CSS styling - how to put these two div boxes adjacent

前端 未结 5 704
春和景丽
春和景丽 2020-12-16 01:55

I have two divs inside a div, I want them both adjacent to each other with a margin of 10px or so separating them but instead they appear one above the other.



        
5条回答
  •  悲哀的现实
    2020-12-16 02:26

    Essentially your #fact and #sortbar divs still have the default 'block' display type which, in simple terms, will put your divs in their own horizontal space. The other answers here show how to use "float" to solve your issue.

    Here's some linkage for you:

    box model: http://www.w3.org/TR/CSS2/box.html
    display css property: http://www.w3schools.com/css/pr_class_display.asp
    float tutorial: http://css.maxdesign.com.au/floatutorial/

    Dan

提交回复
热议问题