Edition for Web Developers — Last Updated 17 December 2024
HTML/HTML5/HTML5_Parser#Inline_SVG_and_MathML_support
Support in all current engines.
The MathML math
element falls into the embedded content,
phrasing content, flow content, and palpable content
categories for the purposes of the content models in this specification.
When the MathML annotation-xml
element contains elements from the
HTML namespace, such elements must all be flow content.
When the MathML token elements (mi
, mo
, mn
, ms
, and mtext
) are descendants of HTML elements, they may contain
phrasing content elements from the HTML namespace.
The semantics of MathML elements are defined by MathML and other applicable specifications. [MATHML]
Here is an example of the use of MathML in an HTML document:
<!DOCTYPE html>
< html lang = "en" >
< head >
< title > The quadratic formula</ title >
</ head >
< body >
< h1 > The quadratic formula</ h1 >
< p >
< math >
< mi > x</ mi >
< mo > =</ mo >
< mfrac >
< mrow >
< mo form = "prefix" > −</ mo > < mi > b</ mi >
< mo > ±</ mo >
< msqrt >
< msup > < mi > b</ mi > < mn > 2</ mn > </ msup >
< mo > −</ mo >
< mn > 4</ mn > < mo > </ mo > < mi > a</ mi > < mo > </ mo > < mi > c</ mi >
</ msqrt >
</ mrow >
< mrow >
< mn > 2</ mn > < mo > </ mo > < mi > a</ mi >
</ mrow >
</ mfrac >
</ math >
</ p >
</ body >
</ html >
HTML/HTML5/HTML5_Parser#Inline_SVG_and_MathML_support
Support in all current engines.
The SVG svg
element falls into the embedded content,
phrasing content, flow content, and palpable content
categories for the purposes of the content models in this specification.
When the SVG foreignObject
element contains elements from the
HTML namespace, such elements must all be flow content.
The content model for the SVG title
element inside HTML
documents is phrasing content. (This further constrains the requirements given
in SVG 2.)
The semantics of SVG elements are defined by SVG 2 and other applicable specifications. [SVG]
doc = iframe.getSVGDocument()
doc = embed.getSVGDocument()
doc = object.getSVGDocument()
Returns the Document
object, in the case of iframe
,
embed
, or object
elements being used to embed SVG.
The width
and
height
attributes on img
, iframe
,
embed
, object
, video
, source
when the parent
is a picture
element and, when their type
attribute is in the Image Button state,
input
elements may be specified to give the dimensions of the visual content of the
element (the width and height respectively, relative to the nominal direction of the output
medium), in CSS pixels. The attributes, if specified, must have values
that are valid non-negative integers.
The specified dimensions given may differ from the dimensions specified in the resource itself, since the resource may have a resolution that differs from the CSS pixel resolution. (On screens, CSS pixels have a resolution of 96ppi, but in general the CSS pixel resolution depends on the reading distance.) If both attributes are specified, then one of the following statements must be true:
The target ratio is the ratio of the natural width to the
natural height in the resource. The specified width and specified
height are the values of the width
and height
attributes respectively.
The two attributes must be omitted if the resource in question does not have both a natural width and a natural height.
If the two attributes are both 0, it indicates that the element is not intended for the user (e.g. it might be a part of a service to count page views).
The dimension attributes are not intended to be used to stretch the image.