I have two div (on the side) inside a parent div, I want the correct div remaining space 100 % I.e. 100% - 200 px) and should always remain next to left vent (not below left part):
& lt; Div id = "wrapper" style = "width: 100%;" & gt; & Lt; Div id = "left" style = "background-color: blue; height: 100px; float: left; width: 200px;" & Gt; & Lt; / Div & gt; & Lt; Div id = "right" style = "background-color: aqua; height: 100px; float: left; width: 100%;" & Gt; & Lt; / Div & gt; & Lt; Div style = "clear: both;" & Gt; & Lt; / Div & gt; & Lt; / Div & gt;
You only have a fixed width column, it Float left and this is it. For the second column, do not specify float and width; It ensures that it is 100% wide but you have to add a left edge; Otherwise, the second column, the initial column e.g.
- Behind the blue background (to see the meaning of blue to close the blue background)
- If the second column is more than the first one Goes, additional content will appear below the first column.
& lt; Div id = "wrapper" & gt; & Lt; Div id = "left" style = "background-color: blue; height: 100px; float: left; width: 200px;" & Gt; & Lt; / Div & gt; & Lt; Div id = "right" style = "background-color: aqua; height: 100px; margin-left: 200px;" & Gt; & Lt; / Div & gt; & Lt; Div style = "clear: both;" & Gt; & Lt; / Div & gt; & Lt; / Div & gt;
Comments
Post a Comment