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

How to center a (background) image within a div?

Is it possible to center a background image in a div? I have tried just about everything - but no success:
Lorem Ipsum ...
//CSS #doit { background-image: url(images/pic.png); background-repeat: none; text-align: center;…
oompahloompah
  • 9,087
  • 19
  • 62
  • 90
157
votes
18 answers

How do you determine what technology a website is built on?

Quite often I come across a nice looking or functional website, and wonder what technology was used to create it. What techniques are available to figure out what a particular website was built with? Few frameworks seem to include any kind of…
Mat
  • 82,161
  • 34
  • 89
  • 109
157
votes
7 answers

Bootstrap full-width text-input within inline-form

I am struggling to create a textbox that fits the entire width of my container area.
Killnine
  • 5,728
  • 8
  • 39
  • 66
157
votes
17 answers

Parsing HTML into NSAttributedText - how to set font?

I am trying to get a snippet of text that is formatted in html to display nicely on an iPhone in a UITableViewCell. So far I have this: NSError* error; NSString* source = @"Nice try, Phil"; NSMutableAttributedString* str =…
phil
  • 4,668
  • 4
  • 33
  • 51
157
votes
10 answers

Set font-weight using Bootstrap classes

Is there any Twitter Bootstrap class for font-weight: bold and other values of font-weight? I would not create a new one if this already exists in Bootstrap.
Ionică Bizău
  • 109,027
  • 88
  • 289
  • 474
157
votes
15 answers

Using margin:auto to vertically-align a div

So I know we can center a div horizontally if we use margin:0 auto;. Should margin:auto auto; work how I think it should work? Centering it vertically as well? Why doesn't vertical-align:middle; work either? .black { position:absolute; …
savinger
  • 6,544
  • 9
  • 40
  • 57
157
votes
18 answers

Change :hover CSS properties with JavaScript

How can JavaScript change CSS :hover properties? For example: HTML
Hover 1 Hover 2
CSS table td:hover { background:#ff0000; } How can the td :hover properties be modified to, say,…
zdebruine
  • 3,687
  • 6
  • 31
  • 50
157
votes
15 answers

How to show multiline text in a table cell

I want to show a paragraph from database into a table cell. The result is a large 1 line, ignoring how its organised in database. ignoring 'enters' for example (new lines) I want to show it exactly according to how it's written in database. For…
Shady
  • 1,701
  • 2
  • 13
  • 14
157
votes
9 answers

How to write a caption under an image?

I have two images that need to kept inline; I want to write a caption under each image.
Samrat Mazumdar
  • 2,641
  • 4
  • 19
  • 28
156
votes
10 answers

Why is  appearing in my HTML?

I see this character in Firebug . I don't know why this is happening, there's no such character in my code. For Firefox it's OK, but in IE everything breaks. I can't even search for this character in Google. I saved my file with utf-8…
mehdi
  • 9,262
  • 11
  • 35
  • 35
156
votes
15 answers

Changing cursor to waiting in javascript/jquery

How would i get my cursor to change to this loading icon when a function is called and how would i change it back to a normal cursor in javascript/jquery
ahmet
  • 4,955
  • 11
  • 39
  • 64
156
votes
11 answers

How to detect which one of the defined font was used in a web page?

Suppose I have the following CSS rule in my page: body { font-family: Calibri, Trebuchet MS, Helvetica, sans-serif; } How could I detect which one of the defined fonts were used in the user's browser? For people wondering why I want to do this…
Pat
  • 36,282
  • 18
  • 72
  • 87
156
votes
16 answers

(HTML) Download a PDF file instead of opening them in browser when clicked

I was wondering how to make a PDF file link downloadable instead of opening them in the browser? How is this done in html? (I'd assume it's done via javascript or something).
404Error
  • 1,643
  • 3
  • 15
  • 11
156
votes
7 answers

HTML5 Video autoplay on iPhone

I have some kind of a strange problem. I try to create a website with a looped background video. The code looks like this one:
156
votes
5 answers

HTML Submit-button: Different value / button-text?

I'd like to create an HTML form submit button with the value 'add tag', however, the web page is in Swedish, so I'd like to have a different button text. That is, I want to have a button like but I want to have my code like if…
aioobe
  • 413,195
  • 112
  • 811
  • 826