平鋪佈局中帶有水平滾動的按鈕
P粉823268006
2023-08-31 20:54:51
<p>我有很多按鈕以瓷磚佈局垂直滾動,就像這樣:</p>
<p>
<pre class="brush:html;toolbar:false;"><style>
.tile-button {
width:33.3%;
height:100px;
background-color: lightblue;
border: solid 1px gray;
white-space: normal;
maring: 0px;
}
</style>
<body style="margin: 0;">
<div style="width:100%;height:300px;background-color: coral;overflow-y: scroll;font-size:0px;">
<button class="tile-button">標題</button>
<button class="tile-button">標題</button>
<button class="tile-button">標題</button>
<button class="tile-button">標題</button>
<button class="tile-button">標題</button>
<button class="tile-button">標題</button>
<button class="tile-button">標題</button>
<button class="tile-button">標題</button>
<button class="tile-button">標題</button>
<button class="tile-button">標題</button>
<button class="tile-button">標題</button>
<button class="tile-button">標題</button>
<button class="tile-button">標題</button>
<button class="tile-button">標題</button>
<button class="tile-button">標題</button>
<button class="tile-button">標題</button>
<button class="tile-button">標題</button>
<button class="tile-button">標題</button>
<button class="tile-button">標題</button>
<div>
</body></pre>
</p>
<p>現在我需要做同樣的事情,但只有水平滾動。
有人可以幫我嗎?
非常感謝</p>
只需在容器DIV中加入此CSS程式碼 'white-space:nowrap;'。
我找到了解決方案: