What does it mean in css when a class comes right after an id (there is no space between them)? such as this:
#bgimage.header-image
Thanks
What does it mean in css when a class comes right after an id (there is no space between them)? such as this:
#bgimage.header-image
Thanks
It means that this formula will be used for the same element, such as
<div id="bgimage" class="header-image"></div>
If you'll make space between #bgimage and .header-image then it will be used to:
<div id="bgimage"><div class="header-image"></div></div>
It means an element with id and class at the same time. Eg:
<div id="bgimage" class="header-image"></div>
See the below example for difference between the selectors.
/* _class should be a child of _id */
#_id ._class{
background: #ccc;
width: 100px;
height: 100px;
}
/* It should have both id and class */
#_id._class{
background: #faa;
width: 100px;
height: 100px;
}
<div id="_id">
<div class="_class">
Box 1
</div>
</div>
<div class="_class" id="_id">
Box 2
</div>