html如何引用bootstrap


本文摘自PHP中文网,作者藏色散人,侵删。

html引用bootstrap的方法:1、使用“link rel”方式在线引用bootstrap;2、将Bootstrap下载到本地,并将需要的文件放在项目下,然后在相应文件中引入即可。

推荐:《bootstrap视频教程》

Bootstrap的引入

Bootstrap的使用一般有两种方法:

引用在线的Bootstrap的样式,

将Bootstrap下载到本地进行引用。

在线引用

基本模板如下:

1

2

3

4

5

6

7

8

9

10

11

<html>

<head>

    <meta charset="UTF-8">

    <title>Bootstrap引入</title>

    <!-- 新 Bootstrap 核心 CSS 文件 --> 

    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.css"

    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 --> 

    <script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script> 

    <!-- 最新的 Bootstrap 核心 JavaScript 文件 --> 

    <script src="http://cdn.bootcss.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> 

</head>

优点:不用本地安装Bootstrap,也不用考虑引用时的路径问题

缺点:一旦在线样式挂了,那么会影响整个页面样式的呈现

本地引用

将Bootstrap下载到本地。

直接访问上述代码中的3个网址来获取代码

去Bootstrap的官网 http://v3.bootcss.com/ 和JQuery

的官网 http://jquery.com/ 下载相应的文件

将需要的文件放在项目下,便于引用

bootstrap的目录结构如下:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

bootstrap/

├── css/

│   ├── bootstrap.css

│   ├── bootstrap.css.map

│   ├── bootstrap.min.css

│   ├── bootstrap.min.css.map

│   ├── bootstrap-theme.css

│   ├── bootstrap-theme.css.map

│   ├── bootstrap-theme.min.css

│   └── bootstrap-theme.min.css.map

├── js/

│   ├── bootstrap.js

│   └── bootstrap.min.js

└── fonts/

    ├── glyphicons-halflings-regular.eot

    ├── glyphicons-halflings-regular.svg

    ├── glyphicons-halflings-regular.ttf

    ├── glyphicons-halflings-regular.woff

    └── glyphicons-halflings-regular.woff2

最常用的是css/bootstrap.min.css、js/bootstrap.min.js

jquery.min.js可以在JQuery官网下载

最后,在相应文件中引入即可。

优点:确保网络状况不佳的情况下,页面样式依然可以正常显示

缺点:需要提前安装或下载,引用时要考虑路径问题。

以上就是html如何引用bootstrap的详细内容,更多文章请关注木庄网络博客

相关阅读 >>

bootstrap表单怎么居中

解决bootstrap只加载一次 remote 数据的问题

bootstrap为什么是12列

怎么引入bootstrap

bootstrap怎么实现自适应高度

bootstrap怎么实现可关闭tab

浅谈bootstraptable+jstree插件对树列表条件和查询条件的处理

用npm下载bootstrap后怎么引入

bootstrap里面都有什么类

bootstrap 不支持ie怎么办

更多相关阅读请进入《bootstrap》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...

    正在狠努力加载,请稍候...