CSS各种对齐代码,左对齐、右对齐、中间对齐、底部对齐、两端对齐等,代码简单
/*CSS代码:*/
/*左对齐*/
.left {
text-align: left;
border: 1px dotted black;
width: 50%;
}
/*右对齐*/
.right {
text-align: right;
border: 1px dotted black;
width: 50%;
}
/*居中对齐*/
.center {
text-align: center;
border: 1px dotted black;
width: 50%;
}
/*两端对齐*/
.justify {
text-align: justify;
border: 1px dotted black;
width: 50%;
}
/*css3将一个div水平和垂直居中显示*/
.div1{
width: 100px;
height: 100px;
border: 4px solid red;
position: absolute;
text-align: center;
left:0;
right:0;
top: 0;
bottom: 0;
margin: auto;
/*50%为自身尺寸的一半*/
}
最后
以上就是发嗲枫叶最近收集整理的关于CSS各种对齐代码,左对齐、右对齐、中间对齐、底部对齐、两端对齐等,代码简单的全部内容,更多相关CSS各种对齐代码内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复