开发者

how do adjust right margin when increasing margin-left

开发者 https://www.devze.com 2023-01-12 07:03 出处:网络
I am styling a div that contains 开发者_如何学Pythonthe main content of my web page.The header has it\'s own div and correctly spans the page 100%.

I am styling a div that contains 开发者_如何学Pythonthe main content of my web page. The header has it's own div and correctly spans the page 100%.

I added a margin-left:125px style to the main content div and now the right edge exceeds 100% of the browser width.

How do I compensate for the this? Thanks


I'm not really sure if its what you are trying to do, but:

    <style type="text/css">
        #Header {
            background: red;
        }

        #Content {
            margin-left: 125px;
            background: green;
        }
    </style>
    <div id="Header">
        &nbsp;
    </div>
    <div id="Content">
        &nbsp;
    </div>

You don't need width:100%, because block level elements will automatically take all the width they can, unless specified otherwise.

0

精彩评论

暂无评论...
验证码 换一张
取 消