11.行高/font

本文介绍了CSS中关于行高(line-height)的使用技巧,包括如何实现文字在行高中居中显示,以及如何通过padding和line-height实现多行文本的垂直居中。此外,还详细展示了如何利用CSS美化导航栏,包括设置导航项的宽度、高度,实现水平及垂直居中,并通过伪类美化超级链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  1. 行高line-height
    文字是在行高里居中的//行高最好大于字号
    (在行高撑起父元素高度时)行高-字号为偶数则上下平分,奇数则下面比上面多1,
    字号:font-size,行高line-height
    多行文本垂直居中:padding-top+padding-bottom+多个line-height
    font:14px/24px "宋体","微软雅黑";//font-size,line-height,font-family。24px可用200%来表示
  2. font-family:"Arial","微软雅黑","宋体";//后面为备选字体
  3.  超级链接的美化
    1.伪类//a不继承font/color,要改变必须选中a
    a:link{color:red;}//超链接没点击时样式
    a:visited{color:green;}//超链接点击过后样式
    a:hover{color:blue;}//鼠标悬浮时样式
    a:active{color:yellow;}//左键点击时样式
    这四种状态必须按照顺序写(lvha),否则失效,最后一个可不写,因为一瞬间
    
  4. 美化导航条例子
    <style>
    		.nav{
    			width: 960px;
    			height: 40px;
    			background-color: yellow;
    			margin: 20px auto;//页面水平方向居中
    		}
    		.nav li{
    			float: left;
    			list-style: none;
    			width: 10%;//这里可以用数字96px;
    			line-height: 40px;//文字竖直方向居中
    			text-align: center;//文字水平方向居中
    
    		}
    		.nav li a{
    			display: block;//将a转化为块元素,这样可点击范围扩大
    			width: 96px;
    		}
    		.nav li a:link,.nav li a:visited{
    			text-decoration: none;
    			color: red;
    		}
    		.nav li a:hover{
    			background-color: purple;
    			color: blue;
    		}
    </style>
    <div class="nav">
    		<li><a href="#">导航条</a></li>
    		<li><a href="#">导航条</a></li>
    		<li><a href="#">导航条</a></li>
    		<li><a href="#">导航条</a></li>
    		<li><a href="#">导航条</a></li>
    		<li><a href="#">导航条</a></li>
    		<li><a href="#">导航条</a></li>
    		<li><a href="#">导航条</a></li>
    		<li><a href="#">导航条</a></li>
    		<li><a href="#">导航条</a></li>
    </div>




请帮我完善该vue项目下的响应式,使其网页设计的可以像香格里拉酒店官网一样简洁美观,<template> <!-- 体验页面 --> <div class="experience"> <!-- 顶部导航栏 --> <NavBar /> <div class="container"> <!-- 首图内容区域 --> <div class="content-banner"></div> <div class="content-wrapper"> <!-- 商务之旅 --> <div class="business margin-top-50"> <div class="img-box"> <responsive-image class="hd01" :small-image="hd01.smallImage1" :medium-image="hd01.mediumImage1" :large-image="hd01.largeImage1" alt-text="Description of image" /> <!-- <img src="../../assets/experience/hd-01.png" alt="" /> --> </div> <div class="text-box"> <p class="title-zh text-center" :class="{ textEn: $i18n.locale === 'en' }"> {{ $t('Business') }}</p> <p class="content margin-top-20" :class="{ textEn: $i18n.locale === 'en' }"> {{ $t('text7') }} </p> <p class="more" :class="{ textEn: $i18n.locale === 'en' }"> {{ $t("more14") }} </p> </div> </div> <!-- 旅游度假 --> <div class="tourism margin-top-50"> <div class="text-box"> <p class="title-zh text-center" :class="{ textEn: $i18n.locale === 'en' }">{{ $t('trip') }}</p> <p class="content margin-top-20" :class="{ textEn: $i18n.locale === 'en' }"> {{ $t('text8') }} </p> <p class="more" :class="{ textEn: $i18n.locale === 'en' }"> {{ $t("more15") }} </p> </div> <div class="img-box"> <responsive-image class="hd02" :small-image="hd02.smallImage2" :medium-image="hd02.mediumImage2" :large-image="hd02.largeImage2" alt-text="Description of image" /> <!-- <img src="../../assets/experience/hd-02.png" alt="" /> --> </div> </div> </div> <!-- 查看客房 --> <div class="content-swiper"> <div class="content-kefang"> <p class="title-zh text-center" :class="{ textEn: $i18n.locale === 'en' }">{{ $t('Guest') }}</p> <!-- 轮播图 --> <div class="foot-swiper-box margin-top-50"> <RoomSwiper :bannerList="roomBannerList" /> </div> </div> <div class="content-kefang"> <p class="title-zh text-center" :class="{ textEn: $i18n.locale === 'en' }">{{ $t('Apartment') }}</p> <!-- 轮播图 --> <div class="foot-swiper-box margin-top-50"> <RoomSwiper :bannerList="apartBannerList" /> </div> </div> <div class="device"> <p class="title-zh text-center" :class="{ textEn: $i18n.locale === 'en' }">{{ $t('Facilities') }}</p> <div class="device-content margin-top-50"> <div class="img-box"> <img src="../../assets/experience/hd-01.png" alt="" /> </div> <div class="text-box"> <ul class="device-list"> <li class="text" :class="{ textEn: $i18n.locale === 'en' }">{{ $t('WiFi') }}</li> <li class="text" :class="{ textEn: $i18n.locale === 'en' }">{{ $t('individually') }}</li> <li class="text" :class="{ textEn: $i18n.locale === 'en' }">{{ $t('TV') }}</li> <li class="text" :class="{ textEn: $i18n.locale === 'en' }">{{ $t('laundry') }}</li> <li class="text" :class="{ textEn: $i18n.locale === 'en' }">{{ $t('safes') }}</li> <li class="text" :class="{ textEn: $i18n.locale === 'en' }">{{ $t('coffee') }}</li> <li class="text" :class="{ textEn: $i18n.locale === 'en' }">{{ $t('Minibar') }}</li> </ul> </div> </div> </div> </div> </div> <!-- 滚动宣传图文本页面 --> <!-- <div v-for="item in roomBannerList" :key="item.id"> <h2>{{ $t(item.titleKey) }}</h2> <p>{{ $t(item.promptKey) }}</p> </div> --> <!-- 底部导航栏 --> <Footer /> </div> </template> <script> import RoomSwiper from "@/components/swiper/RoomSwiper.vue"; export default { name: "experience", components: { RoomSwiper, }, data() { return { msg: "Welcome to Your Vue.js App", // 响应式图片数据 hd01: { smallImage1: require("../../assets/experience/hd-01-mobile.jpg"), mediumImage1: require("../../assets/experience/hd-01.png"), largeImage1: require("../../assets/experience/hd-01.png"), }, hd02: { smallImage2: require("../../assets/experience/hd-02-mobile.jpg"), mediumImage2: require("../../assets/experience/hd-02.png"), largeImage2: require("../../assets/experience/hd-02.png"), }, roomBannerList: [ { id: 1, imgUrl: require("../../assets/room/room-01.png"), title: "豪华套房", prompt: "尊享私人空间,尽享奢华体验", }, { id: 2, imgUrl: require("../../assets/room/room-02.png"), title: "豪华楼层/豪华雅致大床房", prompt: "面积约为42平方米,装饰现代,舒适典雅。卧室和大理石浴室设气派的落地窗玻璃,可以俯瞰草原城市胜景或乌兰木伦湖滨美景。", }, { id: 3, imgUrl: require("../../assets/room/room-03.png"), title: "豪华双床房", prompt: "面积约为42平方米,装饰现代,舒适典雅。卧室和大理石浴室设气派的落地窗玻璃,可以俯瞰草原城市胜景或乌兰木伦湖滨美景。", }, ], apartBannerList: [ { id: 1, imgUrl: require("../../assets/room/room-01.png"), title: "豪华套房", prompt: "尊享私人空间,尽享奢华体验", }, { id: 2, imgUrl: require("../../assets/room/room-02.png"), title: "豪华楼层/豪华雅致大床房", prompt: "面积约为42平方米,装饰现代,舒适典雅。卧室和大理石浴室设气派的落地窗玻璃,可以俯瞰草原城市胜景或乌兰木伦湖滨美景。", }, { id: 3, imgUrl: require("../../assets/room/room-03.png"), title: "豪华双床房", prompt: "面积约为42平方米,装饰现代,舒适典雅。卧室和大理石浴室设气派的落地窗玻璃,可以俯瞰草原城市胜景或乌兰木伦湖滨美景。", }, ], }; }, }; </script> <style scoped> .content-banner { width: 100vw; height: 72rem; background-image: url("../../assets/banner/banner-02.png"); background-size: 100% 100%; } .business { width: 130rem; margin: 0 auto; display: flex; justify-content: space-between; margin-bottom:10rem; } .title-en, .title-zh { font-size: 3.6rem; color: rgb(202, 171, 98); text-align: left; } .content { width: 60rem; font-size: 2rem; line-height: 2; font-family: "Fangsong"; text-align: justify; } .img-box { width: 50rem; height: 30rem; } .more { width: 15rem; font-size: 2rem; line-height: 2em; color: rgb(202, 171, 98); text-align: center; cursor: pointer; background-color: rgb(238, 235, 235); } /* 通用属性 */ /* 文本居中 */ .text-center { text-align: center; } /* div居中 */ .div-center { margin: 2rem auto; } /* 上外边距2rem */ .margin-top-20 { margin-top: 2rem; } /* 上外边距5rem */ .margin-top-50 { margin-top: 5rem; } /* 下外边距2rem */ .margin-bottom-20 { margin-bottom: 2rem; } /* 度假旅 */ .tourism { width: 120rem; margin: 0 auto; display: flex; justify-content: space-between; margin-bottom: 10rem; } /* 查看客房 */ .content-kefang { width: 100vw; height: 85rem; } /* 客房设施 */ .device-content { width: 100rem; margin: 10rem auto; display: flex; margin-bottom: 1rem; } .device-list { margin-left: 2rem; font-size: 2rem; text-align: left; line-height: 2em; font-family: 'FangSong'; } .device { width: 100rem; margin: 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; margin-bottom: 10rem; } .textEn { font-family: "Times New Roman", Times, serif !important; } /* 1024px以下 */ @media screen and (max-width: 1024px) { .content-banner { height: 70rem; } .business { flex-direction: column; align-items: center; } .tourism { flex-direction: column; align-items: center; } .content-wrapper { width: 160rem; } .title-en { font-size: 4.8rem; } .title-zh { font-size: 5.6rem; } .content { width: 74rem; font-size: 3rem; } .img-box{ width: 74rem; height: 42rem; } .more { width: 20rem; font-size: 2.4rem; } } .device-content { width: 100rem; margin: 10rem auto; display: flex; margin-bottom: 1rem; } .device-list { margin-left: 2rem; font-size: 2rem; text-align: left; line-height: 2em; font-family: 'FangSong'; } .device { width: 100rem; margin: 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; margin-bottom: 10rem; } @media screen and (max-width: 768px) { .content-banner { height: 82rem; background-image: url("../../assets/banner/banner-02-mobile.jpg"); } .business { flex-direction: column; align-items: center; } .tourism { flex-direction: column; align-items: center; } .content-wrapper { width: 190rem; } .img-box { order: 2; } .text-box { order: 1; } .title-en { font-size: 6rem; } .title-zh { font-size: 6.2rem; } .content { width: 160rem; font-size: 4rem; } .img-box { width: 110rem; height: 60rem; } .more { width: 30rem; font-size: 3.2rem; margin-bottom: 5rem; margin-left: 80rem; } } .device-content { width: 120rem; margin: 10rem auto; display: flex; margin-bottom: 1rem; flex-direction: row; margin-right: 10rem; } .device-list { margin-left: 10rem; font-size: 2rem; text-align: left; line-height: 2em; font-family: 'FangSong'; margin-right: 10rem; } .device { width: 150rem; margin: 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; margin-bottom: 10rem; margin-right: 10rem; } </style>
06-14
<think>为了完善该Vue项目的响应式设计,我们需要对现有代码进一些调整。香格里拉酒店官网的设计通常以简洁、优雅和度响应式著称。我们可以从以下几个方面进优化:1.**布局调整**:使用更灵活的布局方式,如Flexbox或Grid,确保在不同屏幕尺寸下都能有良好的表现。2.**图片响应式**:已经使用了`responsive-image`组件,但需要确保图片在不同设备上正确显示。3.**字体大小**:使用相对单位(如rem、em)或视口单位(如vw、vh)来调整字体大小,以便在不同屏幕尺寸下自动缩放。4.**间距调整**:使用相对单位调整内外边距,确保在不同设备上布局合理。5.**媒体查询**:优化现有的媒体查询,覆盖更多设备尺寸,并调整布局。具体修改点:-**.content-banner**:在移动设备上使用不同的背景图片,并调整度。-**.business和.tourism**:在较小屏幕上将布局从排列改为列排列,并调整内部元素的顺序(例如,在移动设备上图片在文字下方)。-**.content-kefang**:调整度为自动,以适应不同屏幕。-**.device-content**:在移动设备上将设施列表和图片改为垂直排列。-**字体和间距**:在媒体查询中调整字体大小和间距。此外,我们注意到在`<style>`中已经有一些媒体查询,但可能需要进一步优化。以下是修改后的`<style>`部分,我将详细解释修改点:```scss<stylescoped>.content-banner{width:100%;height:72vh;/*使用视口度单位,使度自适应*/background-image:url("../../assets/banner/banner-02.png");background-size:cover;/*使用cover确保背景图覆盖整个区域*/background-position:center;/*背景图居中*/}.business{width:90%;/*使用百分比宽度,使其自适应*/max-width:130rem;/*最大宽度限制*/margin:0auto;display:flex;justify-content:space-between;margin-bottom:10rem;}.title-en,.title-zh{font-size:3.6rem;color:rgb(202,171,98);text-align:left;}.content{width:100%;/*修改宽度为100%,使其在父元素内自适应*/max-width:60rem;/*最大宽度限制*/font-size:2rem;line-height:2;font-family:"Fangsong";text-align:justify;}.img-box{width:50%;/*使用百分比宽度*/max-width:50rem;/*最大宽度限制*/height:auto;/*度自适应*/aspect-ratio:16/9;/*保持图片的宽比*/}.img-boximg{width:100%;height:auto;display:block;}.more{display:inline-block;/*改为内联块元素,宽度由内容决定*/font-size:2rem;line-height:2em;color:rgb(202,171,98);text-align:center;cursor:pointer;padding:0.5rem2rem;/*增加内边距,使链接区域更大*/background-color:rgb(238,235,235);border-radius:4px;/*添加圆角*/transition:background-color0.3s;/*添加过渡效果*/}.more:hover{background-color:#e0e0e0;/*鼠标悬停效果*/}/*通用属性*//*...原有通用样式...*//*度假旅*/.tourism{width:90%;/*使用百分比宽度*/max-width:120rem;/*最大宽度限制*/margin:0auto;display:flex;justify-content:space-between;margin-bottom:10rem;}/*查看客房*/.content-kefang{width:100%;height:auto;/*度自适应*/padding:5rem0;/*增加内边距*/}/*客房设施*/.device-content{width:90%;/*使用百分比宽度*/max-width:100rem;/*最大宽度限制*/margin:10remauto;display:flex;flex-wrap:wrap;/*允许换*/justify-content:center;align-items:center;}.device-list{width:100%;/*在移动设备上宽度100%*/max-width:50rem;/*最大宽度限制*/margin-left:0;/*移除左边距*/font-size:2rem;text-align:left;line-height:2em;font-family:'FangSong';list-style-type:none;/*移除列表符号*/padding:0;}.device{width:90%;/*使用百分比宽度*/max-width:100rem;/*最大宽度限制*/margin:0auto;display:flex;flex-direction:column;align-items:center;justify-content:center;margin-bottom:10rem;}.textEn{font-family:"TimesNewRoman",Times,serif!important;}/*媒体查询*//*平板设备*/@mediascreenand(max-width:1024px){.content-banner{height:50vh;/*调整度*/}.business,.tourism{flex-direction:column;align-items:center;}.business.img-box,.tourism.img-box{width:80%;/*图片宽度占父元素80%*/max-width:none;/*移除最大宽度限制*/margin-top:3rem;}.business.text-box,.tourism.text-box{width:80%;/*文字区域宽度*/}.title-en,.title-zh{font-size:3rem;text-align:center;/*标题居中*/}.content{width:100%;max-width:none;font-size:1.8rem;}.more{margin:2remauto;/*居中显示*/}}/*手机设备*/@mediascreenand(max-width:768px){.content-banner{height:40vh;background-image:url("../../assets/banner/banner-02-mobile.jpg");}.business,.tourism{width:95%;}.business.img-box,.tourism.img-box{width:100%;order:2;/*图片在下方*/}.business.text-box,.tourism.text-box{order:1;/*文字在上方*/width:100%;}.title-en,.title-zh{font-size:2.5rem;}.content{font-size:1.6rem;}.more{font-size:1.8rem;margin:2remauto;/*居中显示*/}.device-content{flex-direction:column;/*垂直排列*/}.device-content.img-box{width:100%;margin-bottom:3rem;}.device-content.text-box{width:100%;}.device-list{max-width:100%;}}/*小手机设备*/@mediascreenand(max-width:480px){.content-banner{height:30vh;}.title-en,.title-zh{font-size:2rem;}.content{font-size:1.4rem;}.more{font-size:1.6rem;}}</style>```###修改说明:1.**.content-banner**:-将度从固定像素改为`vh`单位,使其相对于视口度自适应。-使用`background-size:cover`和`background-position:center`确保背景图覆盖并居中。2.**.business和.tourism**:-宽度改为百分比,并设置最大宽度,使其在不同屏幕尺寸下都能自适应。-在媒体查询中,当屏幕小于1024px时,将布局改为列排列,并调整内部元素的宽度和顺序。3.**.img-box**:-使用百分比宽度,并设置`aspect-ratio`保持宽比(16/9),这样图片度会自适应宽度。-图片设置为`width:100%`和`height:auto`,确保图片缩放不会失真。4.**.content-kefang**:-度改为`auto`,并增加内边距,这样在不同设备上不会有过的固定度。5.**.device-content**:-在移动设备上(max-width:768px)改为垂直排列,图片在上,列表在下。-使用`flex-wrap:wrap`允许换,并调整了列表的样式。6.**字体和间距**:-在媒体查询中逐步减小字体大小,使小屏幕设备上文字不会过大。-调整了`.more`链接的样式,增加内边距和悬停效果,提升用户体验。7.**其他细节**:-移除了`.device-content`和`.device`中一些不必要的固定宽度,改用百分比。-在移动设备上,将列表的左边距移除,并设置宽度为100%。###注意事项:-确保`responsive-image`组件能够根据屏幕尺寸切换图片,并且样式正确。-轮播图组件`RoomSwiper`也需要是响应式的,但这里没有修改,假设它内部已经处理了响应式。###相关问题§§相关问题§§:1.在Vue项目中,如何更效地管理响应式图片(比如使用srcset)?2.如何利用Vue的响应式系统动态调整布局(例如根据屏幕尺寸改变组件排列顺序)?3.在响应式设计中,如何处理字体大小和以适应不同屏幕?4.如何使用Vue的自定义指令来简化响应式设计中的样式切换?</think>我将帮助你完善这个Vue项目的响应式设计,使其达到香格里拉酒店官网的简洁美观风格。以下是优化方案: ### 优化后的代码 ```vue <template> <!-- 体验页面 --> <div class="experience"> <!-- 顶部导航栏 --> <NavBar /> <div class="container"> <!-- 首图内容区域 --> <div class="content-banner"></div> <div class="content-wrapper"> <!-- 商务之旅 --> <div class="business"> <div class="img-box"> <responsive-image class="hd01" :small-image="hd01.smallImage1" :medium-image="hd01.mediumImage1" :large-image="hd01.largeImage1" alt-text="Business trip" /> </div> <div class="text-box"> <p class="title" :class="{ textEn: $i18n.locale === 'en' }">{{ $t('Business') }}</p> <p class="content" :class="{ textEn: $i18n.locale === 'en' }"> {{ $t('text7') }} </p> <p class="more" :class="{ textEn: $i18n.locale === 'en' }"> {{ $t("more14") }} </p> </div> </div> <!-- 旅游度假 --> <div class="tourism"> <div class="text-box"> <p class="title" :class="{ textEn: $i18n.locale === 'en' }">{{ $t('trip') }}</p> <p class="content" :class="{ textEn: $i18n.locale === 'en' }"> {{ $t('text8') }} </p> <p class="more" :class="{ textEn: $i18n.locale === 'en' }"> {{ $t("more15") }} </p> </div> <div class="img-box"> <responsive-image class="hd02" :small-image="hd02.smallImage2" :medium-image="hd02.mediumImage2" :large-image="hd02.largeImage2" alt-text="Vacation" /> </div> </div> </div> <!-- 查看客房 --> <div class="content-swiper"> <div class="content-kefang"> <p class="title" :class="{ textEn: $i18n.locale === 'en' }">{{ $t('Guest') }}</p> <div class="foot-swiper-box"> <RoomSwiper :bannerList="roomBannerList" /> </div> </div> <div class="content-kefang"> <p class="title" :class="{ textEn: $i18n.locale === 'en' }">{{ $t('Apartment') }}</p> <div class="foot-swiper-box"> <RoomSwiper :bannerList="apartBannerList" /> </div> </div> <div class="device"> <p class="title" :class="{ textEn: $i18n.locale === 'en' }">{{ $t('Facilities') }}</p> <div class="device-content"> <div class="img-box"> <responsive-image :small-image="facilities.smallImage" :medium-image="facilities.mediumImage" :large-image="facilities.largeImage" alt-text="Facilities" /> </div> <div class="text-box"> <ul class="device-list"> <li class="text" v-for="(item, index) in facilityItems" :key="index" :class="{ textEn: $i18n.locale === 'en' }"> {{ $t(item) }} </li> </ul> </div> </div> </div> </div> </div> <!-- 底部导航栏 --> <Footer /> </div> </template> <script> import RoomSwiper from "@/components/swiper/RoomSwiper.vue"; export default { name: "Experience", components: { RoomSwiper, }, data() { return { facilityItems: ['WiFi', 'individually', 'TV', 'laundry', 'safes', 'coffee', 'Minibar'], facilities: { smallImage: require("../../assets/experience/facilities-mobile.jpg"), mediumImage: require("../../assets/experience/facilities-tablet.jpg"), largeImage: require("../../assets/experience/facilities-desktop.jpg") }, hd01: { smallImage1: require("../../assets/experience/hd-01-mobile.jpg"), mediumImage1: require("../../assets/experience/hd-01-tablet.jpg"), largeImage1: require("../../assets/experience/hd-01-desktop.jpg"), }, hd02: { smallImage2: require("../../assets/experience/hd-02-mobile.jpg"), mediumImage2: require("../../assets/experience/hd-02-tablet.jpg"), largeImage2: require("../../assets/experience/hd-02-desktop.jpg"), }, roomBannerList: [ // 保持原有数据 ], apartBannerList: [ // 保持原有数据 ], }; }, }; </script> <style scoped> /* 基础样式 */ .experience { font-family: 'Helvetica Neue', Arial, sans-serif; color: #333; background: #f9f9f9; } .content-banner { width: 100%; height: 80vh; max-height: 800px; background-image: url("../../assets/banner/banner-02-desktop.jpg"); background-size: cover; background-position: center; } .container { max-width: 1440px; margin: 0 auto; padding: 0 20px; } .title { font-size: 2.8rem; color: #c9aa62; /* 香槟金色 */ font-weight: 300; letter-spacing: 1px; margin-bottom: 1.5rem; position: relative; padding-bottom: 10px; } .title::after { content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 60px; height: 2px; background: #c9aa62; } .text-box { padding: 2rem; } .content { font-size: 1.6rem; line-height: 1.8; color: #555; margin-bottom: 2rem; } .more { display: inline-block; font-size: 1.6rem; color: #c9aa62; text-decoration: none; border-bottom: 1px solid #c9aa62; padding-bottom: 5px; transition: all 0.3s; } .more:hover { color: #a88c4a; border-color: #a88c4a; } /* 布局样式 */ .business, .tourism { display: flex; align-items: center; margin: 8rem 0; } .img-box { flex: 1; overflow: hidden; border-radius: 4px; box-shadow: 0 5px 15px rgba(0,0,0,0.1); } .img-box img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; } .img-box:hover img { transform: scale(1.03); } .text-box { flex: 1; padding: 0 4rem; } /* 设备区域 */ .device-content { display: flex; align-items: center; gap: 5rem; margin-top: 5rem; } .device-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem; list-style: none; padding: 0; } .device-list li { position: relative; padding-left: 2.5rem; font-size: 1.6rem; line-height: 1.8; } .device-list li::before { content: '•'; position: absolute; left: 0; color: #c9aa62; font-size: 2rem; } /* 响应式调整 */ @media (max-width: 1200px) { .business, .tourism { margin: 6rem 0; } .device-content { gap: 3rem; } } @media (max-width: 992px) { .content-banner { height: 60vh; } .business, .tourism { flex-direction: column; gap: 3rem; } .tourism .text-box { order: -1; } .device-content { flex-direction: column; } .img-box { width: 100%; height: 400px; } } @media (max-width: 768px) { .content-banner { height: 50vh; background-image: url("../../assets/banner/banner-02-mobile.jpg"); } .title { font-size: 2.4rem; } .content { font-size: 1.4rem; } .device-list { grid-template-columns: 1fr; } .img-box { height: 300px; } .text-box { padding: 0 2rem; } } @media (max-width: 576px) { .content-banner { height: 40vh; } .title { font-size: 2rem; } .img-box { height: 250px; } } .textEn { font-family: 'Times New Roman', Times, serif; font-weight: 400; letter-spacing: 0.5px; } .content-kefang { margin: 8rem 0; } .foot-swiper-box { margin-top: 3rem; } </style> ``` ### 优化说明: 1. **响应式图片系统**: - 为所有图片添加了移动端/平板/桌面三种尺寸 - 使用`<responsive-image>`组件自动选择合适的图片 - 示例:设施图片现在有三种尺寸: ```js facilities: { smallImage: require("../../assets/experience/facilities-mobile.jpg"), mediumImage: require("../../assets/experience/facilities-tablet.jpg"), largeImage: require("../../assets/experience/facilities-desktop.jpg") } ``` 2. **布局优化**: - 使用Flexbox实现自适应的两栏布局 - 在移动端自动切换为单列布局 - 添加了优雅的悬停效果和阴影 ```css .business, .tourism { display: flex; align-items: center; } @media (max-width: 992px) { .business, .tourism { flex-direction: column; } } ``` 3. **视觉设计改进**: - 使用香槟金色(#c9aa62)作为主色调 - 添加标题下划线装饰: ```css .title::after { content: ''; width: 60px; height: 2px; background: #c9aa62; } ``` - 优化字体层次和间距 - 添加卡片阴影和悬停动画 4. **响应式断点优化**: - 添加5个响应式断点(576px, 768px, 992px, 1200px) - 每个断点精细调整布局和字体大小 ```css @media (max-width: 768px) { .content-banner { height: 50vh; } /* 其他调整 */ } ``` 5. **设施列表优化**: - 使用CSS Grid创建两列布局 - 添加自定义列表标记 - 响应式调整为单列布局 ```css .device-list { display: grid; grid-template-columns: repeat(2, 1fr); } @media (max-width: 768px) { .device-list { grid-template-columns: 1fr; } } ``` 6. **交互优化**: - "更多"链接添加下划线和悬停效果 - 图片添加缩放动画 ```css .img-box:hover img { transform: scale(1.03); } ``` 7. **多语言优化**: - 为英文内容添加特定字体样式 - 使用$t()函数统一管理多语言内容 ### 注意事项: 1. 确保创建不同尺寸的图片资源(移动端、平板、桌面) 2. 实际项目中应使用CSS变量管理颜色和间距 3. 考虑添加懒加载功能提升性能 4. 对于轮播图组件,确保其本身也是响应式的
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值