CSS Selectors | Class and ID Selectors

CSS Class Selector:

Class selector using (.) dot notation can be used to select elements that have a class attribute containing a specific value or values.The name of the class value must immediately follow the dot (.)

*.design { color: gray } OR .design { color: gray }
 /* to set a color for all elements with "design" class */

p.design { color: gray }
 /* to set a color for "p" elements with "design" class */

<p class="design">Web Design</p>

p.design.develop { color: gray }
 /* to set a color for "p" elements with "design" 
and white separated with develop class */

<p class="design develop">Web Designing & Development</p>

CSS ID Selector:

ID selector using “hash notation” can be used to select elements that have an ID containing a specific value or values. The name of the ID value must immediately follow the octothorpe (#).  An ID typed attribute can be used to uniquely identify its element. There is no two such attributes can have the same value in a conforming document.

*#testing { color: red } OR #testing { color: red }
  /* to set a color for all elements with "testing" id */

p#testing { color: red }
  /* to set a color for "p" elements with "testing" id */

<p id="testing">Web Testing</p>