how to show one element under the other one?


Tags: html,css

Problem :

I have a problem with my CSS in my html file.

I have two div's:

<div class="one">
    ....
</div>
<br>
<div class="two">
    ....
</div>

with the following css:

.one 
{
    position: relative;
    float: left;
}
.two 
{
    position: relative;
    float: left;
}

the problem: the first div is very big and the second should be under the first but it is not, its right from the first one.

how to fix this, so that the second div is under the first one starting at the left site of the page?



Solution :

A nice explanation for Why clear?

Add clear: left for .two

.two {
clear: left
}

Check this JSFiddle


    CSS Howto..

    How to make CSS menu stay on top

    CSS: How to define a centered div with endless vertical borders and an initial height of 100%?

    How to exclude specific the form from the css applied to body [duplicate]

    How to center icons in div consistently? [duplicate]

    In IE6, how to implement a:hover?

    HTML+CSS: How to add shadow (as image) to image?

    How can i align the text in center of a row in css?

    How does one creates inner and outer triangles on a div with pure CSS?

    How to create a circle with divided borders in CSS and Javascript?

    Foundation 6: how to handle images that has an vertical overflow within one row?

    How to set CSS hover on input

    How to override inline style dynamically?

    How to remove unwanted white space in CSS

    How to change a vertical css menu to a horizontal one

    Writing “$('#dialog').modal('show');” as plain javascript?

    How to reduce my code in both jQuery and CSS

    How to move image in div with CSS?

    How do I set a CSS width from a javascript function result?

    How to create both-sided dotted line around a title? [duplicate]

    How to rotate Images in HTML using CSS in FireFox..? [duplicate]

    How can I increase the size of twitter bootstrap carousel navigation arrows

    How are CSS elements combined

    How to place kartik typeahead above text input

    Dompdf: how to get background image to show on first page only

    How to change div border automatically when more children are added to it

    How to make link color change based on location on page?

    Show or hide button text responsively in jQuery Mobile

    How to toggle multiple images in jquery?

    How to add multiple CSS classes to an single array

    How to put div block into right screen area using css?