michaelpfnewton / prj-rev-bwfs-dasmoto

0 stars 0 forks source link

Abstract common styles to classes #2

Open zannain opened 6 years ago

zannain commented 6 years ago

One trick you can use when you find yourself repeating certain styles in multiple CSS selectors is creating a class for it and call the class instead. For example you use font-weight:bold several times. You can instead create a class called bold and now you can apply this class to any element in your HTML markup without having to go back to your CSS stylesheet and adding that style. This is what developers say by dont-repeat-yourself and its in fact how popular CSS frameworks like Bootstrap are built. They create classes with certain styles and all you as a developer has to do is call those styles in your HTML.

.bold {
   font-weight:bold;
}