好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

关于多行文字水平垂直居中的一点研究_html/css_WEB-ITnose

前些天在W3CPlus看到了一篇文章,提到用CSS制作水平垂直居中,在测试其中的第六点时发现了一些小问题:

添加了一个无意义的新标签

当设定内容宽度的时候,文本换行了

对于第一点,解决的办法是使用 :before 伪元素 :

 1   2   3   4   5  水平垂直居中  6   7 .wrapper { 8     width: 200px; 9     height: 200px;10     background: skyblue;11 }12 .wrapper:before {13     content: '.';14     display: inline-block;15     vertical-align: middle;16     height: 100%;17 }18 .content {19     display: inline-block;20     text-align: center;21 }22  23  24 25  26 

27

多行文字居中 多行文字居中 多行文字居中

查看更多关于关于多行文字水平垂直居中的一点研究_html/css_WEB-ITnose的详细内容...

  阅读:38次