Butang dengan tatal mendatar dalam susun atur jubin
P粉823268006
P粉823268006 2023-08-31 20:54:51
0
2
570
<p>Saya mempunyai banyak butang yang menatal secara menegak dalam susun atur jubin, seperti ini: </p> <p> <pre class="brush:html;toolbar:false;"><style> .butang-jubin { lebar: 33.3%; ketinggian:100px; warna latar belakang: biru muda; sempadan: pepejal 1px kelabu; ruang putih: 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">title</button> <button class="tile-button">title</button> <button class="tile-button">title</button> <button class="tile-button">title</button> <button class="tile-button">title</button> <button class="tile-button">title</button> <button class="tile-button">title</button> <button class="tile-button">title</button> <button class="tile-button">title</button> <button class="tile-button">title</button> <button class="tile-button">title</button> <button class="tile-button">title</button> <button class="tile-button">title</button> <button class="tile-button">title</button> <button class="tile-button">title</button> <button class="tile-button">title</button> <button class="tile-button">title</button> <button class="tile-button">title</button> <button class="tile-button">title</button> <div> </body></pre> </p> <p>Sekarang saya perlu melakukan perkara yang sama, tetapi hanya dengan menatal mendatar. Bolehkah sesiapa membantu saya? Terima kasih banyak</p>
P粉823268006
P粉823268006

membalas semua(2)
P粉060528326

Cuma tambah kod CSS ini 'white-space:nowrap;' dalam bekas DIV.

<div style="width:100%;height:300px;background-color: coral;overflow-y: scroll;font-size:0px;white-space:nowrap; ">
P粉156415696

Saya jumpa penyelesaiannya:

<style>
/* webkit, per chrome, edge, safari */
::-webkit-scrollbar {
    height: 12px;
    width: 5px;
    background: #aaa;
}

::-webkit-scrollbar-thumb {
    background: #393812;
    -webkit-border-radius: 1ex;
    -webkit-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.75);
}

::-webkit-scrollbar-corner {
    background: #000;
}

/* per firefox */
.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: #393812 #aaa;
}

.container {
  width: 100%; 
  height: 300px; 
  border: 1px solid green;
  overflow-x: scroll;
  overflow-y: hidden;
  font-size:0px;
}

.inner {
  height: 100%;
  white-space:nowrap; 
}

.floatLeft {
  width: 150px;
  margin:0px; 
  display: inline-block;
}

button {
  height: 94px;
  width: 150px;
  margin: 0px;
  border: solid 1px gray;
}
</style>

<div class="container custom-scrollbar">
   <div class="inner">
       <div class="floatLeft">
         <div>
           <button>Cap1</button>
         </div>
         <div>
           <button>Cap2</button>
         </div>
         <div>
           <button>Cap3</button>
         </div>
       </div>
       <div class="floatLeft">
         <div>
           <button>Cap1</button>
         </div>
         <div>
           <button>Cap2</button>
         </div>
         <div>
           <button>Cap3</button>
         </div>
       </div>
       <div class="floatLeft">
         <div>
           <button>Cap1</button>
         </div>
         <div>
           <button>Cap2</button>
         </div>
         <div>
           <button>Cap3</button>
         </div>
       </div>
       <div class="floatLeft">
         <div>
           <button>Cap1</button>
         </div>
         <div>
           <button>Cap2</button>
         </div>
         <div>
           <button>Cap3</button>
         </div>
       </div>
       <div class="floatLeft">
         <div>
           <button>Cap1</button>
         </div>
         <div>
           <button>Cap2</button>
         </div>
         <div>
           <button>Cap3</button>
         </div>
       </div>
       <div class="floatLeft">
         <div>
           <button>Cap1</button>
         </div>
         <div>
           <button>Cap2</button>
         </div>
         <div>
           <button>Cap3</button>
         </div>
       </div>
   </div>
</div>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan