Home  >  Article  >  Web Front-end  >  Does the text-align attribute have inheritance_html/css_WEB-ITnose

Does the text-align attribute have inheritance_html/css_WEB-ITnose

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

Is the text-align attribute inherited? There may sometimes be questions about whether the word attributes are inherited. If so, you can define a centering method for the parent element, and then integrate the child elements below, which can save some code. The code example is as follows:

It can be seen from the performance of the above code that the text-align attribute is inherited.

<!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>

The original address is: http://www.51texiao.cn/div_cssjiaocheng/2015/0503/599.html

The original address is: 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