簡體   English   中英

在右邊放置許多不同的div元素,每個元素的高度和寬度均為100%(全屏)

[英]Place many different div elements to the right, each with height and width 100 percent (fullscreen)

即時通訊面臨的問題,我需要一些建議。 我想有幾個主要的div容器,可以說

<div class="main">

一個到另一個在右邊。

  1. 所有主容器應具有完整的寬度和高度(全屏顯示)。
  2. 在右側,我需要其他幾個具有前者大小和寬度的主容器。

是否可以在不使用javascript進行閱讀和設置的情況下將div彼此正確設置? 是否有CSS / HTML解決方案?

在此處輸入圖片說明

例:

<div class="main"><!--to the right one more --> 
</div>

<div class="main"><!--to the right one more -->
</div>

<div class="main">
</div>

風格:#這不起作用...

.main{
width:100%;
height:auto;
float: right;

}

我可能誤解了這個問題,但請嘗試

html, body {
   height: 100%;   
}

body {
    width: 300%;
}

.main {
   height: 100%;
   width: 33.333333333%;
   float: left;    
}

http://jsfiddle.net/3yaJZ/

希望我理解的是您想告訴的。.根據我的理解,您希望將3 div(主)放在一個位組件(容器)中,每個組件的寬度為100%,您可以在檢查時檢查每個div水平滾動...

在你的CSS中

body{
width:300%;
height:100%;
}
.main{
width:100%;
height:100%;
float:left;
}

還有你的html-

<body>
<div class="main"><!--to the right one more --> 
</div>

<div class="main"><!--to the right one more -->
</div>

<div class="main">
</div>
</body>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM