This is what I have:
I have a div id="navbar"
and various styles for the ul
and li
elements there.
Now I want to know, if there is any selector in CSS where I can say "the following css-styles shall only be aplliedd to children of #navbar"
something like:
/* ***** NAVBAR ****** */
#navbar {
/* Add a gray right border to all list items, except the last item (last-child) */
li {
border-right: 1px solid #bbb;
}
li:last-child {
border-right: none;
}
.active {
background-color: #4CAF50;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
/* Change the link color to #111 (black) on hover */
li a:hover {
background-color: #111;
}
}
are there any ways to apply various css-styles only to elements that are chil or child-child or child-..-child of a certain HTML-element?
Note I'm also using jQuery so if thats only possible with jQuery, it will not be a problem.
sincerly basti