Bootstrap frame and inconfont, font-awesome use

Bootstrap frame and inconfont, font-awesome use

  iconfont use: https: //www.cnblogs.com/clschao/articles/10387580.html

Bootstrap Introduction

  Twitter Bootstrap front-end framework is based on HTML, CSS, JavaScript open source.

  It is a package for rapid development of Web applications designed a front-end tools.

  It supports responsive layout, and adhere to the mobile device priority after the V3 version.

Copy paste is a shuttle package combinations html \ css \ js code

Why use Bootstrap?

  Before Bootstrap appears:

  Name: repetition, complicated, meaningless (think of a name strenuous)

  Style: duplicate, redundant, non-standard, discord

  Page: confusion, not standardized, discord

  After using Bootstrap: all kinds of names are unified and standardized. Page style uniform, harmonious picture.

Bootstrap Download

  Official address: https: //getbootstrap.com

  Chinese Address: http: //www.bootcss.com/

  We use the V3 version of Bootstrap, we downloaded the Bootstrap for production environments.

Bootstrap environment to build

  Directory Structure:

Copy the code

Copy the code

bootstrap-3.3.7-dist/ 
├── css  // CSS文件
│   ├── bootstrap-theme.css  // Bootstrap主题样式文件,官方提供的,一般不用
│   ├── bootstrap-theme.css.map
│   ├── bootstrap-theme.min.css  // 主题相关样式压缩文件
│   ├── bootstrap-theme.min.css.map
│   ├── bootstrap.css  //引用的时候,引用这一个或者下面那个bootstrap.min.css文件就可以了
│   ├── bootstrap.css.map
│   ├── bootstrap.min.css  // 核心CSS样式压缩文件,其他的文件都是在这个核心文件的基础上加了一些其他的样式
│   └── bootstrap.min.css.map
├── fonts  // 字体文件
│   ├── glyphicons-halflings-regular.eot
│   ├── glyphicons-halflings-regular.svg
│   ├── glyphicons-halflings-regular.ttf
│   ├── glyphicons-halflings-regular.woff
│   └── glyphicons-halflings-regular.woff2
└── js  // JS文件
    ├── bootstrap.js
    ├── bootstrap.min.js  // 核心JS压缩文件
    └── npm.js

Copy the code

Copy the code

  Dependence treatment

  Because some components depend on jQuery Bootstrap, so be sure to download the corresponding version of jQuery files, Bootstrap related components to ensure normal operation.

  Introduction:

    That will extract the downloaded file into the folder under the project directory we can use the

    img

      The theme can delete those you do not the css and other documents.

    Then what can be introduced with a very simple

    img

Bootstrap Global Style

  img

  Typography, buttons, tables, forms, pictures, etc. we used HTML elements, Bootstrap are provided a global style.

  As long as we in the basic HTML elements by setting the class will be able to apply on Bootstrap style, so that our pages more beautiful harmony.

  Foundation forms: a brief look at the structure of

Copy the code

<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">  <!--页面宽度自适应设备的屏幕宽度-->
    <!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
    <title>Bootstrap 101 Template</title>

    <!-- Bootstrap -->
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">

    <!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询(media queries)功能 -->
    <!-- 警告:通过 file:// 协议(就是直接将 html 页面拖拽到浏览器中)访问页面时 Respond.js 不起作用 -->
    <!--[if lt IE 9]>  
      <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/html5shiv.min.js"></script>
      <script src="https://cdn.jsdelivr.net/npm/[email protected]/dest/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
    <h1>你好,世界!</h1>

    <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery,所以必须放在前边) -->
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script>
    <!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"></script>
  </body>
</html>

Copy the code

  img

  End mobile phones want to be able to display the full page, you need to write on

  img

  Using a grid layout when people pay attention to bootstrap the official website which is written requirements: written on in the following years, wrote layout inside the container, inside the column is a row of elements.

    img

    effect:

    img

    If the element does not occupy the inside of the column 12 parts, then the right will be vacated in several widths.

    img

    img

    and also:

    img

  Column offset  

  About Media Inquiries:   

Copy the code

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
        body {
            margin: 0;
        }
        .c1 {
            background-color: red;
            height: 200px;
        }
        /*媒体查询,捕捉显示屏幕的宽度,来显示不同的定制效果*/
        @media screen and (max-width: 700px) {
            .c1 {
                background-color: green;
            }
        }
    </style>
</head>
<body>

<div class="c1">

</div>
</body>
</html>

Copy the code

  Use media queries

Copy the code

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
    <title>Bootstrap 101 Template</title>

    <!-- Bootstrap -->
    <link href="bootstrap/css/bootstrap.css" rel="stylesheet">

    <style>
        #con1{
            /*background-color: red;*/
            /*height: 600px;*/
        }
        .c1{
            background-color: red;
            height: 40px;
        }
        .c2{
            background-color: green;
            height: 40px;
        }
        @media screen and (min-width: 700px) {
            .c1{
                background-color: yellow;
                height: 40px;
            }
            .c2{
                background-color: blue;
                height: 40px;
            }
        }


    </style>

</head>
<body>
<!--<h1>你好,世界!</h1>-->


<!--<div id="con1" class="container"></div>-->
<!--<div id="con1" class="container-fluid">-->
    <!--<div class="row">-->
        <!--<div class="col-md-2 col-xs-2 c1 col-md-offset-1 col-xs-offset-1">-->

        <!--</div>-->
        <!--<div class="col-md-8 col-xs-8 c2">-->

        <!--</div>-->
    <!--</div>-->

<!--</div>-->
<div id="con1" class="container-fluid">
    <div class="row">
        <div class="col-md-2 col-xs-2 c1 col-md-offset-1 col-xs-offset-1">

        </div>
        <div class="col-md-8 col-xs-8 c2">

        </div>
    </div>

</div>





<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery,所以必须放在前边) -->
<script src="jquery.js"></script>
<!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
<script src="bootstrap/js/bootstrap.js"></script>
</body>
</html>

Copy the code

Related title

    title

Copy the code

Copy the code

<h1>一级标题36px</h1>
<h2>二级标题30px</h2>
<h3>三级标题24px</h3>
<h4>四级标题18px</h4>
<h5>五级标题14px</h5>
<h6>六级标题12px</h6>
<!--除了使用h标签,Bootstrap内置了相应的全局样式-->
<!--内联标签应用标题样式-->
<span class="h1">一级标题36px</span>
<span class="h2">二级标题30px</span>
<span class="h3">三级标题24px</span>
<span class="h4">四级标题18px</span>
<span class="h5">五级标题14px</span>
<span class="h6">六级标题12px</span>

Copy the code

Copy the code

    subtitle

<!--一级标题中嵌入小标题-->
<h1>一级标题<small>小标题</small></h1>

Text alignment

<!--文本对齐-->
<p class="text-left">文本左对齐</p>
<p class="text-center">文本居中</p>
<p class="text-right">文本右对齐</p>

Text case

<!--大小写-->
<p class="text-lowercase">Lowercased text.</p>
<p class="text-uppercase">Uppercased text.</p>
<p class="text-capitalize">Capitalized text.</p>

form

Class description
.table-striped Striped table
.table-bordered Table with border
.table-hover Hover color table
.table-condensed Contractionary table
.table-responsive Responsive table

State class

Class description
.active Hover color cell row or the upper set
.success Identify successful or positive action
.info Identify common message or action
.warning Or require the user to identify the warning note
.danger Identify dangerous or potentially negative impact of action

Forms

    Inline Form

    Form state

    With icons of the form

Push button

<a class="btn btn-default" href="#" role="button">Link</a>
<button class="btn btn-default" type="submit">Button</button>
<input class="btn btn-default" type="button" value="Input">
<input class="btn btn-default" type="submit" value="Submit">

    Button Style

Copy the code

Copy the code

<!-- Standard button -->
<button type="button" class="btn btn-default">(默认样式)Default</button>
<!-- Provides extra visual weight and identifies the primary action in a set of buttons -->
<button type="button" class="btn btn-primary">(首选项)Primary</button>
<!-- Indicates a successful or positive action -->
<button type="button" class="btn btn-success">(成功)Success</button>
<!-- Contextual button for informational alert messages -->
<button type="button" class="btn btn-info">(一般信息)Info</button>
<!-- Indicates caution should be taken with this action -->
<button type="button" class="btn btn-warning">(警告)Warning</button>
<!-- Indicates a dangerous or potentially negative action -->
<button type="button" class="btn btn-danger">(危险)Danger</button>
<!-- Deemphasize a button by making it look like a link while maintaining button behavior -->
<button type="button" class="btn btn-link">(链接)Link</button>

Copy the code

Copy the code

    Button Size

Copy the code

Copy the code

<p>
  <button type="button" class="btn btn-primary btn-lg">(大按钮)Large button</button>
  <button type="button" class="btn btn-default btn-lg">(大按钮)Large button</button>
</p>
<p>
  <button type="button" class="btn btn-primary">(默认尺寸)Default button</button>
  <button type="button" class="btn btn-default">(默认尺寸)Default button</button>
</p>
<p>
  <button type="button" class="btn btn-primary btn-sm">(小按钮)Small button</button>
  <button type="button" class="btn btn-default btn-sm">(小按钮)Small button</button>
</p>
<p>
  <button type="button" class="btn btn-primary btn-xs">(超小尺寸)Extra small button</button>
  <button type="button" class="btn btn-default btn-xs">(超小尺寸)Extra small button</button>
</p>

Copy the code

Copy the code

image

<img src="..." class="img-responsive" alt="Responsive image">

    Picture Shape

<img src="..." alt="..." class="img-rounded">
<img src="..." alt="..." class="img-circle">
<img src="..." alt="..." class="img-thumbnail">

Auxiliary class

    Text Color

<p class="text-muted">...</p>
<p class="text-primary">...</p>
<p class="text-success">...</p>
<p class="text-info">...</p>
<p class="text-warning">...</p>
<p class="text-danger">...</p>

    background color

<p class="bg-primary">...</p>
<p class="bg-success">...</p>
<p class="bg-info">...</p>
<p class="bg-warning">...</p>
<p class="bg-danger">...</p>

    Close button

<button type="button" class="close" aria-label="Close"><span aria-hidden="true">&times;</span></button>

    Drop-down triangle

<span class="caret"></span>

    Fast floating

<div class="pull-left">...</div>
<div class="pull-right">...</div>

    Content block center

<div class="center-block">...</div>

    Clear float

<!-- Usage as a class -->
<div class="clearfix">...</div>

    Show and hide

<div class="show">...</div>
<div class="hidden">...</div>

  bootstrap write a simple landing page:

Copy the code

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录页面</title>
    <link rel="stylesheet" href="bootstrap-3.3.7/css/bootstrap.css">
    <style>
        body {
            background-color: #eeeeee;
        }
    </style>
</head>
<body>

<div class="container">
    <div class="row">
        <div class="col-md-4 col-md-offset-4" style="margin-top: 70px">
            <h2 class="text-center">欢迎登录</h2>
            <form>
                <div class="form-group">
                    <label for="exampleInputEmail1">邮箱</label>
                    <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Email">
                    <span class="help-block"></span>
                </div>
                <div class="form-group">
                    <label for="exampleInputPassword1">密码</label>
                    <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
                    <span class="help-block"></span>
                </div>
                <div class="checkbox">
                    <label>
                        <input type="checkbox"> 记住
                    </label>
                </div>
                <button type="submit" id="login-btn" class="btn btn-success btn-block">登录</button>
            </form>
        </div>
    </div>
</div>

<script src="jquery.js"></script>
<script>
    // 给登录按钮绑定点击事件
    $('#login-btn').click(function () {
        // 定义一个是否允许提交的标志位
         var flag = true;
        // 1. 找到登录框中所有的input框,判断值是否为空
        $('form input').each(function () {
            var value = $(this).val();
            if (value.length===0){
                // 2. 为空就显示提示信息
                // 2.1 给下面的span标签设置文本提示信息
                var errMsg = $(this).prev().text() + '不能为空';
                $(this).next().text(errMsg);
                // 2.2 给父标签设置has-error的样式
                $(this).parent().addClass('has-error');
                // 2.3 阻止表单提交
                flag = false;
                return false;
            }
        });
        return flag;
    });

    // 给input框绑定focus事件
    $('form input').focus(function () {
        // 1. 去掉当前input框后面的span标签的文本
        $(this).next().text('');
        // 2. 去掉父标签的has-error样式
        $(this).parent().removeClass('has-error');
    })
</script>
</body>
</html>

Copy the code

Bootstrap common components (that is, some of them with the results, but also involves some action related, so it is necessary to introduce js files)

  1. Fonts icon (fontawesome which compare whole)
  2. Drop-down menu
  3. Button Group
  4. Input box ZU
  5. navigation
  6. Paging
  7. Labels and badges
  8. Header
  9. Shrinkage FIG.
  10. progress bar

  img

  img

  Assignment: to achieve such a page

    img

    To find the features you need to use the inside of the right side of the global css styles bootstrap the official website of this place.

      img

img Activity ID

  Analog scroll bars:

Copy the code

img

Copy the code

var $d1 = $("#d1");
var width = 0;
var theID = setInterval(setValue, 200);

function setValue() {
  if (width === 100) {
    clearInterval(theID);
  } else {
    width++;
    $d1.css("width", width+"%").text(width+"%");
  }
}

Copy the code

Copy the code

  About fontawesome of use

    img

    Download, unzip, and then put our project directory to refer directly to the line

    img

    css folder and fonts folder must be the same level directory, because that is the content inside css content fonts come inside by a relative path

    img

    Find a micro-channel icons to see:

    img

    img

   img

    Let us look at some uses font awesome inside, higher than the bootstrap icon inside some of them, and the bootstrap and perfectly compatible.

    img

    img

  pycharm中设置HTML的模板样式:

    img

  京东的标签页:

    img

    img

    img

    标签页示例:

Copy the code

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="bootstrap-3.3.7/css/bootstrap.css">
</head>
<body>


<div class="container">
    <div>
        <!-- Nav tabs -->
        <ul class="nav nav-tabs nav-justified" role="tablist">
            <li role="presentation" class="active">
                <a href="#home" aria-controls="home" role="tab" data-toggle="tab">主页</a>
            </li>
            <li role="presentation">
                <a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">详情页</a>
            </li>
            <li role="presentation">
                <a href="#messages" aria-controls="messages" role="tab" data-toggle="tab">售后服务</a>
            </li>
            <li role="presentation">
                <a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">评论专区</a>
            </li>
        </ul>

        <!-- Tab panes -->
        <div class="tab-content">
            <div role="tabpanel" class="tab-pane active" id="home">这是主页的内容</div>
            <div role="tabpanel" class="tab-pane" id="profile">这是详情页的内容</div>
            <div role="tabpanel" class="tab-pane" id="messages">这是售后服务专区的内容</div>
            <div role="tabpanel" class="tab-pane" id="settings">这是评论区的内容</div>
        </div>

    </div>
</div>
<script src="jquery.js"></script>
<script src="bootstrap-3.3.7/js/bootstrap.js"></script>
</body>
</html>

Copy the code

  巨幕:

    img

  进度条  

Copy the code

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="bootstrap-3.3.7/css/bootstrap.css">
</head>
<body>


<div class="container">
    <div class="progress">
      <div id="p1" class="progress-bar progress-bar-info progress-bar-striped active" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 0%;min-width: 2%">
        0%
      </div>
    </div>
    <button class="btn btn-success btn-sm" id="b1">开始</button>
</div>


<script src="jquery.js"></script>
<script src="bootstrap-3.3.7/js/bootstrap.js"></script>
<script>
        var n = 0;
        var t;
    // jQuery操作标签的CSS属性
        function foo(){
            $('#p1').css('width', n+'%').text(n+'%');
            n += 1;
            if (n > 100){
                clearInterval(t);
            }
        }
    // 点击开始按钮,让滚动条滚动起来
    $('#b1').click(function () {
        // 每隔一秒钟执行一下上面的代码
        t = setInterval(foo, 100);
    });

</script>
</body>
</html>

Copy the code

  保存网页的方法:

  img

  img

响应式开发

为什么要进行响应式开发?

    随着移动设备的流行,网页设计必须要考虑到移动端的设计。同一个网站为了兼容PC端和移动端显示,就需要进行响应式开发。

什么是响应式?

    利用媒体查询,让同一个网站兼容不同的终端(PC端、移动端)呈现不同的页面布局。

用到的技术:

    CSS3@media查询

    用于查询设备是否符合某一特定条件,这些特定条件包括屏幕尺寸、是否可触摸、屏幕精度、横屏竖屏等信息。

    常见属性:

      1.device-width, device-height 屏幕宽、高

      2.width,height 渲染窗口宽、高

      3.orientation 设备方向

      4.resolution 设备分辨率

      语法:

@media mediatype and|not|only (media feature) {
    CSS-Code;
}

    不同的媒体使用不同的stylesheet

<link rel="stylesheet" media="mediatype and|not|only (media feature)" href="mystylesheet.css">

    viewport

      手机浏览器是把页面放在一个虚拟的"窗口"(viewport)中,通常这个虚拟的"窗口"(viewport)比屏幕宽,这样就不用把每个网页挤到很小的窗口中(这样会破坏没有针对手机浏览器优化的网页的布局),用户可以通过平移和缩放来看网页的不同部分。

      设置viewport

      一个常用的针对移动网页优化过的页面的 viewport meta 标签大致如下:

<meta name=”viewport” content=”width=device-width, initial-scale=1, maximum-scale=1″>
  • width:控制 viewport 的大小,可以指定的一个值,如果 600,或者特殊的值,如 device-width 为设备的宽度(单位为缩放为 100% 时的 CSS 的像素)。
  • height:和 width 相对应,指定高度。
  • initial-scale:初始缩放比例,也即是当页面第一次 load 的时候缩放比例。
  • maximum-scale:允许用户缩放到的最大比例。
  • minimum-scale:允许用户缩放到的最小比例。
  • user-scalable: whether the user can manually zoom.

    Bootstrap grid system

  • container
  • row
  • column

    Note: When using Bootstrap class name conflicts do not let their names and the Bootstrap.

JavaScript plug-in

Commonly used Bootstrap comes with plug-ins

Other common plug-ins

Featured Bootstrap examples:

  • cover picture
  • Carousel
  • Blog page
  • Console
  • Login page
  • Offcanvas

Add some content:

  How pycharm connected to the database

  img

  img

  img

  img

  img

  Then you can see the library and the inside of the table on pycharm

  img

  img

  You can also write sql statement in it

  img

  We designed three tables, books, authors, publishers, convenient after learning django:

    img

    img

    It will create tables and table relationships out of it by sql statement (using foreign key on it)

    img

    img

Homework :

  Modified to the effect that the following

    img

  • Admin page (modify Dashbord, https: //v3.bootcss.com/examples/dashboard/)
  • Common Components practice

Guess you like

Origin www.cnblogs.com/ciquankun/p/11564858.html