CSS常用操作:
导航栏:
css:
ul{
list-style-type: none;
margin: 0px;
padding: 0px;
background-color: black;
width: 400px;
text-align: center;
}
a:link,a:visited{
text-decoration: none;
background-color: black;
color: whitesmoke;
width: 50px;
text-align: center;
font-size: large;
}
a:active,a:hover{
background-color: cadetblue;
}
li{
display: inline;
padding: 3px;
padding-left: 5px;
padding-right: 5px;
}
html
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<link href="dhl.css" type="text/css" rel="stylesheet">
</head>
<body>
<ul>
<li><a href="#">导航1</a></li>
<li><a href="#">导航1</a></li>
<li><a href="#">导航1</a></li>
<li><a href="#">导航1</a></li>
<li><a href="#">导航1</a></li>
</ul>
</body>
</html>
图片处理:
html
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<link href="hzw.css" type="text/css" rel="stylesheet">
</head>
<body>
<div>
<div class="image">
<a href="#">
<img src="img/8.jpg" width="340px" height="220px" alt="海贼王">
</a>
<div class="text">海贼王</div>
</div>
<div class="image">
<a href="#">
<img src="img/8.jpg" width="340px" height="220px" alt="海贼王">
</a>
<div class="text">海贼王</div>
</div>
<div class="image">
<a href="#">
<img src="img/8.jpg" width="340px" height="220px" alt="海贼王">
</a>
<div class="text">海贼王</div>
</div>
<div class="image">
<a href="#">
<img src="img/8.jpg" width="340px" height="220px" alt="海贼王">
</a>
<div class="text">海贼王</div>
</div>
<div class="image">
<a href="#">
<img src="img/8.jpg" width="340px" height="220px" alt="海贼王">
</a>
<div class="text">海贼王</div>
</div>
</div>
</body>
</html>
css:
body{
margin: 10px auto;
width: 70%;
height: auto;
background-color: cadetblue;
}
.image{
border: 1px solid darkgray;
width: auto;
height: auto;
float: left;
text-align: center;
margin: 5px;
}
img{
margin: 5px;
}
.text{
font-size: 16px;
margin-bottom: 5px;
}
a:active,a:hover{
opacity: 0.5;
}