-2

我想添加一个固定的侧边栏,如下图所示。

在此处输入图像描述

这怎么可能?

Appreciate any suggestion.

解决方案

4

4 回答 4

2

used to this

fixed position

.sidebar{
position:fixed;
left:0;
width:250px; // width change to according your left bar side
top:0;
bottom:0;
}

Demo

于 2013-03-22T11:55:05.843 回答
1
.SomeClass { position: fixed }
于 2013-03-22T11:55:25.467 回答
1

这个小提琴可能会解决你的问题,右栏是灵活的,左栏是固定的

http://jsfiddle.net/R5TZH/

<div class="container">
         <div class="columns">
         <div class="right-col">
             Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum
        </div>    
     </div>  
    <div class="left-col">
                <a class="selected" href="#">05 <br><strong>Today</strong></a>
                <a href="#">06 <br><strong>TOM</strong></a>
                <a href="#">07 <br><strong>MON</strong></a>
                <a href="#">08 <br><strong>TUE</strong></a>
                <a href="#">09 <br><strong>WED</strong></a>
                <a href="#">08 <br><strong>THU</strong></a>
                <a href="#">09 <br><strong>FRI</strong></a>
    </div>  
</div>      

CSS:

.container {
    width: 100%;
}

.left-col {
    background: none repeat scroll 0 0 #434345;
    float: left;
    margin-left: -100%;
    padding: 10px;
    width: 80px;
}

.left-col a {
    background: none repeat scroll 0 0 #FFFFFF;
    border-radius: 10px 10px 10px 10px;
    color: #000000;
    float: left;
    font-size: 18px;
    height: 50px;
    margin-bottom: 10px;
    padding: 10px;
    text-align: center;
    width: 60px;
}


.columns {
    float: left;
    width: 100%;
}


.right-col {
    margin-left: 100px;
    background:red;
    height:400px;
}
于 2013-03-22T13:17:44.700 回答
0

用于固定侧栏,样式

position:fixed;

这可以,但不是在 chrome 中,所以你可以使用它

position:absolute;
top:0;
left:0;
bottom:0;
width:180px;// you may change as per your requirement

这适用于所有浏览器:)

编辑:使用内容 div 更新小提琴

http://jsfiddle.net/MarmeeK/nkprH/5/

我希望这会做,更多的答案发布你的一些工作细节,谢谢

于 2013-03-22T12:00:04.943 回答