4.8 字母间距letter-spacing和词间距word-spacing

CSS使用letter-spacing属性定义字间距,使用word-spacing属性定义词间距。这两个属性取值单位都是像素。

一、letter-spacing属性

语法:
letter-spacing:像素值;

letter-spacing控制的是字间距,每一个中文文字作为一个“字”,而每一个英文字母也作为一个“字”!大家要细心留意一下。

默认情况下,letter-spacing我们几乎都用不上,我们直接采用浏览器默认样式就可以了。大家完全可以忽略掉这个属性。

二、word-spacing属性

语法:
word-spacing:像素值;

定义词间距,以空格为基准进行调节,如果多个单词被连在一起,则被word-spacing视为一个单词;如果汉字被空格分隔,则分隔的多个汉字就被视为不同的单词,word-spacing属性此时有效。

针对这个Vue项目进行响应式布局调整,主要目标是让页面在不同设备上都能自适应显示:<template> <div class="family"> <!-- 顶部导航栏 --> <NavBar /> <!-- 首页内容区域 --> <div class="content-banner"> <hotel-reservation class="hotel-reservation"></hotel-reservation> </div> <div class="banner-text"> <p class="text" :class="{ textEn: $i18n.locale === 'en' }">{{ $t('Family') }}</p> <!-- <span class="top1" >Wedding Banquet & Conference</span> --> </div> <div class="content-wrapper"> <div class="title-box"> <p class="title-zh" :class="{ textEn: $i18n.locale === 'en' }">{{ $t('trip2') }}</p> </div> <!-- 一起脉动 --> <div class="content-box"> <div class="text-box"> <p class="content margin-bottom-20" :class="{ textEn: $i18n.locale === 'en' }"> {{ $t('text28') }} </p> <p class="more":class="{ textEn: $i18n.locale === 'en' }">{{ $t('more7') }}</p> </div> <div class="img-box"> <img src="@/assets/wedding/cup.png" alt="" /> </div> </div> <!-- 专业策划 --> <div class="content-box"> <div class="img-box"> <img src="@/assets/wedding/table.png" alt="" /> </div> <div class="text-box"> <p class="title-zh text-center" :class="{ textEn: $i18n.locale === 'en' }">{{ $t('Professional') }}</p> <p class="content margin-top-20" :class="{ textEn: $i18n.locale === 'en' }"> {{ $t('text20') }} </p> <p class="content"> </p> <p class="more div-center" :class="{ textEn: $i18n.locale === 'en' }">{{$t('more8')}}</p> </div> </div> <!-- 婚宴进行中 --> <div class="content-box"> <div class="text-box"> <p class="title-zh text-center" :class="{ textEn: $i18n.locale === 'en' }">{{ $t('progress') }}</p> <p class="content margin-top-20" :class="{ textEn: $i18n.locale === 'en' }"> {{ $t('text21') }} </p> <p class="more div-center" :class="{ textEn: $i18n.locale === 'en' }">{{ $t('more9') }}</p> </div> <div class="img-box"> <img src="@/assets/wedding/flower.png" alt="" /> </div> </div> </div> <!-- 底部导航栏 --> <Footer /> </div> </template> <script> export default { name: "family", data() { return { }; }, }; </script> <style scoped> .content-banner { width: 100vw; height: 62rem; margin: 0 auto; background-image: url("@/assets/wedding/flower.png"); background-size: 100% 100%; position: relative; } .hotel-reservation { width: 120rem; height: 12rem; margin: 0 auto; position: relative; top: 45rem; } .content-wrapper { width: 120rem; margin: 0 auto; } .title-box { text-align: center; margin: 6rem 0; } .content-box { display: flex; justify-content: space-between; margin-bottom: 10rem; } .title-en{ font-size: 3rem; font-weight: bold; line-height: 2em; font-family: "Times New Roman", Times, serif; } .textEn { font-family: "Times New Roman", Times, serif !important; } .banner-text { position: absolute; top: 10rem; left: 20%; padding: 1rem 24rem; font-size: 3.2rem; line-height: 2em; font-weight: bold; color: #fff; text-align: center; background-color: rgba(1, 1, 1 1.5); } .text { margin-top: 2rem; font-family: "FangSong"; font-size: 10rem; line-height: 2em; text-align: left; padding: 0 4rem; text-align: justify; -webkit-text-justify: inter-word; text-justify: inter-word; } .top1{ font-family: "Times New Roman", Times, serif; font-size: 6rem; font-weight: bold; } .title-zh { font-size: 4.6rem; /* font-weight: bold; */ 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 img { 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-box{ text-align: left; } /* 通用属性 */ /* 文本居中 */ .text-center { text-align: left; } /* div居中 */ .div-center { margin: 5rem auto; text-align: center; } /* 上外边距2rem */ .margin-top-20 { margin-top: 2rem; } /* 下外边距2rem */ .margin-bottom-20 { margin-bottom: 2rem; } /* 页面修改区域 */ /* 响应式调整 */ @media screen and (max-width: 1024px) { .content-banner { height: 70rem; } .hotel-reservation { width: 160rem; top: 54rem; } .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: 54rem; height: 42rem; } .img-box img { width: 54rem; height: 42rem; } .more { width: 20rem; font-size: 2.4rem; } } @media screen and (max-width: 768px) { .content-banner { height: 82rem; background-image: url("@/assets/wedding/flower.png"); } .hotel-reservation { width: 160rem; top: 66rem; } .content-wrapper { width: 160rem; } .content-box { flex-direction: column; } .img-box { order: 2; } .img-box img { width: 100rem; height: auto; } .text-box { order: 1; } .title-en { font-size: 6rem; } .title-zh { font-size: 6.2rem; } .content { width: 160rem; font-size: 4rem; } .img-box { width: 160rem; height: 90rem; } .more { width: 30rem; font-size: 3.2rem; margin-bottom: 5rem; margin-left: 130rem; } } </style>
最新发布
07-05
请帮我完善该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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值