一、将五环(奥运)放在网页中间
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>css练习</title>
<link rel="stylesheet" type="text/css" href="外部css1.css">
</head>
<body>
<div class="plat">
<div class="a1"></div>
<div class="a2"></div>
<div class="a3"></div>
<div class="a4"></div>
<div class="a5"></div>
</div>
</body>
</html>
*{
margin: 0;
padding: 0;
}
.plat{
position: absolute;
left: 50%;
top: 50%;
margin-left:-190px ;
margin-top: -93px;
height: 185px;
width: 380px;
}
.a1,
.a2,
.a3,
.a4,
.a5{
position:absolute;
width: 100px;
height: 100px;
border: 10px solid black;
border-radius: 50%;
}
.a1{
border-color: red;
left: 0;
top: 0;
}
.a2{
left: 130px;
top: 0;
border-color: yellow;
z-index: 1;
}
.a3{
left: 260px;
top: 0;
border-color: black;
}
.a4{
left: 195px;
top: 70px;
border-color: green;
}
.a5{
left: 65px;
top: 70px;
border-color: blue;
}
两栏布局
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>css练习</title>
<link rel="stylesheet" type="text/css" href="外部css1.css">
</head>
<body>
<div class="right"></div>
<div class="left"></div>
</body>
</html>
*{
margin: 0;
padding: 0;
}
.right{
position: absolute;
width: 500px;
height: 100px;
background-color: pink;
right: 0;
}
.left{
margin-right: 100px;
height: 100px;
width: 500px;
background-color: black;
}