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

连云港网站建设网站软文设计

连云港网站建设,网站软文设计,网站运营托管,秦皇岛吧 百度贴吧简单概述 为元素添加 display:flex; 的属性后&#xff0c;当前元素被视为弹性布局的盒子容器(box)&#xff0c;其子元素被视为弹性布局项目(item)。item 会在 box 内灵活布局&#xff0c;解决了对齐、分布、尺寸等响应式问题。 演示 demo <template><div class&quo…

简单概述

  • 为元素添加 display:flex; 的属性后,当前元素被视为弹性布局的盒子容器(box),其子元素被视为弹性布局项目(item)。
  • item 会在 box 内灵活布局,解决了对齐、分布、尺寸等响应式问题。

演示 demo

<template><div class="mainBox"><div class="box"><divv-for="(item, index) in data":key="index"class="item":style="{background: item.background, height: item.height, width: item.width,}">{{ item.msg }}</div></div></div>
</template>
<script>
export default {data() {return {data: [{ msg: "111", background: "#3E445E", width: "100px", height: "50px", },{ msg: "222", background: "#D0D3DA", width: "100px", height: "60px", },{ msg: "333", background: "#505A9B", width: "100px", height: "70px", },{ msg: "444", background: "#7394CD", width: "100px", height: "80px", },{ msg: "555", background: "#F1E2D0", width: "100px", height: "90px", },{ msg: "666", background: "#F6CFA3", width: "100px", height: "100px", },{ msg: "777", background: "#E18792", width: "100px", height: "110px", },{ msg: "888", background: "#907AC3", width: "100px", height: "120px", },],};},
};
</script>
<style lang="less" scoped>
.mainBox {width: 100%;height: 100%;
}
.box {display: flex;padding: 40px;border: 1px solid #333;.item {color: #fff;}
}
</style>

下述属性演示都在以上代码的基础上进行

用于盒子容器(box)的属性

flex-direction

  • 设置 box 内弹性 item 的方向
  • 取值:row / row-reverse / column / column-reverse
  • flex-direction: row; 行模式-从左到右排列(默认值)
    .box {display: flex;padding: 40px;border: 1px solid #333;flex-direction: row;
    }
    
    flex-direction: row;
  • flex-direction: row-reverse; 行模式-从右到左排列
    .box {display: flex;padding: 40px;border: 1px solid #333;flex-direction: row-reverse;
    }
    
    flex-direction: row-reverse;
  • flex-direction: column; 列模式-从上到下排列
    .box {display: flex;padding: 40px;border: 1px solid #333;flex-direction: column;
    }
    
    flex-direction: column;
  • flex-direction: column-reverse; 列模式-从下到上排列
    .box {display: flex;padding: 40px;border: 1px solid #333;flex-direction: column-reverse;
    }
    
    flex-direction: column-reverse;

flex-wrap

  • box 在必要的时候换行
  • 取值:nowrap / wrap
  • flex-wrap: nowrap; 不换行(默认值)
    .box {display: flex;padding: 40px;border: 1px solid #333;flex-wrap: nowrap;
    }
    /* 减小 box 宽度时,item 的宽度失效,被压缩 */
    
    flex-wrap: nowrap;
  • flex-wrap: wrap; 换行
    .box {display: flex;padding: 40px;border: 1px solid #333;flex-wrap: wrap;
    }
    /* 减小 box 宽度时,item 的宽度不变,不会被压缩,自动换行 */
    
    在这里插入图片描述

justify-content

  • 设置 box 内弹性 item 的对齐分布方式
  • 取值:flex-start / flex-end / center / space-between / space-around / space-evenly
  • 为方便观察不同属性的对比,移除了 boxpadding 属性
  • justify-content: flex-start; 起点对齐(默认值)
    .box {display: flex;border: 1px solid #333;justify-content: flex-start;
    }
    
    justify-content: flex-start;
  • justify-content: flex-end; 结束点对齐
    .box {display: flex;border: 1px solid #333;justify-content: flex-end;
    }
    
    justify-content: fflex-end;
  • justify-content: center; 居中对齐
    .box {display: flex;border: 1px solid #333;justify-content: center;
    }
    
    justify-content: center;
  • justify-content: space-between; 两端对齐
    .box {display: flex;border: 1px solid #333;justify-content: space-between;
    }
    
    justify-content: space-between;
  • justify-content: space-around; 周围分布-视作 margin 效果的话,相当于每个 itemmargin-leftmargin-right 值相同
    .box {display: flex;border: 1px solid #333;justify-content: space-around;
    }
    /* margin-right = margin-left = (box 的宽度 - item 的宽度 * 8) / (8 * 2) */
    
    justify-content: space-around;
  • justify-content: space-evenly; 均匀分布-视作 margin 的话,均匀分配剩余空间,每个 itemmargin-left 值相等,最后剩下的空隙,值与 itemmargin-left 相等
    .box {display: flex;border: 1px solid #333;justify-content: space-evenly;
    }
    /* margin-right = 0 */
    /* margin-left = (box 的宽度 - item 的宽度 * 8) / (8 + 1) */
    
    justify-content: space-evenly;

align-items

  • 设置 box 内弹性 item 的针对交叉轴的对齐分布方式
  • 取值:flex-start / flex-end / center
  • align-items: flex-start; 起点对齐(默认值)
    .box {display: flex;padding: 40px;border: 1px solid #333;align-items: flex-start;
    }
    
    align-items: flex-start;
  • align-items: flex-end; 结束点对齐
    .box {display: flex;padding: 40px;border: 1px solid #333;align-items: flex-end;
    }
    
    align-items: flex-end;
  • align-items: center; 居中对齐
    .box {display: flex;padding: 40px;border: 1px solid #333;align-items: center;
    }
    
    align-items: center;

align-content

  • 设置多轴线 box 内弹性 item 的对齐分布方式

  • 取值:flex-start / flex-end / center / space-between / space-around / space-evenly

  • 为方便观察不同属性的对比,移除了 boxpadding 属性

  • 为外层父盒子添加 flex 属性,形成多轴线的盒子

  • align-content: flex-start; 起点对齐

    .mainBox {display: flex;.box {display: flex;border: 1px solid #333;flex-wrap: wrap;align-content: flex-start;}
    }
    

    align-content: flex-start;

  • align-content: flex-end; 结束点对齐

    .mainBox {display: flex;.box {display: flex;border: 1px solid #333;flex-wrap: wrap;align-content: flex-end;}
    }
    

    align-content: flex-end;

  • align-content: center; 居中对齐

    .mainBox {display: flex;.box {display: flex;border: 1px solid #333;flex-wrap: wrap;align-content: center;}
    }
    

    align-content: center;

  • align-content: space-between; 两端对齐

    .mainBox {display: flex;.box {display: flex;border: 1px solid #333;flex-wrap: wrap;align-content: space-between;}
    }
    

    align-content: space-between;

  • align-content: space-around; 周围分布

    .mainBox {display: flex;.box {display: flex;border: 1px solid #333;flex-wrap: wrap;align-content: space-around;}
    }
    

    align-content: space-around;

  • align-content: space-evenly; 均匀分布

    .mainBox {display: flex;.box {display: flex;border: 1px solid #333;flex-wrap: wrap;align-content: space-evenly;}
    }
    

    align-content: space-evenly;

用于弹性项目(item)的属性

order

  • 设置 box 内弹性 item 的排序
  • 取值:Num,取值越小越靠前,默认为 0
    .item {color: #fff;&:nth-child(1) {order: 4;}&:nth-child(2) {order: 3;}&:nth-child(3) {order: 0;}&:nth-child(4) { }&:nth-child(5) {order: 2;}
    }
    
    order

flex-grow

  • 设置 box 内弹性 item 的扩展系数
  • 取值:Num,取值越小扩展比例越小,默认为 0
    .item {color: #fff;&:nth-child(1) {flex-grow: 1;}&:nth-child(2) {flex-grow: 3;}&:nth-child(3) {flex-grow: 1;}&:nth-child(4) { }&:nth-child(5) { }
    }
    
    flex-grow

flex-basis

  • 设置 box 内弹性 item 的初始宽度,会覆盖原有宽度属性
  • 取值:像素值
    .item {color: #fff;&:nth-child(1) {flex-basis: 50px;}&:nth-child(2) {flex-basis: 100px;}&:nth-child(3) {flex-basis: 150px;}&:nth-child(4) {flex-basis: 200px;}&:nth-child(5) {flex-basis: 250px;}
    }
    
    flex-basis

flex-shrink

  • 设置 box 内弹性 item 的收缩系数
  • 取值:Num,取值越小压缩比例越小,默认为 1 ,取值为 0 时,不会被压缩
    .item {color: #fff;&:nth-child(1) {flex-shrink: 1;}&:nth-child(2) {flex-shrink: 2;}&:nth-child(3) {flex-shrink: 3;}&:nth-child(4) {flex-shrink: 0;}&:nth-child(5) {flex-shrink: 0;}
    }
    
    flex-shrink
http://www.yayakq.cn/news/477284/

相关文章:

  • 绵阳网站维护托管友情链接发布平台
  • 云南省住房和城乡建设厅网站站长工具劲爆
  • 网站建设登录界面设计步骤网站的营销方法
  • 合肥网站优化排名推广互站网怎么样
  • 免费网站建设站王者荣耀是哪家公司开发的
  • 制作简历哪个网站好陕西省城乡住房建设厅网站
  • wordpress自动网站地址广州微盟微商城
  • 买好域名和云主机后怎么做网站新浪sae 安装wordpress
  • 企业网站seo哪里好物流企业网站建设特色
  • 国外网站推广如何做网站原型图软件
  • 淘宝网站的推广与优化建筑施工企业主要负责人安全证书
  • 网站案例展示分类广告联盟挂机
  • 专门做ppt的网站叫什么jsp电子商务网站开发源码
  • 如何利用淘宝建设网站挣钱游戏开发用什么语言
  • 美容美发网站模板长宁区网站建设网站制作
  • 网站建设教程17建设门户网站
  • 合肥模板网站建设费用网站模板 茶叶响应式
  • 有哪些网站可以做兼职衡水seo_衡水网站建设-燕丰收
  • 宁波建设银行网站分部网络营销的主要传播渠道是
  • 安义网站建设wordpress 上传功能
  • 公司网站建设什么价格低园区网站建设
  • 重庆网站推广大全2022做网站还能赚钱吗
  • 南浔建设网站在线教学网站建设
  • 网站做外链的具体步骤wordpress影视主题下载失败
  • 网站做优化有什么好处开源的低代码开发平台
  • 下城区网站建设价格查询建设网站需要什么资质
  • 企业网站pr值低怎么办制作3d动画的软件
  • 临沂做百度网站软件公司网站设计报价单模板
  • 西安网站制作有限公司制作网站需要的服务器
  • 我的世界找建筑网站模板下载失败