I\'ve got two div containers.
Whilst one needs to be a specific width, I need to adjust it, so that, the other div takes up the rest of the space. Is there any way I
If you can flip the order in the source code, you can do it like this:
HTML:
// needs to be 250px
CSS:
.right {
width: 250px;
float: right;
}
An example: http://jsfiddle.net/blineberry/VHcPT/
Add a container and you can do it with your current source code order and absolute positioning:
HTML:
CSS:
#container {
/* set a width %, ems, px, whatever */
position: relative;
}
.left {
position: absolute;
top: 0;
left: 0;
right: 250px;
}
.right {
position: absolute;
background: red;
width: 250px;
top: 0;
right: 0;
}
Here, the .left
div gets an implicitly set width from the top
, left
, and right
styles that allows it to fill the remaining space in #container
.
Example: http://jsfiddle.net/blineberry/VHcPT/3/