Files
niumalll/website/css/responsive.css

982 lines
17 KiB
CSS
Raw Normal View History

/* 移动端响应式优化样式 */
/* 超小屏幕设备 (小于576px) */
@media (max-width: 575.98px) {
.container {
padding-left: 1rem;
padding-right: 1rem;
}
.hero-section {
padding: 80px 0 30px;
}
.hero-title {
font-size: 1.75rem;
}
.hero-features .col-6 {
flex: 0 0 50%;
max-width: 50%;
}
.hero-stats .col-4 {
flex: 0 0 50%;
max-width: 50%;
}
.hero-stats .col-4:nth-child(3) {
flex: 0 0 100%;
max-width: 100%;
margin-top: 0.5rem;
}
.btn {
font-size: 0.9rem;
padding: 0.6rem 1.2rem;
}
.modal-dialog {
margin: 0.5rem;
}
.demo-header {
padding: 2rem 0;
padding-top: 120px;
}
.demo-header h1 {
font-size: 2rem;
}
.demo-nav-item {
font-size: 0.85rem;
padding: 0.75rem;
}
.metric-number {
font-size: 1.75rem;
}
.chart-container {
height: 200px;
}
/* 超小屏幕新增优化 */
.xs-container {
padding-left: 0.5rem;
padding-right: 0.5rem;
}
.xs-section {
padding: 1.5rem 0;
}
.xs-card {
margin-bottom: 0.75rem;
border-radius: 8px;
}
.xs-text-center {
text-align: center;
}
.xs-mb-2 {
margin-bottom: 0.5rem;
}
.xs-mt-2 {
margin-top: 0.5rem;
}
.xs-p-2 {
padding: 0.5rem;
}
/* 新增超小屏幕优化类 */
.xs-d-block {
display: block !important;
}
.xs-d-flex {
display: flex !important;
}
.xs-flex-column {
flex-direction: column !important;
}
.xs-gap-2 {
gap: 0.5rem !important;
}
.xs-gap-3 {
gap: 1rem !important;
}
.xs-w-100 {
width: 100% !important;
}
.xs-text-start {
text-align: start !important;
}
.xs-text-end {
text-align: end !important;
}
}
/* 移动设备优先设计 (小于768px) */
@media (max-width: 767.98px) {
/* 导航栏优化 */
.navbar {
padding: 0.5rem 0;
}
.navbar-brand .brand-text .brand-name {
font-size: 1rem;
}
.navbar-brand .brand-text .brand-subtitle {
font-size: 0.65rem;
}
.logo-container {
width: 40px;
height: 40px;
}
.navbar-nav .nav-link {
padding: 0.75rem 1rem;
margin: 0.25rem 0;
border-radius: 8px;
}
/* 英雄区域移动端优化 */
.hero-section {
min-height: 90vh;
padding: 100px 0 50px;
}
.hero-title {
font-size: 2rem;
line-height: 1.2;
}
.hero-subtitle {
font-size: 1rem;
margin-bottom: 2rem;
}
.hero-features .col-6 {
margin-bottom: 1rem;
}
.hero-features .feature-item {
padding: 0.75rem;
}
.hero-actions .btn {
width: 100%;
margin-bottom: 0.75rem;
}
/* 隐藏复杂动画元素 */
.floating-element,
.floating-card,
.particles-container {
display: none !important;
}
.dashboard-mockup {
transform: none !important;
}
/* 统计数据移动端优化 */
.hero-stats .col-4 {
margin-bottom: 1rem;
}
.stat-number {
font-size: 1.5rem;
}
/* 卡片组件优化 */
.card {
margin-bottom: 1.5rem;
}
.card-body {
padding: 1.25rem;
}
/* 按钮优化 */
.btn {
padding: 0.75rem 1.5rem;
}
.btn-lg {
padding: 1rem 2rem;
}
/* 表单优化 */
.form-control {
padding: 0.75rem;
font-size: 1rem;
}
/* 模态框优化 */
.modal-dialog {
margin: 1rem;
}
/* 演示页面移动端优化 */
.demo-sidebar {
margin-bottom: 2rem;
position: static;
}
.demo-nav-item {
padding: 1rem;
font-size: 0.9rem;
}
.demo-content {
padding: 1.5rem;
}
.dashboard-card {
padding: 1rem;
margin-bottom: 1rem;
}
.metric-number {
font-size: 2rem;
}
.chart-container {
height: 250px;
}
/* 移动端新增优化 */
.mobile-container {
padding-left: 1rem;
padding-right: 1rem;
}
.mobile-section {
padding: 2rem 0;
}
.mobile-card {
margin-bottom: 1rem;
border-radius: 12px;
}
.mobile-text-center {
text-align: center;
}
.mobile-mb-3 {
margin-bottom: 1rem;
}
.mobile-mt-3 {
margin-top: 1rem;
}
.mobile-p-3 {
padding: 1rem;
}
/* 新增移动端优化类 */
.mobile-d-block {
display: block !important;
}
.mobile-d-flex {
display: flex !important;
}
.mobile-flex-column {
flex-direction: column !important;
}
.mobile-gap-2 {
gap: 0.5rem !important;
}
.mobile-gap-3 {
gap: 1rem !important;
}
.mobile-w-100 {
width: 100% !important;
}
.mobile-text-start {
text-align: start !important;
}
.mobile-text-end {
text-align: end !important;
}
/* 新增移动端交互动画优化 */
.mobile-no-transform:hover {
transform: none !important;
}
.mobile-no-shadow:hover {
box-shadow: inherit !important;
}
}
/* 平板设备优化 (768px 到 991.98px) */
@media (min-width: 768px) and (max-width: 991.98px) {
.hero-title {
font-size: 2.5rem;
}
.hero-subtitle {
font-size: 1.1rem;
}
.hero-actions .btn {
margin-bottom: 0.5rem;
}
.floating-card {
transform: scale(0.8);
}
.demo-sidebar {
margin-bottom: 2rem;
}
/* 平板新增优化 */
.tablet-container {
max-width: 720px;
}
.tablet-section {
padding: 3rem 0;
}
.tablet-card {
margin-bottom: 1.5rem;
}
.tablet-text-left {
text-align: left;
}
.tablet-d-flex {
display: flex;
}
/* 新增平板优化类 */
.tablet-d-block {
display: block !important;
}
.tablet-flex-row {
flex-direction: row !important;
}
.tablet-gap-3 {
gap: 1rem !important;
}
.tablet-w-75 {
width: 75% !important;
}
.tablet-text-center {
text-align: center !important;
}
.tablet-text-start {
text-align: start !important;
}
.tablet-text-end {
text-align: end !important;
}
}
/* 中等屏幕设备优化 (992px 到 1199.98px) */
@media (min-width: 992px) and (max-width: 1199.98px) {
.container {
max-width: 960px;
}
.hero-title {
font-size: 3rem;
}
.hero-subtitle {
font-size: 1.25rem;
}
.dashboard-card {
padding: 1.5rem;
}
.metric-number {
font-size: 2.5rem;
}
/* 中等屏幕新增优化 */
.md-container {
max-width: 960px;
}
.md-section {
padding: 4rem 0;
}
.md-card {
transition: all 0.3s ease;
}
.md-card:hover {
transform: translateY(-5px);
}
/* 新增中等屏幕优化类 */
.md-d-block {
display: block !important;
}
.md-d-flex {
display: flex !important;
}
.md-flex-row {
flex-direction: row !important;
}
.md-gap-4 {
gap: 1.5rem !important;
}
.md-w-50 {
width: 50% !important;
}
.md-text-left {
text-align: left !important;
}
.md-text-center {
text-align: center !important;
}
}
/* 大屏幕优化 (1200px 及以上) */
@media (min-width: 1200px) {
.container {
max-width: 1200px;
}
.hero-title {
font-size: 4rem;
}
.hero-subtitle {
font-size: 1.4rem;
}
.dashboard-card {
padding: 2rem;
}
.metric-number {
font-size: 3rem;
}
/* 大屏幕新增优化 */
.desktop-container {
max-width: 1400px;
}
.desktop-section {
padding: 5rem 0;
}
.desktop-card {
transition: all 0.3s ease;
}
.desktop-card:hover {
transform: translateY(-10px);
}
.desktop-text-left {
text-align: left;
}
.desktop-d-flex {
display: flex;
}
/* 新增大屏幕优化类 */
.desktop-d-block {
display: block !important;
}
.desktop-flex-row {
flex-direction: row !important;
}
.desktop-gap-5 {
gap: 3rem !important;
}
.desktop-w-25 {
width: 25% !important;
}
.desktop-text-center {
text-align: center !important;
}
/* 新增大屏幕交互动画 */
.desktop-hover-lift:hover {
transform: translateY(-10px) !important;
}
.desktop-hover-scale:hover {
transform: scale(1.05) !important;
}
}
/* 超大屏幕优化 (1400px 及以上) */
@media (min-width: 1400px) {
.container {
max-width: 1320px;
}
.hero-title {
font-size: 4.5rem;
}
.hero-subtitle {
font-size: 1.5rem;
}
/* 超大屏幕新增优化 */
.xxl-container {
max-width: 1500px;
}
.xxl-section {
padding: 6rem 0;
}
/* 新增超大屏幕优化类 */
.xxl-d-block {
display: block !important;
}
.xxl-d-flex {
display: flex !important;
}
.xxl-flex-row {
flex-direction: row !important;
}
.xxl-gap-5 {
gap: 3rem !important;
}
.xxl-w-20 {
width: 20% !important;
}
.xxl-text-left {
text-align: left !important;
}
}
/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
/* 移除悬停效果 */
.card:hover,
.btn:hover,
.nav-link:hover,
.dashboard-card:hover {
transform: none !important;
box-shadow: inherit !important;
}
/* 增大点击区域 */
.btn {
min-height: 44px;
}
.nav-link {
min-height: 44px;
display: flex;
align-items: center;
}
/* 优化表单控件 */
.form-control,
.form-select {
min-height: 44px;
}
/* 新增触摸设备优化类 */
.touch-no-transform:hover {
transform: none !important;
}
.touch-no-shadow:hover {
box-shadow: inherit !important;
}
.touch-larger-hit-area {
min-height: 44px !important;
min-width: 44px !important;
}
}
/* 高对比度模式 */
@media (prefers-contrast: high) {
.hero-section {
background: #000;
color: #fff;
}
.btn-primary {
background: #000;
border-color: #fff;
color: #fff;
}
.card {
border: 2px solid #000;
}
/* 新增高对比度模式优化类 */
.high-contrast-border {
border: 2px solid currentColor !important;
}
.high-contrast-bg {
background-color: #000 !important;
color: #fff !important;
}
}
/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
:root {
--bg-color: #121212;
--text-color: #ffffff;
--card-bg: #1e1e1e;
--border-color: #333;
}
body {
background-color: var(--bg-color);
color: var(--text-color);
}
.card {
background-color: var(--card-bg);
border-color: var(--border-color);
}
.navbar {
background-color: rgba(0, 0, 0, 0.9) !important;
}
.demo-sidebar,
.demo-content,
.dashboard-card {
background-color: var(--card-bg);
border-color: var(--border-color);
}
/* 新增暗色模式优化类 */
.dark-bg {
background-color: var(--bg-color) !important;
}
.dark-text {
color: var(--text-color) !important;
}
.dark-card-bg {
background-color: var(--card-bg) !important;
}
.dark-border {
border-color: var(--border-color) !important;
}
}
/* 减少动画效果 */
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
.floating-element,
.floating-card {
animation: none !important;
}
/* 新增减少动画效果优化类 */
.no-animation {
animation: none !important;
transition: none !important;
}
.reduced-motion-transform {
transform: none !important;
}
}
/* 横屏模式优化 */
@media (orientation: landscape) and (max-height: 500px) {
.hero-section {
min-height: 100vh;
padding: 80px 0 20px;
}
.hero-title {
font-size: 2.5rem;
margin-bottom: 1rem;
}
.hero-subtitle {
margin-bottom: 1.5rem;
}
.hero-features {
margin-bottom: 1.5rem;
}
/* 新增横屏模式优化类 */
.landscape-min-height {
min-height: 100vh !important;
}
.landscape-padding-adjust {
padding-top: 80px !important;
padding-bottom: 20px !important;
}
}
/* 打印样式优化 */
@media print {
.navbar,
.back-to-top,
.floating-element,
.demo-sidebar,
.hero-bg-animation {
display: none !important;
}
.hero-section {
background: white !important;
color: black !important;
page-break-inside: avoid;
}
.demo-content,
.dashboard-card {
background: white !important;
box-shadow: none !important;
border: 1px solid #ddd !important;
}
body {
font-size: 12pt;
line-height: 1.4;
}
h1, h2, h3, h4, h5, h6 {
page-break-after: avoid;
}
.card {
page-break-inside: avoid;
border: 1px solid #ddd !important;
box-shadow: none !important;
}
/* 新增打印样式优化类 */
.print-only {
display: block !important;
}
.no-print {
display: none !important;
}
.print-border {
border: 1px solid #000 !important;
}
.print-no-shadow {
box-shadow: none !important;
}
}
/* 可访问性增强 */
@media (prefers-reduced-motion: no-preference) {
.smooth-scroll {
scroll-behavior: smooth;
}
}
/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
.logo-container i {
transform: scale(1.1);
}
.metric-number {
text-rendering: optimizeLegibility;
}
/* 新增高分辨率屏幕优化类 */
.high-dpi-enhanced {
image-rendering: -webkit-optimize-contrast;
image-rendering: crisp-edges;
}
}
/* 键盘导航优化 */
.btn:focus-visible,
.nav-link:focus-visible,
.form-control:focus-visible,
.demo-nav-item:focus-visible {
outline: 2px solid var(--primary-color);
outline-offset: 2px;
box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.25);
}
/* 错误状态优化 */
.is-invalid:focus {
border-color: var(--danger-color);
box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}
/* 成功状态优化 */
.is-valid:focus {
border-color: var(--success-color);
box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}
/* 新增响应式工具类 */
/* 超小屏幕专用类 */
@media (max-width: 575.98px) {
.xs-only {
display: block !important;
}
.sm-up,
.md-up,
.lg-up,
.xl-up {
display: none !important;
}
}
/* 小屏幕及以上 */
@media (min-width: 576px) {
.sm-up {
display: block !important;
}
.xs-only {
display: none !important;
}
}
/* 中等屏幕及以上 */
@media (min-width: 768px) {
.md-up {
display: block !important;
}
.xs-only,
.sm-only {
display: none !important;
}
}
/* 大屏幕及以上 */
@media (min-width: 992px) {
.lg-up {
display: block !important;
}
.xs-only,
.sm-only,
.md-only {
display: none !important;
}
}
/* 超大屏幕及以上 */
@media (min-width: 1200px) {
.xl-up {
display: block !important;
}
.xs-only,
.sm-only,
.md-only,
.lg-only {
display: none !important;
}
}
/* 特定屏幕尺寸专用类 */
.xs-only {
display: none !important;
}
.sm-only {
display: none !important;
}
.md-only {
display: none !important;
}
.lg-only {
display: none !important;
}
@media (min-width: 576px) and (max-width: 767.98px) {
.sm-only {
display: block !important;
}
}
@media (min-width: 768px) and (max-width: 991.98px) {
.md-only {
display: block !important;
}
}
@media (min-width: 992px) and (max-width: 1199.98px) {
.lg-only {
display: block !important;
}
}