Hi,
I have a big disadvantage in understanding CSS and I want to learn how to use it in the best way.
Lets assume I have a simple page with header, content and footer sections like this
body
{
font-family: Arial, serif;
color: blue;
background: red;
.header
{
position: absolute;
left: 0;
right: 0:
top: 0;
height: 2rem;
padding: 10px 10px 10px 10px;
}
.content
{
position: absolute;
left: 0;
right: 0;
top: 2rem;
bottom: 2rem;
}
.footer
{
position: absolute;
left: 0;
right: 0;
bottom: 0;
height: 2rem;
}
<body>
<div class = "header"></div>
<div class = "content"></div>
<div class = "footer"></div>
</body>
Now I want to show another div in the content div which has the same structure.
<body>
<div class = "header"></div>
<div class = "content">
<div class = "new">
<div class = "header"></div>
<div class = "content"></div>
<div class = "footer"></div>
</div>
</div>
<div class = "footer"></div>
</body>
my understanding normally is that when I now define
body .content .new .header
{
.....
}
the header div in the new div should get this and only this style attributes. But in real world it is also getting the attributes from body .header
How can I change this to not have this attributes in my new .header but have the header inherit from body .content only but not from body .footer?