I understand that in css if you use the ">" then the tag has to be a direct child, however if you use just a space then it will be a sibling selector and as long as the tag is within the other tag the css will be applied. So why is it in the below code, the text in my sidebar is not centering unless I make the sidebar-header div a direct child of the sidebar div?
Relevant CSS:
.sidebar {
float:right;
width:24%;
margin-right:1%;
margin-top:20px;
background-color: #e5e5e5;
min-height:400px;
border-radius: 6px;
box-shadow: 4px 4px 10px #999
}
.content-padding {
float:left;
padding:10px;
}
.sidebar .sidebar-header {
text-align:center
}
Relevant HTML:
<div class="sidebar">
<div class="content-padding">
<div class="sidebar-header">Favorites</div>
</div>
</div>