flex布局

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<style type="text/css">
			#big{
				height: 500px;
				border: 2px solid black;
				resize: both;
				overflow: hidden;
				/*申明为flex容器*/
				display: flex;
				/*水平居中*/
				justify-content: center;
				/*右对齐*/
				/*justify-content: flex-end;*/
 /* 两端对齐*/
            /*     justify-content: space-between;*/
           /*两端保持一样的距离*/
                 justify-content: space-around;
                 

              
			}
			.box{
				width: 200px;
				height: 200px;
				color: white;
			    font-size: 100px;	
			    flex-shrink: 0;
			}
			.mi{
				width: 200px;
				height: 200px;
				color: white;
			    font-size: 100px;	
			    flex-shrink: 0;
			}
			#red{
				background-color: red;
			}
			#blue{
				background-color: blue;
			}
			#green{
				background-color: green;
			}
			#orange{
				background-color: orange;
			}
			#fuchsia{
				background-color: fuchsia;
			}
			#cornflowerblue{
				background-color: cornflowerblue;
			}
			#darkgoldenrod{
				background-color: darkgoldenrod;
			}
		</style>
	</head>
	<body>
		<div id="big">
	         <div class="box" id="red">1</div>
	         <div class="box" id="blue">2</div>
	         <div class="box" id="green">3</div>
	         <div class="box mi" id="orange">4</div>
	         <div class="box" id="fuchsia">5</div>
	         <div class="box" id="cornflowerblue">6</div>
	         <div class="box" id="darkgoldenrod">7</div>
		</div>
	</body>
</html>

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<style type="text/css">
			#big{
				height: 500px;
				border: 2px solid black;
				resize: both;
				overflow: hidden;
				/*申明为flex容器*/
				display: flex;
				/*左对齐从左到右的顺序*/
/*				flex-direction: row;*/
/*从右到左*/
/*			flex-direction: row-reverse;*/
           /*纵向排列,从上到下*/
          /*flex-direction: column;*/
           /*纵向排列 从下到往上*/
          flex-direction: column-reverse;
			}
			.box{
				width: 200px;
				height: 200px;
				color: white;
			    font-size: 100px;
			}
			#red{
				background-color: red;
			}
			#blue{
				background-color: blue;
			}
			#green{
				background-color: green;
			}
		</style>
	</head>
	<body>
		<div id="big">
	         <div class="box" id="red">1</div>
	         <div class="box" id="blue">2</div>
	         <div class="box" id="green">3</div>
		</div>
	</body>
</html>

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值