更改背景和字体的颜色。
修改图像的不透明度。
文本嵌入。
创建图像翻转效果。
交换图像。
:hover {
css declarations;
}
<html>
<head>
<style>
body{
text-align:center;
}
a
{
color: red;
}
a:hover
{
color: green;
}
a:active
{
color: cyan;
}
</style>
</head>
<body>
<h1>Move your mouse on the below link to see the hover effect.</h1>
<a class = "link" href = https://www.Bianchenghao6.com/css-grid>CSS Grid</a>
</body>
</html>
<html>
<head>
<style>
body{
text-align:center;
}
p:hover, h1:hover, a:hover{
background-color: yellow;
}
</style>
</head>
<body>
<h1>Hello World</h1>
<p>Welcome to the Bianchenghao6.</p>
<a href='https://www.Bianchenghao6.com/css-grid'>CSS Grid</a>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body{
text-align:center;
}
* {box-sizing: border-box;}
.container {
position: relative;
width: 50%;
max-width: 300px;
}
.image {
display: block;
width: 100%;
height: auto;
}
.overlay {
position: absolute;
bottom: 0;
background: rgba(0, 0, 0, 0.2);
width: 100%;
opacity:0;
transition: .9s ease;
font-size: 25px;
padding: 20px;
}
.container:hover .overlay {
opacity: 1.5;
}
</style>
</head>
<body>
<h1>Image Overlay Title Effect</h1>
<h2>Move your mouse over the image to see the effect.</h2>
<center>
<div class="container">
<img src="jtp.png" class="image">
<div class="overlay">Welcome to Bianchenghao6.com</div>
</div> </center>
</body>
</html>