偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

一篇文章帶你了解HTML的網(wǎng)頁布局結(jié)構(gòu)

網(wǎng)絡(luò) 通信技術(shù)
本文主要介紹了Html的網(wǎng)頁布局結(jié)構(gòu),如何去了解網(wǎng)絡(luò)的布局,介紹了常見的移動設(shè)備的三種網(wǎng)頁模式,最后通過一個小項目,總結(jié)之前講解的內(nèi)容。

[[404070]]

大家好,我是IT共享者,人稱皮皮。這篇我們來講講CSS網(wǎng)頁布局。

一、網(wǎng)頁布局

網(wǎng)頁布局有很多種方式,一般分為以下幾個部分:頭部區(qū)域、菜單導(dǎo)航區(qū)域、內(nèi)容區(qū)域、底部區(qū)域。

1. 頭部區(qū)域

頭部區(qū)域位于整個網(wǎng)頁的頂部,一般用于設(shè)置網(wǎng)頁的標題或者網(wǎng)頁的 logo:

  1. <!DOCTYPE html> 
  2. <html> 
  3. <head> 
  4. <meta charset="utf-8"
  5. <title>CSS 項目(runoob.com)</title> 
  6. <meta name="viewport" content="width=device-width, initial-scale=1"
  7. <style> 
  8. body { 
  9.   margin: 0; 
  10.  
  11. /* 頭部樣式 */ 
  12. .header { 
  13.   background-color: #f1f1f1; 
  14.   padding: 20px; 
  15.   text-align: center; 
  16. </style> 
  17. </head> 
  18. <body> 
  19.  
  20. <div class="header"
  21.   <h1>頭部區(qū)域</h1> 
  22. </div> 
  23.  
  24. </body> 
  25. </html> 

 

2. 菜單導(dǎo)航區(qū)域

菜單導(dǎo)航條包含了一些鏈接,可以引導(dǎo)用戶瀏覽其他頁面:

  1. /* 導(dǎo)航條 */ 
  2. .topnav { 
  3.   overflow: hidden; 
  4.   background-color: #333; 
  5.   
  6. /* 導(dǎo)航鏈接 */ 
  7. .topnav a { 
  8.   floatleft
  9.   display: block; 
  10.   color: #f2f2f2; 
  11.   text-align: center; 
  12.   padding: 14px 16px; 
  13.   text-decoration: none; 
  14.   
  15. /* 鏈接 - 修改顏色 */ 
  16. .topnav a:hover { 
  17.   background-color: #ddd; 
  18.   color: black; 

3. 內(nèi)容區(qū)域

內(nèi)容區(qū)域一般有三種形式:

1 列:一般用于移動端。

2 列:一般用于平板設(shè)備。

3 列:一般用于 PC 桌面設(shè)備。

不相等的列

不相等的列一般是在中間部分設(shè)置內(nèi)容區(qū)域,這塊也是最大最主要的,左右兩次側(cè)可以作為一些導(dǎo)航等相關(guān)內(nèi)容,這三列加起來的寬度是 100%。

例:

  1. .column { 
  2.   floatleft
  3.   
  4. /* 左右側(cè)欄的寬度 */ 
  5. .column.side { 
  6.   width: 25%; 
  7.   
  8. /* 中間列寬度 */ 
  9. .column.middle { 
  10.   width: 50%; 
  11.   
  12. /* 響應(yīng)式布局 - 寬度小于600px時設(shè)置上下布局 */ 
  13. @media screen and (max-width: 600px) { 
  14.   .column.side, .column.middle { 
  15.     width: 100%; 
  16.   } 

4. 底部區(qū)域

底部區(qū)域在網(wǎng)頁的最下方,一般包含版權(quán)信息和聯(lián)系方式等。

  1. .footer { 
  2.   background-color: #F1F1F1; 
  3.   text-align: center; 
  4.   padding: 10px; 

二、響應(yīng)式網(wǎng)頁布局

通過以上等學(xué)習(xí)我們來創(chuàng)建一個響應(yīng)式等頁面,頁面的布局會根據(jù)屏幕的大小來調(diào)整:

案例

  1. <!DOCTYPE html> 
  2. <html> 
  3. <head> 
  4. <meta charset="utf-8"
  5. <title>項目</title> 
  6. <style> 
  7. * { 
  8.   box-sizing: border-box; 
  9.   
  10. body { 
  11.   font-family: Arial; 
  12.   padding: 10px; 
  13.   background: #f1f1f1; 
  14.   
  15. /* 頭部標題 */ 
  16. .header { 
  17.   padding: 30px; 
  18.   text-align: center; 
  19.   background: white; 
  20.   
  21. .header h1 { 
  22.   font-size: 50px; 
  23.   
  24. /* 導(dǎo)航條 */ 
  25. .topnav { 
  26.   overflow: hidden; 
  27.   background-color: #333; 
  28.   
  29. /* 導(dǎo)航條鏈接 */ 
  30. .topnav a { 
  31.   floatleft
  32.   display: block; 
  33.   color: #f2f2f2; 
  34.   text-align: center; 
  35.   padding: 14px 16px; 
  36.   text-decoration: none; 
  37.   
  38. /* 鏈接顏色修改 */ 
  39. .topnav a:hover { 
  40.   background-color: #ddd; 
  41.   color: black; 
  42.   
  43. /* 創(chuàng)建兩列 */ 
  44. /* Left column */ 
  45. .leftcolumn {    
  46.   floatleft
  47.   width: 75%; 
  48.   
  49. /* 右側(cè)欄 */ 
  50. .rightcolumn { 
  51.   floatleft
  52.   width: 25%; 
  53.   background-color: #f1f1f1; 
  54.   padding-left: 20px; 
  55.   
  56. /* 圖像部分 */ 
  57. .fakeimg { 
  58.   background-color: #aaa; 
  59.   width: 100%; 
  60.   padding: 20px; 
  61.   
  62. /* 文章卡片效果 */ 
  63. .card { 
  64.   background-color: white; 
  65.   padding: 20px; 
  66.   margin-top: 20px; 
  67.   
  68. /* 列后面清除浮動 */ 
  69. .row:after { 
  70.   content: ""
  71.   display: table
  72.   clear: both; 
  73.   
  74. /* 底部 */ 
  75. .footer { 
  76.   padding: 20px; 
  77.   text-align: center; 
  78.   background: #ddd; 
  79.   margin-top: 20px; 
  80.   
  81. /* 響應(yīng)式布局 - 屏幕尺寸小于 800px 時,兩列布局改為上下布局 */ 
  82. @media screen and (max-width: 800px) { 
  83.   .leftcolumn, .rightcolumn {    
  84.     width: 100%; 
  85.     padding: 0; 
  86.   } 
  87.   
  88. /* 響應(yīng)式布局 -屏幕尺寸小于 400px 時,導(dǎo)航等布局改為上下布局 */ 
  89. @media screen and (max-width: 400px) { 
  90.   .topnav a { 
  91.     float: none; 
  92.     width: 100%; 
  93.   } 
  94. </style> 
  95. </head> 
  96. <body> 
  97.  
  98. <div class="header"
  99.   <h1>我的網(wǎng)頁</h1> 
  100.   <p>重置瀏覽器大小查看效果。</p> 
  101. </div> 
  102.  
  103. <div class="topnav"
  104.   <a href="#">鏈接</a> 
  105.   <a href="#">鏈接</a> 
  106.   <a href="#">鏈接</a> 
  107.   <a href="#" style="float:right">鏈接</a> 
  108. </div> 
  109.  
  110. <div class="row"
  111.   <div class="leftcolumn"
  112.     <div class="card"
  113.       <h2>文章標題</h2> 
  114.       <h5>xx 年xx月 xx日</h5> 
  115.       <div class="fakeimg" style="height:200px;"><img src="img/bird.png"></div> 
  116.       <p>文本...</p> 
  117.       <p>當熱誠變成習(xí)慣,恐懼和憂慮即無處容身。缺乏熱誠的人也沒有明確的目標。熱誠使想象的輪子轉(zhuǎn)動。一個人缺乏熱誠就象汽車沒有汽油。 
  118.       善于安排玩樂和工作,兩者保持熱誠,就是最快樂的人。熱誠使平凡的話題變得生動。!</p> 
  119.     </div> 
  120.     <div class="card"
  121.       <h2>文章標題</h2> 
  122.       <h5>xx 年 xx 月xx日</h5> 
  123.       <div class="fakeimg" style="height:200px;"><img src="img/border.png"></div> 
  124.       <p>文本...</p> 
  125.       <p>一切事無法追求完美,唯有追求盡力而為。這樣心無壓力,出來的結(jié)果反而會更好!</p> 
  126.     </div> 
  127.   </div> 
  128.   <div class="rightcolumn"
  129.     <div class="card"
  130.       <h2>關(guān)于我</h2> 
  131.       <div class="fakeimg" style="height:100px;"></div> 
  132.       <p>6666</p> 
  133.     </div> 
  134.     <div class="card"
  135.       <h3>熱門文章</h3> 
  136.       <div class="fakeimg"><img src="img/fy2_wp.png">\</div> 
  137.      
  138.     </div> 
  139.     <div class="card"
  140.       <h3>關(guān)注我</h3> 
  141.       <p>本站發(fā)布的系統(tǒng)與軟件僅為個人學(xué)習(xí)測試使用,請在下載后24小時內(nèi)刪除, 
  142.       不得用于任何商業(yè)用途,否則后果自負,請支持購買正版軟件!如侵犯到您的權(quán)益,請及時通知我們,我們會及時處理。 
  143.  
  144. 聲明:為非贏利性網(wǎng)站 不接受任何贊助和廣告。</p> 
  145.     </div> 
  146.   </div> 
  147. </div> 
  148.  
  149. <div class="footer"
  150.   <h2>底部區(qū)域</h2> 
  151. </div> 
  152.  
  153. </body> 
  154. </html> 

三、總結(jié)

本文主要介紹了Html的網(wǎng)頁布局結(jié)構(gòu),如何去了解網(wǎng)絡(luò)的布局,介紹了常見的移動設(shè)備的三種網(wǎng)頁模式,最后通過一個小項目,總結(jié)之前講解的內(nèi)容。

代碼很簡單,希望可以幫助你學(xué)習(xí)。

 

責(zé)任編輯:姜華 來源: IT共享之家
相關(guān)推薦

2021-06-30 00:20:12

Hangfire.NET平臺

2023-05-12 08:19:12

Netty程序框架

2020-10-23 08:17:29

HTML5MathML語言

2023-07-11 15:34:02

2023-05-08 08:21:15

JavaNIO編程

2024-04-19 14:23:52

SwitchJavaScript開發(fā)

2023-09-06 14:57:46

JavaScript編程語言

2023-07-30 15:18:54

JavaScript屬性

2021-05-18 08:30:42

JavaScript 前端JavaScript時

2024-01-30 13:47:45

2021-03-05 18:04:15

JavaScript循環(huán)代碼

2021-03-09 14:04:01

JavaScriptCookie數(shù)據(jù)

2021-09-27 09:18:30

ListIterato接口方法

2021-01-26 23:46:32

JavaScript數(shù)據(jù)結(jié)構(gòu)前端

2021-06-24 09:05:08

JavaScript日期前端

2021-02-26 20:01:57

SVG濾鏡元素

2020-12-08 08:09:49

SVG圖標Web

2021-02-02 18:39:05

JavaScript

2020-11-10 10:48:10

JavaScript屬性對象

2021-06-04 09:56:01

JavaScript 前端switch
點贊
收藏

51CTO技術(shù)棧公眾號