用HTML+CSS+JS生成一个左边竖框带有菜单选项的HTML网页
时间: 2023-12-17 22:05:10 浏览: 40
<!DOCTYPE html>
<html>
<head>
<title>左边竖框带有菜单选项的HTML网页</title>
<style>
/* 网页布局 */
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
}
.container {
display: flex;
flex-direction: row;
height: 100vh;
overflow: hidden;
}
.sidebar {
width: 200px;
background-color: #333;
color: #fff;
display: flex;
flex-direction: column;
align-items: center;
padding: 20px;
box-sizing: border-box;
}
.main-content {
flex: 1;
background-color: #eee;
padding: 20px;
box-sizing: border-box;
}
/* 菜单样式 */
.menu {
list-style: none;
padding: 0;
margin: 0;
width: 100%;
}
.menu li {
padding: 10px;
margin-bottom: 10px;
background-color: #444;
border-radius: 5px;
cursor: pointer;
transition: all 0.3s ease;
}
.menu li:hover {
background-color: #555;
}
.menu li.active {
background-color: #fff;
color: #333;
}
</style>
</head>
<body>
<div class="container">
<div class="sidebar">
<h2>菜单</h2>
<ul class="menu">
<li class="active">选项一</li>
<li>选项二</li>
<li>选项三</li>
<li>选项四</li>
</ul>
</div>
<div class="main-content">
<h2>内容</h2>
<p>这是一个左边竖框带有菜单选项的HTML网页。</p>
</div>
</div>
</body>
</html>
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)