Carlos Carlos - 1 month ago 7
CSS Question

Text align inherit in css

I have a HTML structure which contains div and some CSS rules. I want to know that why

is inherit to its child div and why is only
is inherit

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>


.multi{ width:500px; text-align:center; float:left }



<div class="multi">
<div class="rr">Abc</div>



In CSS, some properties are naturally inherited, by default. text-align is one of these, along with font, color, and others. Here is a rather small (but mostly robust) list of properties which will be, and will not be, inherited by children.

What you'll have to do in this case is something like this:

.multi {
    width: 500px;
    text-align: center;
    float: left;
.multi .rr {
    text-align: left; /* Or whatever value multi's parent has */