900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > CSS 行内元素设置高度

CSS 行内元素设置高度

时间:2023-09-22 11:58:48

相关推荐

CSS 行内元素设置高度

设置line-height属性

行内元素设置高度,并且文本垂直水平居中

span {background: red;line-height: 100px;align-items: center;display: flex;justify-content: center;}

span {background: red;line-height: 100px;align-items: center;display: inline-flex; /*宽度是文本宽度*/justify-content: center;}

span {background: red;line-height: 100px;text-align: center;display: block;}

span {background: red;line-height: 100px;text-align: center;display: inline-block;/*宽度是文本宽度*/}

span {background: red;line-height: 100px;text-align: center;/*position: relative;*//*position: fixed;*/position: absolute; /*会改变display为block,宽度是文本宽度*/}

span {background: red;line-height: 100px;text-align: center;/*float: right;*/float: left; /*会改变display为block,宽度是文本宽度*/}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。