Note for HTML
Note for HTML
Note for HTML
Language)
Tip: You can use either .htm or .html as file extension. There is
no difference, it is up to you.
Step 4: View the HTML Page in Your Browser
Open the saved HTML file in your favorite browser (double click
on the file, or right-click - and choose "Open with").
The result will look much like this:
Title
Heading
Body
Basics Tags
Codes enclosed in brackets
Usually paired
<TITLE>My Web Page</TITLE>
Not case sensitive
<TITLE> = <title> = <TITLE>
Basic tags
<html>
<heading>
<title></title>
</heading>
<body> </body> </html>
Continued…
Paragraph tag syntax <p> </p>
New line tag <br> to cut the line
Centering Content tag <center></center>
Horizontal Lines <hr>
HTML –Elements
Html Tags <> </>
Elements
<html></html>
<heading></heading>
<title></title>
<body> </body>
HTML Headings
HTML headings are defined with the <h1> to <h6> tags.
<h1> defines the most important heading. <h6> defines
the least important heading:
Example
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
HTML Paragraphs
HTML paragraphs are defined with the <p> tag
Example
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
HTML Links
HTML links are defined with the <a> tag:
Example
<a href="https://www.w3schools.com">This is a link</a>
The link's destination is specified in the href attribute.
Attributes are used to provide additional information about HTML
elements.
HTML Images
HTML images are defined with the <img> tag.
The source file (src), alternative text (alt), width, and height are provided
as attributes:
img src="w3schools.jpg" alt="W3Schools.com" width="104" height="14
2">:
HTML Elements
The HTML element is everything from the start tag
to the end tag:
<tagname>Content goes here...</tagname>
Examples of some HTML elements:
<h1>My First Heading</h1>
<p>My first paragraph.</p>
Start tag Element content End tag
</body>
</html>
Try it Your
HTML Attributes
HTML attributes provide additional information about HTML
elements.
All HTML elements can have attributes
Attributes provide additional information about elements
Attributes are always specified in the start tag
Attributes usually come in name/value pairs like: name="value“
The href Attribute
The <a> tag defines a hyperlink. The href attribute specifies the URL of
the page the link goes to:
Example
<a href="https://www.w3schools.com">Visit
W3Schools</a>
The src Attribute
The <img> tag is used to embed an image in an HTML page.
The src attribute specifies the path to the image to be displayed:
Example
<img src="img_girl.jpg">
The width and height Attributes
The <img> tag should also contain the width and height attributes, which specifies the width and
height of the image (in pixels):
Example
<img src="img_girl.jpg" width="500" height="600">
The alt Attribute
The required alt attribute for the <img> tag specifies an alternate text for an
image, if the image for some reason cannot be displayed. This can be due to
slow connection, or an error in the src attribute, or if the user uses a screen
reader.
Example
<img src="img_girl.jpg" alt="Girl with a jacket">
Example Example
Heading 1 h1>Heading 1</h1> <
HTML Styles
The HTML style attribute is used to add styles to an element, such as color, font, size, and
more.
Example
I am Red
I am Blue
I am Big
The HTML Style Attribute
Setting the style of an HTML element, can be done with
the style attribute.
The HTML style attribute has the following syntax:
<tagname style="property:value;">
Background Color
The CSS background-color property defines the background color for an
HTML element.
Example
Set the background color for a page to powderblue:
<body style="background-color:powderblue;">
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
Fonts
The CSS color property defines the text color for an HTML element:
Example
<h1 style="color:blue;">This is a heading</h1>
<p style="color:red;">This is a paragraph.</p>
Text Size
The CSS font-size property defines the text size for an HTML element:
Example
<h1 style="font-size:300%;">This is a heading</h1>
<p style="font-size:160%;">This is a paragraph.</p>
Text Alignment
The CSS text-align property defines the horizontal text alignment for an
HTML element:
Example
<h1 style="text-align:center;">Centered Heading</h1>
<p style="text-align:center;">Centered paragraph.</p>
HTML Text Formatting
HTML contains several elements for defining text with a special meaning.
Example
This text is bold
This text is italic
This is subscript and superscript
HTML Formatting Elements
Formatting elements were designed to display special types of text:
•<b> - Bold text
•<small> - Smaller text
•<strong> - Important text
•<ins> - Inserted text
•<i> - Italic text
•<sub> - Subscript text
•<em> - Emphasized text
•<sup> - Superscript text
•<mark> - Marked text
The HTML <b> element defines bold text, without any extra importance.
Example
<b>This text is bold</b>