twitter-bootstrap 如何使用 twitter bootstrap 制作 2(框架?)?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26717892/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 21:48:16  来源:igfitidea点击:

How to make 2 (frame?) using twitter bootstrap?

javascriptjqueryhtmlcsstwitter-bootstrap

提问by Mae Zi

enter image description herethis is what I started to make in twitter bootstrap.. I am new using this.. Can you help me to make a 2 split page inside the html that the menu in header when scrolled down will not disappear .. I made html codes below Thanks!!

在此处输入图片说明这就是我开始在 twitter bootstrap 中做的..我是新人使用这个..你能帮我在 html 中创建一个 2 个拆分页面,向下滚动时标题中的菜单不会消失..我在下面制作了 html 代码谢谢!!

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta charset="utf-8">
        <title>Teacher</title>
        <link href="css/bootstrap.min.css" rel="stylesheet">
        <style type="text/css">`
            /* CSS used here will be applied after bootstrap.css */
            body{
            margin-top: 1px;
            }
            .divide-nav{
            height: 80px;
            background-color: #428bca;
            }
            .divide-text{
            color:#fff;
            line-height: 20px;
            font-size:20px;
            padding: 15px 0;
            }
            .affix {
            top: 1px;
            width:100%;
            }
            .filler{
            min-height: 2000px;
            }
            .navbar-form {
            padding-left: 0;
            }
            .navbar-collapse{
            padding-left:0; 
            }
            #footer {
            height: 60px;
            background-color: #f5f5f5;
            }
        </style>
        <style type="text/css"></style>
    </head>
    <!-- HTML code from Bootply.com editor -->
    <body>
        <div class="divide-nav">
            <div class="container">
                <p class="divide-text"><img src ="musar-logo.png"></p>
            </div>
        </div>
        <nav class="navbar navbar-default navbar-lower affix-top" role="navigation">
            <div class="container">
                <div class="collapse navbar-collapse collapse-buttons">
                    <form class="navbar-form navbar-left" role="search">
                        <button class="btn btn-success">Button</button>
                        <button class="btn btn-default">Button</button>
                        <button class="btn btn-default">Button</button>
                        <button class="btn btn-default">Button</button>
                    </form>
                </div>
            </div>
        </nav>
        <frameset cols="25%,*,25%">
            <frame src="1.html">
            <frame src="it.html">
            <frame src="it.html">
        </frameset>
        <div class="container">
            <div class="row">
                <div class="filler"></div>
            </div>
        </div>
        <div class="modal-body row">
            <div class="col-md-6">
                <!-- Your first column here -->
            </div>
            <div class="col-md-6">
                <!-- Your second column here -->
            </div>
        </div>
        <script type="text/javascript" src="js/jquery.min.js"></script>
        <script type="text/javascript" src="js/bootstrap.min.js"></script>
        <!-- JavaScript jQuery code from Bootply.com editor  -->
        <script type="text/javascript">
            $(document).ready(function() {

                $('.navbar-lower').affix({
            offset: {top: 50}
            });

            });

        </script>
        <div id="footer">
            <div class="container">
                <p class="text-muted credit">Footer Trial</a></p>
            </div>
        </div>
    </body>
</html>

回答by Richard Czechowski

Expanding on the above answer, I put up a fiddle. http://jsfiddle.net/w7s2o90e/1/

扩展上述答案,我提出了一个小提琴。 http://jsfiddle.net/w7s2o90e/1/

        <title>Teacher</title>
    <!-- HTML code from Bootply.com editor -->
    <body>
        <div class="divide-nav">
            <div class="container">
                <p class="divide-text"><img src ="musar-logo.png"></p>
            </div>
        </div>
        <nav class="navbar navbar-default navbar-lower affix-top" role="navigation">
            <div class="container">
                <div class="collapse navbar-collapse collapse-buttons">
                    <form class="navbar-form navbar-left" role="search">
                        <button class="btn btn-success">Button</button>
                        <button class="btn btn-default">Button</button>
                        <button class="btn btn-default">Button</button>
                        <button class="btn btn-default">Button</button>
                    </form>
                </div>
            </div>
        </nav>
        <frameset cols="25%,*,25%">
            <frame src="1.html">
            <frame src="it.html">
            <frame src="it.html">
        </frameset>
 <div class="row-fluid">
   <div id="left" class="col-sm-4">
     <div id="allYourContent" class= "col-sm-12">
    </div>
     </div>
  <div id="right" class="col-sm-8">
    <!--Body content-->
  </div>
 </div>
</div>
        <div id="footer">
            <div class="container">
                <p class="text-muted credit">Footer Trial</a></p>
            </div>
        </div>
    </body>

If you want a fixed size and the left side to scroll use

如果你想要一个固定的大小和左侧滚动使用

overflow:scroll   

in your css.

在你的 css 中。

The two columns from above work, but until you add content or a size to them, they won't show up (see fiddle). I used

上面的两列有效,但在向它们添加内容或大小之前,它们不会显示(参见小提琴)。我用了

class="col-sm-4" & class="col-sm-8"

instead of "span" but it should be similar.

而不是“跨度”,但它应该是相似的。

I didn't edit all of your code, but it looks generally like what you were trying to achieve.

我没有编辑您的所有代码,但它看起来与您想要实现的大致相同。

回答by jsdev

You can make a two grid layout to achieve this. You can find more documentation on this at http://getbootstrap.com/2.3.2/scaffolding.html

您可以制作两个网格布局来实现这一点。您可以在http://getbootstrap.com/2.3.2/scaffolding.html上找到更多相关文档

<div class="container-fluid">
 <div class="row-fluid">
   <div class="span2">
     <!--Sidebar content-->
    </div>
  <div class="span10">
    <!--Body content-->
  </div>
 </div>
</div>