DreamLife_ToolBox/styles.css

422 lines
11 KiB
CSS
Raw Normal View History

2025-02-25 02:41:59 +00:00
/* 基本样式重置 */
body, html {
margin: 0;
padding: 0;
font-family: Arial, sans-serif; /* 设置页面的默认字体 */
background-color:#f4f4f4;
}
/* 头部样式 */
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; /* 为头部的尺寸变化和样式变化添加过渡效果 */
}
#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); /* 添加阴影效果 */
}
/* 按钮的基础样式 */
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% */
}
/* 侧边栏 */
.sidebar {
position: fixed;
top: -30px;
left: 0;
width: 250px;
bottom: 24px;
background-color: #f4f4f4;
color: rgb(100, 99, 99); /* logo颜色 */
display: flex;
flex-direction: column;
align-items: center; /* 水平居中 */
padding: 20px;
transition: transform 0.3s ease-in-out;
z-index: 2000;
}
/* 使用 @font-face 引用本地字体 */
@font-face {
font-family: 'Pacifico'; /* 字体名称 */
src: url('font/Pacifico.ttf') format('truetype'); /* 设置 .ttf 格式 */
font-weight: normal;
font-style: normal;
}
.logo {
font-family: 'Pacifico', cursive; /* 使用本地字体 Pacifico */
margin: 0;
padding-top: 48px;
text-align: center; /* 确保整个 logo 居中 */
display: flex;
flex-direction: column; /* 将 part1 和 part2 垂直排列 */
align-items: center; /* 确保每个部分居中 */
}
.logo .part1 {
font-size: 50px; /* "ream" 字体较大 */
}
.logo .part2 {
font-size: 40px; /* ".life" 字体较小 */
}
/* 侧边栏链接的基础样式 */
.sidebar-link {
position: relative;
font-size: 22px;
font-weight: bold;
margin-top: 48px;
color: rgb(117, 115, 115);
text-decoration: none; /* 去掉默认的下划线 */
display: inline-block;
padding: 10px 20px;
background-color: #f4f4f4;
transition: all 0.3s ease; /* 添加平滑过渡效果 */
}
/* 侧边栏链接内容的容器 */
.sidebar-link .link-content {
display: flex;
background-color: #f4f4f4;
align-items: center; /* 确保文字和图标垂直居中 */
transition: transform 0.3s ease; /* 添加平滑过渡 */
}
/* 悬停时图标和文字一起上浮 */
.sidebar-link:hover .link-content {
transform: translateY(-3px); /* 向上浮起5px */
}
/* 图标样式 */
.sidebar-link .icon {
margin-right: 10px; /* 给图标和文字之间留点空隙 */
}
/* 悬停时改变链接的颜色 */
.sidebar-link:hover {
color: #000;
}
/* 按钮文本和图标的状态样式 */
.sidebar-link.fullscreen .icon {
transform: rotate(90deg); /* 图标旋转 */
}
/* 退出全屏时的样式 */
.sidebar-link.fullscreen span {
content: "退出全屏"; /* 修改文本为"退出全屏" */
}
/* 禁用页面滚动样式 */
body.no-scroll {
overflow: hidden; /* 禁止页面滚动 */
}
/* 主内容区 */
.main-content {
margin-left: 270px;
margin-right: 20px;
margin-top: 14px; /* 增加主内容区的上边距 */
padding: 20px;
display: flex;
flex-direction: column;
justify-content: space-between;
z-index: 1; /* 确保内容在侧边栏下方 */
position: relative; /* 确保相对定位 */
}
.sidebar {
flex: 1 1 250px; /* 允许侧边栏在可用空间内缩放 */
}
.content {
flex: 3 1 600px; /* 允许内容区域在可用空间内缩放 */
}
/* 为整个工具卡片添加链接样式 */
.tool-card-link {
text-decoration: none; /* 去掉链接的下划线 */
}
/* 保证工具卡片正常排列 */
.tools-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 20px;
padding: 20px;
}
/* 保证工具卡片的顺序 */
.tool-card {
display: flex;
flex-direction: column; /* 使 logo 在上,名称在下 */
align-items: flex-start; /* 左对齐 */
background: white;
border-radius: 8px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
padding: 20px;
text-align: left; /* 左对齐 */
min-height: 180px;
transition: transform 0.5s ease, box-shadow 0.5s ease; /* 工具卡片动画时间设置为 0.5s */
}
/* 工具卡片动画完成状态 */
.tool-card.animated {
opacity: 1;
transform: translateY(0); /* 恢复到正常位置 */
}
/* 工具卡片悬停效果 */
.tool-card:hover {
transform: scale(1.03);
box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}
/* 工具卡片logo样式 */
.tool-logo {
margin-left: 30px;
margin-top: 10px;
width: 50px; /* 设置logo的宽度 */
height: 50px;
margin-bottom: 10px; /* 给logo和名称之间留出间距 */
border-radius: 8px; /* 设置圆角矩形 */
object-fit: cover; /* 保证图片不会被拉伸或变形 */
}
/* 工具名称的样式 */
.tool-name {
margin-left: 30px;
margin-top: 10px;
font-size: 20px;
font-weight: bold;
color: #333;
text-decoration: none;
position: relative; /* 使下划线定位相对 */
display: block; /* 确保工具名称独占一行 */
text-align: left; /* 左对齐 */
}
/* 工具名称的下划线效果 */
.tool-name::after {
content: "";
position: absolute;
bottom: -5px;
left: 0;
width: 0;
height: 2px;
background-color: black;
transition: width 0.3s ease;
}
.tool-name:hover::after {
width: 100%; /* 让下划线横跨整个文字 */
}
/* 分类标签样式 */
.tool-category {
display: inline-block; /* 使标签处于同一行 */
padding: 4px 16px; /* 胶囊形状的内边距,横向较宽 */
background-color: #fc8f8f; /* 背景颜色 */
color: #ffffff; /* 文字颜色 */
font-size: 10px; /* 字体大小 */
font-weight: bold; /* 加粗字体 */
border-radius: 50px; /* 设置圆角,形成胶囊形状 */
margin-left: 30px;
margin-top: 10px; /* 给标签和描述之间留出间距 */
}
/* 工具描述样式 */
.card-description {
font-size: 14px;
color: #777;
margin-left: 30px;
margin-top: 10px; /* 给描述添加上边距 */
}
/* 悬停效果 */
.tool-card:hover {
transform: scale(1.03);
box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}
/* 页脚样式 - 默认 (电脑设备) */
footer {
background-color: rgba(51, 51, 51, 0.5); /* 半透明背景 */
color: white;
display: flex; /* 使用 flex 布局 */
justify-content: center; /* 水平居中 */
align-items: center; /* 垂直居中 */
padding: 0px;
position: fixed;
left: 0;
right: 0;
bottom: 0;
font-size: 14px;
max-height: 30px;
z-index: 2000; /* 提升侧边栏的层级 */
}
/* 响应式设计 */
@media (max-width: 768px) {
#fullscreen-button {
display: none; /* 小屏幕隐藏头部全屏按钮 */
}
#sidebar-fullscreen-button {
display: flex; /* 小屏幕显示侧边栏全屏按钮 */
}
#search-input {
width: 50%; /* 设置宽度为屏幕的50% */
padding: 5px 15px;
top: 10px;
left: 50%; /* 使搜索框居中 */
}
#search-input:hover,
#search-input:focus {
width: 60%; /* 展开宽度 */
padding: 5px 20px; /* 调整内边距 */
box-shadow: 0 0 5px rgba(0, 0, 0, 0.2); /* 添加阴影效果 */
}
/* 小屏幕时侧边栏 */
.sidebar {
width: 80%; /* 设置侧边栏宽度为60% */
bottom: 0;
transform: translateX(-100%); /* 默认隐藏侧边栏 */
}
.sidebar.open {
transform: translateX(0);
bottom: 0;
width: 80%; /* 确保侧边栏在打开时宽度为60% */
}
/* 小屏幕时主内容区 */
.main-content {
margin-left: 0px; /* 小屏幕时移除左边距 */
margin-right: 0px; /* 小屏幕时右边距减小 */
margin-top: 60px; /* 小屏幕时稍微减小上边距 */
}
/* 小屏幕时头部 */
header {
height: 40px; /* 设置头部高度为50px */
justify-content: space-between; /* 保持头部内容在两端 */
align-items: center; /* 垂直居中内容 */
}
/* 小屏幕时菜单按钮 */
header .toggle-menu {
display: block; /* 在小屏幕时显示菜单按钮 */
font-size: 24px;
background: none;
border: none;
color: rgb(235, 10, 10);
cursor: pointer;
position: absolute;
top: 10px; /* 距离顶部20px */
right: 14px; /* 距离右侧20px */
transition: transform 0.3s ease-in-out; /* 添加平滑过渡效果 */
}
/* 悬停效果,按钮背景颜色变化 */
header .toggle-menu:hover {
background-color: rgba(235, 10, 10, 0.1); /* 增加轻微的背景色变化 */
}
}
@media (min-width: 768px) {
header {
background: none; /* 去掉头部背景色 */
box-shadow: none; /* 去掉头部阴影 */
height: auto; /* 自动高度适应搜索框 */
padding: 0; /* 去掉多余的内边距 */
top: 10px;
}
#fullscreen-button {
display: flex; /* 小屏幕隐藏头部全屏按钮 */
}
#sidebar-fullscreen-button {
display: none; /* 小屏幕显示侧边栏全屏按钮 */
}
#search-input {
margin: 0 auto; /* 搜索框居中显示 */
}
header .toggle-menu {
display: none; /* 在小屏幕时显示菜单按钮 */
}
}