0
A
回答
0
也許最好的辦法是在內部div上使用margin-left屬性,以便給出向右浮動的錯覺。
0
如果我正確地理解了你,你可以這樣做。 編輯:到新的編輯底部!
你父DIV(ID = 「父」) 兒童DIV(ID = 「孩子」)
你需要的CSS和HTML做到這一點。
- 使您的父母和孩子的div正確嵌套。
<div id="parent">
<div id="child">
<!-- Whatever goes in your div -->
</div>
<div id="child2">
<!-- Whatever goes in your div -->
</div>
</div>
- 現在你需要創建一個CSS類爲您的父母和孩子div的。
/* this will use the ID of the div, to use a class its .parent and you need to set the class parameter of the div. */
#parent {
width: 1000px;
height: 500px;
background-color: #333 /* Grey */
}
#child {
width: 450px;
height: 500px;
float: right;
background-color: #2e00ff /* Blue */;
}
#child2 {
width: 450px;
height: 500px;
float: left;
background-color: #ff0000 /* Red */;
}
<div id="parent">
<div id="child">
<!-- Whatever goes in your div -->
</div>
<div id="child2">
<!-- Whatever goes in your div -->
</div>
</div>
希望這有助於! -InvincibleM
編輯:你應該能夠在div元素中放置任何像按鈕一樣的填充符。
0
這個月的工作適合你
<div class="flex">
<div class="other-items">
may be large chunks ..
</div>
<div class="right"> <!-- separate the element and give position -->
right
</div>
</div>
.flex {
display: flex;
position: relative;
}
.other-items {
width: 98%;
/*padding-right: 15px;*/
}
.right {
position: absolute;
right: 10px;
top: 0px;
}
+0
根據您的需要調整頂部,右側,寬度 – bhv
0
您可以使用下面的CSS的方法來得到它 使用一個parent
DIV然後一個按鈕parent
DIV中,使用float:right
到按鈕的父div並使用display:inline-block
以單行對齊。
.box {
width: 100%;
border: 2px solid;
padding: 10px;
}
.buttonGroup {
display: inline-block;
float: right;
margin-top: 5px;
}
.dashboard {
border: 2px solid;
padding: 4px;
display: inline-block;
text-align: right;
}
.refresh {
border: 2px solid;
display: inline-block;
margin-right: 10px;
}
.setting {
border: 2px solid;
display: inline-block;
}
<div class="box">
<div class="dashboard">Dashboard</div>
<div class="buttonGroup">
<div class="refresh">refresh</div>
<div class="setting">Setting</div>
</div>
</div>
0
試試這個:
.parent {
overflow:hidden;
background: orange;
}
.child1 {
height: 200px;
width: auto;
background: red;
float: left;
}
.child2 {
height: 200px;
width: auto;
background: blue;
float: right;
}
<div class="parent">
<div class="child1">Child1</div>
<div class="child2">Child2</div>
</div>
相關問題
- 1. 嵌套浮動Div
- 2. 與浮動嵌套的div
- 3. 展開父浮動子div
- 4. 嵌套的div浮動對齊
- 5. 浮動div父母?
- 6. 浮動子女中心父母div
- 7. 浮動子元素溢出父div
- 8. 子div浮動在其父項下
- 9. 內部div浮動outisde父
- 10. 浮動權DIV問題,IE
- 11. 使父子代的子級別浮動
- 12. Div似乎沒有內容作爲嵌套的div浮動
- 13. 限制div浮動清除到一個嵌套div內
- 14. 將浮動div對齊到父div
- 15. 浮動div文本內的父div
- 16. 浮動DIV是逸出父DIV
- 17. 讓div浮動到父div的底部?
- 18. 與浮動div的父DIV蔡爾茲
- 19. 當子div被漂浮時,父div失去自動高度
- 20. 從父div浮動文本在兩個並排子div上?
- 21. 左邊的div浮動,兩個div浮動權HTML5
- 22. 使浮動的div div分開浮動
- 23. 使用jQuery添加文本之後,嵌套div在包含div之外浮動
- 24. DIV浮動右浮動DIV左浮動
- 25. Div浮左有Div浮動權奇怪的影響
- 26. 如何重置嵌套div之間的父子關係
- 27. 嵌套浮動divs導致外部div不增長
- 28. 劍道PanelBar和嵌套浮動的div(ASP.NET MVC)
- 29. 爲嵌套在浮動div中的元素設置margin屬性
- 30. div浮動在桌子上
呢'浮動:right'作品?如果沒有,你可以在這裏粘貼你的當前代碼。 –
@Bk Santigo ..內部div的寬度是自動的。 –
你正在使用儀表板和刷新按鈕周圍的邊框它是什麼div? – LKG