Difference between .h1 and #h1 selector

what is the Difference between .h1 and #h1 selector., can we use both.,

Yes you can use both the ‘class selector’ the one with period (.), e.g. .hello so it can occur many times in a HTML page; <p class=“hello”> or <h1 class=“hello”>

The CSS ‘ID selector’ contains a ‘#’ immediately followed by the ID value, which must be an identifier, e.g. #hello although ID name values within (x)html must be unique and only occur once; <p id=“hello”> so you couldn’t have multiple ID called “hello” unlike with the class selectors.

However, the example you have shown in post #1 isn’t a very good choice for a class or ID name for it to match. I think you might be getting confused with a H1 rather than class and id names.