HTML Basics

HTMLWeb DevelopmentFront End Technology

Hypertext refers to the way in which Web pages (HTML documents) are linked together. Thus, the link available on a web page is called Hypertext. As its name suggests, HTML is a Markup Language which means you use HTML to simply "mark-up" a text document with tags that tell a Web browser how to structure it to display. It stands for Hypertext Markup Language, and it is the most widely used language to write Web Pages.

HTML5 is the next major revision of the HTML standard superseding HTML 4.01, XHTML 1.0, and XHTML 1.1. HTML5 is a standard for structuring and presenting content on the World Wide Web. The new standard incorporates features like video playback and drag-and-drop that have been previously dependent on third-party browser plug-ins such as Adobe Flash, Microsoft Silverlight, and Google Gears.

HTML Doctype

Whenever you create an HTML document, the doctype is the first thing placed in the document. It conveys the web browser about the version of the HTML, this page is written on. It is not case-sensitive.

The HTML5 doctype

<!DOCTYPE html>

HTML Character Encoding

The charset attribute in HTML is used with the <meta> to specify the character encoding.

Following is the syntax −

<meta charset="char_set">

Above, char_set is the character set to specify the character encoding of an HTML document.

Let us now see an example to specify character encoding −


 Live Demo

<!DOCTYPE html>
<meta charset = "UTF-8">
<p>We have added demo text:<p>
<textarea rows = "4" cols = "50">
Here, we are mentioned the demo content. This is just to display an example of charset in an HTML document.
<button type = "button">Previous</button>
<button type = "button">Next</button>


HTML Headings

Any document starts with a heading. You can use different sizes for your headings. HTML also has six levels of headings, which use the elements <h1>, <h2>, <h3>, <h4>, <h5>, and <h6>. While displaying any heading, browser adds one line before and one line after that heading.

HTML Elements

An HTML element is defined by a starting tag. If the element contains other content, it ends with a closing tag, where the element name is preceded by a forward slash

HTML Attributes

An attribute is used to define the characteristics of an HTML element and is placed inside the element's opening tag. All attributes are made up of two parts − a name and a value. For example −

<canvas id=”newCanvas” width=”400” height=”300”>

Other examples include −

<img alt = ”alternate text”>

Including quotes around an attribute is not mandatory, according to HTML5 standard, but it’s always a good practice to include quotes.

HTML Formatting

Formatting means how we can format text on a web page in an HTML. It includes bold text, italic text, strike text, highlight a text, etc. Let us see an example −


 Live Demo

<!DOCTYPE html>
<h2>Tags for formatting text in HTML</h2>
<strong>Strong text</strong><br>
<b>Bold text</b><br>
<em>Emphasized text</em><br>
<i>Italic Text</i><br>
<mark>Highlighted text</mark>


HTML Comments

HTML comments are placed in between <!-- … --> tags. So, any content placed with-in <!-- … --> tags will be treated as a comment and will be completely ignored by the browser.

Published on 11-Jun-2019 18:15:13