Setting a div's height in HTML with CSS

前端 未结 14 959
无人共我
无人共我 2020-12-05 09:36

I am trying to lay out a table-like page with two columns. I want the rightmost column to dock to the right of the page, and this column should have a distinct background c

14条回答
  •  天涯浪人
    2020-12-05 10:18

    I had the same problem on my site (shameless plug).

    I had the nav section "float: right" and the main body of the page has a background image about 250px across aligned to the right and "repeat-y". I then added something with "clear: both" to it. Here is the W3Schools and the CSS clear property.

    I placed the clear at the bottom of the "page" classed div. My page source looks something like this.

    body
     -> header (big blue banner)
     -> headerNav (green bar at the top)
     -> breadcrumbs (invisible at the moment)
     -> page
         -> navigation (floats to the right)
         -> content (main content)
             -> clear (the quote at the bottom)
             -> footerNav (the green bar at the bottom)
         -> clear (empty but still does something)
     -> footer (blue thing at the bottom)
    

    I hope that helps :)

提交回复
热议问题