Setting a div's height in HTML with CSS

前端 未结 14 942
无人共我
无人共我 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:17

    A 2 column layout is a little bit tough to get working in CSS (at least until CSS3 is practical.)

    Floating left and right will work to a point, but it won't allow you to extend the background. To make backgrounds stay solid, you'll have to implement a technique known as "faux columns," which basically means your columns themselves won't have a background image. Your 2 columns will be contained inside of a parent tag. This parent tag is given a background image that contains the 2 column colors you want. Make this background only as big as you need it to (if it is a solid color, only make it 1 pixel high) and have it repeat-y. AListApart has a great walkthrough on what is needed to make it work.

    http://www.alistapart.com/articles/fauxcolumns/

提交回复
热议问题