使用 display 屬性指定用于 HTML 元素的框類型。
示例
您可以嘗試運(yùn)行以下代碼來(lái)實(shí)現(xiàn)display屬性來(lái)顯示flex容器。
現(xiàn)場(chǎng)演示
<!DOCTYPE html> <html> <head> <style> .mycontainer { display: flex; height: 300px; background-color: orange; } .mycontainer > div { background-color: white; text-align: center; line-height: 90px; font-size: 40px; width: 100px; margin: 50px; } </style> </head> <body> <h1>Quiz</h1> <div class = "mycontainer"> <div>Q1</div> <div>Q2</div> <div>Q3</div> <div style = "align-self: center">Q4</div> <div>Q5</div> </div> </body> </html>
登錄后復(fù)制
以上就是如何使用 CSS 指定 HTML 元素使用的框類型?的詳細(xì)內(nèi)容,更多請(qǐng)關(guān)注www.92cms.cn其它相關(guān)文章!