HTML And CSS Tutorial 28: Style More Than One Elements And Span


Welcome to your website development training center.

Today am gonna teach you how to apply styles to more than one elements at a time because we have to take each element and apply one style at a time and it takes a lot of time.

Am gonna teach you how to save some time.

Open your contact.html file. We already have header h1, header h2 and paragraph p tags at the top of our webpage, right?

So, what we wanna do is to apply style to more than one elements. Assuming we'd like to give header h1 and paragraph p tags the same style, all we need to do is to select h1 and add comma , and then type p and the curly bracelets {property: value } in our CSS stylesheet

Like this 👇

h1, p {color: red;
}

The whole thing will be in this format 👇


If you preview this👆🏽 you will see that the "247" we wrapped with <span></span> will change to blue and will also be bold.

I hope we all garrit? Pls try to garrit but if you still don't garrit.. Drop your questions in the comment box below, I will reply as soon as possible.

Thanks for learning.

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

Search