一、HTML与CSS
html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>菜单栏</title>
<link rel="stylesheet" href="css\菜单栏.css">
</head>
<body>
<ul>
<li>游戏1</li>
<li>游戏2</li>
<li>游戏3</li>
<li>游戏4</li>
<li>游戏5</li>
<li>游戏6</li>
<li>游戏7</li>
</ul>
</body>
</html>
css:
ul {
/* 清除无序序列格式*/
list-style-type:none;
background-color: rgb(60, 69, 114);
height: 60px;
padding: 10px 300px ;
margin-top: 10px;
/* 圆角矩形*/
border-radius: 25px;
}
li {
/* 块元素转变为行元素*/
display: inline-block;
width:100px;
height: 20px;
color: white;
font-style:oblique;
/* 文本内对齐方式居中对齐*/
text-align: center;
padding: 15px 5px;
border-radius: 25px;
}
ul > li:hover{
background-color: rgb(118, 37, 42);
cursor: pointer;
}