ppt html 1
ppt html 1
Aakansha
Priyanka Yadav
HTML Introduction:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
EXPLAINATION:
All HTML documents must start with a document type declaration: <!DOCTYPE html>.
The HTML document itself begins with <html> and ends with </html>.
The visible part of the HTML document is between <body> and </body>.
The <!DOCTYPE> declaration represents the document type and helps browsers to display web pages
correctly.
It must only appear once, at the top of the page (before any HTML tags).
The <!DOCTYPE> declaration is not case sensitive.
The <!DOCTYPE> declaration for HTML5 is: <!DOCTYPE html>
HTML Headings:
An HTML element is defined by a start tag, some content, and an end tag:
<tagname> Content goes here... </tagname>
The HTML element is everything from the start tag to the end tag:
<h1>My First Heading</h1>
<p>My first paragraph.</p>
Note: Some HTML elements have no content (like the <br> element). These elements are called
empty elements. Empty elements do not have an end tag!
Web Browsers:
The purpose of a web browser (Chrome, Edge, Firefox, Safari) is to read HTML documents and
display them correctly.
A browser does not display the HTML tags, but uses them to determine how to display the
document:
Nested HTML Elements:
HTML elements can be nested (this means that elements can contain other elements).
All HTML documents consist of nested HTML elements.
The following example contains four HTML elements (<html>, <body>, <h1> and <p>):
Example
<!DOCTYPE html>
<html>
<body>
</body>
</html>
Empty HTML Elements:
HTML elements with no content are called empty elements.
The <br> tag defines a line break, and is an empty element without a closing tag:
Example
<p>This is a <br> paragraph with a line break.</p>
HTML is Not Case Sensitive
HTML tags are not case sensitive: <P> means the same as <p>.
The HTML standard does not require lowercase tags, but W3C recommends
lowercase in HTML, and demands lowercase for stricter document types like
XHTML.
HTML ATTRIBUTES:
The <a> tag defines a hyperlink. The href attribute specifies the URL of the page
the link goes to:
Example
<a href="https://www.google.com" target="_blank" >This is a demo</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="https://media.istockphoto.com/id/1952748547/photo/smiling-woman-embracing-dog-
on-sofa.jpg?s=1024x1024&w=is&k=20&c=NgaENrEXAc0ylT21r3N-9nw_NLiRMjLDewDta8BmXvs="
alt="Dog Image" width="200" height="150">
The <img> tag should also contain the width and height attributes, which specify the width and
height of the image (in pixels)
The required alt attribute for the <img> tag specifies an alternate text for an image, if the image
for some reason cannot be displayed.
The style Attribute:
The style attribute is used to add styles to an element, such as color, font, size, and more.
Example:
<!DOCTYPE html>
<html>
<body>
</body>
</html>
The lang Attribute:
You should always include the lang attribute inside the <html> tag, to declare the
language of the Web page. This is meant to assist search engines and browsers.
<!DOCTYPE html>
<html lang="en">
<body>
...
</body>
</html>
Country codes can also be added to the language code in the lang attribute. So, the first
two characters define the language of the HTML page, and the last two characters define
the country.
The following example specifies English as the language and United States as the country:
<!DOCTYPE html>
<html lang="en-US">
<body>
...
</body>
</html>
The title Attribute:
The title attribute defines some extra information about an element.
The value of the title attribute will be displayed as a tooltip when you mouse over the
element:
Example
<!DOCTYPE html>
<html>
<body>
<h2 title="I'm a header">The title Attribute</h2>
<p title="I'm a tooltip">Mouse over this paragraph, to display the title attribute as a tooltip.</p>
</body>
</html>
Note:
The title attribute (and all other attributes) can be written with uppercase or lowercase like title
or TITLE. However, lowercase attributes should be used in HTML and demands lowercase
attributes for stricter document types like XHTML.
Always Quote Attribute Values
The HTML standard does not require quotes around attribute values.
However, use quotes in HTML, and demands quotes for stricter document types like XHTML.
Good:
<a href="https://www.w3schools.com/html/">Visit our HTML tutorial</a>
Bad:
<a href=https://www.w3schools.com/html/>Visit our HTML tutorial</a>
Sometimes you have to use quotes. This example will not display the title attribute correctly,
because it contains a space:
Example:
<p title=Description of W3Schools>
Single or Double Quotes?
Double quotes around attribute values are the most common in HTML, but single
quotes can also be used.
In some situations, when the attribute value itself contains double quotes, it is
necessary to use single quotes:
<p title='John "ShotGun" Nelson'>
Or vice versa:
<p title="John 'ShotGun' Nelson">
HTML Headings:
HTML headings are titles or subtitles that you want to display on a webpage.
Each HTML heading has a default size. However, you can specify the size for any heading with the
style attribute, using the CSS font-size property.
Example:
<!DOCTYPE html>
<html>
<body>
</body>
</html>
HTML Horizontal Rules:
The <hr> tag defines a thematic break in an HTML page, and is most often displayed as a horizontal
rule.
The <hr> element is used to separate content (or define a change) in an HTML page.
Example:
<!DOCTYPE html>
<html>
<body>
</body>
</html>
HTML Line Breaks:
</body>
</html>
The HTML Style Attribute:
Background Colour :
Example- Set the background color for a page to powder blue
<!DOCTYPE html>
<html>
<body style="background-color:powderblue;">
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Set background color for two different elements:
Example:
<!DOCTYPE html>
<html>
<body>
</body>
</html>
Text Color:
</body>
</html>
Fonts:
</body>
</html>
Text Size:
<!DOCTYPE html>
<html>
<body>
<h1 style="font-size:300%;">This is a heading</h1>
<p style="font-size:160%;">This is a paragraph.</p>
</body>
</html>
Text Alignment:
<!DOCTYPE html>
<html>
<body>
<h1 style="text-align:center;">Centered Heading</h1>
<p style="text-align:center;">Centered paragraph.</p>
</body>
</html>
HTML Text Formatting:
Formatting elements were designed to display special types of text:
</body>
</html>
Thank you