Nat*_*pos 25 css layout overflow width
我正在尝试使我的网页的一部分符合浏览器的宽度,因为我正在使用width: 100%,问题是它显示滚动条而我无法使用,overflow-x: hidden;因为它会使一些内容隐藏,所以我怎么解决这个问题?
#news {
list-style-type: none;
position: absolute;
bottom: 0;
width: 100%;
text-align: center;
margin-right: 10px;
margin-left: 10px;
padding: 0;
-webkit-user-select: text;
}
Run Code Online (Sandbox Code Playgroud)
thi*_*dot 31
因为你正在使用position: absolute,而不是使用:
width: 100%; margin-right: 10px; margin-left: 10px
Run Code Online (Sandbox Code Playgroud)
你应该使用:
left: 10px; right: 10px
Run Code Online (Sandbox Code Playgroud)
这将使您的元素占据整个宽度,10px左侧和右侧都有空间.
| 归档时间: |
|
| 查看次数: |
36281 次 |
| 最近记录: |