DreamLife_ToolBox/css/header.css

80 lines
2.1 KiB
CSS
Raw Normal View History

2025-03-03 18:59:57 +08:00
/* 头部样式 */
header {
position: fixed;
top: 0;
left: 0;
width: 100%;
background-color: #ffffff;
color: #fff;
padding: 10px;
display: flex;
justify-content: space-between;
align-items: center;
z-index: 3000;
transition: all 1s ease; /* 为头部的尺寸变化和样式变化添加过渡效果 */
}
/* 按钮的基础样式 */
header .toggle-menu {
display: inline-block;
font-size: 24px;
background: none;
border: none;
color: rgb(235, 10, 10);
cursor: pointer;
margin-right: 20px; /* 设置右边距 */
transition: transform 0.3s ease-in-out; /* 添加平滑过渡效果 */
}
/* 悬停效果,按钮背景颜色变化 */
header .toggle-menu:hover {
background-color: rgba(235, 10, 10, 0.1); /* 增加轻微的背景色变化 */
}
/* 头部全屏按钮样式(仅大屏幕显示) */
#fullscreen-button {
position: absolute;
right: 16px;
top: 0px;
background: none;
border: none;
cursor: pointer;
font-size: 32px;
display: flex;
align-items: center;
transition: top 0.3s ease,transform 0.3s ease-in-out, padding 0.3s ease-in-out; /* 平滑放大动画 */
transform-origin: center center; /* 确保放大时的中心不变 */
}
#fullscreen-button:hover {
transform: scale(1.20); /* 悬停时上下左右均匀放大 5% */
}
#search-input {
height: 20px;
width: 500px;
display: inline-block;
border: 1px solid #ccc;
border-radius: 20px;
padding: 5px 15px;
transition: width 0.3s ease, padding 0.3s ease, top 0.3s ease; /* 加入 top 过渡效果 */
outline: none;
background-color: #fff;
text-align: center;
margin-bottom: 20px;
position: fixed; /* 固定定位 */
top: 10px; /* 初始位置距离顶部20px */
left: 50%;
transform: translateX(-50%); /* 居中显示 */
z-index: 1000; /* 确保在顶部 */
}
/* 鼠标悬停时搜索框展开 */
#search-input:hover,
#search-input:focus {
width: 600px; /* 展开宽度 */
padding: 5px 20px; /* 调整内边距 */
box-shadow: 0 0 5px rgba(0, 0, 0, 0.2); /* 添加阴影效果 */
}