我花2小時直接在這篇文章中敲出一個HTML DIV+CSS首頁的所有的代碼(可複製)

2022-01-29 網頁源碼

用了2小時寫了一套學生作業水準的網站首頁,希望這篇文章和代碼能讓更多新手了解HTML DIV+CSS布局的方法和原理,而不是被一些人copy走從中獲利…該網站的主題為《去旅行吧》,整個首頁下來有1800字符的代碼量,當然你可以直接將首頁提交作業使用但記得修改網頁內的版權資訊欄,也可以根據首頁框架去試著做出自己主題的頁面以及幾個超連結頁面,一般的作業需要4-6個頁面左右【截圖及源碼在下方】。

這個首頁代碼運用了DIV盒子的使用方法,如盒子的嵌套、浮動、margin、border、background等屬性的使用,外部大盒子設定居中,內部左中右布局,下方橫向浮動排列,大學學習的前端知識點和布局方式都有運用,CSS的代碼量也很足、很細緻,使用hover來完成過渡效果、滑鼠滑過效果等,使用表格、表單補充模塊,為方便新手學習頁面中沒有使用js有需要的可以自行添加。

能看懂或寫出這個首頁的,恭喜你已經掌握了HTML前端網頁設計的大部分知識點,已經能夠寫出來一個完整的網站頁面了,同時如LOGO圖的設計、漸變的使用、布局上色塊、陰影的使用、js的引入可能就是你下一步需要攻克的點了...尤其是頁面的美觀度以及個人審美的提升將會是一條漫長的道路…

源碼有價,僅供學習,請勿轉售,有用點讚。

源碼保存方法(下方為保存及使用的視頻):

1. 複製下方所有源碼

2. 電腦右鍵桌面空白 - 新建 - 文本文檔 雙擊打開文本文檔,Ctrl V粘貼源碼到空白文本文檔內

3. 點擊 文件 - 另存為,保存類型選擇 所有文件, 文件名填寫為 index.html 點擊保存即可在瀏覽器預覽

也可以直接將源碼複製進Dreamweaver、Hbuilder X、Editplus等網頁設計軟體內保存為Html此處就不多說了…

源碼共享如下,記得點在看~

<!doctype html><html><head><meta charset="utf-8"><title>去旅行吧-PsdHtml.CN原創作品,僅供個人學習使用,禁止轉賣</title><style type="text/css">#father {  position: absolute;  width: 100%;  height: 1418px;  z-index: 1;  left: 0px;  top: 0px;}#father #top {  height: 120px;  width: 1000px;  margin-right: auto;  margin-left: auto;}#father #title {  height: 42px;  width: 1000px;  margin-right: auto;  margin-left: auto;  background-image: url(http://cdn.psdhtml.cn/title-skin.jpg);  border: 1px solid #fafafa;}#father #line1 {  height: 5px;  width: 100%;  background-color: #333;}#father #title #daohang {  font-family: "微軟雅黑";  font-size: 16px;  color: #333;  float: left;  height: 42px;  width: 140px;  border-top-width: 1px;  border-right-width: 1px;  border-bottom-width: 1px;  border-top-style: solid;  border-right-style: solid;  border-bottom-style: solid;  border-top-color: #fafafa;  border-right-color: #ececec;  border-bottom-color: #fafafa;  border-left-width: 1px;  border-left-style: solid;  border-left-color: #ffffff;  line-height: 42px;  text-align: center;}.d_over{  background-color:#217aff;  transition-duration: 1s;}.d_out{  background-color:rgba(0,0,0,0);}
a:link { color: #333; text-decoration: none;}a:visited { text-decoration: none; color: #000;}a:hover { text-decoration: none; color: #FFFFFF;}a:active { text-decoration: none; color: #333;}#father #main { height: 600px; width: 1000px; margin-top: 1px; margin-right: auto; margin-left: auto; background-color: #FFF; font-family: "微軟雅黑"; font-size: 12px; line-height: 28px; color: #333;}#father #main #left { float: left; height: 600px; width: 249px;}#father #main #left #left-text #m-249 { height: 272px; margin-top: 15px;}#father #main #left #left-text #m-245 { height: 245px;}#father #main #central { float: left; height: 600px; width: 500px; border-right-width: 1px; border-left-width: 1px; border-right-style: solid; border-left-style: solid; border-right-color: #f2f2f2; border-left-color: #f2f2f2;}#father #main #left #left-text { height: 520px; width: 195px; margin-top: 30px; margin-left: 28px;}.dabiaoti { font-family: "微軟雅黑"; font-size: 18px; color: #333; font-weight: bold;}.axiaozi { font-family: "微軟雅黑"; font-size: 13px; line-height: 35px; color: #000;}.bxiaozi { font-family: "微軟雅黑"; font-size: 10px; line-height: 27px; color: #000;}a.black:link { color: #000000; text-decoration: none;}a.black:visited { text-decoration: none; color: #000000;}a.black:hover { text-decoration: none; color: #2a7cf5;}a.black:active { text-decoration: none;}
a.black1:link { color: #000000; text-decoration: none;}a.black1:visited { text-decoration: none; color: #2a7cf5;}a.black1:hover { text-decoration: underline; color: #217aff;}a.black1:active { text-decoration: none; color: #2199ff;}#father #main #central #text2 { font-family: "微軟雅黑"; font-size: 12px; line-height: 25px; color: #333; height: 290px; width: 500px; margin-top: 0px; background-color: #f5fffa;}
#father #footer_all { height: 241px; width: 100%; margin-right: auto; margin-left: auto; font-family: "微軟雅黑"; font-size: 13.4px; color: #696969; margin-top: 0px;}#father #footer_all #f1000-167 { height: 167px; width: 1000px; margin-right: auto; margin-left: auto; padding-top: 67px; background-color: #f6faff; border-top-width: 1px; border-top-style: solid; border-top-color: #CCC;}#father #footer_all #f1000-167 #logo-175-40 { float: left; height: 40px; width: 160px; margin-top: 40px; margin-left: 45px;}#father #footer_all #f1000-167 #login { float: left; height: 40px; width: 70px; margin-top: 40px; margin-left: 40px;}#father #footer_all #f1000-167 #right828-167 { float: left; height: 167px; width: 300px; margin-left: 236px;}#father #footer_all #f1000-167 #right828-167 #l-828-80 { height: 80px; width: 300px; margin-top: 30px; letter-spacing: 2px;}#father #footer_all #f1000-167 #right828-167 #l-828-80 #r-150-42 { float: left; height: 42px; width: 70px; margin-top: 13px; text-align: center; line-height: 42px;}#father #footer_all #f1000-167 #right828-167 #l-828-80 #r-150-42-1 { float: left; height: 42px; width: 70px; margin-top: 13px; margin-left: 32px; text-align: center; line-height: 42px;}#father #footer_all #f1000-167 #right828-167 #l-828-80 #r-erweima { float: left;height: 75px;width: 75px;margin-top: 0px;margin-left: 48px;}#father #footer_all #f1000-167 #right828-167 #link { height: 33px; width: 721px; margin-top: 24px; margin-left: 108px; text-align: right; line-height: 20px; font-family: "微軟雅黑"; font-size: 13px;}#father #tuijian { height: 315px; width: 1000px; margin-right: auto; margin-left: auto; background-color: #FFF; padding-top: 40px; margin-top: 1px;}#father #tuijian #tuijian01 { float: left; height: 270px; width: 290px; margin-left: 35px;}
#father #tuijian #tuijian02 { float: left; height: 270px; width: 290px; margin-left: 30px;}#father #tuijian #tuijian01 #tuijiantu { height: 204px;}#father #tuijian #tuijian01 #tuijiantu:hover { height: 204px; border: 2px solid #2376F6;}#father #tuijian #tuijian01 #tuijianwenzi { height: 66px; font-family: "微軟雅黑"; font-size: 14px; color: #999999; width: 290px;}#father #tuijian #tuijian02 #tuijiantu2 { height: 204px;}#father #tuijian #tuijian02 #tuijiantu2:hover { height: 204px; border: 2px solid #2376F6;}#father #tuijian #tuijian02 #tuijianwenzi2 { height: 66px; font-family: "微軟雅黑"; font-size: 14px; color: #999999; width: 290px;}#father #footer_all #down1 { background-color: #f2f2f; height: 1px; width: 1000px; margin-right: auto; margin-left: auto;}#father #main #left #left-text #m-245 #a195 { height: 115px; background-image: url(http://cdn.psdhtml.cn/index1.jpg);}#father #main #left #left-text #m-245 #a195:hover { height: 115px; background-image: url(http://cdn.psdhtml.cn/index2.jpg); transition-duration: 1s;}#father #main #left #left-text #m-245 #a196 { height: 115px; margin-top: 9px; background-image: url(http://cdn.psdhtml.cn/index3.jpg);}#father #main #left #left-text #m-245 #a196:hover { height: 115px; background-image: url(http://cdn.psdhtml.cn/index4.jpg); transition-duration: 1s;}#father #main #central #banner { height: 310px; width: 500px; background-image: url(http://cdn.psdhtml.cn/banner.gif);}#father #main #left #left-text #m-249 table tr td #textfield { height: 36px; width: 170px; font-family: "微軟雅黑"; font-size: 14px; color: #999;}#father #main #left #left-text #m-249 table tr td #textfield2 { height: 36px; width: 170px; font-family: "微軟雅黑"; font-size: 14px; color: #999;}.wenben {font-family: "微軟雅黑"; font-size: 15px; color: #000;}#father #footer_all #banquan { height: 36px; width: 1000px; margin-right: auto; margin-left: auto; border-top-width: 1px; border-top-style: solid; border-top-color: #f2f2f2; background-image: url(http://cdn.psdhtml.cn/lxidw7.svg); background-color: #FFF;}</style><script type="text/javascript">function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0;}function MM_popupMsg(msg) { //v1.0 alert(msg);}function MM_goToURL() { //v3.0 var i, args=MM_goToURL.arguments; document.MM_returnValue = false; for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");}</script></head>
<body bgcolor="#f2f2f2"><div id="father"><div id="line1"></div><div id="top"><a href="index.html"><img src="http://cdn.psdhtml.cn/title.jpg" width="1000" height="120"></a></div> <div id="title"> <div id="daohang" onmouseover="this.className='d_over'" onmouseout="this.className='d_out'"><a href="index.html">首 頁</a></div> <div id="daohang" onmouseover="this.className='d_over'" onmouseout="this.className='d_out'"><a href="http://www.psdhtml.cn/index.php?c=thread&fid=18?ym">推薦風景</a></div> <div id="daohang" onmouseover="this.className='d_over'" onmouseout="this.className='d_out'"><a href="http://www.psdhtml.cn/index.php?c=thread&fid=18?ym">圖庫</a></div> <div id="daohang" onmouseover="this.className='d_over'" onmouseout="this.className='d_out'"><a href="http://www.psdhtml.cn/index.php?c=thread&fid=18?ym">視頻</a></div> <div id="daohang" onmouseover="this.className='d_over'" onmouseout="this.className='d_out'"><a href="http://www.psdhtml.cn/index.php?c=thread&fid=18?ym">註冊</a></div> </div> <div id="main"> <div id="left"> <div id="left-text"> <table width="100%" border="0"> <tr> <td height="45">推薦內容&nbsp;</td> </tr> <tr> <td> <img src="http://cdn.psdhtml.cn/arrow_01.gif" width="5" height="7"> <a href="#">出遊攻略看這裡</a><br> <img src="http://cdn.psdhtml.cn/arrow_01.gif" alt="" width="5" height="7"> <a href="#">出行日本注意事項 </a><br> <img src="http://cdn.psdhtml.cn/arrow_01.gif" alt="" width="5" height="7"> <a href="#">上帝的花園——吐瓦魯</a><br> <img src="http://cdn.psdhtml.cn/arrow_01.gif" alt="" width="5" height="7"> <a href="#">世界上最浪漫十大酒店 </a><br> <img src="http://cdn.psdhtml.cn/arrow_01.gif" alt="" width="5" height="7"> <a href="#">聞所未聞10個世界之最</a><br> <img src="http://cdn.psdhtml.cn/arrow_01.gif" alt="" width="5" height="7"> <a href="#">塞班島 / 馬紹爾群島</a><br> <img src="http://cdn.psdhtml.cn/arrow_01.gif" alt="" width="5" height="7"> <a href="#">埃及金字塔 </a><br> <img src="http://cdn.psdhtml.cn/arrow_01.gif" alt="" width="5" height="7"> <a href="#">布達拉宮</a><br> <img src="http://cdn.psdhtml.cn/arrow_01.gif" alt="" width="5" height="7"> <a href="#">自助旅遊實用手冊</a><br> <img src="http://cdn.psdhtml.cn/arrow_01.gif" alt="" width="5" height="7"> <a href="#">籤證基本知識 </a><br> <img src="http://cdn.psdhtml.cn/arrow_01.gif" alt="" width="5" height="7"> 蘇州 <br> &nbsp; &nbsp;<span><a href="#">蘇州園林</a>&nbsp;</span> &nbsp; <span><a href="#">寒山寺</a></span>&nbsp; &nbsp; <a href="#"><span>七裡山塘</span></a><br> <img src="http://cdn.psdhtml.cn/arrow_01.gif" alt="" width="5" height="7"> <a href="#">鳳凰古城&nbsp;</a></td> </tr> </table> </div> </div> <div id="central"> <div id="banner"></div> <div id="text2"><table width="100%" border="0"> <tr> <td height="287" align="center"><table width="80%" border="0"> <tr> <td><span>&quot;</span> 因為有些事要趁早,現在不做,也許一輩子都不會再做了,等有時間了,可不曾想,其實我們什麼時候都很忙,也許真到了你覺得有時間的時候,身邊的他(她)已不在,或者是到了樓下走走都困難的年紀。因為旅行的腳步,永遠是向前的,「世界那麼大,我想去看看」,很贊的一句網絡語,世界那麼大,想要在有生之年看完,就只能步步向前,確定計劃出發,將會讓你心靈和身體都在向前的路上。&nbsp;</td> </tr> </table></td> </tr> </table></div>
</div> <div id="left"> <div id="left-text"> <div id="m-245"> <div id="a195"></div> <div id="a196"></div> </div><div id="m-249"> <table width="100%" border="0"> <tr> <td height="36">歡迎登陸</td> </tr> <tr> <td height="51"><label for="textfield"></label> <input name="textfield" type="text" id="textfield" value="用戶名"></td> </tr> <tr> <td height="53"><input name="textfield2" type="password" id="textfield2" value="."></td> </tr> <tr> <td height="37" align="left" bgcolor="#f8f8f8"><label for="select"></label> <select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu('parent',this,0)"> <option value="http://www.psdhtml.cn/index.php?c=thread&fid=18?ym">男</option> <option value="http://www.psdhtml.cn/index.php?c=thread&fid=18?ym">女</option> </select></td> </tr> <tr> <td height="42" align="left"><input type="checkbox" name="checkbox" id="checkbox">同意註冊協議 <br></td> </tr> <tr> <td align="center"><input name="button2" type="submit" id="button2" onclick="MM_popupMsg('註冊成功,點擊確定跳轉至首頁。');MM_goToURL('parent','http://www.psdhtml.cn/index.php?c=thread&amp;fid=18?tz');return document.MM_returnValue" value="登 錄" /></td> </tr> </table>
</div> </div> </div> </div>
<div id="tuijian"> <div id="tuijian01"> <div id="tuijiantu"><a href="http://www.psdhtml.cn/read.php?tid=1108&fid=18?ym" target="_blank"><img src="http://cdn.psdhtml.cn/tuijian01.jpg" width="286" height="204" /></a></div> <div id="tuijianwenzi"><table width="100%" border="0"> <tr> <td height="40">美麗的海島度假不想了解一下?</td> </tr> <tr> <td><a href="#">了解更多</a></td> </tr></table></div> </div>
<div id="tuijian02"> <div id="tuijiantu2"><a href="http://www.psdhtml.cn/read.php?tid=1108&fid=18?ym" target="_blank"><img src="http://cdn.psdhtml.cn/tuijian02.jpg" width="286" height="204" /></a></div> <div id="tuijianwenzi2"><table width="100%" border="0"> <tr> <td height="40">一個能夠淨化靈魂的地方</td> </tr> <tr> <td><a href="#">了解更多</a></td> </tr></table></div> </div> <div id="tuijian02"> <div id="tuijiantu2"><a href="http://www.psdhtml.cn/read.php?tid=1108&fid=18?ym" target="_blank"><img src="http://cdn.psdhtml.cn/tuijian03.jpg" width="286" height="204" /></a></div> <div id="tuijianwenzi2"><table width="100%" border="0"> <tr> <td height="40">這個視頻美哭了,不看後悔...</td> </tr> <tr> <td><a href="#">了解更多</a></td> </tr></table></div> </div>
</div> <div id="footer_all"> <div id="f1000-167"> <div id="logo-175-40"><a href="index.html"><img src="http://cdn.psdhtml.cn/logodibu.png" width="159" height="47"></a></div> <div id="login"> <table width="103" border="0"> <tr> <td width="97" height="37" align="left"><a href="http://www.psdhtml.cn/read.php?tid=1108&fid=18?ym">查看更多</a></td> </tr> </table> </div>
<div id="login"> <table width="103" border="0"> <tr> <td width="97" height="37" align="left"><a href="http://www.psdhtml.cn/read.php?tid=1108&fid=18?ym"><span><img src="http://cdn.psdhtml.cn/arrow_01.gif" alt="" width="5" height="7"></span> 免費網頁源碼</a><a href="Login.html"></a></td> </tr> </table> </div>
<div id="right828-167"> <div id="l-828-80"> <div id="r-150-42"><a href="#"><img src="http://cdn.psdhtml.cn/fb.png" width="45" height="45"></a></div> <div id="r-150-42-1"><a href="#"><img src="http://cdn.psdhtml.cn/tw.png" alt="" width="45" height="45"></a></div> <div id="r-150-42-1"><a href="#"><img src="http://cdn.psdhtml.cn/ins.png" alt="" width="45" height="45"></a></div> </div> <div id="r-lianjie"><table width="100%" border="0"> <tr> <td align="right">© 去旅行吧&nbsp;&nbsp; &nbsp;</td> </tr></table></div> </div> </div> <div id="down1"></div> <div id="banquan"><a href="http://www.psdhtml.cn/index.php?c=thread&fid=18?ym" target="_blank"><img src="http://cdn.psdhtml.cn/lxidw7.svg" width="1000" height="36"></a></div> </div></div>
</body></html>

需要更多網頁源碼成品可以複製連結到瀏覽器打開http://www.psdhtml.cn/index.php?c=thread&fid=18?zgh 我在業餘時間也會代做各類網頁設計作業,有遇到網頁設計問題的看到也會回復。

上次共享了一份7頁的疫情主題源碼成品,仍然可以在公眾號後臺回復【疫情記憶】來獲取。


最近有遇到幾位學生找我做期末大作業說被別人代做作業「騙」了,一問才知道不是卷錢拉黑那種騙,而是有些需求點代做不會做實現不了,比如一些框架不會寫,js驗證實現不了,再比如老師讓兼容ie,代做說不會做兼容ie的甚至說ie老舊他的代碼是新的(兼容ie自有兼容的道理噴ie還不實現需求過分了)…還有個常見的就是做出來美觀度很低… 這幾位同學最後找到我以後說希望我能優惠一些因為他們不得不第二次付費,我只能給大家提醒,首先要做的需求提前123列清楚避免扯皮,然後要評估這個人的水平,很多代做是學生水平和你旗鼓相當,代碼也都是寫一部分網上找一部分,不會調整兼容,用潘叔的話說就是「你還年輕 你駕馭不了…」

來自某校學生的真實評價

來自某校學生的真實評價

來自某校學生的真實評價

我目前在某大廠工作,業餘時間代做,對於學生作業代做有6年經驗了,不會用力過猛超出學生作業範圍,更不會滿足不了你的需求,原創作品超300套,自主設計運營的源碼網站通過工信部、公安部備案,運營有6年時間了,會認真對待每一份需求。

相關焦點

  • Div+CSS 基礎入門教程
  • HTML普通流以及css中position的介紹
    寫這篇文章是想給16級的師弟師妹們簡單介紹一下HTML中元素是如何分布的,回想自己去年做期末作業的時候什麼都不知道,連最基本的普通流都不懂,所以當時做期末作業的時候非常痛苦
  • 基於HTML/CSS/JS的愛吹風的獅子小遊戲
    愛吹風的獅子一個基於HTML,CSS,Javascript的愛吹風的獅子小遊戲,文章末尾給出了小遊戲的源碼,關注公眾號啦啦啦好想biu點什麼回復愛吹風的獅子可免費獲取
  • HTML DIV+CSS 命名規範大全
    網頁製作中規範使用DIV+CSS命名規則,可以改善優化功效特別是團隊合作時候可以提供合作製作效率,具體DIV CSS命名規則CSS命名大全內容篇。常用DIV+CSS命名大全集合,即CSS命名規則我們開發CSS+DIV網頁(Xhtml)時候,比較困惑和糾結的事就是CSS命名,特別是新手不知道什麼地方該如何命名,怎樣命名才是好的方法。
  • 新年煙花/表白/拜年/情人節/ html+css+js 放一場浪漫煙花秀(含音樂/定製相片)程式設計師表白必備煙花
    人狠話不多,直接上代碼文件結構 完整代碼可滴滴 : 365392777</html>css 部分{ -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-box-sizing: border-box; box-sizing: border-box;}.share_img
  • 教程 | Web前端教程2:CSS+DIV頁面布局
    每條聲明由一個屬性和一個值組成。屬性(property)是您希望設置的樣式屬性(style attribute)。每個屬性有一個值。屬性和值被冒號分開。(2)使用 <div> 元素的 HTML 布局注釋:<div> 元素常用作布局工具,因為能夠輕鬆地通過 CSS 對其進行定位。
  • 最好用的Html轉pdf的工具——wkhtmltopdf
    pdflib,FPDF 這兩個方法是需要編寫程序去生成pdf的,就也是講不支持直接把html頁面轉換成pdf;html2pdf這個雖然可以把html頁面轉換成pdf文 件,但是它只能轉換一般簡單的html代碼,如果你的html內容要的是通過後臺新聞編輯器排版的那肯定不行的。
  • 【原創】 實戰div css網頁布局
    圍繞怎麼做一個簡易的網頁,回顧其步驟: 1、新建站點 2、打開index.html,按照網頁的六個組成部分,依次創建logo層、導航層、banner層、內容層、友情連結層、版權層 3、作為初學者,可以先不考慮網頁中的文字。(關於如果切圖下節講) 4、在紙上,記錄下每一部分寬高具體的尺寸。 5、通過css控制面板,對每個層進行定義,如它們的寬、高,邊框、背景、填充、邊界等。定義的時候,必須定義左浮動。 在我們通過css來定義div的時候,這個地方一定要對應。
  • 「css基礎」你想知道的偽元素內容都在這篇文章裡(長文值得收藏)
    最近因為一些網頁的需要,需要比較深入的使用了CSS 的「偽元素」( Pseudo Element ),發現原來不只是用用before或after 而已,可以玩的東西還真是不少,所以就來篇文章,把這些比較不常玩的用法歸納整理下,希望對你的日常工作有所幫助。
  • 一批腦洞大開的CSS特效
    今天帶大家看幾個用css(部分會用到canvas和js)實現的好玩兒的效果(不好好琢磨下,還真寫不出來)本篇文章有參考一些css大佬的傑作,具體參考連結在文末有提及超能陸戰隊-大白超能陸戰隊中的大白,相信你一定不陌生吧。影片中的大白又萌又可愛,十分惹人喜歡。
  • CSS中content屬性的妙用
    --html-->11<div class="container clear">12    <div class="left">左</div>13    <div class="right">右</div>14</div>父元素.container中兩個子元素.left
  • CSS 黑魔法小技巧,讓你少寫不必要的JS,代碼更優雅
    ,有人希望能博主還能整理個 CSS 的一些黑魔法小技巧,無奈我 CSS 一直很渣,沒什麼乾貨,最近寫了一個 Chrome 插件 GayHub,算是把 GitHub 的樣式審查了個變,在寫的過程中,也收穫了很多關於 CSS 的小技巧,尤其是開始的第一個技巧,學習到了很多,於是再加上一波搜集,就誕生這篇博文,歡迎補充~~~😂。
  • 20 個讓你效率更高的 CSS 代碼技巧
    希望每個人通過這篇文章都能學到對自己有用的知識。1.注意外邊距摺疊與其他大多數屬性不同,上下的垂直外邊距margin在同時存在時會發生外邊距摺疊。這意味著當一個元素的下邊緣接觸到另一個元素的上邊緣時,只會保留兩個margin值中較大的那個。
  • 30+有用的CSS代碼片段
    在一篇文章中收集所有的CSS代碼片段幾乎是不可能的事情,但是我們這裡列出了一些相對於其他的更有用的代碼片段,不要被這些代碼的長度所嚇到
  • HTML5 | 022 - CSS 的'繼承'
    繼承是 CSS 中一個很重要的基本功能,要了解繼承,先要了解 HTML 的 DOM 結構。先看一段,HTML 的區塊代碼,用汪國真的詩吧:<meta charset="utf-8"><body>        <div id="first">                <p>我不去想是否能夠成功 既然選擇了遠方 便只顧風雨兼程</p>
  • 技術者|初探HTML5:學習製作學校網頁
    </html>上面代碼中,<!DOCTYPE>標籤就是形同一個聲明,同學們只需記住,在製作所有HTML5頁面時把它放在第一行就可以了。 <html></html>標籤,形如「圍牆」,用它來包裹整個頁面,即所有頁面內容都得寫到這對標籤裡面。而在圍牆之內又有兩大塊,一部分是頁面的「頭」,一部分是頁面的「身體」,分別用<head><body>標籤來指定。
  • 可愛極了,用 CSS 實現一個超可愛的貓咪!
    介紹本期我們通過vite+scss去完成一個橘貓心情變化的創意動畫,這裡的邏輯我們將不使用任何js代碼,僅依靠css來完成,所以,通過本期的動畫,你可以到一些css動畫和繪製的一些技巧。廢話不多說,先康康效果~VID_20211030_184225.gif還比較可愛吧。
  • CSS各種姿勢實現Sticky Footer
    將內容部分的底部外邊距設為負數這是個比較主流的用法,把內容部分最小高度設為100%,再利用內容部分的負底部外邊距值來達到當高度不滿時,頁腳保持在窗口底部,當高度超出則隨之推出的效果。-- 頁面主體內容區域 --></div>    <div class="footer"><!
  • div和css
    div是區域的意思,就是把網頁分為一個一個區域,在沒有區域之前,就相當於一個國家由一個村一個村組成,有區域的概念後就可以把國家先分為省,省裡面還可以分區域
  • css動畫之@keyframes