i have one div with width: 100%; and two other divs are inside it.
+---------- div, width: 100% ----------+
| +-- div1 50% --+ +-- div2 50% --+ |
| | contents | | contents | |
| | | | | |
| +--------------+ +--------------+ |
+--------------------------------------+
now i want to know, if i remove one of those two divs inside the main div for any reason, how other inside div can be automatically 100% ? if i remove div2, how div1 can be 100% automatically?
<div style="width: 100%; " >
<div style="width: 50%; display:inline; float:right; background-color:blue; color: white" >
This is test 1
</div>
<div style="width: 50%; display:inline; float:right; background-color:red" >
This is test 2
</div>
</div>
i mean, i use php , and assume that div2 is a sidebar, i control divs in php, and for example i turn off sidebar, so div2 should not display, i know i can use conditions but i want to know is there any css code to handle this changing width automatically? normally inside the main div are two divs, but in some case it should be one div with width 100%. sorry if my english is not good :(
tnx everyone