HTML (Hypertext Markup Language)
HTML (Hypertext Markup Language) is a text-based approach to describing how content contained within an HTML file is structured. This markup tells a web browser how to display text, images and other forms of multimedia on a webpage.
HTML is a formal recommendation by the World Wide Web Consortium (W3C) and is generally adhered to by all major web browsers, including both desktop and mobile web browsers. HTML5 is the latest version of the specification.
How HTML works
HTML is a text file containing specific syntax, file and naming conventions that show the computer and the web server that it is in HTML and should be read as such. By applying these HTML conventions to a text file in virtually any text editor, a user can write and design a basic webpage, and then upload it to the internet.
The most basic of HTML conventions is the inclusion of a document type declaration at the beginning of the text file. This always comes first in the document, because it is the piece that affirmatively informs a computer that this is an HTML file. The document header typically looks like this: <!DOCTYPE html>. It should always be written that way, without any content inside it or breaking it up. Any content that comes before this declaration will not be recognized as HTML by a computer.
Doctypes are not just used for HTML, they can apply to the creation of any document that uses SGML (Standard Generalized Markup Language). SGML is a standard for specifying a specific markup language being used. HTML is one of several markup languages that SGML and doctype declarations apply to.
The other critical requirement for creating an HTML file is saving it with a .html file extension. Whereas the doctype declaration signals HTML to the computer from the inside of the file, the file extension signals HTML to the computer from the outside of the file. By having both, a computer can tell that it's an HTML file whether it's reading the file or not. This becomes especially important when uploading the files to the web, because the web server needs to know what to do with the files before it can send them to a client computer for the inner contents to be read.
After writing the doctype and saving as an HTML file, a user can implement all the other syntactic tools of HTML to customize a web page. Once finished, they will likely have several HTML files corresponding to various pages of the website. It's important that the user uploads these files in the same hierarchy that they saved them in, as each page references the specific file paths of the other pages, enabling links between them. Uploading them in a different order will cause links to break and pages to be lost, because the specified file paths will not match the pages.
Basic elements of HTML
Using HTML, a text file is further marked up with additional text describing how the document should be displayed. To keep the markup separate from the actual content of the HTML file, there is a special, distinguishing HTML syntax that is used. These special components are known as HTML tags. The tags can contain name-value pairs known as attributes, and a piece of content that is enclosed within a tag is referred to as an HTML element.
HTML elements always have opening tags, content in the middle and closing tags. Attributes can provide additional information about the element and are included in the opening tag. Elements can be described in one of two ways:
- Block-level elements start on a new line in the document and take up their own space. Examples of these elements include headings and paragraph tags.
- Inline elements do not start on a new line in the document and only take up necessary space. These elements usually format the contents of block-level elements. Examples of inline elements include hyperlinks and text format tags.
Pros and cons of HTML
Pros of using HTML include:
- Is widely adopted with a large amount of resources available.
- Is natively run on every browser.
- Is relatively easy to learn.
- Has a clean and consistent source code.
- Is open source and free to use.
- Can be integrated with other backend programming languages such as PHP.
A few cons to consider are:
- Does not have very dynamic functionality and is mainly used for static web pages.
- All components must be created separately even if they use similar elements.
- Browser behavior can be unpredictable. For example, older browsers may not be compatible with newer features.
- Commonly used HTML tags
- HTML tags dictate the overall structure of a page and how the elements within them will be displayed in the browser.
Commonly used HTML tags include:
- <h1> which describes a top-level heading.
- <h2> which describes a second-level heading.
- <p> which describes a paragraph.
- <table> which describes tabular data.
- <ol> which describes an ordered list of information.
- <ul> which describes an unordered list of information.
- As mentioned, there are opening and closing tags that surround the content they are augmenting. An opening tag looks like this: <p>. A closing tag is the same but contains a backslash in it to indicate that it's the end of the given HTML element. Closing tags look like this: </p>.
How to use and implement HTML
HTML, CSS and JavaScript
History and development
HTML versions
- HTML 1.0 -- released in 1992 -- had very limited capability and around 20 elements.
- HTML 2.0 -- released in 1995 -- began to incorporate elements relating to math functions.
- HTML 3.2 -- released in 1996 -- dropped the math function initiative altogether, and fixed overlap between various proprietary extensions.
- HTML 4.0 -- released in 1997 -- offered three variations which differed in the number of deprecated elements that were allowed.
- HTML 4.01 -- released in 1999 -- largely the same as 4.0.
- HTML 5 -- released in 2014 -- came after a long break in updates because the organization that developed it -- W3C -- was focusing on another, parallel language called XHTML.
- HTML 5.1 -- released in 2016 -- aimed to more easily accommodate various types of media embedding with new tags.
- HTML 5.2 -- released in 2017 -- aimed to be equally understandable by humans and computers.
- HTML 5.3 -- yet to be released -- W3C is collaborating with WHATWG on a new version. The collaboration began in 2019.
Features of HTML5
- HTML5 introduces several elements to increase interactivity, multimedia capabilities and semantic efficiency. Instead of using plugins, multimedia can be placed within the HTML code.
These elements include:
Graphics elements:
- <canvas>, which creates a blank rectangular space in which web designers can draw using JavaScript.
- <svg>, which is a container for scalable vector graphics (SVG).
- Semantic elements:
- <header>, which creates a header at the top of the page.
- <footer>, which creates a footer at the bottom of the page.
- <article>, which creates an area for independent content.
- <section>, which defines sections and subsections such as chapters, or headers and footers when more than one are necessary.
- <nav>, which creates a navigation menu.
- Multimedia elements:
- <audio>, which describes MP3 files, WAV files and OGG files in HTML.
- <video>, which describes MP4, WebM and OGG video types.
- Attributes that apply to the <form> element, which creates an area for user input on the web page. These include number, date, calendar and range.
Other main features of HTML5 include:
- Elimination of outmoded or redundant attributes.
- Offline editing.
- The ability to drag and drop between HTML5 documents.
- Messaging enhancements.
- Detailed parsing
- MIME and protocol handler registration.
- A common standard for storing data in SQL databases (Web SQL).
- Application program interfaces (API) for complex applications.
- Accommodations for mobile device app development.
- MathML for mathematical and scientific formulas.
Post a Comment
We welcome relevant and respectful comments. Off-topic or spam comments may be removed.