I have a containing div (contentBody) that is N% wide. Within that div I have two other divs, contentLeft and contentRight.
contentLeft is always 205px. I want contentRight to automatically fill the remaining space in contentBody. How can I achieve this?
#div contentLeft{
width:205px;
float:left;
}
#div contentRight{
width:<**100% - 205px**>;
float:left;
}
Edit: Sorry, I meant to write "N%" instead of 100%, this needs to work for a containing area of any percentage or size.
The following should do it:
#contentBody{
width:N%
}
#div contentLeft{
width:205px;
float:left;
}
#div contentRight{
margin-left:205px;
}
the easiest thing to do is to position them both absolutely then set contentleft to the desired with and add margin-left equal to that same width - as follows:
#div contentLeft{
position:absolute;
top:0;
left:0;
width:205px;
}
#div contentRight{
position:absolute;
width:100%;
top:0;
left:0;
margin-left:205px;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With