Setting a div's height in HTML with CSS

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

    Just trying to help out here so the code is more readable.
    Remember that you can insert code snippets by clicking on the button at the top with "101010". Just enter your code then highlight it and click the button.

    Here is an example:

    <html>
        <body>
        <style type="text/css">
            .rightfloat {
                color: red;
                background-color: #BBBBBB;
                float: right;
                width: 200px;
            }
    
            .left {
                font-size: 20pt;
            }
    
            .separator {
                clear: both;
                width: 100%;
                border-top: 1px solid black;
            }
        </style>
    
    0 讨论(0)
  • 2020-12-05 10:20

    This should work for you: Set the height to 100% in your css for the html and body elements. You can then adjust the height to your needs in the div.

    html {
        height: 100%;
    }
    
    body {
        height: 100%;
    }
    div {
        height: 100%; /* Set Div Height */
    } 
    
    0 讨论(0)
提交回复
热议问题