使用grid-auto-columns屬性設定列的預設大小。
您可以嘗試執行以下程式碼來使用CSS實作grid-auto-columns屬性
即時示範
<!DOCTYPE html> <html> <head> <style> .container { display: grid; grid-auto-columns: 100px; grid-gap: 10px; background-color:red; padding: 10px; } .container>div { background-color: yellow; text-align: center; padding:10px 0; font-size: 20px; } </style> </head> <body> <div class = "container"> <div class = "ele1">1</div> <div class = "ele2">2</div> <div class = "ele3">3</div> <div class = "ele4">4</div> <div class = "ele5">5</div> <div class = "ele6">6</div> </div> </body> </html>
以上是CSS grid-auto-columns 屬性的用法的詳細內容。更多資訊請關注PHP中文網其他相關文章!