頁面布局 - Layout

固定布局

.container 類用于固定寬度并支持響應式布局的容器。注意,由于 padding 等屬性的原因,這兩種 容器類不能互相嵌套。

<!-- 導航條部分 -->
<nav id="myNavbar" class="navbar navbar-default navbar-inverse navbar-fixed-top" role="navigation">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbarCollapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">Tutorial Republic</a>
        </div>
        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="navbarCollapse">
            <ul class="nav navbar-nav">
                <li class="active"><a  target="_blank">首頁</a></li>
                <li><a  target="_blank">關于</a></li>
                <li><a  target="_blank">聯系</a></li>
            </ul>
        </div>
    </div>
</nav>


<!-- 主體布局容器 -->
<div class="container">

    <!-- 巨幕部分 -->
    <div class="jumbotron">
        <h1>學習如何創建網頁</h1>
        <p>In today's world internet is the most popular way of connecting with the people. At <a  target="_blank">tutorialrepublic.com</a> you will learn the essential of web development technologies along with real life practice example, so that you can create your own website to connect with the people around the world.</p>
        <p><a  target="_blank" class="btn btn-success btn-lg">立即開始</a></p>
    </div>

    <!-- 三分列簡介 -->
    <div class="row">
        <div class="col-xs-4">
            <h2>HTML</h2>
            <p>HTML is a markup language that is used for creating web pages. The HTML tutorial section will help you understand the basics of HTML, so that you can create your own web pages or website.</p>
            <p><a  target="_blank" class="btn btn-success">Learn More ?</a></p>
        </div>
        <div class="col-xs-4">
            <h2>CSS</h2>
            <p>CSS is used for describing the presentation of web pages. The CSS tutorial section will help you learn the essentials of CSS, so that you can fine control the style and layout of your HTML document.</p>
            <p><a  target="_blank" class="btn btn-success">Learn More ?</a></p>
        </div>
        <div class="col-xs-4">
            <h2>Bootstrap</h2>
            <p>Bootstrap is a powerful front-end framework for faster and easier web development. The Bootstrap tutorial section will help you learn the techniques of Bootstrap so that you can quickly create your own website.</p>
            <p><a  target="_blank" class="btn btn-success">Learn More ?</a></p>
        </div>
    </div>

    <!-- 頁腳 -->
    <hr>
    <div class="row">
        <div class="col-xs-12">
            <footer>
                <p>? Copyright 2013 Tutorial Republic</p>
            </footer>
        </div>
    </div>
</div>

01.PNG

流式布局

100% 寬度,占據全部視口(viewport)的容器。

<!-- 導航條 -->
<nav id="myNavbar" class="navbar navbar-default navbar-inverse navbar-fixed-top" role="navigation">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbarCollapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">Tutorial Republic</a>
        </div>
        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="navbarCollapse">
            <ul class="nav navbar-nav">
                <li class="active"><a  target="_blank">Home</a></li>
                <li><a  target="_blank">About</a></li>
                <li><a  target="_blank">Contact</a></li>
            </ul>
        </div>
    </div>
</nav>


<!-- 流式布局巨幕 -->
<div class="jumbotron">
    <div class="container-fluid">
        <h1>Learn to Create Websites</h1>
        <p>In today's world internet is the most popular way of connecting with the people. At <a  target="_blank">tutorialrepublic.com</a> you will learn the essential of web development technologies along with real life practice example, so that you can create your own website to connect with the people around the world.</p>
        <p><a  target="_blank" class="btn btn-success btn-lg">Get started today</a></p>
    </div>
</div>


<!-- 流式布局主體 -->
<div class="container-fluid">

    <!-- 三列 -->
    <div class="row">
        <div class="col-xs-4">
            <h2>HTML</h2>
            <p>HTML is a markup language that is used for creating web pages. The HTML tutorial section will help you understand the basics of HTML, so that you can create your own web pages or website.</p>
            <p><a  target="_blank" class="btn btn-success">Learn More ?</a></p>
        </div>
        <div class="col-xs-4">
            <h2>CSS</h2>
            <p>CSS is used for describing the presentation of web pages. The CSS tutorial section will help you learn the essentials of CSS, so that you can fine control the style and layout of your HTML document.</p>
            <p><a  target="_blank" class="btn btn-success">Learn More ?</a></p>
        </div>
        <div class="col-xs-4">
            <h2>Bootstrap</h2>
            <p>Bootstrap is a powerful front-end framework for faster and easier web development. The Bootstrap tutorial section will help you learn the techniques of Bootstrap so that you can create web your own website.</p>
            <p><a  target="_blank" class="btn btn-success">Learn More ?</a></p>
        </div>
    </div>

    <!-- 版權信息 -->
    <hr>
    <div class="row">
        <div class="col-xs-12">
            <footer>
                <p>? Copyright 2013 Tutorial Republic</p>
            </footer>
        </div>
    </div>
</div>
02.PNG

響應式布局

行列數目根據屏幕大小自動調整

<!-- 導航條部分 -->
<nav id="myNavbar" class="navbar navbar-default navbar-inverse navbar-fixed-top" role="navigation">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbarCollapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">Tutorial Republic</a>
        </div>
        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="navbarCollapse">
            <ul class="nav navbar-nav">
                <li class="active"><a  target="_blank">Home</a></li>
                <li><a  target="_blank">About</a></li>
                <li><a  target="_blank">Contact</a></li>
            </ul>
        </div>
    </div>
</nav>

<!-- 固定寬度布局 -->
<div class="container">

    <!-- 巨幕 -->
    <div class="jumbotron">
        <h1>Learn to Create Websites</h1>
        <p>In today's world internet is the most popular way of connecting with the people. At <a  target="_blank">tutorialrepublic.com</a> you will learn the essential of web development technologies along with real life practice example, so that you can create your own website to connect with the people around the world.</p>
        <p><a  target="_blank" class="btn btn-success btn-lg">Get started today</a></p>
    </div>

    <!-- 響應式一行多列 -->
    <div class="row">
        <div class="col-sm-6 col-md-4 col-lg-2">
            <h2>HTML</h2>
            <p>HTML is a markup language that is used for creating web pages. The HTML tutorial section will help you understand the basics of HTML, so that you can create your own web pages or website.</p>
            <p><a  target="_blank" class="btn btn-success">Learn More ?</a></p>
        </div>
        <div class="col-sm-6 col-md-4 col-lg-2">
            <h2>CSS</h2>
            <p>CSS is used for describing the presentation of web pages. The CSS tutorial section will help you learn the essentials of CSS, so that you can fine control the style and layout of your HTML document.</p>
            <p><a  target="_blank" class="btn btn-success">Learn More ?</a></p>
        </div>
        <div class="clearfix visible-sm-block"></div>
        <div class="col-sm-6 col-md-4 col-lg-2">
            <h2>Bootstrap</h2>
            <p>Bootstrap is a powerful front-end framework for faster and easier web development. The Bootstrap tutorial section will help you learn the techniques of Bootstrap so that you can create web your own website with much less efforts.</p>
            <p><a  target="_blank" class="btn btn-success">Learn More ?</a></p>
        </div>
        <div class="clearfix visible-md-block"></div>
        <div class="col-sm-6 col-md-4 col-lg-2">
            <h2>References</h2>
            <p>The references section outlines all the standard HTML tags and CSS properties along with other useful references such as color names and values, symbols and character entities, web safe fonts, language codes, HTTP messages and much more.</p>
            <p><a  target="_blank" class="btn btn-success">Learn More ?</a></p>
        </div>
        <div class="clearfix visible-sm-block"></div>
        <div class="col-sm-6 col-md-4 col-lg-2">
            <h2>Examples</h2>
            <p>The examples section encloses an extensive collection of examples on various topic that you can try and test yourself using online HTML editor.</p>
            <p><a  target="_blank" class="btn btn-success">Learn More ?</a></p>
        </div>
        <div class="col-sm-6 col-md-4 col-lg-2">
            <h2>FAQ</h2>
            <p>The collection of Frequently Asked Questions (FAQ) provides brief answers to many common questions related to web design and development.</p>
            <p><a  target="_blank" class="btn btn-success">Learn More ?</a></p>
        </div>
    </div>

    <!-- 頁腳 -->
    <hr>
    <div class="row">
        <div class="col-sm-12">
            <footer>
                <p>? Copyright 2013 Tutorial Republic</p>
            </footer>
        </div>
    </div>
</div>

03.PNG
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容