请实现一个网页顶部区域居中并排显示四个小方块颜色分别是 RED BLUE YELLOW GREEN 方块大小为20px请在每一个方块后面增加颜色的描述文字
<!DOCTYPE html>
<html>
<head>
<title>Color Squares</title>
<style>
.container {
width: 100%;
text-align: center;
}
.square {
display: inline-block;
width: 20px;
height: 20px;
margin: 10px;
}
.red {
background-color: red;
}
.blue {
background-color: blue;
}
.yellow {
background-color: yellow;
}
.green {
background-color: green;
}
.description {
display: inline-block;
margin: 10px;
}
</style>
</head>
<body>
<div class="container">
<div class="square red"></div>
<div class="description">Red</div>
<div class="square blue"></div>
<div class="description">Blue</div>
<div class="square yellow"></div>
<div class="description">Yellow</div>
<div class="square green"></div>
<div class="description">Green</div>
</div>
</body>
</html
原文地址: https://www.cveoy.top/t/topic/gsG3 著作权归作者所有。请勿转载和采集!