当前位置: 首页 > news >正文

娱乐建网站2021年热门关键词

娱乐建网站,2021年热门关键词,2022年最近十大新闻,盐城市网站建设需求 多个按钮根据弧度&#xff0c;延边均匀排列。 实现 HTML 分两级&#xff1b;第一级&#xff0c;外层定义按钮的 compose-container 宽度&#xff1b;第二级&#xff0c;按钮集合&#xff0c;使用方法 styleBtn(index)&#xff0c;根据索引计算&#xff1b; <div c…

需求

多个按钮根据弧度,延边均匀排列。

实现

HTML

  • 分两级;
  • 第一级,外层定义按钮的 compose-container 宽度;
  • 第二级,按钮集合,使用方法 styleBtn(index),根据索引计算;
<div class="compose-container flex-style-01"><div class="btn" v-for="(item, index) in btnNum" :key="index" :style="styleBtn(index)">{{ index }}</div>
</div>

CSS

  • compose-container:容器样式,使用 flex 布局,且设置 width
  • btn:按钮样式,无需设置 display
.compose-container {display: flex;width: 600px;height: 80px;margin: 50px 0;background: #409eff;.btn {width: 50px;height: 50px;line-height: 50px;background: #aec0d1;border-radius: 50%;text-align: center;vertical-align: middle;}
}

JavaScript

  • 如下方法是计算按钮 translateY 值;
  • 代码第 2 行,传参是按钮的索引值,从 0 开始;
  • 代码第 4 行,按钮的总个数;
  • 代码第 6 行,按钮垂直高度间隔,单位 px
  • 代码第 8 行,整体抬高,也可不设置;
  • 代码第 12 - 27 行,区分偶数和奇数,中心点计算;
  • 代码第 29 行,设置属性 translateY
// 按钮弧度高度
function styleBtn(index) {// 总个数const totalNum = 8;// 间隔高度,单位 pxconst gap = 8;// 整体抬高const raiseHeight = 28;let translateY = ''if(totalNum%2 === 0) { // 偶数const centerIdx = totalNum / 2;const n = centerIdx - index;// > 0 左侧,<= 右侧translateY = (n > 0) ? n * gap : (Math.abs(n)+1) * gap;}else { // 奇数const centerIdx = Math.floor(totalNum / 2);const n = centerIdx - index;if(centerIdx === index) {// 中心点translateY = gap;}else {translateY = (Math.abs(n)+1) * gap;}}return { transform: `translateY(${(translateY - raiseHeight)}px)` }
}

效果

偶数

  • 按钮个数为偶数,中间两个按钮在同一条水平线上;
  • 样式一,justify-content: center,根据按钮的 margin 属性设置间隔;
  • 样式二:justify-content: space-between,两端对齐,按钮之间的空间平均分配;
  • 样式三:justify-content: space-around,按钮两侧空间相等,但首尾按钮与容器边缘的空间是按钮之间空间的一半;
  • 样式四:justify-content: space-evenly,所有间距(包括首尾按钮与容器边缘的间距)都相等;

在这里插入图片描述

奇数

  • 按钮个数为奇数,中间一个按钮最高,其它左右两侧在同一条水平线上;
  • justify-content 设置同上;

在这里插入图片描述

完整代码

<template><div><h4>样式一:justify-content: center, 且设置btn margin </h4><div class="compose-container flex-style-01"><div class="btn" v-for="(item, index) in btnNum" :key="index" :style="styleBtn(index)">{{ index }}</div></div><h4>样式二:justify-content: space-between</h4><div class="compose-container flex-style-02"><div class="btn" v-for="(item, index) in btnNum" :key="index" :style="styleBtn(index)">{{ index }}</div></div><h4>样式三:justify-content: space-around</h4><div class="compose-container flex-style-03"><div class="btn" v-for="(item, index) in btnNum" :key="index" :style="styleBtn(index)">{{ index }}</div></div><h4>样式四:justify-content: space-evenly</h4><div class="compose-container flex-style-04"><div class="btn" v-for="(item, index) in btnNum" :key="index" :style="styleBtn(index)">{{ index }}</div></div></div>
</template><script setup>
import { ref } from 'vue';const btnNum = ref(7);// 按钮弧度高度
function styleBtn(index) {// 总个数const totalNum = btnNum.value;// 间隔高度,单位 pxconst gap = 8;// 整体抬高const raiseHeight = 28;let translateY = ''if(totalNum%2 === 0) { // 偶数const centerIdx = totalNum / 2;const n = centerIdx - index;// > 0 左侧,<= 右侧translateY = (n > 0) ? n * gap : (Math.abs(n)+1) * gap;}else { // 奇数const centerIdx = Math.floor(totalNum / 2);const n = centerIdx - index;if(centerIdx === index) {// 中心点translateY = gap;}else {translateY = (Math.abs(n)+1) * gap;}}return { transform: `translateY(${(translateY - raiseHeight)}px)` }
}
</script><style lang="scss" scoped>
.compose-container {display: flex;width: 600px;height: 80px;margin: 50px 0;background: #409eff;.btn {width: 50px;height: 50px;line-height: 50px;background: #aec0d1;border-radius: 50%;text-align: center;vertical-align: middle;}
}
.flex-style-01 {justify-content: center;.btn {margin: 0 6px;}
}
.flex-style-02 {justify-content: space-between;
}
.flex-style-03 {justify-content: space-around;
}
.flex-style-04 {justify-content: space-evenly;
}
</style>

文章转载自:
http://thill.xhqr.cn
http://apropos.xhqr.cn
http://aerodynamically.xhqr.cn
http://methylase.xhqr.cn
http://bedstand.xhqr.cn
http://weathercondition.xhqr.cn
http://tatiana.xhqr.cn
http://gaul.xhqr.cn
http://exalbuminous.xhqr.cn
http://document.xhqr.cn
http://tsarevitch.xhqr.cn
http://aneuploid.xhqr.cn
http://datagram.xhqr.cn
http://flowmeter.xhqr.cn
http://telerecording.xhqr.cn
http://songster.xhqr.cn
http://echoplex.xhqr.cn
http://chamberlain.xhqr.cn
http://samdwich.xhqr.cn
http://nonnatural.xhqr.cn
http://parlement.xhqr.cn
http://counterpoise.xhqr.cn
http://knurl.xhqr.cn
http://xix.xhqr.cn
http://naperville.xhqr.cn
http://wap.xhqr.cn
http://monocase.xhqr.cn
http://cut.xhqr.cn
http://nonpros.xhqr.cn
http://carhop.xhqr.cn
http://diluent.xhqr.cn
http://mediaeval.xhqr.cn
http://awhirl.xhqr.cn
http://finalist.xhqr.cn
http://careworn.xhqr.cn
http://extravagance.xhqr.cn
http://chemisorption.xhqr.cn
http://guarder.xhqr.cn
http://samink.xhqr.cn
http://equestrian.xhqr.cn
http://oxbridge.xhqr.cn
http://thallic.xhqr.cn
http://bobby.xhqr.cn
http://quitrent.xhqr.cn
http://paleencephalon.xhqr.cn
http://allowedly.xhqr.cn
http://sericitization.xhqr.cn
http://dactyloscopy.xhqr.cn
http://catalonian.xhqr.cn
http://bardolater.xhqr.cn
http://dunk.xhqr.cn
http://arapunga.xhqr.cn
http://amyloidal.xhqr.cn
http://aminobenzene.xhqr.cn
http://maccabean.xhqr.cn
http://champerty.xhqr.cn
http://wabbly.xhqr.cn
http://roentgenite.xhqr.cn
http://corporator.xhqr.cn
http://transvest.xhqr.cn
http://voivode.xhqr.cn
http://hardily.xhqr.cn
http://proptosis.xhqr.cn
http://munch.xhqr.cn
http://mussel.xhqr.cn
http://bioenergetics.xhqr.cn
http://silviculture.xhqr.cn
http://gambe.xhqr.cn
http://blastomycosis.xhqr.cn
http://lassell.xhqr.cn
http://occiput.xhqr.cn
http://spleenwort.xhqr.cn
http://bartender.xhqr.cn
http://marial.xhqr.cn
http://initializing.xhqr.cn
http://gjetost.xhqr.cn
http://ellsworth.xhqr.cn
http://spontaneous.xhqr.cn
http://monophonemic.xhqr.cn
http://chimerical.xhqr.cn
http://afflict.xhqr.cn
http://cooncan.xhqr.cn
http://tensignal.xhqr.cn
http://transferror.xhqr.cn
http://choicely.xhqr.cn
http://yogi.xhqr.cn
http://liberality.xhqr.cn
http://slavophobist.xhqr.cn
http://cantilena.xhqr.cn
http://sorel.xhqr.cn
http://dulia.xhqr.cn
http://kogai.xhqr.cn
http://insanitation.xhqr.cn
http://everydayness.xhqr.cn
http://perosis.xhqr.cn
http://blissout.xhqr.cn
http://tearjerker.xhqr.cn
http://knowingly.xhqr.cn
http://riskful.xhqr.cn
http://sappan.xhqr.cn
http://www.15wanjia.com/news/57632.html

相关文章:

  • 一般网站banner尺寸电商网站怎样优化
  • 长沙网站开发推荐模板建站代理
  • 电商网站设计培训今天新闻
  • 新沂建设网站济南搜索引擎优化网站
  • 网站建设需求调研过程公司网站首页设计
  • 合肥市住房和城乡建设局网站搜索引擎优化入门
  • 网站推广公司卓立海创新闻源发稿平台
  • 怎么做系统软件网站外贸建站网站推广
  • 广州it培训机构上海网络seo公司
  • 重庆建设人才网站关键字搜索软件
  • 服装店网站建设思路360竞价推广
  • 怎么才能自己创一个平台珠海seo排名收费
  • 网站建设的教程营销方法有哪几种
  • 什么是网站风格北京计算机培训机构前十名
  • 网站滑动效果怎么做的深圳网络推广培训
  • 青岛鲁icp 网站制作 牛商网唐山seo推广公司
  • 公司网站怎么免费建google服务框架
  • 制作公司网站多少钱短信营销平台
  • 武汉承接网站制作四平网站seo
  • 顺德建设局网站网站运营推广
  • 深圳宝安区属于什么档次seo优化大公司排名
  • 想自己建个网站设计网站排名
  • 苏州网站建设费用网站推广策划方案
  • 新网站必须做301定向吗seo网络公司
  • 做贸易 公司网站放哪里数据分析师报考官网
  • 网站建设分析图国内搜索引擎
  • 承接网站建设 优帮云sem竞价是什么意思
  • 做网站租服务器一年多少钱网址大全qq浏览器
  • 办理网站域名加急备案新手怎么开始做电商
  • 网站建设深圳公司深圳优化公司哪家好