Files
java-web-homework/homework1/index.css
T

86 lines
1.6 KiB
CSS

/* 这是被index.html引用的css样式表 */
/* 设置全局样式:将所有元素的内边距和外边距初始化为 0 */
* {
padding: 0;
margin: 0;
}
/* 设置导航栏样式 */
#navbar {
background-color: rgb(49, 42, 42);
width: 100%;
height: 50px;
/* 确保导航栏内对象居中 */
display: flex;
align-items: center;
}
/* 设置导航栏对象样式*/
.navobj {
color: rgb(255, 255, 255);
margin-left: 10px;
margin-right: 10px;
display: inline-block;
}
/* 确保导航栏内的链接无蓝字和下划线 */
.navobj a {
color: inherit;
text-decoration: none;
}
/* 下拉菜单容器样式 */
.dropdown {
position: relative;
display: inline-block;
}
/* 下拉菜单按钮样式 */
.dropbtn {
color: white;
padding: 16px;
font-size: 16px;
border: none;
cursor: pointer;
display: flex;
align-items: center;
}
/* 为下拉菜单按钮添加三角箭头 */
.dropbtn::after {
content: "";
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 5px solid white;
margin-left: 5px;
}
/* 下拉菜单内容样式 */
.dropdown-content {
display: none;
position: absolute;
background-color: rgb(49, 42, 42);
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 1;
}
/* 下拉菜单内容链接样式 */
.dropdown-content a {
color: rgb(255, 255, 255);
padding: 12px 16px;
text-decoration: none;
display: block;
}
/* 鼠标悬停时下拉菜单内容链接样式 */
.dropdown-content a:hover {
background-color: #8187db;
}
/* 鼠标悬停时显示下拉菜单内容 */
.dropdown:hover .dropdown-content {
display: block;
}