Questions tagged [html]

HTML (HyperText Markup Language) is the markup language for creating web pages and other information to be displayed in a web browser. Questions regarding HTML should include a minimal reproducible example and some idea of what you're trying to achieve. This tag is rarely used alone and is often paired with CSS and JavaScript.

HTML (HyperText Markup Language) is the markup language used for structuring web pages and other information to be displayed in a web browser. HTML describes the structure of a web page semantically along with cues for presentation, making it a markup language rather than a programming language. A browser 'renders' HTML in conjunction with CSS, which defines the 'style' (colours, fonts, layout, etc.), and JavaScript, which defines interactive and dynamic elements, adding style and behaviour to the pages.

https://html.spec.whatwg.org/multipage/ is the canonical HTML specification.


HTML (HyperText Markup Language) is the primary markup language for creating web pages and other information to be displayed to humans in a web browser.

It was invented by Sir Tim Berners-Lee while developing the first Web browser at CERN to enable researchers to share their findings and was formally released in June 1993. The original "HTML Tags" were first publicly mentioned by Berners-Lee in 1991 and borrowed the syntax from CERN's SGML-based documentation standard. The latest and current version for HTML is HTML5.3.

HTML elements form the building blocks of all web pages. HTML allows images and objects to be embedded in a page. It references styles and scripts and carries meta-data. It can be used to create interactive forms. It provides a means to create structured documents by denoting structural semantics for text such as headings, paragraphs, lists, links, quotes, and other items. It can embed scripts written in languages such as JavaScript, which affects the behaviour of HTML web pages. Web pages generated by various programming languages (such as PHP, JSP, VF, ASP.NET, etc.) are rendered as HTML in a browser.

HTML is a hierarchical (tree-structured) markup language. That is, an item might descend from another item, which is its ancestor. However, if item2 is a descendant of item1, they have an additional special relation: item2 is inside of item1, or item1 is wrapped around item2.


Syntax

HTML is written in the form of elements consisting of tags (and their attributes) enclosed in angle brackets (e.g., <html>).

HTML attributes are most commonly expressed in a key="value" format. However, there are exceptions in which some attributes can be written with no value and still be interpreted.

HTML tags most commonly come in pairs. The first is known as the opening tag and the second, which includes a forward slash, is the closing tag (e.g., <h1> and </h1>). Various types of content, such as text or additional HTML elements, can be contained within these tags. Some tags, however, are unpaired, and these are known as empty elements or self-closing tags. They may or may not include the slash (e.g., <img> or <img />).

Collectively, these tags form an HTML document. Web browsers read these documents, interpret each HTML tag, and then render their corresponding visual and/or audible display in the form of a web page.


Standards

HTML standards, as well as those for many other web technologies, are maintained by the World Wide Web Consortium (W3C).

HTML4 was introduced in 1997, and the latest iteration, HTML5, was recently developed by the W3C. What W3C calls HTML5 is a subset, with a few modifications, of the HTML-Living-Standard, which is specified by the Web Hypertext Application Technology Working Group (WHATWG).

The language specification and standards documents for HTML5 are available online.


Design and Scripting

HTML markups are designed, or 'styled', via CSS (Cascading Style Sheets), using one or more of the following:

  • the <link> tag, which loads a CSS file
  • the <style> tag, where CSS rules are defined
  • the style attribute of HTML tags, where inline styles can be specified

Dynamic and interactive parts of a page are programmed most frequently in JavaScript, using one or more of the following:

  • the <script> tag with an src attribute, which points to a script file
  • the <script> opening and closing tags enclosing a script written in JavaScript
  • event attributes of HTML tags, like onclick

FAQ


References:


Free HTML Books:


Related Tags:

HTML5: What’s New?

1180250 questions
155
votes
10 answers

Is a URL allowed to contain a space?

Is a URI (specifically an HTTP URL) allowed to contain one or more space characters? If a URL must be encoded, is + just a commonly followed convention, or a legitimate alternative? In particular, can someone point to an RFC that indicates that a…
Joe Casadonte
  • 15,888
  • 11
  • 45
  • 57
155
votes
5 answers

Select first occurring element after another element

I've got the following HTML code on a page:

Some text

Some more text!

In my .css I've got the following selector to style the h4 element. The HTML code above is just a small part of the entire code; there are several divs more…
Rob
  • 6,731
  • 12
  • 52
  • 90
155
votes
6 answers

Adding additional data to select options using jQuery

Very simple question I hope. I have the usual I can get the selected value (by using…
jim smith
  • 1,833
  • 3
  • 16
  • 12
155
votes
7 answers

Difference between jQuery’s .hide() and setting CSS to display: none

Which am I better off doing? .hide() is quicker than writing out .css("display", "none"), but what’s the difference and what are both of them actually doing to the HTML element?
benhowdle89
  • 36,900
  • 69
  • 202
  • 331
155
votes
11 answers

CSS background image alt attribute

This is one I have not had to tackle before. I need to use alt tags on all images in a site including those used by CSS background-image attribute. There is no CSS property like this as far as I know, so what is the best way to do this please?
Sixfoot Studio
  • 2,951
  • 7
  • 26
  • 35
155
votes
3 answers

Difference between and

There are many legends about them. I want to know the truth. What are the differences between the two following examples?
James
  • 42,081
  • 53
  • 136
  • 161
155
votes
21 answers

How do I display images from Google Drive on a website?

A client of mine has uploaded some photos to their Google Drive and would like me to display their photos on their company website. I reviewed the documentation for displaying Google Drive content on a web page, but it appears that this is simply…
forrest
  • 10,570
  • 25
  • 70
  • 132
155
votes
10 answers

'transform3d' not working with position: fixed children

I have a situation where, in normal CSS circumstances, a fixed div would be positioned exactly where it is specified (top:0px, left:0px). This does not seem to be respected if I have a parent that has a translate3d transform. Am I not seeing…
Juan Carlos Moreno
  • 2,754
  • 3
  • 22
  • 21
155
votes
10 answers

How to make input type= file Should accept only pdf and xls

I used Now I would like to restrict this by accepting only .pdf and .xls files. When I click the submit button it should validate this. And when I click the files (PDF/XLS) on webpage it should automatically…
Manikandan
  • 1,589
  • 3
  • 11
  • 10
154
votes
10 answers

Limit the size of a file upload (html input element)

I would like to simply limit the size of a file that a user can upload. I thought maxlength = 20000 = 20k but that doesn't seem to work at all. I am running on Rails, not PHP, but was thinking it'd be much simpler to do it client side in the…
delphi
  • 10,705
  • 5
  • 22
  • 18
154
votes
16 answers

How to extract svg as file from web page

I want to save SVG as file from this page https://www.lightningdesignsystem.com/icons/ Is there any Chrome extension or other way to do this?
Vladyslav K
  • 2,178
  • 3
  • 19
  • 25
154
votes
26 answers

How to prevent long words from breaking my div?

Ever since switching from TABLE-layout to DIV-layout, one common problem remains: PROBLEM: you fill your DIV with dynamic text and inevitably there is a super-long word that extends over the edge of your div column and makes your site look…
Edward Tanguay
  • 189,012
  • 314
  • 712
  • 1,047
154
votes
18 answers

Disabling android's chrome pull-down-to-refresh feature

I've created a small HTML5 web application for my company. This application displays a list of items and everything works fine. The application is mainly used on android phones and Chrome as browser. Also, the site is saved on the home screen so…
Sebastiano
  • 1,682
  • 2
  • 13
  • 13
154
votes
13 answers

ReactJS: "Uncaught SyntaxError: Unexpected token <"

I am trying to get started building a site in ReactJS. However, when I tried to put my JS in a separate file, I started getting this error: "Uncaught SyntaxError: Unexpected token <". I tried adding /** @jsx React.DOM */ to the top of the JS file,…
kat
  • 5,645
  • 4
  • 19
  • 35
1 2 3
99
100