国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

如何使用bootstrap框架 bootstrap入門必看!

2019-11-19 16:49:49
字體:
來源:轉載
供稿:網友

前言: 前幾天,本想做一個登陸界面,但自己寫form表單必然很丑,所以想用下bootstarp框架,之前聽別人說bootstrap很牛的樣子。但我完全不會bootstrap...

下載&目錄

bootstrap官網,接著我下載了用于生產環境Bootstrap:

解壓出來是這樣的:

目錄結構大概是這樣的,前幾天在官網有看到。下面這個目錄結構你應該先了解下:

bootstrap3
├── css
│├── bootstrap-theme.css //主題類型,生產上一般用不到
│├── bootstrap-theme.css.map //主題類型,生產上一般用不到
│├── bootstrap-theme.min.css //主題類型,生產上一般用不到
│ ├── bootstrap.css
│ ├── bootstrap.css.map //做映射的,可以理解為 shuaige = “luotianshuai” 那么掉shuaige的時候就相當于掉luotianshuai
│ └── bootstrap.min.css
├──fonts //包含了字體圖標文件,他也是做的對應。下面的文件包含了不同系統下的字體圖標
│ ├── glyphicons-halflings-regular.eot
│ ├── glyphicons-halflings-regular.svg
│ ├── glyphicons-halflings-regular.ttf
│ ├── glyphicons-halflings-regular.woff
│ └── glyphicons-halflings-regular.woff2
└── js
├── bootstrap.js
├── bootstrap.min.js

bootstrap做了很多美化過的css樣式在bootstrap.css中,js則放在bootstrap.js。注意了,bootstrap的js與Jquery的js是不一樣的。bootstrap的js必須依賴Jquery。所以在導入JS的時候,得先導入Jquery.

應用

接下來看官網給我們推薦的入門級模版.

雖然不怎么好看,但我想在本地上也能有這么個HTML文件。怎么搞??
右擊鼠標,點擊網頁另存為,保存到本地。

下載的除了HTML文件外,還有另外一個文件Starter Template for Boostrap_files,打開后,顯示如下:是所需要的bootstrap的css與js,可在HTML中引入。

我已經下載了bootstrap,所以我直接用我本地的bootstrap就好了,于是我刪除上面的Starter Template for Boostrap_files文件夾。

bootstrap_1.html:

<!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-3.3.7-dist/css/bootstrap.min.css" rel="external nofollow" rel="external nofollow" rel="stylesheet"> </head> <body> <h1>你好,世界!</h1> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="bootstrap-3.3.7-dist/js/jquery-3.1.1.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="bootstrap-3.3.7-dist/js/bootstrap.min.js"></script> </body></html>
  • 11行從bootstrap導入css.
  • 19行導入jquery
  • 21行從bootstrap導入js

導入bootstrap的css與js注意路徑:

用瀏覽器打開上面的html界面會出現"你好,世界"。很low,我不禁懷疑bootstrap真的有用嗎??說好的美化效果呢

我在bootstrap官網隨便找下"巨幕"的組件

將組件的代碼貼到HTML的body中,便可以使用了。

<!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-3.3.7-dist/css/bootstrap.min.css" rel="external nofollow" rel="external nofollow" rel="stylesheet"> </head> <body> <h1>你好,世界!</h1> <div class="jumbotron container">  <div >   <h1>Hello, world!</h1>   <p><a class="btn btn-primary btn-lg" href="#" rel="external nofollow" role="button">Learn more</a></p>  </div> </div> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="bootstrap-3.3.7-dist/js/jquery-3.1.1.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="bootstrap-3.3.7-dist/js/bootstrap.min.js"></script> </body></html>

效果圖:

現在,你會使用bootstrap了吧,哈哈

建議好好看下官網,我可是看了整個下午……都沒看完……

如果大家還想深入學習,可以點擊這里進行學習,再為大家附兩個精彩的專題:Bootstrap學習教程 Bootstrap實戰教程

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持武林網。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 丹凤县| 循化| 乌拉特后旗| 武清区| 陆良县| 武城县| 威远县| 吐鲁番市| 彩票| 凤城市| 顺义区| 漠河县| 绍兴县| 百色市| 巴青县| 临武县| 兴文县| 陆河县| 绍兴市| 武威市| 历史| 祁东县| 新巴尔虎左旗| 广德县| 西贡区| 孝义市| 化德县| 枝江市| 扎鲁特旗| 周宁县| 含山县| 桂阳县| 怀远县| 汉寿县| 寻乌县| 荆州市| 阳谷县| 咸丰县| 英山县| 霍邱县| 尚志市|