一个属性text-align-last,对齐写法可以说是比较麻烦的
本篇文章介绍了使用css实现文本两端对齐的效果,具有一定的参考价值,感兴趣的朋友可以看看。
<pre class="brush:php;toolbar:false;">//html
{{item.label}}: {{item.value}}</pre>
<pre class="brush:php;toolbar:false;">//scss
.item {
height: 32px;
line-height: 32px;
margin-bottom: 8px;
.label {
display: inline-block;
height: 100%;
width: 100px;
text-align: justify;
vertical-align: top;
&::after {
display: inline-block;
width: 100%;
content: &#39;&#39;;
height: 0;
}
}
.value {
padding-right: 10px;
}
re>
but以上写法可以说是比较麻烦的,重点来啦,最近新了解到的一个属性text-align-lastcss 英文两端对齐,该属性定义的是一段文本中最后一行在被强制换行之前的对齐规则。
<pre class="brush:php;toolbar:false;">//scss
.item {
margin-bottom: 8px;
.label {
display: inline-block;
height: 100%;
min-width: 100px;
text-align: justify;
text-align-last: justify;
}
.value {
padding-right: 10px;
}
re>
相比第一种实现,第二种实现方式就简单了不少css 英文两端对齐,不过该属性有兼容性问题,大家可以根据情况决定实现方式。
( 推荐学习:CSS教程 )
以上就是css实现文本两端对齐的方法的详细内容,更多请关注 第一PHP社区 其它相关文章!
发表评论
热门文章
Spimes主题专为博客、自媒体、资讯类的网站设计....
仿制主题,Typecho博客主题,昼夜双版设计,可....
一款个人简历主题,可以简单搭建一下,具体也比较简单....
用于作品展示、资源下载,行业垂直性网站、个人博客,....
热评文章
最新评论
bluejay21st
1月30日
我是作者,很意外我的插件会被转载,非常感谢。因为平时比较忙,改了博客的域名但是并没有及时做重定向以及更新插件,十分抱歉。
大家如果需要可以去Github下载我的插件:
https://github.com/bluejay21st/Typecho-BaiduSeo
https://github.com/bluejay21st/Typecho-Sitemap
chenyu
3天前
[已回复]
怎么配置主题 没看到教程