Q
水平居中父母
1
A
回答
1
您是否嘗試過使用類似的引導格? 它會讓你的生活變得如此簡單。
你只是定義一個容器和自舉網格將爲你做所有的繁重工作。 包括調整到各種設備:)
<!-- simple three column display that will take seconds to create -->
<div class="container">
<div class="row">
<div class="span4">/div>
<div class="span4">/div>
<div class="span4"></div>
</div>
+0
我已經使用Bootstrap,但是在這種特殊情況下,藝術家'div's可以全部具有不同的高度和寬度,所以網格不能真正起作用 –
1
父必須具有
text-align:center; width:abc;
和一定的寬度。然後,孩子應該有
margin:auto; text-align:left; width:xyz;
例子:
<div style="width:100%; text-align:center;">
<div style="width:50%; text-align:left; background:red; margin:auto;">
This will do it just right
</div>
</div>
如果這不起作用,你應該檢查是否別的東西影響的行爲!
相關問題
- 1. 水平居中旋轉格在較小的父母
- 2. 水平居中水平ItemsControl
- 3. 水平居中
- 4. 水平居中
- 5. 父母不能水平中心div
- 6. 水平居中UL
- 7. 居中水平UL
- 8. 水平居中水平滾動頁面
- 9. 保留div父母身高一起兒童div內容水平居中
- 10. 垂直父母和水平孩子?
- 11. ImageView中水平居中TextView
- 12. 水平居中的錶行
- 13. 水平居中浮動框
- 14. 無法水平居中div
- 15. 水平居中多個UIView
- 16. CSS響應水平居中
- 17. 居中對齊水平div
- 18. as3水平居中圖像
- 19. 不能水平居中TextView
- 20. css水平居中圖像
- 21. SmartGWT:水平居中HTMLFlow
- 22. 如何水平居中DIV
- 23. 水平居中浮動div
- 24. 水平居中引導列
- 25. 水平居中圖像
- 26. Android:水平居中gridview
- 27. CSS水平居中行
- 28. 如何水平居中fic?
- 29. 居中水平導航欄
- 30. 如何水平居中JSpinner
嘗試bootstrap,我附上了一個答案,它會讓你的生活變得如此簡單:) –
@DoryZidon我已經使用bootstrap,但對於這個高度/寬度可變的內容,網格不能很好地工作 –