網(wǎng)站開發(fā)簡介
HTML簡介HTML是超文本標(biāo)記語言(HyperText Markup Language),是一種用于創(chuàng)建網(wǎng)頁的標(biāo)準(zhǔn)標(biāo)記語言,HTML由一個個標(biāo)簽組成,文件的后綴名是html或htm,一個html文件就是一個網(wǎng)頁,html文件用編輯器打開就顯示文本,用瀏覽器打開就會渲染成網(wǎng)頁。 HTML基本結(jié)構(gòu):
<!DOCTYPE html><html><head> <title>黑貓編程</title></head><body> 網(wǎng)頁顯示內(nèi)容</body></html> 前端開發(fā)需要哪些技術(shù)?
前端開發(fā)編輯器前端開發(fā)語言本質(zhì)上都是文本文件,只要后綴名符合標(biāo)準(zhǔn),任何文本編輯器都可以用來寫前端代碼,在此推薦幾種編輯器: IDE——集成開發(fā)環(huán)境:
輕量級文本編輯器:
VS Code開發(fā)前端項目比較方便,推薦安裝插件:
![]() 標(biāo)簽分類分類一:
分類二:
<meta>標(biāo)簽所有瀏覽器都支持 <meta> 標(biāo)簽: ![]()
圖像標(biāo)簽<img>標(biāo)簽可以在網(wǎng)頁上插入一張圖片,它是獨立使用的標(biāo)簽,它的常用屬性有:
標(biāo)題標(biāo)簽通過<h1>、<h2>、<h3>、<h4>、<h5>、<h6>,標(biāo)簽可以在網(wǎng)頁上定義6種級別的標(biāo)題。6種級別的標(biāo)題表示文檔的6級目錄層級關(guān)系,比如說: <h1>用作主標(biāo)題,其后是<h2>,再其次是 <h3>,以此類推。搜索引擎會使用標(biāo)題將網(wǎng)頁的結(jié)構(gòu)和內(nèi)容編制索引。
span和div
思考:完成如下圖所示效果
![]() <!--添加兩個div進(jìn)行嵌套--><div style='width: 100px; height: 100px; background-color: pink'> <div style='width: 50px; height: 50px; background-color: yellow'></div></div> ![]() CSS樣式css:Cascading Style Sheet 層疊樣式表,它是用來美化頁面的一種語言。
![]()
![]() CSS引入三種方式
<style> div { background-color:yellow; color:green; }</style>
常用CSS選擇器css 選擇器是用來選擇標(biāo)簽的,選出來以后給標(biāo)簽加樣式
.a { font-weight:bold; color:yellow;}
#info { font-size:24px; color:red;}
nth-child: nth-child(odd) nth-child(even) nth-child(3n+1) nth-child(3) nth-last-child(3) nth-child(-n+3) nth-child(n+5) last-child first-child 偽元素
.father::after{ display: block; content: '最后面'; width: 100px; height:100px; background-color: yellow;} 超鏈接
a:link{ text-decoration: none;}a:visited{ color: red;}a:hover{ color: orange;}a:active{ color: green;} 錨點定位通過創(chuàng)建錨點鏈接,用戶能夠快速定位到目標(biāo)內(nèi)容。創(chuàng)建錨點鏈接分為兩步: ![]() 文本標(biāo)簽注釋標(biāo)簽:如果需要在HTML文檔中添加一些便于閱讀和理解但又不需要顯示在頁面中的注釋文字,就需要使用注釋標(biāo)簽。 簡單解釋:注釋內(nèi)容不會顯示在瀏覽器窗口中,但是作為HTML文檔內(nèi)容的一部分,也會被下載到用戶的計算機(jī)上,查看源代碼時就可以看到。 <!-- 注釋語句 --> 文本屬性
![]() ![]() ![]() 特殊字符 ![]() 背景屬性背景顏色: background-color:顏色值; 默認(rèn)的值是 transparent 透明的 background: rgba(0, 0, 0, 0.3); 最后一個參數(shù)為透明度背景平鋪:pbackground-repeat : repeat | no-repeat | repeat-x | repeat-y背景固定:pbackground-attachment : scroll | fixed背景位置: background-position : x y: x和y:為長度值或top、left等方位詞background-size:contain/cover 盒子模型![]() ![]()
浮動應(yīng)用,首頁布局![]() <!DOCTYPE html><html lang='en'><head> <meta charset='UTF-8'> <meta http-equiv='X-UA-Compatible' content='IE=edge'> <meta name='viewport' content='width=device-width, initial-scale=1.0'> <title>Document</title> <style> .container{ width: 700px; border: 1px solid gray; margin: 0 auto; background-color: lightyellow; } .header{ text-align: center; background-color: skyblue; padding: 8px; color: white } .left{ width: 160px; float: left; padding: 23px; } .content{ padding: 16px; margin-left: 190px; border-left: 1px solid gray; } .footer{ padding: 8px; color: white; background-color: red; } </style></head><body> <div class='container'> <div class='header'> <h1>backcat1995.com</h1> </div> <div class='left'> <p>黑貓編程教育品牌</p> <p>作者:黑貓</p> </div> <div class='content'> <h2>課程大綱</h2> C++從入門到精通 <br> 玩轉(zhuǎn)數(shù)據(jù)結(jié)構(gòu)與算法 <br> Python從小白到起飛 </div> <div class='footer'> 地址:火星巖漿路1198弄 </div> </div></body></html> 元素隱藏overflow:
絕對單位和相對單位1.絕對單位,當(dāng)窗口大小發(fā)生改變,不能自適應(yīng)窗口進(jìn)行改變
2.相對單位 <style> *{margin: 0; padding: 0;} .box{ width: 50%; height: 50%; background-color: red; } body, html{ height: 100%; } .box2{ width: 50%; height: 50%; background-color: green; }</style><div class='box'> <div class='box2'> </div></div> ![]() 風(fēng)箏效果
![]() 列表標(biāo)簽
表格標(biāo)簽
表單標(biāo)簽表單用于搜集不同類型的用戶輸入(用戶輸入的數(shù)據(jù)),然后可以把用戶數(shù)據(jù)提交到web服務(wù)器。 表單屬性設(shè)置:
響應(yīng)式布局Bootstrap響應(yīng)式最主要特點就是針對不同寬度設(shè)備進(jìn)行布局和樣式設(shè)置,從而適配不同大小設(shè)備。 ![]() 柵格系統(tǒng): ![]() 顯示和隱藏: ![]() |
|