Home  >  Article  >  Web Front-end  >  text-align属性有没有继承性_html/css_WEB-ITnose

text-align属性有没有继承性_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:40:491778browse

text-align属性有没有继承性:

text-align属性可以将对象内的文本水平居中对齐,应该说不是什么难点,可能有时候会有这样的疑问词属性有没有继承性,如果有的话可以给父元素定义一个居中方式,下面子元素集成就可以了,能够节省些许代码。代码实例如下:

<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="author" content="http://www.51texiao.cn/" /><title>蚂蚁部落</title><style type="text/css">.grandfather{  width:440px;  height:350px;  background-color:green;  text-align:right;}.parent{  width:200px;  height:200px;  background-color:blue;}.children{  width:180px;  height:150px;  background-color:red;}</style></head><body> <div class="grandfather">  <div class="parent">    <div class="children">蚂蚁部落欢迎您</div>  </div> </div></body></html>

以上代码的表现可以看出text-align属性具有继承性。

原文地址是:http://www.51texiao.cn/div_cssjiaocheng/2015/0503/599.html

最原始地址是:http://www.softwhy.com/

Statement:
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