├─ /weijinsuo/ ··················· 项目所在目录
└─┬─ /css/ ······················· 我们自己的CSS文件
├─ /font/ ······················ 使用到的字体文件
├─ /img/ ······················· 使用到的图片文件
├─ /js/ ························ 自己写的JS脚步
├─ /lib/ ······················· 从第三方下载回来的库【只用不改】
├─ /favicon.ico ················ 站点图标
└─ /index.html ················· 入口文件
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>页面标题title>
head>
<body>
body>
html>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0">
html中插入视口设置,可以通过emmet meta:vp 插入
<meta http-equiv="X-UA-Compatible" content="IE=edge">
html中插入兼容模式设置,可以通过emmet meta:compat 插入
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
html中插入图标链接,可以通过emmet link:favicon 插入
<link rel="stylesheet" href="bootstrap.css">
<link rel="stylesheet" href="my.css">
...
<script src="jquery.js">script>
<script src="bootstrap.js">script>
<script src="my.js">script>
body{
font-family: "Helvetica Neue",
Helvetica,
Microsoft Yahei,
Hiragino Sans GB,
WenQuanYi Micro Hei,
sans-serif;
}
先划分好页面中的大容器,然后在具体看每一个容器中单独的情况
<body>
<header>header>
<section>section>
<section>section>
<section>section>
<section>section>
<section>section>
<section>section>
<footer>footer>
body>
<header>
<div class="topbar">div>
header>
<div class="topbar">
<div class="container">
div>
div>
<div class="container">
<div class="row">div>
div>
<div class="row">
<div class="col-md-2 text-center">div>
<div class="col-md-5 text-center">div>
<div class="col-md-2 text-center">div>
<div class="col-md-3 text-center">div>
div>
此处顶部通栏已经被划分成四列
text-center的作用就是让内部内容居中显示
@font-face {
font-family: 'itcast';
src: url('../font/MiFie-Web-Font.eot') format('embedded-opentype'), url('../font/MiFie-Web-Font.svg') format('svg'), url('../font/MiFie-Web-Font.ttf') format('truetype'), url('../font/MiFie-Web-Font.woff') format('woff');
}
[class^="icon-"],
[class*=" icon-"] {
/*注意上面选择器中间的空格*/
/*我们使用的名为itcast的字体就是上面的@font-face的方式声明的*/
font-family: itcast;
font-style: normal;
}
.icon-mobilephone::before{
content: '\e908';
}
<div class="col-md-2 text-center">
<a class="mobile-link" href="#">
<i class="icon-mobile">i>
<span>手机微金所span>
<i class="glyphicon glyphicon-chevron-down">i>
<img src="..." alt="">
a>
div>
.mobile-link:hover > img {
display: block;
}
.btn-itcast {
color: #ffffff;
background-color: #E92322;
border-color: #DB3B43;
}
.btn-itcast:hover,
.btn-itcast:focus,
.btn-itcast:active,
.btn-itcast.active,
.open .dropdown-toggle.btn-itcast {
color: #ffffff;
background-color: #E92322;
border-color: #DB3B43;
}
.btn-itcast:active,
.btn-itcast.active,
.open .dropdown-toggle.btn-itcast {
background-image: none;
}
.btn-itcast.disabled,
.btn-itcast[disabled],
fieldset[disabled] .btn-itcast,
.btn-itcast.disabled:hover,
.btn-itcast[disabled]:hover,
fieldset[disabled] .btn-itcast:hover,
.btn-itcast.disabled:focus,
.btn-itcast[disabled]:focus,
fieldset[disabled] .btn-itcast:focus,
.btn-itcast.disabled:active,
.btn-itcast[disabled]:active,
fieldset[disabled] .btn-itcast:active,
.btn-itcast.disabled.active,
.btn-itcast[disabled].active,
fieldset[disabled] .btn-itcast.active {
background-color: #E92322;
border-color: #DB3B43;
}
.btn-itcast .badge {
color: #E92322;
background-color: #ffffff;
}
<div class="topbar hidden-xs hidden-sm">div>
或者
<div class="topbar visible-md visible-lg">div>
<nav class="navbar navbar-itcast navbar-static-top">
<div class="container">
<div class="navbar-header">
<button id="btn" type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#nav_list" aria-expanded="false">
<span class="sr-only">切换菜单span>
<span class="icon-bar">span>
<span class="icon-bar">span>
<span class="icon-bar">span>
button>
<a class="navbar-brand" href="#">
<i class="icon-icon">i>
<i class="icon-logo">i>
a>
div>
<div id="nav_list" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">我要投资a>li>
<li><a href="#">我要借款a>li>
<li><a href="#">平台介绍a>li>
<li><a href="#">新手专区a>li>
<li><a href="#">最新动态a>li>
<li><a href="#">微论坛a>li>
ul>
<ul class="nav navbar-nav navbar-right hidden-sm">
<li><a href="#">个人中心a>li>
ul>
div>
div>
nav>
.navbar-itcast{
...
}
...具体代码参考navbar-default实现即可
对于Bootstrap的JS插件,我们只需要将文档实例中的代码粘到我们自己的代码中
让后作出相应的样式调整
<div id="轮播图的ID" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#轮播图的ID" data-slide-to="0" class="active">li>
<li data-target="#轮播图的ID" data-slide-to="1">li>
ol>
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="example.jpg" alt="示例图片">
<div class="carousel-caption">
div>
div>
<div class="item">
div>
div>
<a class="left carousel-control" href="#轮播图的ID" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true">span>
<span class="sr-only">上一张span>
a>
<a class="right carousel-control" href="#轮播图的ID" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true">span>
<span class="sr-only">下一张span>
a>
div>
// 获取屏幕宽度
var windowWidth = $(window).width();
// 判断屏幕属于大还是小
var isSmallScreen = windowWidth < 768;
// 根据大小为界面上的每一张轮播图设置背景
// $('#main_ad > .carousel-inner > .item') // 获取到的是一个DOM数组(多个元素)
$('#main_ad > .carousel-inner > .item').each(function(i, item) {
// 因为拿到是DOM对象 需要转换
var $item = $(item);
// var imgSrc = $item.data(isSmallScreen ? 'image-xs' : 'image-lg');
var imgSrc =
isSmallScreen ? $item.data('image-xs') : $item.data('image-lg');
// 设置背景图片
$item.css('backgroundImage', 'url("' + imgSrc + '")');
});
function 窗口变化后执行的函数名(){
// 具体的操作
}
$(window).on('resize', 窗口变化后执行的函数名);
...
$(window).on('resize', 窗口变化后执行的函数名).trigger('resize');
// 因为我们需要小图时 尺寸等比例变化,所以小图时我们使用img方式
if (isSmallScreen) {
$item.html(''" alt="" />');
} else {
$item.empty();
}
#main_ad > .carousel-inner > .item {
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
}
@media (min-width: 768px) {
#main_ad > .carousel-inner > .item {
height: 410px;
}
}
#main_ad > .carousel-inner > .item > img {
width: 100%;
}
<div class="col-sm-6 col-md-4">
div>
<a href="#">
<div class="media">
<div class="media-left">
<i class="icon-uniE907">i>
div>
<div class="media-body">
<h4 class="media-heading">支付交易保障h4>
<p>银联支付全称保证支付安全p>
div>
div>
a>
选项卡功能可以通过Bootstrap中提供的相应组件实现
http://v3.bootcss.com/javascript/#tabs
<div class="container">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#第一个标签的ID" aria-controls="第一个标签的ID" role="tab" data-toggle="tab">标签页1a>li>
<li role="presentation"><a href="#第二个标签的ID" aria-controls="第二个标签的ID" role="tab" data-toggle="tab">标签页2a>li>
ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="第一个标签的ID">
div>
<div role="tabpanel" class="tab-pane" id="第二个标签的ID">...div>
div>
div>
.panel-czbk > .panel-heading::before,
.panel-czbk > .panel-heading::after {
content: ' ';
width: 16px;
height: 16px;
border-radius: 8px;
background-color: #f0f0f0;
position: absolute;
}
.panel-czbk > .panel-heading::before {
top: -8px;
left: -8px;
}
.panel-czbk > .panel-heading::after {
bottom: -8px;
left: -8px;
box-shadow: 0 2px 1px #ccc inset;
}
http://www.cnblogs.com/micua/p/bootstrap-version4-alpha.html