我在容器內有兩個<div>
標籤。其中一個漂浮在右邊,另一個漂浮在左邊。 我試圖排隊他們,但問題是,正確的一個下了左邊,並沒有浮動。css div floating
回答
檢查這個fiddle。
它不是正確的浮動,因爲你正在給你的div
的填充,這使得你的.rightside
股利底部。而不是給填充內部元素填充div
。
而不是給px
給你div
的百分比。它可以幫助你理解模式。
我從你的div中刪除了填充,並向下面的內部元素添加了填充。
h4,p{padding:5px;}
檢查這個@ user1665569這也許是你想要的。 –
It is working fine. I have checked except.
change
<font color= "#FFFFFF"><b>Site Contents</b>
to
<font color= "#FFFFFF"><b>Site Contents</b></font>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title> new document </title>
<style type="text/css">
.subcontent{width:750px;}
.menu {
background-color :#FFD700;
float: left;
padding-bottom: 100px;
width:170px;
font-family: Verdana;
font-size: 12px;
}
.rightside {
background-color: #FFF;
float:left;
width:540;
padding-left:10px;
}
</style>
</head>
<body>
<div class="subcontent">
<div class="menu">
<div class="submenu" style= "background-color:#A80000; text-align:center; width:120px; padding:10px">
<font color= "#FFFFFF"><b>Site Contents</b></font>
</div>
<h4><b>Virtual Tour</b></h4>
<P>Explore the lab to know the insights of the new world!</p>
<h4><b>Experiments</b></h4>
<P>There is lot more to it that would fascinate you.</P>
<h4>Lab History</h4>
<P> Find out the need to make it underground.</P>
</div>
<div class = "rightside">
<div id="separator" style="background-color: #A80000; height: 20px">
</div>
<p id="para1"> Located 2,341 feet beneath the surface in an old iron mine, the lab is deep enough that particle physics experiments see less than 100,00 times the cosmic radiation than on the surface, allowing sensitive searches for exotic particles like neutrinos and dark matter.</P>
</div>
</div>
</body>
</html>
是的,但我想那個領域在底部的段落正好在菜單旁邊漂浮 – user1665569
好吧,您希望在右側區域和內容上找到菜單。我是否正確使用...? – aravind3
是的,這就是我想要的 – user1665569
- 1. css floating and iexplorer
- 2. floating popup.html div
- 3. Div Floating left down down
- 4. CSS Floating/Wrapping問題
- 5. html div floating and sizing
- 6. CSS Floating Divs問題
- 7. Floating Divs and centering the Div
- 8. Floating DIV column out of position
- 9. floating divs:align:middle
- 10. Floating Div in chrome clears the parent div
- 11. Floating/Popover圖片
- 12. Floating Link in Page
- 13. Floating Div的調整大小問題
- 14. Floating Div - 停止清除/包裝
- 15. Divs floating wrong
- 16. Floating DIVs not flowing properly
- 17. Floating PagerTabStrip
- 18. JButton floating
- 19. Floating Divs +動態高度
- 20. ie 6 footer floating to top issue
- 21. Flooring floating-point modulo
- 22. Wordpress floating/sticky box
- 23. vaadin floating(dynamic?)layout
- 24. javascript floating decimal
- 25. GameObject Prefabs floating away
- 26. C++「Floating Point Enum」
- 27. Binary Floating Point Addition
- 28. Arm Assembly Floating Point
- 29. Floating window Cordova
- 30. Floating Tableless Layout
你的代碼檢查有一次錯誤。 –
嗯......我不知道你說的究竟是什麼錯誤 – user1665569
'Font'缺少結束標記,'p'在某些地方和特殊字符中有大寫字母。這些錯誤並不代表任何代碼問題,但你應該檢查它們。 :) –