HTML

INTRODUCTION

  • HTML stands for HyperText Markup Language.
  • HTML is a standard markup language for creating Web pages.
  • HTML was  invented by Tim Berners – Lee in 1991.
  • HTML is a structure to design a website.
  • HTML is a series of elements.
  • HTML elements tell the browser how to display the content.

EXAMPLE:-

<!DOCTYPE html>

<html>

<head>

<title>Page Title</title>

</head>

<body>

<h1>My First E</h1>

<p>My first paragraph.</p>

</body>

EXAMPLE EXPLAINED:-

  • The <!DOCTYPE html> declaration defines that this document is an HTML5 document
  • The <html> element is the root element of an HTML page
  • The <head> element contains meta information about the HTML page
  • The <title> element specifies a title for the HTML page (which is shown in the browser’s title bar or in the page’s tab)
  • The <body> element defines the document’s body, and is a container for all the visible contents, such as headings, paragraphs, images, hyperlinks, tables, lists, etc.
  • The <h1> element defines a large heading
  • The <p> element defines a paragraph

What is an HTML Element?

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>   

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”
  1. 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 here</a>

2.    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”>

3.    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″>

4.    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”>

5.     style Attribute

The style attribute is used to add styles to an element, such as color, font, size, and more.

Example

<p style=”color:red;”>This is a red paragraph.</p>

6.     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.

The following example specifies English as the language:

<!DOCTYPE html>
<html lang=”en”>
<body>

</body>
</html>

7.   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

<p title=”I’m a tooltip”>This is a paragraph.</p>

NOTE:-  There  are  many  more  attributes  in  HTML

HTML Styles

The HTML style attribute is used to add styles to an element, such as color, font, size, and more.

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;“>

The property is a CSS property. The value is a CSS value.

Example:-

I am normal

I am red

I am blue

I am big

HTML Text Formatting

HTML contains several elements for defining text with a special meaning.

Formatting elements were designed to display special types of text:

  • <b> – Bold text
  • <strong> – Important text
  • <i> – Italic text
  • <em> – Emphasized text
  • <mark> – Marked text
  • <small> – Smaller text
  • <del> – Deleted text
  • <ins> – Inserted text
  • <sub> – Subscript text
  • <sup> – Superscript text

Above is a picture of what we have done during our internship. This is a small portion of code of our work to design a WEB PAGE.

Leave a Comment