设计出一个够大的页面(至少,右边要出现垂直的进度条,我要在页面的左下角设计出一个垂直菜单,至少包含6个功能。每个功能条都要有边框,并且功能的文字和边框要有内边距。菜单要实现鼠标放上去变色的功能,背景色和字体颜色都要变,且不一样。链接必须没有下划线,初始字体不能是蓝色。最后一个功能必须是回到顶部。
时间: 2024-02-15 14:03:09 浏览: 23
好的,根据您的要求,我为您设计了一个页面,包含垂直进度条和左下角的垂直菜单。以下是HTML和CSS代码:
HTML代码:
```
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>页面设计作业</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="script.js"></script>
</head>
<body>
<div class="container">
<h1>页面设计作业</h1>
<div class="progress-bar">
<div class="progress"></div>
</div>
<div class="menu">
<ul>
<li><a href="#">功能1</a></li>
<li><a href="#">功能2</a></li>
<li><a href="#">功能3</a></li>
<li><a href="#">功能4</a></li>
<li><a href="#">功能5</a></li>
<li><a href="#" id="go-top">回到顶部</a></li>
</ul>
</div>
</div>
</body>
</html>
```
CSS代码:
```
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
background-color: #f5f5f5;
}
h1 {
font-size: 36px;
text-align: center;
padding-top: 50px;
margin-bottom: 50px;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
}
.progress-bar {
position: fixed;
top: 0;
right: 0;
width: 10px;
height: 100%;
background-color: #f5f5f5;
border-left: 1px solid #ccc;
}
.progress {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 0;
background-color: #007bff;
}
.menu {
position: fixed;
bottom: 0;
left: 0;
width: 200px;
padding: 20px;
background-color: #fff;
border: 1px solid #ccc;
}
.menu ul {
list-style: none;
}
.menu ul li {
border: 1px solid #ccc;
padding: 10px;
margin-bottom: 10px;
}
.menu ul li a {
color: #333;
text-decoration: none;
display: block;
padding: 10px;
}
.menu ul li a:hover {
background-color: #007bff;
color: #fff;
}
#go-top {
background-color: #007bff;
color: #fff;
padding: 10px;
margin-top: 10px;
text-align: center;
}
#go-top:hover {
background-color: #0056b3;
cursor: pointer;
}
```
CSS代码中使用了jQuery库和一个JavaScript文件,用于实现回到顶部的功能。以下是JavaScript代码:
```
$(function() {
$(window).scroll(function() {
var scrollTop = $(this).scrollTop();
var windowHeight = $(this).height();
var documentHeight = $(document).height();
var progress = scrollTop / (documentHeight - windowHeight) * 100;
$('.progress').css('height', progress + '%');
});
$('#go-top').click(function() {
$('html, body').animate({scrollTop: 0}, 500);
});
});
```
该页面实现了垂直进度条和左下角的垂直菜单,菜单包含6个功能,底部的功能为回到顶部。菜单实现了鼠标放上去变色的功能,背景色和字体颜色都有变化。链接没有下划线,初始字体不是蓝色。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.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)