Both are valid, but used in different ways:
- .classname: Styles will be applied for every element with class- classname
- element.classname: Styles will be applied for every type of this element element with class- classname
Example:
.class {
  width: 100px;
  height: 100px;
  background-color: blue;
}
div.class {
  background-color: yellow;
}<div class="class"></div>
<section class="class"></section>
<p class="class"></p>1
solved Which is the correct method of declaration CSS class? and what is different from following methods?