HTML CSS examples for CSS Layout:2 Column
2 columns layout with em-width separator in the middle
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> body {<!-- w w w. jav a2s .c o m--> padding: 20px; } .container { overflow: hidden; margin-bottom:40px; } .container .b { float:right; background-color: green; width:50%; text-indent:0.5em; position:relative; } .container .b:after{ content:""; position:absolute; top:0; left:0; bottom:0; width:0.5em; background:red; } .container .a{ border-right: 0.5em solid gray; overflow: hidden; background-color: yellow; } .container2 .b { float:right; background-color: green; width:50%; position:relative; text-indent:0.2em; } .container2 .b:after{ content:""; position:absolute; top:0; left:0; bottom:0; width:0.2em; background:red; } .container2 .a{ border-right: 0.2em solid gray; overflow: hidden; background-color: yellow; } </style> </head> <body> <div class="container"> <div class="b"> Column B </div> <div class="a"> Column A </div> </div> <div class="container2"> <div class="b"> Column B </div> <div class="a"> Column A </div> </div> <script type="text/javascript"> </script> </body> </html>