/* 响应式设计 */ @media (max-width: 768px) { #fullscreen-button { display: none; /* 小屏幕隐藏头部全屏按钮 */ } #sidebar-fullscreen-button { display: flex; /* 小屏幕显示侧边栏全屏按钮 */ } #search-input { position: absolute; width: 50%; /* 设置宽度为屏幕的50% */ padding: 5px 15px; top: 72px; left: 50%; /* 使搜索框居中 */ z-index: 1000; } #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%; bottom: 0; transform: translateX(-100%); /* 默认隐藏侧边栏 */ z-index: 2000; } .sidebar.open { transform: translateX(0); bottom: 0; width: 80%; /* 侧边栏在打开时宽度为80% */ } .logo { padding-top: 72px !important; } /* 小屏幕时主内容区 */ .main-content { margin-left: 0px; /* 小屏幕时移除左边距 */ margin-right: 0px; /* 小屏幕时右边距减小 */ margin-top: 80px; /* 小屏幕时稍微减小上边距 */ } /* 小屏幕时头部 */ header { height: 40px; justify-content: space-between; align-items: center; z-index: 3000; } /* 小屏幕时菜单按钮 */ header .toggle-menu { display: block; /* 在小屏幕时显示菜单按钮 */ font-size: 24px; background: none; border: none; color: rgb(235, 10, 10); cursor: pointer; position: absolute; top: 10px; right: 14px; transition: transform 0.3s ease-in-out; /* 添加平滑过渡效果 */ } /* 悬停效果,按钮背景颜色变化 */ header .toggle-menu:hover { background-color: rgba(235, 10, 10, 0.1); } #logo_head { width: 100%; } }