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
8678
votes
9 answers

Why does HTML think “chucknorris” is a color?

Why do certain random strings produce colors when entered as background colors in HTML? For example, bgcolor="chucknorris" produces a red background: test Conversely, bgcolor="chucknorr" produces a yellow…
user456584
  • 86,427
  • 15
  • 75
  • 107
5476
votes
79 answers

How can I validate an email address in JavaScript?

I'd like to check if the user input is an email address in JavaScript, before sending it to a server or attempting to send an email to it, to prevent the most basic mistyping. How could I achieve this?
pix0r
  • 31,139
  • 18
  • 86
  • 102
5148
votes
68 answers

How do I check whether a checkbox is checked in jQuery?

I need to check the checked property of a checkbox and perform an action based on the checked property using jQuery. For example, if the age checkbox is checked, then I need to show a textbox to enter age, else hide the textbox. But the following…
Prasad
  • 58,881
  • 64
  • 151
  • 199
5037
votes
131 answers

How can I horizontally center an element?

How can I horizontally center a
within another
using CSS?
Foo foo
Lukas
  • 9,476
  • 4
  • 20
  • 14
4407
votes
56 answers

Which "href" value should I use for JavaScript links, "#" or "javascript:void(0)"?

The following are two methods of building a link that has the sole purpose of running JavaScript code. Which is better, in terms of functionality, page load speed, validation purposes, etc.? function myJsFunc() { alert("myJsFunc"); }
2cBGj7vsfp
  • 2,737
  • 3
  • 17
  • 5
4350
votes
42 answers

Change an HTML input's placeholder color with CSS

Chrome v4 supports the placeholder attribute on input[type=text] elements (others probably do too). However, the following CSS doesn't do anything to the placeholder's value: input[placeholder], [placeholder], *[placeholder] { color: red…
David Murdoch
  • 87,823
  • 39
  • 148
  • 191
3671
votes
19 answers

Set cellpadding and cellspacing in CSS?

In an HTML table, the cellpadding and cellspacing can be set like this: How can the same be accomplished using CSS?
kokos
  • 43,096
  • 5
  • 36
  • 32
3371
votes
34 answers

How can I change an element's class with JavaScript?

How can I change the class of an HTML element in response to an onclick or any other events using JavaScript?
Nathan Smith
  • 36,807
  • 6
  • 28
  • 25
3234
votes
22 answers

How do I disable the resizable property of a textarea?

I want to disable the resizable property of a textarea. Currently, I can resize a textarea by clicking on the bottom right corner of the textarea and dragging the mouse. How can I disable this?
user549757
  • 32,962
  • 4
  • 19
  • 20
3196
votes
102 answers

How do you disable browser autocomplete on web form field / input tags?

How do you disable autocomplete in the major browsers for a specific input (or form field)?
Brett Veenstra
  • 47,674
  • 18
  • 70
  • 86
3151
votes
20 answers

Is it possible to apply CSS to half of a character?

What I am looking for: A way to style one HALF of a character. (In this case, half the letter being transparent) What I have currently searched for and tried (With no luck): Methods for styling half of a character/letter Styling part of a character…
SimplyAzuma
  • 25,214
  • 3
  • 23
  • 39
3051
votes
40 answers

How can I know which radio button is selected via jQuery?

I have two radio buttons and want to post the value of the selected one. How can I get the value with jQuery? I can get all of them like this: $("form :radio") How do I know which one is selected?
juan
  • 80,295
  • 52
  • 162
  • 195
3046
votes
24 answers

How to store objects in HTML5 localStorage/sessionStorage

I'd like to store a JavaScript object in HTML5 localStorage, but my object is apparently being converted to a string. I can store and retrieve primitive JavaScript types and arrays using localStorage, but objects don't seem to work. Should…
Kristopher Johnson
  • 81,409
  • 55
  • 245
  • 302
2978
votes
21 answers

How do I modify the URL without reloading the page?

Is there a way I can modify the URL of the current page without reloading the page? I would like to access the portion before the # hash if possible. I only need to change the portion after the domain, so it's not like I'm violating cross-domain…
Robin Rodricks
  • 110,798
  • 141
  • 398
  • 607
2882
votes
16 answers

I need an unordered list without any bullets

I have created an unordered list. I feel the bullets in the unordered list are bothersome, so I want to remove them. Is it possible to have a list without bullets?
praveenjayapal
  • 37,683
  • 30
  • 72
  • 72
1
2 3
99 100