Front-end note recording-simple navigation bar continued (background picture exercise)

Statement: The following content is a summary of personal learning. There may be errors in understanding or recording errors. The original intention is to facilitate self-study and review records.

Achieve effect

Before
Insert picture description here
clicking: After clicking:
Insert picture description here

Implementation code

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>

    <style>
    	.nav {
     
     
    		text-align: center;
    	}
        .nav a {
     
     
        	display: inline-block;
        	width: 200px;
        	height: 50px;
        	line-height: 50px;
        	text-decoration: none;
        	color: white;
        	/*background-color: pink;*/
        	background: url(imgs/h.png) no-repeat;
        }
        .nav a:hover {
     
     
            background-image: url(imgs/l.png);
        }
    </style>

</head>
<body>

	<div class="nav">
		<a href="#">首页</a>
		<a href="#">前端</a>
		<a href="#">后端</a>
		<a href="#">工具使用</a>
		<a href="#">关于我</a>
	</div>
	
</body>
</html>

Background image:
Link: https://pan.baidu.com/s/1I5InT8UDWvix9LGiDtnuFA
Extraction code: j5q7 After
copying this content, open the Baidu Netdisk mobile phone App, the operation is more convenient

Guess you like

Origin blog.csdn.net/pilgrim_121/article/details/110916008