HTML Introduction to HTML and CSS Make It Beautiful With CSS Select and Style Multiple Elements by Class

Shuhan Zhang
Shuhan Zhang
7,798 Points

What is h2 and h1? I didn't see them in the css page?

I didn't see the h2 and h1 and h3 in the css page?

Daniel D'Angelo
Daniel D'Angelo
552 Points

This refers to headings, which there of up to six, the h1 being the first and largest font. The font size decreases with each subsequent numbered heading.

<h1>first heading</h1> <p> </p> <h2>second heading</h2>

etc.

Priscilla Harris
Priscilla Harris
676 Points

The h1, h2, and h3 are defined on the css page by class. Example on your html you have <h2 class="card-title">. So on your css page it would be .card-title that styles the h2 element.

4 Answers

Hmmm, I don't really know the context in which you're referring to H1 and H2, but essentially they mean Header 1 and Header 2 and when you put the tag you're stating that you want a header with a specific size 1-6 Ex: <h4></h4> means Header of size 4

Rachel Lev
Rachel Lev
14,401 Points

The <h1> to <h6> tags are used to define HTML headings. <h1> defines the most important heading. <h6> defines the least important heading.

John Lack-Wilson
John Lack-Wilson
8,159 Points

H tags are headings, with <h1> is being the largest heading and <h6> being the smallest.

You can target them in the CSS by either adding a class: i.e. <h1 class="myClass">Heading</h1>. Alternatively you can use the following in your stylesheet file: h1 { color: red; }, which will target all h1 tags.

DEEPIKA MARAM
DEEPIKA MARAM
4,491 Points

Yes,

h1 { color: red; } this is how you are styling or adding effects to a simple text which we wrote in HTML like this <h1 class="myClass">Heading</h1>.

There are two ways here that you can refer to this <h1 class="myClass">Heading</h1> tag in CSS and behaves differently:

  1. By Tag Name: h1 { color: red; } - This one applies to all the h1 tags in your HTML document i.e., For all the h1 tags in your HTML change the text to color red.
  2. By Class name: myClass { color: red; } - his one applies to all the tags in your HTML document that hold myClass as their class name i.e., For all the tags in your HTML where the class name is myClass, now change the text to color red.