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
158
votes
15 answers

How to minify php page html output?

I am looking for a php script or class that can minify my php page html output like google page speed does. How can I do this?
m3tsys
  • 3,939
  • 6
  • 31
  • 45
158
votes
13 answers

Relative URL to a different port number in a hyperlink?

Is there a way without Javascript / server-side scripting to link to a different port number on the same box, if I don't know the hostname? e.g.: Look at the other port (This example does't work as it'll just treat :8080 as a…
Ciaran McNulty
  • 18,698
  • 6
  • 32
  • 40
158
votes
12 answers

css 'pointer-events' property alternative for IE

I have a drop down navigation menu in which some of the title should not navigate to other page when clicked(these title open a drop down menu when clicked on) while others should navigate (these dont have dropdown and navigate directly).However,…
Anupam
  • 7,966
  • 3
  • 41
  • 63
158
votes
3 answers

how to show alternate image if source image is not found? (onerror working in IE but not in mozilla)

I need to show an alternate image in cell of table if source image is not found. Currently below code is used to do so. cell.innerHTML=""…
Jyoti
  • 2,065
  • 3
  • 25
  • 28
158
votes
3 answers

Can an input field have two labels?

Mary had a little form, and its fields where labeled just so. Whenever an error crept in, confusion it would sow. I've got a label for each input field... pretty standard affair. After validating the form, I'm displaying a helpful little paragraph…
aslum
  • 11,774
  • 16
  • 49
  • 70
158
votes
9 answers

Why does HTML5 form-validation allow emails without a dot?

I'm writing a very simple mock-up to demonstrate some HTML5 form-validation. However, I noticed the email validation doesn't check for a dot in the address, nor does it check for characters following said dot. In other words, "john@doe" is…
WEFX
  • 8,298
  • 8
  • 66
  • 102
158
votes
40 answers

Change Bootstrap tooltip color

What I'm trying to do is change the tooltip color to red. However, I also want to have multiple other colors so I don't simply want to replace the original tooltip's color. How would I go about doing this?
John Smith
  • 2,713
  • 7
  • 24
  • 23
158
votes
9 answers

How to manually trigger validation with jQuery validate?

I want to manually trigger validation including showing error messages with jQuery Validate. The scenario I am trying to accomplish is a form like this:
usr
  • 168,620
  • 35
  • 240
  • 369
158
votes
9 answers

Make div (height) occupy parent remaining height

Consider the following HTML/css code sample:
Text
Text
Text
Text
Text
Text
#container { width: 300px; height: 300px; border:1px solid…
Alvaro
  • 9,247
  • 8
  • 49
  • 76
158
votes
3 answers

Are nested span tags OK in XHTML?

Will this validate in XHTML? helloworld
rick
  • 4,103
  • 9
  • 37
  • 41
157
votes
29 answers

Best way to obfuscate an e-mail address on a website?

I've spent the past few days working on updating my personal website. The URL of my personal website is (my first name).(my last name).com, as my last name is rather unusual, and I was lucky enough to pick up the domain name. My e-mail address is…
Adam Rezich
  • 3,122
  • 6
  • 31
  • 39
157
votes
5 answers

Placing an image to the top right corner - CSS

I need to display an image on the top-right corner of a div (the image is a "diagonal" ribbon) but keeping the current text contained in an internal div, like stuck to the top of it. I tried different things as including the image in another div or…
Randomize
  • 8,651
  • 18
  • 78
  • 133
157
votes
9 answers

How to position a table at the center of div horizontally & vertically

We can set a image as background image of a
like: