html - 设置 div 的宽度直到浏览器端

标签 html css

我从两个例子开始:

13"macbook pro: macscreen 21"飞利浦显示器 philipscreen

是否可以使用 position:fixed 为父元素设置全宽,但对于子元素设置宽度直到浏览器站点,所以所有尺寸的文本都将到浏览器站点或最大宽度.

CSS:

div#wrapper{
    width: 100%;
    height: 100%;
    padding-top: 70px;
}

header#left-panel, header#right-panel{
    background: none repeat scroll 0 0 #000000;
    min-height: 40px;
    padding: 10px;
    opacity: 0.8;
}

header#left-panel{
    width: 185px;
    position: fixed;
}

header#right-panel{
    /*width: 100%;*/ /*here is the problem*/
    left: 755px;
    position: fixed;
}

HTML:

<body>
    <div id="wrapper">
        <header id="left-panel">
            <section id="contacts">
            </section>
        </header>
        <header id="right-panel">
            <section id="comments">
                <div>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>
                <div style="float:right">Lorem ipsum</div>
            </section>
        </header>
    </div>
</body>

最佳答案

header#right-panel 元素上使用 right:0

您可以在 this jsFiddle 上试用它.

关于html - 设置 div 的宽度直到浏览器端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14914523/

相关文章:

javascript - 无法设置未定义的属性(输入 [文本] 值)

javascript - 如何在某个点(75%)开始动画?

html - 如何关闭 HTML5 离线缓存

html - CSS 百分比高度无效

javascript - 不使用 DIV "onclick()"

html - 叠加多个图像

html - 无法修复的 Bootstrap 框/边框

css - 创建 5 个 DIV,中间有 1 个 DIV

html - 消除滚动条

html - 调整大小时 IE10 背景图像伪像