简体   繁体   English

Twitter Bootstrap:固定了顶部标题和侧边栏

[英]Twitter Bootstrap: Fixed top header and sidebar

i'm trying to create a specific layout with Twitter Bootstrap . 我正在尝试使用Twitter Bootstrap创建特定的布局。 Since i am not the CSS guy i can't figure out how to do it or if it's even possible. 由于我不是CSS专家,所以我不知道该怎么做,甚至不可能。

It should look like this: 它看起来应该像这样: 在此处输入图片说明

Maybe you can help me. 也许你可以帮我。

Assuming you want nothing in the top left like your diagram, you could use the following markup... http://jsfiddle.net/abrudtkuhl/JV3bN/ 假设您不需要图表左上方的任何内容,则可以使用以下标记... http://jsfiddle.net/abrudtkuhl/JV3bN/

Note: The markup is based on the assumption you want nothing above the sidebar (See my comment to your question). 注意:标记基于您在侧边栏上方不需要任何内容​​的假设(请参阅我对问题的评论)。 I used the "offset" feature of bootstrap to move the header over. 我使用了引导程序的“偏移”功能来移动标题。

Ex: <div class="span10 offset2"> 例如: <div class="span10 offset2">

Demo: http://jsfiddle.net/abrudtkuhl/JV3bN/embedded/result/ 演示: http : //jsfiddle.net/abrudtkuhl/JV3bN/embedded/result/

Another Note: You have to make a static height to only have the content div scrollable. 另一个注意事项:您必须将静态高度设置为仅使内容div可滚动。 In the example I used 200px as an example. 在示例中,我以200px为例。

<div class="container">
    <div class="row">
        <div class="span10 offset2">
            <div class="page-header">
                <h1>Hello World</h1>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="span2">
            Sidebar
        </div>
        <div id="content" class="span10">
            <h2>Bacon</h2>
            <p>Bresaola pork loin shoulder sausage doner t-bone short ribs pork belly meatloaf shank. Turkey shank shankle shoulder pastrami chicken. Shoulder beef meatball meatloaf boudin turducken pancetta swine hamburger sausage jowl sirloin chuck. Prosciutto frankfurter t-bone corned beef beef capicola bacon chuck salami ribeye. Salami drumstick shankle ribeye jerky. Corned beef leberkas pastrami pork tenderloin bacon brisket flank frankfurter beef ribs fatback tongue swine tri-tip. Flank sirloin t-bone doner, bacon shankle chuck ham.</p>
            <p>Bresaola pork loin shoulder sausage doner t-bone short ribs pork belly meatloaf shank. Turkey shank shankle shoulder pastrami chicken. Shoulder beef meatball meatloaf boudin turducken pancetta swine hamburger sausage jowl sirloin chuck. Prosciutto frankfurter t-bone corned beef beef capicola bacon chuck salami ribeye. Salami drumstick shankle ribeye jerky. Corned beef leberkas pastrami pork tenderloin bacon brisket flank frankfurter beef ribs fatback tongue swine tri-tip. Flank sirloin t-bone doner, bacon shankle chuck ham.</p>
        </div>
    </div>
</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM