What is HTML?
HTML (HyperText Markup Language) is the standard markup language used for structuring and presenting content on the World Wide Web. It is used to create and store documents on the internet. HTML is used for webpages, newsletters, email, and forms.
HTML describes the “structure” of webpages using markup. Elements are the building blocks of HTML pages. They are represented by tags and can include text, bookmark links, images, and control elements. An HTML tag is composed of the name of the element surrounded by angle brackets.
For example, web page authors indicate the start and end of a paragraph with the <p> and </p> tags, respectively. HTML tags are not case sensitive, which means that the tags <P> and <p> can be used interchangeably.
Structure of an HTML Document
An HTML document has two main sections - the head and the body. The purpose of the head section is to give information regarding the document to the user agent (e.g. browser). It usually contains meta data, style information, and scripts used to control page elements.
The body section represents the contents of the page. It encompasses everything that can be displayed on the page, such as text, images, links, and form elements. For example, text on a page is typically contained within a <p> element, while images are contained within an <img> element.
HTML Elements
HTML elements represent the building blocks of webpages. HTML elements are the most basic structure of an HTML page and can be used to indicate the structure and meaning of the content contained in a document. An element consists of a tag, and its contents.
There are a variety of different HTML elements:
<h1>to<h6>- Headings<p>- Paragraphs<img>- Images<ul>and<li>- Unordered lists<table>and<tr>- Tables<form>- Forms
Here is an example of an HTML document:
<!DOCTYPE html>
<html>
<head>
<title>My First HTML Document</title>
</head>
<body>
<h1>My First HTML Document</h1>
<p>This is my first HTML document.</p>
<button onClick="alert('button clicked!')">Click me!</button>
</body>
</html>
My First HTML Document
This is my first HTML document.
These elements provide the basic structure for webpages, and are used to render the webpages in an understandable way for browsers.
HTML Documents
HTML documents are written in “markup”. Markup is used to describe the content within an HTML document. It is different than natural language as it is composed of tags, attributes, and elements. These tags can be used to indicate the content and structure within a document.
For example, the <p> tag is used to indicate the start and end of a paragraph. The <h1> tag is used to indicate the start and end of a heading, and so on. By using these tags, HTML documents can be "marked up" to give meaning and structure to the content on the page.
HTML Attributes
Attributes provide additional information about an HTML element. They can be used to give an element additional information, or to control how the element behaves. Attributes can be used to control the appearance and behavior of an element, such as its color, size, and even its position on the page.
For example, the <img> tag uses the src attribute to indicate the source of the image and the alt attribute to provide alternative text for the image.
HTML and CSS
HTML and CSS work together to create a web page. HTML is responsible for the structure of the page, while CSS is responsible for the styling of the page. CSS can be used to set properties such as font size, font family, text color, and background color of an element.
By combining HTML and CSS, web developers can create webpages that look and behave the way they desire.
Coding in HTML
HTML documents are written in plain text format, but they must be written correctly in order to be rendered properly in the browser. To ensure that HTML documents are written correctly, developers use an HTML editor. An HTML editor is a piece of software used to write HTML code. Examples of HTML editors include Sublime Text, Atom, and Notepad++.
Conclusion
HTML is the standard markup language used for structuring and presenting content on the World Wide Web. It is used to create and store documents on the web and provides the basic structure for webpages. Elements, attributes, and tags provide the building blocks for webpages, and HTML and CSS work together to create the visual structure of a web page. HTML documents must be written correctly in order for them to be rendered correctly in the browser, and HTML editors are used to help developers write HTML code correctly.
