html文本垂直居中对齐_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:22:01
Original
1792 people have browsed it

html文本垂直居中对齐,代码如下:


    
      行1

      行2

      行3
   

    另一个span

实现原理:

1、首先设置div元素的高与行高为一样的值,这样在块内的行内元素就会垂直居中

2、设置span元素的显示,修改display为line-block,使其成为行内块元素

3、设置span的vertical-align为middle,以垂直居中,设置行高为1.2em,以改变继承的行高

 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template