-2

What are the differences between dot and hash tag in CSS? Code

.img{
    background:red;
    margin-top:2px;
}
#img{
    background:yellow;
    margin-top:2px; 

1 Answers1

-1

The dot ( . ) signifies a class name while the hash ( # ) signifies an element with a specific id attribute

#img{} will style the single element declared with an attribute id="img"
.img{}
will style all elements with an attribute class="img"