box-align,box-pack实现元素垂直底部对齐

发布时间:2020-06-28 13:38:56 作者:小旭依然
来源:网络 阅读:462

自己写了一个图表样式,利用box-align,box-pack属性end实现了其内部元素垂直底部对齐,在利用该属性前,设置其display属性为box即可。

css代码:

.tubiao-content{width: 90%;margin: auto;}

.tubiao{border-bottom: solid 1px #d0cece; padding-top: 2.4rem;}

.time01 {

position: relative;

float: left;

margin-left:12%;

width: 2.6rem;

/* Firefox */

display:-moz-box;

-moz-box-pack:end;

-moz-box-align:end;


/* Safari、Opera 以及 Chrome */

display:-webkit-box;

-webkit-box-pack:end;

-webkit-box-align:end;


/* W3C */

display:box;

box-pack:end;

box-align:end;

}

@media only screen and (min-width: 300px) and (max-width: 350px)  {

.time01 {margin-left:11%;}

}

.time01  li{width: 1.3rem;position: relative;}

.time01  li.time01-red{background: #f08417; height: 7rem;}

.time01  li.time01-green{background: #79bd3f;height: 14rem;}

.time01  li span{position: absolute;font-size: 1.2rem;}

.time01  li.time01-red span{left: -2.2rem;top: -0.5rem;}

.time01  li.time01-green span{left:1.5rem;top: -0.5rem;}

.tubiao-time{position:absolute;font-size: 1.5rem;width: 8rem;bottom: -2.5rem;left: -0.5rem;}

html代码

<div class="tubiao-content">
						<div class="tubiao mui-clearfix">
						<div class="time01 mui-clearfix">
							   <li class="time01-red"><span>300</span></li>
							   <li class="time01-green"><span>500</span></li>
							   <div class="tubiao-time">0~6点</div>
						</div>	
						<div class="time01 mui-clearfix">
							   <li class="time01-red"><span>300</span></li>
							   <li class="time01-green"><span>500</span></li>
							   <div class="tubiao-time">0~6点</div>
						</div>	
						<div class="time01 mui-clearfix">
							   <li class="time01-red"><span>300</span></li>
							   <li class="time01-green"><span>500</span></li>
							   <div class="tubiao-time">0~6点</div>
						</div>	
						<div class="time01 mui-clearfix">
							   <li class="time01-red"><span>300</span></li>
							   <li class="time01-green"><span>500</span></li>
							   <div class="tubiao-time">0~6点</div>
						</div>	
						</div>
						
					</div>

效果如下:

box-align,box-pack实现元素垂直底部对齐

推荐阅读:
  1. div垂直居中于父容器 box-pack 属性和box-align属性控制
  2. 水平和垂直对齐

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

css3 x-pack bo

上一篇:java中用什么运算符表示“或”

下一篇:php实现消息推送的方法

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》