HTML is a forgiving language
Your code will work even if you write incorrect code - but it has limits. Lets see.
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
Now one important fact that I want to mention to you, is that HTML is a very forgiving language. That means that if you break the syntax and if you write incorrect code let's say by avoiding the closing </p> tag and miss the closing </span> tag, this is how it should look.
<p id="first-para" class="info">
This is the text for the paragraph.
<br />
<br />
<hr />
<span id="whatever" class="something else">
this is some more text
</span>
<span>
sadjalsdkjsa
Sometimes it is going to totally break, but sometimes is going to simply work. Right here I am missing the two closing tags, but still it's working.
So that's what I want to mention to you, that HTML is a very forgiving language. That means that when the browser reads the code, it tries it's best to understand it. And even if it's broken, it's gonna try to make sense of it, and render something on the screen to the best of it's knowledge.
With that said, I'm gonna right-click, and inspect the <p> element. Basically you've learned that the inspect feature will open all the code in the elements tab in the Chrome Developer Tools, and you immediately see that this is not the code that we wrote.
We never wrote the <html> element, neither the <head> or the <body> elements, we just wrote the code that goes inside the <body>.
So where is the rest of the code coming from? And that is what goes on to say that HTML is a very forgiving language. The browser interprets our code and fills in the gaps to make the webpage appear on the screen. Now, this does not mean that it's okay to make mistakes. It only means that a lot of times you may have made a mistake and you will not see an error on the screen.
Proper format of an HTML document
Now you see that so far you wrote all of these HTML elements, and these are the elements that shows up on the page.
But, the proper way to write an HTML page, is to have this particular basic markup.
<!DOCTYPE html>
<html lang="en">
<head>
<title>
page title goes here
</title>
</head>
<body>
page content goes here
</body>
</html>
You write an <html> element, and inside it you have two elements: the <head>, and the <body> elements.
<body>
The <body> one, will have everything that is shown in this area:
This white area is the <body> of the HTML page.
<head>
in the <head> area, you write let's say the <title>. This is just one option, there are many others as well, but this is one of the thing that you write in the <head> section.
What is <head>? It is the section which is like the options for the web page.
Where it says "index.html", you want to mention the title for that page, so you're going to put it inside the <title> element, and everything that you want to show inside that particular page, will go inside the <body> area.
Explaining the code from the inspector
Now with that said, you can see over here that the browser is smart enough to think "hey, these are some <p>, <hr>, and <span>, it looks like they fit inside the <body> area". So it just puts it automatically inside the <body> element. Smart enough, right?
Even though HTML is a forgiving language, if you break the rules too much, your code will not work in the way that you expect. So always be careful writing code, indent your code pretty well so it is easier for you to read, so you can have the proper result that you are expecting.
With that said, in the next lesson, we are going to go over this basic markup, and you're going to know basically the things that you need to know about HTML to get started. In the rest of the tutorials we are going to be focusing on the different elements one by one, and after that, we are going to get into the CSS.So that's pretty much it for this lesson, I'll talk to you in the next.