<div class="container"> <div class="row"> <div class="col-md-3"><h2>XOOPS 網站架設</h2></div> <div class="col-md-3"><h2>XOOPS 模組開發</h2></div> <div class="col-md-3"><h2>XOOPS 佈景設計</h2></div> <div class="col-md-3"><h2>XOOPS 維護升級</h2></div> </div> </div>
|
手機 (<768px) |
平板 (≧768px) |
桌面顯示器 (≧992px) |
大屏幕 (≧1200px) |
---|---|---|---|---|
容器最大寬度 |
None (自動) |
750px |
970px |
1170px |
類前綴 |
.col-xs- |
.col-sm- |
.col-md- |
.col-lg- |
每欄欄寬 |
自動 |
~62px |
~81px |
~97px |
<div class="col-md-3 col-sm-6"><h2>XOOPS 網站架設</h2></div>
<div class="clearfix visible-sm-block"></div>
<div class="row"> <div class="col-md-6 col-md-push-6">文字</div> <div class="col-md-6 col-md-pull-6">圖片</div> </div>
@font-face { font-family: myfont; src: url('setofont.ttf'); }
<form action="#" class="form-horizontal" role="form"> <div class="form-group"> <label class="col-sm-2 control-label">標籤</label> <div class="col-sm-10"> <input type="text" class="form-control"> </div> </div> </form>
<div class="form-group has-success has-feedback"> <label class="col-sm-2 control-label">姓名:</label> <div class="col-sm-10"> <input type="text" name="user_name" class="form-control" placeholder="請輸入姓名"> <span class="glyphicon glyphicon-ok form-control-feedback"></span> </div> </div>
<div class="input-group"> <span class="input-group-addon">關鍵字</span> <input type="text" class="form-control"> <span class="input-group-btn"> <button class="btn btn-primary" type="button">搜尋</button> </span> </div>
<img src="images/header.jpg" alt="logo" class="img-responsive hidden-xs"> <img src="images/header_xs.jpg" alt="logo" class="img-responsive visible-xs-block">
<link href="css/font-awesome.min.css" rel="stylesheet">
<i class="fa fa-desktop fa-5x" aria-hidden="true"></i>
<span class="fa-stack fa-5x"> <i class="fa fa-circle-thin fa-stack-2x text-info"></i> <i class="fa fa-desktop fa-stack-1x"></i> </span>
<span class="label label-primary">標籤內容</span>
<span class="badge">12</span>
<div class="page-header"> <h1>點兩下電腦工作室 <small>只要點兩下滑鼠,這個世界就能連起更多友善的網</small></h1> </div>
<div class="thumbnail"> <img src="圖"> <div class="caption"> <h3>標題</h3> <p>內文</p> </div> </div>
<div class="media"> <div class="media-left"> <a href="#"><img src="圖"></a> </div> <div class="media-body"> <h4 class="media-heading">媒體標題</h4> 內文 </div> </div>
<div class="alert alert-info"> 相關內容 </div>
<div class="well"> 相關內容 </div>
<div class="jumbotron"> <h1>標題</h1> <p>文字</p> </div>
<ul class="list-group"> <li class="list-group-item">列表1</li> <li class="list-group-item">列表2</li> </ul>
<div class="list-group"> <a href="#" class="list-group-item active">選項1</a> <a href="#" class="list-group-item">選項2</a> </div>
<div class="panel panel-primary"> <div class="panel-heading"><h3 class="panel-title">面板標題</h3></div> <div class="panel-body">面板內容</div> <div class="panel-footer">面板註腳</div> </div>
<ul class="nav navbar-nav"> <li><a href="#">首頁</a></li> <li><a href="service">服務項目</a></li> <li><a href="#about">關於我們</a></li> <li><a href="#contact">聯繫我們</a></li> <li><a href="#map">工作室位置</a></li> </ul>
<li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> Page 1 <span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="#">Page 1-1</a></li> </ul> </li>
|
前景色 |
背景色 |
按鈕 |
表格 |
表單 |
標籤 |
警告 |
列表 |
面板 |
---|---|---|---|---|---|---|---|---|---|
muted灰 |
.text-muted |
|
.btn-default |
.active |
|
label-default |
|
|
|
primary深藍 |
.text-primary |
.bg-primary |
.btn-primary |
|
|
label-primary |
|
|
panel-primary |
success綠 |
.text-success |
.bg-success |
.btn-success |
.success |
.has-success |
label-success |
alert-success |
list-group-item-success |
panel-success |
info淺藍 |
.text-info |
.bg-info |
.btn-info |
.info |
|
label-info |
alert-info |
list-group-item-info |
panel-info |
warning橘黃 |
.text-warning |
.bg-warning |
.btn-warning |
.warning |
.has-warning |
label-warning |
alert-warning |
list-group-item-warning |
panel-warning |
danger紅 |
.text-danger |
.bg-danger |
.btn-danger |
.danger |
.has-error |
label-danger |
alert-danger |
list-group-item-danger |
panel-danger |
<nav class="navbar navbar-fixed-top"> <div class="container"> <div class="navbar-header"> 選單標題 </div> 原本<ul>選單 </div> </nav>
若需要修改選項顏色,可自行加入CSS樣式表
/*選單項目*/ ul.nav>li>a { color: white; } /*滑鼠移過選單項目時*/ ul.nav>li>a:hover { background-color: transparent; border-bottom: 3px solid #ff7f00; } /*焦點在項目上時*/ ul.nav>li>a:focus { background-color: transparent; border-bottom: 3px solid red; } /*開啟下拉選單時*/ ul.nav>li.open>a, ul.nav>li.open>a:hover { background-color: transparent; color: yellow; }
若點選選項,卻遮住,可以在標題上方加入空白已避免被固定選單遮住:
.page-header{ padding-top:60px; }
「選單標題」可套用.navbar-brand
<a class="navbar-brand" href="#">點兩下電腦工作室</a>
若要做成自適應選單,則將選單包起來,並給一個ID(id="myNavbar"),搭配.collapse navbar-collapse,利用.navbar-right可以讓選單靠右邊。
而原本標題部份須加上一個切換按鈕button,並設定其啟動事件為data-toggle="collapse",作用目標剛指定的選單ID(data-target="#myNavbar"):
<nav class="navbar navbar-fixed-top" id="navbar-spy"> <div class="container"> <div class="navbar-header"> 選單標題 <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div class="collapse navbar-collapse" id="myNavbar"> <ul class="nav navbar-nav navbar-right"> <li><a href="#">首頁</a></li> ...略... </ul> </div> </div> </nav>
.navbar-toggle .icon-bar{ background-color: #fff; }
<nav class="navbar navbar-fixed-top" id="navbar-spy">
<body data-target="#navbar-spy" data-spy="scroll">
.mini_menu { padding-bottom: 10px; background: #000 url('images/min-header.jpg') top left /cover; border-bottom: 1px solid #156785; box-shadow: 0px 5px 5px -3px rgba(0, 0, 0, 0.4); }
接著加入javascript,讓瀏覽器偵測,一旦有捲動,就套用新的樣式外觀:
<script> $(function() { $(window).scroll(scroll_style); }); function scroll_style() { var window_top = $(window).scrollTop(); if (window_top > 2) { $(".navbar").addClass("mini_menu"); } else { $(".navbar").removeClass("mini_menu"); } } </script>
.parallax { background: #ffffff url('images/bg.jpg') center center/cover no-repeat fixed; min-height: 300px; padding: 30px 0px; }
接著將該樣式套用到div上,並包住 container容器即可。
<div class="parallax"> <div class="container"> </div> </div>