求一个 经典布局方案_html/css_WEB-ITnose
如上图,要求:使用纯css实现,不使用js
想了半天没想到好的办法实现
回复讨论(解决方案)
<!doctype html><html><head><meta charset="utf-8"><title>无标题文档</title><meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/><style>*{ margin:0; padding:0;}html,body{ width:100%;height:100%}.b{ /*设置元素宽度包含边框宽度**/box-sizing: border-box; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; }main{margin-top:-50px;margin-left:-200px;padding-left:200px; padding-top:50px;overflow-y:scroll;float:left;background:#FF0000; width:100%; height:100%;}#left{ float:left; width:200px; height:100%; padding-top:50px; margin-top:-50px;overflow-y:scroll; background:#0000FF; z-index:2; position:relative }</style> </head><body><header style=" line-height:50px;height:50px; background:#666666; color:#FFFFFF; text-align:center;z-index:3; position:relative"> width:100%;height:50px;</header><div id="left" class="b" > <!--用于展示部分--> <div style="width:100%; height:33%; background:#00FF00">1</div> <div style="width:100%; height:33%; background:#666">2</div> <div style="width:100%; height:33%; background:#09F">3</div> <div style="width:100%; height:33%; background:#3C0">4</div> <div style="width:100%; height:33%; background:#3FF">5</div> <div style="width:100%; height:33%; background:#F3C">6</div> <!----------></div><main class="b"> <!--用于展示部分--> <div style="width:100%; height:33%; background:#3C0">1</div> <div style="width:100%; height:33%; background:#F3C">2</div> <div style="width:100%; height:33%; background:#3FF">3</div> <div style="width:100%; height:33%; background:#09F">4</div> <div style="width:100%; height:33%; background:#666">5</div> <div style="width:100%; height:33%; background:#00FF00">6</div> <!--------------></main</body></html>
试试:table-cell+table-row
@q81999008
现在你的这个例子有一个小问题,就是 左侧的滚动条看不到上面的箭头。有没有更好的体验办法
<!doctype html><html><head><meta charset="utf-8"><title>无标题文档</title><meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/><style>*{ margin:0; padding:0;}html,body{ width:100%;height:100%}.b{ /*设置元素宽度包含边框宽度**/box-sizing: border-box; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; }main{margin-top:-50px;margin-left:-200px;padding-left:200px; padding-top:50px;float:left;background:#FF0000; width:100%; height:100%;}#left{ float:left; width:200px; height:100%; padding-top:50px; margin-top:-50px; background:#0000FF; z-index:2; position:relative }</style> </head><body><header style=" line-height:50px;height:50px; background:#666666; color:#FFFFFF; text-align:center;z-index:3; position:relative"> width:100%;height:50px;</header><div id="left" class="b"> <div style=" overflow-y:scroll; height:100%; width:100%"> <!--用于展示部分--> <div style="width:100%; height:33%; background:#00FF00">1</div> <div style="width:100%; height:33%; background:#666">2</div> <div style="width:100%; height:33%; background:#09F">3</div> <div style="width:100%; height:33%; background:#3C0">4</div> <div style="width:100%; height:33%; background:#3FF">5</div> <div style="width:100%; height:33%; background:#F3C">6</div> <!----------> </div></div><main class="b"> <div style=" overflow-y:scroll; height:100%; width:100%"> <!--用于展示部分--> <div style="width:100%; height:33%; background:#3C0">1</div> <div style="width:100%; height:33%; background:#F3C">2</div> <div style="width:100%; height:33%; background:#3FF">3</div> <div style="width:100%; height:33%; background:#09F">4</div> <div style="width:100%; height:33%; background:#666">5</div> <div style="width:100%; height:33%; background:#00FF00">6</div> <!--------------> </div></main</body></html>
@q81999008 谢谢 经测试 可用。

熱AI工具

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

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

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

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

熱門文章

熱工具

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

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

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

WebDevelovermentReliesonHtml,CSS和JavaScript:1)HTMLStructuresContent,2)CSSStyleSIT和3)JavaScriptAddSstractivity,形成thebasisofmodernWebemodernWebExexperiences。

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

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

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

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

HTML是構建網頁結構的基石。 1.HTML定義內容結構和語義,使用、、等標籤。 2.提供語義化標記,如、、等,提升SEO效果。 3.通過標籤實現用戶交互,需注意表單驗證。 4.使用、等高級元素結合JavaScript實現動態效果。 5.常見錯誤包括標籤未閉合和屬性值未加引號,需使用驗證工具。 6.優化策略包括減少HTTP請求、壓縮HTML、使用語義化標籤等。

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

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