I created a child theme and installed it but I don't know how exactly it works!
For example, in the parent theme I have the code below:
.header {
margin-top: 10px;
margin-bottom: 10px;
width: 300px;
height: 150px;
background: white;
border-width: 5px;
}
And I want to not include the width: 300px; , the background and the border-width (because i don't want background and border) and change the "margin-top: 10px;" to "margin-top: 15px;" in the child theme.
So normally in the child theme I would have:
.header {
margin-top: 15px;
margin-bottom: 10px;
height: 150px;
}
The subject is that if I do that WordPress will automatically check first the style.css
of the child theme and then the style.css
of the parent theme. So it will execute the missing code (width: 300px; , the background and the border-width).
What should I do? I am a bit confused. Do I have to delete each line I don't want from the parent theme? But if I do that after an update it will add it again.
style.css
file, add@import( '../parent-theme/style.css' )
, and then progressively override any desired styles. Thus, this question ultimately becomes one of the CSS cascade, and overriding one style declaration with another.