tes*_*der 7 html css scroll horizontal-scrolling
我有div,其中放置内部div我需要使所有内部div在行和水平滚动条应显示(我知道这听起来很疯狂,但我需要).我尝试了容器宽度自动和溢出滚动但没有.
怎么做到这一点?
我的加价:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>text-overflow</title>
<style>
body{
width: auto;
}
#items{
overflow-x: scroll;
width: auto;
}
.item{
display: inline-block;
width: 400px;
height: 100px;
border:1px solid;
}
</style>
</head>
<body>
<div id="items">
<div class="item">
Item content
</div>
<div class="item">
Item content
</div>
<div class="item">
Item content
</div>
<div class="item">
Item content
</div>
<div class="item">
Item content
</div>
<div class="item">
Item content
</div>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
Zol*_*oth 21
使用white-space: nowrap;上#items
#items{
overflow-x: scroll;
width: auto;
white-space: nowrap;
}
Run Code Online (Sandbox Code Playgroud)