分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 教程案例

css-5(弹性盒子)

发布时间:2023-09-06 01:47责任编辑:胡小海关键词:暂无标签
<!DOCTYPE html><html><head><meta charset="UTF-8"><title></title></head><style type="text/css">/*分别设置father和son的宽高和边框*/.father{width: 1000px;height: 500px;border: 1px solid black;/*在css中设置father为弹性盒子*/display: flex;/*让father的子元素在father中水平居中 justify-content: center;*//*让子元素空间环绕*/justify-content: space-around;/*让子元素垂直居中*/align-items: center;/*允许当父系元素宽度小于子元素总宽度时,多余的子系元素换行排列*/flex-wrap: nowrap;}.son{/*可去掉son的宽度,使用flex:N(n填写数字)参数,则每个son的宽度占父系宽度的 "N/总N" * flex: N;*/width: 200px;height: 100px;border: 1px solid blue;}</style><body><!--设置一个父系div,取名叫father--><div class="father"><!--设置子div,取名叫son--> ???????????<div class="son"></div> ????????????<div class="son"></div> ????????????<div class="son"></div> ????????????????????????</div></body></html>

 效果图:

css-5(弹性盒子)

原文地址:https://www.cnblogs.com/zhangrui0328/p/8708592.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved