<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>作业</title>
<style>
* {
padding: 0;
margin: 0;
}
li {
list-style: none;
float: left;
width: 120px;
height: 50px;
color: white;
margin-right: 10px;
line-height: 50px;
background-color: red;
}
ul {
background-color: black;
text-align: center;
/* width: 1200px;
margin: auto;*/
}
/* .clear {
clear: both;
} */
</style>
</head>
<body>
<ul>
关于给ul加了背景颜色background-color 然后背景颜色不生效的问题。原因:li没有清除浮动
于 2022-04-24 20:18:42 首次发布