The <h1>...<h6>, <i> and <strong> elements
These elements help us format our text in our webpage
Course content
71 lessons- 1Tools you need for the HTML/CSS course1:59
- 2Overview of the VS Code Text Editor4:57
- 3Code your first webpage3:59
- 4What is HTML Really?3:16
- 5What does HTML look like?2:46
- 6HTML Elements7:20
- 7HTML Elements - Continued3:36
- 8Common HTML Elements (Cheatsheet included)3:26
- 9HTML is a forgiving language3:47
- 10Basic Markup of HTML5:18
- 11The <h1>...<h6>, <i> and <strong> elements5:18
- 12Learn to link webpages via the anchor <a> element4:04
- 13Relative vs Absolute Paths - linking continued5:50
- 14<div> and <span> elements6:36
- 15Making lists in HTML via <ul>, <ol> and <li> elements5:36
- 16Making nested lists + Homework4:31
- 17Adding special characters in your webpage5:50
- 18Emmet shortcuts and code comments3:37
- 19<meta> elements and what they are about3:19
- 20<meta> description and keyword elements for SEO3:33
- 21<blockquote> and <pre> elements for special text formatting5:43
- 22Adding images with the <img> element5:11
- 23Using <video> and <audio> elements5:56
- 24Semantic Elements + Homework4:26
- 25Intro to CSS - Making the webpages beautiful4:22
- 26Intro to CSS continued4:10
- 27<style> element & using CSS selectors5:38
- 28Organize your CSS is its own file4:55
- 29CSS id selector (# hash sign)4:20
- 30CSS class selector (. dot sign)3:52
- 31Select all elements with asterisk (*) selector0:58
- 32Using multiple selectors together (using comma and more)4:40
- 33CSS Combinators selectors (~ + > etc.)7:50
- 34Pseudo Selectors (:visited: :hover :active :focus)6:04
- 35Chrome Developer Tools - Intro6:43
- 36Colors in CSS3:19
- 37Apply multiple CSS classes + write notes with code comments2:59
- 38Fonts: Change & add custom fonts6:20
- 39Background CSS Property. Change color, images and more7:39
- 40Common CSS Units - (px, em, rem, %)7:01
- 41Common CSS Units - (rem)2:39
- 42CSS Margin and Padding9:49
- 43CSS border property4:00
- 44CSS border style2:05
- 45Size elements with 'width' and 'height' property3:21
- 46Use 'box-sizing' for more control on element sizing3:43
- 47'border-radius' Curve borders and make custom shapes.7:58
- 48<div> vs <span> the real difference4:36
- 49Using 'display' property of CSS & 'inline-block'3:19
- 50'float' & 'clear' property - Moving elements around.4:38
- 51Hide content with `overflow`, `visibility` and `display` property3:36
- 52Clearfix: Hack to fix webpage spacing issue3:51
- 53Project: Blog Design - Create beautiful looking website5:20
- 54Project: Blog Design (Part 2/7) - Layout the HTML9:09
- 55Project: Blog Design (Part 3/7) - Styling the header4:01
- 56Project: Blog Design (Part 4/7) - Styling main and footer area4:02
- 57Project: Blog Design (Part 5/7) - Styling sidebar3:10
- 58Project: Blog Design (Part 6/7) - Styling articles2:17
- 59Project: Blog Design (Part 7/7) - Additional Pages5:13
- 60'position' - Control element position within your page8:10
- 61Project: Coupon (using `absolute` & `relative` position)5:21
- 62CSS Flexbox & CSS Grid - More layout methods3:02
- 63CSS Priority Order6:04
- 64Additional Resources - Codepen + HTML Cheatsheet5:18
- 65<table> Making tables in HTML5:32
- 66<table> Making tables in HTML continued2:41
- 67<iframe> Embedding other webpages in your webpage4:16
- 68Creating forms and understanding how they work11:17
- 69Creating form - continued6:41
- 70Using external CSS libraries in your projects6:42
- 71Conclusion and next steps3:28
HTML Cheatsheet
- Download HTML Cheatsheet (PDF)
- Star HTML Cheatsheet on Github
- Share HTML/CSS Cheatsheet Link: https://ilovecoding.org/blog/htmlcss-cheatsheet
CSS Cheatsheet
- Download CSS Cheatsheet (PDF)
- Star CSS Cheatsheet on Github
- Share HTML/CSS Cheatsheet Link: https://ilovecoding.org/blog/htmlcss-cheatsheet
Video Lesson Transcript
So far we were just understanding the basics. Now things are going to get easier, because now we only need to look at the different elements that we have. We will be covering 4 elements in this lesson, and then we will be looking at the rest.
From <h1> to <h6>
One of the very important elements in HTML is the <h1> all the way to <h6> elements. h1 stands for header one, so it's the main header for a page. For example if you are reading a book, the main title for that particular chapter, consider that to be <h1>, and a sub header could be an <h2>, and so on uptill <h6>. Say that I am writing an "about me" page:
<!DOCTYPE html>
<html lang="en">
<head>
<title>
This is my first page
</title>
</head>
<body>
<h1>
Hi my name is Aziz
</h1>
<p>
Hi this is my first para
</p>
<p>
this is the second para
</p>
</body>
</html>
And as result:
By doing that, you can see automatically that just because I mentioned <h1>, it is a very big text.
Now if I want to write a sub-header, that's going to be <h2>. So we can simply put it under the <h1>.
<!DOCTYPE html>
<html lang="en">
<head>
<title>
This is my first page
</title>
</head>
<body>
<h1>
Hi my name is Aziz
</h1>
<h2>
This is my bio page
</h2>
<p>
Hi this is my first para
</p>
<p>
this is the second para
</p>
</body>
</html>
And you can see that the <h2> text is slightly smaller, and I can do the same thing all the way from <h1> to <h6> which are valid tags in HTML.
I am gonna simply replicate this code, so for this you can do alt + shift + β for duplicating the lines, so I can simply rename them.
There is another handy shortcut in Visual Studio Code. I can simply select some text and do command + D (Ctrl + D on Windows), and it's going to select both tag names for example. Let me show you what I mean:
This way I can simply edit both of them together, like such:
Pretty handy, right? And that's the beauty of a good text editor. Others are good as well: Sublime Text introduced, I believe, this particular shortcut, and Visual Studio Code has copied that.
If you save and refresh, you will see all our headings from <h1> to <h6>. These are different tags, with different automatic formatting of the text and it's sizes.
That's very handy when you are writing multiple content, you can format them differently.
The <strong> and <i> elements
Next, let's see if you want to make your text italic or bold, you are going to use the <i> or the <strong> element.
Let's say that you have the following two paragraphs in your code:
<!DOCTYPE html>
<html lang="en">
<head>
<title>
This is my first page
</title>
</head>
<body>
<h1>
Hi my name is Aziz <
/h1>
<h2>
This is my bio page
</h2>
<p>
Hi this is my first para
</p>
<p>
this is the <em>second</em> para
</p>
</body>
</html>
For this, we want to make the word "second" from the second paragraph italic.
So for this we simply put the word second inside the <i> element.
Save, refresh, and you will see that this is italic now.
If we want to make the word "first" from the first paragraph bold, we can simply wrap the <strong> element around it.
<p> Hi this is my <strong>first</strong> para </p> <p> this is the <i>second</i> para </p>
Save, refresh, and you will see that the word "first" is now bold.
Now if you want to make the word "this" italic and bold, you can use both of these elements.
<p> Hi <strong><i>this</i></strong> is my <strong>first</strong> para </p> <p> this is the <i>second</i> para </p>
You can see that this is bold, and also italic. So notice the way I am doing this; the <strong> is the outer element, and inside there is a nested <i> element, and inside it we have the child for the <i>, which is the word "this".
This particular format that I am doing is very important. HTML is very hierarchical, so it's nested.
Of course one element can have multiple children, for example if I have some text like this:
<p> Hi <strong><i>this</i> something else </strong> is my <strong>first</strong> para </p> <p> this is the <i>second</i> para </p>
you will notice that the "something else" is bold, but only the "this" is italic and bold.
It may be very difficult for you to read right now what code I wrote, that's why formatting the code comes in very handy, so I am just going to format this with the indent format.
<p>
Hi
<strong>
<i>this</i>
something else
</strong> is my <strong>first</strong> para
</p>
<p>
this is the <i>second</i> para
</p>
You see, now it's more obvious, so that's how you do it.
In the next lesson we are going to learn more about the <a>, <div>, and <span>elements. Now you already know about <h1> to <h6>, <p>, <i>, and <strong>.
I will talk to you in the next lesson.