krtong / prj-rev-bwfs-dasmoto

0 stars 0 forks source link

Using Class & ID selectors #3

Open zannain opened 6 years ago

zannain commented 6 years ago

I recommend against using to many element selectors to apply your CSS styles. Element selectors are some of the more broad CSS selectors available and a better alternative is to use a class or id. Since you only select <h2> once in your style sheets, rather using an h2 selector and id would be more appropriate because it is more concise and you can give it a name that accurately reflects what is being styled.

/* Not recommended */
.item h2 {
  color: white;
  font-size: 32px;
}

/* Recommended */
#item {
  color: white;
  font-size: 32px;
}
krtong commented 6 years ago

ok thx.