HTML Basics
- Get link
- X
- Other Apps
Heading, Lines and Comments
HTML Headings
HTML includes six levels of headings, which are ranked according to importance.
These are <h1>, <h2>, <h3>, <h4>, <h5>, and <h6>.
The following code defines all of the headings:
<head>
<title>first page</title>
</head>
<body>
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>
</body>
</html>
Result:
HTML Headings
What tags are used to indicate headings?
Horizontal Lines
To create a horizontal line, use the <hr> tag.
<head>
<title>first page</title>
</head>
<body>
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>
<p>This is a paragraph </p>
<hr>
<p>This is a paragraph </p>
</body>
</html>
Result:
Horizontal Lines
How do you create a horizontal line in HTML?
Comments
The browser does not display comments, but they help document the HTML and add descriptions, reminders, and other notes.
Example:
<head>
<title>first page</title>
</head>
<body>
<p>This is a paragraph </p>
<hr />
<p>This is a paragraph </p>
<!-- This is a comment -->
</body>
</html>
Result:As you can see, the comment is not displayed in the browser.

Chapter:7
Paragraphs
The <p> Element
To create a paragraph, simply type in the <p> element with its opening and closing tags:
<head>
<title>first page</title>
</head>
<body>
<p>This is a paragraph. </p>
<p>This is another paragraph. </p>
</body>
</html>
The result:
The <p> Element
Drag and drop from the options below to create paragraphs:
HTML is easy!</p>
<p>HTML is fun!
Single Line Break
Use the <br /> tag to add a single line of text without starting a new paragraph:
<head>
<title>first page</title>
</head>
<body>
<p>This is a paragraph.</p>
<p>This is another paragraph. </p>
<p>This is <br /> a line break </p>
</body>
</html>
Single Line Break
What tag is used to create a line-break without an extra space between the text blocks?
Single Line Break
Fill in the blanks:
Chapter:8
Text Formatting
Formatting Elements
In HTML, there is a list of elements that specify text style.
Formatting elements were designed to display special types of text:
<head>
<title>first page</title>
</head>
<body>
<p>This is regular text </p>
<p><b> bold text </b></p>
<p><big> big text </big></p>
<p><i> italic text </i></p>
<p><small> small text </small></p>
<p><strong> strong text </strong></p>
<p><sub> subscripted text </sub></p>
<p><sup> superscripted text </sup></p>
<p><ins> inserted text </ins></p>
<p><del> deleted text </del></p>
</body>
</html>
Formatting Elements
Which two tags below make the text visually bold?
Formatting Elements
Each paragraph in the example is formatted differently to demonstrate what each tag does:

However, the meanings of these tags differ: <b> and <i> define bold and italic text, respectively, while <strong> and <em> indicate that the text is "important".
Formatting Elements
Fill in the correct tags:
Chapter:9
Blog Project: About me
Formatting Text
Let's get back to our blog project.
The About Me section will contain a heading that's wrapped in a <h1> tag, along with two paragraphs that format text using the tags you've just learned.
Let's take a look at the code:
<p>
Hey! I'm <strong>Alex</strong>. Coding has changed my world ...
</p>
<p class="quote">"Declare variables, not war"</p>
You may have noticed that we've also used some CSS to add colors and styles to the page. When you complete HTML, we strongly recommend our free CSS Tutorial!

1. Create your own About Me section by changing the text.
2. Play around with the code; experiment with formatting text.
Formatting Text
Fill in the blanks to form a valid HTML:
Chapter:10
Elements
HTML Elements
HTML documents are made up of HTML elements.
An HTML element is written using a start tag and an end tag, and with the content in between.
HTML documents consist of nested HTML elements. In the example below, the body element includes the <p> tags, the <br /> tag and the content, "This is a paragraph".
<head>
<title>first page</title>
</head>
<body>
<p>This is a paragraph <br /></p>
</body>
</html>
HTML Elements
General HTML elements consist of:
HTML Elements
Some elements are quite small. Since you can't put contents within a break tag, and you don't have an opening and closing break tag, it’s a separate, single element.
So HTML is really scripting with elements within elements.
<head>
<title>first page</title>
</head>
<body>
<p>This is a paragraph</p>
<p>This is a <br /> line break</p>
</body>
</html>
HTML Elements
Fill in the blanks:
Chapter:11
Attributes
HTML Attributes
Attributes provide additional information about an element or a tag, while also modifying them. Most attributes have a value; the value modifies the attribute.
This text is aligned to center
</p>
In this example, the value of "center" indicates that the content within the p element should be aligned to the center:
HTML Attributes
What is the role of an attribute in HTML?
Attribute Measurements
As an example, we can modify the horizontal line so it has a width of 50 pixels.
This can be done by using the width attribute:
An element's width can also be defined using percentages:
Attribute Measurements
What measurement units can be used for the width attribute?
The Align Attribute
The align attribute is used to specify how the text is aligned.
In the example below, we have a paragraph that is aligned to the center, and a line that is aligned to the right.
<head>
<title>Attributes</title>
</head>
<body>
<p align="center">This is a text <br />
<hr width="10%" align="right" /> This is also a text.
</p>
</body>
</html>
The Align Attribute
What attribute is used to align the contents of an element to the right, center or left?
Attributes
You may be wondering what happens if you try to apply contradictory attributes within the same element.
This is a text.
<hr width="50%" align="left" />
</p>
Attributes
Which attribute is used to align the content of a paragraph to the right?
Chapter:12
Images
Image Location
You need to put in the image location for the src attribute that is between the quotation marks.
For example, if you have a photo named "tree.jpg" in the same folder as the HTML file, your code should look like this:
<head>
<title>first page</title>
</head>
<body>
<img src="tree.jpg" alt="" />
</body>
</html>
Image Resizing
To define the image size, use the width and height attributes.
The value can be specified in pixels or as a percentage:
<head>
<title>first page</title>
</head>
<body>
<img src="tree.jpg" height="150px" width="150px" alt="" />
<!-- or -->
<img src="tree.jpg" height="50%" width="50%" alt="" />
</body>
</html>
Image Border
By default, an image has no borders. Use the border attribute within the image tag to create a border around the image.

Image Border
Fill in the blank:
Chapter:13
Lists
HTML Ordered Lists
An ordered list starts with the <ol> tag, and each list item is defined by the <li> tag.
Here is an example of an ordered list:
<head>
<title>first page</title>
</head>
<body>
<ol>
<li>Red</li>
<li>Blue</li>
<li>Green</li>
</ol>
</body>
</html>
Result:
HTML Ordered Lists
Enter the tag corresponding to the list item:
HTML Unordered List
An unordered list starts with the <ul> tag.
<head>
<title>first page</title>
</head>
<body>
<ul>
<li>Red</li>
<li>Blue</li>
<li>Green</li>
</ul>
</body>
</html>
Result:

HTML Unordered List
Fill in the blanks:
Chapter:14
Blog Project: My Skills
My Skills
Back to our blog! Let's create the My Skills section, which is an unordered list of languages you know.
Reminder: Use the <ul> tag, in which each item is represented by the <li> tag, to create an unordered list.
Take a look at the code:
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
We'll learn how to add progress bars to each of the skills in the following module.
1. Create your own My Skills section.
2. Use the <a> tag to make each list item a link.
Chapter:15
Tables
Creating a Table
Tables are defined by using the <table> tag.
Tables are divided into table rows with the <tr> tag.
Table rows are divided into table columns (table data) with the <td> tag.
Here is an example of a table with one row and three columns
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
They can contain all sorts of HTML elements, such as text, images, lists, other tables, and so on.
Creating a Table
What tag is used to create columns in a row?
The border and colspan Attributes
A border can be added using the border attribute:
A table cell can span two or more columns:
<tr>
<td>Red</td>
<td>Blue</td>
<td>Green</td>
</tr>
<tr>
<td><br /></td>
<td colspan="2"><br /></td>
</tr>
</table>
Result:
The border and colspan Attributes
What attribute is used to expand a cell for two or more cells?
Colspan Color
The example below demonstrates the colspan attribute in action:
<tr>
<td>Red</td>
<td>Blue</td>
<td>Green</td>
</tr>
<tr>
<td>Yellow</td>
<td colspan="2">Orange</td>
</tr>
</table>
Result:You can see that the cell containing "Orange" spans two cells.
Colspan Color
Fill in the blanks:
The align and bgcolor Attributes
To change your table's position, use the align attribute inside your table tag:
Now let's specify a background color of red for a table cell. To do that, just use the bgcolor attribute.
<tr>
<td bgcolor="red">Red</td>
<td>Blue</td>
<td>Green</td>
</tr>
<tr>
<td>Yellow</td>
<td colspan="2">Orange</td>
</tr>
</table>
Result:

The align and bgcolor Attributes
What attribute is used to change the color of a cell?
Chapter:16
Links
The <a> Tag
Links are also an integral part of every web page. You can add links to text or images that will enable the user to click on them in order to be directed to another file or webpage.
In HTML, links are defined using the <a> tag.
Use the href attribute to define the link's destination address:
The <a> Tag
What tag is used to create a link to a web page?
Creating Your First Link
In the example below, a link to SoloLearn's website is defined:
Once the code has been saved, "Learn Playing" will display as a link:
Learn Playing
Clicking on "Learn Playing" redirects you to www.sololearn.com
Creating Your First Link
Which attribute of the link tag contains the URL location that you are trying to link to?
The target Attribute
The target attribute specifies where to open the linked document.
Giving a _blank value to your attribute will have the link open in a new window or new tab:
Learn Playing
</a>

Chapter:17
Blog Project: My Schedule
My Schedule
Use table tags to add a table to your blog that represents your daily learning schedule.
The <th> tags represent the table headers.
Take a look at the following code:
<table>
<tr>
<th>Day</th>
<th>Mon</th>
<th>Tue</th>
<th>Wed</th>
<th>Thu</th>
<th>Fri</th>
</tr>
<tr>
<td>8-8:30</td>
<td class="selected">Learn</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>9-10</td>
<td></td>
<td class="selected">Practice</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>1-1:30</td>
<td></td>
<td></td>
<td class="selected">Play</td>
<td></td>
<td></td>
</tr>
<tr>
<td>3:45-5</td>
<td></td>
<td></td>
<td></td>
<td class="selected">Code</td>
<td></td>
</tr>
<tr>
<td>6-6:15</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="selected">Discuss</td>
</tr>
</table>
The empty <td> tags represent empty table cells. They're necessary because they maintain the table's structure.
My Schedule
Fill in the blanks to create a valid table:
Chapter:18
Inline and Block Elements
Types of Elements
In HTML, most elements are defined as block level or inline elements.
Block level elements start from a new line.
For example: <h1>, <form>, <li>, <ol>, <ul>, <p>, <pre>, <table>, <div>, etc.
Inline elements are normally displayed without line breaks.
For example: <b>, <a>, <strong>, <img>, <input>, <em>, <span>, etc.
The <div> element is a block-level element that is often used as a container for other HTML elements.
When used together with some CSS styling, the <div> element can be used to style blocks of content:
<body>
<h1>Headline</h1>
<div style="background-color:green; color:white; padding:20px;">
<p>Some paragraph text goes here.</p>
<p>Another paragraph goes here.</p>
</div>
</body>
</html>
Similarly, the <span> element is an inline element that is often used as a container for some text.
When used together with CSS, the <span> element can be used to style parts of the text:
<body>
<h2>Some
<span style="color:red">Important</span>
Message</h2>
</body>
</html>
The <div> element defines a block-level section in a document.
The <span> element defines an inline section in a document.
Types of Elements
Other elements can be used either as block level elements or inline elements. This includes the following elements:
APPLET - embedded Java applet
IFRAME - Inline frame
INS - inserted text
MAP - image map
OBJECT - embedded object
SCRIPT - script within an HTML document
You can insert inline elements inside block elements. For example, you can have multiple <span> elements inside a <div> element.
Types of Elements
Can you insert a block element inside an inline element?
Chapter:19
Forms
The <form> Element
HTML forms are used to collect information from the user.
Forms are defined using the <form> element, with its opening and closing tags:
<form></form>
</body>
Use the action attribute to point to a webpage that will load after the user submits the form.
</form>
The <form> Element
Which attribute contains the URL address of the webpage that is loaded after a form submission?
The method and name Attributes
The method attribute specifies the HTTP method (GET or POST) to be used when forms are submitted (see below for description):
Use POST if the form is updating data, or includes sensitive information (passwords).
POST offers better security because the submitted data is not visible in the page address.
To take in user input, you need the corresponding form elements, such as text fields. The <input> element has many variations, depending on the type attribute. It can be a text, password, radio, URL, submit, etc.
The example below shows a form requesting a username and password:
<input type="text" name="username" /><br />
<input type="password" name="password" />
</form>
Result:
The method and name Attributes
Which value for the type attribute should be used for a password field?
Form Elements
If we change the input type to radio, it allows the user select only one of a number of choices:
<input type="radio" name="gender" value="female" /> Female <br />
Result:The type "checkbox" allows the user to select more than one option:
<input type="checkbox" name="gender" value="2" /> Female <br />
Result:
Form Elements
Fill in the blanks:
Form Elements
The submit button submits a form to its action attribute:
Result:

Form Elements
Which value for the type attribute turns the input tag into a submit button?
Chapter:20
Blog Project: Contact Form
Contact Form
Next, we'll create a Contact Form for your blog. The form will include Name, Email, and Message fields. We'll also add a Submit button.
Check out the code:
<form>
<input name="name" type="text" /><br/>
<input name="email" type="email" /><br/>
<textarea name="message"></textarea>
<input type="submit" value="SEND" class="submit" />
</form>
This is just a static HTML page, so it won't work to actually submit the form. You'd need to create the server-side code in order to submit a real form and process the data. To learn how, complete SoloLearn's PHP course once you've completed the HTML and CSS courses.

Contact Form
To support multiple lines of input you should use the following element:
Chapter:21
HTML Colours
HTML Colors!
HTML colors are expressed as hexadecimal values.
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
What characters does the hexadecimal system consist of?
HTML Color Model
Colors are displayed in combinations of red, green, and blue light (RGB).
Hex values are written using the hashtag symbol (#), followed by either three or six hex characters.
As shown in the picture below, the circles overlap, forming new colors:
Color Values
All of the possible red, green, and blue combinations potentially number over 16 million.
Here are only a few of them:We can mix the colors to form additional colors.
Orange and red mix:
Color Values
What would be the value of the color black in HTML, expressed by 6 hex characters?
Background and Font Colors
The bgcolor attribute can be used to change the web page's background color.
This example would produce a dark blue background with a white headline:
<head>
<title>first page</title>
</head>
<body bgcolor="#000099">
<h1>
<font color="#FFFFFF"> White headline </font>
</h1>
</body>
</html>
Result:
Background and Font Colors
Set the background color to white:
Chapter:22
Frames
The <frame> Tag
A page can be divided into frames using a special frame document.
The <frame> tag defines one specific window (frame) within a <frameset>. Each <frame> in a <frameset> can have different attributes, such as border, scrolling, the ability to resize, etc.
The <frameset> element specifies the number of columns or rows in the frameset, as well as what percentage or number of pixels of space each of them occupies.
<frameset rows="100, 25%, *"></frameset>
The <frame> Tag
What attributes does the frameset tag require to indicate its size?
Working with Frames
Use the <noresize> attribute to specify that a user cannot resize a <frame> element:
Frame content should be defined using the src attribute.
Lastly, the <noframes> element provides a way for browsers that do not support frames to view the page. The element can contain an alternative page, complete with a body tag and any other elements.
<frame src="a.htm" />
<frame src="b.htm" />
<frame src="c.htm" />
<noframes>Frames not supported!</noframes>
</frameset>
Working with Frames
Which attribute prevents a frame from resizing?
Chapter:23
Blog Project: Putting it all Together
Blog Project
To finalize our blog, we'll use a frame to embed a YouTube video. We'll also create a Follow Me section that includes links at the end of the page.
Check out the final code:
<div class="section">
<h1><span>My Media</span></h1>
<iframe height="150" width="300" src="https://www.youtube.com/embed/Q6_5InVJZ88" allowfullscreen frameborder="0"></iframe>
</div>
...
1. Finalize your blog page.
2. Share your code creation with the community, get feedback, and receive upvotes!
Blog Project
The sections in the blog project are created using the following tag:
Chapter:24
Model 2 Quiz
When formatting text, can you get the same result when using different tags?
What does the href attribute contain?
Which tag contains the cell tags besides the table tag?
What does HTML stand for?
Choose the correct HTML tag for the largest heading:
Which of these tags are all table tags?
Fill in the blanks:
- Get link
- X
- Other Apps
Comments
Post a Comment