-1
A
回答
1
你真的不需要引導這個!
在你的情況下不能運行的代碼段,這是CodePen筆:http://codepen.io/kranzy/pen/bwqWbo
body {
margin: 0;
}
.full {
position: absolute;
width: 100%;
height: 100%;
background-color: red;
overflow: hidden;
}
.inside {
position: relative;
/* some bit of margins */
top: 50px;
left: 50px;
/* calculate the width, if not, weird effect. */
width: calc(100% - 50px * 2);
height: calc(100% - 50px * 2);
/* 50px * 2 because 50px is just enough for the .inside div's width and height not to fall out of screen. */
/* make it like your image */
background-color: blue;
overflow: auto;
}
<div class="full">
<div class="inside"></div>
</div>
+1
你想添加一些文本到內部塊嗎?當滾動條出現時,代碼片段會更清晰。 –
+0
我想我不應該因爲你將不得不刪除lorem ipsum文本來使用代碼。但是,如果重要,隨時編輯我的答案。 –
0
<div class="main" style="background-color:red; height:100vh; float:left; width:100%;>
<div class="wrapper" style="width:1170px;margin:0 auto">
<div class="main-text" style="float:left; width:100%; background-color:blue;">
</div>
<div>
</div>
相關問題
- 1. HTML,身體和高度的div 100%
- 2. 100%高度可滾動的div內部的身體與50px的底部邊距
- 3. Bootstrap邊欄不滾動100%高度
- 4. 垂直滾動100%高度div
- 5. 100%的高度div與JQuery頁滾動
- 6. DIV - 100%高度導致滾動條
- 7. Twitter Bootstrap - 100%身高
- 8. css讓父母的div 100%身高和兒童可滾動
- 9. 滾動塊的100%高度
- 10. 滾動與100%的高度
- 11. CSS 100%高度滾動
- 12. CSS 100%高度不工作,但身體是100%高度?
- 13. 製作可滾動的div 100%的父容器高度
- 14. 可滾動div與側div的高度
- 15. Div浮動左高度100%
- 16. div高度100%
- 17. 100%div高度
- 18. Div 100%高度
- 19. 浮動div,高度100,容器流體高度
- 20. HTML,身體{身高:100%}始終顯示滾動條
- 21. 孩子身高是滾動父內容高度的100%
- 22. 動態高度可滾動div
- 23. 100%高度div內100%td
- 24. 身體元素沒有100%高度
- 25. CSS 100%高度的身體和元素
- 26. 100%查看高度和寬度div與滾動
- 27. 動態高度DIV滾動
- 28. div的高度100%
- 29. 100%身高的滾動單元表
- 30. IE8身高:100%;在滾動條
告訴我到目前爲止你已經嘗試過的代碼? –
我找到了一個使用jquery的解決方案;我得到身高onload和調整大小減去100px(填充)。無論如何謝謝 –
使用css'calc()'比jquery更容易!學習它以使代碼更清晰。如果你使用jquery,那麼這段代碼必須運行onload和onresize,更困難。 –