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

构建网站需要什么意思网站里的字体大小

构建网站需要什么意思,网站里的字体大小,杭州做网站公司,免费注册自己的网站文章目录 v-bind对样式控制的增强2.1 操作class2.1.1 语法2.1.2 对象语法2.1.3 数组语法2.1.4 使用2.1.5 Test 2.2 操作style2.2.1 语法2.2.2 使用2.2.3 Test v-bind对样式控制的增强 2.1 操作class 2.1.1 语法 <div> :class "对象/数组">这是一个div&l…

文章目录

  • v-bind对样式控制的增强
    • 2.1 操作class
      • 2.1.1 语法
      • 2.1.2 对象语法
      • 2.1.3 数组语法
      • 2.1.4 使用
      • 2.1.5 Test
    • 2.2 操作style
      • 2.2.1 语法
      • 2.2.2 使用
      • 2.2.3 Test

v-bind对样式控制的增强

2.1 操作class

2.1.1 语法

<div> :class = "对象/数组">这是一个div</div>

2.1.2 对象语法

当class动态绑定的是对象时,键就是类名,值就是布尔值,如果值是true,就有这个类,否则没有这个类

<div class="box" :class="{ 类名1: 布尔值, 类名2: 布尔值 }"></div>

适用场景:一个类名,来回切换

2.1.3 数组语法

当class动态绑定的是数组时 → 数组中所有的类,都会添加到盒子上,本质就是一个 class 列表

<div class="box" :class="[ 类名1, 类名2, 类名3 ]"></div><div class="box" :class="[ '类名1', '类名2', '类名3' ]"></div>

使用场景:批量添加或删除类

2.1.4 使用

<style>.box {width: 50px;height: 50px;border: 1px solid #000;margin-top: 5px;}.red {background-color: red;}.big {width: 100px; height: 100px;}</style>
</head>
<body><div id="app"><div class="box" :class="{ big: true, red: true }">你好Java</div><div class="box" :class="['red', 'big']">你好Java</div></div><script src="js/vue.js"></script><script>const app = new Vue({el: '#app',data: {}})</script>
</body>

2.1.5 Test

<style>* {margin: 0;padding: 0;}ul {display: flex;border-bottom: 2px solid #1e3c9f;padding: 0 10px;}li {width: 100px;height: 50px;line-height: 50px;list-style: none;text-align: center;}li a {display: block;text-decoration: none;font-weight: bold;color: #333333;}li a.active {background-color: #12e06f;color: #fff;}</style>
</head>
<body><div id="app"><ul><li v-for="(item ,index) in list" :key="item.id" @click="activeIndex = index"><a href="#" :class="{active: index === activeIndex}">{{item.name}}</a></li></ul></div><script src="js/vue.js"></script><script>const app = new Vue({el: '#app',data: {activeIndex: 0, // 记录高亮list: [{id: 1,name: '商品秒杀'}, {id: 2,name: '特价处理'}, {id: 3,name: '品牌优惠'}]}})</script>
</body>

2.2 操作style

2.2.1 语法

:style中的css属性会覆盖 class="box"的css样式

<div class="box" :style="{ CSS属性名1: CSS属性值, CSS属性名2: CSS属性值 }"></div>

2.2.2 使用

<style>.box {width: 50px;height: 50px;background-color: red;}</style>
</head><body><div id="app"><div class="box" :style="{ width: '100px', height: '100px', backgroundColor: 'green' }"></div></div><script src="js/vue.js"></script><script>const app = new Vue({el: '#app',data: {}})</script>
</body>

2.2.3 Test

 <style>.progress {height: 25px;width: 400px;border-radius: 15px;background-color: #272425;border: 3px solid #272425;box-sizing: border-box;margin-bottom: 30px;}.inner {width: 50%;height: 20px;border-radius: 10px;text-align: right;position: relative;background-color: #409eff;background-size: 20px 20px;box-sizing: border-box;transition: all 1s;}.inner span {position: absolute;right: -20px;bottom: -25px;}</style>
</head><body><div id="app"><!-- 外层盒子底色 (黑色) --><div class="progress"><!-- 内层盒子 - 进度(蓝色) --><div class="inner" :style="{ width: percent+'%' }"><span>{{ percent }}%</span></div></div><button @click="percent = 25">设置25%</button><button @click="percent = 50">设置50%</button><button @click="percent = 75">设置75%</button><button @click="percent = 100">设置100%</button></div><script src="js/vue.js"></script><script>const app = new Vue({el: '#app',data: {percent: 30}})</script>
</body>
http://www.yayakq.cn/news/434498/

相关文章:

  • 黑龙江省建设集团网站云南省城乡建设培训中心网站
  • 网站关键词之间广东新闻联播2019
  • 网站兼容ie代码做电影网站用的云盘
  • 最便宜的网站网站优化百度
  • 网站大气是什么意思专业建站公司的业务内容
  • 开网店需要自己做网站吗浙江省建设厅证书查询
  • 做搜狗网站关键词排名关于内网站建设的请示
  • 中国山东建设监理协会官方网站站长工具果冻传媒
  • 连云港市赣榆区建设局网站怎么用自己的电脑做网站
  • 临沂网站制作定制网络编程技术及应用
  • 个人备案网站经营wordpress自定义分类模板下载
  • 网站百度权重查询网站微商城的建设运营实践和思考
  • 网站建设公司服wordpress删除分类
  • 在线充值网站怎么做图文制作app哪个好
  • 贺兰县住房和城乡建设局网站企业网站的技术维护内容主要包括
  • 临沂做拼多多网站如何组建商业网
  • 上海高端建站dnf做任务解制裁的网站
  • 技术支持 张家港网站建设徐州网站制作建设
  • 广州网站建设比较好的公司手机免费推广软件
  • 家居网站建设如何wordpress 需要缓存
  • 网站充值接口怎么做科技网络公司怎么取名字
  • 本手机原有微信网站西安SEO网站建设
  • python做的网站哪些泰州哪家网做网站
  • 乔拓云智能建站官网怎样做一个公司网站
  • 唐山网站制作公司设计网页的步骤和规范
  • 佛山新网站建设如何字号 wordpress
  • 百度站长平台网站验证企业网站管理系统信得过y湖南岚鸿怎么样
  • 在哪个网做免费网站好企业公司简介
  • 局网站内容建设考核百度网址大全旧版安装
  • 网站建设 做一个网站需要多少钱网站建设中什么是一栏