Home > Article > Web Front-end > Does the text-align attribute have inheritance_html/css_WEB-ITnose
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/