HTML
HTML
HTML
HTML
</head>
<body>
</body>
</html>
HTML ELEMENTS
An HTML element is defined by a start tag, some content, and an
end tag:
EXAMPLE:
The HTML element is everything from the start tag to the end tag:
EXAMPLE:
<p>This is a <br> paragraph with a line break.</p>
<hr> for horizontal line
HTML TAGS
HTML tags are like keywords which defines that how web
browser will format and display the content.
All HTML tags must enclosed within < > these brackets.
Every tag in HTML perform different tasks.
If you have used an open tag <tag>, then you must use a
close tag </tag>.
HTML TAGS EXAMPLE
Meta Tags
DOCTYPE, title, link, meta and style
Text Tags
<p>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <var>,<br>
Link Tags
<a> and <base>
Image and Object Tags
<img>, <object>
HTML TAGS EXAMPLE
List Tags
<ul>, <ol>, <li>, <dl>, <dt> and <dd>
Table Tags
<table>, <tr>, <td>, <th>,<caption>
Form Tags
<form>, <input>, <textarea>, <select>, <button>, <label>
Special Tag
<div>,<span>
HTML ATTRIBUTES
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"
Examples:
href Attribute:- The <a> tag defines a hyperlink. The href
attribute specifies the URL of the page the link goes to:
<a href="https://www.w3schools.com">Visit W3Schools</a>
HTML ATTRIBUTES
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.
<img src="img_girl.jpg">
width and height Attributes:- The <img> tag should also
contain the width and height attributes , which specify the
width and height of the image (in pixels):
<img src="img_girl.jpg" width="500" height="600">
HTML ATTRIBUTES
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.
<img src="img_girl.jpg" alt="Girl">
style Attribute:- The style attribute is used to add styles to an
element, such as color, font, size, and more.
<p style="color:red;">This is a red paragraph.</p>
title Attribute:- The title attribute defines some extra
information about an element.
<p title="I'm a tooltip">This is a paragraph.</p>
HTML TEXT FORMATTING
The HTML <b> element defines bold text.
The HTML <i> element defines italic text.
The HTML <strong> element is used to define text with
strong importance. The content inside is typically displayed in
bold.
The HTML <small> element defines smaller text.
The HTML <sup> element defines superscript text.
Superscript text appears half a character above the normal
line, and is sometimes rendered in a smaller font.
HTML TEXT FORMATTING
HTML LINK
HTML links are hyperlinks. You can click
on a link and jump to another document.
<a href="url">link text</a>
TASK 2&3
1. Inline
by using the style attribute inside HTML CSS
HTML elements. CSS stands for Cascading Style
2. Internal
Sheets.
It can control the layout of multiple
web pages all at once.
by using a <style> element in the CSS can be added to HTML
documents in 3 ways:
<head> section
3. External
by using a <link> element
to link to an external CSS.
CSS SELECTORS
1. id
The id attribute specifies a unique id for an HTML element.
The value of the id attribute must be unique within the HTML
document.
The id attribute is used to point to a specific style declaration in
a style sheet.
The syntax for id is: write a hash character (#), followed by an
id name. Then, define the CSS properties within curly braces
{}.
CSS SELECTORS
<html>
<head>
<style>
#myHeader {
background-color: lightblue;
color: black;
}
#paragraph{Color:black;}
</style></head>
<body>
<h1 id="myHeader">My Header</h1>
<p id=“paragraph”>hello</p>
</body>
</html>
CSS SELECTORS
2. class
The HTML class attribute is used to specify a class for an HTML
element. The syntax for class is: .classname{}
<html> <head>
<style>
.myHeader { background-color: lightblue; color: black; }
</style></head>
<body>
<h1 class="myHeader">My Header</h1>
<p class="myHeader">hello</p>
</body>
</html>
SPAN
The <span> tag is an inline container used to
mark up a part of a text, or a part of a
document.
DIV
The <div> (division) element is a generic
block-level element that is typically used to
separate page content into blocks.
HTML LIST
1 2 3
Description List
Ordered List Unordered List or
Definition List
Unordered HTML List
An unordered list starts with the <ul> tag. Each list item
starts with the <li> tag.
The list items will be marked with bullets (small black
circles) by default:
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
Ordered List
In the ordered HTML lists, all the list items are marked
with numbers by default.
It is known as numbered list also. The ordered list starts
with <ol> tag and the list items start with <li> tag.
<ol>
<li>Aries</li>
<li>Bingo</li>
<li>Leo</li>
</ol>
HTML Description List or Definition List
It is also known as a definition list where entries are listed like a dictionary or
encyclopedia.
The HTML definition list contains the following three tags:
<dl> tag defines the start of the list.
<dt> tag defines a term.
<dd> tag defines the term definition (description).
<dl>
<dt>Aries</dt>
<dd>-One of the 12 horoscope sign.</dd>
<dt>Bingo</dt>
<dd>-One of my evening snacks</dd>
</dl>
TASK 4
TASK 5
HTML TABLE
HTML tables allow web developers to arrange data into rows
and columns.
Each table cell is defined by a <td> and a </td> tag.
Each table row starts with a <tr> and end with a </tr> tag.
If you want your cells to be headers, use the <th> tag instead
of the <td> tag.
To add a border, use the CSS border property on table, th, and
td elements.
To set the width of a table, add the style attribute to the
<table> element.
<table>
<tr>
<th>Company</th>
<th>Contact</th>
<th>Place</th>
</tr>
<tr>
HTML TABLE
<td>Alfreds Futterkiste</td>
<td>95478124</td>
<td>Germany</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>784556214</td>
<td>Mexico</td>
</tr>
</table>
colspan
Example:
<iframe src="demo_iframe.htm" height="200"
width="300"title="Iframe Example"></iframe>
THANK YOU