Home Web Front-end JS Tutorial Bootstrap Tutorial Compilation - Getting Started + CSS Basics

Bootstrap Tutorial Compilation - Getting Started + CSS Basics

Jan 25, 2019 am 11:09 AM
bootstrap

When I learned Bootstrap by myself, I followed the official website documentation. The official website is actually very clear and complete, but for front-end beginners, there are still many scattered knowledge points that can be ignored for the time being.

[Related video recommendation: Bootstrap tutorial]

So here is a short summary of the knowledge points. , I hope it can help you in the "getting started" aspect.

bootstrap Notes-Starting CSS Basics

1. Getting Started

1. Quote

Download through the official website, or provide it through bootCDN CDN service, or quote the document through the CDN service provided by cdnjs

bootstrap.min.css 
bootstrap.min.js
Copy after login

You need to quote jquery

jquery.min.js
Copy after login

CDN service

https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css
https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js
Copy after login

before referencing bootstrap.min.js When we document, it is recommended to write it at the bottom of the body tag content

…
<bdoy>
…
<script src="jquery.min.js"></script>
<script src="bootstrap.min.js"></script>
</body>
…
Copy after login

2. Mobile first

In order to ensure proper drawing and touch screen scaling, you need to add it in viewport metadata tag.

   <meta name="viewport" content="width=device-width, initial-scale=1">
Copy after login

On mobile device browsers, the zooming function can be disabled by setting the meta attribute of the viewport to user-scalable=no.

   <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
Copy after login

If you want to understand the specific content of the above code, you want to fully understand the problem of moving pixels. It is recommended to go to MOOC.com to take a look at the WEB mobile course

2. CSS layout

1. Layout container

Content container, the width has been adjusted Fixed (with spacing on the left and right)

<div class="container"></div>
Copy after login

Content container, width is 100%

<div class="container-fluid"></div>
Copy after login

2. Grid system

The grid system divides the screen width into 12 evenly For example,

 class="col-md-12"
Copy after login

is divided into four categories for different screen sizes, namely:

.col-lg-大屏幕             >1200px
.col-md-中等屏幕       992px~1200px
.col-sm-小屏幕         750px~992px
.col-xs-超小屏幕             <750px
Copy after login

html:

   <div class="container">
        <div class="row">
            <div class="col-lg-3 col-md-6 col-sm-12">好好学习天天向上</div>
            <div class="col-lg-3 col-md-6 col-sm-12">好好学习天天向上</div>
            <div class="col-lg-3 col-md-6 col-sm-12">好好学习天天向上</div>
            <div class="col-lg-3 col-md-6 col-sm-12">好好学习天天向上</div>
            
        </div>
    </div>
Copy after login

css:

<style>
div[class^="col"]{
outline-offset: 1px;
outline:1px solid red;
}
</style>
Copy after login

3.Typesetting-Title

<mark></mark>    标记标签
<small></small>   小文本标签/副标题标签
Copy after login

4.Typesetting-Code

   <kbd></kbd>  标记通过键盘输入的内容
    <code></code>  标记代码内容
Copy after login

5.Table

Add a class name on the basis of the traditional table>tr>td to use the table effects provided by bootstrap

Basic table:

 <table class="table"></table>
Copy after login

In< ;b>.table, add the following class names to add corresponding effects

.table-bordered   带边框的
.table-striped    带条纹的
.table-hover 鼠标悬停
.table-condensed 紧缩表格  单元格内的padding值减半
Copy after login

State classes Through these state classes, you can set colors for rows or cells

.active The color set when the mouse is hovering over a row or cell.Success Identifies success or positive action.info Identifies ordinary prompt information or action.warning Identifies warning or requires user attention.danger Identifies danger or potential Actions that bring negative impacts


6. Situational colors (text, buttons, backgrounds, etc.)

Colors will be used in many places in subsequent studies

     -default;  默认
      -primary;  首选项
      -success;  成功(一般用于表达积极向上)
      -info;     信息
      -warning;  警告
      -danger;   危险
Copy after login

7. Button

Usually we use input or button tags to write form buttons, and we also use a tags to imitate buttons.

       <a class="btn btn-danger" href="">百度一下</a>
        <input class="btn btn-danger" type="button" value="按钮2">
        <button class="btn btn-danger">按钮3</button>
Copy after login

The button has the following skins, or themes, or simply colors:

 btn-default;  默认
  btn-primary;  首选项
  btn-success;  成功(一般用于表达积极向上)
  btn-info;  b   信息
  btn-warning;  警告
  btn-danger;   危险
  btn-link;     连接(a标签的方式)
Copy after login

8. Triangle symbol

You can use the triangle symbol to Indicates that an element has the functionality of a drop-down menu. Note that the triangle symbol in the upward pop-up menu is reversed.

<span class="caret"></span>
Copy after login

9. Close button

By using an icon that symbolizes closure, modal boxes and warning boxes can be made to disappear.

  <button type="button" class="close" >
       <span>×</span>
    </button>
Copy after login


The above is the detailed content of Bootstrap Tutorial Compilation - Getting Started + CSS Basics. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to get the bootstrap search bar How to get the bootstrap search bar Apr 07, 2025 pm 03:33 PM

How to use Bootstrap to get the value of the search bar: Determines the ID or name of the search bar. Use JavaScript to get DOM elements. Gets the value of the element. Perform the required actions.

How to use bootstrap in vue How to use bootstrap in vue Apr 07, 2025 pm 11:33 PM

Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

How to write split lines on bootstrap How to write split lines on bootstrap Apr 07, 2025 pm 03:12 PM

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

How to do vertical centering of bootstrap How to do vertical centering of bootstrap Apr 07, 2025 pm 03:21 PM

Use Bootstrap to implement vertical centering: flexbox method: Use the d-flex, justify-content-center, and align-items-center classes to place elements in the flexbox container. align-items-center class method: For browsers that do not support flexbox, use the align-items-center class, provided that the parent element has a defined height.

How to insert pictures on bootstrap How to insert pictures on bootstrap Apr 07, 2025 pm 03:30 PM

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

How to set up the framework for bootstrap How to set up the framework for bootstrap Apr 07, 2025 pm 03:27 PM

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

How to use bootstrap button How to use bootstrap button Apr 07, 2025 pm 03:09 PM

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text

How to resize bootstrap How to resize bootstrap Apr 07, 2025 pm 03:18 PM

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-

See all articles