I'm working on this page: http://www.insidemarketblog.com/test-4/
You'll see that the word "test" is in the div floated left, and the image is in the div floated right.
If you resize it, you'll see the div floated left goes on top, and the div floated right goes below.
How can you invert that order? So that the div floated left goes BELOW the div floated right. Nothing I do seems to work.
HTML:
<div class="main_header">
<div class="banner_left">
<p>test</p>
</div>
<div class="banner_right">
<img src="http://www.insidemarketblog.com/wp-content/uploads/2014/04/oz_main3.jpg">
</div>
</div>
CSS:
.main_header {
background: none repeat scroll 0 0 #2B3443;
border: 1px solid #FFFFFF;
height: 300px;
margin: 0 auto;
overflow: hidden;
}
.banner_left {
float: left;
}
.banner_right {
float: right;
}
Use CSS property to set the height and width of div and use display property to place div in side-by-side format. float:left; This property is used for those elements(div) that will float on left side. float:right; This property is used for those elements(div) that will float on right side.
The float CSS property places an element on the left or right side of its container, allowing text and inline elements to wrap around it. The element is removed from the normal flow of the page, though still remaining a part of the flow (in contrast to absolute positioning).
The elements after the floating element will flow around it. The elements before the floating element will not be affected. If the image floated to the right, the texts flow around it, to the left and if the image floated to the left, the text flows around it, to the right.
With CSS properties, you can easily put two <div> next to each other in HTML. Use the CSS property float to achieve this. With that, add height:100px and set margin.
You can swap the order of the HTML tags to achieve the desired effect.
Change this:
<div class="main_header">
<div class="banner_left">
<p>test</p>
</div>
<div class="banner_right">
<img src="http://www.insidemarketblog.com/wp-content/uploads/2014/04/oz_main3.jpg">
</div>
</div>
To this:
<div class="main_header">
<div class="banner_right">
<img src="http://www.insidemarketblog.com/wp-content/uploads/2014/04/oz_main3.jpg">
</div>
<div class="banner_left">
<p>test</p>
</div>
</div>
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