多列樣式佈局

来源:http://www.cnblogs.com/Idus/archive/2016/02/23/5208774.html
-Advertisement-
Play Games

效果圖如下: 代碼如下: 1 <!DOCTYPE html> 2 <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 3 <meta charset="UTF-8"> 4 <title>Doc


效果圖如下: 代碼如下:
  1 <!DOCTYPE html>
  2 <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  3     <meta charset="UTF-8">
  4     <title>Document</title>
  5     <style>
  6         * {
  7             margin: 0;
  8             padding: 0;
  9         }
 10         h2 {
 11             margin: 20px 0;
 12         }
 13         .left1 {
 14             width: 200px;
 15             height: 100px;
 16             green;
 17         }
 18         .right1 {
 19             width: 60%;
 20             height: 100px;
 21             red;
 22         }
 23         .left2 {
 24             width: 200px;
 25             height: 100px;
 26             green;
 27             display: inline-block;
 28         }
 29         .right2 {
 30             width: 60%;
 31             height: 100px;
 32             red;
 33             display: inline-block;
 34         }
 35         .left3 {
 36             width: 200px;
 37             height: 100px;
 38             float: left;
 39             green;
 40         }
 41         .right3 {
 42             width: 60%;
 43             height: 100px;
 44             float: right;
 45             red;
 46         }
 47         .mainL, .sitebarL, .mainR, .sitebarR {
 48             height: 200px;
 49             /*font: bolder 20px/200px '微軟雅黑';*/
 50             color: #fff;
 51             text-align: center;
 52         }
 53         .mainL {
 54             width: 100%;
 55             float: left;
 56         }
 57         .mainR {
 58             width: 100%;
 59             float: right;
 60         }
 61         .mainL .contentL {
 62             height: 100%;
 63             margin-right: 200px;
 64             red;
 65         }
 66         .mainR .contentR {
 67             height: 100%;
 68             margin-left: 200px;
 69             red;
 70         }
 71         .contentLR {
 72             height: 100%;
 73             margin-left: 200px;
 74             margin-right: 200px;
 75             red;
 76         }
 77         .sitebarL {
 78             width: 200px;
 79             float: left;
 80             margin-right: -100%;
 81             green;
 82         }
 83         .sitebarR {
 84             width: 200px;
 85             float: right;
 86             margin-left: -100%;
 87             green;
 88         }
 89         .clear {
 90             width: 100%;
 91             clear: both;
 92             height: 10px;
 93         }
 94         #left {
 95                 float: left;
 96                 width: 200px;
 97                 height: 100px;
 98                 green;
 99         }
100  
101         #contentL {
102             height: 100px;
103             red;
104             margin-left: 200px;/*==等於右邊欄寬度==*/
105         }
106         #right {
107             float: right;
108             width: 200px;
109             height: 100px;
110             green;
111         }
112  
113         #contentR {
114             height: 100px;
115             red;
116             margin-right: 200px;/*==等於左邊欄寬度==*/
117         }
118         #contentLR {
119             height: 100px;
120             red;
121             margin: 0 200px;
122         }
123         .cont {
124             overflow: hidden;
125         }
126     </style>
127 </head>
128 <body>
129     <h2>普通文檔佈局</h2>
130     <div class="left1">Left</div>
131     <div class="right1">Right</div>
132     <div class="clear"></div>
133  
134  
135     <h2>行內佈局使用inline-block</h2>
136     <div class="left2">Left</div>
137     <div class="right2">Right</div>
138     <div class="clear"></div>
139  
140  
141     <h2>浮動佈局float</h2>
142     <div class="left3">Left:<br>
143         width: 200px;<br>
144         height: 100px;<br>
145         float: left;<br>
146         green;
147     </div>
148     <div class="right3">Right<br>
149         width: 60%;<br>
150         height: 100px;<br>
151         float: right;<br>
152         red;
153     </div>
154     <div class="clear"></div>
155  
156  
157     <h2>浮動佈局float+margin正邊距與多列佈局</h2>
158     <h3>兩列</h3>
159     <div id="left">
160             Left Sidebar<br>
161             float: left;<br>
162             width: 200px;<br>
163             height: 100px;<br>
164             green;<br>
165     </div>
166     <div id="contentL">
167         height: 100px;
168             red;
169             margin-left: 200px;/*==等於左邊欄寬度==*/
170         <div id="contentInner">
171             Main Content
172         </div>
173     </div>
174     <div class="clear"></div>
175     <div id="right">
176         Right Sidebar<br>
177         float: right;<br>
178         width: 200px;<br>
179         height: 100px;<br>
180         green;
181     </div>
182     <div id="contentR">
183         height: 100px;
184             red;
185             margin-right: 200px;/*==等於右邊欄寬度==*/
186         <div id="contentInner">
187             Main Content
188         </div>
189     </div>
190     <div class="clear"></div>
191     <h3>三列</h3>
192     <div id="left">
193         Left Sidebar<br>
194         float: left;<br>
195         width: 200px;<br>
196         height: 100px;<br>
197         green;<br>
198     </div>
199     <div id="right">
200         Right Sidebar<br>
201         float: right;<br>
202         width: 200px;<br>
203         height: 100px;<br>
204         green;
205     </div>
206     <div id="contentLR">
207         <div id="contentInner">
208             Main Content<br>
209             height: 100px;<br>
210             red;<br>
211             margin: 0 200px;<br>
212         </div>
213     </div>
214  
215  
216     <h2>浮動佈局float+margin負邊距與多列佈局</h2>
217     <h3>兩列</h3>
218     <div class="sitebarL">
219         <h4>左側定寬200px區塊</h4>
220         <p>width: 200px;
221             float: left;
222             margin-right: -100%;
223             green;
224         </p>
225     </div>
226     <div class="mainR">
227         <div class="contentR">
228             <h4>右側主體自適應區塊</h4>
229             <p>.mainR:width: 100%;
230             float: right;</p>
231             <p>.contentR:height: 100%;
232             margin-left: 200px;
233             red;
234             </p>
235         </div>
236     </div>
237     <div class="clear"></div>
238     <div class="mainL">
239         <div class="contentL">
240             <h4>左側主體自適應區塊</h4>
241             <p>.mainL:width: 100%;
242             float: left;</p>
243             <p>.contentL:height: 100%;
244             margin-right: 200px;
245             red;</p>
246         </div>
247     </div>
248     <div class="sitebarR">
249         <h4>右側定寬200px區塊</h4><h4>
250         <p>width: 200px;
251             float: right;
252             margin-left: -100%;
253             green;
254         </p>
255     </h4></div>
256     <div class="clear"></div>
257     <h3>三列</h3>
258     <div class="sitebarL">
259         <h4>左側定寬200px區塊</h4>
260         <p>width: 200px;
261             float: left;
262             margin-right: -100%;
263             green;
264         </p>
265     </div>
266     <div class="mainL">
267         <div class="contentLR">
268             <h4>主體自適應區塊</h4>
269             <p>.mainR:width: 100%;
270                 float: left;
271             </p>
272             <p>.contentLR:height: 100%;
273                 margin-left: 200px;
274                 margin-right: 200px;
275                 red;
276             </p>
277         </div>
278     </div>
279     <div class="sitebarR">
280         <h4>右側定寬200px區塊</h4><h4>
281         <p>width: 200px;
282             float: right;
283             margin-left: -100%;
284             green;
285         </p>
286     </h4></div>
287     <div class="clear"></div> 
288 </body></html>

 


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 1 package com.shejimoshi.structural.Composite.type1; 2 3 4 /** 5 * 功能:將對象組合成樹形結構以表示“部分-整體”的層次結構。composite使得用戶對單個對象和組合對象的使用具有一致性 6 * 適用:想表示對象的部分-整體層次結構
  • 定義 橋接模式(bridge):將抽象部分與實現部分分離,使它們都可以獨立的變化. 從定義來看,抽象的簡直看不了,那麼通俗點講,我們怎麼理解橋接模式呢? 我們再舉一個例子,假設你是一個地主,你有兩個管家,兩個工人,那麼每天你怎麼指揮他們呢,你可以告訴管家A讓工人1去幹活,同時也可以告訴管家B讓工人2
  • Atitit.跨語言系統服務管理器api相容設計 1. Common api,相容sc ,service control??1 1.1. 服務創建,use sc1 1.2. 服務delete ,use sc1 1.3. 服務start, net start1 1.4. Service stop, n
  • 前段時間一個項目因併發量大。因防止宕機做了主從備份,首頁的表連接查詢又非常的耗時。故此拿出利器Redis緩存這個查詢結果,並隨著用戶操作而更新。 因官方目前只有linux版,Windows版下載: https://github.com/ServiceStack/redis-windows/tree/
  • 軟體環境:jdk、tomcat、docker、centos、虛擬機 首先,您要準備一個 CentOS 的操作系統,虛擬機也行。總之,可以通過 Linux 客戶端工具訪問到 CentOS 操作系統就行。 需要說明的是,Ubuntu 或其它 Linux 操作系統也能玩 Docker,只不過本文選擇了以
  • 使用JDK的類 BASE64Decoder BASE64Encoder Java代碼 package test; import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; /** * BASE64加密解密 */ public clas
  • 本文轉載:http://www.manongjc.com/article/517.html 選擇器是CSS的核心,從最初的元素、class/id選擇器,演進到偽元素、偽類,以及CSS3中提供的更豐富的選擇器,定位頁面上的任意元素開始變得愈發的簡單。 1、元素選擇器 這是最基本的CSS選擇器,HTML
  • 效果圖如下: 代碼如下: <html> <head> <title>Javascript版選擇下拉菜單互移且排序</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> </head> <body> <
一周排行
    -Advertisement-
    Play Games
  • 示例項目結構 在 Visual Studio 中創建一個 WinForms 應用程式後,項目結構如下所示: MyWinFormsApp/ │ ├───Properties/ │ └───Settings.settings │ ├───bin/ │ ├───Debug/ │ └───Release/ ...
  • [STAThread] 特性用於需要與 COM 組件交互的應用程式,尤其是依賴單線程模型(如 Windows Forms 應用程式)的組件。在 STA 模式下,線程擁有自己的消息迴圈,這對於處理用戶界面和某些 COM 組件是必要的。 [STAThread] static void Main(stri ...
  • 在WinForm中使用全局異常捕獲處理 在WinForm應用程式中,全局異常捕獲是確保程式穩定性的關鍵。通過在Program類的Main方法中設置全局異常處理,可以有效地捕獲並處理未預見的異常,從而避免程式崩潰。 註冊全局異常事件 [STAThread] static void Main() { / ...
  • 前言 給大家推薦一款開源的 Winform 控制項庫,可以幫助我們開發更加美觀、漂亮的 WinForm 界面。 項目介紹 SunnyUI.NET 是一個基於 .NET Framework 4.0+、.NET 6、.NET 7 和 .NET 8 的 WinForm 開源控制項庫,同時也提供了工具類庫、擴展 ...
  • 說明 該文章是屬於OverallAuth2.0系列文章,每周更新一篇該系列文章(從0到1完成系統開發)。 該系統文章,我會儘量說的非常詳細,做到不管新手、老手都能看懂。 說明:OverallAuth2.0 是一個簡單、易懂、功能強大的許可權+可視化流程管理系統。 有興趣的朋友,請關註我吧(*^▽^*) ...
  • 一、下載安裝 1.下載git 必須先下載並安裝git,再TortoiseGit下載安裝 git安裝參考教程:https://blog.csdn.net/mukes/article/details/115693833 2.TortoiseGit下載與安裝 TortoiseGit,Git客戶端,32/6 ...
  • 前言 在項目開發過程中,理解數據結構和演算法如同掌握蓋房子的秘訣。演算法不僅能幫助我們編寫高效、優質的代碼,還能解決項目中遇到的各種難題。 給大家推薦一個支持C#的開源免費、新手友好的數據結構與演算法入門教程:Hello演算法。 項目介紹 《Hello Algo》是一本開源免費、新手友好的數據結構與演算法入門 ...
  • 1.生成單個Proto.bat內容 @rem Copyright 2016, Google Inc. @rem All rights reserved. @rem @rem Redistribution and use in source and binary forms, with or with ...
  • 一:背景 1. 講故事 前段時間有位朋友找到我,說他的窗體程式在客戶這邊出現了卡死,讓我幫忙看下怎麼回事?dump也生成了,既然有dump了那就上 windbg 分析吧。 二:WinDbg 分析 1. 為什麼會卡死 窗體程式的卡死,入口門檻很低,後續往下分析就不一定了,不管怎麼說先用 !clrsta ...
  • 前言 人工智慧時代,人臉識別技術已成為安全驗證、身份識別和用戶交互的關鍵工具。 給大家推薦一款.NET 開源提供了強大的人臉識別 API,工具不僅易於集成,還具備高效處理能力。 本文將介紹一款如何利用這些API,為我們的項目添加智能識別的亮點。 項目介紹 GitHub 上擁有 1.2k 星標的 C# ...