使用 display 屬性指定用于 HTML 元素的框類型。
示例
您可以嘗試運行以下代碼來實現(xiàn)display屬性來顯示flex容器。
現(xiàn)場演示
<!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>
登錄后復制
以上就是如何使用 CSS 指定 HTML 元素使用的框類型?的詳細內容,更多請關注www.92cms.cn其它相關文章!






