<!doctype html><html><head><meta charset="UTF-8"><title>Web的Flex弹性盒模型</title><style> body{ font-family: '微软雅黑'; /*font-family: cursive, '微软雅黑';*/ padding: 0; margin: 20px 0 40px; font-size: 16px; background-color: #F9F9F9; } h1{ color: #0BF; text-indent: 15px; } h3{ color: #6D7273; text-indent: 15px; padding: 10px 0; background-color: #fff; } p{ margin: 0; padding: 0; color: #666; margin-bottom: 5px; } .boxes{ padding: 0 10px; overflow: hidden; display: -webkit-flex; flex-wrap: wrap; align-content:flex-start } .box{ width: 400px; padding: 8px; margin-right: 20px; margin-bottom: 10px; display: inline-block; box-shadow: 2px 2px 3px 1px #E0E0E0; } .boxstyle{ padding: 8px 0; } .boxborder{ border: 1px dashed #B6B6B6; } .demo{ color: #fff; display: -webkit-flex; text-align: center; } .demo .item{ line-height: 40px; background-color: #ddd; } .demo .item:nth-child(1){ background-color: #E46C49; } .demo .item:nth-child(2){ background-color: #37B0D3; } .demo .item:nth-child(3){ background-color: #68B33D; } .demo .item:nth-child(4){ background-color: #E46775; } .demo .item:nth-child(5){ background-color: #CFC731; } .demo .item:nth-child(6){ background-color: #8370F4; } .demo .item span{ display: block; } .demo2 .item{ height: 60px; width: 150px; word-wrap: break-word; line-height: 1.5; } .demo-row{ flex-direction: row; } .demo-row-reverse{ flex-direction: row-reverse; } .demo-column{ height: 200px; flex-direction: column; } .demo-column-reverse{ height: 200px; flex-direction: column-reverse; } .demo-nowrap{ -webkit-flex-wrap: nowrap; width: 400px; } .demo-wrap{ -webkit-flex-wrap: wrap; width: 400px; } .demo-wrap-reverse{ -webkit-flex-wrap: wrap-reverse; width: 400px; } .demo-align-content{ width: 400px; flex-wrap: wrap; height:200px; border: 1px dashed #B6B6B6; } .demo-align-content .item:nth-child(1), .demo-align-content .item:nth-child(2), .demo-align-content .item:nth-child(3), .demo-align-content .item:nth-child(4), .demo-align-content .item:nth-child(5), .demo-align-content .item:nth-child(6){ background-color: #717171; width: 80px; margin: 2px 10px; }</style></head><body> <h1 id="Web的Flex弹性盒模型">Web的Flex弹性盒模型</h1> <section> <h3 id="nbsp-flex-nbsp">[ flex ]</h3> <div> <div> <div> <p>display: -webkit-flex;</p> </div> <div class="demo demo1"> <div style="width:100px">width:100px;</div> <div style="flex:2">flex: 2;</div> <div style="flex:1">flex: 1;</div> </div> </div> <div> <div> <p>display: -webkit-flex; </p> </div> <div class="demo demo2 boxborder"> <div style="margin-right:10px;"> <span>width:150px;</span> <span>margin-right:10px;</span></div> <div style="flex:1">flex: 1;</div> <div style="margin-left:10px;"> <span>width:150px;</span> <span>margin-left:10px;</span></div> </div> </div> </div> <h3 id="nbsp-flex-direction-nbsp">[ flex-direction ]</h3> <div style="width:900px"> <div> <div> <p>flex-direction: row; /*default*/</p> <p>display: -webkit-flex;</p> </div> <div class="demo demo-row"> <div style="flex:1">flex: 1;</div> <div style="flex:2">flex: 2;</div> <div style="flex:3">flex: 3;</div> </div> </div> <div> <div> <p>flex-direction: row-reverse;</p> <p>display: -webkit-flex; </p> </div> <div class="demo demo-row-reverse"> <div style="flex:1">flex: 1;</div> <div style="flex:2">flex: 2;</div> <div style="flex:3">flex: 3;</div> </div> </div> <div> <div> <p>flex-direction: column;</p> <p>display: -webkit-flex; </p> </div> <div class="demo demo-column"> <div style="flex:1">flex: 1;</div> <div style="flex:2">flex: 2;</div> <div style="flex:3">flex: 3;</div> </div> </div> <div> <div> <p>flex-direction: column-reverse;</p> <p>display: -webkit-flex; </p> </div> <div class="demo demo-column-reverse"> <div style="flex:1">flex: 1;</div> <div style="flex:2">flex: 2;</div> <div style="flex:3">flex: 3;</div> </div> </div> </div> <h3 id="nbsp-flex-wrap-nbsp">[ flex-wrap ]</h3> <div style="width:1310px"> <div> <div> <p>-webkit-flex-wrap: nowrap; /* default */</p> <p>display: -webkit-flex; </p> <p>width: 400px</p> </div> <div class="demo demo-nowrap"> <div style="width: 100px">100px;</div> <div style="width: 200px">width: 200px;</div> <div style="width: 300px">width: 300px;</div> </div> </div> <div> <div> <p>-webkit-flex-wrap: wrap</p> <p>display: -webkit-flex; </p> <p>width: 400px</p> </div> <div class="demo demo-wrap boxborder"> <div style="width: 100px">100px;</div> <div style="width: 200px">width: 200px;</div> <div style="width: 300px">width: 300px;</div> </div> </div> <div> <div> <p>-webkit-flex-wrap: wrap-reverse</p> <p>display: -webkit-flex; </p> <p>width: 400px</p> </div> <div class="demo demo-wrap-reverse boxborder"> <div style="width: 100px">100px;</div> <div style="width: 200px">width: 200px;</div> <div style="width: 300px">width: 300px;</div> </div> </div> </div> <h3 id="nbsp-flex-flow-nbsp-nbsp-flex-direction-nbsp-flex-wrap-nbsp-nbsp-自个体会吧-nbsp">[ flex-flow ]: flex-direction flex-wrap; /* 自个体会吧 */</h3> <h3 id="nbsp-justify-content-nbsp">[ justify-content ]</h3> <div style="width:1310px;"> <div> <div> <p>/* 效果如同 float:left; */</p> <p>justify-content: flex-start; /* default */</p> <p>display: -webkit-flex;</p> </div> <div class="demo boxborder" style="justify-content: flex-start;"> <div style="width:100px">width:100px;</div> <div style="width:100px">width:100px;</div> </div> </div> <div> <div> <p><p>/* 效果如同 float:right; */</p></p> <p>justify-content: flex-end;</p> <p>display: -webkit-flex;</p> </div> <div class="demo demo-justify boxborder" style="justify-content: flex-end;"> <div style="width:100px">width:100px;</div> <div style="width:100px">width:100px;</div> </div> </div> <div> <div> <p>/* 第三代水平居中方案 */</p> <p>justify-content: center;</p> <p>display: -webkit-flex;</p> </div> <div class="demo demo-justify-end boxborder" style="justify-content: center;"> <div style="width:100px">width:100px;</div> <div style="width:100px">width:100px;</div> </div> </div> <div> <div> <p>justify-content: space-between; </p> <p>display: -webkit-flex;</p> </div> <div class="demo demo-justify boxborder" style="justify-content: space-between;"> <div style="width:100px">width:100px;</div> <div style="width:100px">width:100px;</div> </div> </div> <div> <div> <p>justify-content: space-around; </p> <p>display: -webkit-flex;</p> </div> <div class="demo demo-justify-end boxborder" style="justify-content: space-around;"> <div style="width:100px">width:100px;</div> <div style="width:100px">width:100px;</div> </div> </div> </div> <h3 id="nbsp-align-self-nbsp">[ align-self ]</h3> <div> <div style="width:1000px;"> <div> <p>display: -webkit-flex;</p> </div> <div class="demo boxborder" style="width: 1000px; height:200px;"> <div style="width:200px; align-self:flex-start;">align-self:flex-start;</div> <div style="width:200px; align-self:flex-end;">align-self:flex-end;</div> <div style="width:200px; align-self:center;">align-self:center;</div> <div style="width:200px; align-self:auto;"> <span>align-self:auto;</span> <span>/*default */</span> </div> <div style="width:200px; align-self:baseline;">align-self:baseline;</div> <div style="width:200px; align-self:stretch;">align-self:stretch;</div> </div> </div> </div> <h3 id="nbsp-align-items-nbsp">[ align-items ]</h3> <div> <div> <div> <p>align-items: flex-start; /* default */</p> <p>display: -webkit-flex;</p> </div> <div class="demo boxborder" style="align-items: flex-start;height:200px;"> <div style="width:100px">width:100px;</div> <div style="width:100px">width:100px;</div> </div> </div> <div> <div> <p>align-items: flex-end; </p> <p>display: -webkit-flex;</p> </div> <div class="demo boxborder" style="align-items: flex-end;height:200px;"> <div style="width:100px">width:100px;</div> <div style="width:100px">width:100px;</div> </div> </div> <div> <div> <p>/* 第三代垂直居中 */</p> <p>align-items: center; </p> <p>display: -webkit-flex;</p> </div> <div class="demo boxborder" style="align-items: center;height:200px;"> <div style="width:100px">width:100px;</div> <div style="width:100px">width:100px;</div> </div> </div> <div> <div> <p>align-items: baseline; </p> <p>display: -webkit-flex;</p> </div> <div class="demo boxborder" style="align-items: baseline;height:200px;"> <div style="width:100px">width:100px;</div> <div style="width:100px">width:100px;</div> </div> </div> <div> <div> <p>align-items: stretch; </p> <p>display: -webkit-flex;</p> </div> <div class="demo boxborder" style="align-items: stretch;height:200px;"> <div style="width:100px; height:100px;">height:100px;</div> <div style="width:150px; min-height:20px;">min-height:20px;</div> <div style="width:150px; max-height:60px;">max-height:60px;</div> </div> </div> </div> <h3 id="nbsp-align-content-nbsp">[ align-content ]</h3> <div> <div> <div> <p>/* <span style="color:red"> 对比 align-items</span>*/</p> <p>align-items: flex-start</p> <p>display: -webkit-flex;</p> </div> <div class="demo demo-align-content" style="align-items: flex-start"> <div >a</div> <div >b</div> <div >c</div> <div >d</div> <div >e</div> <div >f</div> </div> </div> <div> <div> <p>align-content: flex-start; </p> <p>display: -webkit-flex;</p> </div> <div class="demo demo-align-content" style="align-content: flex-start;"> <div >a</div> <div >b</div> <div >c</div> <div >d</div> <div >e</div> <div >f</div> </div> </div> <div> <div> <p>align-content: flex-end; </p> <p>display: -webkit-flex;</p> </div> <div class="demo demo-align-content" style="align-content: flex-end;"> <div >a</div> <div >b</div> <div >c</div> <div >d</div> <div >e</div> <div >f</div> </div> </div> <div> <div> <p>align-content: center; </p> <p>display: -webkit-flex;</p> </div> <div class="demo demo-align-content" style="align-content: center;"> <div >a</div> <div >b</div> <div >c</div> <div >d</div> <div >e</div> <div >f</div> </div> </div> <div> <div> <p>align-content: space-between; </p> <p>display: -webkit-flex;</p> </div> <div class="demo demo-align-content" style="align-content: space-between;"> <div >a</div> <div >b</div> <div >c</div> <div >d</div> <div >e</div> <div >f</div> </div> </div> <div> <div> <p>align-content: space-around; </p> <p>display: -webkit-flex;</p> </div> <div class="demo demo-align-content" style="align-content: space-around;"> <div >a</div> <div >b</div> <div >c</div> <div >d</div> <div >e</div> <div >f</div> </div> </div> <div> <div> <p>align-content: stretch; /*default*/ </p> <p>display: -webkit-flex;</p> </div> <div class="demo demo-align-content" style="align-content: stretch;"> <div >a</div> <div >b</div> <div >c</div> <div >d</div> <div >e</div> <div >f</div> </div> </div> </div> <h3 id="nbsp-order-nbsp">[ order ]</h3> <div> <div style="width:1000px;"> <div> <p>display: -webkit-flex;</p> </div> <div class="demo demo-align-content" style="width: 1000px;height:40px;"> <div >a</div> <div >b</div> <div >c</div> <div style="order:-1; width:120px"> d (order:-1) </div> <div >e</div> <div >f</div> </div> </div> </div> </section> </body></html>

HTML代碼可以通過在線驗證器、集成工具和自動化流程來確保其清潔度。 1)使用W3CMarkupValidationService在線驗證HTML代碼。 2)在VisualStudioCode中安裝並配置HTMLHint擴展進行實時驗證。 3)利用HTMLTidy在構建流程中自動驗證和清理HTML文件。

HTML、CSS和JavaScript是構建現代網頁的核心技術:1.HTML定義網頁結構,2.CSS負責網頁外觀,3.JavaScript提供網頁動態和交互性,它們共同作用,打造出用戶體驗良好的網站。

HTML的功能是定義網頁的結構和內容,其目的在於提供一種標準化的方式來展示信息。 1)HTML通過標籤和屬性組織網頁的各個部分,如標題和段落。 2)它支持內容與表現分離,提升維護效率。 3)HTML具有可擴展性,允許自定義標籤增強SEO。

HTML的未來趨勢是語義化和Web組件,CSS的未來趨勢是CSS-in-JS和CSSHoudini,JavaScript的未來趨勢是WebAssembly和Serverless。 1.HTML的語義化提高可訪問性和SEO效果,Web組件提升開發效率但需注意瀏覽器兼容性。 2.CSS-in-JS增強樣式管理靈活性但可能增大文件體積,CSSHoudini允許直接操作CSS渲染。 3.WebAssembly優化瀏覽器應用性能但學習曲線陡,Serverless簡化開發但需優化冷啟動問題。

HTML、CSS和JavaScript在Web開發中的作用分別是:1.HTML定義網頁結構,2.CSS控製網頁樣式,3.JavaScript添加動態行為。它們共同構建了現代網站的框架、美觀和交互性。

HTML的未來充滿了無限可能。 1)新功能和標準將包括更多的語義化標籤和WebComponents的普及。 2)網頁設計趨勢將繼續向響應式和無障礙設計發展。 3)性能優化將通過響應式圖片加載和延遲加載技術提升用戶體驗。

HTML、CSS和JavaScript在網頁開發中的角色分別是:HTML負責內容結構,CSS負責樣式,JavaScript負責動態行為。 1.HTML通過標籤定義網頁結構和內容,確保語義化。 2.CSS通過選擇器和屬性控製網頁樣式,使其美觀易讀。 3.JavaScript通過腳本控製網頁行為,實現動態和交互功能。

HTMLISNOTAPROGRAMMENGUAGE; ITISAMARKUMARKUPLAGUAGE.1)htmlStructures andFormatSwebContentusingtags.2)itworkswithcsssforstylingandjavascript for Interactivity,增強WebevebDevelopment。


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

EditPlus 中文破解版
體積小,語法高亮,不支援程式碼提示功能

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

Dreamweaver Mac版
視覺化網頁開發工具

MinGW - Minimalist GNU for Windows
這個專案正在遷移到osdn.net/projects/mingw的過程中,你可以繼續在那裡關注我們。 MinGW:GNU編譯器集合(GCC)的本機Windows移植版本,可自由分發的導入函式庫和用於建置本機Windows應用程式的頭檔;包括對MSVC執行時間的擴展,以支援C99功能。 MinGW的所有軟體都可以在64位元Windows平台上運作。