What's the proper CSS to achieve this for most browsers?
<!-- TOP 50% --> <div class="top"> <div class="left">img</div> <div class="right">txt</div> </div> <!-- BOT 50% --> <div class="bot"> <div class="left">text</div> <div class="right">img</div> </div>
For anything inside the content div, setting top: 0; will put it right underneath the header. Sometimes the content will be a real table, with its height set to 100%.
It seems like this should be one of the easiest things to understand in CSS. If you want a block-level element to fill any remaining space inside of its parent, then it's simple — just add width: 100% in your CSS declaration for that element, and your problem is solved.
You want a 2 x 2 grid of boxes. Each box is to be 50% of the window in height and width. This is actually much easier than you'd think. You don't need .left
or .right
, you don't need .top
.bot
. All you need is a single class called .row
.
EDIT: You mentioned in comments that you want the width fixed at 1600px;
We just need to add width
to body
.
<!-- TOP 50% --> <div class="row"> <div>img</div> <div>txt</div> </div> <!-- BOT 50% --> <div class="row"> <div>text</div> <div>img</div> </div>
html,body { padding:0; margin:0; height:100%; } body { width:1600px; } .row { width:100%; height:50%; } .row div { width:50%; height:100%; float:left; }
This is from the example below, but I've added colors to make it easier to see.
Edit: The Fiddle has changed to include width. My screenshot is before the width, to demonstrate. It'll look a lot wider, because of the fixed width.
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