left div:fixed:right div fluid - minor issue css

时间:2015-07-10 20:03:51

标签: html css

CSS:

.col-fixed-left {
    /* Fixed Width */
    width: 250px;

    /* Fixed Sidebar */
    position: fixed;
    height: 100%;

    padding: 0px 15px;
    background: #444c63;
}
.col-fluid-right {
    width: 100%;
    padding: 0px 15px;
    background: #ffffff;
}

HTML:

<div class="col-fixed-left">
    <a href="#">Left Side</a>
</div>
<div class="col-fluid-right">
    <a href="#">Right Side</a>
</div>

问题:问题是,右侧是进入左侧div,因为右侧div是固定的。我不想应用margin-left:250px(左边div为250px宽)在屏幕上正确显示正确的div文本。我需要一个很好的解决方案。

jsfiddle

1 个答案:

答案 0 :(得分:0)

&#13;
&#13;
.col-fixed-left {
	/* Fixed Width */
	width: 250px;

	/* Fixed Sidebar */
	position: fixed;
	height: 100%;

	padding: 0px 15px;
	background: #444c63;
}
.col-fluid-right {
	width: 250px;
	padding: 0px 15px;
	background: #ddd;
    position: fixed;
    left:250px;
    height: 100%;
}
&#13;
<div class="col-fixed-left">
    <a href="#">Left Side</a>
</div>
<div class="col-fluid-right">
    <a href="#">Right Side</a>
</div>
&#13;
&#13;
&#13;

http://jsfiddle.net/bt1h68bv/2/

试试这个问题。