iT邦幫忙

0

DIV內的多個Button要如何置中

大家好
想要來試著寫網頁
但遇到個困難

https://ithelp.ithome.com.tw/upload/images/20200708/20115224aaRSehJABH.png

https://ithelp.ithome.com.tw/upload/images/20200708/201152240GwV8OL4h0.png
我是在Chrome的DevTools上操作的
希望這六的button可以在藍色框裡水平置中
且因畫面變窄 六個button也要隨著畫面變化 變成直列的
像是這樣
https://ithelp.ithome.com.tw/upload/images/20200708/20115224e3SAkCMpYi.png
也要在藍色框裡水平置中

謝謝

請先提供你目前的css配置。比較好了解你目前的情況。
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

2
japhenchen
iT邦超人 1 級 ‧ 2020-07-08 09:30:55
最佳解答

單純BUTTON或用JQUERY跑button()或用DIV自製.....
上層容器的CSS設text-align:center;

    <div style="text-align:center;">
        <button>1</button>
        <button>2</button>
        <button>3</button><br>
        <button>4</button>
        <button>5</button>
        <button>6</button>
    </div>
HAHZOZO iT邦新手 5 級 ‧ 2020-07-08 10:03:12 檢舉

謝謝 搞定了
增加CSS
justify-content: center;
就可以了 謝謝

我要發表回答

立即登入回答