Search completed in 1.11 seconds.
3088 results for "style":
Your results are loading. Please wait...
border-style - CSS: Cascading Style Sheets
the border-style shorthand css property sets the line style for all four sides of an element's border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...erty sets the line style for all four sides of an element's border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...style for all four sides of an element's border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 23 more matches
border-right-style - CSS: Cascading Style Sheets
the border-right-style css property sets the line style of an element's right border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: the specification doesn't define how borders of different styles connect in the corners. ...
...yle of an element's right border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: the specification doesn't define how borders of different styles connect in the corners. ...
...border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: the specification doesn't define how borders of different styles connect in the corners. ...
...And 18 more matches
border-left-style - CSS: Cascading Style Sheets
the border-left-style css property sets the line style of an element's left border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: the specification doesn't define how borders of different styles connect in the corners. ...
...style of an element's left border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: the specification doesn't define how borders of different styles connect in the corners. ...
...t border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: the specification doesn't define how borders of different styles connect in the corners. ...
...And 16 more matches
list-style-type - CSS: Cascading Style Sheets
moreover, because this property is inherited, it can be set on a parent element (commonly <ol> or <ul>) to make it apply to all list items. ...
...teractive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the color of the marker will be the same as the computed color of the element it applies to. only a few elements (<li> and <summary>) have a default value of display: list-item. ...
...element it applies to. only a few elements (<li> and <summary>) have a default value of display: list-item. however, the list-style-type property may be applied to any element whose display value is set to list-item. moreover, because this property is inherited, it can be set on a parent element (commonly <ol> or <ul>) to make it apply to all list items. ...
...And 15 more matches
list-style - CSS: Cascading Style Sheets
the list-style css shorthand property allows you set all the list style properties at once. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: this property is applied to list items, i.e., elements with display: list-item; . by default this includes <li> elements. because this property is inherited, it can be set on a parent element (normally <ol> or <ul>) to make the same list styling apply to all the items inside. ...
...s a pull request. note: this property is applied to list items, i.e., elements with display: list-item; . by default this includes <li> elements. because this property is inherited, it can be set on a parent element (normally <ol> or <ul>) to make the same list styling apply to all the items inside. ...
... note: this property is applied to list items, i.e., elements with display: list-item; . by default this includes <li> elements. because this property is inherited, it can be set on a parent element (normally <ol> or <ul>) to make the same list styling apply to all the items inside. ...
...And 15 more matches
@counter-style - CSS: Cascading Style Sheets
the @counter-style css at-rule lets you define counter styles that are not part of the predefined set of styles. a @counter-style rule defines how to convert a counter value into a string representation. @counter-style thumbs { system: cyclic; symbols: "\1f44d"; suffix: " "; } ul { list-style: thumbs; } the initial version of css defined a set of useful counter styles. however, although more styles were added to this set of predefined styles over the years, this system proved too restrictive to fulfill the needs of worldwide typography. the @counter-style at-rule addresses this shortcoming in an open-ended manner, by allowing authors to define their own counter styles when the pre-defined styles aren't fitting their needs. ...
... system specifies the algorithm to be used for converting the integer value of a counter to a string representation. negative lets the author specify symbols to be appended or prepended to the counter representation if the value is negative. ...
...nded to the marker representation. prefixes are added to the representation in the final stage, so in the final representation of the counter, it comes before the negative sign. suffix specifies, similar to the prefix descriptor, a symbol that is appended to the marker representation. suffixes come after the marker representation. range defines the range of values over which the counter style is applicable. if a counter style is used to represent a counter value outside of its ranges, the counter style will drop back to its fallback style. pad is used when you need the marker representations to be of a minimum length. for example if you want the counters to start at 01 and go through 02, 03, 04 etc, then the pad descriptor is to be used. for representations larger than the specif...
...And 14 more matches
ElementCSSInlineStyle.style - Web APIs
the style property is used to get as well as set the inline style of an element. when getting, it returns a cssstyledeclaration object that contains a list of all styles properties for that element with values assigned for the attributes that are defined in the element's inline style attribute. see the css properties reference for a list of the css properties accessible via style. the style property has the same (and highest) priority in the css cascade as an inline style declaration set via the style attribute. setting styles styles should not be set by assigning a string directly to the style property (as in elt.style = "color: blue;"), since it is considered read-only, as the style attribute returns a cssstyledeclaration object which is also read-only. ...
...style. the style property has the same (and highest) priority in the css cascade as an inline style declaration set via the style attribute. setting styles styles should not be set by assigning a string directly to the style property (as in elt.style = "color: blue;"), since it is considered read-only, as the style attribute returns a cssstyledeclaration object which is also read-only. instead, styles can be set by assigning values to the properties of style. for adding specific styles to an element without altering other style values, it is preferred to use the individual properties of style (as in elt.style.color = '...') as using elt.style.csstext = '...' or elt.setattribute('style', '...') sets the complete inline style for the element by overriding the existing inline styles. note that t...
...pecific styles to an element without altering other style values, it is preferred to use the individual properties of style (as in elt.style.color = '...') as using elt.style.csstext = '...' or elt.setattribute('style', '...') sets the complete inline style for the element by overriding the existing inline styles. note that the property names are in camel-case and not kebab-case while setting the style using elt.style.<property> (i.e., elt.style.fontsize, not elt.style.font-size). a style declaration is reset by setting it to null or an empty string, e.g., elt.style.color = null. internet explorer requires setting it to an empty string, and does not do anything when setting it to null. ...
...And 13 more matches
font-style - CSS: Cascading Style Sheets
italic specifies that font-face is an italicized version of the normal font. oblique specifies that the font-face is an artificially sloped version of the normal font. ...
... italic specifies that font-face is an italicized version of the normal font. oblique specifies that the font-face is an artificially sloped version of the normal font. ...
... italic specifies that font-face is an italicized version of the normal font. oblique specifies that the font-face is an artificially sloped version of the normal font. ...
...And 11 more matches
<style>: The Style Information element - HTML: Hypertext Markup Language
Web › HTML › Element › style
the html <style> element contains style information for a document, or part of a document. it contains css, which is applied to the contents of the document containing the <style> element. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the <style> element must be included inside the <head> of the document. in general, it is better to put your styles in external stylesheets and apply them using <link> elements. ...
...ve example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the <style> element must be included inside the <head> of the document. in general, it is better to put your styles in external stylesheets and apply them using <link> elements. ...
... attributes this element includes the global attributes. ...
...And 10 more matches
font-style - CSS: Cascading Style Sheets
the font-style css property sets whether a font should be styled with a normal, italic, or oblique face from its font-family. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. italic font faces are generally cursive in nature, usually using less horizontal space than their unstyled counterparts, while oblique faces are usually just sloped versions of the regular face. when the specified style is not available, both italic and oblique faces are simulated by artificially sloping the glyphs of the regular face (use font-synthesis to control this behavior). ...
... italic font faces are generally cursive in nature, usually using less horizontal space than their unstyled counterparts, while oblique faces are usually just sloped versions of the regular face. when the specified style is not available, both italic and oblique faces are simulated by artificially sloping the glyphs of the regular face (use font-synthesis to control this behavior). syntax font-style: normal; font-style: italic; font-style: oblique; font-style: oblique 10deg; /* global values */ font-style: inherit; font-style: initial; font-style: unset; the font-style property is specified as a single keyword chosen from the list of values below, which can optionally include an angle if the keyword is oblique. values normal selects a font that is classified as normal within a font-f...
...perty is specified as a single keyword chosen from the list of values below, which can optionally include an angle if the keyword is oblique. values normal selects a font that is classified as normal within a font-family. italic selects a font that is classified as italic. if no italic version of the face is available, one classified as oblique is used instead. if neither is available, the style is artificially simulated. oblique selects a font that is classified as oblique. if no oblique version of the face is available, one classified as italic is used instead. if neither is available, the style is artificially simulated. oblique <angle> selects a font classified as oblique, and additionally specifies an angle for the slant of the text. if one or more oblique faces are available in...
...And 9 more matches
Alternative style sheets - CSS: Cascading Style Sheets
specifying alternative style sheets in a web page provides a way for users to see multiple versions of a page, based on their needs or preferences. firefox lets the user select the stylesheet using the view > page style submenu. internet explorer also supports this feature (beginning with ie 8), also accessed from view > page style. chrome requires an extension to use the feature (as of version 48). the web page can also provide its own user interface to let the user switch styles. an example: specifying the alternative stylesheets the alternate stylesheets are commonly specified using a <link> element with rel="alternate stylesheet" and title="..." attributes. ...
...m view > page style. chrome requires an extension to use the feature (as of version 48). the web page can also provide its own user interface to let the user switch styles. an example: specifying the alternative stylesheets the alternate stylesheets are commonly specified using a <link> element with rel="alternate stylesheet" and title="..." attributes. ...
... feature (as of version 48). the web page can also provide its own user interface to let the user switch styles. an example: specifying the alternative stylesheets the alternate stylesheets are commonly specified using a <link> element with rel="alternate stylesheet" and title="..." attributes. ...
...And 8 more matches
border-bottom-style - CSS: Cascading Style Sheets
the border-bottom-style css property sets the line style of an element's bottom border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: the specification doesn't define how borders of different styles connect in the corners. ...
...e of an element's bottom border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: the specification doesn't define how borders of different styles connect in the corners. ...
...rder. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: the specification doesn't define how borders of different styles connect in the corners. ...
...And 8 more matches
outline-style - CSS: Cascading Style Sheets
the outline-style css property sets the style of an element's outline. an outline is a line that is drawn around an element, outside the border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. it is often more convenient to use the shorthand property outline when defining the appearance of an outline. ...
...nt, outside the border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. it is often more convenient to use the shorthand property outline when defining the appearance of an outline. syntax /* keyword values */ outline-style: auto; outline-style: none; outline-style: dotted; outline-style: dashed; outline-style: solid; outline-style: double; outline-style: groove; outline-style: ridge; outline-style: inset; outline-style: outset; /* global values */ outline-style: inherit; outline-style: initial; outline-style: unset; the outline-style property is specified as any one of the values listed below. values auto ...
... none no outline is used. the outline-width is 0. dotted the outline is a series of dots. dashed the outline is a series of short line segments. solid the outline is a single line. double the outline is two single lines. the outline-width is the sum of the two lines and the space between them. ...
...And 8 more matches
border-top-style - CSS: Cascading Style Sheets
the border-top-style css property sets the line style of an element's top border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the specification doesn't define how borders of different styles connect in the corners. ...
... line style of an element's top border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the specification doesn't define how borders of different styles connect in the corners. ...
...t's top border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the specification doesn't define how borders of different styles connect in the corners. ...
...And 7 more matches
transform-style - CSS: Cascading Style Sheets
the transform-style css property sets whether children of an element are positioned in the 3d space or are flattened in the plane of the element. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. if flattened, the element's children will not exist on their own in the 3d-space. as this property is not inherited, it must be set for all non-leaf descendants of the element. ...
...stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. if flattened, the element's children will not exist on their own in the 3d-space. as this property is not inherited, it must be set for all non-leaf descendants of the element. syntax /* keyword values */ transform-style: flat; transform-style: preserve-3d; /* global values */ transform-style: inherit; transform-style: initial; transform-style: unset; values flat indicates that the children of the element are lying in the plane of the element itself. preserve-3d indicates that the children of the element should be positioned in the 3d-space. formal definition initial valueflatapplies totransformable e...
...t indicates that the children of the element are lying in the plane of the element itself. preserve-3d indicates that the children of the element should be positioned in the 3d-space. formal definition initial valueflatapplies totransformable elementsinheritednocomputed valueas specifiedanimation typediscretecreates stacking contextyes formal syntax flat | preserve-3d examples transform style demonstration in this example we have a 3d cube created using transforms. the parent container of the cube faces has transform-style: preserve-3d set on it by default, so it is transformed in the 3d space and you can see it as intended. we also provide a checkbox allowing you to toggle between this, and transform-style: flat. in this alternative state, the cube faces are all flattened onto the ...
...And 6 more matches
CSSStyleRule.styleMap - Web APIs
working draft initial definition. ...
... working draft initial definition. ...
... working draft initial definition. ...
...And 5 more matches
column-rule-style - CSS: Cascading Style Sheets
the column-rule-style css property sets the style of the line drawn between columns in a multi-column layout. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... the column-rule-style css property sets the style of the line drawn between columns in a multi-column layout. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... the column-rule-style css property sets the style of the line drawn between columns in a multi-column layout. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 4 more matches
border-block-end-style - CSS: Cascading Style Sheets
the border-block-end-style css property defines the style of the logical block-end border of an element, which maps to a physical border style depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-style, border-right-style, border-bottom-style, or border-left-style property depending on the values defined for writing-mode, direction, and text-orientation. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...rder-right-style, border-bottom-style, or border-left-style property depending on the values defined for writing-mode, direction, and text-orientation. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <'border-style'> values */ border-block-end-style: dashed; border-block-end-style: dotted; border-block-end-style: groove; related properties are border-block-start-style, border-inline-start-style, and border-inline-end-style, which define the other border styles of the element. values <'border-style'> the line style of the border. see border-style. formal definition initial valuenoneapplies toall el...
...tyle: groove; related properties are border-block-start-style, border-inline-start-style, and border-inline-end-style, which define the other border styles of the element. values <'border-style'> the line style of the border. see border-style. ...
...And 2 more matches
border-block-start-style - CSS: Cascading Style Sheets
the border-block-start-style css property defines the style of the logical block start border of an element, which maps to a physical border style depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-style, border-right-style, border-bottom-style, or border-left-style property depending on the values defined for writing-mode, direction, and text-orientation. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...rder-right-style, border-bottom-style, or border-left-style property depending on the values defined for writing-mode, direction, and text-orientation. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <'border-style'> values */ border-block-start-style: dashed; border-block-start-style: dotted; border-block-start-style: groove; related properties are border-block-end-style, border-inline-start-style, and border-inline-end-style, which define the other border styles of the element. values <'border-style'> the line style of the border. see border-style. formal definition initial valuenoneapplies toal...
...-style: groove; related properties are border-block-end-style, border-inline-start-style, and border-inline-end-style, which define the other border styles of the element. values <'border-style'> the line style of the border. see border-style. ...
...And 2 more matches
border-inline-start-style - CSS: Cascading Style Sheets
the border-inline-start-style css property defines the style of the logical inline start border of an element, which maps to a physical border style depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-style, border-right-style, border-bottom-style, or border-left-style property depending on the values defined for writing-mode, direction, and text-orientation. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...rder-right-style, border-bottom-style, or border-left-style property depending on the values defined for writing-mode, direction, and text-orientation. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <'border-style'> values */ border-inline-start-style: dashed; border-inline-start-style: dotted; border-inline-start-style: groove; related properties are border-block-start-style, border-block-end-style, and border-inline-end-style, which define the other border styles of the element. ...
...style'> values */ border-inline-start-style: dashed; border-inline-start-style: dotted; border-inline-start-style: groove; related properties are border-block-start-style, border-block-end-style, and border-inline-end-style, which define the other border styles of the element. initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete values <'border-style'> the line style of the border. see border-style. ...
...And 2 more matches
list-style-position - CSS: Cascading Style Sheets
the list-style-position css property sets the position of the ::marker relative to a list item. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. it is often more convenient to use the shorthand list-style. note: this property is applied to list items, i.e., elements with display: list-item;. by default this includes <li> elements. because this property is inherited, it can be set on the parent element (normally <ol> or <ul>) to let it apply to all list items. ...
... note: this property is applied to list items, i.e., elements with display: list-item;. by default this includes <li> elements. because this property is inherited, it can be set on the parent element (normally <ol> or <ul>) to let it apply to all list items. ...
...ems. note that there is variance among browsers regarding behavior when a block element is placed first within a list element declared as list-style-position: inside. chrome and safari both place this element on the same line as the marker box, whereas firefox, internet explorer, and opera place it on the next line. for more information on this, see bug 36854. syntax /* keyword values */ list-style-position: inside; list-style-position: outside; /* global values */ list-style-position: inherit; list-style-position: initial; list-style-position: unset; the list-style-position property is specified as one of the keyword values listed below. values inside the ::marker is the first element among the list item's contents. outside the ::marker is outside the principal block box. forma...
...And 2 more matches
border-block-style - CSS: Cascading Style Sheets
the border-block-style css property defines the style of the logical block borders of an element, which maps to a physical border style depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-style and border-bottom-style, or border-left-style and border-right-style properties depending on the values defined for writing-mode, direction, and text-orientation. /* <'border-style'> values */ border-block-style: dashed; border-block-style: dotted; border-block-style: groove; the border style in the other dimension can be set with border-inline-style, which sets border-inline-start-style, and border-inline-end-style. syntax values <'border-style'> the line style of the border. see border-style. formal definition initial va...
...lock-style: groove; the border style in the other dimension can be set with border-inline-style, which sets border-inline-start-style, and border-inline-end-style. syntax values <'border-style'> the line style of the border. see border-style. ...
... editor's draft initial definition ...
... editor's draft initial definition ...
border-inline-end-style - CSS: Cascading Style Sheets
the border-inline-end-style css property defines the style of the logical inline end border of an element, which maps to a physical border style depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-style, border-right-style, border-bottom-style, or border-left-style property depending on the values defined for writing-mode, direction, and text-orientation. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...rder-right-style, border-bottom-style, or border-left-style property depending on the values defined for writing-mode, direction, and text-orientation. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <'border-style'> values */ border-inline-end-style: dashed; border-inline-end-style: dotted; border-inline-end-style: groove; related properties are border-block-start-style, border-block-end-style, and border-inline-start-style, which define the other border styles of the element. values <'border-style'> the line style of the border. see border-style. formal definition initial valuenoneapplies toall ...
...style: groove; related properties are border-block-start-style, border-block-end-style, and border-inline-start-style, which define the other border styles of the element. values <'border-style'> the line style of the border. see border-style. ...
...le. formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <'border-top-style'> examples html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; border: 5px solid blue; border-inline-end-style: dashed; } results specifications specification status comment css logical properties and values level 1the definition of 'border-inline-end-style' in that specification. editor's draft initial definition ...
border-inline-style - CSS: Cascading Style Sheets
the border-inline-style css property defines the style of the logical inline borders of an element, which maps to a physical border style depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top-style and border-bottom-style, or border-left-style and border-right-style properties depending on the values defined for writing-mode, direction, and text-orientation. /* <'border-style'> values */ border-inline-style: dashed; border-inline-style: dotted; border-inline-style: groove; the border style in the other dimension can be set with border-block-style, which sets border-block-start-style, and border-block-end-style. syntax values <'border-style'> the line style of the border. see border-style. formal definition initial valuenonea...
...-inline-style: groove; the border style in the other dimension can be set with border-block-style, which sets border-block-start-style, and border-block-end-style. syntax values <'border-style'> the line style of the border. see border-style. ...
... editor's draft initial definition ...
... editor's draft initial definition ...
text-decoration-style - CSS: Cascading Style Sheets
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. if the specified decoration has a specific semantic meaning, like a line-through line meaning that some text has been deleted, authors are encouraged to denote this meaning using an html tag, like <del> or <s>. as browsers can disable styling in some cases, the semantic meaning won't disappear in such a situation. ...
...e text has been deleted, authors are encouraged to denote this meaning using an html tag, like <del> or <s>. as browsers can disable styling in some cases, the semantic meaning won't disappear in such a situation. when setting multiple line-decoration properties at once, it may be more convenient to use the text-decoration shorthand property instead. syntax /* keyword values */ text-decoration-style: solid; text-decoration-style: double; text-decoration-style: dotted; text-decoration-style: dashed; text-decoration-style: wavy; /* global values */ text-decoration-style: inherit; text-decoration-style: initial; text-decoration-style: unset; values solid draws a single line. double draws a double line. dotted draws a dotted line. dashed draws a dashed line. wavy draws a wavy line...
...no line. use text-decoration-line: none instead. formal definition initial valuesolidapplies toall elements. ...
...s to ::first-letter and ::first-line.inheritednocomputed valueas specifiedanimation typediscrete formal syntax solid | double | dotted | dashed | wavy examples setting a wavy underline .example { -moz-text-decoration-line: underline; -moz-text-decoration-style: wavy; -moz-text-decoration-color: red; -webkit-text-decoration-line: underline; -webkit-text-decoration-style: wavy; -webkit-text-decoration-color: red; } css .wavy { text-decoration-line: underline; text-decoration-style: wavy; text-decoration-color: red; } html <p class="wavy">this text has a wavy red line beneath it.</p> results specifications specification status comment css text decoration module level 3the definition of 'text-decoration-style' in tha...
<xsl:stylesheet> - XSLT: Extensible Stylesheet Language Transformations
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:stylesheet> element (or the equivalent <xsl:transform> element) is the outermost element of a stylesheet. namespace declaration a pseudo-attribute required to identify the document as an xslt stylesheet. typically this is xmlns:xsl="http://www.w3.org/1999/xsl/transform". syntax <xsl:stylesheet version="number" xmlns:xsl="http://www.w3.org/1999/xsl/transform" id="name" extension-element-prefixes="list-of-names" exclude-result-prefixes="list-of-names"> entire stylesheet </xsl:stylesheet> required attributes version specifies the version of xslt required by this stylesheet. optional attributes exclude-result-prefixes specifies any namespace used in this document that shou...
...-mode defines the default value for the mode attribute of all <xsl:template> and <xsl:apply-templates> elements within its scope. default-validation defines the default value of the validation attribute of all relevant instructions appearing within its scope. expand-text determines whether descendant text nodes of the element are treated as text value templates. ...
... attribute of all <xsl:template> and <xsl:apply-templates> elements within its scope. default-validation defines the default value of the validation attribute of all relevant instructions appearing within its scope. expand-text determines whether descendant text nodes of the element are treated as text value templates. id specifies an id for this stylesheet. this is most often used when the stylesheet is embedded in another xml document. input-type-annotations specifies whether type annotations are stripped from the element so the same results are produced whether the source documents have been validated against a schema or not. use-when determines whether the element and all the nodes that have it as ancestor are excluded from the stylesheet. xpath-default-namespace specifies the n...
...re produced whether the source documents have been validated against a schema or not. use-when determines whether the element and all the nodes that have it as ancestor are excluded from the stylesheet. xpath-default-namespace specifies the namespace that will be used if the element name is unprefixed or an unprefixed type name within an xpath expression. type required outermost element of stylesheet. specifications specification status comment xslt 3.0the definition of '<xsl:stylesheet>' in that specification. recommendation added the attributes default-mode, expand-text, and use-when. xslt 2.0 added the attributes xpath-default-namespace, default-validation, default-collation, and input-type-annotations and made all attributes except ...
stylesheet/style - Archive of obsolete content
experimental modify styles using stylesheet files or css rules. globals constructors style(options) the style constructor creates an object that represents style modifications via stylesheet file(s) or/and css rules. stylesheet file url(s) are verified to be local to an add-on, while css rules are verified to be a string or array of strings. the style created can be applied to a content by calling attach, and removed using detach. those functions are part of content/mod module. parameters options : object required options: name type uri string,array a string, or an array of strings, that represents local uri to stylesheet. source string,array a string, or an array of strings, that contains css rules. those rules are a...
... detach. those functions are part of content/mod module. parameters options : object required options: name type uri string,array a string, or an array of strings, that represents local uri to stylesheet. source string,array a string, or an array of strings, that contains css rules. those rules are applied after the rules in the stylesheet specified with uri options, if provided. optional options: name type type string the type of the sheet. ...
... a string, or an array of strings, that contains css rules. those rules are applied after the rules in the stylesheet specified with uri options, if provided. optional options: name type type string the type of the sheet. it accepts the following values: "agent", "user" and "author". if not provided, the default value is "author". style properties source an array of strings that contains the css rule(s) specified in the constructor's option; null if no source option was given to the constructor. this property is read-only. uri an array of strings that contains the stylesheet local uri(s) specified in the constructor's option; null if no uri option was given to the constructor. this property is read-only. type the type of ...
list-style-image - CSS: Cascading Style Sheets
the list-style-image css property sets an image to be used as the list item marker. it is often more convenient to use the shorthand list-style. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: this property is applied to list items, i.e. elements with display: list-item; by default this includes <li> elements. because this property is inherited, it can be set on the parent element (normally <ol> or <ul>) to let it apply to all list items. ...
...ve examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: this property is applied to list items, i.e. elements with display: list-item; by default this includes <li> elements. because this property is inherited, it can be set on the parent element (normally <ol> or <ul>) to let it apply to all list items. syntax /* keyword values */ list-style-image: none; /* <url> values */ list-style-image: url('starsolid.gif'); /* global values */ list-style-image: inherit; list-style-image: initial; list-style-image: unset; values <url> location of image to use as the marker. none specifies that no image is used as the marker. if this value is set, the marker defined in list-style-type will be used instead. formal definition initial va...
...image is used as the marker. if this value is set, the marker defined in list-style-type will be used instead. formal definition initial valuenoneapplies tolist itemsinheritedyescomputed valuenone or the image with its uri made absoluteanimation typediscrete formal syntax <url> | none examples setting list item images html <ul> <li>item 1</li> <li>item 2</li> </ul> css ul { list-style-image: url("https://mdn.mozillademos.org/files/11981/starsolid.gif"); } result specifications specification status comment css lists module level 3the definition of 'list-style-image' in that specification. working draft extends support to any <image> data type. css level 2 (revision 1)the definition of 'list-style-image' in that specification. r...
text-emphasis-style - CSS: Cascading Style Sheets
the text-emphasis-style css property sets the appearance of emphasis marks. it can also be set, and reset, using the text-emphasis shorthand. /* initial value */ text-emphasis-style: none; /* no emphasis marks */ /* <string> values */ text-emphasis-style: 'x'; text-emphasis-style: '点'; text-emphasis-style: '\25b2'; text-emphasis-style: '*'; text-emphasis-style: 'foo'; /* should not be used. ...
...also be set, and reset, using the text-emphasis shorthand. /* initial value */ text-emphasis-style: none; /* no emphasis marks */ /* <string> values */ text-emphasis-style: 'x'; text-emphasis-style: '点'; text-emphasis-style: '\25b2'; text-emphasis-style: '*'; text-emphasis-style: 'foo'; /* should not be used. it may be computed to or rendered as 'f' only */ /* keyword values */ text-emphasis-style: filled; text-emphasis-style: open; text-emphasis-style: dot; text-emphasis-style: circle; text-emphasis-style: double-circle; text-emphasis-style: triangle; text-emphasis-style: filled sesame; text-emphasis-style: open sesame; /* global values */ text-emphasis-style: inherit; text-emphasis-style: initial; text-emphasis-style: unset; syntax values none no emphasis marks. filled the shap...
...ld not specify more than one character in <string>. the ua may truncate or ignore strings consisting of more than one grapheme cluster. formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax none | [ [ filled | open ] | [ dot | circle | double-circle | triangle | sesame ] ] | <string> examples h2 { text-emphasis-style: sesame; } specifications specification status comment css text decoration module level 3the definition of 'text-emphasis' in that specification. candidate recommendation initial definition ...
CSSStyleRule.style - Web APIs
the cssrule.style property is the cssstyledeclaration interface for the declaration block of the cssrule. syntax styleobj = cssrule.style example function stilo() { alert(document.stylesheets[0].cssrules[0].style.csstext); } // displays "background-color: gray;" notes the declaration block is that part of the style rule that appears within the braces and that actually provides the style definitions (for the selector, the part that comes before the braces). ...
StyleSheet.parentStyleSheet - Web APIs
the parentstylesheet property of the stylesheet interface returns the style sheet, if any, that is including the given style sheet. syntax objref = stylesheet.parentstylesheet example // find the top level stylesheet if (stylesheet.parentstylesheet) { sheet = stylesheet.parentstylesheet; } else { sheet = stylesheet; } notes this property returns null if the current stylesheet is a top-level stylesheet or if stylesheet inclusion is not supported. specifications specification status comment css object model (cssom)the definition of 'stylesheet: parentstylesheet' in that specification. working draft ...
CSS Counter Styles - CSS: Cascading Style Sheets
css counter styles is a module of css that lets you define your own counter styles. reference properties counter-increment counter-reset at-rules @counter-style system additive-symbols negative prefix suffix range pad speak-as fallback guides using css counters describes how to use counters to number any html element or to perform complex counting. specifications specification status comment css counter styles level 3 candidate recommendation initial definition. ...
filter - CSS: Cascading Style Sheets
Web › CSS › filter
age. the value of radius defines the value of the standard deviation to the gaussian function, or how many pixels on the screen blend into each other, so a larger value will create more blur. the lacuna value for interpolation is 0. the parameter is specified as a css length, but does not accept percentage values. ...
... to the gaussian function, or how many pixels on the screen blend into each other, so a larger value will create more blur. the lacuna value for interpolation is 0. the parameter is specified as a css length, but does not accept percentage values. ...
...into each other, so a larger value will create more blur. the lacuna value for interpolation is 0. the parameter is specified as a css length, but does not accept percentage values. ...
...And 59 more matches
Style System Overview - Archive of obsolete content
style system style sheets & rules ↓ rule tree ↓ style context interface style sheets & rules nsistyleruleprocessor and nsistylesheet describe in c++ what a css stylesheet can do nsistylerule describes in c++ what a css style rule can do main implementations are for css, but we have other implementations in c++ that: do what css can't do do things faster than css would css style sheets at basic level, sheet is collection of rules other special things: @import, @media, @namespace, etc. a rule is a selector and a declaration block. a declaration block is a group of declarations. a declaration is a property and a value. ...
... rule applies to matched elements. “cascaded” value for property + element: if 0 rules matching the element have the property: some properties inherit and some properties use initial value. inherited: 'font-size', 'color', etc. ...
... rule applies to matched elements. “cascaded” value for property + element: if 0 rules matching the element have the property: some properties inherit and some properties use initial value. inherited: 'font-size', 'color', etc. “reset”: 'border', 'background', etc. ...
...And 45 more matches
Applying styles and colors - Web APIs
« previousnext » in the chapter about drawing shapes, we used only the default line and fill styles. here we will explore the canvas options we have at our disposal to make our drawings a little more attractive. you will learn how to add different colors, line styles, gradients, patterns and shadows to your drawings. colors up until now we have only seen methods of the drawing context. if we want to apply colors to a shape, there are two important properties we can use: fillstyle and strokestyle. fillstyle = color sets the style used when filling shapes. strokestyle = color sets the style for shapes' outlines. color is a string representing a css <color>, a gradient object, or a pattern object. we'll look at gradient and pattern objects later. by default, the stro...
...fillstyle and strokestyle. fillstyle = color sets the style used when filling shapes. strokestyle = color sets the style for shapes' outlines. color is a string representing a css <color>, a gradient object, or a pattern object. we'll look at gradient and pattern objects later. by default, the stroke and fill color are set to black (css color value #000000). note: when you set the strokestyle and/or fillstyle property, the new value becomes the default for all shapes being drawn from then on. for every shape you want in a different color, you will need to reassign the fillstyle or strokestyle property. the valid strings you can enter should, according to the specification, be css <color> values. each of the following examples describe the same color. ...
...the resulting image should look something like the screenshot. there is nothing too spectacular happening here. ...
...And 34 more matches
Mozilla Style System Documentation
see also the style techtalk for more complete although less detailed documentation. style context management a style context (class nsstylecontext, currently also interface nsistylecontext although the interface should go away when all of the style systems can be moved back into the layout dll) represents the style data for a css formatting object. in the layout system, these formatting objects are described as frames (interface nsiframe), although a pair of frames represents table formatting objects. the css specification describes formatting objects that correspond to elements in the content model and formatting objects that correspond to pseudo-elements. ...
...ystem, these formatting objects are described as frames (interface nsiframe), although a pair of frames represents table formatting objects. the css specification describes formatting objects that correspond to elements in the content model and formatting objects that correspond to pseudo-elements. ...
...matting objects. the css specification describes formatting objects that correspond to elements in the content model and formatting objects that correspond to pseudo-elements. (mozilla has a bunch of its pseudo-elements that are not in the css specification.) we also create style contexts for some things that are not css formatting objects: text nodes and placeholder frames. these three types of style contexts correspond to the three ways of creating a style context: nsiprescontext::resolvestylecontextfor, nsiprescontext::resolvepseudostylecontextfor, and.nsiprescontext::resolvestylecontextfornonelement there is also a fourth method, nsiprescontext::probepseudostylecontextfor, which creates a style context only if there are style rules that match the pseudo-element. this is useful for the pseu...
...And 32 more matches
system - CSS: Cascading Style Sheets
if the algorithm specified in the system descriptor is unable to construct the representation for a particular counter value, then that value's representation will be constructed using the fallback system provided. ...
...es */ system: cyclic; system: numeric; system: alphabetic; system: symbolic; system: additive; system: fixed; /* combined values */ system: fixed 3; system: extends decimal; this may take one of three forms: one of the keyword values cyclic, numeric, alphabetic, symbolic, additive, or fixed. the keyword value fixed along with an integer. the keyword value or extends along with a @counter-style name. cyclic cycles through the list of symbols provided. once the end of the list of symbols is reached, it will loop back to the beginning and start over. this system is useful for simple bullet styles with just one symbol, or for styles having multiple symbols. at least one symbol must be specified in the symbols descriptor, or the counter style is not valid. fixed defines a finite ...
...also an optional <integer> can be specified after the the system, as the value of the first symbol. if this integer is omitted, value of the first integer is taken as 1. symbolic cycles through the provided list of symbols. ...
...And 24 more matches
CSP: style-src - HTTP
the http content-security-policy (csp) style-src directive specifies valid sources for stylesheets. csp version 1 directive type fetch directive default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. syntax one or more sources can be allowed for the style-src policy: content-security-policy: style-src <source>; content-security-policy: style-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip address, as well as an optional url scheme and/or port number. the site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal...
......
...ce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. see unsafe inline script for an example. in csp 2.0, this applie...
...And 23 more matches
Using the Stylesheet Service - Archive of obsolete content
the examples in this document are all written in javascript using xpcom. using the api the string "chrome://myext/content/myext.css" in the examples below is just an example. replace it with the url of the css file you want to load. you can replace user_sheet with agent_sheet or author_sheet, depending where in the css cascade you want the sheet to be placed. ...
... the examples in this document are all written in javascript using xpcom. using the api the string "chrome://myext/content/myext.css" in the examples below is just an example. replace it with the url of the css file you want to load. you can replace user_sheet with agent_sheet or author_sheet, depending where in the css cascade you want the sheet to be placed. ...
...cument are all written in javascript using xpcom. using the api the string "chrome://myext/content/myext.css" in the examples below is just an example. replace it with the url of the css file you want to load. you can replace user_sheet with agent_sheet or author_sheet, depending where in the css cascade you want the sheet to be placed. see the css specification for more details. ...
...And 18 more matches
Box-shadow generator - CSS: Cascading Style Sheets
et" data-topic="height" data-type="add"></div> <div class="ui-slider-input" data-topic="height" data-unit="px"></div> </div> </div> </div> <div id="output" class="category"> <div id="menu" class="menu"></div> <div class="title"> css code </div> <div class="group" style="border-top-left-radius: 0;"> <div class="output" data-topic="element" data-name="element" data-prop="width height background-color position=[relative] box-shadow"> </div> <div class="output" data-topic="before" data-name="element:before" data-prop="content=[&quot;&quot;] position=[absolute...
...s.max - this.min; var offset = this.pointer.clientwidth + 4; // border width * 2 if (pos < 0) pos = 0; if (pos > width) pos = width; var value = pos * delta / width | 0; var precision = value % this.step; value = value - precision + this.min; if (precision > this.step / 2) value = value + this.step; if (this.snap) pos = (value - this.min) * width / delta; this.pointer.style.left = pos - offset/2 + "px"; this.value = value; node.setattribute('data-value', value); notify.call(this); } var setvalue = function setvalue(topic, value) { var slider = sliders[topic]; if (value > slider.max || value < slider.min) return; var delta = slider.max - slider.min; var width = slider.node.clientwidth; var offset = slider.pointer.clientwidth; var pos = (val...
...ata-value', value); notify.call(this); } var setvalue = function setvalue(topic, value) { var slider = sliders[topic]; if (value > slider.max || value < slider.min) return; var delta = slider.max - slider.min; var width = slider.node.clientwidth; var offset = slider.pointer.clientwidth; var pos = (value - slider.min) * width / delta; slider.value = value; slider.pointer.style.left = pos - offset / 2 + "px"; slider.node.setattribute('data-value', value); notify.call(slider); } var setmousetracking = function setmousetracking(elem, callback) { elem.addeventlistener("mousedown", function(e) { callback(e); document.addeventlistener("mousemove", callback); }); document.addeventlistener("mouseup", function(e) { document.removeeventlistener("mousemove"...
...And 18 more matches
font - CSS: Cascading Style Sheets
Web › CSS › font
that is not specified is set to its corresponding initial value (possibly overriding values previously set using non-shorthand properties). though not directly settable by font, the longhands font-size-adjust and font-kerning are also reset to their initial values. constituent properties this property is a shorthand for the following css properties: font-family font-size font-stretch font-style font-variant font-weight line-height syntax the font property may be specified as either a single keyword, which will select a system font, or as a shorthand for various font-related properties. if font is specified as a system keyword, it must be one of: caption, icon, menu, message-box, small-caption, status-bar. if font is specified as a shorthand for several font-related properties, t...
...lect a system font, or as a shorthand for various font-related properties. if font is specified as a system keyword, it must be one of: caption, icon, menu, message-box, small-caption, status-bar. if font is specified as a shorthand for several font-related properties, then: it must include values for: <font-size> <font-family> it may optionally include values for: <font-style> <font-variant> <font-weight> <font-stretch> <line-height> font-style, font-variant and font-weight must precede font-size font-variant may only specify the values defined in css 2.1, that is normal and small-caps font-stretch may only be a single keyword value. line-height must immediately follow font-size, preceded by "/", like this: "16px/3" font-family must be the last v...
... <'font-variant'> see the font-variant css property. <'font-weight'> see the font-weight css property. <'font-stretch'> see the font-stretch css property. <'font-size'> see the font-size css property. <'line-height'> see the line-height css property. <'font-family'> see the font-family css property. ...
...And 17 more matches
CSSStyleSheet - Web APIs
the cssstylesheet interface represents a single css stylesheet, and lets you inspect and modify the list of rules contained in the stylesheet. it inherits properties and methods from its parent, stylesheet. a stylesheet consists of a collection of cssrule objects representing each of the rules in the stylesheet. the rules are contained in a cssrulelist, which can be obtained from the stylesheet's cssrules property. for example, one rule might be a cssstylerule object containing a style such as: h1, h2 { font-size: 16pt; } another rule might be an at-rule such as @import or @media, and so forth. see the notes section for the various ways a cssstylesheet object can be obtained. properties inherits properties from its parent, stylesheet. cssrules read only returns a live cssrulel...
... a style such as: h1, h2 { font-size: 16pt; } another rule might be an at-rule such as @import or @media, and so forth. see the notes section for the various ways a cssstylesheet object can be obtained. properties inherits properties from its parent, stylesheet. cssrules read only returns a live cssrulelist which maintains an up-to-date list of the cssrule objects that comprise the stylesheet. this is normally used to access individual rules like this: stylesheet.cssrules[i] // where i = 0..cssrules.length-1 to add or remove items in cssrules, use the cssstylesheet's insertrule() and deleterule() methods. ...
...et. cssrules read only returns a live cssrulelist which maintains an up-to-date list of the cssrule objects that comprise the stylesheet. this is normally used to access individual rules like this: stylesheet.cssrules[i] // where i = 0..cssrules.length-1 to add or remove items in cssrules, use the cssstylesheet's insertrule() and deleterule() methods. ownerrule read only if this stylesheet is imported into the document using an @import rule, the ownerrule property returns the corresponding cssimportrule; otherwise, this property's value is null. methods inherits methods from its parent, stylesheet. ...
...And 16 more matches
Introducing the CSS Cascade - CSS: Cascading Style Sheets
Web › CSS › Cascade
this article explains what the cascade is, the order in which css declarations cascade, and how this affects you, the web developer. which css entities participate in the cascade only css declarations, that is property/value pairs, participate in the cascade. this means that at-rules containing entities other than declarations, such as a @font-face rule containing descriptors, don't participate in the cascade. ...
...e, only the at-rule as a whole is selected via the cascade algorithm. finally, note that @import and @charset obey specific algorithms and aren't affected by the cascade algorithm. origin of css declarations the css cascade algorithm's job is to select css declarations in order to determine the correct values for css properties. ...
... whole is selected via the cascade algorithm. finally, note that @import and @charset obey specific algorithms and aren't affected by the cascade algorithm. origin of css declarations the css cascade algorithm's job is to select css declarations in order to determine the correct values for css properties. ...
...And 16 more matches
Adding Style Sheets - Archive of obsolete content
« previousnext » we have hardly modified the look of the elements we have created so far. xul uses css (cascading style sheets) to customize elements. style sheets a style sheet is a file which contains style information for elements. it was originally designed for html elements but can be applied to xul elements also, or to any xml for that matter. the style sheet contains information such as the fonts, colors, borders, and size of elements. mozilla applies a default style sheet to each xul window. in many cases, it will suffice to leave the defaults as is. other times, however, you will want to provide a custom style sheet. in general, you will associate a single style sheet with each xul file. you can place a style sheet anywhere you wish. if your xul file is stored remotely...
...this method has the disadvantage because it means your application will not be themeable. the second method involves placing your files as part of a theme. ...
...want to provide a custom style sheet. in general, you will associate a single style sheet with each xul file. you can place a style sheet anywhere you wish. if your xul file is stored remotely and accessed via an http url, you can store the style sheet remotely as well. if you are creating a xul package to be installed as part of the chrome system, you have two choices. first, you could store the style sheet in the same directory as the xul file. this method has the disadvantage because it means your application will not be themeable. the second method involves placing your files as part of a theme. ...
...And 15 more matches
Mozilla Style System
the style system is the module of mozilla's code responsible for the loading and parsing of css style sheets, and the computation of computed values for all css properties. the handling of those computed values is the responsibility of other parts of the code. architecture the style system is split in half rather neatly. in one half (the backend) are the sources of specified style data, and in the other half (the frontend) is the code that turns the specified values into computed values. ...
...rts of the code. architecture the style system is split in half rather neatly. in one half (the backend) are the sources of specified style data, and in the other half (the frontend) is the code that turns the specified values into computed values. the barrier between these two halves consists of three abstract interfaces, plus some smaller structures associated with some methods on each: nsistylesheet nsistylesheet represents what one would think of as a style sheet: the in-memory representation of a css file or other source of style data. some style sheets are managed by the document; some apply to all documents. the style system actually has relatively little to do with style sheets; it instead deals with style rule processors. ...
... associated with some methods on each: nsistylesheet nsistylesheet represents what one would think of as a style sheet: the in-memory representation of a css file or other source of style data. some style sheets are managed by the document; some apply to all documents. the style system actually has relatively little to do with style sheets; it instead deals with style rule processors. nsistyleruleprocessor a style rule processor represents an origin within the css cascade. thus there is a single style rule processor for all user-agent css style sheets, a single style rule processor for all user css style sheets, and a single style rule processor for all author css style sheets. ...
...And 13 more matches
CSSStyleSheet.insertRule() - Web APIs
the default is 0. ...
...the default is 0. ...
...the default is 0. ...
...And 13 more matches
CSS reference - CSS: Cascading Style Sheets
Web › CSS › Reference
use this css reference to browse an alphabetical index of all of the standard css properties, pseudo-classes, pseudo-elements, data types, and at-rules. you can also browse key css concepts and a list of selectors organized by type. also included is a brief dom-css / cssom reference. basic rule syntax style rule syntax style-rule ::= selectors-list { properties-list } ... ...
...e-rule ::= selectors-list { properties-list } ... where : selectors-list ::= selector[:pseudo-class] [::pseudo-element] [, selectors-list] properties-list ::= [property : value] [; properties-list] see the index of selectors, pseudo-classes, and pseudo-elements below. the syntax for each specified value depends on the data type defined for each specified property. style rule examples strong { color: red; } div.menu-bar li:hover > ul { display: block; } for a beginner-level introduction to the syntax of selectors, see our guide on css selectors. be aware that any syntax error in a rule definition invalidates the entire rule. invalid rules are ignored by the browser. note that css rule definitions are entirely (ascii) text-based, whereas dom-css / cssom (t...
... whereas dom-css / cssom (the rule management system) is object-based. at-rule syntax as the structure of at-rules varies widely, please see at-rule to find the syntax of the specific one you want. keyword index note: the property names in this index do not include the javascript names where they differ from the css standard names. ...
...And 13 more matches
Linear-gradient Generator - CSS: Cascading Style Sheets
ng_area.clientwidth; if (x > size) x = size; if (y > size) y = size; if (x < 0) x = 0; if (y < 0) y = 0; var value = 100 - (y * 100 / size) | 0; var saturation = x * 100 / size | 0; if (this.picker_mode === 'hsv') this.color.sethsv(this.color.hue, saturation, value); if (this.picker_mode === 'hsl') this.color.sethsl(this.color.hue, saturation, value); this.color_picker.style.left = x + 'px'; this.color_picker.style.top = y + 'px'; this.updatealphagradient(); this.updatepreviewcolor(); this.notify('value', value); this.notify('lightness', value); this.notify('saturation', saturation); this.notify('red', this.color.r); this.notify('green', this.color.g); this.notify('blue', this.color.b); this.notify('hexa', this.color.gethexa()); notify(this.
...********/ colorpicker.prototype.updatepickerposition = function updatepickerposition() { var size = this.picking_area.clientwidth; var value = 0; if (this.picker_mode === 'hsv') value = this.color.value; if (this.picker_mode === 'hsl') value = this.color.lightness; var x = (this.color.saturation * size / 100) | 0; var y = size - (value * size / 100) | 0; this.color_picker.style.left = x + 'px'; this.color_picker.style.top = y + 'px'; }; colorpicker.prototype.updatesliderposition = function updatesliderposition(elem, pos) { elem.style.left = pos + 'px'; }; colorpicker.prototype.updatehuepicker = function updatehuepicker() { var size = this.hue_area.clientwidth; var pos = (this.color.hue * size / 360 ) | 0; this.hue_picker.style.left = pos + 'px'; }; co...
...= pos + 'px'; }; colorpicker.prototype.updatehuepicker = function updatehuepicker() { var size = this.hue_area.clientwidth; var pos = (this.color.hue * size / 360 ) | 0; this.hue_picker.style.left = pos + 'px'; }; colorpicker.prototype.updatealphapicker = function updatealphapicker() { var size = this.alpha_mask.clientwidth; var pos = (this.color.a * size) | 0; this.alpha_picker.style.left = pos + 'px'; }; /*************************************************************************/ // update background colors /*************************************************************************/ colorpicker.prototype.updatepickerbackground = function updatepickerbackground() { var nc = new color(this.color); nc.sethsv(nc.hue, 100, 100); this.picking_area.style.backgroundc...
...And 13 more matches
border-inline-end - CSS: Cascading Style Sheets
the border-inline-end css property is a shorthand property for setting the individual logical inline-end border property values in a single place in the style sheet. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. constituent properties this property is a shorthand for the following css properties: border-inline-end-color border-inline-end-style border-inline-end-width syntax border-inline-end: 1px; border-inline-end: 2px dashed; border-inline-end: medium dashed blue; the physical border to which border-inline-end maps depends on the element's writing mode, directionality, and text orientation. it correspo...
...ing-mode, direction, and text-orientation. related properties are border-block-start, border-block-end, and border-inline-start, which define the other borders of the element. ...
...s are border-block-start, border-block-end, and border-inline-start, which define the other borders of the element. ...
...And 13 more matches
Color picker tool - CSS: Cascading Style Sheets
ng_area.clientwidth; if (x > size) x = size; if (y > size) y = size; if (x < 0) x = 0; if (y < 0) y = 0; var value = 100 - (y * 100 / size) | 0; var saturation = x * 100 / size | 0; if (this.picker_mode === 'hsv') this.color.sethsv(this.color.hue, saturation, value); if (this.picker_mode === 'hsl') this.color.sethsl(this.color.hue, saturation, value); this.color_picker.style.left = x - picker_offset + 'px'; this.color_picker.style.top = y - picker_offset + 'px'; this.updatealphagradient(); this.updatepreviewcolor(); this.notify('value', value); this.notify('lightness', value); this.notify('saturation', saturation); this.notify('red', this.color.r); this.notify('green', this.color.g); this.notify('blue', this.color.b); this.notify('hexa', this.c...
...icker.prototype.updatepickerposition = function updatepickerposition() { var size = this.picking_area.clientwidth; var value = 0; var offset = 5; if (this.picker_mode === 'hsv') value = this.color.value; if (this.picker_mode === 'hsl') value = this.color.lightness; var x = (this.color.saturation * size / 100) | 0; var y = size - (value * size / 100) | 0; this.color_picker.style.left = x - offset + 'px'; this.color_picker.style.top = y - offset + 'px'; }; colorpicker.prototype.updatesliderposition = function updatesliderposition(elem, pos) { elem.style.left = math.max(pos - 3, -2) + 'px'; }; colorpicker.prototype.updatehuepicker = function updatehuepicker() { var size = this.hue_area.clientwidth; var offset = 1; var pos = (this.color.hue * size / 360 ) | ...
...'px'; this.color_picker.style.top = y - offset + 'px'; }; colorpicker.prototype.updatesliderposition = function updatesliderposition(elem, pos) { elem.style.left = math.max(pos - 3, -2) + 'px'; }; colorpicker.prototype.updatehuepicker = function updatehuepicker() { var size = this.hue_area.clientwidth; var offset = 1; var pos = (this.color.hue * size / 360 ) | 0; this.hue_picker.style.left = pos - offset + 'px'; }; colorpicker.prototype.updatealphapicker = function updatealphapicker() { var size = this.alpha_area.clientwidth; var offset = 1; var pos = (this.color.a * size) | 0; this.alpha_picker.style.left = pos - offset + 'px'; }; /*************************************************************************/ // update background colors /*********************...
...And 12 more matches
StylePropertyMapReadOnly - Web APIs
the stylepropertymapreadonly interface of the the css typed object model api provides a read-only representation of a css declaration block that is an alternative to cssstyledeclaration. retrieve an instance of this interface using element.computedstylemap(). properties stylepropertymapreadonly.size returns an unsinged long integer containing the size of the stylepropertymapreadonly object. methods stylepropertymapreadonly.entries() returns an array of a given object's own enumerable property [key, value] pairs, in the same order as that provided by a for...in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well). stylepropertymapreadonly.foreach() executes a provided function once for each element of stylepropertymapreadonly. ...
.... methods stylepropertymapreadonly.entries() returns an array of a given object's own enumerable property [key, value] pairs, in the same order as that provided by a for...in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well). stylepropertymapreadonly.foreach() executes a provided function once for each element of stylepropertymapreadonly. stylepropertymapreadonly.get() returns the value of the specified property. stylepropertymapreadonly.getall() returns an array of cssstylevalue objects containing the values for the provided property. stylepropertymapreadonly.has() indicates whether the specified property is in the stylepropertymapreadonly object. ...
...cutes a provided function once for each element of stylepropertymapreadonly. stylepropertymapreadonly.get() returns the value of the specified property. stylepropertymapreadonly.getall() returns an array of cssstylevalue objects containing the values for the provided property. stylepropertymapreadonly.has() indicates whether the specified property is in the stylepropertymapreadonly object. stylepropertymapreadonly.keys() returns a new array iterator containing the keys for each item in stylepropertymapreadonly. stylepropertymapreadonly.values() returns a new array iterator containing the values for each index in the stylepropertymapreadonly object. ...
...And 11 more matches
border - CSS: Cascading Style Sheets
Web › CSS › border
the border shorthand css property sets an element's border. it sets the values of border-width, border-style, and border-color. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... the values of border-width, border-style, and border-color. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. constituent properties this property is a shorthand for the following css properties: border-color border-style border-width syntax /* style */ border: solid; /* width | style */ border: 2px dotted; /* style | color */ border: outset #f33; /* width | style | color */ border: medium dashed green; /* global values */ border: inherit; border: initial; border: unset; the border property may be specified using one, two, or three of the values listed below. the order of the values does not matter. no...
... <color> sets the color of the border. defaults to currentcolor if absent. see border-color. ...
...And 11 more matches
Variable fonts guide - CSS: Cascading Style Sheets
they let you access all the variations contained in a given font file via css and a single @font-face reference. this article will give you all you need to know to get you started using variable fonts. warning: in order to use variable fonts on your operating system, you need to make sure that it is up to date. ...
...onts in web pages or the firefox developer tools. variable fonts: what they are, and how they differ to better understand what's different about variable fonts, it is worth reviewing what non-variable ones are like and how they compare. standard (or static) fonts in the past, a typeface would be produced as a number of individual fonts, and each font would represent one specific width/weight/style combination. so you would have separate files for 'roboto regular', 'roboto bold', and 'roboto bold italic' — meaning that you could end up with 20 or 30 different font files to represent a complete typeface (it could be several times that for a large typeface that has different widths as well). in such a scenario, in order to use a typeface for typical use on a site for body copy you would ne...
...ing downloaded (usually around 20k or more per file). variable fonts with a variable font, all of those permutations can be contained in a single file. that file would be larger than a single font, but in most cases smaller or about the same size as the 4 you might load for body copy. the advantage in choosing the variable font is that you have access to the entire range of weights, widths, and styles available, rather than being constrained to only the few that you previously would have loaded separately. this allows for common typographic techniques such as setting different size headings in different weights for better readability at each size, or using a slightly narrower width for data-dense displays. for comparison, it is typical in a typographic system for a magazine to use 10–15 or...
...And 10 more matches
Window.getComputedStyle() - Web APIs
the window.getcomputedstyle() method returns an object containing the values of all css properties of an element, after applying active stylesheets and resolving any basic computation those values may contain. individual css property values are accessed through apis provided by the object, or by indexing with css property names. syntax var style = window.getcomputedstyle(element [, pseudoelt]); element the element for which to get the computed style. pseudoeltoptional a string specifying the pseudo-element to match. omitted (or null) for real elements. the returned style is a live cssstyledeclaration object, which updates automatically when the element's styles are changed. throws typeerror if the passed object is not an element or the pseudoelt is not a valid pseudo-element sel...
...omatically when the element's styles are changed. throws typeerror if the passed object is not an element or the pseudoelt is not a valid pseudo-element selector or is ::part() or ::slotted(). note: valid pseudo-element selector refers to syntactic validity, e.g. ::unsupported is considered valid, even though the pseudo-element itself is not supported. examples in this example we style a <p> element, then retrieve those styles using getcomputedstyle(), and print them into the text content of the <p>. ...
...supported. examples in this example we style a <p> element, then retrieve those styles using getcomputedstyle(), and print them into the text content of the <p>. html <p>hello</p> css p { width: 400px; margin: 0 auto; padding: 20px; font: 2rem/2 sans-serif; text-align: center; background: purple; color: white; } javascript let para = document.queryselector('p'); let compstyles = window.getcomputedstyle(para); para.textcontent = 'my computed font-size is ' + compstyles.getpropertyvalue('font-size') + ',\nand my computed line-height is ' + compstyles.getpropertyvalue('line-height') + '.'; result description the returned object is the same cssstyledeclaration type as the object returned from the element's style property. however, the two objects have...
...And 9 more matches
-moz-image-rect - CSS: Cascading Style Sheets
tage>, of the sub-image within the specified image. left the left edge, specified as an <integer> or <percentage>, of the sub-image within the specified image. description this property allows you to, for example, use different parts of one larger image as backgrounds in different parts of your content. this works very similarly to the -moz-image-region property, which is used with the list-style-image property to use parts of an image as the bullets in lists. however, this can be used for any css background. the syntax for the rectangle is similar to the rect() function generating a <<shape>()> css type. all four values are relative to the upper left corner of the image. examples this example loads an image and uses it in four segments to draw the firefox logo in four <div> blocks. cl...
...nerating a <<shape>()> css type. all four values are relative to the upper left corner of the image. examples this example loads an image and uses it in four segments to draw the firefox logo in four <div> blocks. clicking on their container causes the four segments to rotate around by swapping the background-image property values among the four <div> blocks. css the css defines one container style, then the styles for the four boxes that comprise the complete image. the container looks like this: #container { width:267px; height:272px; top:100px; left:100px; position:absolute; font-size:16px; text-shadow:white 0px 0px 6px; text-align:center; } then the four boxes defining the segments of the image are defined. let's look at them one at a time. #box1 { background-image...
...these four segments are all contained within a larger <div> block whose primary purpose is to re...
...And 9 more matches
Border-image generator - CSS: Cascading Style Sheets
ooltip2[data-info='bottom'] { top: -10px; right: -50px; } #subject .tooltip2[data-info='left'] { bottom: -30px; right: -20px; } /* preview */ #preview { width: 30%; height: 50%; background-color: #fff; text-align: center; overflow: hidden; position: absolute; z-index: 10; left: 60%; top: 15%; border-radius: 2px; border-image-width: 20px; border-image-repeat: round; border-style: solid; box-shadow: 0 0 3px 0 #bababa; } #preview .resize-handle { width: 10px; height: 10px; background: url("https://mdn.mozillademos.org/files/6027/resize.png") center center no-repeat; position: absolute; bottom: 0; right: 0; } #preview .resize-handle:hover { cursor: nw-resize; } /* * general controls menu */ #general-controls { padding: 10px 30px; background-color: #fff; op...
...rty .value { width: 65%; padding: 0 2.5%; word-break: break-all; float: left; } javascript content 'use strict'; /** * ui-slidersmanager */ var inputslidermanager = (function inputslidermanager() { var subscribers = {}; var sliders = []; var inputcomponent = function inputcomponent(obj) { var input = document.createelement('input'); input.setattribute('type', 'text'); input.style.width = 50 + obj.precision * 10 + 'px'; input.addeventlistener('click', function(e) { this.select(); }); input.addeventlistener('change', function(e) { var value = parsefloat(e.target.value); if (isnan(value) === true) setvalue(obj.topic, obj.value); else setvalue(obj.topic, value); }); return input; }; var slidercomponent = function slidercomponent(obj, sign)...
...onent(obj, sign) { var slider = document.createelement('div'); var startx = null; var start_value = 0; slider.addeventlistener("click", function(e) { document.removeeventlistener("mousemove", slidermotion); setvalue(obj.topic, obj.value + obj.step * sign); }); slider.addeventlistener("mousedown", function(e) { startx = e.clientx; start_value = obj.value; document.body.style.cursor = "e-resize"; document.addeventlistener("mouseup", slideend); document.addeventlistener("mousemove", slidermotion); }); var slideend = function slideend(e) { document.removeeventlistener("mousemove", slidermotion); document.body.style.cursor = "auto"; slider.style.cursor = "pointer"; }; var slidermotion = function slidermotion(e) { slider.style.cursor = "e-resi...
...And 9 more matches
border-block-start - CSS: Cascading Style Sheets
the border-block-start css property is a shorthand property for setting the individual logical block-start border property values in a single place in the style sheet. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...a single place in the style sheet. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. constituent properties this property is a shorthand for the following css properties: border-block-start-color border-block-start-style border-block-start-width syntax border-block-start: 1px; border-block-start: 2px dotted; border-block-start: medium dashed blue; border-block-start can be used to set the values for one or more of border-block-start-width, border-block-start-style, and border-block-start-color. the physical border to which it maps depends on the element's writing mode, directionality, and text orientation.
...r-left property depending on the values defined for writing-mode, direction, and text-orientation. related properties are border-block-end, border-inline-start, and border-inline-end, which define the other borders of the element. values the border-block-start is specified with one or more of the following, in any order: <'border-width'> the width of the border. see border-width. ...
...And 9 more matches
border-inline-start - CSS: Cascading Style Sheets
the border-inline-start css property is a shorthand property for setting the individual logical inline-start border property values in a single place in the style sheet. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...a single place in the style sheet. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. constituent properties this property is a shorthand for the following css properties: border-inline-start-color border-inline-start-style border-inline-start-width syntax border-inline-start: 1px; border-inline-start: 2px dotted; border-inline-start: medium dashed green; the physical border to which border-inline-start maps depends on the element's writing mode, directionality, and text orientation. it corresponds to the border-top, border-right, border-bottom, or border-left property depending on the values defined for writi...
...r-left property depending on the values defined for writing-mode, direction, and text-orientation. related properties are border-block-start, border-block-end, and border-inline-end, which define the other borders of the element. values the border-inline-start is specified with one or more of the following, in any order: <'border-width'> the width of the border. see border-width. ...
...And 9 more matches
Index - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Index
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes found 54 pages: # page tags and summary 1 xslt: extensible stylesheet language transformations landing, web, xslt extensible stylesheet language transformations (xslt) is an xml-based language used, in conjunction with specialized processing software, for the transformation of xml documents. 2 common xslt errors xslt your server needs to send both the source and the stylesheet with a xml mime type, text/xml or application/xml. to find out the current type, load the file in mozilla and look at the page info. or use a download tool, those usually tell the mime type. 3 index index, reference, xslt found 54 pages: 4 ...
...presentable form and then add it into an existing document. since the xml data loaded only contains the raw information without any presentation data, it can load quickly even on dialup. 10 javascript/xslt bindings dom, javascript, xml, xslt javascript can run xslt transformations through the xsltprocessor object. once instantiated, an xsltprocessor has an xsltprocessor.importstylesheet() method that takes as an argument the xslt stylesheet to be used in the transformation. the stylesheet has to be passed in as an xml document, which means that the .xsl file has to be loaded by the page before calling xsltprocessor.importstylesheet(). this can be done via xmlhttprequest or xmldocument.load(). 11 resources xslt no summary! 12 setting parameter...
... itself, unhindered by a need to provide any indication about how this data should eventually be presented. this intelligent structuring is particularly important as more and more data transfers are automated and take place between highly heterogeneous machines linked by a network. 14 an overview needshelp, needsmarkupwork, transforming_xml_with_xslt, xml, xslt the extensible stylesheet language/transform is a very powerful language, and a complete discussion of it is well beyond the scope of this article, but a brief discussion of some basic concepts will be helpful in understanding the description of netscape's capabilities that follows. 15 for further reading needscontent, needshelp, transforming_xml_with_xslt, xml, xslt http://www.amazon.com/xslt-pr...
...And 9 more matches
CSSCounterStyleRule - Web APIs
the csscounterstylerule interface represents an @counter-style at-rule. ...
... the csscounterstylerule interface represents an @counter-style at-rule. ...
... the csscounterstylerule interface represents an @counter-style at-rule. ...
...And 8 more matches
StyleSheet.media - Web APIs
Web › API › StyleSheet › media
the media property of the stylesheet interface specifies the intended destination media for style information. it is a read-only, array-like medialist object and can be removed with deletemedium() and added with appendmedium(). ...
... the media property of the stylesheet interface specifies the intended destination media for style information. it is a read-only, array-like medialist object and can be removed with deletemedium() and added with appendmedium(). ...
... the media property of the stylesheet interface specifies the intended destination media for style information. it is a read-only, array-like medialist object and can be removed with deletemedium() and added with appendmedium(). ...
...And 8 more matches
Logical properties for margins, borders and padding - CSS: Cascading Style Sheets
-left. if you were using a horizontal-tb writing mode with a right-to-left text direction then margin-inline-start would be the same as margin-right, and in a vertical writing mode it would be the same as using margin-top. ...
...ng a horizontal-tb writing mode with a right-to-left text direction then margin-inline-start would be the same as margin-right, and in a vertical writing mode it would be the same as using margin-top. ...
...ing margin-top. ...
...And 8 more matches
Using media queries - CSS: Cascading Style Sheets
media queries are useful when you want to modify your site or app depending on a device's general type (such as print vs. screen) or specific characteristics and parameters (such as screen resolution or browser viewport width). media queries are used for the following: to conditionally apply styles with the css @media and @import at-rules. to target specific media for the <style>, <link>, <source>, and other html elements with the media= attribute. to test and monitor media states using the window.matchmedia() and mediaquerylist.addlistener() javascript methods. note: the examples on this page use css's @media for illustrative purposes, but the basic syntax remains the same for all types of media queries. syntax a media query is composed of an optional media type and any number of ...
...and any number of media feature expressions. multiple queries can be combined in various ways by using logical operators. media queries are case-insensitive. a media query computes to true when the media type (if specified) matches the device on which a document is being displayed and all media feature expressions compute as true. queries involving unknown media types are always false. note: a style sheet with a media query attached to its <link> tag will still download even if the query returns false. nevertheless, its contents will not apply unless and until the result of the query changes to true. media types media types describe the general category of a device. except when using the not or only logical operators, the media type is optional and the all type will be implied. all su...
...g true if the query would otherwise return false. if present in a comma-separated list of queries, it will only negate the specific query to which it is applied. if you use the not operator, you must also specify a media type. note: in level 3, the not keyword can't be used to negate an individual media feature expression, only an entire media query. only the only operator is used to apply a style only if an entire query matches, and is useful for preventing older browsers from applying selected styles. when not using only, older browsers would interpret the query screen and (max-width: 500px) simply as screen, ignoring the remainder of the query, and applying its styles on all screens. if you use the only operator, you must also specify a media type. , (comma) commas are used to combine...
...And 8 more matches
Specificity - CSS: Cascading Style Sheets
lectors (e.g., [type="radio"]) and pseudo-classes (e.g., :hover). id selectors (e.g., #example). universal selector (*), combinators (+, >, ~, ' ', ||) and negation pseudo-class (:not()) have no effect on specificity. (the selectors declared inside :not() do, however.) for more information, visit: "specificity" in "cascade and inheritance", you can also visit: https://specifishity.com inline styles added to an element (e.g., style="font-weight: bold;") always overwrite any styles in external stylesheets, and thus can be thought of as having the highest specificity. the !important exception when an important rule is used on a style declaration, this declaration overrides any other declarations. although technically !important has nothing to do with specificity, it interacts directly with ...
...when two conflicting declarations with the !important rule are applied to the same element, the declaration with a greater specificity will be applied. ...
...be green because that rule is most specific. (also, the rule for blue overwrites the rule for red, notwithstanding the order of the rules) as a nonsense special case for (2), duplicate simple selectors to increase specificity when you have nothing more to specify. ...
...And 8 more matches
An Overview - XSLT: Extensible Stylesheet Language Transformations
« transforming xml with xslt the extensible stylesheet language/transform is a very powerful language, and a complete discussion of it is well beyond the scope of this article, but a brief discussion of some basic concepts will be helpful in understanding the description of netscape's capabilities that follows. an xslt stylesheet is an xml document. unlike css, which has its own specialized syntax, an xslt stylesheet is an xml document, which must conform to all xml rules, including well-formedness. so the model for transformation is that one xml document is used to transform another xml document. an xslt stylesheet is marked as such by the inclusion of a standard xslt heading. ...
...this element will include at least one namespace declaration and the mandatory version attribute. other namespaces and three optional attributes may also be included. ...
...this element will include at least one namespace declaration and the mandatory version attribute. other namespaces and three optional attributes may also be included. the mandatory namespace for xslt is "http://www.w3.org/1999/xsl/transform". ...
...And 8 more matches
nsIStyleSheetService
allows extensions or embeddors to add to the built-in list of user or agent style sheets. layout/base/nsistylesheetservice.idlscriptable please add a summary to this article. last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) inherits from: nsisupports implemented by: @mozilla.org/content/style-sheet-service;1. ...
... allows extensions or embeddors to add to the built-in list of user or agent style sheets. layout/base/nsistylesheetservice.idlscriptable please add a summary to this article. last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) inherits from: nsisupports implemented by: @mozilla.org/content/style-sheet-service;1. ...
...to the built-in list of user or agent style sheets. layout/base/nsistylesheetservice.idlscriptable please add a summary to this article. last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) inherits from: nsisupports implemented by: @mozilla.org/content/style-sheet-service;1. ...
...And 7 more matches
Style Editor - Firefox Developer Tools
the style editor enables you to: view and edit all the stylesheets associated with a page create new stylesheets from scratch and apply them to the page import existing stylesheets and apply them to the page to open the style editor choose the "style editor" option from the "web developer" menu (which is a submenu in the "tools" menu on the mac). the toolbox will appear at the bottom of the browser window, with the style editor activated: the style editor is divided into three main sections: the style sheet pane on the left the editor on the right the media sidebar. the style sheet pane the style sheet pane, on the left, lists all the style sheets being used by the current document. you can quickly toggle the use of a given sheet on and off by clicking the eyeball icon to t...
...vided into three main sections: the style sheet pane on the left the editor on the right the media sidebar. the style sheet pane the style sheet pane, on the left, lists all the style sheets being used by the current document. you can quickly toggle the use of a given sheet on and off by clicking the eyeball icon to the left of the sheet's name. you can save any changes you've made to the style sheet to your local computer by clicking the save button in the bottom-right corner of each sheet's entry in the list. from firefox 40 onwards, the style sheet pane also includes a context menu that lets you open the selected style sheet in a new tab. the editor pane on the right is the editor pane. this is where the source for the selected style sheet is available for you to read and edit. an...
...ew tab. the editor pane on the right is the editor pane. this is where the source for the selected style sheet is available for you to read and edit. any changes you make are immediately applied to the page. this makes it easy to experiment with, revise, and test changes. once you're satisfied with your changes, you can save a copy locally by clicking the save button on the sheet's entry in the style sheet pane. the editor provides line numbers and syntax highlighting to help make it easier to read your css. it also supports a number of keyboard shortcuts. the style editor automatically de-minimizes style sheets that it detects, without affecting the original. this makes it much easier to work on pages that have been optimized. the style editor supports autocomplete. just start typing, and...
...And 7 more matches
Border-radius generator - CSS: Cascading Style Sheets
return input; } var slidercomponent = function slidercomponent(obj, sign) { var slider = document.createelement('div'); var startx = null; var start_value = 0; slider.addeventlistener("click", function(e) { setvalue(obj.topic, obj.value + obj.step * sign); }); slider.addeventlistener("mousedown", function(e) { startx = e.clientx; start_value = obj.value; document.body.style.cursor = "e-resize"; document.addeventlistener("mousemove", slidermotion); }); document.addeventlistener("mouseup", function(e) { document.removeeventlistener("mousemove", slidermotion); document.body.style.cursor = "auto"; slider.style.cursor = "pointer"; }); var slidermotion = function slidermotion(e) { slider.style.cursor = "e-resize"; var delta = (e.clientx - start...
...&& y == 'top') handle.classname = 'handle handle-top-left' if (x === 'right' && y == 'top') handle.classname = 'handle handle-top-right'; if (x === 'right' && y == 'bottom') handle.classname = 'handle handle-bottom-right'; if (x === 'left' && y == 'bottom') handle.classname = 'handle handle-bottom-left'; handle.addeventlistener("mousedown", function(e) { active = true; this.radius.style.display = 'block'; previewmousetracking.subscribe(this.updatecontainer.bind(this)); }.bind(this)); document.addeventlistener("mouseup", function(e) { this.radius.style.display = 'none'; if (active === true) previewmousetracking.unsubscribe(this.updatecontainer.bind(this)); }.bind(this)); inputslidermanager.subscribe(this.topic + '-w', this.setwidth.bind(this)); inputslide...
...updatecontainer.bind(this)); }.bind(this)); inputslidermanager.subscribe(this.topic + '-w', this.setwidth.bind(this)); inputslidermanager.subscribe(this.topic + '-h', this.setheight.bind(this)); inputslidermanager.subscribe(this.topic, this.setradius.bind(this)); buttonmanager.subscribe(this.topic, function(value) { this.rounded = value; if (value === true) { unitw.container.style.display = 'none'; unith.container.style.display = 'none'; unitr.container.style.display = 'block'; sliderw.style.display = 'none'; sliderh.style.display = 'none'; sliderr.style.display = 'block'; this.setunitr(this.unitr); this.updateradius(); } if (value === false) { unitw.container.style.display = 'block'; unith.container.style.display = 'block'; u...
...And 7 more matches
border-block-end - CSS: Cascading Style Sheets
the border-block-end css property is a shorthand property for setting the individual logical block-end border property values in a single place in the style sheet. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... in a single place in the style sheet. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. constituent properties this property is a shorthand for the following css properties: border-block-end-color border-block-end-style border-block-end-width syntax border-block-end: 1px; border-block-end: 2px dotted; border-block-end: medium dashed blue; border-block-end can be used to set the values for one or more of border-block-end-width, border-block-end-style, and border-block-end-color. the physical border to which it maps depends on the element's writing mode, directionality, and text orientation. it corresponds ...
...r-left property depending on the values defined for writing-mode, direction, and text-orientation. related properties are border-block-start, border-inline-start, and border-inline-end, which define the other borders of the element. values the border-block-end is specified with one or more of the following, in any order: <'border-width'> the width of the border. see border-width. ...
...And 7 more matches
<mstyle> - MathML
Web › MathML › Element › mstyle
the mathml <mstyle> element is used change the style of its children. it accepts all attributes of all mathml presentation elements with some exceptions and additional attributes listed below. attributes dir overall directionality of formulas. possible values are either ltr (left to right) or rtl (right to left). decimalpoint this attribute is specifying the character for the alignment point within <mstack> and <mtable> columns, if the decimalpoint value is used to specify the alignment. displaystyle a boolean value specifying whether more vertical space is used for displayed equations or, if set to false, a more compact layout is used to display formulas. the main effect is that larger versions of operators are displayed, when displaystyle is set to true. see also largeop and movable...
...the values before, after and duplicate are allowed. scriptlevel controls mostly the font-size. the higher the scriptlevel, the smaller the font size. ...
...the values before, after and duplicate are allowed. scriptlevel controls mostly the font-size. the higher the scriptlevel, the smaller the font size. this attribute accepts a non-negative integer, as well as a "+" or a "-" sign, which increments or decrements the current value. ...
...And 7 more matches
Basic Example - XSLT: Extensible Stylesheet Language Transformations
4 : xml file <?xml version="1.0"?> <myns:article xmlns:myns="http://devedge.netscape.com/2002/de"> <myns:title>my article</myns:title> <myns:authors> <myns:author company="foopy corp.">mr. foo</myns:author> <myns:author>mr. bar</myns:author> </myns:authors> <myns:body> the <b>rain</b> in <u>spain</u> stays mainly in the plains. ...
...ns:article xmlns:myns="http://devedge.netscape.com/2002/de"> <myns:title>my article</myns:title> <myns:authors> <myns:author company="foopy corp.">mr. foo</myns:author> <myns:author>mr. bar</myns:author> </myns:authors> <myns:body> the <b>rain</b> in <u>spain</u> stays mainly in the plains. ...
...5 : xslt stylesheet <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:myns="http://devedge.netscape.com/2002/de"> <xsl:output method="html" /> <xsl:template match="/"> <html> <head> <title> <xsl:value-of select="/myns:article/myns:title"/> </title> <style type="text/css"> .mybox {margin:10px 155px 0 50px; border: 1px dotted #639ace; padding:0 5px 0 5px;} </style> </head> <body> <p class="mybox"> <span class="title"> <xsl:value-of select="/myns:article/myns:title"/> </span> <br /> authors: <br /> <xsl:apply-templates select="/myns:article/myns:authors/m...
...And 7 more matches
Correctly Using Titles With External Stylesheets - Archive of obsolete content
external stylesheets are often associated with html documents using the <link rel="stylesheeet"> element, but it is important to use the element's title attribute properly. this is because the title attribute on a <link rel="stylesheeet"> element makes it either preferred or an alternative style sheet. this can lead to a stylesheet being ignored, which is typically not what an author intends to do. why titles matter the title attribute affects how your external stylesheet is applied to a document. in fact, the use of the title attribute is so significant that html 4.01 categorizes stylesheets according to the presence or absence of a title. ...
... a stylesheet being ignored, which is typically not what an author intends to do. why titles matter the title attribute affects how your external stylesheet is applied to a document. in fact, the use of the title attribute is so significant that html 4.01 categorizes stylesheets according to the presence or absence of a title. by including a title attribute, you can control whether a particular stylesheet always affects a document, or if it is only used under certain circumstances. there are three kinds of stylesheets that are possible: persistent, preferred, and alternate stylesheets. authors will be most familiar with persistent stylesheets, of which any number may be applied to a document at once. ...
...le. by including a title attribute, you can control whether a particular stylesheet always affects a document, or if it is only used under certain circumstances. there are three kinds of stylesheets that are possible: persistent, preferred, and alternate stylesheets. authors will be most familiar with persistent stylesheets, of which any number may be applied to a document at once. a persistent stylesheet is one which has no title attribute and a value of stylesheet supplied for the rel attribute. a document may refer to one or more persistent stylesheets, all of which are used in the presentation of the document. a preferred stylesheet, on the other hand, is one that has a value of stylesheet supplied for the rel attribute, and any value at all for the title attribute. here are two examples...
...And 6 more matches
CSSStyleDeclaration.setProperty() - Web APIs
value optional is a domstring containing the new property value. if not specified, treated as the empty string. note: value must not contain "!important" -- that should be set using the priority parameter. priority optional is a domstring allowing the "important" css priority to be set. if not specified, treated as the empty string. ...
...ot specified, treated as the empty string. the following values are accepted: string value "important" keyword undefined string empty value "" return value undefined exceptions domexception (nomodificationallowederror): if the property or declaration block is read only. ...
...e empty string. the following values are accepted: string value "important" keyword undefined string empty value "" return value undefined exceptions domexception (nomodificationallowederror): if the property or declaration block is read only. ...
...And 6 more matches
CanvasRenderingContext2D.strokeStyle - Web APIs
gradient a canvasgradient object (a linear or radial gradient). pattern a canvaspattern object (a repeating image). examples changing the stroke color of a shape this example applies a blue stroke color to a rectangle. ...
... gradient a canvasgradient object (a linear or radial gradient). pattern a canvaspattern object (a repeating image). examples changing the stroke color of a shape this example applies a blue stroke color to a rectangle. ...
... gradient a canvasgradient object (a linear or radial gradient). pattern a canvaspattern object (a repeating image). examples changing the stroke color of a shape this example applies a blue stroke color to a rectangle. ...
...And 6 more matches
HTMLStyleElement.media - Web APIs
the htmlstyleelement.media property specifies the intended destination medium for style information. syntax medium = style.media style.media = medium parameters medium is a string describing a single medium or a comma-separated list. ...
... the htmlstyleelement.media property specifies the intended destination medium for style information. syntax medium = style.media style.media = medium parameters medium is a string describing a single medium or a comma-separated list. ...
... the htmlstyleelement.media property specifies the intended destination medium for style information. syntax medium = style.media style.media = medium parameters medium is a string describing a single medium or a comma-separated list. ...
...And 6 more matches
HTMLStyleElement - Web APIs
the htmlstyleelement interface represents a <style> element. it inherits properties and methods from its parent, htmlelement, and from linkstyle. this interface doesn't allow to manipulate the css it contains (in most case). to manipulate css, see using dynamic styling information for an overview of the objects used to manipulate specified css properties using the dom. ...
...tmlstyleelement interface represents a <style> element. it inherits properties and methods from its parent, htmlelement, and from linkstyle. this interface doesn't allow to manipulate the css it contains (in most case). to manipulate css, see using dynamic styling information for an overview of the objects used to manipulate specified css properties using the dom. ...
...nkstyle. this interface doesn't allow to manipulate the css it contains (in most case). to manipulate css, see using dynamic styling information for an overview of the objects used to manipulate specified css properties using the dom. ...
...And 6 more matches
OpenType font features guide - CSS: Cascading Style Sheets
these are all referred to as opentype features, and are made available to use on the web via specific properties and a low-level control property — font-feature-settings. this article provides you with all you need to know about using opentype font features in css. ...
...these are all referred to as opentype features, and are made available to use on the web via specific properties and a low-level control property — font-feature-settings. this article provides you with all you need to know about using opentype font features in css. ...
...h all you need to know about using opentype font features in css. some fonts will have one or more of these features enabled by default (kerning and default ligatures are common examples), while others are left to the designer or developer to choose to enable in specific scenarios. in addition to broad feature sets like ligatures or lining figures (numerals that line up evenly as opposed to 'oldstyle', which look more like lower-case letters), there are also very specific ones such as stylistic sets (which might include several specific variants of glyphs meant to be used together), alternates (which might be one or more variants of the letter 'a'), or even language-specific alterations for east asian languages. in the latter case, these alterations are actually necessary to properly express ...
...And 6 more matches
border-bottom - CSS: Cascading Style Sheets
the border-bottom shorthand css property sets an element's bottom border. it sets the values of border-bottom-width, border-bottom-style and border-bottom-color. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. as with all shorthand properties, border-bottom always sets the values of all of the properties that it can set, even if they are not specified. it sets those that are not specified to their default values. this means that ... border-bottom-style: dotted; border-bottom: thick green; ... is actually the same as ... border-bottom-style: dotted; border-bottom: none thick green; ... and the value of border-bo...
...nd properties, border-bottom always sets the values of all of the properties that it can set, even if they are not specified. it sets those that are not specified to their default values. this means that ... border-bottom-style: dotted; border-bottom: thick green; ... is actually the same as ... border-bottom-style: dotted; border-bottom: none thick green; ... and the value of border-bottom-style given before border-bottom is ignored. since the default value of border-bottom-style is none, not specifying the border-style part results in no border. ...
... <color> see border-bottom-color. ...
...And 6 more matches
column-rule - CSS: Cascading Style Sheets
note: as with all shorthand properties, any individual value that is not specified is set to its corresponding initial value (possibly overriding values previously set using non-shorthand properties). ...
... in a multi-column layout. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. it is a shorthand property that sets the individual column-rule-* properties in a single, convenient declaration: column-rule-width, column-rule-style, and column-rule-color. note: as with all shorthand properties, any individual value that is not specified is set to its corresponding initial value (possibly overriding values previously set using non-shorthand properties). syntax column-rule: dotted; column-rule: solid 8px; column-rule: solid blue; column-rule: thick inset blue; /* global values */ column-rule: inherit; column-rule: initi...
...id 8px; column-rule: solid blue; column-rule: thick inset blue; /* global values */ column-rule: inherit; column-rule: initial; column-rule: unset; the column-rule property is specified as one, two, or three of the values listed below, in any order. values <'column-rule-width'> is a <length> or one of the three keywords, thin, medium, or thick. see border-width for details. ...
...And 6 more matches
counter() - CSS: Cascading Style Sheets
Web › CSS › counter
perimental, and support for the type-or-unit parameter is sparse. check the browser compatibility table carefully before using this in production. syntax values <custom-ident> a name identifying the counter, which is the same case-sensitive name used for the counter-reset and counter-increment. the name cannot start with two dashes and can't be none, unset, initial, or inherit. ...
...pport for the type-or-unit parameter is sparse. check the browser compatibility table carefully before using this in production. syntax values <custom-ident> a name identifying the counter, which is the same case-sensitive name used for the counter-reset and counter-increment. the name cannot start with two dashes and can't be none, unset, initial, or inherit. ...
...heck the browser compatibility table carefully before using this in production. syntax values <custom-ident> a name identifying the counter, which is the same case-sensitive name used for the counter-reset and counter-increment. the name cannot start with two dashes and can't be none, unset, initial, or inherit. ...
...And 6 more matches
Element.computedStyleMap() - Web APIs
the computedstylemap() method of the element interface returns a stylepropertymapreadonly interface which provides a read-only representation of a css declaration block that is an alternative to cssstyledeclaration. syntax var stylepropertymapreadonly = element.computedstylemap() parameters none. return value a stylepropertymapreadonly interface. examples we start with some simple html: a paragraph with a link, and a definition list to which we will add all the css property / value pairs. <p> <a href="https://example.com">link</a> </p> <dl id="regurgitation"></dl> we add a little bit of css a { --colour: red; color: var(--colour); } we add javascript to grab our link and return back a definition list of all the css property values using computedstylemap(). // get the ele...
...airs. <p> <a href="https://example.com">link</a> </p> <dl id="regurgitation"></dl> we add a little bit of css a { --colour: red; color: var(--colour); } we add javascript to grab our link and return back a definition list of all the css property values using computedstylemap(). ...
...</dl> we add a little bit of css a { --colour: red; color: var(--colour); } we add javascript to grab our link and return back a definition list of all the css property values using computedstylemap(). ...
...And 5 more matches
FontFace.style - Web APIs
Web › API › FontFace › style
working draft initial definition. ...
... working draft initial definition. ...
... working draft initial definition. ...
...And 5 more matches
Window.getDefaultComputedStyle() - Web APIs
the getdefaultcomputedstyle() method gives the default computed values of all the css properties of an element, ignoring author styling. that is, only user-agent and user styles are taken into account. syntax var style = window.getdefaultcomputedstyle(element [, pseudoelt]); parameters element the element for which to get the computed style. pseudoelt optional a string specifying the pseudo-element to match. must be null (or not specified) for regular elements. return value the returned style is a cssstyledeclaration object. the object is of the same type as the object returned by window.getcomputedstyle(), but only takes into account user-agent and user rules. ...
...ptional a string specifying the pseudo-element to match. must be null (or not specified) for regular elements. return value the returned style is a cssstyledeclaration object. the object is of the same type as the object returned by window.getcomputedstyle(), but only takes into account user-agent and user rules. ...
...pseudo-element to match. must be null (or not specified) for regular elements. return value the returned style is a cssstyledeclaration object. the object is of the same type as the object returned by window.getcomputedstyle(), but only takes into account user-agent and user rules. ...
...And 5 more matches
:host-context() - CSS: Cascading Style Sheets
e shadow host of the shadow dom containing the css it is used inside (so you can select a custom element from inside its shadow dom) — but only if the selector given as the function's parameter matches the shadow host's ancestor(s) in the place it sits inside the dom hierarchy. in other words, this allows a custom element, or anything within that custom element's shadow dom, to apply different styles based on its position within the outer dom or classes/attributes applied to ancestor elements. one typical use of this is with a descendant selector expression — for example h1 — to select only instances of the custom element that are inside an <h1>. another typical use would be to allow inner elements to react to classes or attributes on any anscestor elements - for example, applying a di...
...' | '$' | '*' ]? '='<attr-modifier> = i | s examples selectively styling shadow hosts the following snippets are taken from our host-selectors example (see it live also). ...
... following snippets are taken from our host-selectors example (see it live also). ...
...And 5 more matches
Mozilla CSS extensions - CSS: Cascading Style Sheets
solete since gecko 2 -moz-background-originobsolete since gecko 2 -moz-background-inline-policyobsolete since gecko 32 [superseded by the standard version box-decoration-break] -moz-background-sizeobsolete since gecko 2 -moz-border-end [superseded by the standard version border-inline-end] -moz-border-end-color [superseded by the standard version border-inline-end-color] -moz-border-end-style [superseded by the standard version border-inline-end-style] -moz-border-end-width [superseded by the standard version border-inline-end-width] -moz-border-image -moz-border-start [superseded by the standard version border-inline-start] -moz-border-start-color [superseded by the standard version border-inline-start-color] -moz-border-start-style [superseded by the standard versio...
...standard version border-inline-end-style] -moz-border-end-width [superseded by the standard version border-inline-end-width] -moz-border-image -moz-border-start [superseded by the standard version border-inline-start] -moz-border-start-color [superseded by the standard version border-inline-start-color] -moz-border-start-style [superseded by the standard version border-inline-start-style] -moz-border-start-width [superseded by the standard version border-inline-start-width] -moz-box-sizing [prefixed version still accepted] c clip-path [applying to more than svg] -moz-column-count [prefixed version still accepted] -moz-column-fill [prefixed version still accepted] -moz-column-gap [prefixed version still accepted] -moz-column-width [prefixed version still...
...] c clip-path [applying to more than svg] -moz-column-count [prefixed version still accepted] -moz-column-fill [prefixed version still accepted] -moz-column-gap [prefixed version still accepted] -moz-column-width [prefixed version still accepted] -moz-column-rule [prefixed version still accepted] -moz-column-rule-width [prefixed version still accepted] -moz-column-rule-style [prefixed version still accepted] -moz-column-rule-color [prefixed version still accepted] -moz-context-properties f–m filter [applying to more than svg] -moz-font-feature-settings [prefixed version still accepted] -moz-font-language-override [prefixed version still accepted] -moz-hyphens [prefixed version still accepted] -moz-margin-end [superseded by the standard ...
...And 5 more matches
border-inline - CSS: Cascading Style Sheets
the border-inline css property is a shorthand property for setting the individual logical inline border property values in a single place in the style sheet. border-inline: 1px; border-inline: 2px dotted; border-inline: medium dashed blue; the physical borders to which border-inline maps depends on the element's writing mode, directionality, and text orientation. it corresponds to the border-top and border-bottom or border-right, and border-left properties, depending on the values defined for writing-mode, direction, and text-orientation. ...
...entation. it corresponds to the border-top and border-bottom or border-right, and border-left properties, depending on the values defined for writing-mode, direction, and text-orientation. the borders in the other dimension can be set with border-block, which sets border-block-start, and border-block-end. ...
... the borders in the other dimension can be set with border-block, which sets border-block-start, and border-block-end. initial valueas each of the properties of the shorthand:border-top-width: mediumborder-top-style: noneborder-top-color: currentcolorapplies toall elementsinheritednocomputed valueas each of the properties of the shorthand:border-top-width: the absolute length or 0 if border-top-style is none or hiddenborder-top-style: as specifiedborder-top-color: computed coloranimation typediscrete constituent properties this property is a shorthand for the following css properties: border-inline-color border-inline-style border-inline-width syntax values the border-inline is specified with one or more of the following, in any order: <'border-width'> the width of the border. ...
...And 5 more matches
border-left - CSS: Cascading Style Sheets
epository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. as with all shorthand properties, border-left always sets the values of all of the properties that it can set, even if they are not specified. it sets those that are not specified to their default values. this means that ... border-left-style: dotted; border-left: thick green; ... is actually the same as ... border-left-style: dotted; border-left: none thick green; ... and the value of border-left-style given before border-left is ignored. since the default value of border-left-style is none, not specifying the border-style part results in no border. constituent properties this property is a shorthand for the following css prop...
... <color> see border-left-color. ...
... constituent properties this property is a shorthand for the following css properties: border-left-color border-left-style border-left-width syntax border-left: 1px; border-left: 2px dotted; border-left: medium dashed green; the three values of the shorthand property can be specified in any order, and one or two of them may be omitted. values <br-width> see border-left-width. <br-style> see border-left-style. <color> see border-left-color. formal definition initial valueas each of the properties of the shorthand:border-left-width: mediumborder-left-style: noneborder-left-color: currentcolorapplies toall elements. it also applies to ::first-letter.inheritednocomputed valueas each of the properties of the shorthand:border-left-width: the absolute length or 0 if border-left-...
...And 5 more matches
border-right - CSS: Cascading Style Sheets
ository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. as with all shorthand properties, border-right always sets the values of all of the properties that it can set, even if they are not specified. it sets those that are not specified to their default values. this means that ... border-right-style: dotted; border-right: thick green; ... is actually the same as ... border-right-style: dotted; border-right: none thick green; ... and the value of border-right-style given before border-right is ignored. since the default value of border-right-style is none, not specifying the border-style part results in no border. constituent properties this property is a shorthand for the following cs...
... <color> see border-right-color. ...
...tuent properties this property is a shorthand for the following css properties: border-right-color border-right-style border-right-width syntax border-right: 1px; border-right: 2px dotted; border-right: medium dashed green; the three values of the shorthand property can be specified in any order, and one or two of them may be omitted. values <br-width> see border-right-width. <br-style> see border-right-style. <color> see border-right-color. formal definition initial valueas each of the properties of the shorthand:border-right-width: mediumborder-right-style: noneborder-right-color: currentcolorapplies toall elements. it also applies to ::first-letter.inheritednocomputed valueas each of the properties of the shorthand:border-right-width: the absolute length or 0 if border...
...And 5 more matches
border-top - CSS: Cascading Style Sheets
repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. as with all shorthand properties, border-top always sets the values of all of the properties that it can set, even if they are not specified. it sets those that are not specified to their default values. this means that ... border-top-style: dotted; border-top: thick green; ... is actually the same as ... border-top-style: dotted; border-top: none thick green; ... and the value of border-top-style given before border-top is ignored. since the default value of border-top-style is none, not specifying the border-style part results in no border. constituent properties this property is a shorthand for the following css properties...
... <color> see border-top-color. ...
...order. constituent properties this property is a shorthand for the following css properties: border-top-color border-top-style border-top-width syntax border-top: 1px; border-top: 2px dotted; border-top: medium dashed green; the three values of the shorthand property can be specified in any order, and one or two of them may be omitted. values <br-width> see border-top-width. <br-style> see border-top-style. <color> see border-top-color. formal definition initial valueas each of the properties of the shorthand:border-top-width: mediumborder-top-style: noneborder-top-color: currentcolorapplies toall elements. ...
...And 5 more matches
outline - CSS: Cascading Style Sheets
Web › CSS › outline
ty set all the outline properties in a single declaration. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. constituent properties this property is a shorthand for the following css properties: outline-color outline-style outline-width syntax /* style */ outline: solid; /* color | style */ outline: #f66 dashed; /* style | width */ outline: inset thick; /* color | style | width */ outline: green solid 3px; /* global values */ outline: inherit; outline: initial; outline: unset; the outline property may be specified using one, two, or three of the values listed below. the order of the values does not matter...
... style */ outline: #f66 dashed; /* style | width */ outline: inset thick; /* color | style | width */ outline: green solid 3px; /* global values */ outline: inherit; outline: initial; outline: unset; the outline property may be specified using one, two, or three of the values listed below. the order of the values does not matter. note: the outline will be invisible for many elements if its style is not defined. this is because the style defaults to none. a notable exception is input elements, which are given default styling by browsers. values <'outline-color'> sets the color of the outline. defaults to currentcolor if absent. see outline-color. <'outline-style'> sets the style of the outline. defaults to none if absent. see outline-style. <'outline-width'> sets the thickness o...
...ers in the following ways: outlines never take up space, as they are drawn outside of an element's content. according to the spec, outlines don't have to be rectangular, although they usually are. as with all shorthand properties, any omitted sub-values will be set to their initial value. accessibility concerns assigning outline a value of 0 or none will remove the browser's default focus style. if an element can be interacted with it must have a visible focus indicator. provide obvious focus styling if the default focus style is removed. how to design useful and usable focus indicators wcag 2.1: understanding success criterion 2.4.7: focus visible formal definition initial valueas each of the properties of the shorthand:outline-color: invert, for browsers supporting it, cur...
...And 5 more matches
text-decoration - CSS: Cascading Style Sheets
the text-decoration shorthand css property sets the appearance of decorative lines on text. it is a shorthand for text-decoration-line, text-decoration-color, text-decoration-style, and the newer text-decoration-thickness property. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. text decorations are drawn across descendant text elements. this means that if an element specifies a text decoration, then a child element can't remove the decoration. ...
...ke to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. text decorations are drawn across descendant text elements. this means that if an element specifies a text decoration, then a child element can't remove the decoration. for example, in the markup <p>this text has <em>some emphasized words</em> in it.</p>, the style rule p { text-decoration: underline; } would cause the entire paragraph to be underlined. the style rule em { text-decoration: none; } would not cause any change; the entire paragraph would still be underlined. however, the rule em { text-decoration: overline; } would cause a second decoration to appear on "some emphasized words". constituent properties this property is a shorthand for the foll...
...ned. the style rule em { text-decoration: none; } would not cause any change; the entire paragraph would still be underlined. however, the rule em { text-decoration: overline; } would cause a second decoration to appear on "some emphasized words". constituent properties this property is a shorthand for the following css properties: text-decoration-color text-decoration-line text-decoration-style text-decoration-thickness syntax the text-decoration property is specified as one or more space-separated values representing the various longhand text-decoration properties. values text-decoration-line sets the kind of decoration used, such as underline or line-through. text-decoration-color sets the color of the decoration. ...
...And 5 more matches
PI Parameters - XSLT: Extensible Stylesheet Language Transformations
overview xslt supports the concept of passing parameters to a stylesheet when executing it. this has been possible for a while when using the xsltprocessor in javascript. however when using an <?xml-stylesheet?> processing instruction (pi) there used to be no way to provide parameters. to solve this two new pis are implemented in firefox 2 (see supported versions below for details), <?xslt-param?> and <?xslt-param-namespace?>. both pis can contain "pseudo attributes" the same way that the xml-stylesheet pi does. the following document passes the two parameters "color" and "size" to the stylesheet "style.xsl". ...
... new pis are implemented in firefox 2 (see supported versions below for details), <?xslt-param?> and <?xslt-param-namespace?>. both pis can contain "pseudo attributes" the same way that the xml-stylesheet pi does. the following document passes the two parameters "color" and "size" to the stylesheet "style.xsl". <?xslt-param name="color" value="blue"?> <?xslt-param name="size" select="2"?> <?xml-stylesheet type="text/xsl" href="style.xsl"?> note that these pis have no effect when transformation is done using the xsltprocessor object in javascript. processing instructions the attributes in the xslt-param and xslt-param-namespace pis are parsed using the rules defined in xml-stylesheet. any unrecognized attributes must be ignored. parsing of any attribute must not fail due to the presence of...
...hen transformation is done using the xsltprocessor object in javascript. processing instructions the attributes in the xslt-param and xslt-param-namespace pis are parsed using the rules defined in xml-stylesheet. any unrecognized attributes must be ignored. parsing of any attribute must not fail due to the presence of an unrecognized attribute as long as that attribute follows the syntax in xml-stylesheet. both the xslt-param and the xslt-param-namespace pis must appear in the prolog of the document, i.e. before the first element tag. ...
...And 5 more matches
SVGStyleElement - Web APIs
svg style interface the svgstyleelement interface corresponds to the svg <style> element. ...
... svg style interface the svgstyleelement interface corresponds to the svg <style> element. ...
... svg style interface the svgstyleelement interface corresponds to the svg <style> element. ...
...And 4 more matches
StylePropertyMap - Web APIs
the stylepropertymap interface of the the css typed object model api provides a representation of a css declaration block that is an alternative to cssstyledeclaration. ...
... the stylepropertymap interface of the the css typed object model api provides a representation of a css declaration block that is an alternative to cssstyledeclaration. ...
... the stylepropertymap interface of the the css typed object model api provides a representation of a css declaration block that is an alternative to cssstyledeclaration. ...
...And 4 more matches
StylePropertyMapReadOnly.get() - Web APIs
the get() method of the stylepropertymapreadonly interface returns a cssstylevalue object for the first value of the specified property. syntax var declarationblock = stylepropertymapreadonly.get(property) parameters property the name of the property to retrieve the value of. return value a cssstylevalue object. examples let's get just a few properties and values. ...
.... ...
...ng a link inside a paragraph in our html, and adding a definition list which we will populate with javascript: <p> <a href="https://example.com">link</a> </p> <dl id="regurgitation"></dl> we add a bit of css, including a custom property and an inhertable property: p { font-weight: bold; } a { --colour: red; color: var(--colour); } we use the element's computedstylemap() to return a stylepropertymapreadonly object. we create an array of properties of interest and use the stylepropertymapreadonly's get() method to get only those values. // get the element const myelement = document.queryselector('a'); // get the <dl> we'll be populating const styleslist = document.queryselector('#regurgitation'); // retrieve all computed styles with computedstylemap() const stylemap = myelement.
...And 4 more matches
-webkit-border-before - CSS: Cascading Style Sheets
the -webkit-border-before css property is a shorthand property for setting the individual logical block start border property values in a single place in the style sheet. /* border values */ -webkit-border-before: 1px; -webkit-border-before: 2px dotted; -webkit-border-before: medium dashed blue; /* global values */ -webkit-border-before: inherit; -webkit-border-before: initial; -webkit-border-before: unset; -webkit-border-before can be used to set the values for one or more of: -webkit-border-before-width, -webkit-border-before-style, and -webkit-border-before-color. it maps to a physical border depending on the element's writing mode, directionality, and text orientation. it corresponds to the border-top, border-right, border-bottom, or border-left property depending on the valu...
...-left property depending on the values defined for writing-mode, direction, and text-orientation. it relates to -webkit-border-after, -webkit-border-start, and -webkit-border-end, which define the other borders of the element. this property is on the standard track as border-block-start. ...
...ding on the values defined for writing-mode, direction, and text-orientation. it relates to -webkit-border-after, -webkit-border-start, and -webkit-border-end, which define the other borders of the element. this property is on the standard track as border-block-start. ...
...And 4 more matches
fallback - CSS: Cascading Style Sheets
the fallback descriptor can be used to specify a counter style to fall back to if the current counter style cannot create a marker representation for a particular counter value. syntax /* keyword values */ fallback: lower-alpha; fallback: custom-gangnam-style; description if the specified fallback style is also unable to construct a representation, then its fallback style will be used. if a valid fallback style is not specified, it defaults to decimal. a couple of scenarios where a fallback style will be used are: when the range descriptor is specified for a counter style, the fallback style will be used to represent values that fall outside the range. ...
...yle will be used. if a valid fallback style is not specified, it defaults to decimal. a couple of scenarios where a fallback style will be used are: when the range descriptor is specified for a counter style, the fallback style will be used to represent values that fall outside the range. when the fixed system is used and there are not enough symbols to cover all the list items, the fallback style will be used for the rest of the list items. ...
...of scenarios where a fallback style will be used are: when the range descriptor is specified for a counter style, the fallback style will be used to represent values that fall outside the range. when the fixed system is used and there are not enough symbols to cover all the list items, the fallback style will be used for the rest of the list items. ...
...And 4 more matches
speak-as - CSS: Cascading Style Sheets
the speak-as descriptor specifies how a counter symbol constructed with a given @counter-style will be represented in the spoken form. for example, an author can specify a counter symbol to be either spoken as its numerical value or just represented with an audio cue. syntax /* keyword values */ speak-as: auto; speak-as: bullets; speak-as: numbers; speak-as: words; speak-as: spell-out; /* @counter-style name value */ speak-as: <counter-style-name>; values auto if the value of speak-as is specified as auto, then the effective value of speak-as will be determined based on the value of the system descriptor: if the value of system is alphabetic, the effective value of speak-as will be spell-out. if system is cyclic, the effective value of speak-as will be bullets. if system is ex...
...s specified as auto, then the effective value of speak-as will be determined based on the value of the system descriptor: if the value of system is alphabetic, the effective value of speak-as will be spell-out. if system is cyclic, the effective value of speak-as will be bullets. if system is extends, the value of speak-as will be the same as if speak-as: auto is specified on the extended style. for all other cases, specifying auto has the same effect as specifying speak-as: numbers. bullets a phrase or an audio cue defined by the user agent for representing an unordered list item will be read out. numbers the numerical value of the counter will be read out in the document language. words the user agent will generate a counter value as normal and read it out as a word in the...
...language. words the user agent will generate a counter value as normal and read it out as a word in the document language. spell-out the user agent will generate a counter representation as normal and would read it out letter by letter. if the user agent doesn't know how to read out a partiular counter symbol, the user agent might read it out as if the value of speak-as was numbers. <counter-style-name> the name of another counter style, specified as a <custom-ident>. if included, the counter will be spoken out in the form specified in that counter style, kind of like specifying the fallback descriptor. if the specified style does not exist, speak-as defaults to auto. accessibility concerns assistive technology support is very limited for the speak-as property. do not rely on it to co...
...And 4 more matches
Detecting CSS animation support - CSS: Cascading Style Sheets
rticle, based on this blog post by chris heilmann, demonstrates a technique for doing this. ...
...we assume that animation is not supported by setting animation to false. we set the animationstring to animation which is the p...
...'-'; animation = true; break; } } } for starters we define a few variables. we assume that animation is not supported by setting animation to false. we set the animationstring to animation which is the property we want to set later on. we create an array of browser prefixes to loop over and we set pfx to an empty string. then we check if the css animation-name property on the style collection for the element specified by the variable elem is set. this means the browser supports css animation without any prefix, which, to date, none of them do. if the browser does not support non-prefixed animation and animation is still false, we iterate over all the possible prefixes, since all the major browsers are currently prefixing this property and changing its name to animationname...
...And 4 more matches
CSS Fonts - CSS: Cascading Style Sheets
Web › CSS › CSS Fonts
css fonts is a module of css that defines font-related properties and how font resources are loaded. it lets you define the style of a font, such as its family, size and weight, line height, and the glyph variants to use when multiple are available for a single character. basic example the following example shows a simple use of basic font properties to style a paragraph of text. ...
...ces are loaded. it lets you define the style of a font, such as its family, size and weight, line height, and the glyph variants to use when multiple are available for a single character. basic example the following example shows a simple use of basic font properties to style a paragraph of text. ...
...p</p> the result is as follows: variable fonts examples you can find a number of variable fonts examples at v-fonts.com and axis-praxis.org; see also our variable fonts guide for more information and usage information. ...
...And 4 more matches
Privacy and the :visited selector - CSS: Cascading Style Sheets
before about 2010, the css :visited selector allowed websites to uncover a user's browsing history and figure out what sites the user had visited. this was done through window.getcomputedstyle and other techniques. this process was quick to execute, and made it possible not only to determine where the user had been on the web, but could also be used to guess a lot of information about the user's identity. to mitigate this problem, browsers have limited the amount of information that can be obtained from visited links. ...
...determine where the user had been on the web, but could also be used to guess a lot of information about the user's identity. to mitigate this problem, browsers have limited the amount of information that can be obtained from visited links. little white lies to preserve users' privacy, firefox and other browsers will lie to web applications under certain circumstances: the window.getcomputedstyle method, and similar functions such as element.queryselector, will always return values indicating that a user has never visited any of the links on a page. if you use a sibling selector such as :visited + span, the adjacent element (span in this example) will be styled as if the link were unvisited. in rare scenarios, if you're using nested link elements and the element being matched is differe...
...e. if you use a sibling selector such as :visited + span, the adjacent element (span in this example) will be styled as if the link were unvisited. in rare scenarios, if you're using nested link elements and the element being matched is different from the link whose presence in history is being tested, the element will be rendered as if the link were unvisited, as well. limits to visited link styles you can style visited links, but there are limits to which styles you can use. ...
...And 4 more matches
background - CSS: Cascading Style Sheets
the background shorthand css property sets all background style properties at once, such as color, image, origin and size, or repeat method. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...hub.com/mdn/interactive-examples and send us a pull request. constituent properties this property is a shorthand for the following css properties: background-attachment background-clip background-color background-image background-origin background-position background-repeat background-size syntax /* using a <background-color> */ background: green; /* using a <bg-image> and <repeat-style> */ background: url("test.jpg") repeat-y; /* using a <box> and <background-color> */ background: border-box red; /* a single image, centered and scaled */ background: no-repeat center/80% url("../img/image.png"); the background property is specified as one or more background layers, separated by commas. the syntax of each layer is as follows: each layer may include zero or one occurrences...
...r-box red; /* a single image, centered and scaled */ background: no-repeat center/80% url("../img/image.png"); the background property is specified as one or more background layers, separated by commas. the syntax of each layer is as follows: each layer may include zero or one occurrences of any of the following values: <attachment> <bg-image> <position> <bg-size> <repeat-style> the <bg-size> value may only be included immediately after <position>, separated with the '/' character, like this: "center/80%". the <box> value may be included zero, one, or two times. if included once, it sets both background-origin and background-clip. if it is included twice, the first occurrence sets background-origin, and the second sets background-clip. the <background-color> val...
...And 4 more matches
border-block - CSS: Cascading Style Sheets
the physical borders to which it maps depends on the element's writing mode, directionality, and text orientation. ...
...the physical borders to which it maps depends on the element's writing mode, directionality, and text orientation. ...
...er-top and border-bottom or border-right, and border-left properties depending on the values defined for writing-mode, direction, and text-orientation. the borders in the other dimension can be set with border-inline, which sets border-inline-start, and border-inline-end. constituent properties this property is a shorthand for the following css properties: border-block-color border-block-style border-block-width syntax values the border-block is specified with one or more of the following, in any order: <'border-width'> the width of the border. see border-width. <'border-style'> the line style of the border. see border-style. <'color'> the color of the border. see color. formal definition initial valueas each of the properties of the shorthand:border-top-width: mediumb...
...And 4 more matches
font-variant-alternates - CSS: Cascading Style Sheets
the font-variant-alternates css property controls the usage of alternate glyphs. these alternate glyphs may be referenced by alternative names defined in @font-feature-values. ...
... syntax this property may take one of two forms: either the keyword normal or one or more of the other keywords and functions listed below, space-separated, in any order. values normal ...
... syntax this property may take one of two forms: either the keyword normal or one or more of the other keywords and functions listed below, space-separated, in any order. ...
...And 4 more matches
mask-repeat - CSS: Cascading Style Sheets
at round; /* multiple values */ mask-repeat: space round, no-repeat; mask-repeat: round repeat, space, repeat-x; /* global values */ mask-repeat: inherit; mask-repeat: initial; mask-repeat: unset; by default, the repeated images are clipped to the size of the element, but they can be scaled to fit (using round) or evenly distributed from end to end (using space). ...
...nd, no-repeat; mask-repeat: round repeat, space, repeat-x; /* global values */ mask-repeat: inherit; mask-repeat: initial; mask-repeat: unset; by default, the repeated images are clipped to the size of the element, but they can be scaled to fit (using round) or evenly distributed from end to end (using space). syntax one or more <repeat-style> values, separated by commas. ...
...y be entirely covered). the position of the non-repeated mask image is defined by the mask-position css property. ...
...And 4 more matches
revert - CSS: Cascading Style Sheets
Web › CSS › revert
the revert css keyword reverts the cascaded value of the property from its current value to the value the property would have had if no changes had been made by the current style origin to the current element. thus, it resets the property to its inherited value if it inherits from its parent or to the default value established by the user agent's stylesheet (or by user styles, if any exist). it can be applied to any css property, including the css shorthand all. this removes from the cascade all of the styles that have been overridden until the style being rolled back to is reached. ...
... resets the property to its inherited value if it inherits from its parent or to the default value established by the user agent's stylesheet (or by user styles, if any exist). it can be applied to any css property, including the css shorthand all. this removes from the cascade all of the styles that have been overridden until the style being rolled back to is reached. if used by a site's own styles (the author origin), revert rolls back the property's cascaded value to the user's custom style, if one exists; otherwise, it rolls the style back to the user agent's default style. if used in a user's custom stylesheet, or if the style was applied by the user (the user origin), revert rolls back the cascaded value to the user agent's default style. if used within the user agent's default styl...
... revert will not affect rules applied to children of an element you reset (but will remove effects of a parent rule on a child). so if you have a color: green for all sections and all: revert on a specific section the color of the section will be black. ...
...And 4 more matches
Using the Mozilla JavaScript interface to XSL Transformations - XSLT: Extensible Stylesheet Language Transformations
this document describes the javascript interface in mozilla 1.2 and up to the xslt processing engine (transformiix). creating an xsltprocessor to start, you need to create an xsltprocessor object: var processor = new xsltprocessor(); specifying the stylesheet before you can use it, you must import a stylesheet with the xsltprocessor.importstylesheet() method. it has a single parameter, which is the dom node of the xslt stylesheet to import. note: the import is live, meaning that if you alter the stylesheet dom after importing it, this will be reflected in the processing. rather than modifying the dom it is recommended to use stylesheet parameters which are usually easier and can give better performance. var testtransform = document.implementation.createdocument("", "test", nul...
...ier and can give better performance. var testtransform = document.implementation.createdocument("", "test", null); // just an example to get a transform into a script as a dom // xmldocument.load is asynchronous, so all processing happens in the // onload handler testtransform.addeventlistener("load", onload, false); testtransform.load("test-transform.xml"); function onload() { processor.importstylesheet(testtransform); } xsltprocessor.importstylesheet() requires one argument, a dom node. if that node is a document node, you can pass in a full xsl transform or a literal result element transform, otherwise it must be an xsl:stylesheet or xsl:transform element. transforming the document you can use the xsltprocessor.transformtodocument() or xsltprocessor.transformtofragment() methods to tr...
...ortstylesheet() requires one argument, a dom node. if that node is a document node, you can pass in a full xsl transform or a literal result element transform, otherwise it must be an xsl:stylesheet or xsl:transform element. transforming the document you can use the xsltprocessor.transformtodocument() or xsltprocessor.transformtofragment() methods to transform a document using the imported xslt stylesheet. ...
...And 4 more matches
CSSStyleDeclaration - Web APIs
the cssstyledeclaration interface represents an object that is a css declaration block, and exposes style information and various style-related methods and properties. a cssstyledeclaration object can be exposed using three different apis: via htmlelement.style, which deals with the inline styles of a single element (e.g., <div style="...">). via the cssstylesheet api. for example, document.stylesheets[0].cssrules[0].style returns a cssstyledeclaration object on the first css rule in the document's first stylesheet. via window.getcomputedstyle(), which exposes the cssstyledeclaration object as a read-only interface. attributes cssstyledeclaration.csstext textual representation of the declaration block. setting this attribute changes the style. ...
...t api. for example, document.stylesheets[0].cssrules[0].style returns a cssstyledeclaration object on the first css rule in the document's first stylesheet. via window.getcomputedstyle(), which exposes the cssstyledeclaration object as a read-only interface. attributes cssstyledeclaration.csstext textual representation of the declaration block. setting this attribute changes the style. cssstyledeclaration.lengthread only the number of properties. see the item() method below. cssstyledeclaration.parentruleread only the containing cssrule. css properties cssstyledeclaration.cssfloat special alias for the float css property. cssstyledeclaration named properties dashed and camel-cased attributes for all supported css properties. ...
...bute changes the style. cssstyledeclaration.lengthread only the number of properties. see the item() method below. cssstyledeclaration.parentruleread only the containing cssrule. css properties cssstyledeclaration.cssfloat special alias for the float css property. cssstyledeclaration named properties dashed and camel-cased attributes for all supported css properties. methods cssstyledeclaration.getpropertypriority() returns the optional priority, "important". cssstyledeclaration.getpropertyvalue() returns the property value given a property name. cssstyledeclaration.item() returns a css property name by its index, or the empty string if the index is out-of-bounds. an alternative to accessing nodelist[i] (which instead returns undefined when i is out-of-bounds). this is ...
...And 3 more matches
DocumentOrShadowRoot.styleSheets - Web APIs
specifications specification status comment shadow domthe definition of 'documentorshadowroot' in that specification. ...
... specifications specification status comment shadow domthe definition of 'documentorshadowroot' in that specification. ...
... specifications specification status comment shadow domthe definition of 'documentorshadowroot' in that specification. ...
...And 3 more matches
:host() - CSS: Cascading Style Sheets
Web › CSS › :host()
' | '$' | '*' ]? '='<attr-modifier> = i | s examples selectively styling shadow hosts the following snippets are taken from our host-selectors example (see it live also). ...
... following snippets are taken from our host-selectors example (see it live also). ...
...ost-selectors example (see it live also). ...
...And 3 more matches
:host - CSS: Cascading Style Sheets
Web › CSS › :host
t */ :host { font-weight: bold; } syntax :host examples styling the shadow host the following snippets are taken from our host-selectors example (see it live also). ...
... following snippets are taken from our host-selectors example (see it live also). ...
...ost-selectors example (see it live also). ...
...And 3 more matches
negative - CSS: Cascading Style Sheets
syntax /* <symbol> values */ negative: "-"; /* prepends '-' if value is negative */ negative: "(" ")"; /* surrounds value by '(' and ')' if it is negative */ values first <symbol> this symbol will be prepended to the representation when the counter is negative. second <symbol> if present, this symbol will be appended to the representation when the counter is negative. ...
...representation when the counter is negative. description if the counter value is negative, the symbol provided as value for the descriptor is prepended to the counter representation; and a second symbol if specified, will be appended to the representation. ...
...ified, will be appended to the representation. the negative descriptor has effect only if the system value is symbolic, alphabetic, numeric, additive, or extends, if the extended counter style itself uses a negative sign. if the negative descriptor is specified for other systems that don't support negative counter values, then the descriptor is ignored. ...
...And 3 more matches
range - CSS: Cascading Style Sheets
syntax /* keyword value */ range: auto; /* range values */ range: 2 5; range: infinite 10; range: 6 infinite; range: infinite infinite; /* multiple range values */ range: 2 5, 8 10; range: infinite 6, 10 infinite; values auto the range depends on the counter system: for cyclic, numeric, and fixed systems, the range is negative infinity to positive infinity. for alphabetic and symbolic systems, the range is 1 to positive infinity. ...
... the range depends on the counter system: for cyclic, numeric, and fixed systems, the range is negative infinity to positive infinity. for alphabetic and symbolic systems, the range is 1 to positive infinity. for additive systems, the range is 0 to positive infinity. for extends systems, the range is whatever auto would produce for the extended system; if extending a complex predefined style (§7 complex predefined counter styles), the range is the style’s defined range. [ [ | infinite ]{2} ]# defines a comma-separated list of ranges. for each individual range, the first value is the lower bound and the second value is the upper bound. a range is inclusive, that means it always contains both, the lower and upper bound numbers. if infinite is used as the first value in a range...
...-separated list of ranges. for each individual range, the first value is the lower bound and the second value is the upper bound. a range is inclusive, that means it always contains both, the lower and upper bound numbers. if infinite is used as the first value in a range, it represents negative infinity; if it is used as the second value, it represents positive infinity. the range of the counter style is the union of all the ranges defined in the list. if the lower bound of any range is higher than the upper bound, the entire descriptor is invalid and will be ignored. description the value of the range descriptor can be either auto or a comma separated list of lower and upper bounds specified as integers. if value is auto, then for cyclic, numeric, and fixed system, the range will be from...
...And 3 more matches
Using CSS animations - CSS: Cascading Style Sheets
there are three key advantages to css animations over traditional script-driven animation techniques: they’re easy to use for simple animations; you can create them without even having to know javascript. the animations run well, even under moderate system load. simple animations can often perform poorly in javascript (unless they’re well made). ...
...ade). the rendering engine can use frame-skipping and other techniques to keep the performance as smooth as possible. letting the browser control the animation sequence lets the browser optimize performance and efficiency by, for example, reducing the update frequency of animations running in tabs that aren't currently visible. configuring the animation to create a css animation sequence, you style the element you want to animate with the animation property or its sub-properties. this lets you configure the timing, duration, and other details of how the animation sequence should progress. this does not configure the actual appearance of the animation, which is done using the @keyframes at-rule as described in defining the animation sequence using keyframes below. the sub-properties of the ...
...defining the animation sequence using keyframes once you’ve configured the animation’s timing, you need to define the appearance of the animation. this is done by establishing two or more keyframes using the @keyframes at-rule. each keyframe describes how the animated element should render at a given time during the animation sequence. since the timing of the animation is defined in the css style that configures the animation, keyframes use a <percentage> to indicate the time during the animation sequence at which they take place. 0% indicates the first moment of the animation sequence, while 100% indicates the final state of the animation. because these two times are so important, they have special aliases: from and to. both are optional. if from/0% or to/100% is not specified, the brows...
...And 3 more matches
CSS Containment - CSS: Cascading Style Sheets
se this information to make decisions about how to render the content. for example, it might not render articles that are outside the viewable area. if we give each <article> the contain property with a value of content, when new elements are inserted the browser understands it does not need to relayout or repaint any area outside of the containing element's subtree, although if the <article> is styled such that its size depends on its contents (e.g. with height: auto), then the browser may need to account for its size changing). we have told it by way of the contain property that each article is independent. the content value is shorthand for contain: layout paint. it tells the browser that the internal layout of the element is totally separate from the rest of the page, and that everything...
...way of performance optimizations when used on its own. however, it means that the size of the element's children cannot affect the size of the element itself — its size is computed as if it had no children. if you turn on contain: size you need to also specify the size of the element you have applied this to. it will end up being zero-sized in most cases, if you don't manually give it a size. ...
...ed on its own. however, it means that the size of the element's children cannot affect the size of the element itself — its size is computed as if it had no children. if you turn on contain: size you need to also specify the size of the element you have applied this to. it will end up being zero-sized in most cases, if you don't manually give it a size. style containment article { contain: style; } despite the name, style containment does not provide scoped styles such as you would get with the shadow dom. the main use case is to prevent situations where a css counter could be changed in an element, which could then affect the rest of the tree. using contain: style would ensure that the counter-increment and counter-set properties created new counters scoped to that subtree only. no...
...And 3 more matches
Shorthand properties - CSS: Cascading Style Sheets
the css specification defines shorthand properties to group the definition of common properties acting on the same theme. for instance, the css background property is a shorthand property that's able to define the values of background-color, background-image, background-repeat, and background-position. ...
... try not to force a specific order for the values of the properties they replace. this works well when these properties use values of different types, as the order has no importance, but this does not work as easily when several properties can have identical values. handling of these cases are grouped in several categories: shorthands handling properties related to edges of a box, like border-style, margin or padding, always use a consistent 1-to-4-value syntax representing those edges: the 1-value syntax: border-width: 1em — the unique value represents all edges the 2-value syntax: border-width: 1em 2em — the first value represents the vertical, that is top and bottom, edges, the second the horizontal ones, that is the left and right ones. ...
...ft top; ... can be shortened to just one declaration: background: #000 url(images/bg.gif) no-repeat left top; (the shorthand form is actually the equivalent of the longhand properties above plus background-attachment: scroll and, in css3, some additional properties.) see background for more detailed information, including css3 properties. font properties the following declarations ... font-style: italic; font-weight: bold; font-size: .8em; line-height: 1.2; font-family: arial, sans-serif; ... can be shortened to the following: font: italic bold .8em/1.2 arial, sans-serif; this shorthand declaration is actually equivalent to the longhand declarations above plus font-variant: normal and font-size-adjust: none (css2.0 / css3), font-stretch: normal (css3). border properties with borders...
...And 3 more matches
Syntax - CSS: Cascading Style Sheets
Web › CSS › Syntax
the css syntax reflects this goal and its basic building blocks are: the property which is an identifier, that is a human-readable name, that defines which feature is considered. the value which describe how the feature must be handled by the engine. each property has a set of valid values, defined by a formal grammar, as well as a semantic meaning, implemented by the browser engine. css declarations setting css properties to specific values is the core function of the css language. ...
...f valid values, defined by a formal grammar, as well as a semantic meaning, implemented by the browser engine. css declarations setting css properties to specific values is the core function of the css language. a property and value pair is called a declaration, and any css engine calculates which declarations apply to every single element of a page in order to appropriately lay it out, and to style it. both properties and values are case-insensitive by default in css. the pair is separated by a colon, ':' (u+003a colon), and white spaces before, between, and after properties and values, but not necessarily inside, are ignored. there are more than 100 different properties in css and a nearly infinite number of different values. not all pairs of properties and values are allowed and each ...
...osing braces must be matched. such blocks are naturally called declaration blocks and declarations inside them are separated by a semi-colon, ';' (u+003b semicolon). a declaration block may be empty, that is containing null declaration. white spaces around declarations are ignored. ...
...And 3 more matches
WebKit CSS extensions - CSS: Cascading Style Sheets
h an -apple- prefix. a few are prefixed with -epub-. webkit-only properties note: avoid using on websites. these properties will only work in webkit applications. ...
...roperties will only work in webkit applications. ...
...it-appearance* -webkit-aspect-ratio b -webkit-backdrop-filter -webkit-background-composite -webkit-border-after** -webkit-border-after-color** -webkit-border-after-style** -webkit-border-after-width** -webkit-border-before** -webkit-border-before-color** -webkit-border-before-style** -webkit-border-before-width** -webkit-border-end** -webkit-border-end-color** -webkit-border-end-style** -webkit-border-end-width** -webkit-border-fit -webkit-border-horizontal-spacing -webkit-border-start** -webkit-border-start-color** -webkit-border-start-style** -webkit-border-start-width** -webkit-border-vertical-spacing -webkit-box-align** -webkit-box-direction** -webkit-box-flex-group** -webkit-box-flex** -webkit-box-lines** -webkit-box-ordinal-group** -webkit-box-orient** -w...
...And 3 more matches
animation - CSS: Cascading Style Sheets
Web › CSS › animation
it is a shorthand for animation-name, animation-duration, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, animation-fill-mode, and animation-play-state. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...argin-bottom: 0; } svg { width: 1.5em; height: 1.5em; } button { width: 27px; height: 27px; background-size: 16px; background-position: center; background-repeat: no-repeat; border-radius: 3px; cursor: pointer; } button.play { background-image: url('data:image/svg+xml;charset=utf-8,%3csvg%20xmlns%3d%22http%3a%2f%2fwww.w3.org%2f2000%2fsvg%22%20viewbox%3d%220%200%2016%2016%22%3e%3cstyle%3epath%20%7bdisplay%3anone%7d%20path%3atarget%7bdisplay%3ablock%7d%3c%2fstyle%3e%3cpath%20id%3d%22play%22%20d%3d%22m3%2c3%20l3%2c13%20l13%2c8%20z%22%20%2f%3e%3cpath%20id%3d%22pause%22%20d%3d%22m5%2c4%20l7%2c4%20l7%2c13%20l5%2c13%20z%20m9%2c4%20l11%2c4%20l11%2c13%20l9%2c13%20z%22%20%2f%3e%3cpath%20id%3d%22restart%22%20d%3d%22m13%2c9%20a5%2c5%2c1%2c1%2c1%2c8%2c4%20l8%2c2%20l12%2c5%20l8%2c8%20l8%2c6...
...3%20z%22%20%2f%3e%3cpath%20id%3d%22restart%22%20d%3d%22m13%2c9%20a5%2c5%2c1%2c1%2c1%2c8%2c4%20l8%2c2%20l12%2c5%20l8%2c8%20l8%2c6%20a3%2c3%2c1%2c1%2c0%2c11%2c9%20a1%2c1%2c1%2c1%2c1%2c13%2c9%20z%22%20%2f%3e%3c%2fsvg%3e#play'); } button.pause { background-image: url('data:image/svg+xml;charset=utf-8,%3csvg%20xmlns%3d%22http%3a%2f%2fwww.w3.org%2f2000%2fsvg%22%20viewbox%3d%220%200%2016%2016%22%3e%3cstyle%3epath%20%7bdisplay%3anone%7d%20path%3atarget%7bdisplay%3ablock%7d%3c%2fstyle%3e%3cpath%20id%3d%22play%22%20d%3d%22m3%2c3%20l3%2c13%20l13%2c8%20z%22%20%2f%3e%3cpath%20id%3d%22pause%22%20d%3d%22m5%2c4%20l7%2c4%20l7%2c13%20l5%2c13%20z%20m9%2c4%20l11%2c4%20l11%2c13%20l9%2c13%20z%22%20%2f%3e%3cpath%20id%3d%22restart%22%20d%3d%22m13%2c9%20a5%2c5%2c1%2c1%2c1%2c8%2c4%20l8%2c2%20l12%2c5%20l8%2c8%20l8%2c6...
...And 3 more matches
counters() - CSS: Cascading Style Sheets
Web › CSS › counters
the counters() css function enables nested counters, returning a concatenated string representing the current values of the named counters, if there are any. the counters() function has two forms: 'counters(name, string)' or 'counters(name, string, style)'. it is generally used with pseudo-elements, but can be used, theoretically, anywhere a <string> value is supported. the generated text is the value of all counters with the given name, from outermost to innermost, separated by the specified string. the counters are rendered in the style indicated, defaulting to decimal if no style is specified. /* simple usage - style defaults to decimal */ counters(countername, '-'); /* changing the counter display */ counters(countername, '.', upper-roman) a counter has no visible effect by itself. the...
...erimental, and support for the type-or-unit parameter is sparse. check the browser compatibility table carefully before using this in production. syntax values <custom-ident> a name identifying the counters, which is the same case-sensitive name used for the counter-reset and counter-increment. the name cannot start with two dashes and can't be none, unset, initial, or inherit. <counter-style> a counter style name or symbols() function, where a counter style name is a numeric, alphabetic, or symbolic simple predefined counter style, a complex longhand east asian or ethiopic predefined counter style, or other predefined counter style. if omitted, the counter-style defaults to decimal <string> any number of text characters. non-latin characters must be encoded using their unicode esc...
...counter style, a complex longhand east asian or ethiopic predefined counter style, or other predefined counter style. if omitted, the counter-style defaults to decimal <string> any number of text characters. non-latin characters must be encoded using their unicode escape sequences: for example, \000a9 represents the copyright symbol. ...
...And 3 more matches
flex-grow - CSS: Cascading Style Sheets
Web › CSS › flex-grow
flex shorthand to ensure all values are set. formal definition initial value0applies toflex items, including in-flow pseudo-elementsinheritednocomputed valueas specifiedanimation typea number formal syntax <number> examples setting flex item grow factor html <h4>this is a flex-grow</h4> <h5>a,b,c and f are flex-grow:1 . ...
...nition initial value0applies toflex items, including in-flow pseudo-elementsinheritednocomputed valueas specifiedanimation typea number formal syntax <number> examples setting flex item grow factor html <h4>this is a flex-grow</h4> <h5>a,b,c and f are flex-grow:1 . ...
...seudo-elementsinheritednocomputed valueas specifiedanimation typea number formal syntax <number> examples setting flex item grow factor html <h4>this is a flex-grow</h4> <h5>a,b,c and f are flex-grow:1 . ...
...And 3 more matches
vertical-align - CSS: Cascading Style Sheets
hub repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the vertical-align property can be used in two contexts: to vertically align an inline element's box inside its containing line box. ...
...ithub.com/mdn/interactive-examples and send us a pull request. the vertical-align property can be used in two contexts: to vertically align an inline element's box inside its containing line box. ...
... two contexts: to vertically align an inline element's box inside its containing line box. ...
...And 3 more matches
CSP: style-src-attr - HTTP
the http content-security-policy (csp) style-src-attr directive specifies valid sources for inline styles applied to individual dom elements. csp version 3 directive type fetch directive default-src fallback yes. if this directive is absent, the user agent will look for the style-src directive, and if both of them are absent, fallback to default-src directive. ...
...cifies valid sources for inline styles applied to individual dom elements. csp version 3 directive type fetch directive default-src fallback yes. if this directive is absent, the user agent will look for the style-src directive, and if both of them are absent, fallback to default-src directive. ...
... individual dom elements. csp version 3 directive type fetch directive default-src fallback yes. if this directive is absent, the user agent will look for the style-src directive, and if both of them are absent, fallback to default-src directive. syntax one or more sources can be allowed for the style-src-attr policy: content-security-policy: style-src-attr <source>; content-security-policy: style-src-attr <source> <source>; style-src-attr can be used in conjunction with style-src: content-security-policy: style-src <source>; content-security-policy: style-src-attr <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip address, as well as an optional url scheme and/or port number. the sit...
...And 3 more matches
CSP: style-src-elem - HTTP
the http content-security-policy (csp) style-src-elem directive specifies valid sources for stylesheets <style> elements and <link> elements with rel="stylesheet". csp version 3 directive type fetch directive default-src fallback yes. if this directive is absent, the user agent will look for the style-src directive, and if both of them are absent, fallback to default-src directive. ...
...or stylesheets <style> elements and <link> elements with rel="stylesheet". csp version 3 directive type fetch directive default-src fallback yes. if this directive is absent, the user agent will look for the style-src directive, and if both of them are absent, fallback to default-src directive. ...
...ts with rel="stylesheet". csp version 3 directive type fetch directive default-src fallback yes. if this directive is absent, the user agent will look for the style-src directive, and if both of them are absent, fallback to default-src directive. syntax one or more sources can be allowed for the style-src-elem policy: content-security-policy: style-src-elem <source>; content-security-policy: style-src-elem <source> <source>; style-src-elem can be used in conjunction with style-src: content-security-policy: style-src <source>; content-security-policy: style-src-elem <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip address, as well as an optional url scheme and/or port number. the...
...And 3 more matches
JavaScript/XSLT Bindings - XSLT: Extensible Stylesheet Language Transformations
this can be done via xmlhttprequest or xmldocument.load(). ...
...this can be done via xmlhttprequest or xmldocument.load(). ...
...this can be done via xmlhttprequest or xmldocument.load(). ...
...And 3 more matches
stylesheet/utils - Archive of obsolete content
the removal takes effect immediately. ...
...the removal takes effect immediately. ...
...the removal takes effect immediately. ...
...And 2 more matches
Document.enableStyleSheetsForSet() - Web APIs
enables the style sheets matching the specified name in the current style sheet set, and disables all other style sheets (except those without a title, which are always enabled). syntax document.enablestylesheetsforset(name); parameters name the name of the style sheets to enable. all style sheets with a title that match this name will be enabled, while all others that have a title will be disabled. specify an empty string for the name parameter to disable all alternate and preferred style sheets (but not the persistent style sheets; that is, those with no title attribute). notes title matches are case-sensitive. calling this method with a null name has no effect; if you want to disable all alternate and preferred style sheets, you must pass "", the empty string. ...
...tle will be disabled. specify an empty string for the name parameter to disable all alternate and preferred style sheets (but not the persistent style sheets; that is, those with no title attribute). notes title matches are case-sensitive. calling this method with a null name has no effect; if you want to disable all alternate and preferred style sheets, you must pass "", the empty string. stylesheets that don't have a title are never affected by this method. ...
... not the persistent style sheets; that is, those with no title attribute). notes title matches are case-sensitive. calling this method with a null name has no effect; if you want to disable all alternate and preferred style sheets, you must pass "", the empty string. stylesheets that don't have a title are never affected by this method. this method never affects the values of document.laststylesheetset or document.preferredstylesheetset. ...
...And 2 more matches
Document.preferredStyleSheetSet - Web APIs
the preferredstylesheetset property returns the preferred style sheet set as set by the page author. syntax preferredstylesheetset = document.preferredstylesheetset on return, preferredstylesheetset indicates the author's preferred style sheet set. this is determined from the order of style sheet declarations and the default-style http header. if there isn't a preferred style sheet set defined by the author, the empty string ("") is returned. ...
...the page author. syntax preferredstylesheetset = document.preferredstylesheetset on return, preferredstylesheetset indicates the author's preferred style sheet set. this is determined from the order of style sheet declarations and the default-style http header. if there isn't a preferred style sheet set defined by the author, the empty string ("") is returned. ...
...et = document.preferredstylesheetset on return, preferredstylesheetset indicates the author's preferred style sheet set. this is determined from the order of style sheet declarations and the default-style http header. if there isn't a preferred style sheet set defined by the author, the empty string ("") is returned. ...
...And 2 more matches
Document.selectedStyleSheetSet - Web APIs
the selectedstylesheetset property indicates the name of the style sheet set that's currently in use. syntax currentstylesheetset = document.selectedstylesheetset; document.selectedstylesheet = newstylesheetset; on return, currentstylesheetset indicates the name of the style sheet set currently in use. you can also set the current style sheet set using this property. setting the value of this property is equivalent to calling document.enablestylesheetsforset() with the value of currentstylesheetset, then setting the value of laststylesheetset to that value as well. note: this attribute's value is live; directly changing the disabled attribute on style sheets will affect the value of this attribute. ...
...eet set using this property. setting the value of this property is equivalent to calling document.enablestylesheetsforset() with the value of currentstylesheetset, then setting the value of laststylesheetset to that value as well. note: this attribute's value is live; directly changing the disabled attribute on style sheets will affect the value of this attribute. ...
...the value of this property is equivalent to calling document.enablestylesheetsforset() with the value of currentstylesheetset, then setting the value of laststylesheetset to that value as well. note: this attribute's value is live; directly changing the disabled attribute on style sheets will affect the value of this attribute. ...
...And 2 more matches
::before (:before) - CSS: Cascading Style Sheets
Web › CSS › ::before
in css2. examples adding quotation marks one simple example of using ::before pseudo-elements is to provide quotation marks. here we use both ::before and ::after to insert quotation characters. ...
...color: blue; } q::after { content: "»"; color: red; } result decorative example we can style text or images in the content property almost any way we want. html <span class="ribbon">notice where the orange box is.</span> css .ribbon { background-color: #5bc8f7; } .ribbon::before { content: "look at this orange box."; background-color: #ffba10; border-color: black; border-style: dotted; } result to-do list in this example we will create a simple to-do list using pseudo-elements. this method can often be used to add small touches to the ui and improve user experience. ...
...color: black; border-style: dotted; } result to-do list in this example we will create a simple to-do list using pseudo-elements. this method can often be used to add small touches to the ui and improve user experience. ...
...And 2 more matches
::cue - CSS: Cascading Style Sheets
Web › CSS › ::cue
::cue { color: yellow; font-weight: bold; } the properties are applied to the entire set of cues as if they were a single unit. the only exception is that background and its longhand properties apply to each cue individually, to avoid creating boxes and obscuring unexpectedly large areas of the media. ...
...dly large areas of the media. ...
... ::cue { color: #fff; backgroun...
...And 2 more matches
:focus-visible - CSS: Cascading Style Sheets
milar functionality through an older, prefixed pseudo-class — :-moz-focusring. syntax :focus-visible examples basic example in this example, the :focus-visible selector uses the ua's behavior to determine when to match. compare what happens when you click on the different controls with a mouse, versus when you tab through them using a keyboard. ...
...xed pseudo-class — :-moz-focusring. syntax :focus-visible examples basic example in this example, the :focus-visible selector uses the ua's behavior to determine when to match. compare what happens when you click on the different controls with a mouse, versus when you tab through them using a keyboard. note the difference in behavior from elements styled with :focus. ...
...cusring. syntax :focus-visible examples basic example in this example, the :focus-visible selector uses the ua's behavior to determine when to match. compare what happens when you click on the different controls with a mouse, versus when you tab through them using a keyboard. note the difference in behavior from elements styled with :focus. ...
...And 2 more matches
:scope - CSS: Cascading Style Sheets
Web › CSS › :scope
when used from a dom api such as queryselector(), queryselectorall(), matches(), or element.closest(), :scope matches the element on which the method was called. ...
... no support 20 — 32disabled disabled from version 20 until version 32 (exclusive): this feature...
...ernet:scopechrome full support 27edge full support 79firefox full support 32notes full support 32notes notes firefox 55 removes support for <style scoped> but not for the :scope pseudo-class, which is still supported. <style scoped> made it possible to explicitly set up element scopes, but ongoing discussions about the design of this feature as well as lack of other implementations resulted in the decision to remove it. no support 20 — 32disabled disabled from version 20 until version 32 (exclusive): this feature is behind the layout.css.scope-pseudo.enabled preference (needs to be set to ...
...And 2 more matches
pad - CSS: Cascading Style Sheets
syntax pad: 3 "0"; values <integer> && <symbol> the <integer> specifies a minimum length that all counter representations must reach. the value must be non-negative. if the minimum length is not reached, the representation will be padded with the specified <symbol>. description if a marker representation is smaller than the specified pad length, then the marker will be padded with the specified pad symbol. marker representations longer than the pad length are constructed as normal. ...
...mbol. marker representations longer than the pad length are constructed as normal. pad descriptor takes the minimum marker length as an integer and a symbol to be used for padding as the second parameter. a common usage of the pad descriptor is when you need your list to start numbering from 01 and go through 02, 03 and so on, instead of just 1, 2, 3... ...
... candidate recommendation initial definition ...
...And 2 more matches
prefix - CSS: Cascading Style Sheets
the prefix descriptor of the @counter-style rule specifies content that will be prepended to the marker representation. if not specified, the default value will be "" (an empty string). syntax /* <symbol> values */ prefix: "»"; prefix: "page "; prefix: url(bullet.png); values <symbol> specifies a <symbol> that is prepended to the marker representation. it may be a <string>, <image>, or <custom-ident>. ...
...ontent that will be prepended to the marker representation. if not specified, the default value will be "" (an empty string). syntax /* <symbol> values */ prefix: "»"; prefix: "page "; prefix: url(bullet.png); values <symbol> specifies a <symbol> that is prepended to the marker representation. it may be a <string>, <image>, or <custom-ident>. ...
... candidate recommendation initial definition. ...
...And 2 more matches
symbols - CSS: Cascading Style Sheets
r is specified as one or more <symbol>s. values <symbol> represents a symbol used within the counter system. this must be one of the following data types: <string> <image> (note: this value is "at risk" and may be removed from the specification. it is not yet implemented.) <custom-ident> description a symbol can be a string, image, or identifier. it is used within the @counter-style at-rule. symbols: a b c d e; symbols: "\24b6" "\24b7" "\24b8" d e; symbols: "0" "1" "2" "4" "5" "6" "7" "8" "9"; symbols: url('first.svg') url('second.svg') url('third.svg'); symbols: indic-numbers; the symbols descriptor must be specified when the value of the system descriptor is cyclic, numeric, alphabetic, symbolic, or fixed. when the additive system is used, use the additive-symbols descr...
..."1" "2" "4" "5" "6" "7" "8" "9"; symbols: url('first.svg') url('second.svg') url('third.svg'); symbols: indic-numbers; the symbols descriptor must be specified when the value of the system descriptor is cyclic, numeric, alphabetic, symbolic, or fixed. when the additive system is used, use the additive-symbols descriptor instead to specify the symbols. ...
... candidate recommendation initial definition. ...
...And 2 more matches
At-rules - CSS: Cascading Style Sheets
Web › CSS › At-rule
an identifier and includes everything up to the next semicolon, ';' (u+003b semicolon), or the next css block, whichever comes first. ...
...+003b semicolon), or the next css block, whichever comes first. /* general structure */ @identifier (rule); /* example: tells browser to use utf-8 character set */ @charset "utf-8"; there are several at-rules, designated by their identifiers, each with a different syntax: @charset — defines the character set used by the style sheet. @import — tells the css engine to include an external style sheet. ...
... designated by their identifiers, each with a different syntax: @charset — defines the character set used by the style sheet. @import — tells the css engine to include an external style sheet. @namespace — tells the css engine that all its content must be considered prefixed with an xml namespace. nested at-rules — a subset of nested statements, which can be used as a statement of a style sheet as well as inside of conditional group rules: @media — a conditional group rule that will apply its content if the device meets the criteria of the condition defined using a media query. @supports — a conditional group rule that will apply its content if the browser meets the criteria of the given condition. @document — a conditional group rule that will apply its conten...
...And 2 more matches
Consistent list indentation - CSS: Cascading Style Sheets
this often leads to frustration, because what works in one browser often doesn't have the same effect in another. for example, if you declare that lists have no left margin, they move over in internet explorer, but sit stubbornly in place in gecko-based browsers.this article will help you understand the problems that can occur and how to avoid them. in order to understand why this is the case, and more importantly how to avoid the problem altogether, it's necessary to examine the details of list construction. making a list first, we consider a single, pure list item. ...
... here. what's key is that the markers are placed outside the "principal box" of the <li> elements, not the <ul>. they're sort of like appendages to the list items, hanging outside the content-area of the <li> but still attached to the <li>. ...
...indows, markers are placed outside any border set for an <li> element, assuming the value of list-style-position is outside. if it's changed to inside, then the markers are brought inside the <li>'s content, as though they're an inline box placed at the very beginning of the <li>. indenting it twice so how will all this appear in a document? at the moment, we have a situation analogous to these styles: ul, li {margin-left: 0; padding-left: 0;} if we dropped this list into a document as-is, there would be no apparent indentation and the markers would be in danger of falling off the left edge of the browser window. in order to avoid this and get some indentation, there are really only three options available to browser implementors. give each <li> element a left margin. give the <ul> ele...
...And 2 more matches
CSS Lists - CSS: Cascading Style Sheets
using css counters explains how to use the css counter properties to control list counters. ...
... using css counters explains how to use the css counter properties to control list counters. ...
... using css counters explains how to use the css counter properties to control list counters. ...
...And 2 more matches
contain - CSS: Cascading Style Sheets
Web › CSS › contain
this property is useful on pages that contain a lot of widgets that are all independent, as it can be used to prevent each widget's internals from having side effects outside of the widget's bounding-box. ...
...ects outside of the widget's bounding-box. note: if applied (with value: paint, strict or content), this property creates: a new containing block (for the descendants whose position property is absolute or fixed). a new stacking context. a new block formatting context. syntax /* keyword values */ contain: none; contain: strict; contain: content; contain: size; contain: layout; contain: style; contain: paint; /* multiple keywords */ contain: size paint; contain: size layout paint; /* global values */ contain: inherit; contain: initial; contain: unset; the contain property is specified as either one of the following: using a single none, strict, or content keyword. using one or more of the size, layout, style, and paint keywords in any order. values none indicates the elem...
...lues */ contain: inherit; contain: initial; contain: unset; the contain property is specified as either one of the following: using a single none, strict, or content keyword. using one or more of the size, layout, style, and paint keywords in any order. values none indicates the element renders as normal, with no containment applied. strict indicates that all containment rules except style are applied to the element. this is equivalent to contain: size layout paint. content indicates that all containment rules except size and style are applied to the element. this is equivalent to contain: layout paint. size indicates that the element can be sized without the need to examine its descendants' sizes. layout indicates that nothing outside the element may affect its internal layo...
...And 2 more matches
content - CSS: Cascading Style Sheets
Web › CSS › content
epresents the copyright symbol. <image> an <image>, denoted by the <url> or <gradient> data type, or part of the webpage, defined by the element() function, denoting the content to display. <counter>() the value of a css counter, generally a number. it can be displayed using either the counter() or counters() function. the counter() function has two forms: 'counter(name)' or 'counter(name, style)'. the generated text is the value of the innermost counter of the given name in scope at the given pseudo-element. it is formatted in the specified style (decimal by default). the counters() function also has two forms: 'counters(name, string)' or 'counters(name, string, style)'. the generated text is the value of all counters with the given name in scope at the given pseudo-element, from oute...
... attr(x) the value of the element's attribute x as a string. if there is no attribute x, an empty string is returned. the case-sensitivity of attribute names depends on the document language. open-quote | close-quote these values are replaced by the appropriate string from the quotes property. ...
...mage-set-option># )<element()> = element( <id-selector> )<paint()> = paint( <ident>, <declaration-value>? )<cross-fade()> = cross-fade( <cf-mixing-image> , <cf-final-image>? )<gradient> = <linear-gradient()> | <repeating-linear-gradient()> | <radial-gradient()> | <repeating-radial-gradient()> | <conic-gradient()><target-counter()> = target-counter( [ <string> | <url> ] , <custom-ident> , <counter-style>? )<target-counters()> = target-counters( [ <string> | <url> ] , <custom-ident> , <string> , <counter-style>? )<target-text()> = target-text( [ <string> | <url> ] , [ content | before | after | first-letter ]? )<leader-type> = dotted | solid | space | <string>where <image-tags> = ltr | rtl<image-src> = <url> | <string><color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color>...
...And 2 more matches
flex-shrink - CSS: Cascading Style Sheets
n-flow pseudo-elementsinheritednocomputed valueas specifiedanimation typea number formal syntax <number> examples setting flex item shrink factor html <p>the width of content is 500px; the flex-basis of the flex items is 120px.</p> <p>a, b, c have flex-shrink:1 set. ...
...edanimation typea number formal syntax <number> examples setting flex item shrink factor html <p>the width of content is 500px; the flex-basis of the flex items is 120px.</p> <p>a, b, c have flex-shrink:1 set. ...
...tting flex item shrink factor html <p>the width of content is 500px; the flex-basis of the flex items is 120px.</p> <p>a, b, c have flex-shrink:1 set. ...
...And 2 more matches
font-variant-numeric - CSS: Cascading Style Sheets
ive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... */ font-variant-numeric: oldstyle-nums; /* <numeric-figure-values> */ font-variant-numeric: proportional-nums; /* <numeric-spacing-values> */ font-variant-numeric: tabular-nums; /* <numeric-spacing-values> */ font-variant-numeric: diagonal-fractions; /* <numeric-fraction-values> */ font-variant-numeric: stacked-fractions; /* <numeric-fraction-values> */ font-variant-numeric: oldstyle-nums stacked-fractions; /* global values */ font-variant-numeric: inherit; font-variant-numeric: initial; font-variant-numeric: unset; this property can take one of two forms: either the keyword value normal or one or more of the other values listed below, space-separated, in any order. values normal this keyword leads to the deactivation of the use of such alternate glyphs. ordinal...
...is keyword forces the use of a 0 with a slash; this is useful when a clear distinction between o and 0 is needed. it corresponds to the opentype values zero. <numeric-figure-values> these values control the figures used for numbers. two values are possible: lining-nums activating the set of figures where numbers are all lying on the baseline. it corresponds to the opentype values lnum. oldstyle-nums activating the set of figures where some numbers, like 3, 4, 7, 9 have descenders. it corresponds to the opentype values onum. <numeric-spacing-values> these values controls the sizing of figures used for numbers. two values are possible: proportional-nums activating the set of figures where numbers are not all of the same size. it corresponds to the opentype values pnum. tabular...
...And 2 more matches
text-emphasis - CSS: Cascading Style Sheets
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the text-emphasis property is quite different from text-decoration. the text-decoration property does not inherit, and the decoration specified is applied across the whole element. ...
...he whole element. however, text-emphasis does inherit, which means it is possible to change emphasis marks for descendents. the size of the emphasis symbol, like ruby symbols, is about 50% of the size of the font, and text-emphasis may affect line height when the current leading is not enough for the marks. text-emphasis doesn't reset the value of text-emphasis-position. ...
...emphasis doesn't reset the value of text-emphasis-position. this is because if the style and the color of emphasis marks may vary in a text, it is extremely unlikely that their position will. in the very rare cases when this is needed, the property text-emphasis-position. constituent properties this property is a shorthand for the following css properties: text-emphasis-color text-emphasis-style syntax /* initial value */ text-emphasis: none; /* no emphasis marks */ /* <string> value */ text-emphasis: 'x'; text-emphasis: '点'; text-emphasis: '\25b2'; text-emphasis: '*' #555; text-emphasis: 'foo'; /* should not use. it may be computed to or rendered as 'f' only */ /* keywords value */ text-emphasis: filled; text-emphasis: open; text-emphasis: filled sesame; text-emphasis: open sesam...
...And 2 more matches
CSSStyleDeclaration.getPropertyPriority() - Web APIs
the cssstyledeclaration.getpropertypriority() method interface returns a domstring that provides all explicitly set priorities on the css property. syntax var priority = style.getpropertypriority(property); parameters property is a domstring representing the property name to be checked. return value priority is a domstring that represents the priority (e.g. "important") if one exists. if none exists, returns the empty string. ...
...etpropertypriority(property); parameters property is a domstring representing the property name to be checked. return value priority is a domstring that represents the priority (e.g. "important") if one exists. if none exists, returns the empty string. ...
...); parameters property is a domstring representing the property name to be checked. return value priority is a domstring that represents the priority (e.g. "important") if one exists. if none exists, returns the empty string. ...
...ts, returns the empty string. example the following javascript code checks whether margin is marked as important in a css selector rule: var declaration = document.stylesheets[0].cssrules[0].style; var isimportant = declaration.getpropertypriority('margin') === 'important'; specifications specification status comment css object model (cssom)the definition of 'cssstyledeclaration.getpropertypriority()' in that specification. working draft document object model (dom) level 2 style specificationthe definition of 'cssstyledeclaration' in that specification. obsolete ...
CSSStyleValue.parseAll() - Web APIs
specifications specification status comment css typed om level 1the definition of 'parseall()' in that specification. ...
... specifications specification status comment css typed om level 1the definition of 'parseall()' in that specification. ...
... specifications specification status comment css typed om level 1the definition of 'parseall()' in that specification. ...
...nterface sets all occurences of a specific css property to the specified value and returns an array of cssstylevalue objects, each containing one of the supplied values. syntax cssstylevalue.parseall(property, value) parameters property a css property to set. csstext a comma-separated string containing one or more values that apply to the provided property. return value an array of cssstylevalue objects, each containing one of the supplied values. specifications specification status comment css typed om level 1the definition of 'parseall()' in that specification. working draft initial definition. ...
Document.lastStyleSheetSet - Web APIs
the document.laststylesheetset property returns the last enabled style sheet set. this property's value changes whenever the document.selectedstylesheetset property is changed. syntax var laststylesheetset = document.laststylesheetset on return, laststylesheetset indicates the style sheet set that was most recently set. if the current style sheet set has not been changed by setting document.selectedstylesheetset, the returned value is null. note: this value doesn't change when document.enablestylesheetsforset() is called. ...
.... syntax var laststylesheetset = document.laststylesheetset on return, laststylesheetset indicates the style sheet set that was most recently set. if the current style sheet set has not been changed by setting document.selectedstylesheetset, the returned value is null. note: this value doesn't change when document.enablestylesheetsforset() is called. ...
...eetset on return, laststylesheetset indicates the style sheet set that was most recently set. if the current style sheet set has not been changed by setting document.selectedstylesheetset, the returned value is null. note: this value doesn't change when document.enablestylesheetsforset() is called. ...
... set that was most recently set. if the current style sheet set has not been changed by setting document.selectedstylesheetset, the returned value is null. note: this value doesn't change when document.enablestylesheetsforset() is called. ...
Document.styleSheetSets - Web APIs
the stylesheetsets read-only property returns a live list of all of the currently-available style sheet sets. syntax var sets = document.stylesheetsets; on return, sets is a list of style sheet sets that are available. ...
... the stylesheetsets read-only property returns a live list of all of the currently-available style sheet sets. syntax var sets = document.stylesheetsets; on return, sets is a list of style sheet sets that are available. ...
...list of all of the currently-available style sheet sets. syntax var sets = document.stylesheetsets; on return, sets is a list of style sheet sets that are available. ...
... the id "sheetlist", you can populate it with the names of all the available style sheet sets with code like this: let list = document.getelementbyid('sheetlist'); let sheets = document.stylesheetsets; list.innerhtml = ''; for (let i = 0; i < sheets.length; i++) { let item = document.createelement('li'); item.innerhtml = sheets[i]; list.appendchild(item); } notes the list of available style sheet sets is constructed by enumerating all the style sheets available for the document, in the order in which they're listed in the document.stylesheets attribute, adding the title of each style sheet that has a title to the list. duplicates are dropped from the list (using a case-sensitive comparison). ...
StylePropertyMapReadOnly.getAll() - Web APIs
example // tbd specifications specification status comment css typed om level 1the definition of 'getall()' in that specification. ...
... example // tbd specifications specification status comment css typed om level 1the definition of 'getall()' in that specification. ...
... example // tbd specifications specification status comment css typed om level 1the definition of 'getall()' in that specification. ...
... example // tbd specifications specification status comment css typed om level 1the definition of 'getall()' in that specification. ...
::cue-region - CSS: Cascading Style Sheets
::cue-region { color: yellow; font-weight: bold; } the properties are applied to the entire set of cues as if they were a single unit. the only exception is that background and its shorthand properties apply to each cue individually, to avoid creating boxes and obscuring unexpectedly large areas of the media. ...
...s of the media. ...
... candida...
... candidate recommendation initial definition. ...
::first-line (:first-line) - CSS: Cascading Style Sheets
the ::first-line css pseudo-element applies styles to the first line of a block-level element. note that the length of the first line depends on many factors, including the width of the element, the width of the document, and the font size of the text. /* selects the first line of a <p> */ p::first-line { color: red; } css3 introduced the ::first-line notation (with two colons) to distinguish pseudo-classes from pseudo-elements. browsers also accept :first-line, introduced in css2. ...
...cts the first line of a <p> */ p::first-line { color: red; } css3 introduced the ::first-line notation (with two colons) to distinguish pseudo-classes from pseudo-elements. browsers also accept :first-line, introduced in css2. ...
...see what i mean?</p> <span>the first line of this text will not receive special styling because it is not a block-level element.</span> css ::first-line { color: blue;...
...n, background-repeat, background-size, background-attachment, and background-blend-mode the color property word-spacing, letter-spacing, text-decoration, text-transform, and line-height text-shadow, text-decoration, text-decoration-color, text-decoration-line, text-decoration-style, and vertical-align. syntax /* css3 syntax */ ::first-line /* css2 syntax */ :first-line examples html <p>styles will only be applied to the first line of this paragraph. after that, all text will be styled like normal. see what i mean?</p> <span>the first line of this text will not receive special styling because it is not a block-level element.</span> css ::first-line { color: blue; text-transform: uppercase; /* warning: do not use these */ /* many properties are invalid in ::first-line pseu...
::selection - CSS: Cascading Style Sheets
the ::selection css pseudo-element applies styles to the part of a document that has been highlighted by the user (such as clicking and dragging the mouse across text). ::selection { background-color: cyan; } allowable properties only certain css properties can be used with ::selection: color background-color cursor caret-color outline and its longhands text-decoration and its associated properties text-emphasis-color text-shadow in particular, background-image is ignored. syntax /* legacy firefox syntax (version 61 and below) */ ::-moz-selection ::selection examples html this text has special styles when you highlight it. <p>also try selecting text in this paragraph.</p> css ::-moz-selection { color: gold; background-color: red; } p::-moz-selection { color:...
... if overridden, it is important to ensure that the contrast ratio between the text and background colors of the selection is high enough that pe...
...ed; } /* make selected text in a paragraph white on a blue background */ p::selection { color: white; background-color: blue; } result accessibility concerns don't override selected text styles for purely aesthetic reasons — users can customize them to suit their needs. for people experiencing cognitive concerns or who are less technologically literate, unexpected changes to selection styles may hurt their understanding of the functionality. if overridden, it is important to ensure that the contrast ratio between the text and background colors of the selection is high enough that people experiencing low vision conditions can read it. color contrast ratio is found by comparing the luminosity of the selected text and the selected text background colors. to meet current web content a...
...it returned in pseudo-elements level 4. ...
:checked - CSS: Cascading Style Sheets
Web › CSS › :checked
>) element that is checked or toggled to an on state. /* matches any checked/selected radio, checkbox, or option */ :checked { margin-left: 25px; border: 1px solid blue; } the user can engage this state by checking/selecting an element, or disengage it by unchecking/deselecting the element. note: because browsers often treat <option>s as replaced elements, the extent to which they can be styled with the :checked pseudo-class varies from browser to browser. syntax :checked examples basic example html <div> <input type="radio" name="my-input" id="yes"> <label for="yes">yes</label> <input type="radio" name="my-input" id="no"> <label for="no">no</label> </div> <div> <input type="checkbox" name="my-checkbox" id="opt-in"> <label for="opt-in">check me!</label> </div> <se...
...text]</td><td>[more text]</td></tr> <tr class="expandable"><td>[more text]</td><td>[more text]</td><td>[more text]</td></tr> </tbody> </table> <label for="expand-toggle" id="expand-btn">toggle hidden rows</label> css /* hide the toggle checkbox */ #expand-toggle { display: none; } /* hide expandable content by default */ .expandable { visibility: collapse; background: #ddd; } /* style the button */ #expand-btn { display: inline-block; margin-top: 12px; padding: 5px 11px; background-color: #ff7; border: 1px solid; border-radius: 3px; } /* show hidden content when the checkbox is checked */ #expand-toggle:checked ~ * .expandable { visibility: visible; } /* style the button when the checkbox is checked */ #expand-toggle:checked ~ #expand-btn { background-color: ...
...no effect.edge full support 12notes full support 12notes notes on macos, styling <option&rt; elements has no effect.firefox full support 1notes full support 1notes notes from firefox 56, <option&rt; elements cannot be styled.notes on macos, styling <option&rt; elements has no effect.ie full support 9opera full support 9notes full support 9notes notes on macos, styling <option&rt; elements has no effect.safari full support 3.1notes ...
...notes styling <option&rt; elements has no effect.webview android full support 2chrome android full support 18firefox android full support 4notes full support 4notes notes from firefox 56, <option&rt; elements cannot be styled.opera android full support 10.1safari ios full support 3.1notes full support 3.1notes notes styling <option&rt; elements has no effect.samsung internet android full support 1.0legend ...
:visited - CSS: Cascading Style Sheets
Web › CSS › :visited
the :visited css pseudo-class represents links that the user has already visited. for privacy reasons, the styles that can be modified using this selector are very limited. /* selects any <a> that has been visited */ a:visited { color: green; } styles defined by the :visited pseudo-class will be overridden by any subsequent link-related pseudo-class (:link, :hover, or :active) that has at least equal specificity. to style links appropriately, put the :visited rule after the :link rule but before the :hover and :active rules, as defined by the lvha-order: :link — :visited — :hover — :active. ...
...eudo-class will be overridden by any subsequent link-related pseudo-class (:link, :hover, or :active) that has at least equal specificity. to style links appropriately, put the :visited rule after the :link rule but before the :hover and :active rules, as defined by the lvha-order: :link — :visited — :hover — :active. ...
...y limit which styles you can apply using this pseudo-class, and how they can be used: allowable css properties are color, background-color, border-color, border-bottom-color, border-left-color, border-right-color, border-top-color, column-rule-color, outline-color, text-decoration-color, and text-emphasis-color. allowable svg attributes are fill and stroke. the alpha component of the allowed styles will be ignored. the alpha component of the element's non-:visited state will be used instead, except when that component is 0, in which case the style set in :visited will be ignored entirely. although these styles can be change the appearance of colors to the end user, the window.getcomputedstyle method will lie and always return the value of the non-:visited color. note: for more informat...
...y has a default value for color and column-rule-color only. thus, if you want to modify the other properties, you'll need to give them a base value outside the :visited selector. html <a href="#test-visited-link">have you visited this link yet?</a><br> <a href="">you've already visited this link.</a> css a { /* specify non-transparent defaults to certain properties, allowing them to be styled with the :visited state */ background-color: white; border: 1px solid white; } a:visited { background-color: yellow; border-color: hotpink; color: hotpink; } result specifications specification status comment html living standardthe definition of ':visited' in that specification. living standard selectors level 4the definition of ':visi...
@charset - CSS: Cascading Style Sheets
Web › CSS › @charset
the @charset css at-rule specifies the character encoding used in the style sheet. it must be the first element in the style sheet and not be preceded by any character; as it is not a nested statement, it cannot be used inside conditional group at-rules. if several @charset at-rules are defined, only the first one is used, and it cannot be used inside a style attribute on an html element or inside the <style> element where the character set of the html page is relevant. @charset "utf-8"; this at-rule is useful when using non-ascii characters in some css properties, like content. ...
.... if several @charset at-rules are defined, only the first one is used, and it cannot be used inside a style attribute on an html element or inside the <style> element where the character set of the html page is relevant. @charset "utf-8"; this at-rule is useful when using non-ascii characters in some css properties, like content. as there are several ways to define the character encoding of a style sheet, the browser will try the following methods in the following order (and stop as soon as one yields a result) : the value of the unicode byte-order character placed at the beginning of the file. the value given by the charset attribute of the content-type: http header or the equivalent in the protocol used to serve the style sheet. the @charset css at-rule. use the character encoding d...
...encoding defined in the iana-registry, and must be double-quoted, following exactly one space character (u+0020), and immediately terminated with a semicolon. if several names are associated with an encoding, only the one marked with preferred must be used. ...
...y one space character (u+0020), and immediately terminated with a semicolon. if several names are associated with an encoding, only the one marked with preferred must be used. formal syntax @charset "<charset>"; examples valid and invalid charset declarations @charset "utf-8"; /* set the encoding of the style sheet to unicode utf-8 */ @charset 'iso-8859-15'; /* invalid, wrong quoting style used */ @charset "utf-8"; /* invalid, more than one space */ @charset "utf-8"; /* invalid, there is a character (a space) before the at-rule */ @charset utf-8; /* invalid, without ' or ", the charset is not a css <string> */ specifications specification status comment css level 2 (revision 1)the definition of '@charset' in that specification. ...
additive-symbols - CSS: Cascading Style Sheets
r weight. the additive system is used to construct sign-value numbering systems such as roman numerals. syntax additive-symbols: 3 "0"; additive-symbols: 3 "0", 2 "\2e\20"; additive-symbols: 3 "0", 2 url(symbol.png); when the system descriptor is cyclic, numeric, alphabetic, symbolic, or fixed, use the symbols descriptor instead of additive-symbols. ...
... candidate recommendation initial definition. ...
... candidate recommendation initial definition. ...
... candidate recommendation initial definition. ...
suffix - CSS: Cascading Style Sheets
the suffix descriptor of the@counter-style rule specifies content that will be appended to the marker representation. syntax /* <symbol> values */ suffix: ""; suffix: ") "; suffix: url(bullet.png); values <symbol> specifies a <symbol> that is appended to the marker representation. it may be a <string>, <image>, or <custom-ident>. formal definition related at-rule@counter-styleinitial value". " (full stop followed by a space)computed valueas specified formal syntax <symbol>where <symbol> = <string> | <image> | <custom-ident>where <image> = <url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! )<image-set()> = image-set( <image-set-option># )<element()> = element( <id-selector> )<p...
... candidate recommendation initial definition. ...
... candidate recommendation initial definition. ...
... candidate recommendation initial definition. ...
@font-feature-values - CSS: Cascading Style Sheets
with the ornaments() functional notation of font-variant-alternates. an ornaments feature value definition allows only one value: ident1: 2 is valid, but ident2: 2 4 isn't. @stylistic specifies a feature name that will work with the stylistic() functional notation of font-variant-alternates. a stylistic feature value definition allows only one value: ident1: 2 is valid, but ident2: 2 4 isn't. @styleset specifies a feature name that will work with the styleset() functional notation of font-variant-alternates. a stylset feature value definition allows an unlimited number of values: ident1: 2 4 12 1 maps to the opentype values ss02, ss04, ss12, and ss01. note that values higher than 99 are valid, but don't map to any opentype values and are ignored. @character-variant specifies a feature nam...
... to cv03=1, and ident2: 2 4 maps to cv02=4, but ident2: 2 4 5 is invalid. ...
...eature-value-block-list> = <feature-value-block>+where <feature-value-block> = <feature-type> '{' <feature-value-declaration-list> '}'where <feature-type> = @stylistic | @historical-forms | @styleset | @character-variant | @swash | @ornaments | @annotation<feature-value-declaration-list> = <feature-value-declaration>where <feature-value-declaration> = <custom-ident>: <integer>+; examples using @styleset in a @font-feature-values rule /* at-rule for "nice-style" in font one */ @font-feature-values font one { @styleset { nice-style: 12; } } /* at-rule for "nice-style" in font two */ @font-feature-values font two { @styleset { nice-style: 4; } } … /* apply the at-rules with a single declaration */ .nice-look { font-variant-alternates: styleset(nice-style); } specificati...
...led from version 24: this feature is behind the layout.css.font-features.enabled preference (needs to be set to true). ...
@supports - CSS: Cascading Style Sheets
Web › CSS › @supports
and (display:run-in) {} @supports (display: table-cell) and ((display: list-item) and (display:run-in)) {} the or operator the or operator creates a new expression from the disjunction of two shorter expressions. it returns true if one or both of the shorter expressions is also true. ...
...isplay: table-cell) and ((display: list-item) and (display:run-in)) {} the or operator the or operator creates a new expression from the disjunction of two shorter expressions. it returns true if one or both of the shorter expressions is also true. ...
...o shorter expressions. it returns true if one or both of the shorter expressions is also true. the following example returns true if at least one of the two shorter expressions is true: @supports (transform-style: preserve) or (-moz-transform-style: preserve) {} multiple disjunctions can be juxtaposed without the need of more parentheses. ...
...ue if one or both of the shorter expressions is also true. the following example returns true if at least one of the two shorter expressions is true: @supports (transform-style: preserve) or (-moz-transform-style: preserve) {} multiple disjunctions can be juxtaposed without the need of more parentheses. the following are both equivalent: @supports (transform-style: preserve) or (-moz-transform-style: preserve) or (-o-transform-style: preserve) or (-webkit-transform-style: preserve) {} @supports (transform-style: preserve-3d) or ((-moz-transform-style: preserve-3d) or ((-o-transform-style: preserve-3d) or (-webkit-transform-style: preserve-3d))) {} note: when using both and and or operators, the parentheses must be used to define the order in which they apply. otherwis...
CSS Animations tips and tricks - CSS: Cascading Style Sheets
here's one way to do it that we feel is stable and reliable enough to suggest to you. html content first, let's define the html for a <div> we wish to animate and a button that will play (or replay) the animation. <div class="box"> </div> <div class="runbutton">click me to run the animation</div> css content now we'll define the animation itself using css. some css that's not important (the style of the "run" button itself) isn't shown here, for brevity. .runbutton { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 12px; padding-top: 2px; padding-bottom: 4px; color: white; background-color: darkgreen; font: 14px "open sans", "arial", sans-serif; } @keyframes colorchange { 0% { background: yellow } 100% {...
.... function play() { document.queryselector(".box").classname = "box"; window.requestanimationframe(function(time) { window.requestanimationframe(function(time) { document.queryselector(".box").classname = "box changing"; }); }); } this looks weird, doesn't it? that's because the only way to play an animation again is to remove the animation effect, let the document recompute styles so that it knows you've done that, then add the animation effect back to the element. to make that happen, we have to be creative. here's what happens when the play() function gets called: the box's list of css classes is reset to simply "box". this has the effect of removing any other classes currently applied to the box, including the "changing" class that handles animation. in other words...
...e to be creative. here's what happens when the play() function gets called: the box's list of css classes is reset to simply "box". this has the effect of removing any other classes currently applied to the box, including the "changing" class that handles animation. in other words, we're removing the animation effect from the box. however, changes to the class list don't take effect until the style recomputation is complete and a refresh has occurred to reflect the change. to be sure that the styles are recalculated, we use window.requestanimationframe(), specifying a callback. our callback gets executed just before the next repaint of the document. the problem for us is that because it's before the repaint, the style recomputation hasn't actually happened yet! so... our callback cleverly...
...this callback adds the "changing" class back onto the box, so that the repaint will start the animation once again. ...
Realizing common layouts using CSS Grid Layout - CSS: Cascading Style Sheets
n, sidebar, and a block into which i am intending to place advertising. ...
...rting with the same markup as used for the grid template areas example. ...
...ext-align: center; margin: 0; padding: 20px; } we are going to create a grid with a flexible number of flexible columns. i want them never to become smaller than 200 pixels, and then to share any available remaining space equally – so we always get equal width column tracks. we achieve this with the minmax() function in our repeat notation for track sizing. .listing { list-style: none; margin: 2em; display: grid; grid-gap: 20px; grid-template-columns: repeat(auto-fill,minmax(200px, 1fr)); } as soon as i add this css, the items start to lay out as a grid. if i make the window smaller or wider the number of column tracks changes – without me needing to add breakpoints using media queries and redefine the grid. i can then tidy up the internals of the boxes usin...
... background-color: #f08c00; color: #fff; text-align: center; margin: 0; padding: 20px; } .listing li { border: 1px solid #ffe066; border-radius: 5px; display: flex; flex-direction: column; } .listing .cta { margin-top: auto; border-top: 1px solid #ffe066; padding: 10px; text-align: center; } .listing .body { padding: 10px; } .listing { list-style: none; margin: 2em; display: grid; grid-gap: 20px; grid-auto-flow: dense; grid-template-columns: repeat(auto-fill,minmax(200px, 1fr)); } .listing .wide { grid-column-end: span 2; } this technique of using auto-placement with some rules applied to certain items is very useful, and can help you to deal with content that is being output by a cms for example, where you have repeated i...
CSS Logical Properties and Values - CSS: Cascading Style Sheets
riting modes, and the vertical dimension in vertical writing modes. for standard english text, it is the horizontal dimension. ...
...t is the horizontal dimension. ...
...operties for sizing block-size inline-size max-block-size max-inline-size min-block-size min-inline-size properties for margins, borders and padding border-block border-block-color border-block-end border-block-end-color border-block-end-style border-block-end-width border-block-start border-block-start-color border-block-start-style border-block-start-width border-block-style border-block-width border-color (logical keyword) border-inline border-inline-color border-inline-end border-inline-end-color border-inline-end-style border-inline-end-width border-inline-start border-inline-start-color border-inline-start-style border-inline-start-width border-inline-style border-inline-width border-start-start-radius border-start-end-radius border-end-start-r...
...ogical keyword) border-inline border-inline-color border-inline-end border-inline-end-color border-inline-end-style border-inline-end-width border-inline-start border-inline-start-color border-inline-start-style border-inline-start-width border-inline-style border-inline-width border-start-start-radius border-start-end-radius border-end-start-radius border-end-end-radius border-style (logical keyword) border-width (logical keyword) margin (logical keyword) margin-block margin-block-end margin-block-start margin-inline margin-inline-end margin-inline-start padding (logical keyword) padding-block padding-block-end padding-block-start padding-inline padding-inline-end padding-inline-start properties for floating and positioning clear (inline-end and...
Using CSS transforms - CSS: Cascading Style Sheets
form specifies the transforms to apply to the element. it is a space-separated list of transforms, which are applied one after the other, as requested by the composition operation. composite transforms are effectively applied in order from right to left. examples here is an unaltered image of the mdn logo: rotating here is the mdn logo rotated 90 degrees from its bottom-left corner. ...
... here is an unaltered image of the mdn logo: rotating here is the mdn logo rotated 90 degrees from its bottom-left corner. <img style="transform: rotate(90deg); transform-origin: bottom left;" src="https://udn.realityripple.com/samples/6d/6633f3efc0.png"> skewing and translating here is the mdn logo, skewed by 10 degrees and translated by 150 pixels on the x-axis. <img style="transform: skewx(10deg) translatex(150px); transform-origin: bottom left;" src="https://udn.realityripple.com/samples/6d/6633f3efc0.png"> 3d specific css properties performing css transformations in 3d space is a bit more complex. you have to start by configuring the 3d space by giving it a perspective, then you have to configure how your 2d elements will behave in that spa...
...rspective: 250px; } .pers350 { perspective: 350px; } .pers500 { perspective: 500px; } .pers650 { perspective: 650px; } /* define the container div, the cube div, and a generic face */ .container { width: 200px; height: 200px; margin: 75px 0 0 75px; border: none; } .cube { width: 100%; height: 100%; backface-visibility: visible; perspective-origin: 150% 150%; transform-style: preserve-3d; } .face { display: block; position: absolute; width: 100px; height: 100px; border: none; line-height: 100px; font-family: sans-serif; font-size: 60px; color: white; text-align: center; } /* define each face based on direction */ .front { background: rgba(0, 0, 0, 0.3); transform: translatez(50px); } .back { background: rgba(0, 255, 0, 1); color: black;...
...o200200neg { perspective-origin: -200% -200%; } .po200200pos { perspective-origin: 200% 200%; } .po200200 { perspective-origin: 200% -200%; } /* define the container div, the cube div, and a generic face */ .container { width: 100px; height: 100px; margin: 24px; border: none; } .cube { width: 100%; height: 100%; backface-visibility: visible; perspective: 300px; transform-style: preserve-3d; } .face { display: block; position: absolute; width: 100px; height: 100px; border: none; line-height: 100px; font-family: sans-serif; font-size: 60px; color: white; text-align: center; } /* define each face based on direction */ .front { background: rgba(0, 0, 0, 0.3); transform: translatez(50px); } .back { background: rgba(0, 255, 0, 1); color: black; ...
Cubic Bezier Generator - CSS: Cascading Style Sheets
var canvas = document.getelementbyid('bezier'); // make sure we don't execute when canvas isn't supported if (canvas.getcontext) { // use getcontext to use the canvas for drawing var ctx = canvas.getcontext('2d'); // clear canvas ctx.clearrect(0, 0, canvas.width, canvas.height); // draw the rulers ctx.beginpath(); ctx.strokestyle = "black"; // draw the y axis ctx.moveto(cx(0), cy(0)); ctx.lineto(cx(1), cy(0)); ctx.textalign = "right"; for (var i = 0.1; i <= 1; i = i + 0.1) { ctx.moveto(-basic_scale_size + cx(0), ly(i)); if ((i == 0.5) || (i > 0.9)) { ctx.moveto(-2 * basic_scale_size + cx(0), ly(i)); ctx.filltext(math.round(i ...
... } // draw the x axis label ctx.textalign = "left"; ctx.filltext("input (time duration ratio)", cx(0), 4 * basic_scale_size + cy(0)); // limitation the constant 4 should be dependant of the font size ctx.stroke(); ctx.closepath(); // draw the bézier curve ctx.beginpath(); ctx.moveto(cx(0), cy(0)); ctx.strokestyle = 'blue'; ctx.beziercurveto(cx(x1), cy(y1), cx(x2), cy(y2), cx(1), cy(1)); ctx.stroke(); ctx.closepath(); // draw the p2 point (with a line to p0) ctx.beginpath(); ctx.strokestyle = 'red'; ctx.moveto(cx(x1), cy(y1)); ctx.lineto(cx(0), cy(0)); ctx.stroke(); ctx.closepath(); ctx.beginpath(); ctx.movet...
...ctx.closepath(); // draw the p2 point (with a line to p0) ctx.beginpath(); ctx.strokestyle = 'red'; ctx.moveto(cx(x1), cy(y1)); ctx.lineto(cx(0), cy(0)); ctx.stroke(); ctx.closepath(); ctx.beginpath(); ctx.moveto(cx(x1), cy(y1)); ctx.arc(cx(x1), cy(y1), radius, 0, 2 * math.pi); ctx.stroke(); ctx.fillstyle = 'white'; ctx.fill(); ctx.closepath(); // draw the p3 point (with a line to p1) ctx.beginpath(); ctx.strokestyle = 'red'; ctx.moveto(cx(x2), cy(y2)); ctx.lineto(cx(1), cy(1)); ctx.stroke(); ctx.closepath(); ctx.beginpath(); ctx.moveto(cx(x2), cy(y2)); ctx.arc(cx(x2), cy(y2), radius, 0, 2 * math.pi...
... ctx.lineto(cx(1), cy(1)); ctx.stroke(); ctx.closepath(); ctx.beginpath(); ctx.moveto(cx(x2), cy(y2)); ctx.arc(cx(x2), cy(y2), radius, 0, 2 * math.pi); ctx.stroke(); ctx.fill(); ctx.closepath(); // draw the p1(1,1) point (with dashed hints) ctx.beginpath(); ctx.moveto(cx(1), cy(1)); ctx.strokestyle = 'lightgrey'; ctx.lineto(cx(0), cy(1)); ctx.moveto(cx(1), cy(1)); ctx.lineto(cx(1), cy(0)); ctx.stroke(); ctx.closepath(); ctx.beginpath(); ctx.strokestyle = "black"; ctx.fillstyle = "black"; ctx.arc(cx(1), cy(1), radius, 0, 2 * math.pi); ctx.fill(); ctx.stroke(); ctx.closepath(); // draw t...
Visual formatting model - CSS: Cascading Style Sheets
anonymous box is created when there is not an html element to use for the box. this situation happens when, for example, you declare display: flex on a parent element, and directly inside there is a run of text not contained in another element. in order to fix the box tree, an anonymous box is created around that run of text. it will then behave as a flex item, however, it cannot be targeted and styled like a regular box because there is no element to target. the same thing happens when you have text runs interspersed with block elements. in the next example i have a string inside a <div>; in the middle of my string is a <p> element containing part of the text. the string is split into three boxes in the box tree. the part of the string before the paragraph element is wrapped in an anony...
...mple i have a string inside a <div>; in the middle of my string is a <p> element containing part of the text. the string is split into three boxes in the box tree. the part of the string before the paragraph element is wrapped in an anonymous box, then we have the <p>, which generates a box, and then another anonymous box. something to consider about these anonymous boxes is that they inherit styles from their direct parent, but you cannot change how they look by targeting the anonymous box. in my examples, i am using a direct child selector to target the children of the container. this does not change the anonymous boxes, as they are not a child of the parent block. inline anonymous boxes are created when a string is split by an inline element, for example, a sentence that includes a sect...
...nymous boxes are created when a string is split by an inline element, for example, a sentence that includes a section wrapped with <em></em>. this splits the sentence into three inline boxes — an anonymous inline box before the emphasized section, the section wrapped in the <em> element, then a final anonymous inline box. ...
..., for example, a sentence that includes a section wrapped with <em></em>. this splits the sentence into three inline boxes — an anonymous inline box before the emphasized section, the section wrapped in the <em> element, then a final anonymous inline box. as with the anonymous block boxes, these anonymous inline boxes cannot be styled independently in the way the <em> can; they just inherit the styles of their container. other formatting contexts also create anonymous boxes. grid layout behaves in the same way as the flexbox example above, turning strings of text into a grid item with an anonymous box. multiple-column layout creates anonymous column boxes around the columns; these also cannot be styled or otherwise targetted. table layout will add anonymous boxes to create a proper table str...
appearance (-moz-appearance, -webkit-appearance) - CSS: Cascading Style Sheets
ra) browsers to achieve the same thing. note that firefox and edge also support -webkit-appearance, for compatibility reasons. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the -moz-appearance property was used in xul stylesheets to design custom widgets with platform-appropriate styling. it was also used in the xbl implementations of the widgets that ship with the mozilla platform. starting with gecko/firefox 80, these uses were changed to -moz-default-appearance, which should never be used outside of internal stylesheets. compatibility note: if you wish to use this property on websites, you should test it very c...
...earance:auto; } <div>lorem</div> none the user agent selects the appropriate special styling based on the element. acts as none on elements with no special styling. menulist-button div { color: black; -moz-appearance: menulist-button; -webkit-appearance: menulist-button; } <div>lorem</div> firefox chrome safari edge the element is styled as a button that would indicate a menulist can be opened. textfield div { color: black; -moz-appearance: textfield; -webkit-appearance: textfield; } <div>lorem</div> firefox chrome safari edge the following values are treated as equivalent to auto: button div { color: black; -moz-appearance: button; -webkit-appearance:...
...(not implemented for the windows platform) meterbar div { color: black; -moz-appearance: meterbar; -webkit-appearance: meterbar; } <div>lorem</div> firefox use meter instead. number-input div { color: black; -moz-appearance: number-input; -webkit-appearance: number-input; } <div>lorem</di...
...use progress-bar instead progressbar-vertical div { color: transparent; -moz-appearance: progressbar-vertical; -webkit-appearance: preogressbar-vertical; } <div>lorem</div> firefox range div { color: black; -moz-appearance: range; -webkit-appearance: range; } range <div>lorem</div> fi...
border-width - CSS: Cascading Style Sheets
t within a single document. formal definition initial valueas each of the properties of the shorthand:border-top-width: mediumborder-right-width: mediumborder-bottom-width: mediumborder-left-width: mediumapplies toall elements. ...
...roperties of the shorthand:border-top-width: mediumborder-right-width: mediumborder-bottom-width: mediumborder-left-width: mediumapplies toall elements. ...
...bottom-width: mediumborder-left-width: mediumapplies toall elements. ...
...lies to ::first-letter.inheritednocomputed valueas each of the properties of the shorthand:border-bottom-width: the absolute length or 0 if border-bottom-style is none or hiddenborder-left-width: the absolute length or 0 if border-left-style is none or hiddenborder-right-width: the absolute length or 0 if border-right-style is none or hiddenborder-top-width: the absolute length or 0 if border-top-style is none or hiddenanimation typeas each of the properties of the shorthand:border-bottom-width: a lengthborder-left-width: a lengthborder-right-width: a lengthborder-top-width: a length formal syntax <line-width>{1,4}where <line-width> = <length> | thin | medium | thick examples a mix of values and lengths html <p id="sval"> one value: 6px wide border on all 4 sides</p> <p id="bival"> ...
<display-listitem> - CSS: Cascading Style Sheets
list-item can also be combined with any <display-outside> keyword and the flow or flow-root <display-inside> keywords. note: in browsers that support the two-value syntax, if no inner value is specified it will default to flow. ...
... list-item can also be combined with any <display-outside> keyword and the flow or flow-root <display-inside> keywords. note: in browsers that support the two-value syntax, if no inner value is specified it will default to flow. ...
... list-item can also be combined with any <display-outside> keyword and the flow or flow-root <display-inside> keywords. note: in browsers that support the two-value syntax, if no inner value is specified it will default to flow. ...
...-outside> keyword and the flow or flow-root <display-inside> keywords. note: in browsers that support the two-value syntax, if no inner value is specified it will default to flow. if no outer value is specified, the principal box will have an outer display type of block. examples html <div class="fake-list">i will display as a list item</div> css .fake-list { display: list-item; list-style-position: inside; } result specifications specification status css display module level 3the definition of 'display-listitem' in that specification. candidate recommendation ...
font-synthesis - CSS: Cascading Style Sheets
alic, may be synthesized by the browser. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax this property can take any one of the following forms: the keyword value none. either of the keyword values weight and style. both the keyword values weight and style. values none indicates that neither bold nor italic typeface may be synthesized. weight indicates that a bold typeface may be synthesized if needed. style indicates that an italic typeface may be synthesized if needed. description most standard western fonts include italic and bold variants, but many novelty fonts do not. fonts used for chin...
...scription most standard western fonts include italic and bold variants, but many novelty fonts do not. fonts used for chinese, japanese, korean and other logographic scripts tend not to include these variants, and synthesizing them may impede the legibility of the text. in these cases, it may be desirable to switch off the browser's default font-synthesis. ...
...tend not to include these variants, and synthesizing them may impede the legibility of the text. in these cases, it may be desirable to switch off the browser's default font-synthesis. formal definition initial valueweight styleapplies toall elements. ...
...weight styleapplies toall elements. it also applies to ::first-letter and ::first-line.inheritedyescomputed valueas specifiedanimation typediscrete formal syntax none | [ weight | style ] examples disabling font synthesis html <em class="syn">synthesize me! 站直。</em> <br/> <em class="no-syn">don't synthesize me! 站直。</em> css em { font-weight: bold; } .syn { font-synthesis: style weight; } .no-syn { font-synthesis: none; } result specifications specification status comment css fonts module level 3the definition of 'font-synthesis' in that specification. candidate recommendation initial definition ...
font-variant - CSS: Cascading Style Sheets
-lig-values>, <discretionary-lig-values>, <historical-lig-values>, <contextual-alt-values> specifies the keywords related to the font-variant-ligatures longhand property. the possible values are: common-ligatures, no-common-ligatures, discretionary-ligatures, no-discretionary-ligatures, historical-ligatures, no-historical-ligatures, contextual, and no-contextual. stylistic(), historical-forms, styleset(), character-variant(), swash(), ornaments(), annotation() specifies the keywords and functions related to the font-variant-alternates longhand property. small-caps, all-small-caps, petite-caps, all-petite-caps, unicase, titling-caps specifies the keywords and functions related to the font-variant-caps longhand property. <numeric-figure-values>, <numeric-spacing-values>, <numeric-fraction-...
...perty. small-caps, all-small-caps, petite-caps, all-petite-caps, unicase, titling-caps specifies the keywords and functions related to the font-variant-caps longhand property. <numeric-figure-values>, <numeric-spacing-values>, <numeric-fraction-values>, ordinal, slashed-zero specifies the keywords related to the font-variant-numeric longhand property. the possible values are: lining-nums, oldstyle-nums, proportional-nums, tabular-nums, diagonal-fractions, stacked-fractions, ordinal, and slashed-zero. <east-asian-variant-values>, <east-asian-width-values>, ruby specifies the keywords related to the font-variant-east-asian longhand property. the possible values are: jis78, jis83, jis90, jis04, simplified, traditional, full-width, proportional-width, ruby. formal definition initial value...
...idth, proportional-width, ruby. formal definition initial valuenormalapplies toall elements. ...
...st-asian-width-values> | ruby ]where <common-lig-values> = [ common-ligatures | no-common-ligatures ]<discretionary-lig-values> = [ discretionary-ligatures | no-discretionary-ligatures ]<historical-lig-values> = [ historical-ligatures | no-historical-ligatures ]<contextual-alt-values> = [ contextual | no-contextual ]<feature-value-name> = <custom-ident><numeric-figure-values> = [ lining-nums | oldstyle-nums ]<numeric-spacing-values> = [ proportional-nums | tabular-nums ]<numeric-fraction-values> = [ diagonal-fractions | stacked-fractions ]<east-asian-variant-values> = [ jis78 | jis83 | jis90 | jis04 | simplified | traditional ]<east-asian-width-values> = [ full-width | proportional-width ] examples setting the small-caps font variant html <p class="normal">firefox rocks!</p> <p class="small...
Inheritance - CSS: Cascading Style Sheets
by default ("inherited: yes") or not ("inherited: no"). inherited properties when no value for an inherited property has been specified on an element, the element gets the computed value of that property on its parent element. only the root element of the document gets the initial value given in the property's summary. a typical example of an inherited property is the color property. given the style rules: p { color: green; } ... and the markup: <p>this paragraph has <em>emphasized text</em> in it.</p> ... the words "emphasized text" will appear green, since the em element has inherited the value of the color property from the p element. it does not get the initial value of the property (which is the color that is used for the root element when the page specifies no color). non-inherite...
...e initial value of the property (which is the color that is used for the root element when the page specifies no color). non-inherited properties when no value for a non-inherited property has been specified on an element, the element gets the initial value of that property (as specified in the property's summary). a typical example of a non-inherited property is the border property. given the style rules: p { border: medium solid; } ... and the markup: <p>this paragraph has <em>emphasized text</em> in it.</p> ... the words "emphasized text" will not have a border (since the initial value of border-style is none). notes the inherit keyword allows authors to explicitly specify inheritance. it works on both inherited and non-inherited properties. you can control inheritance for all p...
...then it doubles the font size and applies a font-weight of "bold". ...
...s authors to explicitly specify inheritance. it works on both inherited and non-inherited properties. you can control inheritance for all properties at once using the all shorthand property, which applies its value to all properties. for example: font { all: revert; font-size: 200%; font-weight: bold; } this reverts the style of the font property to the user agent's default unless a user stylesheet exists, in which case that is used instead. then it doubles the font size and applies a font-weight of "bold". see also css values for controlling inheritance: inherit, initial, unset, and revert introducing the css cascade cascade and inheritance css key concepts: css syntax, at-rule, comments, specificity and inheritance, the box, layout modes and visual formatting models, ...
mask - CSS: Cascading Style Sheets
Web › CSS › mask
y) by masking or clipping the image at specific points. as well as the properties listed below, the mask shorthand also resets mask-border to its initial value. it is therefore recommended to use the mask shorthand rather than other shorthands or the individual properties to override any mask settings earlier in the cascade. this will ensure that mask-border has also been reset to allow the new styles to take effect. constituent properties this property is a shorthand for the following css properties: mask-clip mask-composite mask-image mask-mode mask-origin mask-position mask-repeat mask-size syntax /* keyword values */ mask: none; /* image values */ mask: url(mask.png); /* pixel image used as mask */ mask: url(masks.svg#star); /* elemen...
...ht / 16px repeat-y; /* element within svg graphic is used as a mask on the right-hand side with a width of 16px */ values <mask-reference> sets the mask image source. see mask-image. <masking-mode> sets the masking mode of the mask image. see mask-mode. <position> sets the position of the mask image. see mask-position. <bg-size> sets the size of the mask image. see mask-size. <repeat-style> sets the repetition of the mask image. see mask-repeat. <geometry-box> if only one <geometry-box> value is given, it sets both mask-origin and mask-clip. if two <geometry-box> values are present, then the first sets mask-origin and the second sets mask-clip. <geometry-box> | no-clip sets the area that is affected by the mask image. see mask-clip. <compositing-operator> sets the compositin...
...age: discretemask-mode: discretemask-repeat: discretemask-position: repeatable list of simple list of length, percentage, or calcmask-clip: discretemask-origin: discretemask-size: repeatable list of simple list of length, percentage, or calcmask-composite: discretecreates stacking contextyes formal syntax <mask-layer>#where <mask-layer> = <mask-reference> | <position> [ / <bg-size> ]? | <repeat-style> | <geometry-box> | [ <geometry-box> | no-clip ] | <compositing-operator> | <masking-mode>where <mask-reference> = none | <image> | <mask-source><position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ]...
...| <masking-mode>where <mask-reference> = none | <image> | <mask-source><position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? ...
<percentage> - CSS: Cascading Style Sheets
n, although negative values are not valid for all properties. as with all css dimensions, there is no space between the symbol and the number. interpolation when animated, values of the <percentage> data type are interpolated as real, floating-point numbers. the speed of the interpolation is determined by the timing function associated with the animation. ...
...id for all properties. as with all css dimensions, there is no space between the symbol and the number. interpolation when animated, values of the <percentage> data type are interpolated as real, floating-point numbers. the speed of the interpolation is determined by the timing function associated with the animation. ...
...ion when animated, values of the <percentage> data type are interpolated as real, floating-point numbers. the speed of the interpolation is determined by the timing function associated with the animation. ...
... timing function associated with the animation. examples width and margin-left <div style="background-color:navy;"> <div style="width:50%; margin-left:20%; background-color:chartreuse;"> width: 50%, left margin: 20% </div> <div style="width:30%; margin-left:60%; background-color:pink;"> width: 30%, left margin: 60% </div> </div> the above html will output: font-size <div style="font-size:18px;"> <p>full-size text (18px)</p> <p><span style="font-size:50%;">50% (9px)</span></p> <p><span style="font-size:200%;">200% (36px)</span></p> </div> the above html will output: specifications specification status comment css values and units module level 4the definition of '<percentage>' in that specification. editor's draft no signific...
url() - CSS: Cascading Style Sheets
Web › CSS › url()
the url() css function is used to include a file. the parameter is an absolute url, a relative url, or a data uri. the url() function can be passed as a parameter of another css functions, like the attr() function. depending on the property for which it is a value, the resource sought can be an image, font, or a stylesheet. the url() functional notation is the value for the <url> data type. ...
...or which it is a value, the resource sought can be an image, font, or a stylesheet. the url() functional notation is the value for the <url> data type. ...
...ion */ background-image: cross-fade(20% url(first.png), url(second.png)); mask-image: image(url(mask.png), skyblue, linear-gradient(rgba(0, 0, 0, 1.0), transparent); /* as part of a non-shorthand multiple value */ content: url(star.svg) url(star.svg) url(star.svg) url(star.svg) url(star.svg); /* at-rules */ @document url("https://www.example.com/") { ... ...
...linear-gradient(rgba(0, 0, 0, 1.0), transparent); /* as part of a non-shorthand multiple value */ content: url(star.svg) url(star.svg) url(star.svg) url(star.svg) url(star.svg); /* at-rules */ @document url("https://www.example.com/") { ... } @import url("https://www.example.com/style.css"); @namespace url(http://www.w3.org/1999/xhtml); relative urls, if used, are relative to the url of the stylesheet (not to the url of the web page). the url() function can be included as a value for background, background-image, list-style, list-style-image, content, cursor, border, border-image, border-image-source, mask, mask-image, src as part of a @font-face block, and @counter-style/symbol in css level 1, the url() functional notation described only true urls. in css level 2, the definition of url...
will-change - CSS: Cascading Style Sheets
he stronger optimizations that are likely to be tied to will-change end up using a lot of a machine’s resources, and when overused like this can cause the page to slow down or consume a lot of resources. use sparingly. the normal behavior for optimizations that the browser make is to remove the optimizations as soon as it can and revert back to normal. but adding will-change directly in a stylesheet implies that the targeted elements are always a few moments away from changing and the browser will keep the optimizations for much longer time than it would have otherwise. so it is a good practice to switch will-change on and off using script code before and after the change occurs. don't apply will-change to elements to perform premature optimization. if your page is performing well...
...shorthand expands to. it cannot be one of the following values: unset, initial, inherit, will-change, auto, scroll-position, or contents. the spec doesn't define the behavior of particular value, but it is common for transform to be a compositing layer hint. chrome currently takes two actions, given particular css property idents: establish a new compositing layer or a new stacking context. via stylesheet it may be appropriate to include will-change in your style sheet for an application that does page flips on key presses like an album or a slide deck presentation where the pages are large and complex. this will let browser prepare the transition ahead of time and allow for snappy transitions between the pages as soon as the key is pressed. but use caution with the will-change property dire...
...it may cause the browser to keep the optimization in memory for much longer than it is needed. ...
...y through scripting, which is probably what you should be doing in most cases. var el = document.getelementbyid('element'); // set will-change when the element is hovered el.addeventlistener('mouseenter', hintbrowser); el.addeventlistener('animationend', removehint); function hintbrowser() { // the optimizable properties that are going to change // in the animation's keyframes block this.style.willchange = 'transform, opacity'; } function removehint() { this.style.willchange = 'auto'; } specifications specification status comment css will change module level 1the definition of 'will-change' in that specification. candidate recommendation initial definition ...
CSS: Cascading Style Sheets
Web › CSS
css describes how elements should be rendered on screen, on paper, in speech, or on other media. css among the core languages of the open web and is standardized across web browsers according to the w3c specification. previously development of various parts of css specification was done synchronously, which allowed versioning of the latest recommendation. you might have heard about css1, css2.1, css3. however, css4 has never become an official version. ...
...b developers describes every property and concept of css. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started tutorials our css learning area features multiple modules that teach css from the ground up — no previous knowledge required. css first steps css (cascading style sheets) is used to style and layout web pages — for example, to alter the font, color, size, and spacing of your content, split it into multiple columns, or add animations and other decorative features. this module provides a gentle beginning to your path towards css mastery with the basics of how it works, what the syntax looks like, and how you can start using it to add styling to html. css ...
... is styling text — one of the most common things you'll do with css. here we look at text styling fundamentals, including setting font, boldness, italics, line and letter spacing, drop shadows, and other text features. we round off the module by looking at applying custom fonts to your page, and styling lists and links. css layout at this point we've already looked at css fundamentals, how to style text, and how to style and manipulate the boxes that your content sits inside. now it's time to look at how to place your boxes in the right place concerning the viewport, and one another. we have covered the necessary prerequisites so we can now dive deep into css layout, looking at different display settings, modern layout tools like flexbox, css grid, and positioning, and some of the legacy te...
... can use as a starting point in your projects, these recipes highlight the different ways layout specifications can be used, and the choices you can make as a developer. tools for css development you can use the w3c css validation service to check if your css is valid. this is an invaluable debugging tool. firefox developer tools lets you view and edit a page's live css via the inspector and style editor tools. the web developer extension for firefox lets you track and edit live css on watched sites. the web community has created various other miscellaneous css tools for you to use. meta bugs firefox: bug 1323667 ...
font-style - SVG: Scalable Vector Graphics
the font-style attribute specifies whether the text is to be rendered using a normal, italic, or oblique face. note: as a presentation attribute, font-style can be used as a css property. see the css font-style property for more information. ...
...attribute, font-style can be used as a css property. see the css font-style property for more information. as a presentation attribute, it can be applied to any element but only has an effect on the following five elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewbox="0 0 250 30" xmlns="http://www.w3.org/2000/svg"> <text y="20" font-style="normal">normal font style</text> <text x="150" y="20" font-style="italic">italic font style</text> </svg> usage notes value normal | italic | oblique default value normal animatable yes for a description of the values, please refer to the css font-style property. specifications specification status comment css fonts ...
...text x="150" y="20" font-style="italic">italic font style</text> </svg> usage notes value normal | italic | oblique default value normal animatable yes for a description of the values, please refer to the css font-style property. specifications specification status comment css fonts module level 4the definition of 'font-style' in that specification. working draft no change css fonts module level 3the definition of 'font-style' in that specification. candidate recommendation no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'font-style' in that specification. recommendation initial definition browser compatibility the compatibility table on this p...
...nition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
<style> - SVG: Scalable Vector Graphics
Web › SVG › Element › style
the svg <style> element allows style sheets to be embedded directly within svg content. svg's style element has the same attributes as the corresponding element in html (see html's <style> element). html,body,svg { height:100%; margin: 0; padding: 0; } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <style> circle { fill: gold; stroke: maroon; stroke-width: 2px; } </style> <circle cx="5" cy="5" r="4" /> </svg> attributes type this attribute defines type of the style sheet language to use as a media type string. value type: <string>; default value: text/css; animatable: no media this attribute defines to which media the style applies. value type: <string>; default value: all; animatable: no title this attribute the title of the s...
...svg> attributes type this attribute defines type of the style sheet language to use as a media type string. value type: <string>; default value: text/css; animatable: no media this attribute defines to which media the style applies. value type: <string>; default value: all; animatable: no title this attribute the title of the style sheet which can be used to switch between alternate style sheets. ...
.../css; animatable: no media this attribute defines to which media the style applies. value type: <string>; default value: all; animatable: no title this attribute the title of the style sheet which can be used to switch between alternate style sheets. value type: <string>; default value: none; animatable: no global attributes core attributes most notably: id styling attributes class, style event attributes global event attributes, document element event attributes usage notes categoriesnonepermitted contentany elements or character data specifications specification status comment scalable vector graphics (svg) 2the definition of '<style>' in that specification. candidate recommendation scalable vector graphics (svg) 1.1 (second edi...
... recommendation initial definition ...
XSLT elements reference - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes there are two types of elements discussed here: top-level elements and instructions. a top-level element must appear as the child of either <xsl:stylesheet> or <xsl:transform>. an instruction, on the other hand, is associated with a template. a stylesheet may include several templates. a third type of element, not discussed here, is the literal result element (lre). an lre also appears in a template. it consists of any non-instruction element that should be copied as-is to the result document, for example, an <hr> element in an html conversion stylesheet. on a related note, any attribute in an lre and some attributes of a limited number of xslt elements can also include what is known as an attribut...
...ic.jpg"/> the element annotations that follow include a description, a syntax listing, a list of required and optional attributes, a description of type and position, its source in the w3c recommendation and an explanation of the degree of present gecko support. use the {{listsubpages}} macro once the bcd for <xsl:fallback>, <xsl:import>, <xsl:namespace-alias>, <xsl:number>, <xsl:output>, <xsl:stylesheet>, <xsl:text> and <xsl:value-of> is fully migrated. <xsl:apply-imports><xsl:apply-templates><xsl:attribute-set><xsl:attribute><xsl:call-template><xsl:choose><xsl:comment><xsl:copy-of><xsl:copy><xsl:decimal-format><xsl:element><xsl:fallback><xsl:for-each><xsl:if><xsl:import><xsl:include><xsl:key><xsl:message><xsl:namespace-alias><xsl:number><xsl:otherwise><xsl:output><xsl:param><xsl:preserve-s...
...ly-imports><xsl:apply-templates><xsl:attribute-set><xsl:attribute><xsl:call-template><xsl:choose><xsl:comment><xsl:copy-of><xsl:copy><xsl:decimal-format><xsl:element><xsl:fallback><xsl:for-each><xsl:if><xsl:import><xsl:include><xsl:key><xsl:message><xsl:namespace-alias><xsl:number><xsl:otherwise><xsl:output><xsl:param><xsl:preserve-space><xsl:processing-instruction><xsl:sort><xsl:strip-space><xsl:stylesheet><xsl:template><xsl:text><xsl:transform><xsl:value-of><xsl:variable><xsl:when><xsl:with-param> <xsl:apply-imports> <xsl:apply-templates> <xsl:attribute> <xsl:attribute-set> <xsl:call-template> <xsl:choose> <xsl:comment> <xsl:copy> <xsl:copy-of> <xsl:decimal-format> <xsl:element> <xsl:fallback> (not supported) <xsl:for-each> <xsl:if> <xsl:import> (mostly supported) <xsl:inclu...
... <xsl:decimal-format> <xsl:element> <xsl:fallback> (not supported) <xsl:for-each> <xsl:if> <xsl:import> (mostly supported) <xsl:include> <xsl:key> <xsl:message> <xsl:namespace-alias> (not supported) <xsl:number> (partially supported) <xsl:otherwise> <xsl:output> (partially supported) <xsl:param> <xsl:preserve-space> <xsl:processing-instruction> <xsl:sort> <xsl:strip-space> <xsl:stylesheet> (partially supported) <xsl:template> <xsl:text> (partially supported) <xsl:transform> <xsl:value-of> (partially supported) <xsl:variable> <xsl:when> <xsl:with-param> ...
For Further Reading - XSLT: Extensible Stylesheet Language Transformations
ray length: 432 pages publisher: o'reilly media; 2 edition (september 22, 2003) isbn: 0596004206 as the title indicates, this is an overview of xml generally. chapter 6 is devoted specifically to xslt. ...
...206 as the title indicates, this is an overview of xml generally. chapter 6 is devoted specifically to xslt. http://www.amazon.com/gp/product/0596004206 digital websites world wide web consortium the w3c homepage: http://www.w3.org/ the main xsl page: http://www.w3.org/style/xsl/ the version 1.0 recommendation for xslt: http://www.w3.org/tr/xslt archive of public style (css and xslt) discussions: http://lists.w3.org/archives/public/www-style/ the version 1.0 recommendation for xpath: http://www.w3.org/tr/xpath the world wide web consortium is the body that publishes recommendations for a number of web-based technologies, many of which become the de-facto standard. articles hands-on xsl author: don r. day location: http://www-106.ib...
... author: jay greenspan location: http://hotwired.lycos.com/webmonkey/...l?tw=authoring what is xslt? author: g. ...
...man/index.html tutorials/examples zvon xsl programmers: http://www.zvon.org/o_html/group_xsl.html jeni's xslt pages index: http://www.jenitennison.com/xslt/ xmlpitstop.com stylesheet center: http://www.xmlpitstop.com/default.asp?datatype=ssc xsl tutorial index: http://www.nwalsh.com/docs/tutorials/xsl/ other cover pages extensible stylesheet language (xsl): http://www.oasis-open.org/cover/xsl.html xsl-list subscribe: http://www.mulberrytech.com/xsl/xsl-list/ archives: http://www.biglist.com/lists/xsl-list/archives/ the xsl-list is a very active general mailing list, hosted by mulberry technologies mozilla.dev.tech.xslt google groups: http://groups.google.com/group/mozilla.dev.tech.xslt ...
Transforming XML with XSLT - XSLT: Extensible Stylesheet Language Transformations
documents will need to be presented to human readers. because a browser provides a familiar and highly flexible interface, it is an ideal mechanism for delivering such presentation versions of xml content. built from the ground up utilizing a wide variety of xml technologies, firefox incorporates within itself all of the mechanisms needed to process both original xml documents and the specialized stylesheets used to style and lay them out for html display, reducing server load with client-side processing. at present, gecko (the layout engine behind firefox) supports two forms of xml stylesheets. for basic control of appearance — fonts, colors, position, and so forth — gecko uses css. css1 and css2 are well supported and support for the emerging css3 standard is under development. for furth...
...rocessing. at present, gecko (the layout engine behind firefox) supports two forms of xml stylesheets. for basic control of appearance — fonts, colors, position, and so forth — gecko uses css. css1 and css2 are well supported and support for the emerging css3 standard is under development. for further information about css, see eric meyer's css pages. our focus here is on the second type of stylesheet that gecko supports: the xslt stylesheet. xslt stands for extensible stylesheet language/transform and the name is apt. ...
..., colors, position, and so forth — gecko uses css. css1 and css2 are well supported and support for the emerging css3 standard is under development. for further information about css, see eric meyer's css pages. our focus here is on the second type of stylesheet that gecko supports: the xslt stylesheet. xslt stands for extensible stylesheet language/transform and the name is apt. xslt allows a stylesheet author to transform a primary xml document in two significant ways: manipulating and sorting the content, including a wholesale reordering of it if so desired, and transforming the content into a different format (and in the case of firefox, the focus is on converting it on the fly into html which can then be displayed by the browser). xslt/xpath reference elements xsl:apply-imports (su...
...orted) xsl:if (supported) xsl:import (mostly supported) xsl:include (supported) xsl:key (supported) xsl:message (supported) xsl:namespace-alias (not supported) xsl:number (partially supported) xsl:otherwise (supported) xsl:output (partially supported) xsl:param (supported) xsl:preserve-space (supported) xsl:processing-instruction xsl:sort (supported) xsl:strip-space (supported) xsl:stylesheet (partially supported) xsl:template (supported) xsl:text (partially supported) xsl:transform (supported) xsl:value-of (partially supported) xsl:variable (supported) xsl:when (supported) xsl:with-param (supported) axes ancestor ancestor-or-self attribute child descendant descendant-or-self following following-sibling namespace (not supported) parent preceding preceding-s...
Content states and the style system - Archive of obsolete content
content states are what gecko uses to implement the various state-dependent in css (examples would be :hover, :active, :focus, :target, :checked). we will focus on describing how changes in content state are handled. generally, whenever a node's content state changes, style has to be reresolved (recomputed) for that node and all of its descendants. this is an expensive operation, however, so the style system tries to minimize the number of style reresolves it does. ...
...as to be reresolved (recomputed) for that node and all of its descendants. this is an expensive operation, however, so the style system tries to minimize the number of style reresolves it does. to this end, when a <code>contentstateschanged</code> notification is dispatched for a content node the first thing that's done is to is to check whether the content state change something could affect any styles. this is done by walking the list of all css2.1 simple selectors in all style sheets applied to the page that have a state-dependent pseudo-class as part of the selector. this list is created during the parsing of the stylesheets involved. ...
...fect any styles. this is done by walking the list of all css2.1 simple selectors in all style sheets applied to the page that have a state-dependent pseudo-class as part of the selector. this list is created during the parsing of the stylesheets involved. for each selector in this list we check whether it might have stopped matching the node or started matching it. if that has happened, then the style could depend on the state that changed and we have to reresolve style. the way we determine whether the selector might have stopped or started matching the node is by just checking whether it matches with the caveat that all the state-dependent pseudo-classes corresponding to the states that changed must be treated as matching (whether they actually do and whether they're negated or not). this i...
style - Archive of obsolete content
Archive › Mozilla › XUL › Property › style
...
... ...
... ...
Learn to style HTML using CSS - Learn web development
for example, you can use css to alter the font, color, size, and spacing of your content, split it into multiple columns, or add animations and other decorative features. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started prerequisites you should learn the basics of html before attempting any css. we recommend that you work through our introduction to html module first. ...
...the web before proceeding with this topic. however, doing so isn't absolutely necessary as much of what is covered in the css basics article is also covered in our css first steps module, albeit in a lot more detail. modules this topic contains the following modules, in a suggested order for working through them. you should definitely start with the first one. css first steps css (cascading style sheets) is used to style and lay out web pages — for example, to alter the font, color, size, and spacing of your content, split it into multiple columns, or add animations and other decorative features. this module provides a gentle beginning to your path towards css mastery with the basics of how it works, what the syntax looks like, and how you can start using it to add styling to html. css...
...n is styling text — one of the most common things you'll do with css. here we look at text styling fundamentals, including setting font, boldness, italics, line and letter spacing, drop shadows and other text features. we round off the module by looking at applying custom fonts to your page, and styling lists and links. css layout at this point we've already looked at css fundamentals, how to style text, and how to style and manipulate the boxes that your content sits inside. now it's time to look at how to place your boxes in the right place in relation to the viewport, and one another. we have covered the necessary prerequisites so we can now dive deep into css layout, looking at different display settings, modern layout tools like flexbox, css grid, and positioning, and some of the legac...
CSSStyleDeclaration.item() - Web APIs
the cssstyledeclaration.item() method interface returns a css property name from a cssstyledeclaration by index. this method doesn't throw exceptions as long as you provide arguments; the empty string is returned if the index is out of range and a typeerror is thrown if no argument is provided. syntax var propertyname = style.item(index); parameters index is the index of the node to be fetched. the index is zero-based. return value propertyname is a domstring that is the name of the css property at the specified index. ...
... typeerror is thrown if no argument is provided. syntax var propertyname = style.item(index); parameters index is the index of the node to be fetched. the index is zero-based. return value propertyname is a domstring that is the name of the css property at the specified index. javascript has a special simpler syntax for obtaining an item from a nodelist by index: var propertyname = style[index]; example var style = document.getelementbyid('div1').style; var propertyname = style.item(1); // or simply style[1] - returns the second style listed specifications specification status comment css object model (cssom)the definition of 'cssstyledeclaration.item()' in that specification. working draft document object model (dom) level 2 styl...
...ent.getelementbyid('div1').style; var propertyname = style.item(1); // or simply style[1] - returns the second style listed specifications specification status comment css object model (cssom)the definition of 'cssstyledeclaration.item()' in that specification. working draft document object model (dom) level 2 style specificationthe definition of 'cssstyledeclaration' in that specification. obsolete ...
CSSStyleDeclaration.removeProperty() - Web APIs
the cssstyledeclaration.removeproperty() method interface removes a property from a css style declaration object. syntax var oldvalue = style.removeproperty(property); parameters property is a domstring representing the property name to be removed. note that multi-word property names are hyphenated and not camel-cased. return value oldvalue is a domstring equal to the value of the css property before it was removed. exceptions domexception no_modification_allowed_err: if the property or declaration block is read only. ...
...rd property names are hyphenated and not camel-cased. return value oldvalue is a domstring equal to the value of the css property before it was removed. exceptions domexception no_modification_allowed_err: if the property or declaration block is read only. ...
...phenated and not camel-cased. return value oldvalue is a domstring equal to the value of the css property before it was removed. exceptions domexception no_modification_allowed_err: if the property or declaration block is read only. example the following javascript code removes the background-color css property from a selector rule: var declaration = document.stylesheets[0].rules[0].style; var oldvalue = declaration.removeproperty('background-color'); specifications specification status comment css object model (cssom)the definition of 'cssstyledeclaration.removeproperty()' in that specification. working draft document object model (dom) level 2 style specificationthe definition of 'cssstyledeclaration' in that specification. obso...
CSSStyleSheet.addRule() - Web APIs
the obsolete cssstylesheet interface's addrule() legacy method adds a new rule to the stylesheet. you should avoid using this method, and should instead use the more standard insertrule() method. syntax var result = cssstylesheet.addrule(selector, styleblock, index); parameters selector a domstring specifying the selector portion of the css rule. the default is the string undefined. styleblock a domstring indicating the style block to apply to elements matching the selector. the default is the string undefined. index optional an optional index into the stylesheet's cssrulelist at which to insert the new rule. if index is not specified, the next index after the last item currently in the list is used (that is, the value of cssstylesheet.cssrules.length). return value always retu...
...n the list is used (that is, the value of cssstylesheet.cssrules.length). return value always returns -1. note that due to somewhat estoteric rules about where you can legally insert rules, it's possible that an exception may be thrown. see insertrule() for more information. usage notes this method is implemented by browsers by constructing a string using the template literal `${selector}{${styleblock}}`, then passing it into the standard insertrule() method. ...
...mewhat estoteric rules about where you can legally insert rules, it's possible that an exception may be thrown. see insertrule() for more information. usage notes this method is implemented by browsers by constructing a string using the template literal `${selector}{${styleblock}}`, then passing it into the standard insertrule() method. therefore, given existing code such as the following: cssstylesheet.addrule(selector, styles, 0); you can rewrite this to use the more standard insertrule() like this: cssstylesheet.insertrule(`${selector} {${styles}}`, 0); specifications specification status comment css object model (cssom)the definition of 'cssstylesheet.addrule()' in that specification. working draft ...
CSSStyleSheet.cssRules - Web APIs
the read-only cssstylesheet property cssrules returns a live cssrulelist which provides a real-time, up-to-date list of every css rule which comprises the stylesheet. each item in the list is a cssrule defining a single rule. syntax var rules = cssstylesheet.cssrules; value a live-updating cssrulelist containing each of the css rules making up the stylesheet. each entry in the rule list is a cssrule object describing one rule making up the stylesheet. ...
..., up-to-date list of every css rule which comprises the stylesheet. each item in the list is a cssrule defining a single rule. syntax var rules = cssstylesheet.cssrules; value a live-updating cssrulelist containing each of the css rules making up the stylesheet. each entry in the rule list is a cssrule object describing one rule making up the stylesheet. examples individual rules within the stylesheet can then be accessed by index: let rulelist = document.stylesheets[0].cssrules; for (let i=0; i < rulelist.length; i++) { processrule(rulelist[i]); } rules can also be accessed using for...of: let rulelist = document.stylesheets[0].cssrules; for (let rule of rulelist) { processrule(rule); } however, because cssrule is not a proper array, you can't use foreach(). specifications ...
...0; i < rulelist.length; i++) { processrule(rulelist[i]); } rules can also be accessed using for...of: let rulelist = document.stylesheets[0].cssrules; for (let rule of rulelist) { processrule(rule); } however, because cssrule is not a proper array, you can't use foreach(). specifications specification status comment css object model (cssom)the definition of 'cssstylesheet.cssrules' in that specification. working draft ...
CSSStyleSheet.ownerRule - Web APIs
the read-only cssstylesheet property ownerrule returns the cssimportrule corresponding to the @import at-rule which imported the stylesheet into the document. if the stylesheet wasn't imported into the document using @import, the returned value is null. syntax var ownerrule = cssstylesheet.ownerrule; value a cssimportrule corresponding to the @import rule which imported the stylesheet into the document. if the stylesheet wasn't imported into the document using @import, the returned value is null. examples this snippet of code looks for rules which were not imported into the document using an @import at-rule. ...
... null. syntax var ownerrule = cssstylesheet.ownerrule; value a cssimportrule corresponding to the @import rule which imported the stylesheet into the document. if the stylesheet wasn't imported into the document using @import, the returned value is null. examples this snippet of code looks for rules which were not imported into the document using an @import at-rule. ...
...ent. if the stylesheet wasn't imported into the document using @import, the returned value is null. examples this snippet of code looks for rules which were not imported into the document using an @import at-rule. let rulelist = document.stylesheets[0].cssrules; for (let rule of rulelist) { if (!rule.ownerrule) { /* rule is not imported */ } } this snipped obtains a reference to the stylesheet associated with the @import and processes it in some manner: let rulelist = document.stylesheets[0].cssrules; for (let rule of rulelist) { if (rule.ownerrule) { checkstylesheet(rule.ownerrule.stylesheet); } } specifications specification status comment css object model (cssom)the definition of 'cssstylesheet.ownerrule' in that specification. working dra...
CanvasRenderingContext2D.fillStyle - Web APIs
the canvasrenderingcontext2d.fillstyle property of the canvas 2d api specifies the color, gradient, or pattern to use inside shapes. the default style is #000 (black). for more examples of fill and stroke styles, see applying styles and color in the canvas tutorial. syntax ctx.fillstyle = color; ctx.fillstyle = gradient; ctx.fillstyle = pattern; options color a domstring parsed as css <color> value. gradient a canvasgradient object (a linear or radial gradient). pattern a canvaspattern object (a repeating image). examples changing the fill color of a shape this example applies a blue fill color to a rectangle. ...
... parsed as css <color> value. gradient a canvasgradient object (a linear or radial gradient). pattern a canvaspattern object (a repeating image). examples changing the fill color of a shape this example applies a blue fill color to a rectangle. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.fillstyle = 'blue'; ctx.fillrect(10, 10, 100, 100); result creating multiple fill colors using loops in this example, we use two for loops to draw a grid of rectangles, each having a different fill color. to achieve this, we use the two variables i and j to generate a unique rgb color for each square, and only modify the red and green values. (the blue channel has a fixed value.) by modifying the cha...
...ique rgb color for each square, and only modify the red and green values. (the blue channel has a fixed value.) by modifying the channels, you can generate all kinds of palettes. <canvas id="canvas" width="150" height="150"></canvas> const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); for (let i = 0; i < 6; i++) { for (let j = 0; j < 6; j++) { ctx.fillstyle = `rgb( ${math.floor(255 - 42.5 * i)}, ${math.floor(255 - 42.5 * j)}, 0)`; ctx.fillrect(j * 25, i * 25, 25, 25); } } the result looks like this: screenshotlive sample specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.fillstyle' in that specification. living standard ...
HTMLStyleElement.scoped - Web APIs
the htmlstyleelement.scoped property is a boolean value indicating if the element applies to the whole document (false) or only to the parent's sub-tree (true). by default it contains the value of the scoped content attribute. ...
... the htmlstyleelement.scoped property is a boolean value indicating if the element applies to the whole document (false) or only to the parent's sub-tree (true). by default it contains the value of the scoped content attribute. ...
... the htmlstyleelement.scoped property is a boolean value indicating if the element applies to the whole document (false) or only to the parent's sub-tree (true). by default it contains the value of the scoped content attribute. ...
HTMLStyleElement.type - Web APIs
the htmlstyleelement.type read-only property returns the type of the current style. ...
... the htmlstyleelement.type read-only property returns the type of the current style. ...
... the htmlstyleelement.type read-only property returns the type of the current style. ...
StylePropertyMapReadOnly.entries() - Web APIs
example // tbd specifications specification status comment css typed om level 1the definition of 'entries()' in that specification. working draft initial definition. ...
... example // tbd specifications specification status comment css typed om level 1the definition of 'entries()' in that specification. working draft initial definition. ...
... example // tbd specifications specification status comment css typed om level 1the definition of 'entries()' in that specification. working draft initial definition. ...
StylePropertyMapReadOnly.forEach() - Web APIs
thisarg optional value to use as this (i.e the reference object) when executing callback. return value undefined. ...
... thisarg optional value to use as this (i.e the reference object) when executing callback. return value undefined. ...
... thisarg optional value to use as this (i.e the reference object) when executing callback. return value undefined. example // tbd specifications specification status comment css typed om level 1the definition of 'foreach()' in that specification. ...
StyleSheet - Web APIs
an object implementing the stylesheet interface represents a single style sheet. css style sheets will further implement the more specialized cssstylesheet interface. properties stylesheet.disabled is a boolean representing whether the current stylesheet has been applied or not. stylesheet.href read only returns a domstring representing the location of the stylesheet. stylesheet.media read only returns a medialist representing the intended destination medium for style information. stylesheet.ownernode read only returns a node associating this style sheet with the current document. stylesheet.parentstylesheet read only returns a stylesheet including this one, if any; returns null if there aren't any. ...
...string representing the location of the stylesheet. stylesheet.media read only returns a medialist representing the intended destination medium for style information. stylesheet.ownernode read only returns a node associating this style sheet with the current document. stylesheet.parentstylesheet read only returns a stylesheet including this one, if any; returns null if there aren't any. stylesheet.title read only returns a domstring representing the advisory title of the current style sheet. stylesheet.typeread only returns a domstring representing the style sheet language for this style sheet. specifications specification status comment css object model (cssom)the definition of 'stylesheet' in that specification. working draft no change from docu...
...a domstring representing the advisory title of the current style sheet. stylesheet.typeread only returns a domstring representing the style sheet language for this style sheet. specifications specification status comment css object model (cssom)the definition of 'stylesheet' in that specification. working draft no change from document object model (dom) level 2 style specification. document object model (dom) level 2 style specificationthe definition of 'stylesheet' in that specification. obsolete initial definition. ...
-moz-image-region - CSS: Cascading Style Sheets
this allows elements to use different pieces of the same image to improve performance. /* keyword value */ -moz-image-region: auto; /* <shape> value */ -moz-image-region: rect(0, 8px, 4px, 4px); /* global values */ -moz-image-region: inherit; -moz-image-region: initial; -moz-image-region: unset; the syntax is similar to the clip property. all four values are relative to the upper left corner of the image. note: for a system that works on any background, see -moz-image-rect(). ...
...) function defines a rectangle to use as shape. its parameters define the top, right, bottom, and left offsets of the edges of the image, in this order. formal definition initial valueautoapplies toxul <image> elements and :-moz-tree-image, :-moz-tree-twisty, and :-moz-tree-checkbox pseudo-elements. ...
...n only works with <image> elements where the icon is specified using list-style-image. it will not work with xul <image src="url" />.inheritedyescomputed valueas specifiedanimation typediscrete formal syntax <shape> | autowhere <shape> = rect(<top>, <right>, <bottom>, <left>) examples clipping an image #example-button { /* display only the 4x4 area from the top left of this image */ list-style-image: url("chrome://example/skin/example.png"); -moz-image-region: rect(0px, 4px, 4px, 0px); } #example-button:hover { /* use the 4x4 area to the right of the first for the hovered button */ -moz-image-region: rect(0px, 8px, 4px, 4px); } specifications not part of any standard. ...
::first-letter (:first-letter) - CSS: Cascading Style Sheets
/* selects the first letter of a <p> */ p::first-letter { font-size: 130%; } the first letter of an element is not always trivial to identify: punctuation that precedes or immediately follows the first letter is included in the match. punctuation includes any unicode character defined in the open (ps), close (pe), initial quote (pi), final quote (pf), and other punctuation (po) classes. some languages have digraphs that are always capitalized together, like the ij in dutch. ...
... case, ::first-letter will match the first letter of this generated content. css3 introduced the ::first-letter notation (with two colons) to distinguish pseudo-classes from pseudo-elements. browsers also accept :first-letter, introduced in css2. ...
...nd-color, background-image, background-clip, background-origin, background-position, background-repeat, background-size, background-attachment, and background-blend-mode all margin properties: margin, margin-top, margin-right, margin-bottom, margin-left all padding properties: padding, padding-top, padding-right, padding-bottom, padding-left all border properties: the shorthands border, border-style, border-color, border-width, border-radius, border-image, and the longhands properties the color property the text-decoration, text-shadow, text-transform, letter-spacing, word-spacing (when appropriate), line-height, text-decoration-color, text-decoration-line, text-decoration-style, box-shadow, float, vertical-align (only if float is none) css properties syntax /* css3 syntax */ ::first-le...
::part() - CSS: Cascading Style Sheets
Web › CSS › ::part
the ::part css pseudo-element represents any element within a shadow tree that has a matching part attribute. ...
... the ::part css pseudo-element represents any element within a shadow tree that has a matching part attribute. ...
... the ::part css pseudo-element represents any element within a shadow tree that has a matching part attribute. ...
::slotted() - CSS: Cascading Style Sheets
Web › CSS › ::slotted
sing</slot></li> </ul> </div> </template> a custom element — <person-details> — is defined like so: customelements.define('person-details', class extends htmlelement { constructor() { super(); let template = document.getelementbyid('person-template'); let templatecontent = template.content; const shadowroot = this.attachshadow({mode: 'open'}); let style = document.createelement('style'); style.textcontent = 'div { padding: 10px; border: 1px solid gray; width: 200px; margin: 10px; }' + 'h2 { margin: 0 0 10px; }' + 'ul { margin: 0; }' + 'p { margin: 10px 0; }' + '::slotted(*) { color: gray; font-family: sans-serif; } '; shadowro...
...this allows them to stand out better next to the slots that haven't been successfully filled. ...
...n: 10px; }' + 'h2 { margin: 0 0 10px; }' + 'ul { margin: 0; }' + 'p { margin: 10px 0; }' + '::slotted(*) { color: gray; font-family: sans-serif; } '; shadowroot.appendchild(style); shadowroot.appendchild(templatecontent.clonenode(true)); } }) you'll see that when filling the style element with content, we select all slotted elements (::slotted(*)) and give them a different font and color. this allows them to stand out better next to the slots that haven't been successfully filled. the element looks like this when inserted into the page: <person-details> <p slot="person-name">dr. shazaam</p> <span slot="person-age">immortal</span> <span slot="person-occupation">supe...
:defined - CSS: Cascading Style Sheets
Web › CSS › :defined
the :defined css pseudo-class represents any element that has been defined. this includes any standard element built in to the browser, and custom elements that have been successfully defined (i.e. with the customelementregistry.define() method). /* selects any defined element */ :defined { font-style: italic; } /* selects any instance of a specific custom element */ simple-custom:defined { display: block; } syntax :defined examples hiding elements until they are defined the following snippets are taken from our defined-pseudo-class demo (see it live also). in this demo we define a very simple trivial custom element: customelements.define('simple-custom', class extends htmlelement { constructor() { super(); let divelem = document.createelement('div'); div...
...he document, along with a standard <p>: <simple-custom text="custom element example text"></simple-custom> <p>standard paragraph example text</p> in the css we first include the following rules: // give the two elements distinctive backgrounds p { background: yellow; } simple-custom { background: cyan; } // both the custom and the built-in element are given italic text :defined { font-style: italic; } then provide the following two rules to hide any instances of our custom element that are not defined, and display instances that are defined as block level elements: simple-custom:not(:defined) { display: none; } simple-custom:defined { display: block; } this is useful if you have a complex custom element that takes a while to load into the page — you might want to hide inst...
... living standard browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and ...
:placeholder-shown - CSS: Cascading Style Sheets
the :placeholder-shown css pseudo-class represents any <input> or <textarea> element that is currently displaying placeholder text. /* selects any element with an active placeholder */ :placeholder-shown { border: 2px solid silver; } syntax :placeholder-shown examples basic example this example applies special font and border styles when the placeholder is shown. html <input placeholder="type something here!"> css input { border: 1px solid black; padding: 3px; } input:placeholder-shown { border-color: teal; color: purple; font-style: italic; } result overflowing text when form fields are too small, placeholder text can get cropped in an undesirable way. you can use the text-overflow property to alter the way overflowing text is displayed. html <input id="input1" p...
...n use the text-overflow property to alter the way overflowing text is displayed. html <input id="input1" placeholder="name, rank, and serial number"> <br><br> <input id="input2" placeholder="name, rank, and serial number"> css #input2:placeholder-shown { text-overflow: ellipsis; } result customized input field the following example highlights the branch and id code fields with a custom style. html <form id="test"> <p> <label for="name">enter student name:</label> <input id="name" placeholder="student name"/> </p> <p> <label for="branch">enter student branch:</label> <input id="branch" placeholder="student branch"/> </p> <p> <label for="sid">enter student id:</label> <input type="number" pattern="[0-9]{8}" title="8 digit id" id="sid" class="studenti...
... working draft initial definition. ...
@document - CSS: Cascading Style Sheets
Web › CSS › @document
@document url("https://www.example.com/") { h1 { color: green; } } syntax an @document rule can specify one or more matching functions. if any of the functions apply to a given url, the rule will take effect on that url. the functions available are: url(), which matches an exact url. url-prefix(), which matches if the document url starts with the value provided. domain(), which matches if the document url is on the domain provided (or a subdomain of it). ...
...ets in firefox 59 in nightly and beta — an experiment designed to mitigate potential css injection attacks (see bug 1035091). ...
... ...
@font-face - CSS: Cascading Style Sheets
ermines how a font face is displayed based on whether and when it is downloaded and ready to use. font-family specifies a name that will be used as the font face value for font properties. font-stretch a font-stretch value. since firefox 61 (and in other modern browsers) this also accepts two values to specify a range that is supported by a font-face, for example font-stretch: 50% 200%; font-style a font-style value. since firefox 61 (and in other modern browsers) this also accepts two values to specify a range that is supported by a font-face, for example font-style: oblique 20deg 50deg; font-weight a font-weight value. since firefox 61 (and in other modern browsers) this also accepts two values to specify a range that is supported by a font-face, for example font-weight: 100 400; fon...
...ttf); font-weight: bold; } } formal syntax @font-face { [ font-family: <family-name>; ] | [ src: <src>; ] | [ unicode-range: <unicode-range>; ] | [ font-variant: <font-variant>; ] | [ font-feature-settings: <font-feature-settings>; ] | [ font-variation-settings: <font-variation-settings>; ] | [ font-stretch: <font-stretch>; ] | [ font-weight: <font-weight>; ] | [ font-style: <font-style>; ] }where <family-name> = <string> | <custom-ident>+ examples specifying a downloadable font this example simply specifies a downloadable font to use, applying it to the entire body of the document: view the live example <html> <head> <title>web font sample</title> <style type="text/css" media="screen, print"> @font-face { font-family: "bitstream vera serif bold";...
...wnloadable font to use, applying it to the entire body of the document: view the live example <html> <head> <title>web font sample</title> <style type="text/css" media="screen, print"> @font-face { font-family: "bitstream vera serif bold"; src: url("https://mdn.mozillademos.org/files/2468/verasebd.ttf"); } body { font-family: "bitstream vera serif bold", serif } </style> </head> <body> this is bitstream vera serif bold. </body> </html> in this example, the user's local copy of "helvetica neue bold" is used; if the user does not have that font installed (two different names are tried), then the downloadable font named "mgopenmodernabold.ttf" is used instead: @font-face { font-family: myhelvetica; src: local("helvetica neue bold"), local("helvetica...
@keyframes - CSS: Cascading Style Sheets
this gives more control over the intermediate steps of the animation sequence than transitions. syntax @keyframes slidein { from { transform: translatex(0%); } to { transform: translatex(100%); } } values <custom-ident> a name identifying the keyframe list. this must match the identifier production in css syntax. from a starting offset of 0%. to an ending offset of 100%. <percentage> a percentage of the time through the animation sequence at which the specified keyframe should occur. ...
...rcentage of the time through the animation sequence at which the specified keyframe should occur. description javascript can access the @keyframes at-rule with the css object model interface csskeyframesrule. to use keyframes, create a @keyframes rule with a name that is then used by the animation-name property to match an animation to its keyframe declaration. each @keyframes rule contains a style list of keyframe selectors, which specify percentages along the animation when the keyframe occurs, and a block containing the styles for that keyframe. you can list the keyframe percentages in any order; they will be handled in the order they should occur. valid keyframe lists if a keyframe rule doesn't specify the start or end states of the animation (that is, 0%/from and 100%/to), browsers ...
...this can be used to animate an element from its initial state and back. properties that can't be animated in keyframe rules are ignored, but supported properties will still be animated. ...
aspect-ratio - CSS: Cascading Style Sheets
{ background: #f9a; /* red */ } } _example used iframe and dataurl to enable this iframe could resize html <label id="wf" for="w">width:165</label> <input id="w" name="w" type="range" min="100" max="250" step="5" value="165"> <label id="hf" for="w">height:165</label> <input id="h" name="h" type="range" min="100" max="250" step="5" value="165"> <iframe id="outer" src="data:text/html,<style> @media (min-aspect-ratio: 8/5) { div { background: %239af; } } @media (max-aspect-ratio: 3/2) { div { background: %239ff; } } @media (aspect-ratio: 1/1) { div { background: %23f9a; } }</style><div id='inner'> watch this element as you resize your viewport's width and height.</div>"> </iframe> css iframe{ display:block; } javascript outer.style.width=outer.style.height="165px" w.onchange...
... candidate recommendation no change. media queriesthe definiti...
... candidate recommendation no change. ...
prefers-reduced-data - CSS: Cascading Style Sheets
e so the following example will not work. ...
... example will not work. ...
...fers reduced data, in this case the "system font stack" will serve as the fallback font: html <head> <link rel="preload" href="fonts/montserrat-regular.woff2" as="font" media="(prefers-reduced-data: no-preference)" crossorigin> <link rel="stylesheet" href="style.css"> </head> css @media (prefers-reduced-data: no-preference) { @font-face { font-family: montserrat; font-style: normal; font-weight: 400; font-display: swap; /* latin */ src: local('montserrat regular'), local('montserrat-regular'), url('fonts/montserrat-regular.woff2') format('woff2'); unicode-range: u+0000-00ff, u+0131, u+0152-0153, u+02bb-02bc, u+02c6, u+02da, u+02dc, u+2000-206f, u+2074, u+20ac, u+2122, u+2191, u+2193, u+2212, u+2215, u+feff, u+fffd; } } bo...
shape - CSS: Cascading Style Sheets
Web › CSS › @media › shape
ditional designs are appropriate. round the shape is rounded or a similar shape to the circle such as an oval, an ellipse for which distinctively rounded designs are appropriate. ...
...he shape is rounded or a similar shape to the circle such as an oval, an ellipse for which distinctively rounded designs are appropriate. examples basic example html <h1>hello world!</h1> css h1 { text-align: left; } @media (shape: rect) { h1 { text-align: left; } } @media (shape: round) { h1 { text-align: center; } } custom stylesheet this html will apply a special stylesheet for devices that have round screens. ...
...n ellipse for which distinctively rounded designs are appropriate. examples basic example html <h1>hello world!</h1> css h1 { text-align: left; } @media (shape: rect) { h1 { text-align: left; } } @media (shape: round) { h1 { text-align: center; } } custom stylesheet this html will apply a special stylesheet for devices that have round screens. <head> <link rel="stylesheet" href="default.css" /> <link media="screen and (shape: rect)" rel="stylesheet" href="rectangle.css" /> <link media="screen and (shape: round)" rel="stylesheet" href="round.css" /> </head> specifications specification status css round display level 1the definition of 'shape' in that specification. working draft ...
Attribute selectors - CSS: Cascading Style Sheets
n the presence or value of a given attribute. /* <a> elements with a title attribute */ a[title] { color: purple; } /* <a> elements with an href matching "https://example.org" */ a[href="https://example.org"] { color: green; } /* <a> elements with an href containing "example" */ a[href*="example"] { font-size: 2em; } /* <a> elements with an href ending ".org" */ a[href$=".org"] { font-style: italic; } /* <a> elements whose class attribute contains the word "logo" */ a[class~="logo"] { padding: 2px; } syntax [attr] represents elements with an attribute name of attr. [attr=value] represents elements with an attribute name of attr whose value is exactly value. [attr~=value] represents elements with an attribute name of attr whose value is a whitespace-separated list of wor...
...</li> <li><a href="#insensitive">insensitive internal link</a></li> <li><a href="http://example.org">example org link</a></li> <li><a href="https://example.org">example https org link</a></li> </ul> result languages css /* all divs with a `lang` attribute are bold. */ div[lang] { font-weight: bold; } /* all divs without a `lang` attribute are italicized. */ div:not([lang]) { font-style: italic; } /* all divs in us english are blue. */ div[lang~="en-us"] { color: blue; } /* all divs in portuguese are green. */ div[lang="pt"] { color: green; } /* all divs in chinese are red, whether simplified (zh-cn) or traditional (zh-tw). */ div[lang|="zh"] { color: red; } /* all divs with a traditional chinese `data-lang` are purple. */ /* note: you could also use hyphenated a...
...the html specification requires the type attribute to be matched case-insensitively due to it primarily being used in the <input> element, trying to use attribute selectors to with the type attribute of an ordered list doesn't work without the case-sensitive modifier. css /* list types require the case sensitive flag due to a quirk in how html treats the type attribute. */ ol[type="a"] { list-style-type: lower-alpha; background: red; } ol[type="a" s] { list-style-type: lower-alpha; background: lime; } ol[type="a" s] { list-style-type: upper-alpha; background: lime; } html <ol type="a"> <li>example list</li> </ol> result specifications specification status comment selectors level 4the definition of 'attribute selectors' in that specification. ...
CSS Backgrounds and Borders - CSS: Cascading Style Sheets
styles in the css backgrounds and borders module allow filling backgrounds with color or an image (clipped or resized), or modifying them in other ways. these styles can also decorate borders with lines or images, and make them square or rounded. ...
...lement boxes can be decorated with a shadow.) reference css properties background background-attachment background-clip background-color background-image background-origin background-position background-position-x background-position-y background-repeat background-size border border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-collapse border-color border-image border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-left border-left-color border-left-style border-left-width border-radius border-right border-right-color border-right-style border-right-width border-style border-top border-top-color border-top-left-radius bo...
...apse border-color border-image border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-left border-left-color border-left-style border-left-width border-radius border-right border-right-color border-right-style border-right-width border-style border-top border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-width box-shadow tools using multiple backgrounds explains how to set one or more backgrounds on an element. scaling background images describes how to change the size and repeating behavior of background images. applying color to html elements using css an overview of how css color can be used in html, including for borders. border-image generator this int...
Styling Columns - CSS: Cascading Style Sheets
the anonymous boxes that make up your columns can’t be targeted in any way, meaning it isn’t possible to change a box's background color or have one column larger than the others. perhaps in future versions of the specification it might be. for now, however, we are able to change the spacing and add lines between columns. ...
... can change the gap by using any length unit as the value of column-gap. in the example below, the column-gap is set to 40px. the allowed value for column-gap is a <length-percentage>, this means percentages are allowed. percentage values for column-gap are calculated as a percentage of the width of the multicol container. column rules the specification defines column-rule-width, column-rule-style and column-rule-color, providing a shorthand column-rule. these properties work in exactly the same way as the border properties: any valid border-style can be used as a column-rule-style. these properties are applied to the element which is the multicol container and therefore all columns will have the same rule. rules are only drawn between columns and not on the outer edges. rules should also...
...l not push the columns apart to make space for the rule. instead, the rule overlays the gap. in this next example we have a very wide rule of 40px and a 10px gap. the rule displays under the content of the columns. in order to make space on both sides of the rule, the gap would need to be increased to be larger than 40px. summary this details all the current ways in which column boxes can be styled. in the next guide we will take a look at making elements inside a container span across all columns. ...
CSS Grid Layout and Progressive Enhancement - CSS: Cascading Style Sheets
: * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; max-width: 600px; margin: 0 auto; } .wrapper li { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } .wrapper ul { overflow: hidden; margin: 0 -10px; padding: 0; list-style: none; } .wrapper li { float: left; width: calc(33.333333% - 20px); margin: 0 10px 20px 10px; } <div class="wrapper"> <ul> <li class="card"><h2>one</h2> <p>we can use css grid to overwrite older methods.</p> </li> <li class="card"><h2>two</h2> <p>we can use css grid to overwrite older methods.</p> </li> <li class="c...
...: * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; max-width: 600px; margin: 0 auto; } .wrapper li { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } .wrapper ul { overflow: hidden; margin: 0 -10px; padding: 0; list-style: none; } .wrapper li { float: left; width: calc(33.333333% - 20px); margin: 0 10px 20px 10px; } @supports (display: grid) { .wrapper ul { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 20px; margin: 0; } .wrapper li { width: auto; min-height: auto; margin: 0; } } <div class="wrapper"> <ul> ...
...m becomes a grid item: * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; max-width: 600px; margin: 0 auto; } .wrapper li { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } .wrapper ul { margin: 0 -10px; padding: 0; list-style: none; } .wrapper li { display: inline-block; vertical-align: top; width: calc(33.333333% - 20px); margin: 0 10px 20px 10px; } @supports (display: grid) { .wrapper ul { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 20px; margin: 0; } .wrapper li { width: auto; margin: 0; } } <div class="wrapper"> ...
Using CSS counters - CSS: Cascading Style Sheets
nce initialized, a counter's value can be increased or decreased with counter-increment. the counter's name must not be "none", "inherit", or "initial"; otherwise the declaration is ignored. displaying a counter the value of a counter can be displayed using either the counter() or counters() function in a content property. the counter() function has two forms: 'counter(name)' or 'counter(name, style)'. the generated text is the value of the innermost counter of the given name in scope at the given pseudo-element.the counter is rendered in the specified style (decimal by default). the counters() function also has two forms: 'counters(name, string)' or 'counters(name, string, style)'. the generated text is the value of all counters with the given name in scope at the given pseudo-element, fro...
... basic example this example adds "section [the value of the counter]:" to the beginning of each heading. css body { counter-reset: section; /* set a counter named 'section', and its initial value is 0. ...
...s automatically created in child elements. using the counters() function, separating text can be inserted between different levels of nested counters. ...
Stacking context example 3 - CSS: Cascading Style Sheets
that arise when mixing several positioned elements in a multi-level html hierarchy and when z-indexes are assigned using class selectors. let's take as an example a three-level hierarchical menu made from several positioned divs. second-level and third-level divs appear when hovering or clicking on their parents. usually this kind of menu is script-generated either client-side or server-side, so style rules are assigned with a class selector instead of the id selector. if the three menu levels partially overlap, then managing stacking could become a problem. the first-level menu is only relatively positioned, so no stacking context is created. the second-level menu is absolutely positioned inside the parent element. in order to put it above all first-level menus, a z-index is used. the pr...
...flattening the html hierarchy. note: in the source code you will see that second-level and third level menus are made of several divs contained in an absolutely positioned container. this is useful to group and position all of them at once. ...
... opacity: 0.9; width: 200px; height: 60px; position: relative; border: 2px outset #990000; background-color: #ffdddd; padding-left: 5px; } #container2 { z-index: 1; position: absolute; top: 20px; left: 110px; } div.lev3 { z-index: 10; width: 100px; position: relative; border: 2px outset #000099; background-color: #ddddff; padding-left: 5px; } </style></head> <body> <br /> <div class="lev1"> <span class="bold">level #1</span> <div id="container1"> <div class="lev2"> <br /><span class="bold">level #2</span> <br />z-index: 1; <div id="container2"> <div class="lev3"><span class="bold">level #3</span></div> <div class="lev3"><span class="bold">level #3</span></div> <div class...
CSS Properties Reference - CSS: Cascading Style Sheets
ound background background-attachment backgroundattachment background-color backgroundcolor background-image backgroundimage background-position backgroundposition background-repeat backgroundrepeat border border border-bottom borderbottom border-bottom-color borderbottomcolor border-bottom-style borderbottomstyle border-bottom-width borderbottomwidth border-color bordercolor border-left borderleft border-left-color borderleftcolor border-left-style borderleftstyle border-left-width borderleftwidth border-right borderright border-right-color borderrightcolor border-right-style bo...
...rbottomstyle border-bottom-width borderbottomwidth border-color bordercolor border-left borderleft border-left-color borderleftcolor border-left-style borderleftstyle border-left-width borderleftwidth border-right borderright border-right-color borderrightcolor border-right-style borderrightstyle border-right-width borderrightwidth border-style borderstyle border-top bordertop border-top-color bordertopcolor border-top-style bordertopstyle border-top-width bordertopwidth border-width borderwidth clear clear clip clip color color cursor cursor display...
... cursor cursor display display filter filter float cssfloat font font font-family fontfamily font-size fontsize font-variant fontvariant font-weight fontweight height height left left letter-spacing letterspacing line-height lineheight list-style liststyle list-style-image liststyleimage list-style-position liststyleposition list-style-type liststyletype margin margin margin-bottom marginbottom margin-left marginleft margin-right marginright margin-top margintop overflow overflow padding padding padding-botto...
Using the :target pseudo-class in selectors - CSS: Cascading Style Sheets
when a url points at a specific piece of a document, it can be difficult for the user to notice. find out how you can use some simple css to draw attention to the target of a url and improve the user's experience. picking a target the pseudo-class :target is used to style the target element of a url containing a fragment identifier. for example, the url http://developer.mozilla.org/en/docs/using_the_:target_selector#example contains the fragment identifier #example. in html, identifiers are found as the values of either id or name attributes, since the two share the same namespace. thus, the example url would point to the heading "example" in this document. suppose you wish to style any h2 element that is the target of a url, but do not want any other kind of element to get a target style. ...
...rs are found as the values of either id or name attributes, since the two share the same namespace. thus, the example url would point to the heading "example" in this document. suppose you wish to style any h2 element that is the target of a url, but do not want any other kind of element to get a target style. this is simple enough: h2:target { font-weight: bold; } it's also possible to create styles that are specific to a particular fragment of the document. this is done using the same identifying value that is found in the uri. ...
...selecting the "first" link, for example, will cause <h1 id="one"> to become the target element. ...
CSS Transforms - CSS: Cascading Style Sheets
specifications specification status comment css transforms level 1 working draft initial definition. ...
... specifications specification status comment css transforms level 1 working draft initial definition. ...
... specifications specification status comment css transforms level 1 working draft initial definition. css transforms level 2 editor's draft adds individual transforms. ...
Questions about CSS - CSS: Cascading Style Sheets
Web › CSS › FAQ
cascading style sheets (css) is a rule-based language allowing developers to define styles to apply to html elements (or other markup structures). css gives more control over the appearance of a web page to the page creator than to the browser designer or the viewer. with css, the sources of style definition for a given document element are in this order of precedence: the style attribute on an individual element tag the style element that defines a specific style sheet containing style declarations or a link element that links to a separate document containing the style element. in a web page, the style element is placed between the title statement and the body statement. ...
...e definition for a given document element are in this order of precedence: the style attribute on an individual element tag the style element that defines a specific style sheet containing style declarations or a link element that links to a separate document containing the style element. in a web page, the style element is placed between the title statement and the body statement. ...
...ibute on an individual element tag the style element that defines a specific style sheet containing style declarations or a link element that links to a separate document containing the style element. in a web page, the style element is placed between the title statement and the body statement. an imported style sheet, using the css @import notation to automatically import and merge an external style sheet with the current style sheet style attributes specified by the viewer to the browser the default style sheet assumed by the browser in general, the web page creator's style sheet takes precedence, but it's recommended that browsers provide ways for the viewer to override the style attributes in some respects. since it's likely that different browsers will choose to implement css1 somewh...
Media queries - CSS: Cascading Style Sheets
app depending on the presence or value of various device characteristics and parameters. they are a key component of responsive design. for example, a media query can shrink the font size on small devices, increase the padding between paragraphs when a page is viewed in portrait mode, or bump up the size of buttons on touchscreens. in css, use the @media at-rule to conditionally apply part of a style sheet based on the result of a media query. use @import to conditionally apply an entire style sheet. media queries in html in html, media queries can be applied to various elements: in the <link> element's media attribute, they define the media to which a linked resource (typically css) should be applied. in the <source> element's media attribute, they define the media to which that source...
... media queries in javascript in javascript, you can use the window.matchmedia() method to test the window against a media query. you can also use mediaquerylist.addlistener() to be notified whenever the state of a query changes. ...
...ies can be applied to various elements: in the <link> element's media attribute, they define the media to which a linked resource (typically css) should be applied. in the <source> element's media attribute, they define the media to which that source should be applied. (this is only valid inside <picture> elements.) in the <style> element's media attribute, they define the media to which the style should be applied. media queries in javascript in javascript, you can use the window.matchmedia() method to test the window against a media query. you can also use mediaquerylist.addlistener() to be notified whenever the state of a query changes. with this functionality, your site or app can respond to changes in the device configuration, orientation, or state. you can learn more about progra...
Viewport concepts - CSS: Cascading Style Sheets
*/ window.innerwidth /* 800 */ window.outerwidth /* 800 in firefox, 1200 in chrome */ document.documentelement.clientheight /* 533 */ window.innerheight /* 533 */ window.outerheight /* 596 in firefox, 900 in chrome */ the viewport was originally 1200 x 800 pixels. upon zooming in, the viewport became 800 x 533 pixels. this is the layout viewport. sticky headers or footers, with the following styles, will stick to the top and bottom of the layout viewport respectively. body > header { position: fixed; top: 0; } body > footer { position: fixed; bottom: 0; } we got the 800 x 533 measurement when we zoomed in using the keyboard. the header and footer stayed flush against the top and bottom of the window. but what if we had pinched-zoomed on a tablet? what if a dynamic keyboard pops ...
...in our example above, or 600px, with 1vw being 6px. when zoomed in, the iframe shrinks to 400px and 1vw becomes 4px. a width-based media query within the iframe document is relative to the iframe's viewport. @media screen and (min-width: 500px) { p { color: red; } } if the above css is included in the iframe, the paragraphs will become red when the user has zoomed in, but this style does not apply in the non-zoomed-in state. svg in an svg document, the viewport is the visible area of the svg image. you can set any height and width on an svg, but the whole image might not be visible. the area that is visible is called the viewport. the size of the viewport can be defined using the width and height attributes of the <svg> element. <svg height="300" width="400"></svg> in th...
...his viewport discussion. if you include an svg file in your html, the viewport of the svg is the initial containing block, or the width and height of the svg container. using the @media query in your svg's css is relative to that container, not the browser. @media screen and (min-width: 400px) and (max-width: 500px) { /* css goes here */ } generally, when you write the above media query, the styles are applied if the viewport, generally the browser window, is between 400px and 500px, inclusive. the width media query in the svg is based on the element in which the svg is contained — the <img> if the source is an svg file, the svg itself if the svg is included directly into the html, or the parent if the parent element has a width assigned and — not the viewport’s width. with the above...
background-repeat - CSS: Cascading Style Sheets
eat: repeat; background-repeat: space; background-repeat: round; background-repeat: no-repeat; /* two-value syntax: horizontal | vertical */ background-repeat: repeat space; background-repeat: repeat repeat; background-repeat: round space; background-repeat: no-repeat round; /* global values */ background-repeat: inherit; background-repeat: initial; background-repeat: unset; values <repeat-style> the one-value syntax is a shorthand for the full two-value syntax: single value two-value equivalent repeat-x repeat no-repeat repeat-y no-repeat repeat repeat repeat repeat space space space round round round no-repeat no-repeat no-repeat in the two-value syntax, the fir...
...ot necessarily be entirely covered). the position of the non-repeated background image is defined by the background-position css property. formal definition initial valuerepeatapplies toall elements. ...
...irely covered). the position of the non-repeated background image is defined by the background-position css property. formal definition initial valuerepeatapplies toall elements. ...
box-align - CSS: Cascading Style Sheets
Web › CSS › box-align
tation is horizontal. stretch the box stretches the contents so that there is no extra space in the box. notes the edge of the box designated the start for alignment purposes depends on the box's orientation: horizontal top vertical left the edge opposite to the start is designated the end. ...
...ment is set using the element's align attribute, then the style is ignored. ...
... browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the dat...
box-decoration-break - CSS: Cascading Style Sheets
the background is also drawn independently for each fragment, which means that a background image with background-repeat: no-repeat may nevertheless repeat multiple times. formal definition initial valuesliceapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax slice | clone examples inline box fragments an inline element that contains line breaks styled with: .example { background: linear-gradient(to bottom right, yellow, green); box-shadow: 8px 8px 10px 0px deeppink, -5px -5px 5px 0px blue, 5px 5px 15px 0px yellow; padding: 0em 1em; border-radius: 16px; border-style: solid; margin-left: 10px; font: 24px sans-serif; line-height: 2; } ... <span class="example">the<br>quick<br>orange fox</span> ... results in: ad...
...results in: you can try the two inline examples above in your browser. ...
...n inline element using a large border-radius value. the second "im" has a line-break between the "i" and the "m". for comparison, the first "im" is without line breaks. note that if you stack the rendering of the two fragments horizontally next to each other it will result in the non-fragmented rendering. try the above example in your browser. block box fragments a block element with similar styles as above and no fragmentation results in: fragmenting the above block into three columns results in: note that stacking these pieces vertically will result in the non-fragmented rendering. now, the same example but styled with box-decoration-break: clone results in: note here that each fragment has an identical replicated border, box-shadow, and background. you can try the block examp...
box-flex - CSS: Cascading Style Sheets
Web › CSS › box-flex
ining box allocates the available extra space in proportion to the flex value of each of the content elements. content elements that have zero flex do not grow. if only one content element has nonzero flex, then it grows to fill the available space. content elements that have the same flex grow by the same absolute amounts. if the flex value is set using the element's flex attribute, then the style is ignored. to make xul elements in a containing box the same size, set the containing box's equalsize attribute to the value always. this attribute does not have a corresponding css property. a trick to make all content elements in a containing box the same size, is to give them all a fixed size (e.g. height: 0), and the same box-flex value greater than zero (e.g. -moz-box-flex: 1). formal de...
...e.g. -moz-box-flex: 1). ...
... ...
<color> - CSS: Cascading Style Sheets
e used wherever a <color> value can be used. currentcolor keyword the currentcolor keyword represents the value of an element's color property. this lets you use the color value on properties that do not receive it by default. if currentcolor is used as the value of the color property, it instead takes its value from the inherited value of the color property. currentcolor example html <div style="color:blue; border: 1px dashed currentcolor;"> the color of this text is blue. <div style="background:currentcolor; height:9px;"></div> this block is surrounded by a blue border. </div> result rgb colors the rgb color model defines a given color according to its red, green, and blue components. an optional alpha component represents the color's transparency. syntax rgb colors can be...
...v { width: 100%; height: 200px; } javascript const inputelem = document.queryselector('input'); const divelem = document.queryselector('div'); function validtextcolor(stringtotest) { if (stringtotest === "") { return false; } if (stringtotest === "inherit") { return false; } if (stringtotest === "transparent") { return false; } const image = document.createelement("img"); image.style.color = "rgb(0, 0, 0)"; image.style.color = stringtotest; if (image.style.color !== "rgb(0, 0, 0)") { return true; } image.style.color = "rgb(255, 255, 255)"; image.style.color = stringtotest; return image.style.color !== "rgb(255, 255, 255)"; } inputelem.addeventlistener('change', () => { if(validtextcolor(inputelem.value)) { divelem.style.backgroundcolor = inputelem.value; ...
... /* these syntax variations all specify the same color: a fully opaque hot pink. ...
element() - CSS: Cascading Style Sheets
Web › CSS › element
id the id of an element to use as the background, specified using the html attribute #id on the element. examples these examples can be viewed live in builds of firefox that support -moz-element(). a somewhat realistic example this example uses a hidden <div> as a background. the background element uses a gradient, but also includes text that is rendered as part of the background. ...
... support -moz-element(). a somewhat realistic example this example uses a hidden <div> as a background. the background element uses a gradient, but also includes text that is rendered as part of the background. <div style="width:400px; height:400px; background:-moz-element(#mybackground1) no-repeat;"> <p>this box uses the element with the #mybackground1 id as its background!</p> </div> <div style="overflow:hidden; height:0;"> <div id="mybackground1" style="width:1024px; height:1024px; background-image: linear-gradient(to right, red, orange, yellow, white);"> <p style="transform-origin:0 0; transform: rotate(45deg); color:white;">this text is part of the background. cool, huh?</p> </div> </div> the <div> element with the id "mybackground1" is used as the background for the content i...
...1" is used as the background for the content including the paragraph "this box uses the element with the #mybackground1 id as its background!". a somewhat more bizarre example this example uses a hidden <button> element in a repeating pattern as its background. this demonstrates that you can use arbitrary elements as background, but doesn't necessarily demonstrate good design practices. <div style="width:400px; height:100px; background:-moz-element(#mybackground2);"> </div> <div style="overflow:hidden; height:0;"> <button id="mybackground2" type="button">evil button!</button> </div> specifications specification status comment css images module level 4the definition of 'using elements as images: the element() notation' in that specification. working dr...
font-family - CSS: Cascading Style Sheets
of fonts, from highest priority to lowest. font selection does not simply stop at the first font in the list that is on the user's system. rather, font selection is done one character at a time, so that if an available font does not have a glyph for a needed character, the latter fonts are tried. (however, this doesn't work in internet explorer 6 or earlier.) when a font is only available in some styles, variants, or sizes, those properties may also influence which font family is chosen. syntax /* a font family name and a generic family name */ font-family: gill sans extrabold, sans-serif; font-family: "goudy bookletter 1911", sans-serif; /* a generic family name only */ font-family: serif; font-family: sans-serif; font-family: monospace; font-family: cursive; font-family: fantasy; font-fami...
... font families, the first with a <family-name> and the second with a <generic-name>: font-family: gill sans extrabold, sans-serif; values <family-name> the name of a font family. for example, "times" and "helvetica" are font families. font family names containing whitespace should be quoted. <generic-name> generic font families are a fallback mechanism, a means of preserving some of the style sheet author's intent when none of the specified fonts are available. generic family names are keywords and must not be quoted. a generic font family should be the last item in the list of font family names. the following keywords are defined: serif glyphs have finishing strokes, flared or tapering ends, or have actual serifed endings. e.g. lucida bright, lucida fax, palatino, "palatino ...
.... math this is for the particular stylistic concerns of representing mathematics: superscript and subscript, brackets that cross several lines, nesting expressions, and double struck glyphs with distinct meanings. this is some example math text: ax² + bx + c = 0. emoji fonts that are specifically designed to render emoji. this is some example emoji text: ✝♾. fangsong a particular style of chinese characters that are between serif-style song and cursive-style kai forms. this style is often used for government documents. this is some example fangsong text with the chinese characters for "fangsong" in traditional and simple forms, respectively: 仿宋體 仿宋体. valid family names font family names must either be given quoted as strings, or unquoted as a sequence of one ...
ime-mode - CSS: Cascading Style Sheets
Web › CSS › ime-mode
me mode. this property should only be used for private web applications or to undo the property if it was previously set by legacy code. syntax the ime-mode property is specified using one of the keyword values listed below. values auto no change is made to the current input method editor state. this is the default. normal the ime state should be normal; this value can be used in a user style sheet to override the page's setting. this value is not supported by internet explorer. active the input method editor is initially active; text entry is performed through it unless the user specifically dismisses it. not supported on linux. inactive the input method editor is initially inactive, but the user may activate it if they wish. not supported on linux. disabled the input method ed...
...led and may not be activated by the user. description unlike internet explorer, firefox's implementation of ime-mode allows this property on <input type="password">. however, this makes for a bad user experience, and password fields should not enable the ime. users may correct the inappropriate behavior of sites that don't follow this recommendation by placing the following css into their user stylesheet: input[type=password] { ime-mode: auto !important; } the mac version of gecko 1.9 (firefox 3) can't recover the previous state of the ime when a field for which it is disabled loses focus, so mac users may get grumpy when you use the disabled value. formal definition initial valueautoapplies totext fieldsinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto |...
...ritednocomputed valueas specifiedanimation typediscrete formal syntax auto | normal | active | inactive | disabled examples disabling input method support this example disables input method support for a form field. in the past, this was commonly used on fields that entered data into databases which didn't support extended character sets. <input type="text" name="name" value="initial value" style="ime-mode: disabled"> note: you shouldn't rely on disabling ime to prevent extended characters from passing through your form. even with ime disabled, users can still paste extended characters into your form's fields. specifications specification status comment css basic user interface module level 3the definition of 'ime-mode' in that specification. recommenda...
Specified value - CSS: Cascading Style Sheets
if none of the above pertain, the element's initial value will be used. ...
... if none of the above pertain, the element's initial value will be used. ...
... if none of the above pertain, the element's initial value will be used. ...
<transform-function> - CSS: Cascading Style Sheets
)</option> <option>perspective(200px)</option> <option>matrix(1, 2, -1, 1, 80, 80)</option> <option>matrix3d(1,0,0,0,0,1,3,0,0,0,1,0,50,100,0,1.1)</option> </select> </div> </main> css main { width: 400px; height: 200px; padding: 50px; background-image: linear-gradient(135deg, white, cyan, white); } #example-element { width: 100px; height: 100px; transform-style: preserve-3d; transition: transform 1.5s; transform: rotate3d(1, 1, 1, 30deg); } .face { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; position: absolute; backface-visibility: inherit; font-size: 60px; color: #fff; } .front { background: rgba(90,90,90,.7); transform: translatez(50px); } .back { background: rgba(0,210,0...
... editor's draft added 3d transform functions. c...
... editor's draft added 3d transform functions. css transforms level 1the definition of '<transform-function>' in that specification. working draft ini...
<url> - CSS: Cascading Style Sheets
Web › CSS › url
uri or url? there is a difference between a uri and a url. a uri simply identifies a resource. a url is a type of uri, and describes the location of a resource. a uri can be either a url or a name (urn) of a resource. in css level 1, the url() functional notation described only true urls. in css level 2, the definition of url() was extended to describe any uri, whether a url or a urn. ...
...necessary, since urns are almost never used in actual css. to alleviate the confusion, css level 3 returned to the narrower, initial definition. now, url() denotes only true <url>s. syntax the <url> data type is specified using the url() functional notation. it may be written without quotes, or surrounded by single or double quotes. relative urls are allowed, and are relative to the url of the stylesheet (not to the url of the web page). if you choose to write the url without quotes, use a backslash (\) before any parentheses, whitespace characters, single quotes (') and double quotes (") that are part of the url. <a_css_property>: url("http://mysite.example.com/mycursor.png") <a_css_property>: url('http://mysite.example.com/mycursor.png') <a_css_property>: url(http://mysite.example.com/my...
...fore any parentheses, whitespace characters, single quotes (') and double quotes (") that are part of the url. <a_css_property>: url("http://mysite.example.com/mycursor.png") <a_css_property>: url('http://mysite.example.com/mycursor.png') <a_css_property>: url(http://mysite.example.com/mycursor.png) examples .topbanner { background: url("topbanner.png") #00d no-repeat fixed; } ul { list-style: square url(http://www.example.com/redball.png); } specifications specification status comment css values and units module level 4the definition of '<url>' in that specification. editor's draft css values and units module level 3the definition of '<url>' in that specification. candidate recommendation no significant change from css level 2 (rev...
style - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. usage note: this attribute must not be used to convey semantic information. even if all styling is removed, a page should remain semantically correct. typically it shouldn't be used to hide irrelevant information; this should be done using the hidden attribute. ...
...d send us a pull request. usage note: this attribute must not be used to convey semantic information. even if all styling is removed, a page should remain semantically correct. typically it shouldn't be used to hide irrelevant information; this should be done using the hidden attribute. specifications specification status comment html living standardthe definition of 'style' in that specification. living standard no change from latest snapshot, html 5.1 html 5.1the definition of 'style' in that specification. recommendation snapshot of html living standard, no change from html5 html5the definition of 'style' in that specification. recommendation snapshot of html living standard. from html 4.01 specification, it is now a true globa...
...test snapshot, html 5.1 html 5.1the definition of 'style' in that specification. recommendation snapshot of html living standard, no change from html5 html5the definition of 'style' in that specification. recommendation snapshot of html living standard. from html 4.01 specification, it is now a true global attribute. html 4.01 specificationthe definition of 'style' in that specification. recommendation supported on all elements but <base>, <basefont>, <head>, <html>, <meta>, <param>, <script>, <style>, and <title>. css style attributes recommendation defines the content of the style attribute. ...
Advanced Example - XSLT: Extensible Stylesheet Language Transformations
// importnode is used to clone the nodes we want to process via xslt - true makes it do a deep clone var mynode = document.getelementbyid("example"); var clonednode...
...nding"); else xsltprocessor.setparameter(null, "myorder", "descending"); // initiate the transformation var fragment = xsltprocessor.transformtofragment(xmlref, document); // clear the contents document.getelementbyid("example").innerhtml = ""; mydom = fragment; // add the new content from the transformation document.getelementbyid("example").appendchild(fragment) } // xsl stylesheet: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="html" indent="yes" /> <xsl:param name="myorder" /> <xsl:template match="/"> <xsl:apply-templates select="/div//div"> <xsl:sort select="." data-type="number...
..." xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="html" indent="yes" /> <xsl:param name="myorder" /> <xsl:template match="/"> <xsl:apply-templates select="/div//div"> <xsl:sort select="." data-type="number" order="{$myorder}" /> </xsl:apply-templates> </xsl:template> <xsl:template match="div"> <xsl:copy-of select="." /> </xsl:template> </xsl:stylesheet> ...
XSLT: Extensible Stylesheet Language Transformations
Web › XSLT
although the process is referred to as "transformation," the original document is not changed; rather, a new xml document is created based on the content of an existing document. then, the new document may be serialized (output) by the processor in standard xml syntax or in another format, such as html or plain text. ...
...e content of an existing document. then, the new document may be serialized (output) by the processor in standard xml syntax or in another format, such as html or plain text. xslt is most often used to convert data between different xml schemas or to convert xml data into web pages or pdf documents. documentation xslt element reference reference. transforming xml with xslt xslt allows a stylesheet author to transform a primary xml document in two significant ways: manipulating and sorting the content, including a wholesale reordering of it if so desired, and transforming the content into a different format. using the mozilla javascript interface to xsl transformations this document describes the javascript interface to the xslt processing engine in mozilla 1.2 and up. specifying pa...
... significant ways: manipulating and sorting the content, including a wholesale reordering of it if so desired, and transforming the content into a different format. using the mozilla javascript interface to xsl transformations this document describes the javascript interface to the xslt processing engine in mozilla 1.2 and up. specifying parameters using processing instructions firefox allows stylesheet parameters to be specified when using the <?xml-stylesheet?> processing instruction. this is done using the <?xslt-param?> pi described in this document. xslt & xpath tutorial the topxml xslt tutorial introduces you to the basics of xslt concepts, syntax, and programming. xslt tutorial this w3schools tutorial teaches the reader how to use xslt to transform xml documents into other format...
XUL Coding Style Guidelines - Archive of obsolete content
xul, pronounced as "zool", stands for "xml-based user interface language", is a cross platform way of describing user interface. it could contain xul specific element types for ui controls, html4 markups for content data, and even javascript for user event handling. to make xul files easy to read and maintain, localization friendly, and portable across user agents, we need to have a set of coding style guidelines to ensure our objectives are achievable. the author has collected a set of guidelines from various sources listed in the references section. while some of the guidelines are recommended practices, the others are mandatory. xml, xul, html, and xhtml guidelines the following are considered good coding style for xml/xul documents. disobeying them might not cause any parsing error for now...
...alized for a specific language or culture. in the new world, mozilla 5.0, this is not true any more. most of the windows and dialogs in mozilla will be described using xul. to make xul stream/file localizable, several guidelines are to be adopted to make the translation work easier and less error-prone. the issues are discussed in details here: what is localizable? widget resources content data style info layout geometry how to make them localizable? localization notes localization notes are the xul writers' notes to the localizers/translators. they are placed above the actual entity string in the format: <!-- localization note (entity.name): content --> where the <var>entity.name</var> is the entity name (id) for the string (entity value) to be localized, and the content provides helpfu...
Style origin - MDN Web Docs Glossary: Definitions of Web-related terms
in css, there are three categories of sources for style changes. these categories are called style origins. they are the user agent origin, user origin, and the author origin. user-agent origin the user agent origin is the style origin comprised of the default styles used by the user's web browser. if no other styles are applied to content, the user agent origin's styles are used while rendering elements. user origin the user origin is the style origin containing any css that the user of the web browser has added. these may be from adding styles using a developer tool or from a browser extension that automatically applies custom styles to content, such as stylus or stylish. ...
...ed to content, the user agent origin's styles are used while rendering elements. user origin the user origin is the style origin containing any css that the user of the web browser has added. these may be from adding styles using a developer tool or from a browser extension that automatically applies custom styles to content, such as stylus or stylish. author origin the author origin is the style origin which contains all of the styles which are part of the document, whether embedded within the html or loaded from an external stylesheet file. the style origins are used to determine where to stop rolling back (or backtracking through) the cascade of styles that have been applied to an element when removing styles, such as when using the unset or revert keywords. learn more technical in...
Stylesheet - MDN Web Docs Glossary: Definitions of Web-related terms
a stylesheet is a set of css rules used to control the layout and design of a webpage or document. internal stylesheets are placed inside a <style> element inside the <head> of a web document, and external stylesheets are placed inside a separate .css file, which is applied to a document by referencing the file inside a <link> element in the document's head. external stylesheets are generally preferred because they allow you to control the styling of multiple pages from a single place, rather than having to repeat the css across each page. ...
...xternal stylesheets are placed inside a separate .css file, which is applied to a document by referencing the file inside a <link> element in the document's head. external stylesheets are generally preferred because they allow you to control the styling of multiple pages from a single place, rather than having to repeat the css across each page. ...
Animation.commitStyles() - Web APIs
the commitstyles() method of the web animations api's animation interface commits the end styling state of an animation to the element being animated, even after that animation has been removed. it will cause the end styling state to be written to the element being animated, in the form of properties inside a style attribute. syntax animation.commitstyles(); parameters none. return value none. ...
...n the form of properties inside a style attribute. syntax animation.commitstyles(); parameters none. return value none. examples const divelem = document.queryselector('div'); document.body.addeventlistener('mousemove', evt => { let anim = divelem.animate( { transform: `translate(${ evt.clientx}px, ${evt.clienty}px)` }, { duration: 500, fill: 'forwards' } ); anim.commitstyles(); }); specifications specification status comment web animationsthe definition of 'commitstyles()' in that specification. working draft ...
CSSStyleDeclaration.getPropertyCSSValue() - Web APIs
the cssstyledeclaration.getpropertycssvalue() method interface returns a cssvalue containing the css value for a property. note that it returns null if the property name is a shorthand property. you should use cssstyledeclaration.getpropertyvalue() instead. syntax var value = style.getpropertycssvalue(property); parameters property is a domstring representing the property name to be retrieved. return value value is a cssvalue containing the css value for a property. if none exists, returns null. ...
...opertyvalue() instead. syntax var value = style.getpropertycssvalue(property); parameters property is a domstring representing the property name to be retrieved. return value value is a cssvalue containing the css value for a property. if none exists, returns null. example the following javascript code gets an object containing the computed rgb values of the color css property: var style = window.getcomputedstyle(elem, null); var rgbobj = style.getpropertycssvalue('color').getrgbcolorvalue(); specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssstyledeclaration' in that specification. obsolete declared as obsolete in july 2003. ...
CSSStyleDeclaration.getPropertyValue() - Web APIs
the cssstyledeclaration.getpropertyvalue() method interface returns a domstring containing the value of a specified css property. syntax var value = style.getpropertyvalue(property); parameters property is a domstring representing the property name to be checked. return value value is a domstring containing the value of the property. if not set, returns the empty string. example the following javascript code queries the value of the margin property in a css selector rule: var declaration = document.stylesheets[0].cssrules[0].style; var value = declaration.getpropertyvalue('margin'); // "1px 2px" specifications specification status comment css object model (cssom)the definition of 'cssstyledeclaration.getpropertyvalue()' in that specification. wo...
... in a css selector rule: var declaration = document.stylesheets[0].cssrules[0].style; var value = declaration.getpropertyvalue('margin'); // "1px 2px" specifications specification status comment css object model (cssom)the definition of 'cssstyledeclaration.getpropertyvalue()' in that specification. working draft document object model (dom) level 2 style specificationthe definition of 'cssstyledeclaration' in that specification. obsolete ...
CSSStyleDeclaration.length - Web APIs
the read-only property returns an integer that represents the number of style declarations in this css declaration block. syntax var num = styles.length; value an integer that provides the number of styles explictly set on the parent of the instance. example the following gets the number of explicitly set styles on the following html element: <div id="div1" style="margin: 0 10px; background-color: #ca1; font-family: monospace"></div> javascript code: var mydiv = document.getelementbyid('div1'); var divstyle = mydiv.style; var len = divstyle.length; // 6 specifications specification status comment css object model (cssom)the definition of 'cssstyledeclaration.length' in that specification. working draft document object model (dom) level 2 s...
... javascript code: var mydiv = document.getelementbyid('div1'); var divstyle = mydiv.style; var len = divstyle.length; // 6 specifications specification status comment css object model (cssom)the definition of 'cssstyledeclaration.length' in that specification. working draft document object model (dom) level 2 style specificationthe definition of 'cssstyledeclaration' in that specification. obsolete ...
CSSStyleDeclaration.parentRule - Web APIs
the cssstyledeclaration.parentrule read-only property returns a cssrule that is the parent of this style block, e.g. a cssstylerule representing the style for a css selector. syntax var rule = styles.parentrule; value the css rule that contains this declaration block or null if this cssstyledeclaration is not attached to a cssrule. example the following javascript code gets the parent css style rule from a cssstyledeclaration: var declaration = document.stylesheets[0].rules[0].style; var rule = declaration.parentrule; specifications specification status comment css object model (cssom)the definition of 'cssstyledeclaration.parentrule' in that specification. ...
...t code gets the parent css style rule from a cssstyledeclaration: var declaration = document.stylesheets[0].rules[0].style; var rule = declaration.parentrule; specifications specification status comment css object model (cssom)the definition of 'cssstyledeclaration.parentrule' in that specification. working draft document object model (dom) level 2 style specificationthe definition of 'cssstyledeclaration' in that specification. obsolete ...
CSSStyleSheet.removeRule() - Web APIs
the obsolete cssstylesheet method removerule() removes a rule from the stylesheet object. it is functionally identical to the standard, preferred method deleterule(). note: this is a legacy method which has been replaced by the standard method deleterule(). you should use that instead. syntax cssstylesheet.removerule(index) parameters index the index into the stylesheet's cssrulelist indicating the rule to be removed. return value undefined example this example removes the first rule from the stylesheet mystyles. ...
...ferred method deleterule(). note: this is a legacy method which has been replaced by the standard method deleterule(). you should use that instead. syntax cssstylesheet.removerule(index) parameters index the index into the stylesheet's cssrulelist indicating the rule to be removed. return value undefined example this example removes the first rule from the stylesheet mystyles. mystyles.removerule(0); you can rewrite this to use the standard deleterule() method very easily: mystyles.deleterule(0); specifications specification status comment css object model (cssom)the definition of 'cssstylesheet.removerule()' in that specification. working draft ...
CSSStyleSheet.rules - Web APIs
rules is a deprecated legacy property of the cssstylesheet interface. functionally identical to the preferred cssrules property, it provides access to a live-updating list of the css rules comprising the stylesheet. note: as a legacy property, you not use rules and should instead use the preferred cssrules. while rules is unlikely to be removed soon, its availability is not as widespread and using it will result in compatibility problems for your site or app. syntax var rules = cssstylesheet.rules; value a live-updating cssrulelist containing each of the css rules making up the stylesheet. each entry in the rule list is a cssrule object describing one rule making up the stylesheet. specifications specification status comment css object model (cssom)the defini...
...ult in compatibility problems for your site or app. syntax var rules = cssstylesheet.rules; value a live-updating cssrulelist containing each of the css rules making up the stylesheet. each entry in the rule list is a cssrule object describing one rule making up the stylesheet. specifications specification status comment css object model (cssom)the definition of 'cssstylesheet.rules' in that specification. working draft ...
CSSStyleValue.parse() - Web APIs
the parse() method of the cssstylevalue interface sets a specific css property to the specified values and returns the first value as a cssstylevalue object. syntax cssstylevalue.parse(property, csstext) parameters property a css property to set. csstext a comma-separated string containing one or more values to apply to the provided property. return value a cssstylevalue object containing the first supplied value. example the code below parses a set of declarations for the transform property. the second code block shows the structure of the returned object as it would be rendered in a developer tools console. ...
...o set. csstext a comma-separated string containing one or more values to apply to the provided property. return value a cssstylevalue object containing the first supplied value. example the code below parses a set of declarations for the transform property. the second code block shows the structure of the returned object as it would be rendered in a developer tools console. const css = cssstylevalue.parse( 'transform', 'translate3d(10px,10px,0) scale(0.5)'); csstransformvalue {0: csstranslate, 1: cssscale, length: 2, is2d: false} specifications specification status comment css typed om level 1the definition of 'parse()' in that specification. working draft initial definition. ...
CSSStyleValue - Web APIs
the cssstylevalue interface of the the css typed object model api is the base class of all css values accessible through the typed om api. an instance of this class may be used anywhere a string is expected. interfaces based on cssstylevalue below is a list of interfaces based on the cssstylevalue interface. cssimagevalue csskeywordvalue cssnumericvalue csspositionvalue csstransformvalue cssunparsedvalue methods cssstylevalue.parse() sets a specific css property to the specified values and returns the first value as a cssstylevalue object. cssstylevalue.parseall() sets all occurences of a specific css property to the specified valueand returns an array of cssstylevalue objects, each containing one of the supplied values. specifications specification status ...
...pecific css property to the specified values and returns the first value as a cssstylevalue object. cssstylevalue.parseall() sets all occurences of a specific css property to the specified valueand returns an array of cssstylevalue objects, each containing one of the supplied values. specifications specification status comment css typed om level 1the definition of 'cssstylevalue' in that specification. working draft initial definition. ...
CSS Counter Styles - Web APIs
the css counter styles module allows to define custom counter styles, which can be used for css list-marker and generated-content counters. interfaces csscounterstylerule represents an @counter-style rule. ...
... the css counter styles module allows to define custom counter styles, which can be used for css list-marker and generated-content counters. interfaces csscounterstylerule represents an @counter-style rule. ...
Element.currentStyle - Web APIs
element.currentstyle is a proprietary property which is similar to the standardized window.getcomputedstyle() method. it is available in old versions of microsoft internet explorer. however, it returns the units set in css while window.getcomputedstyle() returns the values in pixels. polyfill this polyfill returns the values in pixels and is likely to be rather slow, as it has to call window.getcomputedstyle() every time its value is read. /* any copyright is dedicated to the public domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ if (!("currentstyle" in element.prototype)) { object.defineproperty(element.prototype, "currentstyle", { get: function() { return window.getcomputedstyle(this); } }); } specification not part of any specification. microsof...
...n on msdn. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
Element.runtimeStyle - Web APIs
summary element.runtimestyle is a proprietary property similar to htmlelement.style, except its styles, that have higher precedence and modification. it does not modify the style content attribute. it is available in old versions of microsoft internet explorer. specification not a part of any specification. microsoft had a description on msdn. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...n on msdn. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
StylePropertyMapReadOnly.size - Web APIs
example // tbd specifications specification status comment css typed om level 1the definition of 'size' in that specification. ...
... example // tbd specifications specification status comment css typed om level 1the definition of 'size' in that specification. ...
StyleSheet.disabled - Web APIs
the disabled property of the stylesheet interface determines whether the style sheet is prevented from applying to the document. a style sheet may be disabled by manually setting this property to true or if it's an inactive alternative style sheet. note that disabled == false does not guarantee the style sheet is applied (it could be removed from the document, for instance). syntax bool = stylesheet.disabled example // if the stylesheet is disabled... if (stylesheet.disabled) { // ... apply styles in-line. } specification specification status comment css object model (cssom)the definition of 'stylesheet.disabled' in that specification. working draft no change from document object model (dom) level 2 style specification. document object model (d...
... example // if the stylesheet is disabled... if (stylesheet.disabled) { // ... apply styles in-line. } specification specification status comment css object model (cssom)the definition of 'stylesheet.disabled' in that specification. working draft no change from document object model (dom) level 2 style specification. document object model (dom) level 2 style specificationthe definition of 'stylesheet.disabled' in that specification. obsolete initial definition. ...
Stylesheet.href - Web APIs
Web › API › StyleSheet › href
the href property of the stylesheet interface returns the location of the style sheet. syntax uri = stylesheet.href parameters uri is a string containing the stylesheet's uri. example // on a local machine: <html> <head> <link rel="stylesheet" href="example.css" type="text/css" /> <script> function sref() { alert(document.stylesheets[0].href); } </script> </head> <body> <div class="thunder">thunder</div> <button onclick="sref()">ss</button> </body> </html> // returns "file:////c:/windows/desktop/example.css notes if the style sheet is a linked style sheet, the value of its attribute is its location. for inline style sheets, the value of this attribute is null. this property is read-only in firefox, opera, google chrome, and safari, and it is...
...le.css notes if the style sheet is a linked style sheet, the value of its attribute is its location. for inline style sheets, the value of this attribute is null. this property is read-only in firefox, opera, google chrome, and safari, and it is read/write in internet explorer. specifications specification status comment css object model (cssom)the definition of 'stylesheet: href' in that specification. working draft ...
StyleSheet.ownerNode - Web APIs
the ownernode property of the stylesheet interface returns the node that associates this style sheet with the document. this is usually an html <link> or <style> element, but can also return a processing instruction node in the case of <?xml-stylesheet ?>. syntax noderef = stylesheet.ownernode example <html lang="en"> <head> <link rel="stylesheet" href="example.css"> </head> <body> <button onclick="alert(document.stylesheets[0].ownernode)">show example.css’s ownernode</button> </body> </html> // displays "object htmllinkelement" notes for style sheets that are included by other style sheets, such as with @import, the value of this property is null. ...
...> <button onclick="alert(document.stylesheets[0].ownernode)">show example.css’s ownernode</button> </body> </html> // displays "object htmllinkelement" notes for style sheets that are included by other style sheets, such as with @import, the value of this property is null. specifications specification status comment css object model (cssom)the definition of 'stylesheet: ownernode' in that specification. working draft ...
StyleSheetList - Web APIs
the stylesheetlist interface represents a list of stylesheet. it is an array-like object but can't be iterated over using array methods. however it can be iterated over in a standard for loop over its indices, or converted to an array. examples get document stylesheet objects with for loop for (let i = 0; i < document.stylesheets.length; i++) { let stylesheet = document.stylesheets[i]; } get all css rules for the document using array methods const allcss = [...document.stylesheets] .map(stylesheet => { try { return [...stylesheet.cssrules] .map(rule => rule.csstext) .join(''); } catch (e) { console.log('access to stylesheet %s is denied. ...
...= 0; i < document.stylesheets.length; i++) { let stylesheet = document.stylesheets[i]; } get all css rules for the document using array methods const allcss = [...document.stylesheets] .map(stylesheet => { try { return [...stylesheet.cssrules] .map(rule => rule.csstext) .join(''); } catch (e) { console.log('access to stylesheet %s is denied. ignoring...', stylesheet.href); } }) .filter(boolean) .join('\n'); specifications specification status comment css object model (cssom)the definition of 'cssstylesheetlist' in that specification. working draft ...
-webkit-mask-repeat-x - CSS: Cascading Style Sheets
specifications not part of any standard. ...
... specifications not part of any standard. ...
-webkit-mask-repeat-y - CSS: Cascading Style Sheets
specifications not part of any standard. ...
... specifications not part of any standard. ...
::after (:after) - CSS: Cascading Style Sheets
Web › CSS › ::after
d of paragraphs. ...
...after { content: " <- boring"; color: red; } result decorative example we can style text or images in the content property almost any way we want. html <span class="ribbon">look at the orange box after this text. </span> css .ribbon { background-color: #5bc8f7; } .ribbon::after { content: "this is a fancy orange box."; background-color: #ffba10; border-color: black; border-style: dotted; } result tooltips this example uses ::after, in conjunction with the attr() css expression and a data-descr custom data attribute, to create tooltips. no javascript is required! we can also support keyboard users with this technique, by adding a tabindex of 0 to make each span keyboard focusable, and using a css :focus selector. this shows how flexible ::before and ::after can be, ...
::backdrop - CSS: Cascading Style Sheets
en dialog is opened with dialog.showmodal() */ dialog::backdrop { background: rgba(255,0,0,.25); } all full-screen elements are placed in a last-in/first out (lifo) stack in the top layer, which is a special layer in the viewport which is always rendered last (and therefore on top) before drawing the viewport's contents to the screen. ...
... video::backdrop { background-color: #448; } the resulting screen looks like this: note the dark grey-blue letterbox effect above and below where the backdrop is visible. ...
:first-of-type - CSS: Cascading Style Sheets
is the first element of its type among its siblings */ p:first-of-type { color: red; } note: as originally defined, the selected element had to have a parent. beginning with selectors level 4, this is no longer required. syntax :first-of-type examples styling the first paragraph html <h2>heading</h2> <p>paragraph 1</p> <p>paragraph 2</p> css p:first-of-type { color: red; font-style: italic; } result nested elements this example shows how nested elements can also be targeted. note that the universal selector (*) is implied when no simple selector is written. html <article> <div>this `div` is first!</div> <div>this <span>nested `span` is first</span>!</div> <div>this <em>nested `em` is first</em>, but this <em>nested `em` is last</em>!</div> <div>this <span>nes...
...ult nested elements this example shows how nested elements can also be targeted. note that the universal selector (*) is implied when no simple selector is written. html <article> <div>this `div` is first!</div> <div>this <span>nested `span` is first</span>!</div> <div>this <em>nested `em` is first</em>, but this <em>nested `em` is last</em>!</div> <div>this <span>nested `span` gets styled</span>!</div> <b>this `b` qualifies!</b> <div>this is the final `div`.</div> </article> css article :first-of-type { background-color: pink; } result specifications specification status comment selectors level 4the definition of ':first-of-type' in that specification. working draft matching elements are not required to have a parent. selec...
:fullscreen - CSS: Cascading Style Sheets
the :fullscreen css pseudo-class matches every element which is currently in full-screen mode. if multiple elements have been put into full-screen mode, this selects them all. syntax :fullscreen usage notes the :fullscreen pseudo-class lets you configure your stylesheets to automatically adjust the size, style, or layout of content when elements switch back and forth between full-screen and traditional presentations. examples in this example, the color of a button is changed depending on whether or not the document is in full-screen mode. this is done without needing to specifically apply style changes using javascript. html the page's html looks like this: <h1>mdn web docs demo: :fullscreen pseudo-class</h1> <p>this demo uses the <code>:fullscreen</code> pseudo-class to automaticall...
...ions. examples in this example, the color of a button is changed depending on whether or not the document is in full-screen mode. this is done without needing to specifically apply style changes using javascript. html the page's html looks like this: <h1>mdn web docs demo: :fullscreen pseudo-class</h1> <p>this demo uses the <code>:fullscreen</code> pseudo-class to automatically change the style of a button used to toggle full-screen mode on and off, entirely using css.</p> <button id="fs-toggle">toggle fullscreen</button> the <button> with the id "fs-toggle" will change between pale red and pale green depending on whether or not the document is in full-screen mode. css the magic happens in the css. there are two rules here. the first establishes the background color of the "toggle...
:link - CSS: Cascading Style Sheets
Web › CSS › :link
the :link css pseudo-class represents an element that has not yet been visited. it matches every unvisited <a>, <area>, or <link> element that has an href attribute. /* selects any <a> that has not been visited yet */ a:link { color: red; } styles defined by the :link pseudo-class will be overridden by any subsequent link-related pseudo-class (:active, :hover, or :visited) that has at least equal specificity. to style links appropriately, put the :link rule before all other link-related rules, as defined by the lvha-order: :link — :visited — :hover — :active. note: use :any-link to select an element independent of whether it has been visited or not. syntax :link examples by default, most browsers apply a special color value to visited links. thus, the links in this example wil...
...al font colors only before you visit them. (after that, you'll need to clear your browser history to see them again.) however, the background-color values are likely to remain, as most browsers do not set that property on visited links by default. html <a href="#ordinary-target">this is an ordinary link.</a><br> <a href="">you've already visited this link.</a><br> <a>placeholder link (won't get styled)</a> css a:link { background-color: gold; color: green; } result specifications specification status comment html living standardthe definition of ':link' in that specification. living standard selectors level 4the definition of ':link' in that specification. working draft no change. selectors level 3the definition of ':link...
:nth-last-child() - CSS: Cascading Style Sheets
> </tbody> </table> css table { border: 1px solid blue; } /* selects the last three elements */ tr:nth-last-child(-n+3) { background-color: pink; } /* selects every element starting from the second to last item */ tr:nth-last-child(n+2) { color: blue; } /* select only the last second element */ tr:nth-last-child(2) { font-weight: 600; } result quantity query a quantity query styles elements depending on how many of them there are. in this example, list items turn red when there are at least three of them in a given list. this is accomplished by combining the capabilities of the nth-last-child pseudo-class and the general sibling combinator. html <h4>a list of four items (styled):</h4> <ol> <li>one</li> <li>two</li> <li>three</li> <li>four</li> </ol> <h4>a list o...
...nding on how many of them there are. in this example, list items turn red when there are at least three of them in a given list. this is accomplished by combining the capabilities of the nth-last-child pseudo-class and the general sibling combinator. html <h4>a list of four items (styled):</h4> <ol> <li>one</li> <li>two</li> <li>three</li> <li>four</li> </ol> <h4>a list of two items (unstyled):</h4> <ol> <li>one</li> <li>two</li> </ol> css /* if there are at least three list items, style them all */ li:nth-last-child(n+3), li:nth-last-child(n+3) ~ li { color: red; } result specifications specification status comment selectors level 4the definition of ':nth-last-child' in that specification. working draft matching elements are not requ...
:only-child - CSS: Cascading Style Sheets
working draft matching elements are not required to have a parent. selectors level 3the definition of ':only-child' in that specification. recommendati...
... working draft matching elements are not required to have a parent. selectors level 3the definition of ':only-child' in that specification. recommendation initial definition. ...
:where() - CSS: Cascading Style Sheets
Web › CSS › :where
ne of the selectors in that list. the difference between :where() and :is() is that :where() always has 0 specificity, whereas :is() takes on the specificity of the most specific selector in its arguments. examples comparing :where() and :is() this example shows how :where() works, and also illustrates the difference between :where() and :is(). take the following html: <article> <h2>:is()-styled links</h2> <section class="is-styling"> <p>here is my main content. this <a href="https://mozilla.org">contains a link</a>. </section> <aside class="is-styling"> <p>here is my aside content. this <a href="https://developer.mozilla.org">also contains a link</a>. </aside> <footer class="is-styling"> <p>this is my footer, also containing <a href="https://github.com/mdn">a li...
...s my main content. this <a href="https://mozilla.org">contains a link</a>. </section> <aside class="is-styling"> <p>here is my aside content. this <a href="https://developer.mozilla.org">also contains a link</a>. </aside> <footer class="is-styling"> <p>this is my footer, also containing <a href="https://github.com/mdn">a link</a>. </footer> </article> <article> <h2>:where()-styled links</h2> <section class="where-styling"> <p>here is my main content. this <a href="https://mozilla.org">contains a link</a>. </section> <aside class="where-styling"> <p>here is my aside content. this <a href="https://developer.mozilla.org">also contains a link</a>. </aside> <footer class="where-styling"> <p>this is my footer, also containing <a href="https://github.com/...
@import - CSS: Cascading Style Sheets
Web › CSS › @import
syntax @import url; @import url list-of-media-queries; @import url supports( supports-query ); @import url supports( supports-query ) list-of-media-queries; where: url is a <string> or a <url> representing the location of the resource to import. the url may be absolute or relative. note that the url for a mozilla package need not actually specify a file; it can just specify the package name and part, and the appropriate file is chosen automatically (e.g. chrome://communicator/skin/). see here for more information. list-of-media-queries is a comma-separated list of media queries conditioning the application of the css rules defined in the linked url. ...
...on of '@import' in that specification. candidate recommendation media queriesthe definition of '@import' in that specification. recommendation extended the syntax to support any media query and not only simple media types. css level 2 (revision 1)the definition of '@import' in that specification. recommendation added support for <string> to denote the url of a stylesheet, and requirement to insert the @import rule at the beginning of the css document. css level 1the definition of '@import' in that specification. recommendation initial definition ...
color-index - CSS: Cascading Style Sheets
e such a table.) it is a range feature, meaning that you can also use the prefixed min-color-index and max-color-index variants to query minimum and maximum values, respectively. ...
...ning that you can also use the prefixed min-color-index and max-color-index variants to query minimum and maximum values, respectively. examples basic example html <p>this is a test.</p> css p { color: black; } @media (color-index) { p { color: red; } } @media (min-color-index: 15000) { p { color: #1475ef; } } result custom stylesheet this html will apply a special stylesheet for devices that have at least 256 colors. <link rel="stylesheet" href="http://foo.bar.com/base.css" /> <link rel="stylesheet" media="all and (min-color-index: 256)" href="http://foo.bar.com/color-stylesheet.css" /> specifications specification status comment media queries level 4the definition of 'color-index' in that specification. candidate recommendation...
@namespace - CSS: Cascading Style Sheets
@namespace is an at-rule that defines xml namespaces to be used in a css style sheet. syntax /* default namespace */ @namespace url(xml-namespace-url); @namespace "xml-namespace-url"; /* prefixed namespace */ @namespace prefix url(xml-namespace-url); @namespace prefix "xml-namespace-url"; description the defined namespaces can be used to restrict the universal, type, and attribute selectors to only select elements within that namespace. the @namespace rule is generally only useful when dealing with documents containing multiple namespaces—such as html5 with inline svg or mathml, or xml that mixes multiple vocabularies. any @namespace rules must follow all @charset and @import rules, and precede all other at-rules and style declarations in a style sheet. @namespace can be used to defin...
...amespace. the @namespace rule is generally only useful when dealing with documents containing multiple namespaces—such as html5 with inline svg or mathml, or xml that mixes multiple vocabularies. any @namespace rules must follow all @charset and @import rules, and precede all other at-rules and style declarations in a style sheet. @namespace can be used to define the default namespace for the style sheet. when a default namespace is defined, all universal and type selectors (but not attribute selectors, see note below) apply only to elements in that namespace. the @namespace rule can also be used to define a namespace prefix. when a universal, type, or attribute selector is prefixed with a namespace prefix, then that selector only matches if the namespace and name of the element or attribu...
Basic Concepts of Multicol - CSS: Cascading Style Sheets
. this guide explains how the specification works with some common use case examples. key concepts and terminology multicol is unlike any of the other layout methods we have in css in that it fragments the content, including all descendent elements, into columns. this happens in the same way that content is fragmented into pages when we work with css paged media, for example by creating a print stylesheet. the properties defined by the specification are: column-width column-count columns column-rule-color column-rule-style column-rule-width column-rule column-span column-fill column-gap by adding column-count or column-width to an element, that element becomes a multi-column container, or multicol container for short. the columns are anonymous boxes and described as column boxe...
... ...
Auto-placement in CSS Grid Layout - CSS: Cascading Style Sheets
oles in your grid. in my image gallery example i have some landscape and some portrait images. i have set landscape images – with a class of landscape to span two column tracks. i then use grid-auto-flow: dense to create a densely packed grid. ...
...> <li><img src="https://udn.realityripple.com/samples/72/ab41das78e.png" alt="placeholder"></li> <li><img src="https://udn.realityripple.com/samples/72/ab41das78e.png" alt="placeholder"></li> </ul> auto-placement can also help you lay out interface items which do have logical order. an example is the definition list in this next example. definition lists are an interesting challenge to style as they are flat, there is nothing wrapping the groups of dt and dd items. in my example i am allowing auto-placement to place the items, however i have classes that start a dt in column 1, and dd in column 2, this ensure that terms go on one side and definitions on the other - no matter how many of each we have. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border...
CSS grids, logical values, and writing modes - CSS: Cascading Style Sheets
l-tb, and the second uses vertical-rl. in the mode text still runs left to right, however the direction of the text is vertical - inline text now runs down the page, from top to bottom. .wrapper > p { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; margin: 1em; color: #d9480f; max-width: 300px; } <div class="wrapper"> <p style="writing-mode: horizontal-tb">i have writing mode set to the default <code>horizontal-tb</code></p> <p style="writing-mode: vertical-rl">i have writing mode set to <code>vertical-rl</code></p> </div> writing modes in grid layouts if we now take a look at a grid layout example, we can see how changing the writing mode means changing our idea of where the block and inline axis are. the gri...
... within documents that are otherwise ltr. in this next example i have a grid layout with a set of links down one side. i’ve used writing modes to turn these on their side in the column track: .wrapper { display: grid; grid-gap: 20px; grid-template-columns: 1fr auto; font: 1em helvetica, arial, sans-serif; } .wrapper nav { writing-mode: vertical-lr; } .wrapper ul { list-style: none; margin: 0; padding: 1em; display: flex; justify-content: space-between; } .wrapper a { text-decoration: none; } <div class="wrapper"> <div class="content"> <p>turnip greens yarrow ricebean rutabaga endive cauliflower sea lettuce kohlrabi amaranth water spinach avocado daikon napa cabbage asparagus winter purslane kale. celery potato scallion desert...
Stacking context example 2 - CSS: Cascading Style Sheets
note: it is worth remembering that in general the html hierarchy is different from the stacking context hierarchy. in the stacking context hierarchy, elements that do not create a stacking context are collapsed on their parent. ...
...8; position: absolute; width: 150px; height: 200px; top: 20px; left: 170px; border: 1px dashed #990000; background-color: #ffdddd; text-align: center; } #div4 { opacity: 0.8; position: absolute; width: 200px; height: 70px; top: 65px; left: 50px; border: 1px dashed #000099; background-color: #ddddff; text-align: left; padding-left: 10px; } </style></head> <body> <br /> <div id="div1"><br /> <span class="bold">div #1</span><br /> position: relative; <div id="div2"><br /> <span class="bold">div #2</span><br /> position: absolute;<br /> z-index: 2; </div> </div> <br /> <div id="div3"><br /> <span class="bold">div #3</span><br /> positi...
Using CSS transitions - CSS: Cascading Style Sheets
ion-property: font-size; transition-duration: 4s; transition-delay: 2s; } #delay:hover { font-size: 36px; } multiple animated properties example html content <body> <p>the box below combines transitions for: width, height, background-color, transform. ...
...sitions are a great tool to make things look much smoother without having to do anything to your javascript functionality. take the following example. <p>click anywhere to move the ball</p> <div id="foo"></div> using javascript you can make the effect of moving the ball to a certain position happen: var f = document.getelementbyid('foo'); document.addeventlistener('click', function(ev){ f.style.transform = 'translatey('+(ev.clienty-25)+'px)'; f.style.transform += 'translatex('+(ev.clientx-25)+'px)'; },false); with css you can make it smooth without any extra effort. simply add a transition to the element and any change will happen smoothly: p { padding-left: 60px; } #foo { border-radius: 50px; width: 50px; height: 50px; background: #c00; position: absolute; top: 0;...
Class selectors - CSS: Cascading Style Sheets
ts based on the contents of their class attribute. ...
...rgin: 2em; } /* all <li> elements with class="spacious" */ li.spacious { margin: 2em; } /* all <li> elements with a class list that includes both "spacious" and "elegant" */ /* for example, class="elegant retro spacious" */ li.spacious.elegant { margin: 2em; } syntax .class_name { style properties } note that this is equivalent to the following attribute selector: [class~=class_name] { style properties } examples css .red { color: #f33; } .yellow-bg { background: #ffa; } .fancy { font-weight: bold; text-shadow: 4px 4px 3px #77f; } html <p class="red">this paragraph has red text.</p> <p class="red yellow-bg">this paragraph has red text and a yellow background.</p> <p class="red fancy">this paragraph has red text and "fancy" styling.</p> <p>this is just a regular paragr...
Comments - CSS: Cascading Style Sheets
Web › CSS › Comments
a css comment is used to add explanatory notes to the code or to prevent the browser from interpreting specific parts of the style sheet. by design, comments have no effect on the layout of a document. syntax comments can be placed wherever white space is allowed within a style sheet. they can be used on a single line, or traverse multiple lines. /* comment */ examples /* a one-line comment */ /* a comment which stretches over several lines */ /* the comment below is used to disable specific styling */ /* span { color: blue; font-size: 1.5em; } */ notes the /* */ comment syntax is used for both single and multiline comments. ...
... on a single line, or traverse multiple lines. /* comment */ examples /* a one-line comment */ /* a comment which stretches over several lines */ /* the comment below is used to disable specific styling */ /* span { color: blue; font-size: 1.5em; } */ notes the /* */ comment syntax is used for both single and multiline comments. there is no other way to specify comments in external style sheets. however, when using the <style> element, you may use <!-- --> to hide css from older browsers, although this is not recommended. as with most programming languages that use the /* */ comment syntax, comments cannot be nested. in other words, the first instance of */ that follows an instance of /* closes the comment. specifications css 2.1 syntax and basic data types #comments ...
Descendant combinator - CSS: Cascading Style Sheets
acters — the space character and/or one of four control characters: carriage return, form feed, new line, and tab characters — between two selectors in the absence of another combinator. additionally, the white space characters of which the combinator is comprised may contain any number of css comments. ...
...r one of four control characters: carriage return, form feed, new line, and tab characters — between two selectors in the absence of another combinator. additionally, the white space characters of which the combinator is comprised may contain any number of css comments. ...
Pseudo-elements - CSS: Cascading Style Sheets
syntax selector::pseudo-element { property: value; } you can use only one pseudo-element in a selector. it must appear after the simple selectors in the statement. note: as a rule, double colons (::) should be used instead of a single colon (:). this distinguishes pseudo-classes from pseudo-elements. ...
... syntax selector::pseudo-element { property: value; } you can use only one pseudo-element in a selector. it must appear after the simple selectors in the statement. note: as a rule, double colons (::) should be used instead of a single colon (:). this distinguishes pseudo-classes from pseudo-elements. ...
Selector list - CSS: Cascading Style Sheets
h1, h2, h3, h4, h5, h6 { font-family: helvetica; } multi line grouping grouping selectors in a multiple lines using a comma-separated lists. ...
... h1, h2, h3, h4, h5, h6 { font-family: helvetica; } multi line grouping grouping selectors in a multiple lines using a comma-separated lists. ...
Tools - CSS: Cascading Style Sheets
Web › CSS › Tools
cubic bezier generatorthis is a sample tool; it lets you edit bezier curves. this is not really yet a useful tool, but will be!linear-gradient generatorthis tool can be used to create custom css3 linear-gradient() backgrounds. ...
...yet a useful tool, but will be!linear-gradient generatorthis tool can be used to create custom css3 linear-gradient() backgrounds. other tools css animation - stylie to check the device display information (helpful in responsive web design) - mydevice.io css menus - cssmenumaker.com a mighty, modern css linter that helps you enforce consistent conventions and avoid errors in your stylesheets - stylelint ...
CSS Tutorials - CSS: Cascading Style Sheets
Web › CSS › Tutorials
el. editor's note: we should look at using "difficulty level" tags on the tutorial/guide pages so that difficulty-based lists can be automatically built. beginner-level css tutorials getting started this guide is aimed at complete beginners: you haven't written one single line of css? — this is for you. it explains the fundamental concepts of the language and guides you in writing basic stylesheets. using multiple backgrounds backgrounds are fundamental for nice styling: css allows you to set several of them on each box. this tutorial explains how they interact and how to achieve nice effects. scaling background images css allows you to resize images used as an element's background. this tutorial describes how to achieve this in a simple way. media queries the size of the screen...
...ase of css 2 (level 1), new features have been added to css. some of them are fancy and are pretty self contained. they are easy to use for anybody with a fair knowledge of basic concepts. css counters counting items and pages is an easy task in css. learn to use counter-reset, counter-increment, counters(), and counter(). css animations css3 animations allow you to define configurations of style, as keyframes, and to transition between them defining an animation. css transitions css3 transitions allow you to define an animation between several styles and to control the way this transition happens. css transforms transforms allow you to change the position of elements by modifying their coordinate space: it allows for translating, rotating, and deforming them in the 2d or 3d spaces. ...
Using CSS custom properties (variables) - CSS: Cascading Style Sheets
e used. ...
...: while a syntax error in a css property / value pair will lead to the line being ignored, using a cascaded value, invalid substitution -- using a custom property value that is invalid -- is not ignored, leading to the value to be inherited. values in javascript to use the values of custom properties in javascript, it is just like standard properties. // get variable from inline style element.style.getpropertyvalue("--my-var"); // get variable from wherever getcomputedstyle(element).getpropertyvalue("--my-var"); // set variable on inline style element.style.setproperty("--my-var", jsvar + 4); ...
all - CSS: Cascading Style Sheets
Web › CSS › all
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...itial specifies that all the element's properties should be changed to their initial values. inherit specifies that all the element's properties should be changed to their inherited values. unset specifies that all the element's properties should be changed to their inherited values if they inherit by default, or to their initial values if not. revert specifies behavior that depends on the stylesheet origin to which the declaration belongs: user-agent origin equivalent to unset. user origin rolls back the cascade to the user-agent level, so that the specified values are calculated as if no author-level or user-level rules were specified for the element. author origin rolls back the cascade to the user level, so that the specified values are calculated as if no author-level ...
animation-fill-mode - CSS: Cascading Style Sheets
the animation-fill-mode css property sets how a css animation applies styles to its target before and after its execution. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. it is often convenient to use the shorthand property animation to set all animation properties at once. ...
...convenient to use the shorthand property animation to set all animation properties at once. syntax /* single animation */ animation-fill-mode: none; animation-fill-mode: forwards; animation-fill-mode: backwards; animation-fill-mode: both; /* multiple animations */ animation-fill-mode: none, backwards; animation-fill-mode: both, forwards, none; values none the animation will not apply any styles to the target when it's not executing. the element will instead be displayed using any other css rules applied to it. this is the default value. forwards the target will retain the computed values set by the last keyframe encountered during execution. the last keyframe depends on the value of animation-direction and animation-iteration-count: animation-direction animation-iter...
attr() - CSS: Cascading Style Sheets
Web › CSS › attr
it can also be used on pseudo-elements, in which case the value of the attribute on the pseudo-element's originating element is returned. ...
... <color> the attribute value is parsed as a hash (3- or 6-value hash) or a keyword. it must be a valid css <string> value. leading and trailing spaces are stripped. currentcolor url <url> the attribute value is parsed as a string that is used inside a css url() function. relative url are resolved relatively to the original document, not relatively to the style sheet. leading and trailing spaces are stripped. the url about:invalid that points to a non-existent document with a generic error condition. integer <integer> the attribute value is parsed as a css <integer>. if it is not valid, that is not an integer or out of the range accepted by the css property, the default value is used. leading and trailing spaces are s...
background-clip - CSS: Cascading Style Sheets
r this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. if the element has no background-image or background-color, this property will only have a visual effect when the border has transparent regions or partially opaque regions (due to border-style or border-image); otherwise, the border masks the difference. note: because the root element has a different background painting area, the background-clip property has no effect when specified on it. see "the backgrounds of special elements." note: for documents whose root element is an html element: if the computed value of background-image on the root element is none and its background-col...
... padding-box | content-box examples html <p class="border-box">the background extends behind the border.</p> <p class="padding-box">the background extends to the inside edge of the border.</p> <p class="content-box">the background extends only to the edge of the content box.</p> <p class="text">the background is clipped to the foreground text.</p> css p { border: .8em darkviolet; border-style: dotted double; margin: 1em 0; padding: 1.4em; background: linear-gradient(60deg, red, yellow, red, yellow, red); font: 900 1.2em sans-serif; text-decoration: underline; } .border-box { background-clip: border-box; } .padding-box { background-clip: padding-box; } .content-box { background-clip: content-box; } .text { background-clip: text; -webkit-background-clip: text; color: r...
border-block-start-width - CSS: Cascading Style Sheets
ax /* <'border-width'> values */ border-block-start-width: 5px; border-block-start-width: thick; related properties are border-block-end-width, border-inline-start-width, and border-inline-end-width, which define the other border widths of the element. ...
...s toall elementsinheritednopercentageslogical-width of containing blockcomputed valueabsolute length; 0 if the border style is none or hiddenanimation typea length values <'border-width'> the width of the border. see border-width. ...
border-bottom-width - CSS: Cascading Style Sheets
thickness denoted by each keyword, the precise result when using one of them is implementation-specific. nevertheless, they always follow the pattern thin ≤ medium ≤ thick, and the values are constant within a single document. formal definition initial valuemediumapplies toall elements. ...
... ...
border-color - CSS: Cascading Style Sheets
css backgrounds and borders module level 3the definition of 'border-color' in...
... css backgrounds and borders module level 3the definition of 'border-color' in that specification. candidate recommendation the transparent keyword has been removed as it is now a part of the <color> d...
border-image-slice - CSS: Cascading Style Sheets
" max="45" id="width"> <output id="width-output">30px</output> </li> <li> <label for="slice">slide to adjust <code>border-image-slice</code></label> <input type="range" min="10" max="45" id="slice"> <output id="slice-output">30</output> </li> </ul> css .wrapper { width: 400px; height: 300px; } div > div { width: 300px; height: 200px; border-width: 30px; border-style: solid; border-image: url(https://udn.realityripple.com/samples/56/bb98f533ef.png); border-image-slice: 30; border-image-repeat: round; } li { display: flex; place-content: center; } javascript const widthslider = document.getelementbyid('width'); const sliceslider = document.getelementbyid('slice'); const widthoutput = document.getelementbyid('width-output'); const sliceoutput = doc...
...} javascript const widthslider = document.getelementbyid('width'); const sliceslider = document.getelementbyid('slice'); const widthoutput = document.getelementbyid('width-output'); const sliceoutput = document.getelementbyid('slice-output'); const divelem = document.queryselector('div > div'); widthslider.addeventlistener('input', () => { const newvalue = widthslider.value + 'px'; divelem.style.borderwidth = newvalue; widthoutput.textcontent = newvalue; }) sliceslider.addeventlistener('input', () => { const newvalue = sliceslider.value; divelem.style.borderimageslice = newvalue; sliceoutput.textcontent = newvalue; }) result specifications specification status comment css backgrounds and borders module level 3the definition of 'border-image-slice...
border-image - CSS: Cascading Style Sheets
the border-image css property draws an image around a given element. it replaces the element's regular border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: you should specify a separate border-style in case the border image fails to load. indeed, this is required according to the specification, although not all browsers implement this requirement. constituent properties this property is a shorthand for the following css properties: border-image-outset border-image-repeat border-image-slice border-image-source border-image-width syntax /* source | slice */ border-image: linear-gradient(red, blue...
...idth */ border-image: linear-gradient(red, blue) 27 / 35px; /* source | slice | width | outset | repeat */ border-image: url("/images/border.png") 27 23 / 50px 30px / 1rem round space; the border-image property may be specified with anywhere from one to five of the values listed below. note: if the computed value of border-image-source is none, or if the image cannot be displayed, the border-style will be displayed instead. values <'border-image-source'> the source image. see border-image-source. <'border-image-slice'> the dimensions for slicing the source image into regions. up to four values may be specified. see border-image-slice. <'border-image-width'> the width of the border image. up to four values may be specified. see border-image-width. <'border-image-outset'> the dis...
border-inline-end-width - CSS: Cascading Style Sheets
tax /* <'border-width'> values */ border-inline-end-width: 2px; border-inline-end-width: thick; related properties are border-block-start-width, border-block-end-width, and border-inline-start-width, which define the other border widths of the element. ...
...s toall elementsinheritednopercentageslogical-width of containing blockcomputed valueabsolute length; 0 if the border style is none or hiddenanimation typea length values <'border-width'> the width of the border. see border-width. ...
box-pack - CSS: Cascading Style Sheets
Web › CSS › box-pack
one child, treat the value as if it were start. notes the edge of the box designated the start for packing purposes depends on the box's orientation and direction: normal reverse horizontal left right vertical top bottom the edge opposite to the start is designated the end. ...
...tart is designated the end. if the packing is set using the element's pack attribute, then the style is ignored. ...
clip-path - CSS: Cascading Style Sheets
Web › CSS › clip-path
ape8 { clip-path: padding-box circle(25% at 25% 25%); } .shape9 { clip-path: content-box circle(25% at 25% 25%); } .defs { width: 0; height: 0; margin: 0; } pre { margin-bottom: 0; } svg { margin: 1em; font-family: sans-serif; width: 192px; height: 192px; } svg rect { stroke: pink; stroke-width: 16px; } svg text { fill: pink; text-anchor: middle; } svg text.em { font-style: italic; } complete example html <img id="clipped" src="https://udn.realityripple.com/samples/db/4f9fbd7dfb.svg" alt="mdn logo"> <svg height="0" width="0"> <defs> <clippath id="cross"> <rect y="110" x="137" width="90" height="90"/> <rect x="0" y="110" width="90" height="90"/> <rect x="137" y="0" width="90" height="90"/> <rect x="0" y="0" width="90" height="...
... candidate recommendation extends its application to html elements. the clip-path property replaces the deprecated clip property. scalable vector graphics (svg) 1.1 (second edition)the de...
color-adjust - CSS: Cascading Style Sheets
t deems appropriate and prudent in order to optimize the output for the device it's being rendered for. for example, when printing, a browser might opt to leave out all background images and to adjust text colors to be sure the contrast is optimized for reading on white paper. this is the default. exact the element's content has been specifically and carefully crafted to use colors, images, and styles in a thoughtful and/or important way, such that being altered by the browser might actually make things worse rather than better. the appearance of the content should not be changed except by the user's request. for example, a page might include a list of information with rows whose background colors alternate between white and a light grey. removing the background color would decrease the legib...
...mples preserving low contrast in this example, a box is shown which uses a background-image and a translucent linear-gradient() function atop a black background color to have a dark blue gradient behind medium red text. for whatever reason, this is the desired appearance in any rendering environment, including on paper, so we also use color-adjust: exact to tell the browser not to make color or style adjustments to the box when rendering it. css .my-box { background-color: black; background-image: linear-gradient(rgba(0, 0, 180, 0.5), rgba(70, 140, 220, 0.5)); color: #900; width: 15rem; height: 6rem; text-align: center; font: 24px "helvetica", sans-serif; display: flex; align-items: center; justify-content: center; color-adjust: exact; } html <div class="my-box"> ...
column-rule-width - CSS: Cascading Style Sheets
h: unset; the column-rule-width property is specified as a single <'border-width'> value. values <'border-width'> is a keyword defined by border-width describing the width of the rule. it may be either a <length> or one of the thin, medium, or thick keywords. ...
...ength; 0 if the column-rule-style is none or hiddenanimation typea length formal syntax <'border-width'> examples setting a thick column rule html <p>this is a bunch of text split into three columns. the `column-rule-width` property is used to change the width of the line that is drawn between columns. don't you think that's wonderful?</p> css p { column-count: 3; column-rule-style: solid; column-rule-width: thick; } result specifications specification status comment css multi-column layout modulethe definition of 'column-rule-width' in that specification. working draft initial definition. ...
<custom-ident> - CSS: Cascading Style Sheets
a decimal digit, nor a hyphen (-) followed by a decimal digit or another hyphen. to prevent ambiguity, each property that uses <custom-ident> forbids the use of specific values: animation-name forbids the global css values (unset, initial, and inherit), as well as none. counter-reset counter-increment forbids the global css values (unset, initial, and inherit), as well as none. @counter-style list-style-type forbids the global css values (unset, initial, and inherit), as well as the values none, inline, and outside. also, quite a few predefined values are implemented by the different browsers: disc, circle, square, decimal, cjk-decimal, decimal-leading-zero, lower-roman, upper-roman, lower-greek, lower-alpha, lower-latin, upper-alpha, upper-latin, arabic-indic, armenian, bengali, ca...
...ifications specification status comment css values and units module level 4the definition of '<custom-ident>' in that specification. editor's draft css will change module level 1the definition of '<custom-ident> for will-change' in that specification. candidate recommendation defines which values are excluded for will-change. css counter styles level 3the definition of '<custom-ident> for list-style-type' in that specification. candidate recommendation uses <custom-ident> instead of a finite list of keywords. defines which values are excluded for list-style-type and @counter-style. css lists module level 3the definition of '<custom-ident> for counter-*' in that specification. working draft renames <identifier> to <...
display - CSS: Cascading Style Sheets
Web › CSS › display
ted behavior; for example if you specify an element to be display: grid, you would expect that the box created on the grid container would be a block level box. list item <display-listitem> the element generates a block box for the content and a separate list-item inline box. a single value of list-item will cause the element to behave like a list item. this can be used together with list-style-type and list-style-position. list-item can also be combined with any <display-outside> keyword and the flow or flow-root <display-inside> keywords. note: in browsers that support the two-value syntax, if no inner value is specified it will default to flow. if no outer value is specified, the principal box will have an outer display type of block. internal <display-internal> some layout ...
... specifications specification status comment css display module level 3the definition of 'display' in that specification. candidate recommendation added ...
<filter-function> - CSS: Cascading Style Sheets
|| filter === 'sepia') { slider.value = 0; slider.min = 0; slider.max = 1; slider.step = 0.01; slider.setattribute('data-unit', ''); } else if(filter === 'hue-rotate') { slider.value = 0; slider.min = 0; slider.max = 360; slider.step = 1; slider.setattribute('data-unit', 'deg'); } } function setdiv(filter) { if(filter === 'drop-shadow') { divelem.style.filter = `${selectelem.value}(${math.round(slider.value)}${slider.getattribute('data-unit')} ${math.round(slider.value)}${slider.getattribute('data-unit')} ${math.round(math.abs(slider.value/2))}${slider.getattribute('data-unit')})`; } else { divelem.style.filter = `${selectelem.value}(${slider.value}${slider.getattribute('data-unit')}`; } updateoutput(); updatecurvalue(); } functio...
... working draft ...
flex - CSS: Cascading Style Sheets
Web › CSS › flex
"block" : "none"; }); #flex-container { width: 100%; font-family: consolas, arial, sans-serif; } #flex-container > div { border: 1px solid #f00; padding: 1rem; } #flex-container > .raw-item { border: 1px solid #000; } result specifications specification status comment css flexible box layout modulethe definit...
...o toggle raw box)</div> <div class="raw-item" id="raw">raw box</div> </div> css #flex-container { display: flex; flex-direction: row; } #flex-container > .flex-item { flex: auto; } #flex-container > .raw-item { width: 5rem; } var flex = document.getelementbyid("flex"); var raw = document.getelementbyid("raw"); flex.addeventlistener("click", function() { raw.style.display = raw.style.display == "none" ? "block" : "none"; }); #flex-container { width: 100%; font-family: consolas, arial, sans-serif; } #flex-container > div { border: 1px solid #f00; padding: 1rem; } #flex-container > .raw-item { border: 1px solid #000; } result specifications specification status comment css flexible box layout modulethe definition of 'flex' in tha...
float - CSS: Cascading Style Sheets
Web › CSS › float
this was an exception to the rule, that the name of the dom member is the camel-case name of the dash-separated css name (due to the fact that "float" is a reserved word in javascript, as seen in the need to escape "class" as "classname" and ...
... table-header-group block table-footer-group block inline-flex flex inline-grid grid other unchanged note: if you're referring to this property from javascript as a member of the htmlelement.style object, modern browsers support float, but in older browsers you have to spell it as cssfloat, with internet explorer versions 8 and older using stylefloat. this was an exception to the rule, that the name of the dom member is the camel-case name of the dash-separated css name (due to the fact that "float" is a reserved word in javascript, as seen in the need to escape "class" as "classname" and escape <label>'s "for" as "htmlfor"). syntax /* keyword values */ float: left; float: right; float: none; float: inline-start; float: inline-end; /*...
font-variant-caps - CSS: Cascading Style Sheets
candidate recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if...
... candidate recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https:/...
font-variation-settings - CSS: Cascading Style Sheets
rty is invalid. the <number> can be fractional or negative, depending on the value range available in your font, as defined by the font designer. description this property is a low-level mechanism designed to set variable font features where no other way to enable or access those features exist. you should only use it when no basic properties exist to set those features (e.g. font-weight, font-style). font characteristics set using font-variation-settings will always override those set using the corresponding basic font properties, e.g. font-weight, no matter where they appear in the cascade. in some browsers, this is currently only true when the @font-face declaration includes a font-weight range. registered and custom axes variable font axes come in two types: registered and custom. re...
...countered — common enough that the authors of the specification felt they were worth standardizing. note that this doesn't mean that the author has to include all of these in their font. here are the registered axes along with their corresponding css properties: axis tag css property "wght" font-weight "wdth" font-stretch "slnt" (slant) font-style: oblique + angle "ital" font-style: italic "opsz" font-optical-sizing custom axes can be anything the font designer wants to vary in their font, for example ascender or descender heights, the size of serifs, or anything else they can imagine. any axis can be used as long as it is given a unique 4-character axis. some will end up becoming more common, and ma...
font-weight - CSS: Cascading Style Sheets
ong or so, waddling like an elephantine lizard up holborn hill.</p> </div> css /* mutator sans is created by letterror (https://github.com/letterror/mutatorsans) and is used here under the terms of its license: https://github.com/letterror/mutatorsans/blob/master/license */ @font-face { src: url('https://mdn.mozillademos.org/files/16011/mutatorsans.ttf'); font-family:'mutatorsans'; font-style: normal; } label { font: 1rem monospace; white-space: nowrap; } .container { max-height: 150px; overflow-y: auto; } .sample { text-transform: uppercase; font: 1.5rem 'mutatorsans', sans-serif; } html, body { max-height: 100vh; max-width: 100vw; overflow: hidden; } body { display: flex; flex-direction: column; } header { margin-bottom: 1.5rem; } .container { flex...
... mdn understanding wcag, guideline 1.4 explanations understanding succes...
<image> - CSS: Cascading Style Sheets
Web › CSS › image
if supported, the browser-defined size matchin...
...he size of the element's background positioning area list-style-image the size of a 1em character border-image-source the size of the element's border image area cursor the browser-defined size matching the usual cursor size on the client's system mask-image ? shape-outside ? mask-border-source ? symbols for @counter-style at risk feature. if supported, the browser-defined size matching the usual cursor size on the client's system content for a pseudo-element (::after/::before) a 300px × 150px rectangle the concrete object size is calculated using the following algorithm: if the specified size defines both the width and the height, these values are used as the concrete object size. if the...
mask-type - CSS: Cascading Style Sheets
Web › CSS › mask-type
tial valueluminanceapplies to<mask> elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax luminance | alpha examples setting an alpha mask html <div class="redsquare"></div> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="0" height="0"> <defs> <mask id="m" maskcontentunits="objectboundingbox" style="mask-type:alpha"> <rect x=".1" y=".1" width=".8" height=".8" fill="red" fill-opacity="0.7"/> </mask> </defs> </svg> css .redsquare { height: 100px; width: 100px; background-color: rgb(128, 128, 128); border: solid 1px black; mask: url("#m"); } result setting a luminance mask html <div class="redsquare"></div> <svg version="1.1" xmlns="http://www.w3.org/200...
... .redsquare { height: 100px; width: 100px; background-color: rgb(128, 128, 128); border: solid 1px black; mask: url("#m"); } result setting a luminance mask html <div class="redsquare"></div> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="0" height="0"> <defs> <mask id="m" maskcontentunits="objectboundingbox" style="mask-type:luminance"> <rect x=".1" y=".1" width=".8" height=".8" fill="red" fill-opacity="0.7"/> </mask> </defs> </svg> css .redsquare { height: 100px; width: 100px; background-color: rgb(128, 128, 128); border: solid 1px black; mask: url("#m"); mask-type:luminance; } result specifications specification status comment css maski...
outline-color - CSS: Cascading Style Sheets
the outline is drawn outside the element's frame, and may overlap other content. the border, on the other hand, will actually alter the page's layout to ensure that it fits without overlapping anything else (unless you explicitly set it to overlap). it is often more convenient to use the shorthand property outline when defining the appearance of an outline. accessibility concerns custom focus styles commonly involve making adjustments to the outline property. if the color of the outline is adjusted, it is important to ensure that the contrast ratio between it and the background the outline is placed over is high enough that people experiencing low vision conditions will be able to perceive it. color contrast ratio is determined by comparing the luminosity of the text and background color v...
... recommendation no change. css level 2 (revision 1)the definition of 'outline-color' in that specification. recommendation ...
place-content - CSS: Cascading Style Sheets
="start">start</option> <option value="end">end</option> <option value="flex-start">flex-start</option> <option value="flex-end">flex-end</option> <option value="left">left</option> <option value="right">right</option> <option value="safe">safe</option> <option value="unsafe">unsafe</option> </select><code>;</code> var update = function () { document.getelementbyid("container").style.placecontent = document.getelementbyid("aligncontentalignment").value + " " + document.getelementbyid("justifycontentalignment").value; } var aligncontentalignment = document.getelementbyid("aligncontentalignment"); aligncontentalignment.addeventlistener("change", update); var justifycontentalignment = document.getelementbyid("justifycontentalignment"); justifycontentalignment.addeventlistener...
...ocument.getelementbyid("aligncontentalignment"); aligncontentalignment.addeventlistener("change", update); var justifycontentalignment = document.getelementbyid("justifycontentalignment"); justifycontentalignment.addeventlistener("change", update); var writingm = document.getelementbyid("writingmode"); writingm.addeventlistener("change", function (evt) { document.getelementbyid("container").style.writingmode = evt.target.value; }); var direction = document.getelementbyid("direction"); direction.addeventlistener("change", function (evt) { document.getelementbyid("container").style.direction = evt.target.value; }); css #container { display: flex; height:240px; width: 240px; flex-wrap: wrap; background-color: #8c8c8c; writing-mode: horizontal-tb; /* can be changed in the l...
scroll-margin-inline-end - CSS: Cascading Style Sheets
xplain to you how it's implemented. the aim here is to create four horizontally-scrolling blocks, the second and third of which snap into place, near but not quite at the right of each block. html the html that represents the blocks is very simple: <div class="scroller"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> </div> css let's walk through the css. ...
... border-box; border: 1px solid #000; scroll-snap-type: x mandatory; } the main parts relevant to the scroll snapping are overflow-x: scroll, which makes sure the contents will scroll and not be hidden, and scroll-snap-type: x mandatory, which dictates that scroll snapping must occur along the horizontal axis, and the scrolling will always come to rest on a snap point. ...
scroll-margin-inline-start - CSS: Cascading Style Sheets
explain to you how it's implemented. the aim here is to create four horizontally-scrolling blocks, the second and third of which snap into place, near but not quite at the left of each block. html the html that represents the blocks is very simple: <div class="scroller"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> </div> css let's walk through the css. ...
... border-box; border: 1px solid #000; scroll-snap-type: x mandatory; } the main parts relevant to the scroll snapping are overflow-x: scroll, which makes sure the contents will scroll and not be hidden, and scroll-snap-type: x mandatory, which dictates that scroll snapping must occur along the horizontal axis, and the scrolling will always come to rest on a snap point. ...
scroll-margin-inline - CSS: Cascading Style Sheets
xplain to you how it's implemented. the aim here is to create four horizontally-scrolling blocks, the second and third of which snap into place, near but not quite at the right of each block. html the html that represents the blocks is very simple: <div class="scroller"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> </div> css let's walk through the css. ...
... border-box; border: 1px solid #000; scroll-snap-type: x mandatory; } the main parts relevant to the scroll snapping are overflow-x: scroll, which makes sure the contents will scroll and not be hidden, and scroll-snap-type: x mandatory, which dictates that scroll snapping must occur along the horizontal axis, and the scrolling will always come to rest on a snap point. ...
scroll-margin - CSS: Cascading Style Sheets
explain to you how it's implemented. the aim here is to create four horizontally-scrolling blocks, the second and third of which snap into place, near but not quite at the left of each block. html the html that represents the blocks is very simple: <div class="scroller"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> </div> css let's walk through the css. ...
... border-box; border: 1px solid #000; scroll-snap-type: x mandatory; } the main parts relevant to the scroll snapping are overflow-x: scroll, which makes sure the contents will scroll and not be hidden, and scroll-snap-type: x mandatory, which dictates that scroll snapping must occur along the horizontal axis, and the scrolling will always come to rest on a snap point. ...
symbols() - CSS: Cascading Style Sheets
Web › CSS › symbols
syntax symbols() = symbols( <symbols-type>? [ <string> | <image> ]+ ); <symbols-type> can be one of the following: cyclic: the system cycles through the given values in the order of their definition, and returns to the start when it reaches the end. numeric: the system interprets the given values as the successive units of a place-value numbering system. ...
...stem but without 0. symbolic: the system cycles through the values, printing them an additional time at each cycle (one time for the first cycle, two times for the second, etc.). fixed: the system cycles through the given values once, then falls back to arabic numerals. examples html <ol> <li>one</li> <li>two</li> <li>three</li> <li>four</li> <li>five</li> </ol> css ol { list-style: symbols(cyclic "*" "†" "‡"); } result specifications specification status comment css counter styles level 3the definition of 'symbols()' in that specification. candidate recommendation initial defintion. ...
Used value - CSS: Cascading Style Sheets
med on the computed value. after the user agent has finished its calculations, every css property has a used value. the used values of dimensions (e.g., width, line-height) are in pixels. the used values of shorthand properties (e.g., background) are consistent with those of their component properties (e.g., background-color or background-size) and with position and float. note: the getcomputedstyle() dom api returns the resolved value, which may either be the computed value or the used value, depending on the property. example this example computes and displays the used width value of three elements (updates on resize): html <div id="no-width"> <p>no explicit width.</p> <p class="show-used-width">..</p> <div id="width-50"> <p>explicit width: 50%.</p> <p class="show-used-...
...d-width">..</p> </div> </div> </div> css #no-width { width: auto; } #width-50 { width: 50%; } #width-inherit { width: inherit; } /* make results easier to see */ div { border: 1px solid red; padding: 8px; } javascript function updateusedwidth(id) { var div = document.queryselector(`#${id}`); var par = div.queryselector('.show-used-width'); var wid = window.getcomputedstyle(div)["width"]; par.textcontent = `used width: ${wid}.`; } function updateallusedwidths() { updateusedwidth("no-width"); updateusedwidth("width-50"); updateusedwidth("width-inherit"); } updateallusedwidths(); window.addeventlistener('resize', updateallusedwidths); result difference from computed value css 2.0 defined only computed value as the last step in a property's calculation.
var() - CSS: Cascading Style Sheets
Web › CSS › var
which is used in case the custom property is invalid in the used context. this value may contain any character except some characters with special meaning like newlines, unmatched closing brackets, i.e. ), ], or }, top-level semicolons, or exclamation marks. ...
...lons, or exclamation marks. examples :root { --main-bg-color: pink; } body { background-color: var(--main-bg-color); } /* fallback */ /* in the component’s style: */ .component .header { color: var(--header-color, blue); /* header-color isn’t set, and so remains blue, the fallback value */ } .component .text { color: var(--text-color, black); } /* in the larger application’s style: */ .component { --text-color: #080; } specifications specification status comment css custom properties for cascading variables module level 1the definition of 'var()' in that specification. candidate recommendation initial definition ...
contentStyleType - SVG: Scalable Vector Graphics
the contentstyletype attribute specifies the style sheet language for the given document fragment on the <svg> element. this language is used for all instances of style that do not specify their own styling language, such as the style attribute that is available on many elements. the value specifies a media type, per mime part two: media types [rfc2046]. usage notes value one of the content types specified in the media types default value text/css animatable no since css is the only widely deployed style sheet language for online styling and it's already defined as default value if contentstyletype is ommitted, the attribute is not well supported in user agents. ...
...art two: media types [rfc2046]. usage notes value one of the content types specified in the media types default value text/css animatable no since css is the only widely deployed style sheet language for online styling and it's already defined as default value if contentstyletype is ommitted, the attribute is not well supported in user agents. if other style sheet languages become more popular they might not use the style attribute, instead it could be easily declared which style language is used in the <style>'s type attribute. the use of contentstyletype is therefore deprecated. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'contentscripttype' in that ...
style - SVG: Scalable Vector Graphics
Web › SVG › Attribute › style
the style attribute allows to style an element using css declarations. it functions identically to the style attribute in html. all elements are using this attribute. html,body,svg { height:100% } <svg viewbox="0 0 100 60" xmlns="http://www.w3.org/2000/svg"> <rect width="80" height="40" x="10" y="10" style="fill: skyblue; stroke: cadetblue; stroke-width: 2;"/> </svg> usage notes value <style> default value none animatable no <style> the syntax of style data depends on the style sheet language. by default, the style sheet language is css. note: in theory, the contentstyletype attribute could be used to specify styling languages other than css, like xsl(t). however, this was never implemented satisfactorily in browsers, so you...
...language. by default, the style sheet language is css. note: in theory, the contentstyletype attribute could be used to specify styling languages other than css, like xsl(t). however, this was never implemented satisfactorily in browsers, so you should not rely on it. specifications specification status comment scalable vector graphics (svg) 2the definition of 'style' in that specification. candidate recommendation no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'style' in that specification. recommendation initial definition ...
Common XSLT Errors - XSLT: Extensible Stylesheet Language Transformations
to find out the current type, load the file in mozilla and look at the page info. or use a download tool, those usually tell the mime type. in firefox 6 and forward, you can also use the official xslt mimetype: application/xslt+xml. namespace the xslt 1.0 namespace is http://www.w3.org/1999/xsl/transform. older versions of ie used a different namespace. however these versions also used a draft version of xslt which is incompatible with what eventually became the xslt 1.0 specification. firefox only supports the official xslt 1.0 version. ...
...ucted output document works. however firefox never serializes the output document and so the attribute isn't really applicable. while we could try to add some heuristics to serialize and reparse just the part of the output document which has disable-output-escaping applied, heuristics often get things wrong and lead to surprising results, hence we've been reluctant to add this so far. often times stylesheets contain code like <xsl:text disable-output-escaping="yes">&nbsp;</xsl:text>, this is equivalent to simply putting &#160; in the stylesheet which will work great in all xslt engines. we do realize that the lack of disable-output-escaping is a problem and we'd like to find a solution for it, however so far we haven't found any good solutions. the <xsl:namespace-alias> element. if you'd lik...
<xsl:namespace-alias> - XSLT: Extensible Stylesheet Language Transformations
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:namespace-alias> element is a rarely used device that maps a namespace in the stylesheet to a different namespace in the output tree. the most common use for this element is in generating a stylesheet from another stylesheet. to prevent a normally xsl:-prefixed literal result element (which should simply be copied as-is to the result tree) from being misunderstood by the processor, it is assigned a temporary namespace which is appropriately re-converted back to the xslt namespace in the output tree. syntax <xsl:namespace-alias stylesheet-prefix=name result-prefix=name /> required attributes stylesheet-prefix specifies the temporary namespace. result-prefix specifies the desired nam...
...a temporary namespace which is appropriately re-converted back to the xslt namespace in the output tree. syntax <xsl:namespace-alias stylesheet-prefix=name result-prefix=name /> required attributes stylesheet-prefix specifies the temporary namespace. result-prefix specifies the desired namespace for the output tree. optional attributes none. type top-level, must be the child of <xsl:stylesheet> or <xsl:transform>. defined xslt, section 7.1.1 gecko support not supported at this time. ...
style - Archive of obsolete content
« xul reference home style type: css inline style css style rules to be applied to the element. syntax is as in the html style attribute. it is preferred to put style rules in style sheets. ...
selstyle - Archive of obsolete content
« xul reference selstyle type: string if set to the value primary, only the label of the primary column will be highlighted when an item in the tree is selected. otherwise, the entire row will be highlighted. to see the difference, compare the selection style in the folder list and the message list in mozilla mail. ...
-ms-overflow-style - Archive of obsolete content
initial valueautoapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values auto the initial value. same as inherit. none scrollbars are never displayed, although the element can still be scrolled if the element's content overflows. scrollbar "traditional" scrollbars are displayed if the element's content overflows. "traditional" scrollbars don't auto-hide and never overlap the element's content. ...
ui.SpellCheckerUnderlineStyle
ui.spellcheckerunderlinestyle holds the style which is used to underline words not recognized by the spellchecker. type:integer default value:5 exists by default: no application support: gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) status: active; last updated 2012-02-22 introduction: pushed to nightly on 2009-04-03 bugs: bug 338209 values the values are defined in nsstyleconsts.h. 0 no underlining 1 dotted 2 dashed 3 single solid line 4 two solid lines 5 (default) wavy ...
GetComputedStyleCSSValue
...
GetComputedStyleValue
...
CSSRule.parentStyleSheet - Web APIs
the parentstylesheet property of the cssrule interface returns the stylesheet object in which the current rule is defined. syntax var stylesheet = cssrule.parentstylesheet parameters stylesheet is a stylesheet object. example if (bgrule.parentstylesheet != mysheet) { // alien style rule! } specifications specification status comment css object model (cssom)the definition of 'cssrule: parentstylesheet' in that specification. working draft ...
CSSStyleDeclaration.cssText - Web APIs
the csstext property of the cssstyledeclaration interface returns or sets the text of the element's inline style declaration only. to be able to set a stylesheet rule dynamically, see using dynamic styling information. not to be confused with stylesheet style-rule cssrule.csstext. example <span id="s1" style="color: red;"> some text </span> <script> var elem = document.getelementbyid("s1"); alert(elem.style.csstext); // "color: red;" </script> specifications specification status comment css object model (cssom)the definition of 'cssstyledeclaration: csstext' in that specification. working draft ...
CSSStyleRule.selectorText - Web APIs
the cssrule.selectortext property gets the textual representation of the selector for the rule set. this is readonly in some browsers; to set stylesheet rules dynamically cross-browser, see using dynamic styling information. syntax string = cssrule.selectortext example // for cssrule: body { background-color: darkblue; } var stylesheet = document.stylesheets[0]; alert(stylesheet.cssrules[0].selectortext); // body notes the implementation may have stripped out insignificant whitespace while parsing the selector. if set to a selector string which cannot be parsed, a syntaxerror is thrown. specifications specification status comment css object model (cssom)the definition of 'cssstylerule.selectortext' in that specification. working draft brows...
CSSStyleRule - Web APIs
cssstylerule represents a single css style rule. it implements the cssrule interface with a type value of 1 (cssrule.style_rule). properties cssstylerule.selectortext returns the textual representation of the selector for this rule, e.g. "h1,h2". cssstylerule.style read only returns the cssstyledeclaration object for the rule. cssstylerule.stylemap read only returns a stylepropertymap object which provides access to the rule's property-value pairs. specifications specification status comment css object model (cssom)the definition of 'cssstylerule' in that specification. working draft no changes document object model (dom) level 2 style specificationthe definition of 'cssrule' in that specification. obsolete ...
CSSStyleSheet.deleteRule() - Web APIs
the cssstylesheet method deleterule() removes a rule from the stylesheet object. syntax cssstylesheet.deleterule(index) parameters index the index into the stylesheet's cssrulelist indicating the rule to be removed. return value undefined example this example removes the first rule from the stylesheet mystyles. mystyles.deleterule(0); specifications specification status comment css object model (cssom)the definition of 'cssstylesheet.deleterule()' in that specification. working draft ...
ElementCSSInlineStyle - Web APIs
the elementcssinlinestyle mixin describes cssom-specific features common to the htmlelement, svgelement and mathmlelement interfaces. each of these interfaces can, of course, add more features in addition to the ones listed below. note: elementcssinlinestyle is a mixin and not an interface; you can't actually create an object of type elementcssinlinestyle. propertiesstylethe style property is used to get as well as set the inline style of an element. when getting, it returns a cssstyledeclaration object that contains a list of all styles properties for that element with values assigned for the attributes that are defined in the element's inline style attribute.methodsthis interface has no methods. specifications specification status comment css object model ...
LinkStyle - Web APIs
Web › API › LinkStyle
the linkstyle interface provides access to the associated css style sheet of a node. linkstyle is a raw interface and no object of this type can be created; it is implemented by htmllinkelement and htmlstyleelement objects. properties there is no inherited property. linkstyle.sheet read only returns the cssstylesheet object associated with the given element, or null if there is none. methods this interface implements no method. specifications specification status comment css object model (cssom)the definition of 'linkstyle' in that specification. working draft linkstyle.sheet returns more specialized cssstylesheet instead of stylesheet document object model (dom) level 2 style specificationthe definition of 'linkstyle' in that specification. ...
StylePropertyMap.append() - Web APIs
font, width, background color) to add. value the value the given property should have. return value undefined. example // tbd specifications specification status comment css typed om level 1the definition of 'append()' in that specification. ...
StylePropertyMap.clear() - Web APIs
return value undefined example // tbd specifications specification status comment css typed om level 1the definition of 'clear()' in that specification. ...
StylePropertyMap.delete() - Web APIs
font, width, background color) to remove. return value undefined example // tbd specifications specification status comment css typed om level 1the definition of 'delete()' in that specification. ...
StylePropertyMap.set() - Web APIs
font, width, background color) to change. value the value the given property should have. return value undefined example // tbd specifications specification status comment css typed om level 1the definition of 'set()' in that specification. ...
StylePropertyMapReadOnly.has() - Web APIs
return value a boolean. example // tbd specifications specification status comment css typed om level 1the definition of 'has()' in that specification. ...
StylePropertyMapReadOnly.keys() - Web APIs
return value a new array. example // tbd specifications specification status comment css typed om level 1the definition of 'keys()' in that specification. working draft initial definition. ...
StylePropertyMapReadOnly.values() - Web APIs
return value a new array. example // tbd specifications specification status comment css typed om level 1the definition of 'values()' in that specification. working draft initial definition. ...
StyleSheet.title - Web APIs
Web › API › StyleSheet › title
the title property of the stylesheet interface returns the advisory title of the current style sheet. the title is often specified in the ownernode. specifications specification status comment css object model (cssom)the definition of 'stylesheet: title' in that specification. working draft ...
StyleSheet.type - Web APIs
Web › API › StyleSheet › type
the type property of the stylesheet interface specifies the style sheet language for the given style sheet. syntax string = stylesheet.type example mystylesheet.type = 'text/css'; specifications specification status comment css object model (cssom)the definition of 'stylesheet: type' in that specification. working draft ...
-moz-context-properties - CSS: Cascading Style Sheets
svg. stroke expose the stroke value set on the image to the embedded svg. fill-opacity expose the fill-opacity value set on the image to the embedded svg. stroke-opacity expose the stoke-opacity value set on the image to the embedded svg. formal definition initial valuenoneapplies toany element that can have an image applied to it, for example as a background-image, border-image, or list-style-image.inheritedyescomputed valueas specifiedanimation typediscrete formal syntax none | [ fill | fill-opacity | stroke | stroke-opacity ]# examples exposing fill and stroke to an svg image in this example we have a simple svg embedded using an <img> element. you first need to specify on the embedding element the properties whose values you wish to expose to the embedded svg, using the -moz-...
-webkit-mask-composite - CSS: Cascading Style Sheets
transparent portion of the destination mask image. this causes the destination mask image to have no effect. xor overlapping pixels in the source mask image and the destination mask image become fully transparent if they are both fully opaque. formal definition initial valuesource-overapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <composite-style>#where <composite-style> = clear | copy | source-over | source-in | source-out | source-atop | destination-over | destination-in | destination-out | destination-atop | xor examples compositing with xor .example { -webkit-mask-image: url(mask1.png), url('mask2.png'); -webkit-mask-composite: xor, source-over; } specifications not part of any standard. this property is specified as mask-co...
-webkit-text-stroke-color - CSS: Cascading Style Sheets
living standard initial standardization safari css reference '-webkit-text-stroke-color' in that document. non-standard unofficial documentation initia...
:-moz-focusring - CSS: Cascading Style Sheets
ature is not defined in any specification yet, though it was discussed in the working group and it was decided to add it to selectors 4 or 5. note: developers tend to use :-moz-focusring to differentiate between the focus state when the user focuses an element via a mouse click versus keyboard tabbing. it is also potentially useful if you are creating a custom element and you want to change its style based on its behavior. syntax :-moz-focusring examples html <input /> css input { margin: 5px; } :-moz-focusring { color: red; outline: 2px dotted green; } result specifications not part of any standard. ...
::-moz-list-number - CSS: Cascading Style Sheets
...
:-moz-submit-invalid - CSS: Cascading Style Sheets
the :-moz-submit-invalid css pseudo-class is a mozilla extension that represents any submit <button> on forms whose contents aren't valid based on their validation constraints. by default, no style is applied. you can use this pseudo-class to customize the appearance of the submit button when there are invalid form fields. syntax syntax not found in db! specifications not part of any standard. ...
:-moz-ui-invalid - CSS: Cascading Style Sheets
user started interacting with it, the validity styling is changed only when the user shifts focus to another control. however, if the user is trying to correct a previously-flagged value, the control shows immediately when the value becomes valid. required items have the pseudo-class applied only if the user changes them or attempts to submit an unchanged valid value. by default, gecko applies a style that creates a red "glow" (using the box-shadow property) around items, which have this pseudo-class applied. see the :invalid pseudo-class for an example that shows how to override the default style. the specification for :user-invalid is still in progress. syntax syntax not found in db! specifications specification status comment selectors level 4the definition o...
:-moz-window-inactive - CSS: Cascading Style Sheets
this attribute is no longer used. ...
:-webkit-autofill - CSS: Cascading Style Sheets
the :-webkit-autofill css pseudo-class matches when an <input> element has its value autofilled by the browser. note: the user agent style sheets of many browsers use !important in their :-webkit-autofill style declarations, making them non-overrideable by webpages without resorting to javascript hacks. syntax :-webkit-autofill specifications not part of any standard. ...
::-moz-color-swatch - CSS: Cascading Style Sheets
...
::-moz-range-progress - CSS: Cascading Style Sheets
ected by the thumb (i.e., virtual knob). note: using ::-moz-range-progress with anything but an <input type="range"> doesn't match anything and has no effect. syntax ::-moz-range-progress examples html <input type="range" min="0" max="100" step="5" value="50"/> css input[type=range]::-moz-range-progress { background-color: green; height: 1em; } result a progress bar using this style might look something like this: specifications not part of any standard. ...
::-moz-range-thumb - CSS: Cascading Style Sheets
the thumb along the input's track to alter its numerical value. note: using ::-moz-range-thumb with anything but an <input type="range"> doesn't match anything and has no effect. syntax ::-moz-range-thumb examples html <input type="range" min="0" max="100" step="5" value="50"/> css input[type=range]::-moz-range-thumb { background-color: green; } result a progress bar using this style might look something like this: specifications not part of any standard. ...
::-moz-range-track - CSS: Cascading Style Sheets
ve) in which the indicator slides in an <input> of type="range". note: using ::-moz-range-track with anything but an <input type="range"> doesn't match anything and has no effect. syntax ::-moz-range-track examples html <input type="range" min="0" max="100" step="5" value="50"/> css input[type=range]::-moz-range-track { background-color: green; } result a progress bar using this style might look something like this: specifications not part of any standard. ...
::-webkit-inner-spin-button - CSS: Cascading Style Sheets
syntax ::-webkit-inner-spin-button examples these examples work only in browsers based on webkit and blink. changing the cursor in the spin controls in this example, the css cursor is changed to pointer whenever the cursor is positioned over the inner part of the input's spin controls. ...
::-webkit-meter-inner-element - CSS: Cascading Style Sheets
additional markup to render the meter element as read-only. syntax ::-webkit-meter-inner-element specifications not part of any standard. examples this will only work in webkit and blink-based browsers, such as safari, chrome, and chromium-based versions of edge. ...
::-webkit-meter-optimum-value - CSS: Cascading Style Sheets
green is the default color. syntax ::-webkit-meter-optimum-value specifications not part of any standard. examples this example will only work in browsers based on webkit or blink. ...
::-webkit-outer-spin-button - CSS: Cascading Style Sheets
syntax ::-webkit-outer-spin-button examples these examples only works on browsers based on webkit or blink. hiding the spinner this example uses input::-webkit-outer-spin-button to find <input> elements' spinner widgets and set their -webkit-appearance to none, thus hiding them. ...
::-webkit-progress-value - CSS: Cascading Style Sheets
...
::-webkit-scrollbar - CSS: Cascading Style Sheets
::-webkit-scrollbar is only available in blink- and webkit-based browsers (e.g., chrome, edge, opera, safari, all browsers on ios, and others). css scrollbar selectors you can use the following pseudo elements to customize various parts of the scrollbar for webkit browsers: ::-webkit-scrollbar — the entire scrollbar. ::-webkit-scrollbar-button — the buttons on the scrollbar (arrows pointing upwards and downwards). ::-webkit-scrollbar-thumb — the draggable scrolling handle. ::-webkit-scrollbar-track — the track (progress bar) of the scrollbar. ...
::grammar-error - CSS: Cascading Style Sheets
html <p>my friends is coming to the party tonight.</p> css ::grammar-error { text-decoration: underline red; color: red; } result specifications specification status comment css pseudo-elements level 4the definition of '::grammar-error' in that specification. working draft initial definition. ...
::placeholder - CSS: Cascading Style Sheets
en programmatically associated with an input using a combination of the for and id attributes, assistive technology such as screen readers cannot parse <input> elements. mdn basic form hints placeholders in form fields are harmful — nielsen norman group examples red text html <input placeholder="type something here!"> css input::placeholder { color: red; font-size: 1.2em; font-style: italic; } result green text html <input placeholder="type something here..."> css input::placeholder { color: green; } result specifications specification status comment css pseudo-elements level 4the definition of '::placeholder' in that specification. working draft initial definition. ...
::spelling-error - CSS: Cascading Style Sheets
html <p contenteditable spellcheck="true">my friends are coegdfgfddffbgning to the party tonight.</p> css ::spelling-error { text-decoration: wavy red; } result specifications specification status comment css pseudo-elements level 4the definition of '::spelling-error' in that specification. working draft initial definition. ...
:active - CSS: Cascading Style Sheets
Web › CSS › :active
ctivation" typically starts when the user presses down the primary mouse button. /* selects any <a> that is being activated */ a:active { color: red; } the :active pseudo-class is commonly used on <a> and <button> elements. other common targets of this pseudo-class include elements that contain an activated element, and form elements that are being activated through their associated <label>. styles defined by the :active pseudo-class will be overridden by any subsequent link-related pseudo-class (:link, :hover, or :visited) that has at least equal specificity. to style links appropriately, put the :active rule after all other link-related rules, as defined by the lvha-order: :link — :visited — :hover — :active. note: on systems with multi-button mice, css3 specifies that the :active...
:any-link - CSS: Cascading Style Sheets
Web › CSS › :any-link
s, it matches every <a>, <area>, or <link> element that has an href attribute. thus, it matches all elements that match :link or :visited. /* selects any element that would be matched by :link or :visited */ :any-link { color: green; } syntax :any-link examples html <a href="https://example.com">external link</a><br> <a href="#">internal target link</a><br> <a>placeholder link (won't get styled)</a> css a:any-link { border: 1px solid blue; color: orange; } /* webkit browsers */ a:-webkit-any-link { border: 1px solid blue; color: orange; } result specifications specification status comment selectors level 4the definition of ':any-link' in that specification. working draft initial definition. ...
:focus-within - CSS: Cascading Style Sheets
ed by :focus. (this includes descendants in shadow trees.) /* selects a <div> when one of its descendants is focused */ div:focus-within { background: cyan; } this selector is useful, to take a common example, for highlighting an entire <form> container when the user focuses on one of its <input> fields. syntax :focus-within examples in this example, the form will receive special coloring styles when either text input receives focus. html <p>try typing into this form.</p> <form> <label for="given_name">given name:</label> <input id="given_name" type="text"> <br> <label for="family_name">family name:</label> <input id="family_name" type="text"> </form> css form { border: 1px solid; color: gray; padding: 4px; } form:focus-within { background: #ff8; color: black; ...
:has() - CSS: Cascading Style Sheets
Web › CSS › :has
ector> = '[' <wq-name> ']' | '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'where <attr-matcher> = [ '~' | | | '^' | '$' | '*' ]? '='<attr-modifier> = i | s description the :has() pseudo-class takes a relative selector list as an argument. in earlier revisions of the css selectors level 4 specification, :has had a limitation that it couldn't be used within stylesheets. instead, it could only be used with functions like document.queryselector(); this was due to performance concerns. this limitation has been removed because no browser implemented it that way. instead, browsers currently only support the use of :has() within stylesheets. examples matching <a> elements that directly contain an <img> the following selector matches only <a> elements that di...
:hover - CSS: Cascading Style Sheets
Web › CSS › :hover
the :hover css pseudo-class matches when the user interacts with an element with a pointing device, but does not necessarily activate it. it is generally triggered when the user hovers over an element with the cursor (mouse pointer). /* selects any <a> element when "hovered" */ a:hover { color: orange; } styles defined by the :active pseudo-class will be overridden by any subsequent link-related pseudo-class (:link, :visited, or :active) that has at least equal specificity. to style links appropriately, put the :hover rule after the :link and :visited rules but before the :active one, as defined by the lvha-order: :link — :visited — :hover — :active. note: the :hover pseudo-class is problematic on touchscreens. depending on the browser, the :hover pseudo-class might never match, mat...
:in-range - CSS: Cascading Style Sheets
Web › CSS › :in-range
absence of such a limitation, the element can neither be "in-range" nor "out-of-range." syntax :in-range examples html <form action="" id="form1"> <ul>values between 1 and 10 are valid. ...
:indeterminate - CSS: Cascading Style Sheets
html <div> <input type="checkbox" id="checkbox"> <label for="checkbox">this label starts out lime.</label> </div> <div> <input type="radio" id="radio"> <label for="radio">this label starts out lime.</label> </div> css input:indeterminate + label { background: lime; } javascript var inputs = document.getelementsbytagname("i...
:invalid - CSS: Cascading Style Sheets
Web › CSS › :invalid
guideline 1.4 explanations understanding success criterion 1.4.1 | w3c understanding wcag 2.0 notes radio buttons if any one of the radio buttons in a group is required, the :invalid pseudo-class is applied to all of them if none of the buttons in the group is selected. (grouped radio buttons share the same value for their name attribute.) gecko defaults by default, gecko does not apply a style to the :invalid pseudo-class. however, it does apply a style (a red "glow" using the box-shadow property) to the :-moz-ui-invalid pseudo-class, which applies in a subset of cases for :invalid. specifications specification status comment html living standardthe definition of ':invalid' in that specification. living standard no change. html5the definitio...
:is() (:matches(), :any()) - CSS: Cascading Style Sheets
Web › CSS › :is
, ul ul dir, ul menu dir, ul dir dir, menu ol ul, menu ul ul, menu menu ul, menu dir ul, menu ol menu, menu ul menu, menu menu menu, menu dir menu, menu ol dir, menu ul dir, menu menu dir, menu dir dir, dir ol ul, dir ul ul, dir menu ul, dir dir ul, dir ol menu, dir ul menu, dir menu menu, dir dir menu, dir ol dir, dir ul dir, dir menu dir, dir dir dir { list-style-type: square; } ... can be replaced with: /* 3-deep (or more) unordered lists use a square */ :is(ol, ul, menu, dir) :is(ol, ul, menu, dir) ul, :is(ol, ul, menu, dir) :is(ol, ul, menu, dir) menu, :is(ol, ul, menu, dir) :is(ol, ul, menu, dir) dir { list-style-type: square; } simplifying section selectors the :is() pseudo-class is particularly useful when dealing with html5 sections and head...
:last-of-type - CSS: Cascading Style Sheets
hat is the last element of its type among its siblings */ p:last-of-type { color: lime; } note: as originally defined, the selected element had to have a parent. beginning with selectors level 4, this is no longer required. syntax :last-of-type examples styling the last paragraph html <h2>heading</h2> <p>paragraph 1</p> <p>paragraph 2</p> css p:last-of-type { color: red; font-style: italic; } result nested elements this example shows how nested elements can also be targeted. note that the universal selector (*) is implied when no simple selector is written. html <article> <div>this `div` is first.</div> <div>this <span>nested `span` is last</span>!</div> <div>this <em>nested `em` is first</em>, but this <em>nested `em` is last</em>!</div> <b>this `b` qualifie...
:out-of-range - CSS: Cascading Style Sheets
ch a limitation, the element can neither be "in-range" nor "out-of-range." syntax :out-of-range examples html <form action="" id="form1"> <p>values between 1 and 10 are valid.</p> <ul> <li> <input id="value1" name="value1" type="number" placeholder="1 to 10" min="1" max="10" value="12"> <label for="value1">your value is </label> </li> </ul> </form> css li { list-style: none; margin-bottom: 1em; } input { border: 1px solid black; } input:in-range { background-color: rgba(0, 255, 0, 0.25); } input:out-of-range { background-color: rgba(255, 0, 0, 0.25); border: 2px solid red; } input:in-range + label::after { content: 'okay.'; } input:out-of-range + label::after { content: 'out of range!'; } result specifications specification ...
:state() - CSS: Cascading Style Sheets
Web › CSS › :state
the :state css pseudo-class represents any custom element with the specified custom state in elementinternals.states. custom-element:state(foo) { /* styles to apply when `custom-element` is in the `foo` state */ } syntax syntax not found in db! examples fill in a simple example that nicely shows a typical usage of the selector, then perhaps some more complex examples. my code block and/or include a list of links to useful code samples that live elsewhere: x y z specifications specification status comment unknownthe definition of 'the :state() selector' in that specification. unknown initial definition. ...
:target - CSS: Cascading Style Sheets
Web › CSS › :target
paragraph</i> using a url fragment. click on the link above to try out!</p> <p id="p2">this is <i>another paragraph</i>, also accessible from the links above. isn't that delightful?</p> css p:target { background-color: gold; } /* add a pseudo-element inside the target element */ p:target::before { font: 70% sans-serif; content: "►"; color: limegreen; margin-right: .25em; } /* style italic elements within the target element */ p:target i { color: red; } result pure-css lightbox you can use the :target pseudo-class to create a lightbox without using any javascript. this technique relies on the ability of anchor links to point to elements that are initially hidden on the page. once targeted, the css changes their display so that they are shown. note: a more complete pu...
font-display - CSS: Cascading Style Sheets
l font fallback. formal definition related at-rule@font-faceinitial valueautocomputed valueas specified formal syntax [ auto | block | swap | fallback | optional ] examples specifying fallback font-display @font-face { font-family: examplefont; src: url(/path/to/fonts/examplefont.woff) format('woff'), url(/path/to/fonts/examplefont.eot) format('eot'); font-weight: 400; font-style: normal; font-display: fallback; } specifications specification status comment css fonts module level 4the definition of 'font-display' in that specification. working draft initial definition ...
font-stretch - CSS: Cascading Style Sheets
the values for the css descriptor is same as that of its corresponding font property. ...
font-variation-settings - CSS: Cascading Style Sheets
ole property is invalid. the <number> can be fractional or negative. formal definition related at-rule@font-faceinitial valuenormalcomputed valueas specified formal syntax normal | [ <string> <number> ]# examples setting font weight and stretch in a @font-face rule @font-face { font-family: 'opentypefont'; src: url('open_type_font.woff2') format('woff2'); font-weight: normal; font-style: normal; font-variation-settings: 'wght' 400, 'wdth' 300; } specifications specification status comment css fonts module level 4the definition of 'font-variation-settings' in that specification. working draft initial definition ...
font-weight - CSS: Cascading Style Sheets
the font-weight css descriptor allows authors to specify font weights for the fonts specified in the @font-face rule. the font-weight property can separately be used to set how thick or thin characters in text should be displayed. for a particular font family, authors can download various font faces which correspond to the different styles of the same font family, and then use the font-weight descriptor to explicitly specify the font face's weights. the values for the css descriptor is same as that of its corresponding font property. there are generally limited weights available for a particular font family. when a specified weight doesn't exist, a nearby weight is used. fonts lacking bold are often synthesized by the user agent. to prevent this, use font-synthesis property. syntax /* sing...
src - CSS: Cascading Style Sheets
Web › CSS › @font-face › src
alled font face names. when a font is needed the user agent iterates over the set of references listed using the first one it can successfully activate. fonts containing invalid data or local font faces that are not found are ignored and the user agent loads the next font in the list. as with other urls in css, the url may be relative, in which case it is resolved relative to the location of the style sheet containing the @font-face rule. in the case of svg fonts, the url points to an element within a document containing svg font definitions. if the element reference is omitted, a reference to the first defined font is implied. similarly, font container formats that can contain more than one font load only one of the fonts for a given @font-face rule. fragment identifiers are used to indicate ...
unicode-range - CSS: Cascading Style Sheets
the font resources for greek and japanese fonts wouldn't need to be downloaded, saving bandwidth. formal definition related at-rule@font-faceinitial valueu+0-10ffffcomputed valueas specified formal syntax <unicode-range># examples using a different font for a single character in this example we create a simple html containing a single <div> element, including an ampersand, that we want to style with a different font. to make it obvious, we will use a sans-serif font, helvetica, for the text, and a serif font, times new roman, for the ampersand. in the css we are in effect defining a completely separate @font-face that only includes a single character in it, meaning that only this character will be styled with this font. we could also have done this by wrapping the ampersand in a <span>...
-moz-device-pixel-ratio - CSS: Cascading Style Sheets
do not use this feature. use the resolution feature with the dppx unit instead. note: this media feature is also implemented by webkit and by ie 11 for windows phone 8.1 as -webkit-device-pixel-ratio. the min and max prefixes as implemented by gecko are named min--moz-device-pixel-ratio and max--moz-device-pixel-ratio; but the same prefixes as implemented by webkit are named -webkit-min-device-pixel-ratio and -webkit-max-device-pixel-ratio. syntax <number> the number of device pixels per css pixel. ...
-webkit-transform-3d - CSS: Cascading Style Sheets
ture query instead. syntax -webkit-transform-3d is a boolean css media feature whose value is true if the browser supports -webkit prefixed css 3d transforms. values true the browser supports the 3d css transforms with the -webkit prefix. false the 3d css transforms prefixed with -webkit are not supported by the browser. examples @media (-webkit-transform-3d) { .foo { transform-style: preserve-3d; } } @media (-webkit-transform-3d: 1) { .foo { transform-style: preserve-3d; } } specifications specification status comment compatibility standardthe definition of '-webkit-transform-3d' in that specification. living standard initial standardization safari css reference 'media query extensions' in that document. non-stan...
aural - CSS: Cascading Style Sheets
Web › CSS › @media › aural
ural css media type is used for devices that have speech output capabilities. note: this media type has been deprecated in favor of speech. syntax the aural css media type—which has been deprecated in favor of the speech media type—was used to specify a block of css that applied only when the content is being presented using a speech synthesis device. @media aural { /* speech-specific styles here */ } updating existing css to use the speech media type should be as simple as replacing aural with speech. examples basic example @media aural { body { voice-family: paul } } specifications specification status comment css level 2 (revision 2)the definition of 'aural' in that specification. deprecated initial definition. ...
device-height - CSS: Cascading Style Sheets
the device-height css media feature can be used to test the height of an output device's rendering surface. syntax the device-height feature is specified as a <length> value. it is a range feature, meaning that you can also use the prefixed min-device-height and max-device-height variants to query minimum and maximum values, respectively. examples this html applies a special stylesheet for devices that are shorter than 800 pixels. <link rel="stylesheet" media="screen and (max-device-height: 799px)" href="http://foo.bar.com/short-styles.css" /> specifications specification status comment media queries level 4the definition of 'device-height' in that specification. candidate recommendation deprecated in media queries level 4. media queriesthe d...
device-width - CSS: Cascading Style Sheets
the device-width css media feature can be used to test the width of an output device's rendering surface. syntax the device-width feature is specified as a <length> value. it is a range feature, meaning that you can also use the prefixed min-device-width and max-device-width variants to query minimum and maximum values, respectively. examples this html applies a special stylesheet for devices that are narrower than 800 pixels. <link rel="stylesheet" media="screen and (max-device-width: 799px)" href="http://foo.bar.com/narrow-styles.css" /> specifications specification status comment media queries level 4the definition of 'device-width' in that specification. candidate recommendation deprecated in media queries level 4. media queriesthe defini...
height - CSS: Cascading Style Sheets
Web › CSS › @media › height
syntax the height feature is specified as a <length> value representing the viewport height. it is a range feature, meaning that you can also use the prefixed min-height and max-height variants to query minimum and maximum values, respectively. ...
orientation - CSS: Cascading Style Sheets
the orientation css media feature can be used to test the orientation of the viewport (or the page box, for paged media). note: this feature does not correspond to device orientation. opening the soft keyboard on many devices in portrait orientation will cause the viewport to become wider than it is tall, thereby causing the browser to use landscape styles instead of portrait. syntax the orientation feature is specified as a keyword value chosen from the list below. keyword values portrait the viewport is in a portrait orientation, i.e., the height is greater than or equal to the width. landscape the viewport is in a landscape orientation, i.e., the width is greater than the height. examples html <div>box 1</div> <div>box 2</div> <div>box 3</div> css body { display: flex;...
@media - CSS: Cascading Style Sheets
Web › CSS › @media
with it, you specify a media query and a block of css to apply to the document if and only if the media query matches the device on which the content is being used. note: in javascript, the rules created using @media can be accessed with the cssmediarule css object model interface. syntax the @media at-rule may be placed at the top level of your code or nested inside any other conditional group at-rule. ...
@viewport - CSS: Cascading Style Sheets
Web › CSS › @viewport
standards track. the @viewport css at-rule lets you configure the viewport through which the document is viewed. it's primarily used for mobile devices, but is also used by desktop browsers that support features like "snap to edge" (such as microsoft edge). lengths specified as percentages are calculated relative to the initial viewport, which is the viewport before any user agent or authored styles have had an opportunity to adjust the viewport. this is typically based on the size of the window on desktop browsers that aren't in full screen mode. on mobile devices (or desktop devices that are in full screen mode), the initial viewport is usually the portion of a device's screen that is available for application use. this may be either the full screen or the full screen area minus areas co...
Adjacent sibling combinator - CSS: Cascading Style Sheets
the adjacent sibling combinator (+) separates two selectors and matches the second element only if it immediately follows the first element, and both are children of the same parent element. /* paragraphs that come immediately after any image */ img + p { font-weight: bold; } syntax former_element + target_element { style properties } examples css li:first-of-type + li { color: red; } html <ul> <li>one</li> <li>two!</li> <li>three</li> </ul> result specifications specification status comment selectors level 4the definition of 'next-sibling combinator' in that specification. working draft renames it the "next-sibling" combinator. selectors level 3the definition of 'adjacent sibling combinator' in that specification. recommen...
CSS Basic User Interface - CSS: Cascading Style Sheets
css basic user interface is a css module that lets you define the rendering and functionality of features related to the user interface. reference properties appearance box-sizing cursor ime-mode nav-down nav-left nav-right nav-up outline outline-width outline-style outline-color outline-offset resize text-overflow user-select guides using url values for the cursor property explains how a url can be used with the cursor property to produce custom cursors. specifications specification status comment css basic user interface module level 4 working draft css basic user interface module level 3 recommendation css level 2 (revision 1) recommendation initial definition. ...
CSS Charsets - CSS: Cascading Style Sheets
css charsets is a module of css that lets you specify the character set used in the style sheet. reference at-rules @charset specifications specification status comment css level 2 (revision 1)the definition of '@charset' in that specification. recommendation initial definition ...
CSS Multi-column Layout - CSS: Cascading Style Sheets
d media, in that each column box becomes a fragment, much like a printed page becomes a fragment of an overall document. therefore the properties now defined in the css fragmentation specification are required in order to control how content breaks between columns. reference multiple-column layout properties column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width columns related css fragmentation properties break-after break-before break-inside orphans widows guides basic concepts of multicol an overview of the multiple-column layout specification styling columns how to use column rules and manage the spacing between columns. spanning and balancing how to make elements span across all co...
Using feature queries - CSS: Cascading Style Sheets
e to test the fallback by misspelling the property or value name. you can try this in the live example above by changing display: grid in the @supports rule to display: grip or similar. summary feature queries can help you start to use newer features by enhancing a simpler display of the site used for older browsers. as you can wrap up the css for supporting browsers, you do not run the risk of styles used for the fallback display leaking through, as shown in our grid example above. see also the @supports rule learn layout: supporting older browsers css grid layout and progressive enhancement using feature queries in css ...
CSS Conditional Rules - CSS: Cascading Style Sheets
css conditional rules is a css module that allows to define a set of rules that will only apply based on the capabilities of the processor or the document the style sheet is being applied to. reference at-rules @document @media @supports @import specifications specification status comment css conditional rules module level 3 candidate recommendation initial definition ...
Backwards Compatibility of Flexbox - CSS: Cascading Style Sheets
ight columns and vertical centering and work back as far as internet explorer 8. if you use display: table-cell on an item in your html it takes on the styling of an html table cell. css creates anonymous boxes to represent these items so that you do not need to wrap each item in a wrapper to represent the html table row, and a second one to represent the table element itself, you can’t see or style these anonymous boxes; they are there purely to fix up the tree. if you then declare display: flex on the parent item, these anonymous boxes do not get created and so your item remains a direct child and can become a flex item — losing any of the table display features. “note: some values of display normally trigger the creation of anonymous boxes around the original box. if such a box is ...
Ordering Flex Items - CSS: Cascading Style Sheets
note: for some years firefox had a bug whereby it would attempt to follow the visual order and not the source order, making it behave differently to other browsers. this has now been fixed. you should always take the source order as the logical order of the document as all up-to-date user agents will be following the specification and doing so. in the live example below i have added a focus style in order that as you tab from link to link you can see which is highlighted. if you change the order using flex-direction you can see how the tab order continues to follow the order that the items are listed in the source. in the same way that changing the value of flex-direction does not change the order in which items are navigated to, changing this value does not change paint order. it is a...
Relationship of flexbox to other layout methods - CSS: Cascading Style Sheets
lows: “the element itself does not generate any boxes, but its children and pseudo-elements still generate boxes as normal. for the purposes of box generation and layout, the element must be treated as if it had been replaced with its children and pseudo-elements in the document tree.” this value of display controls box generation, and whether the element should generate a box that we can style and see on the page, or whether instead the box it would normally create should be removed and the child elements essentially moved up to participate in whatever layout method the parent would have been part of. this is much easier to see with an example. in the following live example i have a flex container with three child elements. one of these flex items has two elements nested inside it, wh...
Block and inline layout in normal flow - CSS: Cascading Style Sheets
l be working in english and therefore a horizontal writing mode. however, everything described should work in the same way if your document is in a vertical writing mode. as defined in the specification, the margins between two block boxes are what creates separation between the elements. we see this with a very simple layout of two paragraphs, to which i have added a border. the default browser stylesheet adds spacing between the paragraphs by way of adding a margin to the top and bottom. if we set margins on the paragraph element to 0 then the borders will touch. by default block elements will consume all of the space in the inline direction, so our paragraphs spread out and get as big as they can inside their containing block. if we give them a width, they will continue to lay out one...
CSS Grid Layout and Accessibility - CSS: Cascading Style Sheets
ting using the keyboard could be tabbing through links on your site and suddenly find themselves jumping from the top to the bottom of the document due to a reordered item being next in line. the specification warns authors (the csswg term for web developers) not to do this reordering. authors must use order and the grid-placement properties only for visual, not logical, reordering of content. style sheets that use these features to perform logical reordering are non-conforming. what does this mean for designing with grid layout in practice? visual not logical re-ordering any time you reorder things with grid layout – or with flexbox – you only perform visual reordering. the underlying source is what controls things like text to speech, and the tab order of the document. you can see ...
Understanding CSS z-index - CSS: Cascading Style Sheets
adjust the order of the layering of objects when rendering content. in css 2.1, each box has a position in three dimensions. in addition to their horizontal and vertical positions, boxes lie along a "z-axis" and are formatted one on top of the other. z-axis positions are particularly relevant when boxes overlap visually. (from css 2.1 section 9.9.1 - layered presentation) this means that css style rules allow you to position boxes on layers in addition to the normal rendering layer (layer 0). the z position of each layer is expressed as an integer representing the stacking order for rendering. greater numbers mean closer to the observer. z position can be controlled with the css z-index property. using z-index appears extremely easy: a single property, assigned a single integer number, wi...
CSS Text Decoration - CSS: Cascading Style Sheets
css text decoration is a module of css that defines features relating to text decoration, such as underlines, text shadows, and emphasis marks. reference properties letter-spacing text-align text-decoration text-decoration-color text-decoration-line text-decoration-offset text-decoration-skip-ink text-decoration-style text-decoration-thickness text-emphasis text-emphasis-color text-emphasis-position text-emphasis-style text-indent text-rendering text-shadow text-transform white-space word-spacing guides none. examples .under { text-decoration: underline red; } .over { text-decoration: wavy overline lime; } .line { text-decoration: line-through; } .plain { text-decoration: none; } .underover { text-decoration: dashed underline overline; } .thick { ...
CSS data types - CSS: Cascading Style Sheets
Web › CSS › CSS Types
ta types are denoted by a keyword placed between the inequality signs "<" and ">". ...
Child combinator - CSS: Cascading Style Sheets
{ margin: 2em; } elements matched by the second selector must be the immediate children of the elements matched by the first selector. this is stricter than the descendant combinator, which matches all elements matched by the second selector for which there exists an ancestor element matched by the first selector, regardless of the number of "hops" up the dom. syntax selector1 > selector2 { style properties } examples css span { background-color: white; } div > span { background-color: dodgerblue; } html <div> <span>span #1, in the div. <span>span #2, in the span that's in the div.</span> </span> </div> <span>span #3, not in the div at all.</span> result specifications specification status comment selectors level 4the definition of 'ch...
Column combinator - CSS: Cascading Style Sheets
the column combinator (||) is placed between two css selectors. it matches only those elements matched by the second selector that belong to the column elements matched by the first. ...
General sibling combinator - CSS: Cascading Style Sheets
the general sibling combinator (~) separates two selectors and matches the second element only if it follows the first element (though not necessarily immediately), and both are children of the same parent element. /* paragraphs that are siblings of and subsequent to any image */ img ~ p { color: red; } syntax former_element ~ target_element { style properties } examples css p ~ span { color: red; } html <span>this is not red.</span> <p>here is a paragraph.</p> <code>here is some code.</code> <span>and here is a red span!</span> <code>more code...</code> <span>and this is a red span!</span> result specifications specification status comment selectors level 4the definition of 'subsequent-sibling combinator' in that specification. working draf...
ID selectors - CSS: Cascading Style Sheets
the css id selector matches an element based on the value of the element’s id attribute. in order for the element to be selected, its id attribute must match exactly the value given in the selector. /* the element with id="demo" */ #demo { border: red 2px solid; } syntax #id_value { style properties } note that syntactically (but not specificity-wise), this is equivalent to the following attribute selector: [id=id_value] { style properties } examples css #identified { background-color: skyblue; } html <div id="identified">this div has a special id on it!</div> <div>this is just a regular div.</div> result specifications specification status comment selectors level 4the definition of 'id selectors' in that specification. working draft ...
Column layouts - CSS: Cascading Style Sheets
eed to create a layout which has a number of columns, and css provides several ways to do this. whether you use grid, flexbox or multi-column layout will depend on what you are trying to achieve, and in this recipe we explore these options. requirements there are a number of design patterns you might want to achieve with your columns: a continuous thread of content broken up into newspaper-style columns. a single row of items arranged as columns, with all heights being equal. multiple rows of columns lined up by row and column. the recipes you need to choose different layout methods in order to achieve your requirements. a continuous thread of content — multi-column layout if you create columns using multi-column layout your text will remain as a continuous stream filling each c...
Pagination - CSS: Cascading Style Sheets
ex container in order that we can center the list inside using the justify-content property. the list itself also becomes a flex container to lay the items out as a row. to space the items out we will use a margin on the flex items. alternative methods once the column-gap property has implementation in browsers this could be used instead of margins to space out the items. .pagination { list-style: none; margin: 0; padding: 0; display: flex; column-gap: 2px; } accessibility concerns we want to ensure that a person using a screenreader understands what this navigation does, and where they will go when clicking a link. to help with this we have added aria-label="pagination" on the <nav> element. we have also added some additional content that would be read by a screenreader but ...
Microsoft CSS extensions - CSS: Cascading Style Sheets
progression -ms-content-zoom-chaining -ms-content-zooming -ms-content-zoom-limit -ms-content-zoom-limit-max -ms-content-zoom-limit-min -ms-content-zoom-snap -ms-content-zoom-snap-points -ms-content-zoom-snap-type -ms-filter -ms-flow-from -ms-flow-into -ms-high-contrast-adjust -ms-hyphenate-limit-chars -ms-hyphenate-limit-lines -ms-hyphenate-limit-zone -ms-ime-align -ms-overflow-style -ms-scrollbar-3dlight-color -ms-scrollbar-arrow-color -ms-scrollbar-base-color -ms-scrollbar-darkshadow-color -ms-scrollbar-face-color -ms-scrollbar-highlight-color -ms-scrollbar-shadow-color -ms-scrollbar-track-color -ms-scroll-chaining -ms-scroll-limit -ms-scroll-limit-x-max -ms-scroll-limit-x-min -ms-scroll-limit-y-max -ms-scroll-limit-y-min -ms-scroll-rails -ms...
Paged media - CSS: Cascading Style Sheets
paged media properties control the presentation of content for print or any other media that splits content into discrete pages. it allows you to set page breaks, control printable area, style left and right pages differently, and control breaks inside elements. widely supported properties include: page-break-before page-break-after page-break-inside orphans widows @page ...
Pseudo-classes - CSS: Cascading Style Sheets
a css pseudo-class is a keyword added to a selector that specifies a special state of the selected element(s). for example, :hover can be used to change a button's color when the user's pointer hovers over it. /* any button over which the user's pointer is hovering */ button:hover { color: blue; } pseudo-classes let you apply a style to an element not only in relation to the content of the document tree, but also in relation to external factors like the history of the navigator (:visited, for example), the status of its content (like :checked on certain form elements), or the position of the mouse (like :hover, which lets you know if the mouse is over an element or not). note: in contrast to pseudo-classes, pseudo-elements can be used to style a specific part of an element. syntax sel...
Replaced elements - CSS: Cascading Style Sheets
in css, a replaced element is an element whose representation is outside the scope of css; they're external objects whose representation is independent of the css formatting model. put in simpler terms, they're elements whose contents are not affected by the current document's styles. the position of the replaced element can be affected using css, but not the contents of the replaced element itself. some replaced elements, such as <iframe> elements, may have stylesheets of their own, but they don't inherit the styles of the parent document. the only other impact css can have on a replaced element is that there are properties which support controlling the positioning of the element's content within its box. see controlling object position within the content box for further information. repla...
Type selectors - CSS: Cascading Style Sheets
the css type selector matches elements by node name. in other words, it selects all elements of the given type within a document. /* all <a> elements. */ a { color: red; } syntax element { style properties } examples css span { background-color: skyblue; } html <span>here's a span with some text.</span> <p>here's a p with some text.</p> <span>here's a span with more text.</span> result specifications specification status comment selectors level 4the definition of 'type (tag name) selector' in that specification. working draft no changes selectors level 3the definition of 'type selectors' in that specification. recommendation no changes css level 2 (revision 1)the definition of 'type selectors' in that specification. ...
Universal selectors - CSS: Cascading Style Sheets
for instance, *.warning and .warning are equivalent. ...
Value definition syntax - CSS: Cascading Style Sheets
to [ bold thin ] && <length>. it describes bold thin <length> or <length> bold thin but not bold <length> thin. double bar separating two or more components by a double bar, ||, means that all entities are options: at least one of them must be present, and they may appear in any order. typically this is used to define the different values of a shorthand property. <'border-width'> || <'border-style'> || <'border-color'> this example matches the following values: 1em solid blue blue 1em solid 1px yellow but not: blue yellow, as a component must appear at most one single time. bold, as it isn't a keyword allowed as value of any of the entity. note: the double ampersand has precedence over the double bar, meaning that bold || thin && <length> is equivalent to bold || [ thin && ...
align-content - CSS: Cascading Style Sheets
working draft adds the [ first | last ]? baseline, start, end, left, right, unsafe...
align-items - CSS: Cascading Style Sheets
working draft update to latest syntax definitions. css flexible box layout mo...
aspect-ratio - CSS: Cascading Style Sheets
xes and internal ruby or table boxesinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | <ratio> examples mapping width and height to aspect-ratio firefox has added an internal aspect-ratio property (in version 69 onwards) that applies to replaced elements and other related elements that accept width and height attributes. this appears in the browser's internal ua stylesheet. chrome is also shipping this feature. in firefox, the internal stylesheet rule looks like this: img, input[type="image"], video, embed, iframe, marquee, object, table { aspect-ratio: attr(width) / attr(height); } specifications specification status comment css box sizing module level 4the definition of 'aspect-ratio' in that specification. editor's draf...
backface-visibility - CSS: Cascading Style Sheets
the three back faces of the "cube" */ .showbf div { backface-visibility: visible; } .hidebf div { backface-visibility: hidden; } /* define the container div, the cube div, and a generic face */ .container { width: 150px; height: 150px; margin: 75px 0 0 75px; border: none; } .cube { width: 100%; height: 100%; perspective: 550px; perspective-origin: 150% 150%; transform-style: preserve-3d; } .face { display: block; position: absolute; width: 100px; height: 100px; border: none; line-height: 100px; font-family: sans-serif; font-size: 60px; color: white; text-align: center; } /* define each face based on direction */ .front { background: rgba(0, 0, 0, 0.3); transform: translatez(50px); } .back { background: rgba(0, 255, 0, 1); color: black;...
background-blend-mode - CSS: Cascading Style Sheets
candidate recommendation initial definition ...
<blend-mode> - CSS: Cascading Style Sheets
candidate recommendation initial definition. ...
border-block-end-width - CSS: Cascading Style Sheets
ck; related properties are border-block-start-width, border-inline-start-width, and border-inline-end-width, which define the other border widths of the element. values <'border-width'> the width of the border. see border-width. ...
border-block-width - CSS: Cascading Style Sheets
h: thick; the border width in the other dimension can be set with border-inline-width, which sets border-inline-start-width, and border-inline-end-width. syntax values <'border-width'> the width of the border. see border-width. ...
border-bottom-left-radius - CSS: Cascading Style Sheets
the box is a square: an arc of circle is used as the border div { border-bottom-left-radius: 40%; } . the box is not a square: an arc of ellipse is used as the border div { border-bottom-left-radius: 40%; } . the background color is clipped at the border div { border-bottom-left-radius:40%; border-style: black 3px double; background-color: rgb(250,20,70); background-clip: content-box; } specifications specification status comment css backgrounds and borders module level 3the definition of 'border-bottom-left-radius' in that specification. candidate recommendation initial definition ...
border-bottom-right-radius - CSS: Cascading Style Sheets
the box is a square: an arc of circle is used as the border div { border-bottom-right-radius: 40%; } . the box is not a square: an arc of ellipse is used as the border div { border-bottom-right-radius: 40%; } . the background color is clipped at the border div { border-bottom-right-radius:40%; border-style: black 3px double; background-color: rgb(250,20,70); background-clip: content-box; } specifications specification status comment css backgrounds and borders module level 3the definition of 'border-bottom-right-radius' in that specification. candidate recommendation initial definition ...
border-collapse - CSS: Cascading Style Sheets
the border-collapse css property sets whether cells inside a <table> have shared or separate borders. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. when cells are collapsed, the border-style value of inset behaves like groove, and outset behaves like ridge. when cells are separated, the distance between cells is defined by the border-spacing property. syntax /* keyword values */ border-collapse: collapse; border-collapse: separate; /* global values */ border-collapse: inherit; border-collapse: initial; border-collapse: unset; the border-collapse property is specified as a single keyword, which may be chosen f...
border-end-end-radius - CSS: Cascading Style Sheets
the border-end-end-radius css property defines a logical border radius on an element, which maps to a physical border radius that depends on on the element's writing-mode, direction, and text-orientation. this is useful when building styles to work regardless of the text orientation and writing mode. /* <length> values */ /* with one value the corner will be a circle */ border-end-end-radius: 10px; border-end-end-radius: 1em; /* with two values the corner will be an ellipse */ border-end-end-radius: 1em 2em; /* global values */ border-end-end-radius: inherit; border-end-end-radius: initial; border-end-end-radius: unset; for instance, in a horizontal-tb writing mode this property corresponds to the border-bottom-right-radius property. syntax values <length-percentage> denotes the siz...
border-end-start-radius - CSS: Cascading Style Sheets
the border-end-start-radius css property defines a logical border radius on an element, which maps to a physical border radius depending on the element's writing-mode, direction, and text-orientation. this is useful when building styles to work regardless of the text orientation and writing mode. /* <length> values */ /* with one value the corner will be a circle */ border-end-start-radius: 10px; border-end-start-radius: 1em; /* with two values the corner will be an ellipse */ border-end-start-radius: 1em 2em; /* global values */ border-end-start-radius: inherit; border-end-start-radius: initial; border-end-start-radius: unset; for instance, in a horizontal-tb writing mode this property corresponds to the border-top-right-radius property. syntax values <length-percentage> denotes th...
border-image-repeat - CSS: Cascading Style Sheets
candidate recommendation initial definition ...
border-image-source - CSS: Cascading Style Sheets
cally applied to the final border image. syntax /* keyword value */ border-image-source: none; /* <image> values */ border-image-source: url(image.jpg); border-image-source: linear-gradient(to top, red, yellow); /* global values */ border-image-source: inherit; border-image-source: initial; border-image-source: unset; values none no border image is used. the appearance defined by border-style is displayed instead. <image> image reference to use for the border. formal definition initial valuenoneapplies toall elements, except internal table elements when border-collapse is collapse. it also applies to ::first-letter.inheritednocomputed valuenone or the image with its uri made absoluteanimation typediscrete formal syntax none | <image>where <image> = <url> | <image()> | <image-se...
border-inline-start-width - CSS: Cascading Style Sheets
thick; related properties are border-block-start-width, border-block-end-width, and border-inline-end-width, which define the other border widths of the element. values <'border-width'> the width of the border. see border-width. ...
border-inline-width - CSS: Cascading Style Sheets
idth: thick; the border width in the other dimension can be set with border-block-width, which sets border-block-start-width, and border-block-end-width. syntax values <'border-width'> the width of the border. see border-width. ...
border-left-width - CSS: Cascading Style Sheets
t thickness denoted by each keyword, the precise result when using one of them is implementation-specific. nevertheless, they always follow the pattern thin ≤ medium ≤ thick, and the values are constant within a single document. formal definition initial valuemediumapplies toall elements. ...
border-right-width - CSS: Cascading Style Sheets
thickness denoted by each keyword, the precise result when using one of them is implementation-specific. nevertheless, they always follow the pattern thin ≤ medium ≤ thick, and the values are constant within a single document. formal definition initial valuemediumapplies toall elements. ...
border-start-end-radius - CSS: Cascading Style Sheets
the border-start-end-radius css property defines a logical border radius on an element, which maps to a physical border radius depending on the element's writing-mode, direction, and text-orientation. this is useful when building styles to work regardless of the text orientation and writing mode. /* <length> values */ /* with one value the corner will be a circle */ border-start-end-radius: 10px; border-start-end-radius: 1em; /* with two values the corner will be an ellipse */ border-start-end-radius: 1em 2em; /* global values */ border-start-end-radius: inherit; border-start-end-radius: initial; border-start-end-radius: unset; for instance, in a horizontal-tb writing mode this property corresponds to the border-bottom-left-radius property. syntax values <length-percentage> denotes ...
border-start-start-radius - CSS: Cascading Style Sheets
the border-start-start-radius css property defines a logical border radius on an element, which maps to a physical border radius that depends on the element's writing-mode, direction, and text-orientation. this is useful when building styles to work regardless of the text orientation and writing mode. /* <length> values */ /* with one value the corner will be a circle */ border-start-start-radius: 10px; border-start-start-radius: 1em; /* with two values the corner will be an ellipse */ border-start-start-radius: 1em 2em; /* global values */ border-start-start-radius: inherit; border-start-start-radius: initial; border-start-start-radius: unset; for instance, in a horizontal-tb writing mode this property corresponds to the border-top-left-radius property. syntax values <length-percent...
border-top-left-radius - CSS: Cascading Style Sheets
candidate recommendation initial definition ...
border-top-right-radius - CSS: Cascading Style Sheets
the box is a square: an arc of circle is used as the border div { border-top-right-radius: 40%; } . the box is not a square: an arc of ellipse is used as the border div { border-top-right-radius: 40%; } the background color is clipped at the border div { border-top-right-radius:40%; border-style: black 3px double; background-color: rgb(250,20,70); background-clip: content-box; } specifications specification status comment css backgrounds and borders module level 3the definition of 'border-top-right-radius' in that specification. candidate recommendation initial definition ...
border-top-width - CSS: Cascading Style Sheets
ct thickness denoted by each keyword, the precise result when using one of them is implementation-specific. nevertheless, they always follow the pattern thin ≤ medium ≤ thick, and the values are constant within a single document. formal definition initial valuemediumapplies toall elements. ...
box-direction - CSS: Cascading Style Sheets
start (the left or top edge). reverse the box lays out its contents from the end (the right or bottom edge). notes the edge of the box designated the start for layout purposes depends on the box's orientation: horizontal left vertical top the edge opposite to the start is designated the end. if the direction is set using the element's dir attribute, then the style is ignored. formal definition initial valuenormalapplies toelements with a css display value of box or inline-boxinheritednocomputed valueas specifiedanimation typediscrete formal syntax normal | reverse | inherit examples setting box direction .example { /* bottom-to-top layout */ -moz-box-direction: reverse; /* mozilla */ -webkit-box-direction: reverse; /* webkit */ box-di...
break-inside - CSS: Cascading Style Sheets
candidate recommendation no change. css regions module level 1the definition of 'break-inside' in that specification.
column-rule-color - CSS: Cascading Style Sheets
age>, <percentage>, <alpha-value>? )where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples setting a blue column rule html <p>this is a bunch of text split into three columns. the `column-rule-color` property is used to change the color of the line that is drawn between columns. don't you think that's wonderful?</p> css p { column-count: 3; column-rule-style: solid; column-rule-color: blue; } result specifications specification status comment css multi-column layout modulethe definition of 'column-rule-color' in that specification. working draft initial definition. ...
Computed value - CSS: Cascading Style Sheets
thing that may require layout to determine, such as width, margin-right, text-indent, and top), percentage-specified values turn into percentage-computed values. additionally, unitless numbers specified on the line-height property become the computed value, as specified. the relative values that remain in the computed value become absolute when the used value is determined. note: the getcomputedstyle() dom api returns the resolved value, which may either be the computed value or the used value, depending on the property. specifications specification status comment css level 2 (revision 2)the definition of 'computed-value' in that specification. working draft no change. css level 2 (revision 1)the definition of 'computed value' in that spe...
<easing-function> - CSS: Cascading Style Sheets
o { left: 90%; } } li { display: flex; align-items: center; justify-content: center; margin-bottom: 20px; } javascript const selectelem = document.queryselector('select'); const startbtn = document.queryselector('button'); const divelem = document.queryselector('div > div'); startbtn.addeventlistener('click', () => { if(startbtn.textcontent === 'start animation') { divelem.style.animationname = 'move-right'; startbtn.textcontent = 'stop animation'; divelem.style.animationtimingfunction = selectelem.value; } else { divelem.style.animationname = 'unset'; startbtn.textcontent = 'start animation'; } }); selectelem.addeventlistener('change', () => { divelem.style.animationtimingfunction = selectelem.value; }); result cubic-bezier() function examples...
flex-basis - CSS: Cascading Style Sheets
flex1">1: flex-basis test</li> <li class="flex flex2">2: flex-basis test</li> <li class="flex flex3">3: flex-basis test</li> <li class="flex flex4">4: flex-basis test</li> <li class="flex flex5">5: flex-basis test</li> </ul> <ul class="container"> <li class="flex flex6">6: flex-basis test</li> </ul> css .container { font-family: arial, sans-serif; margin: 0; padding: 0; list-style-type: none; display: flex; flex-wrap: wrap; } .flex { background: #6ab6d8; padding: 10px; margin-bottom: 50px; border: 3px solid #2e86bb; color: white; font-size: 14px; text-align: center; position: relative; } .flex:after { position: absolute; z-index: 1; left: 0; top: 100%; margin-top: 10px; width: 100%; color: #333; font-size: 12px; } .flex1 { flex-basi...
flex-direction - CSS: Cascading Style Sheets
1.3 explanations understanding success criterion 1.3.2 | w3c understanding wcag 2.0 formal definition initial valuerowapplies toflex containersinheritednocomputed valueas specifiedanimation typediscrete formal syntax row | row-reverse | column | column-reverse examples reversing flex container columns and rows html <h4>this is a column-reverse</h4> <div id="content"> <div class="box" style="background-color:red;">a</div> <div class="box" style="background-color:lightblue;">b</div> <div class="box" style="background-color:yellow;">c</div> </div> <h4>this is a row-reverse</h4> <div id="content1"> <div class="box1" style="background-color:red;">a</div> <div class="box1" style="background-color:lightblue;">b</div> <div class="box1" style="background-color:yellow;">c</div> </d...
flex-wrap - CSS: Cascading Style Sheets
Web › CSS › flex-wrap
reen">2</div> <div class="blue">3</div> </div> <h4>this is an example for flex-wrap:nowrap </h4> <div class="content1"> <div class="red">1</div> <div class="green">2</div> <div class="blue">3</div> </div> <h4>this is an example for flex-wrap:wrap-reverse </h4> <div class="content2"> <div class="red">1</div> <div class="green">2</div> <div class="blue">3</div> </div> css /* common styles */ .content, .content1, .content2 { color: #fff; font: 100 24px/100px sans-serif; height: 150px; text-align: center; } .content div, .content1 div, .content2 div { height: 50%; width: 300px; } .red { background: orangered; } .green { background: yellowgreen; } .blue { background: steelblue; } /* flexbox styles */ .content { display: flex; flex-wrap: ...
font-feature-settings - CSS: Cascading Style Sheets
candidate recommendation initial definition ...
font-optical-sizing - CSS: Cascading Style Sheets
n typediscrete formal syntax auto | none examples disabling optical sizing <p class="optical-sizing">this paragraph is optically sized. this is the default across browsers.</p> <p class="no-optical-sizing">this paragraph is not optically sized. you should see a difference in supporting browsers.</p> @font-face { src: url('amstelvaralpha-vf.ttf'); font-family:'amstelvar'; font-style: normal; } p { font-size: 36px; font-family: amstelvar; } .no-optical-sizing { font-optical-sizing: none; } note: the font referenced above — which includes optical sizing and is freely-licensed — is good for testing. you can download it on github. specifications specification status comment css fonts module level 4the definition of 'font-optical-sizin...
font-size-adjust - CSS: Cascading Style Sheets
ntly different aspect ratio (the ratio of the size of lowercase letters to the size of the font). to use this property in a way that is compatible with browsers that do not support font-size-adjust, it is specified as a number that the font-size property is multiplied by. this means the value specified for the property should generally be the aspect ratio of the first choice font. for example, a style sheet that specifies: font-size: 14px; font-size-adjust: 0.5; ... is really specifying that the lowercase letters of the font should be 7px high (0.5 × 14px). this will still produce reasonable results in browsers that do not support font-size-adjust, where a 14px font will be used. syntax values none choose the size of the font based only on the font-size property. <number> choos...
font-stretch - CSS: Cascading Style Sheets
rd</p> </div> css /* this example uses the league mono variable font, developed by tyler finck (https://www.tylerfinck.com/) and used here under the terms of the sil open font license, version 1.1: http://scripts.sil.org/cms/scripts/page.php?item_id=ofl_web */ @font-face { src: url('https://mdn.mozillademos.org/files/16014/leaguemonovariable.ttf'); font-family:'leaguemonovariable'; font-style: normal; font-stretch: 1% 500%; /* required by chrome */ } .container { border: 10px solid #f5f9fa; padding: 0 1rem; font: 1.5rem 'leaguemonovariable', sans-serif; } .condensed { font-stretch: 50%; } .normal { font-stretch: 100%; } .expanded { font-stretch: 200%; } result specifications specification status comment css fonts module level 4the d...
font-variant-east-asian - CSS: Cascading Style Sheets
nt-values> || <east-asian-width-values> || ruby ]where <east-asian-variant-values> = [ jis78 | jis83 | jis90 | jis04 | simplified | traditional ]<east-asian-width-values> = [ full-width | proportional-width ] examples setting east asian glyph variants this example require font "yu gothic" installed in your os, other fonts may not support opentype features. ...
font-variant-ligatures - CSS: Cascading Style Sheets
common-lig-values> = [ common-ligatures | no-common-ligatures ]<discretionary-lig-values> = [ discretionary-ligatures | no-discretionary-ligatures ]<historical-lig-values> = [ historical-ligatures | no-historical-ligatures ]<contextual-alt-values> = [ contextual | no-contextual ] examples setting font ligatures and contextual forms html <link href="//fonts.googleapis.com/css?family=lora" rel="stylesheet"> <p class="normal"> normal<br> if fi ff tf ft jf fj </p> <p class="none"> none<br> if fi ff tf ft jf fj </p> <p class="common-ligatures"> common-ligatures<br> if fi ff tf ft jf fj </p> <p class="no-common-ligatures"> no-common-ligatures<br> if fi ff tf ft jf fj </p> <p class="discretionary-ligatures"> discretionary-ligatures<br> if fi ff tf ft jf fj </p> <p class="no-dis...
grid-auto-flow - CSS: Cascading Style Sheets
candidate recommendation initial definition ...
image-orientation - CSS: Cascading Style Sheets
candidate recommendation initial definition. ...
image() - CSS: Cascading Style Sheets
e, the css image() function allows adding allows only including background colors should an image fail to load, which means you can add a fall back color should a transparent png/gif/webp not load. examples directionally-sensitive images <ul> <li dir="ltr">bullet is a right facing arrow on the left</li> <li dir="rtl">bullet is the same arrow, flipped to point left.</li> </ul> ul { list-style-image: image(ltr 'https://mdn.mozillademos.org/files/16412/rightarrow.png'); } in the left-to-right list items — those with dir="ltr" set on the element itself or inheriting the directionality from an ancestor or default value for the page — the image will be used as-is. list items with dir="rtl" set on the <li> or inheriting the right-to-left directionality from an ancestor, such as documen...
initial - CSS: Cascading Style Sheets
Web › CSS › initial
full support no support no supportrequires a vendor prefix or different name for use.requires a vendor prefix or different name for use. see also use unset to set a property to its inherited value if it inherits, or to its initial value if not. use revert to reset a property to the value established by the user-agent stylesheet (or by user styles, if any exist). use inherit to make an element's property the same as its parent. the all property lets you reset all properties to their initial, inherited, reverted, or unset state at once. ...
Initial value - CSS: Cascading Style Sheets
herited properties, the initial value is used on the root element only, as long as no specified value is supplied. for non-inherited properties, the initial value is used on all elements, as long as no specified value is supplied. you can explicitly specify the initial value by using the initial keyword. note: the initial value should not be confused with the value specified by the browser's style sheet. specifications specification status comment css cascade 4 formal definition. css level 2 (revision 1)the definition of 'initial value' in that specification. recommendation implicit definition. ...
justify-content - CSS: Cascading Style Sheets
working draft adds the [ first | last ]? baseline, self-start, self-end, start, end, left, right, unsafe | safe values. css flexible box layout modulethe definiti...
<length> - CSS: Cascading Style Sheets
Web › CSS › length
px; } .input-container { position: absolute; display: flex; justify-content: flex-start; align-items: center; height: 50px; } label { margin: 0 10px 0 20px; } javascript const inputdiv = document.queryselector('.inner'); const inputelem = document.queryselector('input'); const resultsdiv = document.queryselector('.results'); inputelem.addeventlistener('change', () => { inputdiv.style.width = inputelem.value; const result = document.createelement('div'); result.classname = 'result'; result.style.width = inputelem.value; result.innerhtml = `<code>width: ${inputelem.value}</code>`; resultsdiv.appendchild(result); inputelem.value = ''; inputelem.focus(); }) result specifications specification status comment css values and units mod...
letter-spacing - CSS: Cascading Style Sheets
extra inter-character space in addition to the default space between characters. values may be negative, but there may be implementation-specific limits. user agents may not further increase or decrease the inter-character space in order to justify text. accessibility concerns a large positive or negative letter-spacing value will make the word(s) the styling is applied to unreadable. for text styled with a very large positive value, the letters will be so far apart that the word(s) will appear like a series of individual, unconnected letters. for text styled with a very large negative value, the letters will overlap each other to the point where the word(s) may be unrecognizable. legible letter-spacing must be determined on a case-by-case basis, as different font families have different ch...
mask-clip - CSS: Cascading Style Sheets
Web › CSS › mask-clip
candidate recommendation initial definition ...
mask-composite - CSS: Cascading Style Sheets
candidate recommendation initial definition ...
mask-mode - CSS: Cascading Style Sheets
Web › CSS › mask-mode
candidate recommendation initial definition ...
mask-origin - CSS: Cascading Style Sheets
candidate recommendation initial definition ...
mask-position - CSS: Cascading Style Sheets
candidate recommendation initial definition ...
mask-size - CSS: Cascading Style Sheets
Web › CSS › mask-size
candidate recommendation initial definition ...
object-position - CSS: Cascading Style Sheets
ontent html here we see html that includes two <img> elements, each displaying the mdn logo. <img id="object-position-1" src="https://udn.realityripple.com/samples/db/4f9fbd7dfb.svg" alt="mdn logo"/> <img id="object-position-2" src="https://udn.realityripple.com/samples/db/4f9fbd7dfb.svg" alt="mdn logo"/> css the css includes default styling for the <img> element itself, as well as separate styles for each of the two images. img { width: 300px; height: 250px; border: 1px solid black; background-color: silver; margin-right: 1em; object-fit: none; } #object-position-1 { object-position: 10px; } #object-position-2 { object-position: 100% 10%; } the first image is positioned with its left edge inset 10 pixels from the left edge of the element's box. the second image is po...
offset-anchor - CSS: Cascading Style Sheets
]where <length-percentage> = <length> | <percentage> examples setting various offset-anchor values in the following example, we have three <div> elements nested in <section> elements. each <div> is given the same offset-path (a horizontal line 200 pixels long) and animated to move along it. the three are then given different background-color and offset-anchor values. each <section> has been styled with a linear gradient to give it a horizontal line running through its center, to give you a visual display of where the <div>'s offset paths are running. this allows you to see what effect the different offset-anchor values have — the first one, auto, causes the <div>'s center point to move along the path. the other two cause the <div>'s top-right and bottom-left points to move along the pa...
offset-path - CSS: Cascading Style Sheets
ry as the path. <basic-shape> specifies a css shape including circle(), ellipse(), inset(), polygon(), or path(). path() a path string defined with svg coordinate syntax. none specifies no motion path at all. description this property defines a path an animated element can follow. an offset path is either a specified path with one or multiple sub-paths or the geometry of a not-styled basic shape. the element’s exact position on the offset path is determined by the offset-distance property. each shape or path must define an initial position for the computed value of 0 for offset-distance and an initial direction which specifies the rotation of the object to the initial position. early versions of the spec called this property motion-path. it was changed to offset-path beca...
outline-width - CSS: Cascading Style Sheets
one is specified, the computed value is 0animation typea length formal syntax <line-width>where <line-width> = <length> | thin | medium | thick examples setting an element's outline width html <span id="thin">thin</span> <span id="medium">medium</span> <span id="thick">thick</span> <span id="twopixels">2px</span> <span id="oneex">1ex</span> <span id="em">1.2em</span> css span { outline-style: solid; display: inline-block; margin: 20px; } #thin { outline-width: thin; } #medium { outline-width: medium; } #thick { outline-width: thick; } #twopixels { outline-width: 2px; } #oneex { outline-width: 1ex; } #em { outline-width: 1.2em; } result specifications specification status comment css basic user interface module level 3the defini...
perspective-origin - CSS: Cascading Style Sheets
o200200neg { perspective-origin: -200% -200%; } .po200200pos { perspective-origin: 200% 200%; } .po200200 { perspective-origin: 200% -200%; } /* define the container div, the cube div, and a generic face */ .container { width: 100px; height: 100px; margin: 24px; border: none; } .cube { width: 100%; height: 100%; backface-visibility: visible; perspective: 300px; transform-style: preserve-3d; } .face { display: block; position: absolute; width: 100px; height: 100px; border: none; line-height: 100px; font-family: sans-serif; font-size: 60px; color: white; text-align: center; } /* define each face based on direction */ .front { background: rgba(0, 0, 0, 0.3); transform: translatez(50px); } .back { background: rgba(0, 255, 0, 1); color: black; ...
perspective - CSS: Cascading Style Sheets
rspective: 250px; } .pers350 { perspective: 350px; } .pers500 { perspective: 500px; } .pers650 { perspective: 650px; } /* define the container div, the cube div, and a generic face */ .container { width: 200px; height: 200px; margin: 75px 0 0 75px; border: none; } .cube { width: 100%; height: 100%; backface-visibility: visible; perspective-origin: 150% 150%; transform-style: preserve-3d; } .face { display: block; position: absolute; width: 100px; height: 100px; border: none; line-height: 100px; font-family: sans-serif; font-size: 60px; color: white; text-align: center; } /* define each face based on direction */ .front { background: rgba(0, 0, 0, 0.3); transform: translatez(50px); } .back { background: rgba(0, 255, 0, 1); color: black;...
place-items - CSS: Cascading Style Sheets
t baseline auto</option> <option value="last baseline normal">last baseline normal</option> <option value="stretch auto">stretch auto</option> </select> </div> javascript var values = document.getelementbyid('values'); var display = document.getelementbyid('display'); var container = document.getelementbyid('container'); values.addeventlistener('change', function (evt) { container.style.placeitems = evt.target.value; }); display.addeventlistener('change', function (evt) { container.classname = evt.target.value; }); css #container { height:200px; width: 240px; place-items: center; /* you can change this value by selecting another option in the list */ background-color: #8c8c8c; } .flex { display: flex; flex-wrap: wrap; } .grid { display: grid; grid-templa...
Resolved value - CSS: Cascading Style Sheets
for most properties, it is the computed value, but for a few legacy properties (including width and height), it is instead the used value. see the specification link below for more per-property details. ...
shape-outside - CSS: Cascading Style Sheets
box defaults to margin-box. <image> the float area is extracted and computed based on the alpha channel of the specified <image> as defined by shape-image-threshold. note: user agents must use the potentially cors-enabled fetch method defined by the html5 specification for all urls in a shape-outside value. when fetching, user agents must use "anonymous" mode, set the referrer source to the stylesheet's url, and set the origin to the url of the containing document. if this results in network errors such that there is no valid fallback image, the effect is as if the value none had been specified. interpolation when animating between one <basic-shape> and a second, the rules below are applied. the values in the shape functions interpolate as a simple list. the list values interpolate a...
text-decoration-color - CSS: Cascading Style Sheets
candidate recommendation initial definition. the text-decoration property is now a shorthand to define multiple related properties. ...
text-decoration-line - CSS: Cascading Style Sheets
candidate recommendation initial definition. the text-decoration property is now a shorthand to define multiple related prope...
text-decoration-thickness - CSS: Cascading Style Sheets
uted valueas specifiedanimation typeby computed value type formal syntax auto | from-font | <length> | <percentage> examples varying thickness html <p class="thin">here's some text with a 1px red underline.</p> <p class="thick">this one has a 5px red underline.</p> <p class="shorthand">this uses the equivalent shorthand.</p> css .thin { text-decoration-line: underline; text-decoration-style: solid; text-decoration-color: red; text-decoration-thickness: 1px; } .thick { text-decoration-line: underline; text-decoration-style: solid; text-decoration-color: red; text-decoration-thickness: 5px; } .shorthand { text-decoration: underline solid red 5px; } results specifications specification status comment css text decoration module level 4the...
text-emphasis-color - CSS: Cascading Style Sheets
candidate recommendation initial definition ...
text-emphasis-position - CSS: Cascading Style Sheets
t either, using the text-emphasis shorthand property. formal definition initial valueover rightapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax [ over | under ] && [ right | left ] examples preferring ruby over emphasis marks some editors prefer to hide emphasis marks when they conflict with ruby. in html, this can be done with the following style rule: ruby { text-emphasis: none; } preferring emphasis marks over ruby some other editors prefer to hide ruby when they conflict with emphasis marks. in html, this can be done with the following pattern: em { text-emphasis: dot; /* set text-emphasis for <em> elements */ } em rt { display: none; /* hide ruby inside <em> elements */ } specifications specification status ...
text-overflow - CSS: Cascading Style Sheets
css value direction: ltr direction: rtl expected result live result expected result live result visible overflow 1234567890 1234567890 0987654321 1234567890 text-overflow: clip 1234567890 1234567890 text-ov...
matrix3d() - CSS: Cascading Style Sheets
ich can be hovered/focused to apply a matrix3d() transform to it. ...
perspective() - CSS: Cascading Style Sheets
class="face left">c</div> </div> <p>with perspective (4cm):</p> <div class="perspective-box-closer"> <div class="face front">a</div> <div class="face top">b</div> <div class="face left">c</div> </div> css .face { position: absolute; width: 100px; height: 100px; line-height: 100px; font-size: 100px; text-align: center; } p + div { width: 100px; height: 100px; transform-style: preserve-3d; margin-left: 100px; } .no-perspective-box { transform: rotatex(-15deg) rotatey(30deg); } .perspective-box-far { transform: perspective(9cm) rotatex(-15deg) rotatey(30deg); } .perspective-box-closer { transform: perspective(4cm) rotatex(-15deg) rotatey(30deg); } .top { background-color: skyblue; transform: rotatex(90deg) translate3d(0, 0, 50px); } .left { background...
scaleZ() - CSS: Cascading Style Sheets
factor, except when the scale factor is 1, in which case the function is the identity transform. the scaling is not isotropic, and the angles of the element are not conserved. scalez(-1) defines an axial symmetry, with the z-axis passing through the origin (as specified by the transform-origin property). in the above interactive examples, perspective: 550px; (to create a 3d space) and transform-style: preserve-3d; (so the children, the 6 sides of the cube, are also positioned in the 3d space), have been set on the cube. note: scalez(sz) is equivalent to to scale3d(1, 1, sz). syntax scalez(s) values s is a <number> representing the scaling factor to apply on the z-coordinate of each point of the element. cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 ...
translateZ() - CSS: Cascading Style Sheets
mple is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. this transformation is defined by a <length> which specifies how far inward or outward the element or elements move. in the above interactive examples, perspective: 550px; (to create a 3d space) and transform-style: preserve-3d; (so the children, the 6 sides of the cube, are also positioned in the 3d space), have been set on the cube. note: translatez(tz) is equivalent to translate3d(0, 0, tz). syntax translatez(tz) values tz a <length> representing the z-component of the translating vector. a positive value moves the element towards the viewer, and a negative value farther away. carte...
visibility - CSS: Cascading Style Sheets
culated as though the cells in the collapsed row(s) or column(s) are present. this value allows for the fast removal of a row or column from a table without forcing the recalculation of widths and heights for the entire table. collapsed flex items are hidden, and the space they would have occupied is removed. for xul elements, the computed size of the element is always zero, regardless of other styles that would normally affect the size, although margins still take effect. for other elements, collapse is treated the same as hidden. accessibility concerns using a visibility value of hidden on an element will remove it from the accessibility tree. this will cause the element and all its descendant elements to no longer be announced by screen reading technology. interpolation visibility va...
white-space - CSS: Cascading Style Sheets
ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occae...
word-spacing - CSS: Cascading Style Sheets
spacing as a percentage of the affected character’s advance width. examples html <div id="mozdiv1">here are many words...</div> <div id="mozdiv2">...and many more!</div> css #mozdiv1 { word-spacing: 15px; } #mozdiv2 { word-spacing: 5em; } accessibility concerns a large positive or negative word-spacing value will make the sentences the styling is applied to unreadable. for text styled with a very large positive value, the words will be so far apart that it will no longer appear to be a sentence. for text styled with a large negative value, the words will overlap each other to the point where the the beginning and end of each word is unrecognizable. legible word-spacing must be determined on a case-by-case basis, as different font families have different character widths. the...
<xsl:apply-imports> - XSLT: Extensible Stylesheet Language Transformations
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:apply-imports> element is fairly arcane, used mostly in complex stylesheets. import precedence requires that template rules in main stylesheets have higher precedence than template rules in imported stylesheets. sometimes, however, it is useful to be able to force the processor to use a template rule from the (lower precedence) imported stylesheet rather than an equivalent rule in the main stylesheet. syntax <xsl:apply-imports/> required attributes none. optional attributes none. type instruction, appears within a template. defined xslt, section 5.6. gecko support supported. ...
<xsl:attribute-set> - XSLT: Extensible Stylesheet Language Transformations
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:attribute-set> element creates a named set of attributes, which can then be applied as whole to the output document, in a manner similar to named styles in css. syntax <xsl:attribute-set name=name use-attribute-sets=list-of-names> <xsl:attribute> </xsl:attribute-set> required attributes name specifies the name of the attribute set. the name must be a valid qname. optional attributes use-attribute-sets builds an attribute set from other attribute sets. the names of the contributing sets must be separated with whitespace characters and must not directly or indirectly embed themselves. type top-level, must be the child of <xsl:stylesheet> or <xsl:transform>. defined xslt, se...
<xsl:attribute> - XSLT: Extensible Stylesheet Language Transformations
the element must be defined before any other output document element inside the output document element for which it establishes attribute values. but it may be after or inside elements that won't be part of the output (like <xsl:choose> or <xsl:apply-templates> etc.). ...
<xsl:decimal-format> - XSLT: Extensible Stylesheet Language Transformations
aracter. the default is (‰). zero-digit specifies the digit zero character. the default is (0). digit specifies the character used in the format pattern to stand for a digit. the default is (#). pattern-separator specifies the character separating positive and negative subpatterns in a format pattern. the default is the semi-colon (;). type top-level, must be the child of <xsl:stylesheet> or <xsl:transform>. defined xslt, section 12.3. gecko support supported as of 1.0 (mozilla 1.0, netscape 7.0). ...
<xsl:import> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › import
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:import> element is a top-level element that serves to import the contents of one stylesheet into another stylesheet. generally speaking, the contents of the imported stylesheet have a lower import precedence than that of the importing stylesheet. this is in contrast to <xsl:include> where the contents of the included stylesheet have exactly the same precedence as the contents of the including stylesheet. syntax <xsl:import href=uri /> required attributes href specifies the uri of the stylesheet to import. optional attributes none. type top-level, must appear before any other child of <xsl:stylesheet> or <xsl:transform> in the importing stylesheet. defined xslt, section 2.6.
<xsl:include> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › include
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:include> element merges the contents of one stylesheet with another. unlike the case of <xsl:import>, the contents of an included stylesheet have exactly the same precedence as the contents of the including stylesheet. syntax <xsl:include href=uri /> required attributes href specifies the uri of the stylesheet to include. optional attributes none. type top-level, may appear in any order as a child of <xsl:stylesheet> or <xsl:transform>. defined xslt, section 2.6.1. gecko support supported. ...
<xsl:key> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › key
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:key> element declares a named key which can be used elsewhere in the stylesheet with the key( ) function. syntax <xsl:key name=name match=expression use=expression /> required attributes name specifies a name for this key. must be a qname. match defines the nodes for which this key is applicable. use specifies an xpath expression that will be used to determine the value of the key for each of the applicable nodes. optional attributes none. type top-level, must be the child of <xsl:stylesheet> or <xsl:transform>. defined xslt, section 12.2. gecko support supported. ...
<xsl:message> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › message
it can be useful for debugging. syntax <xsl:message terminate="yes" | "no" > template </xsl:message> required attributes none. optional attributes terminate set to "yes", indicates that execution should be terminated. ...
<xsl:output> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › output
laration in the output document. cdata-section-elements lists elements whose text contents should be written as cdata sections. elements should be whitespace separated. indent (not supported.) specifies if the output should be indented to indicate its hierarchic structure. media-type (not supported.) specifies the output document mime type. type top-level, must be the child <xsl:stylesheet> or <xsl:transform>. defined xslt, section 16. gecko support partial support. see comments above. ...
<xsl:preserve-space> - XSLT: Extensible Stylesheet Language Transformations
he names with a whitespace character. preserving whitespace is the default setting, so this element only needs to be used to counteract an <xsl:strip-space> element. syntax <xsl:preserve-space elements=list-of-element-names /> required attributes elements specifies the elements for which whitespace should be preserved. optional attributes none. type top-level, must be a child of <xsl:stylesheet> or <xsl:transform>. defined xslt, section 3.4 gecko support supported. ...
<xsl:strip-space> - XSLT: Extensible Stylesheet Language Transformations
defined xslt, section 3.4 gecko support supported. ...
<xsl:template> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › template
ode for this template, which can be matched by an attribute of the <xsl:apply-templates> element. this is useful for processing the same information in multiple ways. priority specifies a numeric priority for this template. this can be any number other than infinity. the processor uses this number when more than one template matches the same node. type top-level, must be the child of <xsl:stylesheet> or <xsl:transform>. defined xslt, section 5.3. gecko support supported. ...
<xsl:transform> - XSLT: Extensible Stylesheet Language Transformations
gecko support supported. ...
<xsl:variable> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › variable
because xslt permits no side-effects, once the value of the variable has been established, it remains the same until the variable goes out of scope syntax <xsl:variable name=name select=expression > template </xsl:variable> required attributes name gives the variable a name. optional attributes select defines the value of the variable through an xpath expression. if the element contains a template, this attribute is ignored. ...
Resources - XSLT: Extensible Stylesheet Language Transformations
...
The Netscape XSLT/XPath Reference - XSLT: Extensible Stylesheet Language Transformations
f (supported) xsl:import (mostly supported) xsl:include (supported) xsl:key (supported) xsl:message (supported) xsl:namespace-alias (not supported) xsl:number (partially supported) xsl:otherwise (supported) xsl:output (partially supported) xsl:param (supported) xsl:preserve-space (supported) xsl:processing-instruction xsl:sort (supported) xsl:strip-space (supported) xsl:stylesheet (partially supported) xsl:template (supported) xsl:text (partially supported) xsl:transform (supported) xsl:value-of (partially supported) xsl:variable (supported) xsl:when (supported) xsl:with-param (supported) axes ancestor ancestor-or-self attribute child descendant descendant-or-self following following-sibling namespace (not supported) parent preceding pr...
Setting Parameters - XSLT: Extensible Stylesheet Language Transformations
setting parameters while running transformations using precoded .xsl and .xml files is quite useful, configuring the .xsl file from javascript may be even more useful. for example, javascript and xslt could be used to sort xml data and then display it. the sorting would have to alternate between ascending and descending sorting. xslt provides the xsl:param element, which is a child of the xsl:stylesheet element. xsltprocessor provides three javascript methods to interact with these parameters: xsltprocessor.setparameter(), xsltprocessor.getparameter() and xsltprocessor.removeparameter(). they all take as the first argument the namespace uri of the xsl:param (usually the param will fall in the default namespace, so passing in null will suffice.) the local name of the xsl:param is the second ...
Index - Web APIs
Web › API › Index
is a static, read-only property of the css interface that provides access to the paintworklet, which programmatically generates an image where a css property expects a file. 390 css.supports() api, css, cssom, method, reference, supports the css.supports() method returns a boolean value indicating if the browser supports a given css feature, or not. 391 css counter styles css, css counter styles, overview the css counter styles module allows to define custom counter styles, which can be used for css list-marker and generated-content counters. 392 css font loading api api, cssfontloading, experimental, fonts, needscontent, reference the css font loading api provides events and interfaces for dynamically loading font resources. ...
..., needscontent, reference the css font loading api provides events and interfaces for dynamically loading font resources. 393 css object model (cssom) api, cssom, overview, reference the css object model is a set of apis allowing the manipulation of css from javascript. it is much like the dom, but for the css rather than the html. it allows users to read and modify css style dynamically. 394 determining the dimensions of elements api, cssom view, client width, guide, intermediate, client height, offsetheight, offsetwidth, size of displayed content there are several properties you can look at in order to determine the width and height of elements, and it can be tricky to determine which is the right one for your needs. this article is designed to ...
...he ability to control the screen orientation in order to preserve or adapt the interface of a web application. 396 using dynamic styling information api, beginner, cssom, guide, needsbeginnerupdate the css object model (cssom), part of the dom, exposes specific interfaces allowing manipulation of a wide amount of information regarding css. initially defined in the dom level 2 style recommendation, these interfaces forms now a specification, css object model (cssom) which aims at superseding it. 397 css painting api api, css, css paint api, houdini, painting, reference the css painting api — part of the css houdini umbrella of apis — allows developers to write javascript functions that can draw directly into an element's background, border, or conten...
...And 100 more matches
Index - Archive of obsolete content
the page's context menu. 45 hotkeys add-on sdk assign hotkey combinations to functions in your add-on. 46 indexed-db add-on sdk exposes the indexeddb api to add-ons. 47 l10n add-on sdk localize strings appearing in the add-on's javascript code. 48 notifications add-on sdk, notifications display transient, toaster-style desktop messages to the user. 49 page-mod add-on sdk run scripts in the context of web pages whose url matches a given pattern. 50 page-worker add-on sdk create a permanent, invisible page and access its dom. 51 panel add-on sdk, add-ons, extensions creates transient dialogs to implement part of an add-on's user interface. 52 ...
...ferences system in firefox. 102 remote/child module, reference, sdk enables an sdk module loaded into a child process to access web content in the child process and communicate with modules in the main process. 103 remote/parent reference, sdk enables you to load modules, and privileged parts of your add-on in general, into child processes. 104 stylesheet/style modify styles using stylesheet files or css rules. 105 stylesheet/utils helper functions for working with stylesheets. 106 system/child_process an implementation of the node.js child_process api. 107 system/environment access, set and clear environment variables. 108 system/events api for...
...pets, extensions no summary! 172 alerts and notifications code snippets non-modal notification and further interaction with users 173 autocomplete code snippets, form fill, satchel no summary! 174 bookmarks code snippets, developing mozilla, extensions, places no summary! 175 boxes code snippets make the box style="display: block" and the wrapping behavior will occur when the box is resized: 176 canvas code snippets canvas, code snippets, graphics no summary! 177 cookies add-ons, code snippets, cookies, extensions no summary! 178 customizing the download progress bar no summary! 179 delayed execution code snippets no summa...
...And 42 more matches
Using the CSS Typed Object Model - Web APIs
the css typed object model api exposes css values as typed javascript objects to allow their performant manipulation. converting css object model value strings into meaningfully-typed javascript representations and back (via htmlelement.style) can incur a significant performance overhead. the css typed om makes css manipulation more logical and performant by providing object features (rather than cssom string manipulation), providing access to types, methods, and an object model for css values. this article provides an introduction to all of its main features. computedstylemap() with the css typed om api, we can access all the css properties and values — including custom properties — that are impacting an element. let's see how this works by creating our first example, which e...
...g manipulation), providing access to types, methods, and an object model for css values. this article provides an introduction to all of its main features. computedstylemap() with the css typed om api, we can access all the css properties and values — including custom properties — that are impacting an element. let's see how this works by creating our first example, which explores computedstylemap(). we start with some html: a paragraph with a link, as well as a definition list to which we will add all the css property / value pairs. <p> <a href="https://example.com">link</a> </p> <dl id="regurgitation"></dl> we add javascript to grab our unstyled link and return back a definition list of all the default css property values impacting the link using computedstylemap(). // get the ...
... will add all the css property / value pairs. <p> <a href="https://example.com">link</a> </p> <dl id="regurgitation"></dl> we add javascript to grab our unstyled link and return back a definition list of all the default css property values impacting the link using computedstylemap(). ...
...And 40 more matches
Skinning XUL Files by Hand - Archive of obsolete content
in the very near future, it will be possible to skin xul files dynamically and completely -- by pressing a button, selecting a skin from a menu, or by accepting a skin from over the web. when this day comes, skins defined in a global skin file will be applied to a whole application -- like the mozilla browser -- so that all the various windows and parts will look consistent. in the meantime, however, skinning a file requires some manual interaction. ...
.... it presumes you have at least basic understanding of xul and the application object model that xul describes. following the instructions here, you are going to create a skin for a xul file and apply it by specifying classes for all of the interested elements. the skin will reside in a single css file, appropriately named drxul.css. ...
...the chrome is everything in the front end of an application. much of what makes xul look (and act!) the way it does comes from the css for each xul element. ...
...And 35 more matches
Performance best practices for Firefox front-end engineers
e screen. knowing the path they will take through the various layers of the browser engine will help you optimize your code to avoid pitfalls. the rendering process goes through the following steps: the above image is used under creative commons attribution 3.0, courtesy of this page from our friends at google, which itself is well worth the read. for a very down-to-earth explanation of the style, layout, paint and composite steps of the pipeline, this hacks blog post does a great job of explaining it. to achieve a 60 fps frame rate, all of the above has to happen in 16 milliseconds or less, every frame. note that requestanimationframe() lets you queue up javascript to run right before the style flush occurs. this allows you to put all of your dom writes (most importantly, anything tha...
...does a great job of explaining it. to achieve a 60 fps frame rate, all of the above has to happen in 16 milliseconds or less, every frame. note that requestanimationframe() lets you queue up javascript to run right before the style flush occurs. this allows you to put all of your dom writes (most importantly, anything that could change the size or position of things in the dom) just before the style and layout steps of the pipeline, combining all the style and layout calculations into a single batch so it all happens once, in a single frame tick, instead of across multiple frames. see detecting and avoiding synchronous reflow below for more information. this also means that requestanimationframe() is not a good place to put queries for layout or style information. detecting and avoiding sy...
...this happens the first time the page loads and the css is initially applied, but can happen again if javascript modifies the dom. ...
...And 28 more matches
Theme changes in Firefox 2 - Archive of obsolete content
ng warning window as a close box for the window. browser/safebrowsing/dim.png new file; this is a graphic overlaid on top of the contents of the window to "dim" it when the safe browsing warning window is displayed. it should use translucency to allow the window contents to be visible through it. browser/safebrowsing/tail.png new file; this is the "tail" of the talk-bubble style window used to indicate that a site may be fraudulent. browser/safebrowsing/warning16x16.png new file; this is the 16x16 pixel version of the warning icon displayed in the url bar when the safe browsing warning window is displayed. browser/safebrowsing/warning24x24.png new file; this is the warning icon that's displayed inside the safe browsing warning window. bro...
...le; css used in the application's about box. global/alltabs-box-bkgnd.png new file; the background for the "all tabs" drop-down menu at the right side of the tab bar. global/alltabs-box-overflow-bkgnd.png new file; the background for the "all tabs" drop-down menu when there are enough tabs to activate tab bar scrolling. global/browser.css revised to support new styles for the main browser window. global/globalbindings.xml updated to support changes to the tab bar, including per-tab close buttons. global/icons/alltabs.png not actually used; left over from earlier drafts of the theme. global/inactivetab-left.png removed file. global/inactivetab-right.png removed file. global/menu.css updated to include...
... the main browser window. global/globalbindings.xml updated to support changes to the tab bar, including per-tab close buttons. global/icons/alltabs.png not actually used; left over from earlier drafts of the theme. global/inactivetab-left.png removed file. global/inactivetab-right.png removed file. global/menu.css updated to include new styles. global/notification.css new file; defines styles used by the notification strip that appears at the top of browser windows to present notices such as "a popup was blocked." global/scrollbox/autorepeat-arrow-dn-dis.gif new file; icon displayed for a disabled autorepeat down arrow in a scroll box. global/scrollbox/autorepeat-arrow-dn.gif new file; icon displaye...
...And 27 more matches
<link>: The External Resource Link element - HTML: Hypertext Markup Language
Web › HTML › Element › link
the html external resource link element (<link>) specifies relationships between the current document and an external resource. this element is most commonly used to link to stylesheets, but is also used to establish site icons (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ets, but is also used to establish site icons (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. to link an external stylesheet, you'd include a <link> element inside your <head> like this: <link href="main.css" rel="stylesheet"> this simple example provides the path to the stylesheet inside an href attribute, and a rel attribute with a value of stylesheet. the rel stands for "relationship", and is probably one of the key features of the <link> element — the value denotes how the item being linked to is related t...
...e/png"> the sizes attribute indicates the icon size, while the type contains the mime type of the resource being linked. these provide useful hints to allow the browser to choose the most appropriate icon available. you can also provide a media type or query inside a media attribute; this resource will then only be loaded if the media condition is true. for example: <link href="print.css" rel="stylesheet" media="print"> <link href="mobile.css" rel="stylesheet" media="screen and (max-width: 600px)"> some interesting new performance and security features have been added to the <link> element too. take this example: <link rel="preload" href="myfont.woff2" as="font" type="font/woff2" crossorigin="anonymous"> a rel value of preload indicates that the browser should preload this resource ...
...And 26 more matches
How CSS is structured - Learn web development
structure of css. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works. objective: to learn css's fundamental syntax structures in detail. ...
...prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works. objective: to learn css's fundamental syntax structures in detail. applying css to html first, let's examine three methods of applying css to a document: with an external stylesheet, with an internal stylesheet, and with inline styles. external stylesheet an external stylesheet contains css in a separate file with a .css extension. this is the most common and useful method of bringing css to a document. you can link a single css file to multiple web pages, styling all of them with the same css stylesheet. in the getting started with css, we linked an external stylesheet to our web page. you refe...
... styles. external stylesheet an external stylesheet contains css in a separate file with a .css extension. this is the most common and useful method of bringing css to a document. you can link a single css file to multiple web pages, styling all of them with the same css stylesheet. in the getting started with css, we linked an external stylesheet to our web page. ...
...And 25 more matches
Examples - Archive of obsolete content
rticle to learn more about these examples. if you wish to test these examples by yourself, please read the important notes. important notes if you plan to test these examples by yourself, you must use the right filename extension (it is written at the beginning of the code). ideally, upload the file to a web server and you're done. please note that the examples 4, 5 and 6 require a file named style.css to exist in the same directory as the example. you can get the contents of style.css at the bottom of this page. examples for "problems with inline style and script" problem 1 <!-- this file should have a .xhtml extension and will generate an error when parsed. --> <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html ...
...article problem 2 <!-- this file should have a .xhtml extension --> <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-us" xml:lang="en-us"> <head> <title>problem 2 - comments in xhtml</title> <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" /> <style type="text/css"> <!-- body {background-color: blue; color: yellow; } --> </style> <script type="text/javascript"> <!-- var i = 0; var sum = 0; for (i = 0; i < 10; ++i) { sum += i; } alert('sum = ' + sum); // --> </script> </head> <body> <h1>problem 2 - comments in xhtml</h1> <p> this document is valid xhtml 1.0 strict served as <code>applicat...
...ipt type="text/javascript"> <!-- var i = 0; var sum = 0; for (i = 0; i < 10; ++i) { sum += i; } alert('sum = ' + sum); // --> </script> </head> <body> <h1>problem 2 - comments in xhtml</h1> <p> this document is valid xhtml 1.0 strict served as <code>application/xhtml+xml</code>. </p> <p> this document contains inline css rules contained in a <code>style</code> element and surrounded by a comment and javascript contained in a <code>script</code> element and surrounded by a comment. </p> <dl> <dt>mozilla 1.1+/opera 7</dt> <dd>do not apply css or execute the javascript.</dd> <dt>netscape 7.0x/mozilla 1.0.x</dt> <dd>do not apply css but does execute the javascript.</dd> <dt>internet explorer 5.5+</dt> <dd>can not display the doc...
...And 20 more matches
Examples of web and XML development using the DOM - Web APIs
telementbyid("image1"); arrimages[1] = document.getelementbyid("image2"); arrimages[2] = document.getelementbyid("image3"); var objoutput = document.getelementbyid("output"); var strhtml = "<ul>"; for (var i = 0; i < arrimages.length; i++) { strhtml += "<li>image" + (i+1) + ": height=" + arrimages[i].height + ", width=" + arrimages[i].width + ", style.height=" + arrimages[i].style.height + ", style.width=" + arrimages[i].style.width + "<\/li>"; } strhtml += "<\/ul>"; objoutput.innerhtml = strhtml; } </script> </head> <body onload="init();"> <p>image 1: no height, width, or style <img id="image1" src="https://udn.realityripple.com/samples/d2/8ba7141ed1.gif"> </p> <p>image 2: height="50", width="500", but no s...
...rhtml = strhtml; } </script> </head> <body onload="init();"> <p>image 1: no height, width, or style <img id="image1" src="https://udn.realityripple.com/samples/d2/8ba7141ed1.gif"> </p> <p>image 2: height="50", width="500", but no style <img id="image2" src="https://udn.realityripple.com/samples/d2/8ba7141ed1.gif" height="50" width="500"> </p> <p>image 3: no height, width, but style="height: 50px; width: 500px;" <img id="image3" src="https://udn.realityripple.com/samples/d2/8ba7141ed1.gif" style="height: 50px; width: 500px;"> </p> <div id="output"> </div> </body> </html> example 2: image attributes <!doctype html> <html lang="en"> <head> <title>modifying an image border</title> <script> function setborderwidth(width) { document.getelementbyid("img1").s...
....gif" style="height: 50px; width: 500px;"> </p> <div id="output"> </div> </body> </html> example 2: image attributes <!doctype html> <html lang="en"> <head> <title>modifying an image border</title> <script> function setborderwidth(width) { document.getelementbyid("img1").style.borderwidth = width + "px"; } </script> </head> <body> <p> <img id="img1" src="image1.gif" style="border: 5px solid green;" width="100" height="100" alt="border test"> </p> <form name="formname"> <input type="button" value="make border 20px-wide" onclick="setborderwidth(20);" /> <input type="button" value="make border 5px-wide" onclick="setborderwidth(5);" /> </form> </body> </html> example 3: manipulating styles in this simple example, some basic style properties of an html...
...And 20 more matches
Styling links - Learn web development
previous overview: styling text next when styling links, it is important to understand how to make use of pseudo-classes to style link states effectively, and how to style links for use in common varied interface features such as navigation menus and tabs. we'll look at all these topics in this article. prerequisites: basic computer literacy, html basics (study introduction to html), css basics (study introduction to css), css text and font fundamentals. objective: to learn how to style link states, and how to use links effectively in common ui features like navigation menus. let's look at some links we looked at how links are implemented in your html according to best practices in creating hyperlinks. in this article we'll build on this knowledge, sho...
...n ui features like navigation menus. let's look at some links we looked at how links are implemented in your html according to best practices in creating hyperlinks. in this article we'll build on this knowledge, showing you best practices for styling links. ...
... hyperlinks. in this article we'll build on this knowledge, showing you best practices for styling links. link states the first thing to understand is the concept of link states — different states that links can exist in, which can be styled using different pseudo-classes: link (unvisited): the default state that a link resides in, when it isn't in any other state. this can be specifically styled using the :link pseudo class. visited: a link when it has already been visited (exists in the browser's history), styled using the :visited pseudo class. hover: a link when it is being hovered over by a user's mouse pointer, styled using the :hover pseudo class. focus: a link when it has been focused (for example moved to by a keyboard user using the tab key or similar, or programmatically fo...
...And 19 more matches
Organizing your CSS - Learn web development
previous overview: building blocks as you start to work on larger stylesheets and big projects you will discover that maintaining a huge css file can be challenging. in this article we will take a brief look at some best practices for writing your css to make it easily maintainable, and some of the solutions you will find in use by others to help improve maintainability. ...
...asily maintainable, and some of the solutions you will find in use by others to help improve maintainability. ...
...html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn some tips and best practices for organizing stylesheets, and find out about some of the naming conventions and tools in common usage to help with css organization and team working. tips to keep your css tidy here are some general suggestions for ways to keep your stylesheets organised and tidy. does your project have a coding style guide? if you are working with a team on an existing project, the first thing to check is whether the project has an existing style guide for css. the team style guide should always win over your own personal preferences. there often isn't a right or wrong way to do things, but consistency is important. keep it consistent if you ...
...And 18 more matches
Styling lists - Learn web development
and font fundamentals. objective: to become familiar with the best practices and properties related to styling lists. a simple list example to begin with, let's look at a simple list example. throughout this article, we'll look at unordered, ordered, and description lists — all have styling features that are similar, and some that are particular to their type of list. ...
... the list items (<li> elements) have no set defaults for spacing. the <dl> element has a top and bottom margin of 16px (1em), but no padding set. the <dd> elements have margin-left of 40px (2.5em.) the <p> elements we've included for reference have a top and bottom margin of 16px (1em), the same as the different list types. ...
...nts we've included for reference have a top and bottom margin of 16px (1em), the same as the different list types. ...
...And 18 more matches
Index - Archive of obsolete content
Archive › Mozilla › XUL › Index
to hide the resizer grippy on maximized windows). 338 sizetopopup xul attributes, xul reference no summary! 339 smoothscroll xul attributes, xul reference no summary! 340 sort xul attributes, xul reference no summary! 341 sortactive xul attributes, xul reference no summary! 342 sortdirection ...
... xul attributes, xul reference no summary! 348 statedatasource xul attributes, xul reference no summary! 349 statusbar xul attributes, xul reference no summary! 350 statustext deprecated, xul attributes, xul reference no summary! 351 stringbundle.src xul attributes, xul reference no summary! 352 style xul attributes, xul reference no summary! 353 subject xul attributes, xul reference no summary! 354 substate xul attributes, xul reference no summary! 355 suppressonselect xul attributes, xul reference no summary! 356 tab.selected xul, xul attributes, xul reference no summary! 357 tabindex ...
...editems xul properties, xul reference no summary! 826 selectedpanel xul properties, xul reference no summary! 827 selectedtab xul properties, xul reference no summary! 828 selectionend xul properties, xul reference no summary! 829 selectionstart xul properties, xul reference no summary! 830 selstyle xul properties, xul reference no summary! 831 sessioncount xul properties, xul reference no summary! 832 sessionhistory xul properties, xul reference no summary! 833 showcommentcolumn xul properties, xul reference no summary! 834 showimagecolumn xul, xul properties, xul reference, popup no summary! ...
...And 17 more matches
Common Firefox theme issues and solutions - Archive of obsolete content
n/: keyhole-circle.png toolbar.png toolbarbutton-dropmarker.png tabbrowser/alltabs-box-bkgnd-icon.png tabview/tabview.png places/toolbar.png linux linux select box fields are showing both drop arrow and spinner arrows on linux: the styling of drop down select box fields may show both a drop arrow and up/down spinner arrows. the problem is commonly caused by a -moz-appearance:menulist style rule in chrome://global/skin/menulist.css. once the offending rule is found, it should be deleted and manual styling used. app button not styled on linux, but is styled on windows on linux the firefox app button that is displayed when tabs are on top and menu bar is disabled is not styled properly compared to windows and is not changing colors when in private browsing mode. the cause of this is...
...tyling used. app button not styled on linux, but is styled on windows on linux the firefox app button that is displayed when tabs are on top and menu bar is disabled is not styled properly compared to windows and is not changing colors when in private browsing mode. the cause of this issue is that linux firefox uses a different id for the firefox button from windows. the fix is to make sure any style rule that references #appmenu-button also has a comparable reference to #appmenu-toolbar-button in chrome://browser/skin/browser.css. if your firefox button relies on some button styling from toolbarbuttons.css you'll need to add comparable style rules for #appmenu-toolbar-button in browser.css. toolbars and menus firefox application button application button doesn't change styling for private...
...ge styling for private browsing mode when in private browsing mode there needs to be a visual difference to the firefox app button that is displayed when tabs are on top and the menu bar is disabled. text only toolbar buttons not aligned properly when text only toolbar buttons are selected in customize toolbars, text labels in toolbar buttons may not align properly. the common cause of this is style rules that reference [iconsize="small"] without excluding [mode="text"]. the solution usually is to append :not ([mode="text"]) to those style rules. for instance use toolbar[iconsize="small"]:not ([mode="text"]). a little experimenting may be required to fully address this issue with your theme. address bar identity box is missing padlock icons for secure sites in firefox 14 and later the ide...
...And 17 more matches
Drawing graphics - Learn web development
now, you'll see nothing, which is fine, but you'll also see scrollbars — this is a problem for us, which happens because the <body> element has a margin that, added to our full-window-size canvas, results in a document that's wider than the window. to get rid of the scrollbars, we need to remove the margin and also set overflow to hidden. add the following into the <head> of your document: <style> body { margin: 0; overflow: hidden; } </style> the scrollbars should now be gone. note: you should generally set the size of the image using html attributes or dom properties, as explained above. you could use css, but the trouble then is that the sizing is done after the canvas has rendered, and just like any other image (the rendered canvas is just an image), the image coul...
... it — our canvas is now primed and ready for drawing on! the ctx variable now contains a canvasrenderingcontext2d object, and all drawing operations on the canvas will involve manipulating this object. let's do one last thing before we move on. we'll color the canvas background black to give you a first taste of the canvas api. ...
... object, and all drawing operations on the canvas will involve manipulating this object. let's do one last thing before we move on. we'll color the canvas background black to give you a first taste of the canvas api. ...
...And 17 more matches
Using custom elements - Web Components
correct prototype chain is established. inside the constructor, we define all the functionality the element will have when an instance of it is instantiated. in this case we attach a shadow root to the custom element, use some dom manipulation to create the element's internal shadow dom structure — which is then attached to the shadow root — and finally attach some css to the shadow root to style it. // create a shadow root this.attachshadow({mode: 'open'}); // sets and returns 'this.shadowroot' // create (nested) span elements const wrapper = document.createelement('span'); wrapper.setattribute('class','wrapper'); const icon = wrapper.appendchild(document.createelement('span')); icon.setattribute('class','icon'); icon.setattribute('tabindex', 0); // insert icon from defined attribute o...
...g = icon.appendchild(document.createelement('img')); img.src = this.hasattribute('img') ? ...
...eateelement('img')); img.src = this.hasattribute('img') ? ...
...And 17 more matches
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
erited many quirks. in this article, i will describe mozilla's quirks mode, which provides strong backwards html compatibility with internet explorer and other legacy browsers. i'll also cover nonstandard technologies, such as xmlhttprequest and rich text editing, that mozilla does support because no w3c equivalent existed at the time. ...
...a does support because no w3c equivalent existed at the time. ...
...ebugging features as breakpoint management, call stack inspection, and variable/object inspection. all features are accessible through the user interface or through the debugger's interactive console. with the console, you can execute arbitrary javascript in the same scope as the javascript currently being debugged. css differences mozilla-based products have the strongest support for cascading style sheets (css), including most of css1, css2.1 and parts of css3, compared to internet explorer as well as all other browsers. for most issues mentioned below, mozilla will add an error or warning entry into the javascript console. check the javascript console if you encounter css-related issues. mimetypes (when css files are not applied) the most common css-related issue is that css definitions...
...And 16 more matches
Styling Vue components with CSS - Learn web development
(like single file components or render functions), you'll need a terminal with node + npm installed. objective: to learn about styling vue components. styling vue components with css before we move on to add more advanced features to our app, we should add some basic css to make it look better. vue has three common approaches to styling apps: external css files. global styles in single file components (.vue files). component-scoped styles in single file components. to help familiarize you with each one, we'll use a combination of all three to give our app a nicer look and feel. styling with external css files you can include external css files and apply them globally to your app. let's look at how this is done. to start with, create a file called reset.css in t...
...rial will not be using such tools, it's good to know that when including such code in the assets folder it will be processed automatically. ...
...sx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; } @media screen and (min-width: 620px) { body { font-size: 1.9rem; line-height: 1.31579; } } /*end resets*/ next, in your src/main.js file, import the reset.css file like so: import './assets/reset.css'; this will cause the file to get picked up during the build step and automatically added to our site. ...
...And 16 more matches
Basic animations - Web APIs
ter it's running on. basic animation steps these are the steps you need to take to draw a frame: clear the canvas unless the shapes you'll be drawing fill the complete canvas (for instance a backdrop image), you need to clear any shapes that have been drawn previously. the easiest way to do this is using the clearrect() method. save the canvas state if you're changing any setting (such as styles, transformations, etc.) which affect the canvas state and you want to make sure the original state is used each time a frame is drawn, you need to save that original state. draw animated shapes the step where you do the actual frame rendering. restore the canvas state if you've saved the state, restore it before drawing a new frame. controlling an animation shapes are drawn to the canvas ...
...canvas_sun.png'; moon.src = 'https://mdn.mozillademos.org/files/1443/canvas_moon.png'; earth.src = 'https://mdn.mozillademos.org/files/1429/canvas_earth.png'; window.requestanimationframe(draw); } function draw() { var ctx = document.getelementbyid('canvas').getcontext('2d'); ctx.globalcompositeoperation = 'destination-over'; ctx.clearrect(0, 0, 300, 300); // clear canvas ctx.fillstyle = 'rgba(0, 0, 0, 0.4)'; ctx.strokestyle = 'rgba(0, 153, 255, 0.4)'; ctx.save(); ctx.translate(150, 150); // earth var time = new date(); ctx.rotate(((2 * math.pi) / 60) * time.getseconds() + ((2 * math.pi) / 60000) * time.getmilliseconds()); ctx.translate(105, 0); ctx.fillrect(0, -12, 40, 24); // shadow ctx.drawimage(earth, -12, -12); // moon ctx.save(); ctx.rotate(((2 *...
... id="canvas" width="300" height="300"></canvas> screenshotlive sample an animated clock this example draws an animated clock, showing your current time. ...
...And 16 more matches
Styling web forms - Learn web development
this has historically been difficult — form controls vary greatly in how easy they are to customize with css — but it is getting easier as old browsers are retired and modern browsers give us more features to use. prerequisites: basic computer literacy, and a basic understanding of html and css. ...
... basic styling techniques that will be useful to you. why is styling form widgets challenging? form controls were added to html in the html 2 specification in 1995; css wasn't released until late 1996, and wasn't supported very well by browsers for a few years after that. browsers relied on the underlying operating system to manage and render form controls. and even with css available to style html, browser vendors have historically been reluctant to make form controls stylable because users were so accustomed to the visual appearance of their respective platforms. but this has changed. website owners want form styles that fit in with their overall site design more than ever, and the web platform has changed to make this more possible. for some form widgets, it is still difficult to r...
...orm controls stylable because users were so accustomed to the visual appearance of their respective platforms. but this has changed. website owners want form styles that fit in with their overall site design more than ever, and the web platform has changed to make this more possible. for some form widgets, it is still difficult to rebuild controls to make them stylable, but we can now use css to style many form features, though we do need to take extra care to ensure we don't break usability. not all widgets are created equal when css is involved at present, some difficulties remain when using css with forms. these problems can be divided into three categories: the good some elements can be styled with few if any problems across platforms. these include the following elements: <form> <...
...And 15 more matches
Index - Learn web development
onal website, so if you're new to web development, we encourage you to start small. you won't build another facebook right away, but it's not hard to get your own simple website online, so we'll start there. 37 css basics beginner, css, codingscripting, learn, styling, web, l10n:priority like html, css is not a programming language. it's not a markup language either. css is a style sheet language. css is what you use to selectively style html elements. for example, this css selects paragraph text, setting the color to red: 38 dealing with files beginner, codingscripting, files, guide, html, l10n:priority, theory, website when you are working on a website locally on your computer, you should keep all the related files in a single folder that mirrors the ...
... 100 test your skills: loops beginner, javascript, learn, loops this aim of this skill test is to assess whether you've understood our looping code article. 101 solve common problems in your javascript code beginner, javascript, learn the following links point to solutions to common problems you may encounter when writing javascript. 102 learn to style html using css beginner, css, codingscripting, debugging, landing, style, topic, length, specificity cascading stylesheets — or css — is the first technology you should start learning after html. while html is used to define the structure and semantics of your content, css is used to style it and lay it out. for example, you can use css to alter the font, color, size, and spacing of...
...ox. do explore the different property pages if you want to find out more about any of the features we have discussed. each page on mdn has more examples of usage for you to play with and enhance your knowledge. 107 css selectors attribute, beginner, css, class, learn, pseudo, selectors, id in css, selectors are used to target the html elements on our web pages that we want to style. there are a wide variety of css selectors available, allowing for fine-grained precision when selecting elements to style. in this article and its sub-articles we'll run through the different types in great detail, seeing how they work. 108 attribute selectors attribute, beginner, css, learn, selectors as you know from your study of html, elements can have attributes that gi...
...And 15 more matches
Advanced form styling - Learn web development
previous overview: forms next in this article, we will see what can be done with css to style the types of form control that are more difficult to style — the "bad" and "ugly" categories. as we saw in the previous article, text fields and buttons are perfectly easy to style; now we will dig into styling the bits that are more problematic. prerequisites: basic computer literacy, and a basic understanding of html and css. objective: to understand what parts of forms are hard to style, and why; to learn what can be done to customize them. ...
...now we will dig into styling the bits that are more problematic. prerequisites: basic computer literacy, and a basic understanding of html and css. objective: to understand what parts of forms are hard to style, and why; to learn what can be done to customize them. to recap what we said in the previous article, we have: the bad: some elements are more difficult to style, requiring more complex css or some more specific tricks: checkboxes and radio buttons <input type="search"> the ugly: some elements can't be styled thoroughly using css. these include: elements involved in creating dropdown widgets, including <select>, <option>, <optgroup> and <datalist>. <input type="color"> date-related controls such as <input type="datetime-local"> <input type="ra...
...med to be using the -webkit- prefixed version, so it was better for compatibility. if you look at the reference page you'll see a lot of different possible values listed for -webkit-appearance, however by far the most helpful value, and probably the only one you'll use, is none. this stops any control you apply it to from using system-level styling, as much as possible, and lets you build up the styles yourself using css. for example, let's take the following controls: <form> <p> <label for="search">search: </label> <input id="search" name="search" type="search"> </p> <p> <label for="text">text: </label> <input id="text" name="text" type="text"> </p> <p> <label for="date">date: </label> <input id="date" name="date" type="datetime-local"> </p> <p> <la...
...And 14 more matches
Using dynamic styling information - Web APIs
the css object model (cssom), part of the dom, exposes specific interfaces allowing manipulation of a wide amount of information regarding css. initially defined in the dom level 2 style recommendation, these interfaces forms now a specification, css object model (cssom) which aims at superseding it. in many cases, and where possible, it really is best practice to dynamically manipulate classes via the classname property since the ultimate appearance of all of the styling hooks can be controlled in a single stylesheet. one's javascript code also becomes cleaner since instead of being dedicated to styling details, it can focus on the overall semantics of each section it is creating or manipulating, leaving the precise style details to the stylesheet. however, there are cases where actually obt...
...styling hooks can be controlled in a single stylesheet. one's javascript code also becomes cleaner since instead of being dedicated to styling details, it can focus on the overall semantics of each section it is creating or manipulating, leaving the precise style details to the stylesheet. however, there are cases where actually obtaining or manipulating the rules can be useful (whether for whole stylesheets or individual elements), and that is described in further detail below. note also that, as with individual element's dom styles, when speaking of manipulating the stylesheets, this is not actually manipulating the physical document(s), but merely the internal representation of the document. the basic style object exposes the stylesheet and the cssstylesheet interfaces. those interfaces con...
...in further detail below. note also that, as with individual element's dom styles, when speaking of manipulating the stylesheets, this is not actually manipulating the physical document(s), but merely the internal representation of the document. the basic style object exposes the stylesheet and the cssstylesheet interfaces. those interfaces contain members like insertrule, selectortext, and parentstylesheet for accessing and manipulating the individual style rules that make up a css stylesheet. to get to the style objects from the document, you can use the document.stylesheets property and access the individual objects by index (e.g., document.stylesheets[0] is the first stylesheet defined for the document, etc.). ...
...And 14 more matches
tabs - Archive of obsolete content
bs"); tabs.on('activate', function(tab) { var worker = tab.attach({ contentscript: 'self.port.emit("html", document.body.innerhtml);' }); worker.port.on("html", function(message) { console.log(message) }) }); note that tab.attach is tab-centric: if the user navigates to a new page in the same tab, then the worker and content scripts will be reattached to the new page. ...
...ker = tab.attach({ contentscript: 'self.port.emit("html", document.body.innerhtml);' }); worker.port.on("html", function(message) { console.log(message) }) }); note that tab.attach is tab-centric: if the user navigates to a new page in the same tab, then the worker and content scripts will be reattached to the new page. attaching stylesheets new in firefox 34. ...
...unction(message) { console.log(message) }) }); note that tab.attach is tab-centric: if the user navigates to a new page in the same tab, then the worker and content scripts will be reattached to the new page. attaching stylesheets new in firefox 34. you can't attach style sheets to a tab using tab.attach(), but from firefox 34 onwards you can attach and detach them using the low-level stylesheet/style and content/mod apis. here's an add-on that uses a toggle button to attach a stylesheet to the active tab, and detach it again. ...
...And 13 more matches
JavaScript Daemons Management - Archive of obsolete content
ript type="text/javascript" src="daemon-methods.js"></script> <script type="text/javascript"> function perform (nindex, nlength, bbackw) { // http://tyleregeto.com/text-animation-in-javascript for (var oletter, nletter = 0; nletter < aletters.length; nletter++) { oletter = aletters[nletter]; var ndist = nmaxdist - nmaxdist * nindex / nlength; oletter.pos += 0.08; oletter.elem.style.top = math.sin(oletter.pos) * ndist + "px"; oletter.elem.style.left = math.cos(oletter.pos) * ndist * 5 + "px"; } } function prepare () { // build letters list // http://tyleregeto.com/text-animation-in-javascript this.textcontent = ""; aletters.length = 0; for (var ospan, oletter, nletter = 0, nlen = stext.length; nletter < nlen; nletter++) { ospan = document.createelement("...
...//tyleregeto.com/text-animation-in-javascript this.textcontent = ""; aletters.length = 0; for (var ospan, oletter, nletter = 0, nlen = stext.length; nletter < nlen; nletter++) { ospan = document.createelement("span"); ospan.textcontent = stext[nletter]; oletter = { "elem": ospan, "parent": this }; aletters.push(oletter); oletter.pos = math.random() * 50; oletter.elem.style.position = "relative"; this.appendchild(ospan); } } var nmaxdist = 25, aletters = [], stext = "do you feel lucky, punk?", orecompose = new daemon(document.createelement("p"), perform, 33, 30, prepare); onload = function () { orecompose.owner.id = "perform-me"; document.body.appendchild(orecompose.owner); orecompose.play(); }; </script> <style type="text/css"> body { font-fam...
...ew daemon(document.createelement("p"), perform, 33, 30, prepare); onload = function () { orecompose.owner.id = "perform-me"; document.body.appendchild(orecompose.owner); orecompose.play(); }; </script> <style type="text/css"> body { font-family: monospace, sans-serif; background: #dddddd; overflow: hidden; } #perform-me { margin: 50px; font-size: 20px; line-height: 20px; } </style> </head> <body> <h1>new daemon(<em>@thisobject</em>, <em>@callback</em>[, <em>@rate</em>, <em>@length</em>, <em>@init</em>, <em>@onstart</em>])</h1> <p><button onclick="orecompose.skipto(11);">skipto(11)</button> <button onclick="orecompose.makesteps(29);">makesteps(29)</button> <button onclick="orecompose.fixposition(-13);">fixposition(-13)</button> <button onclick="orecompose.play();">play</...
...And 13 more matches
Layout System Overview - Archive of obsolete content
content elements and frames. layout creates frames for content based on either the specific html rules for an element or based on the css display type of the element. ...
...s for content based on either the specific html rules for an element or based on the css display type of the element. in the case of the html-specific elements, the frame types that correspond to the element are hard-coded, but in the more general case where the display type is needed, the layout system must determine that display type by using the style system. ...
...les for an element or based on the css display type of the element. in the case of the html-specific elements, the frame types that correspond to the element are hard-coded, but in the more general case where the display type is needed, the layout system must determine that display type by using the style system. a content element is passed to the style system and a request is made to resolve the style for that element. ...
...And 13 more matches
jspage - Archive of obsolete content
:function(){return this.ownerdocument.window;},getdocument:function(){return this.ownerdocument; },getelementbyid:function(o,n){var m=this.ownerdocument.getelementbyid(o);if(!m){return null;}for(var l=m.parentnode;l!=this;l=l.parentnode){if(!l){return null; }}return document.id(m,n);},getselected:function(){return new elements($a(this.options).filter(function(l){return l.selected;}));},getcomputedstyle:function(m){if(this.currentstyle){return this.currentstyle[m.camelcase()]; }var l=this.getdocument().defaultview.getcomputedstyle(this,null);return(l)?l.getpropertyvalue([m.hyphenate()]):null;},toquerystring:function(){var l=[]; this.getelements("input, select, textarea",true).each(function(m){if(!m.name||m.disabled||m.type=="submit"||m.type=="reset"||m.type=="file"){return;}var n=(m.tagname.tolo...
...s.removeeventlistener(m,l,false);}else{this.detachevent("on"+m,l);}return this; },retrieve:function(m,l){var o=c(this.uid),n=o[m];if(l!=undefined&&n==undefined){n=o[m]=l;}return $pick(n);},store:function(m,l){var n=c(this.uid);n[m]=l; return this;},eliminate:function(l){var m=c(this.uid);delete m[l];return this;}});window.addlistener("unload",d);})();element.properties=new hash;element.properties.style={set:function(a){this.style.csstext=a; },get:function(){return this.style.csstext;},erase:function(){this.style.csstext="";}};element.properties.tag={get:function(){return this.tagname.tolowercase(); }};element.properties.html=(function(){var c=document.createelement("div");var a={table:[1,"<table>","</table>"],select:[1,"<select>","</select>"],tbody:[2,"<table><tbody>","</tbody></table>"],tr:[3,...
...1}; (function(){var a=function(b){var c=b.relatedtarget;if(c==undefined){return true;}if(c===false){return false;}return($type(this)!="document"&&c!=this&&c.prefix!="xul"&&!this.haschild(c)); };element.events=new hash({mouseenter:{base:"mouseover",condition:a},mouseleave:{base:"mouseout",condition:a},mousewheel:{base:(browser.engine.gecko)?"dommousescroll":"mousewheel"}}); })();element.properties.styles={set:function(a){this.setstyles(a);}};element.properties.opacity={set:function(a,b){if(!b){if(a==0){if(this.style.visibility!="hidden"){this.style.visibility="hidden"; }}else{if(this.style.visibility!="visible"){this.style.visibility="visible";}}}if(!this.currentstyle||!this.currentstyle.haslayout){this.style.zoom=1;}if(browser.engine.trident){this.style.filter=(a==1)?"":"alpha(opacity="+a*100+"...
...And 13 more matches
Browser Feature Detection - Archive of obsolete content
rue true document.open() true true true document.close() true true true document.write() true true true document.writeln() true true true document.getelementbyid() true true true document.getelementsbyname() true true true dom css 1 support for properties/methods in document.body.style name firefox 1.5 ie 6 & 7 opera 8.54 - 9.01 background true true true backgroundattachment true true true backgroundcolor true true true backgroundimage true true true backgroundrepeat true true true border true true true borderspacing true false true ...
...me firefox 1.5 ie 6 & 7 opera 8.54 - 9.01 background true true true backgroundattachment true true true backgroundcolor true true true backgroundimage true true true backgroundrepeat true true true border true true true borderspacing true false true borderstyle true true true bordertop true true true borderright true true true borderbottom true true true borderleft true true true bordertopwidth true true true borderrightwidth true true true borderbottomwidth true true true borderleftwidth true true true...
... true borderleftwidth true true true borderwidth true true true clear true true true color true true true display true true true cssfloat true false true font true true true fontfamily true true true fontsize true true true fontstyle true true true fontvariant true true true fontweight true true true height true true true letterspacing true true true lineheight true true true liststyle true true true liststyleimage true true true liststyleposition true true true list...
...And 13 more matches
Cascade and inheritance - Learn web development
nd the concepts before moving on. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn about the cascade and specificity, and how inheritance works in css. conflicting rules css stands for cascading style sheets, and that first word cascading is incredibly important to understand — the way that the cascade behaves is key to understanding css. at some point, you will be working on a project and you will find that the css you thought should be applied to an element is not working. usually the problem is that you have created two rules which could potentially apply to the same element. the cascade...
...on't. this can also cause some behavior that you might not expect. let's start by taking a quick look at the key things we are dealing with, then we'll look at each in turn and see how they interact with each other and your css. this can seem like a set of tricky concepts to understand. as you get more practice writing css, however, the way it works will become more obvious to you. the cascade stylesheets cascade — at a very simple level this means that the order of css rules matter; when two rules apply that have equal specificity the one that comes last in the css is the one that will be used. in the below example, we have two rules that could apply to the h1. the h1 ends up being colored blue — these rules have an identical selector and therefore carry the same specificity, so the la...
...selector appears further down in the source order. we'll explain specificity scoring and other such things later on. inheritance inheritance also needs to be understood in this context — some css property values set on parent elements are inherited by their child elements, and some aren't. for example, if you set a color and font-family on an element, every element inside it will also be styled with that color and font, unless you've applied different color and font values directly to them. some properties do not inherit — for example if you set a width of 50% on an element, all of its descendants do not get a width of 50% of their parent's width. if this was the case, css would be very frustrating to use! note: on mdn css property reference pages you can find a technical infor...
...And 13 more matches
Fundamental text and font styling - Learn web development
overview: styling text next in this article we'll start you on your journey towards mastering text styling with css. here we'll go through all the basic fundamentals of text/font styling in detail, including setting font weight, family and style, font shorthand, text alignment and other effects, and line and letter spacing. prerequisites: basic computer literacy, html basics (study introduction to html), css basics (study introduction to css). objective: to learn the fundamental properties and techniques needed to style text on web pages. what is involved in styling text in css? as you'll have already experienced in your work with html and css, text inside an element is laid out inside the element's content box. it starts at the top left of the content ...
... elements, being laid out on lines adjacent to one another, and not creating line breaks until the end of the line is reached, or unless you force a line break manually using the <br> element. note: if the above paragraph leaves you feeling confused, then no matter — go back and review our box model article, to brush up on the box model theory, before carrying on. ...
...of the line is reached, or unless you force a line break manually using the <br> element. note: if the above paragraph leaves you feeling confused, then no matter — go back and review our box model article, to brush up on the box model theory, before carrying on. the css properties used to style text generally fall into two categories, which we'll look at separately in this article: font styles: properties that affect the font that is applied to the text, affecting what font is applied, how big it is, whether it is bold, italic, etc. text layout styles: properties that affect the spacing and other layout features of the text, allowing manipulation of, for example, the space between lines and letters, and how the text is aligned within the content box. note: bear in mind that the te...
...And 13 more matches
Challenge solutions - Developer guides
solution css supports common color names like orange, yellow, blue, green, or black. ...
...of specifying colors. how css works dom inspector challenge in domi, click on a strong node. use domi's right-hand pane to find out where the node's color is set to red, and where its appearance is made bolder than normal text. solution in the menu above the right-hand pane, choose css rules. you see two items listed, one that references an internal resource and one that references your stylesheet file. the internal resource defines the font-weight property as bolder; your stylesheet defines the color property as red. cascading and inheritance inherited styles challenge change your stylesheet so that only the red letters are underlined. solution move the declaration for underlining from the rule for <p> to the one for <strong>. the resulting file looks like this: p {color: b...
... selectors second paragraph blue challenge without changing your html file, add a single rule to your css file that keeps all the initial letters the same color as they are now, but makes all the other text in the second paragraph blue. ...
...And 13 more matches
CSS FAQ - Learn web development
Learn › CSS › Howto › CSS FAQ
transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> when at all possible, you should just use the html5 doctype. why doesn't my css, which is valid, render at all? here are some possible causes: you've got the path to css file wrong. to be applied, a css stylesheet must be served with a text/css mime type. if the web server doesn't serve it with this type, it won't be applied. what is the difference between id and class? html elements can have an id and/or class attribute. the id attribute assigns a name to the element it is applied to, and for valid markup, there can be only one element with that name. the class attribute assigns a class name to th...
...pe, it won't be applied. what is the difference between id and class? html elements can have an id and/or class attribute. the id attribute assigns a name to the element it is applied to, and for valid markup, there can be only one element with that name. the class attribute assigns a class name to the element, and that name can be used on many elements within the page. ...
...ss? html elements can have an id and/or class attribute. the id attribute assigns a name to the element it is applied to, and for valid markup, there can be only one element with that name. the class attribute assigns a class name to the element, and that name can be used on many elements within the page. css allows you to apply styles to particular id and/or class names. use a class-specific style when you want to apply the styling rules to many blocks and elements within the page, or when you currently only have element to style with that style, but you might want to add more later. use an id-specific style when you need to restrict the applied styling rules to one specific block or element. this style will only be used by the element with that particular id. it is generally recommende...
...And 12 more matches
UI pseudo-classes - Learn web development
en it is selected. in this article, we will explore in detail the different ui pseudo-classes available to us in modern browsers for styling forms in different states. prerequisites: basic computer literacy, and a basic understanding of html and css, including general knowledge of pseudo-classes and pseudo-elements. objective: to understand what parts of forms are hard to style, and why; to learn what can be done to customize them. what pseudo-classes do we have available? the original pseudo-classes available to us (as of css 2.1) that are relevant to forms are: :hover: selects an element only when it is being hovered over by a mouse pointer. :focus: selects an element only when it is focused (i.e. by being tabbed to via the keyboard). :active: selects an ...
... word "required" being associated with the controls in question. in the next section, we'll look at a better example of indicating required fields using :required, which also digs into using generated content. note: you'll probably not find yourself using the :optional pseudo-class very often. form controls are optional by default, so you could just do your optional styling by default, and add styles on top for required controls. note: if one radio button in a same-named group of radio buttons has the required attribute, all the radio buttons will be invalid until one is selected, but only the one with the attribute assigned will actually match :required. using generated content with pseudo-classes in previous articles, we've seen the usage of generated content, but we thought now woul...
... seen the usage of generated content, but we thought now would be a good time to talk about it in a bit more detail. the idea is that we can use the ::before and ::after pseudo-elements along with the content property to make a chunk of content appear before or after the affected element. the chunk of content is not added to the dom, so is invisible to screenreaders; it is part of the document's styles. because it is a pseudo element, it can be targetted with styles in the same way that any actual dom node can. this is really useful when you want to add a visual indicator to an element, such as a label or icon, but don't want it to be picked up by assistive technologies. for example, in our custom radio buttons example, we use generated content to handle the placement and animation of the inn...
...And 12 more matches
Handling common HTML and CSS problems - Learn web development
them. the trouble with html and css some of the trouble with html and css lies with the fact that both languages are fairly simple, and often developers don't take them seriously, in terms of making sure the code is well-crafted, efficient, and semantically describes the purpose of the features on the page. in the worst cases, javascript is used to generate the entire web page content and style, which makes your pages inaccessible, and less performant (generating dom elements is expensive). in other cases, nascent features are not supported consistently across browsers, which can make some features and styles not work for some users. responsive design problems are also common — a site that looks good in a desktop browser might provide a terrible experience on a mobile device, because ...
...and what related techniques are useful. see finding help below. html fallback behaviour some problems can be solved by just taking advantage of the natural way in which html/css work. unrecognised html elements are treated by the browser as anonymous inline elements (effectively inline elements with no semantic value, similar to <span> elements). ...
... note: see ie conditional comments for the best way to do this. more complex elements like html <video>, <audio>, and <canvas> (and other features besides) have natural mechanisms for fallbacks to be added, which work on the same principle as described above. ...
...And 12 more matches
Mozilla’s UAAG evaluation report
a ui for this would be good. 2.4 allow time-independent interaction. (p1) nr need to look into this 2.5 make captions, transcripts available. (p1) na this relates to multimedia players 2.6 respect synchronization cues. (p1) na this re...
...a ui for this would be good. ...
...a ui for this would be good. 2.10 toggle placeholders. (p3) ni 2.11 alert unsupported language. (p3) nr ? guideline 3. allow configuration not to render some content that may reduce accessibility. checkpoint title status n...
...And 12 more matches
inIDOMUtils
ls(in nsidomelement aelement); nsidomnodelist getchildrenfornode(in nsidomnode anode, in boolean ashowinganonymouscontent); unsigned long long getcontentstate(in nsidomelement aelement); void getcsspropertynames([optional] in unsigned long aflags, [optional] out unsigned long acount, [retval, array, size_is(acount)] out wstring aprops); nsisupportsarray getcssstylerules(in nsidomelement aelement, [optional] in domstring apseudo); nsidomnode getparentfornode(in nsidomnode anode, in boolean ashowinganonymouscontent); unsigned long getruleline(in nsidomcssstylerule arule); unsigned long getrulecolumn(in nsidomcssstylerule arule); unsigned long getselectorcount(in nsidomcssstylerule arule); astring getselectortext(in...
...sidomelement aelement, [optional] in domstring apseudo); nsidomnode getparentfornode(in nsidomnode anode, in boolean ashowinganonymouscontent); unsigned long getruleline(in nsidomcssstylerule arule); unsigned long getrulecolumn(in nsidomcssstylerule arule); unsigned long getselectorcount(in nsidomcssstylerule arule); astring getselectortext(in nsidomcssstylerule arule, in unsigned long aselectorindex); unsigned long long getspecificity(in nsidomcssstylerule arule, in unsigned long aselectorindex); nsidomfontfacelist getusedfontfaces(in nsidomrange arange); bool haspseudoclasslock(in nsidomelement aelement, in domstring apseudoclass); boolean isignorablewhitespace(in nsidomcharacterdata adatanode); bool is...
...long long getspecificity(in nsidomcssstylerule arule, in unsigned long aselectorindex); nsidomfontfacelist getusedfontfaces(in nsidomrange arange); bool haspseudoclasslock(in nsidomelement aelement, in domstring apseudoclass); boolean isignorablewhitespace(in nsidomcharacterdata adatanode); bool isinheritedproperty(in astring apropertyname); void parsestylesheet(in nsidomcssstylesheet asheet, in domstring ainput); void removepseudoclasslock(in nsidomelement aelement, in domstring apseudoclass); astring rgbtocolorname(in octet ar, in octet ag, in octet ab); bool selectormatcheselement(in nsidomelement aelement, in nsidomcssstylerule arule, in unsigned long aselectorindex, [optional] in domstring apseudo); void set...
...And 12 more matches
Generating HTML - Web APIs
e <body> element of the article now contains html elements (a <b> and <u> tag, see figure 2). the xml document contains both html elements and xml elements, but only one namespace is needed, namely for the xml elements. ...
...foo</myns:author> <myns:author>mr. ...
..." href="example2.xsl"?> <myns:article xmlns:myns="http://devedge.netscape.com/2002/de"> <myns:title>my article</myns:title> <myns:authors> <myns:author company="foopy corp.">mr. foo</myns:author> <myns:author>mr. bar</myns:author> </myns:authors> <myns:body> the <b>rain</b> in <u>spain</u> stays mainly in the plains. ...
...And 12 more matches
Using the W3C DOM - Archive of obsolete content
html page is document.getelementbyid(). all modern browsers support it. the method returns a reference to the uniquely identified element, which can then be used to script the element. for example, the following short sample dynamically sets the left margin of a <div> element with an id of "inset" to half an inch: // in the html: <div id="inset">sample text</div> document.getelementbyid("inset").style.marginleft = ".5in"; note: internet explorer 5 through 7 have a flawed implementation of getelementbyid(), which returns the first element with a matching name or id (id versus name when using getelementbyid, msdn: getelementbyid method). ie-specific ways to access elements w3c web standards replacements id_attribute_value document.getelementbyid() document.all...
... in addition to these access methods, the w3c dom specifications provide methods for creating new elements and inserting them in a document, for creating attributes, new content, for traversing the content tree and for handling events dispatched as the user interacts with the document it...
...// and now, the first paragraph in the document // gets a 2px solid green border. in addition to these access methods, the w3c dom specifications provide methods for creating new elements and inserting them in a document, for creating attributes, new content, for traversing the content tree and for handling events dispatched as the user interacts with the document itself. manipulating document style and content changing an element's style using the dom the following table describes standards-based methods for accessing and updating style rules defined for various html elements in a web page. see the w3c dom 2 recommendation, css2 extended interface. dom level 2 provides for the assignment of new values to the css properties of an element using the elemref.style object reference. you can g...
...And 11 more matches
Practical positioning examples - Learn web development
on> element with a class of info-box, which contains a <ul> and a <div>. the unordered list contains three list items with links inside, which will become the actual tabs to click on for displaying our content panels. the div contains three <article> elements, which will make up the content panels that correspond to each tab. each panel contains some sample content. the idea here is that we will style the tabs to look like a standard horizontal navigation menu, and style the panels to sit on top of one another using absolute positioning. we'll also give you a bit of javascript to include on your page to display the corresponding panel when a tab is pressed, and style the tab itself. you won't need to understand the javascript itself at this stage, but you should think about learning some basic...
...sed, and style the tab itself. you won't need to understand the javascript itself at this stage, but you should think about learning some basic javascript as soon as possible — the more complex your ui features become, the more likely it is that you'll need some javascript to implement your desired functionality. general setup to begin with, add the following between your opening and closing <style> tags: html { font-family: sans-serif; } * { box-sizing: border-box; } body { margin: 0; } this is just some general setup to set a sans-serif font on our page, use the border-box box-sizing model, and get rid of the default <body> margin. next, add the following just below your previous css: .info-box { width: 450px; height: 400px; margin: 0 auto; } this sets a specific width ...
...s a specific width and height on the content, and centers it on the screen using the old margin: 0 auto trick. previously in the course we advised against setting a fixed height on content containers if at all possible; it is ok in this circumstance because we have fixed content in our tabs. it also looks a bit jarring to have different tabs at different heights. styling our tabs now we want to style tabs to look like tabs — basically, these are a horizontal navigation menu, but instead of loading different web pages when they are clicked on like we've seen previously in the course, they cause different panels to be displayed on the same page. first, add the following rule at the bottom of your css to remove the default padding-left and margin-top from the unordered list: .info-box ul { ...
...And 11 more matches
Getting started with CSS - Learn web development
very first thing we need to do is to tell the html document that we have some css rules we want it to use. there are three different ways to apply css to an html document that you'll commonly come across, however, for now, we will look at the most usual and useful way of doing so — linking css from the head of your document. create a file in the same folder as your html document and save it as styles.css. the .css extension shows that this is a css file. to link styles.css to index.html add the following line somewhere inside the <head> of the html document: <link rel="stylesheet" href="styles.css"> this <link> element tells the browser that we have a stylesheet, using the rel attribute, and the location of that stylesheet as the value of the href attribute. you can test that the css work...
...using your code editor add the following to your css file: h1 { color: red; } save your html and css files and reload the page in a web browser. the level one heading at the top of the document should now be red. if that happens, congratulations — you have successfully applied some css to an html document. ...
...add the following to your css file: h1 { color: red; } save your html and css files and reload the page in a web browser. the level one heading at the top of the document should now be red. if that happens, congratulations — you have successfully applied some css to an html document. if that doesn't happen, carefully check that you've typed everything correctly. you can continue to work in styles.css locally, or you can use our interactive editor below to continue with this tutorial. the interactive editor acts as if the css in the first panel is linked to the html document, just as we have with our document above. styling html elements by making our heading red we have already demonstrated that we can target and style an html element. we do this by targeting an element selector — th...
...And 11 more matches
CSS basics - Learn web development
previous overview: getting started with the web next css (cascading style sheets) is the code that styles web content. css basics walks through what you need to get started. we'll answer questions like: how do i make text red? how do i make content display at a certain location in the (webpage) layout? how do i decorate my webpage with background images and colors? what is css? ...
...sheets) is the code that styles web content. css basics walks through what you need to get started. we'll answer questions like: how do i make text red? how do i make content display at a certain location in the (webpage) layout? how do i decorate my webpage with background images and colors? what is css? like html, css is not a programming language. it's not a markup language either. css is a style sheet language. css is what you use to selectively style html elements. for example, this css selects paragraph text, setting the color to red: p { color: red; } let's try it out! using a text editor, paste the three lines of css (above) into a new file. save the file as style.css in a directory named styles. to make the code work, we still need to apply this css (above) to your html documen...
...you should see something like this: if your paragraph text is red, congratulations! your css is working. anatomy of a css ruleset let's dissect the css code for red paragraph text to understand how it works : the whole structure is called a ruleset. ...
...And 11 more matches
Gecko info for Windows accessibility vendors
readonly dom support, and the keyboard api/user interface. definitions here are some basic definitions that you'll need for this document to make sense: gecko: the rendering engine for firefox, thunderbird, nvu, mozilla seamonkey and other applications. gecko is the internal engine that mozilla uses to render any kind of web content. it supports html, xhtml, cascading style sheets (css) and the document object model (dom). microsoft active accessibility (msaa) an api devised by microsoft so that accessibility aids can track what's going on inside the user interface of any software package that supports it. if you seriously need to understand msaa, you'll need to read the docs on msdn and play with the sample apps and code that come with msaa sd...
...read the docs on msdn and play with the sample apps and code that come with msaa sdk 1.3. (i recommend sdk 1.3 because the msaa sdk 2.0 doesn't come with the source code to the testing tools. the other differences are not important). dom: document object model this is the w3c's specification for how web content is exposed to javascript and other languages. it covers content, style and events. inside the gecko process, code has full access to dom apis. however, exposing the entire dom to external software packages is quite involved, partially because changes to the dom in firefox must occur on the main thread. we have chosen a subset of readonly methods in the dom needed for assistive technology vendors. events such as focus changes must be tracked through msaa events, rath...
...thods in the dom needed for assistive technology vendors. events such as focus changes must be tracked through msaa events, rather than dom events. xul: extensible user-interface language the xml-based language used by firefox and mozilla to develop the ui. similar to html in that it can be combined with css and javascript to make powerful applications. contains more desktop-style widgets than html and follows a box layout model, rather than being text-flow based. ajax: asynchronous javascript and xml ajax is a method of building interactive web applications that process user requests, user actions immediately in real time, unlike an http request, during which users must wait for a whole page to reload or for a new page to load. data is therefore stor...
...And 11 more matches
MathML Torture Test
</mrow> </math> </td></tr> <tr> <td>6</td> <td><img src="https://udn.realityripple.com/samples/76/5ce9da68c6.png" width="220" height="138" alt="texbook, 17.5-17.6" /></td> <td> <math display="block"> <mrow> <msub> <mi>a</mi> <mn>0</mn> </msub> <mo>+</mo> <mfrac> <mn>1</mn> <mstyle displaystyle="true" scriptlevel="0"> <msub> <mi>a</mi> <mn>1</mn> </msub> <mo>+</mo> <mfrac> <mn>1</mn> <mstyle displaystyle="true" scriptlevel="0"> <msub> <mi>a</mi> <mn>2</mn> </msub> ...
... <mn>1</mn> </msub> <mo>+</mo> <mfrac> <mn>1</mn> <mstyle displaystyle="true" scriptlevel="0"> <msub> <mi>a</mi> <mn>2</mn> </msub> <mo>+</mo> <mfrac> <mn>1</mn> <mstyle displaystyle="true" scriptlevel="0"> <msub> <mi>a</mi> <mn>3</mn> </msub> <mo>+</mo> <mfrac> <mn>1</mn> <mstyle displaystyle="true" scriptlevel="0"> <msub> <mi>a...
... <mn>3</mn> </msub> <mo>+</mo> <mfrac> <mn>1</mn> <mstyle displaystyle="true" scriptlevel="0"> <msub> <mi>a</mi> <mn>4</mn> </msub> </mstyle> </mfrac> </mstyle> </mfrac> </mstyle> </mfrac> </mstyle> </mfrac> </mrow> </math> </td></tr> <tr> <td>7</td> <td><img src="https://udn.realityripple.com/samples/e0/ebbefa9d75.png" width="200" height="85" alt="texbook, 17.5-17.6" /></td> <td> <math> ...
...And 11 more matches
Migrating from Firebug - Firefox Developer Tools
ion firebug's html panel allows to copy the inner and outer html of an element as well as the css and xpath to it via the context menu of an element. the page inspector provides the same functionality except copying xpaths. this is covered by bug 987877. edit css both tools allow to view and edit the css rules related to the element selected within the node view in a similar way. ...
...from the context menu. the devtools display an element {} rule for this purpose, which requires a single click into it to start editing the properties. ...
...from the context menu. the devtools display an element {} rule for this purpose, which requires a single click into it to start editing the properties. ...
...And 11 more matches
panel - Archive of obsolete content
", text); textarea.value = ''; } }, false); // listen for the "show" event being sent from the // main add-on code. it means that the panel's about // to be shown. // // set the focus to the text area so the user can // just start typing. ...
...anel's about // to be shown. // // set the focus to the text area so the user can // just start typing. self.port.on("show", function onshow() { textarea.focus(); }); finally, the "text-entry.html" file defines the <textarea> element: <html> <head> <style type="text/css" media="all"> textarea { margin: 10px; } body { background-color: gray; } </style> </head> <body> <textarea rows="13" cols="33" id="edit-box"></textarea> </body> </html> finally, save these three icon files to the "data" directory: icon-16.png icon-32.png icon-64.png to learn much more about content scripts, see the working with content scripts guide. scripting trusted panel content note: this example uses the action b...
...); textarea.value = ''; } }, false); // listen for the "show" event being sent from the // main add-on code. it means that the panel's about // to be shown. // // set the focus to the text area so the user can // just start typing. ...
...And 10 more matches
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
ul and javascript source files. most extensions consist of a single content package2 the locale package this package is used to contain language data that can be translated. to make an extension’s gui support multiple languages, you can include multiple locale packages, one for each language. the skin package this is used to include source files used as visual elements in the gui, including style sheets and images. most extensions include only one skin package, but you can include multiple skin packages to allow the gui to change with different themes. chrome url use a file called a “chrome manifest” to register chrome packages with firefox and start using them. to register a package, you use a special uri scheme called a “chrome url” to represent the path to the file. chrome ur...
...you can create the overlay.xul file that will insert it (listing 3). in line 4, we identify the merge point as the menupop element; in lines 5–7, we have the code that adds the new menu item. the insertbefore attribute determines where the element gets added. test install and operational check this brings us to the point where we finally install our hello world extension. using the normal xpi-style installer would just be added trouble in this case, so we won’t use it. for source files under development, we do test installs. placing pointer files first, navigate to the profile folder of the currently active profile4, and open the extensions folder within it. create a new file there with the name you used as the hello world extension id in the install manifest, helloworld@xuldev.org. set...
...plays the clock (listing 5) and its controller (listing 6). we’ve already covered the dialog element in chapter 3. in this case, we only want to display an ok button, so we set the buttons attribute to accept. within the window are a label element and textbox element, wrapped in a hbox element so that they are arranged horizontally. ...
...And 10 more matches
Creating a Skin - Archive of obsolete content
e it easier. for this reason, we'll modify only the file findfile.css rather than the global.css file. this section assumes that you are starting with the classic skin. you may wish to make a copy of the files used by the find files dialog before editing. you need to create a file 'findfile.css' in a custom skin. or, you can temporarily place it in the content directory and refer to it using a stylesheet directive. you can modify the existing findfile.css directly to see what it looks like, or you can create a custom skin and link to that. creating a custom skin package to create a skin, do the following: (if you are using firefox 1.5 or later, see manifest files instead of below) create a directory somewhere where you want to place the skin files. copy a manifest file (contents.rdf) f...
... a line to the file 'chrome/installed-chrome.txt of the following form: skin,install,url,file:///stuff/blueswayedshoes/ where the last part points to the directory you created. make sure to add a slash at the end. copy the original findfile.css into the new directory. we'll use this as a basis for the new skin. we can then refer to it using the url 'chrome://findfile/skin/findfile.css'. adding style rules first, let's decide what kind of changes we want to make. we'll make some simple color changes, modify the button styles, and modify the spacing a bit. let's start with the menus, toolbars and the overall tab panel. the following style rules added to findfile.css will cause the changes shown in the accompanying image. window > box { background-color: #0088cc; } menubar,menupopup,toolb...
... border around these four elements has been changed to give a heavier 3d appearance. you can see this if you look closely. the background color of the caption has also been changed to match the background. the first rule above (for 'window > box') specifies that the child box of the window has a different color. this probably isn't the best way to do this. we should really change this to use a style class. let's do this. that way, we can modify the xul without needing to keep the box as the first child of the window. css: .findfilesbox { background-color: #0088cc; } xul: <vbox class="findfilesbox" orient="vertical" flex="100%"> <toolbox> rounding on the tabs next, let's modify the tabs. we will make the selected tab bold and change the rounding on the tabs. tab:first-child { -moz-b...
...And 10 more matches
Styling a Tree - Archive of obsolete content
this is because the tree body is stored in a different way to other elements. the outer treechildren is the only real element in the tree body. the inner elements are just placeholders. ...
...this is because the tree body is stored in a different way to other elements. the outer treechildren is the only real element in the tree body. the inner elements are just placeholders. ...
...this is because the tree body is stored in a different way to other elements. the outer treechildren is the only real element in the tree body. the inner elements are just placeholders. ...
...And 10 more matches
Using the standard theme - Archive of obsolete content
by default, no style is associated with xul extension windows or dialogs. you can either provide a complete custom styling, but most of the time you also want to be able to reuse the standard theme (also called the "global skin") of the base application for non-custom elements, transparently with regard to which theme the user has currently chosen. at the beginning, there is no style when creating a new xul <tt>window</tt> (or a new <tt>dialog</tt>, for that matter) in your extension, and you do not associate a style sheet with it, your widgets will be unstyled. meaning, some internal default will be applied, which does by no means correspond to the standard theme (the theme currently chosen by the user in the theme selector), or even the default theme delivered with your the base app...
... be applied, which does by no means correspond to the standard theme (the theme currently chosen by the user in the theme selector), or even the default theme delivered with your the base application. ...
...eme currently chosen by the user in the theme selector), or even the default theme delivered with your the base application. ...
...And 10 more matches
Styling tables - Learn web development
isn't the most glamorous job in the world, but sometimes we all have to do it. this article provides a guide to making html tables look good, with some specific table styling techniques highlighted. prerequisites: html basics (study introduction to html), knowledge of html tables, and an idea of how css works (study css first steps.) objective: to learn how to effectively style html tables. a typical html table let's start by looking at a typical html table. well, i say typical — most html table examples are about shoes, or the weather, or employees; we decided to make things more interesting by making it about famous punk bands from the uk. the markup looks like so: <table> <caption>a summary of the uk's most famous punk bands</caption> <thead> <tr> ...
...>6</td> <td>london calling</td> </tr> ... some rows removed for brevity <tr> <th scope="row">the stranglers</th> <td>1974</td> <td>17</td> <td>no more heroes</td> </tr> </tbody> <tfoot> <tr> <th scope="row" colspan="2">total albums</th> <td colspan="2">77</td> </tr> </tfoot> </table> the table is nicely marked up, easily styleable, and accessible, thanks to features such as scope, <caption>, <thead>, <tbody>, etc. unfortunately, it doesn't look good when rendered on the screen (see it live at punk-bands-unstyled.html): with only the default browser styling it looks cramped, hard to read, and boring. we need to use some css to fix this up. styling our table let's work through styling our table example together. ...
...owser styling it looks cramped, hard to read, and boring. we need to use some css to fix this up. styling our table let's work through styling our table example together. to start with, make a local copy of the sample markup, download both images (noise and leopardskin), and put the three resulting files in a working directory somewhere on your local computer. ...
...And 10 more matches
HTML text fundamentals - Learn web development
instead. this is done with software called a screen reader. this software provides ways to get fast access to given text content. among the various techniques used, they provide an outline of the document by reading out the headings, allowing their users to find the information they need quickly. if headings are not available, they will be forced to listen to the whole document read out loud. to style content with css, or make it do interesting things with javascript, you need to have elements wrapping the relevant content, so css/javascript can effectively target it. we therefore need to give our content structural markup. active learning: giving our content structure let's jump straight in with a live example. in the example below, add elements to the raw text in the input field so that ...
...ent structure let's jump straight in with a live example. in the example below, add elements to the raw text in the input field so that it appears as a heading and two paragraphs in the output field. if you make a mistake, you can always reset it using the reset button. if you get stuck, press the show solution button to see the answer. playable code <h2>live output</h2> <div class="output" style="min-height: 50px;"> </div> <h2>editable code</h2> <p class="a11y-label">press esc to move focus away from the code area (tab inserts a tab character).</p> <textarea id="code" class="input" style="min-height: 100px; width: 95%">my short story i am a statistician and my name is trish. my legs are made of cardboard and i am married to a fish.</textarea> <div class="playable-buttons"> <input i...
...re using the correct elements, giving our content the correct meaning, function, or appearance. ...
...And 10 more matches
Looping code - Learn web development
ot the same one over and over again! let's look at an example to perfectly illustrate why loops are such a good thing. ...
...dden code <!doctype html> <html> <head> <meta charset="utf-8"> <title>random canvas circles</title> <style> html { width: 100%; height: inherit; background: #ddd; } canvas { display: block; } body { margin: 0; } button { position: absolute; top: 5px; left: 5px; } </style> </head> <body> <button>update</button> <canvas></canvas> <script> const btn = document.queryselector('button'); const canvas = document.queryselector('canvas'); const ctx = canvas.getcontext('2d'); let width = document.documentelement.clientwidth; let height = document.documentelement.clientheight; canvas.width = width; canvas.height = height; f...
...t('2d'); let width = document.documentelement.clientwidth; let height = document.documentelement.clientheight; canvas.width = width; canvas.height = height; function random(number) { return math.floor(math.random()*number); } function draw() { ctx.clearrect(0,0,width,height); for (let i = 0; i < 100; i++) { ctx.beginpath(); ctx.fillstyle = 'rgba(255,0,0,0.5)'; ctx.arc(random(width), random(height), random(50), 0, 2 * math.pi); ctx.fill(); } } btn.addeventlistener('click',draw); </script> </body> </html> you don't have to understand all the code for now, but let's look at the part of the code that actually draws the 100 circles: for (let i = 0; i < 100; i++) { ctx.beginpath(); ctx.fi...
...And 10 more matches
Adding a new CSS property
this document assumes that you have a specifcation for the property available. issues about how to write such a specification (including things such as whether it is appropriate to use prefixes or when properties should be inherited by default) are not covered here. if you need more details on any of the points mentioned here, a good place to find them is by looking at other changes in the version control history of the files mentioned. ...
...ts mentioned here, a good place to find them is by looking at other changes in the version control history of the files mentioned. getting started first, you'll want to add an appropriate test entry to property_database.js. see the documentation at the top of the file and the other entries for examples. ...
...he version control history of the files mentioned. getting started first, you'll want to add an appropriate test entry to property_database.js. see the documentation at the top of the file and the other entries for examples. this will cause tests of your new property to be added to many of the mochitests in layout/style/test, which can be run with the command "./mach mochitest -f plain layout/style/". then, unless you're implementing a shorthand property, you need to decide which style struct the computed value of the property should go in. (again, see the gecko overview for more information.) it should generally be grouped with related properties. remember that each style struct contains only properties that inherit by default or only properties that do not. (which set the property is...
...And 10 more matches
The Firefox codebase: CSS Guidelines
comment). the overriding css section contains more information about this. avoid magic numbers; prefer automatic sizing or alignment methods. some examples to avoid: absolutely positioned elements hardcoded values such as: vertical-align: -2px; . the reason you should avoid such "hardcoded" values is that, they don't necessarily work for all font-size configurations. avoid setting styles in javascript. it's generally better to set a class and then specify the styles in css. classlist is generally better than classname. there's less chance of overwriting an existing class. only use generic selectors such as :last-child, when it is what you mean semantically. if not, using a semantic class name is more descriptive and usually better. boilerplate make sure each file starts wit...
...ed, it can be the case that a common component has been already written could be reused with or without changes. most of the time, the common component already follows the a11y/theme standards defined in this guide. so, when possible, always prefer editing common components to writing your own. also, it is good practice to introduce a common class when the new element you are styling reuses some styles from another element, this allows the maintenance cost and the amount of code duplication to be reduced. formatting spacing & indentation 2 spaces indentation is preferred add a space after each comma, except within color functions: linear-gradient(to bottom, black 1px, rgba(255,255,255,0.2) 1px) always add a space before !important. omit units on 0 values do this: margin: 0; ...
...plicit. do this: border-color: red; not this: border: red; put multiple selectors on different lines do this: h1, h2, h3 { font-family: sans-serif; text-align: center; } not this: h1, h2, h3 { font-family: sans-serif; text-align: center; } naming standards for class names lower-case-with-dashes is the most common. but camelcase is also used sometimes. try to follow the style of existing or related code. other tips assume ="true" in attribute selectors. example: use option[checked], not option[checked="true"]. avoid id selectors unless it is really the wanted goal, since ids have higher specificity and therefore are harder to override. using descendant selectors is good practice for performance when possible: for example: .autocomplete-item[se...
...And 10 more matches
page-mod - Archive of obsolete content
s your code easier to maintain, secure, debug and review. a page-mod only attaches scripts to documents loaded in tabs. it will not attach scripts to add-on panels, page-workers, sidebars, or firefox hidden windows. to stop a page-mod from making any more modifications, call its destroy() method. the pagemod constructor takes a number of other options to control its behavior: contentstyle lists stylesheets to attach, supplied as strings. contentstylefile lists stylesheets to attach, supplied in separate files. contentscriptoptions defines read-only values accessible to content scripts. attachto controls whether to attach scripts to tabs that were already open when the page-mod was created, and whether to attach scripts to iframes as well as t...
...t scripts to tabs we've seen that the page-mod api attaches content scripts to documents based on their url. sometimes, though, we don't care about the url: we just want to execute a script on demand in the context of a particular tab. for example, we might want to run a script in the context of the currently active tab when the user clicks a button: to block certain content, to change the font style, or to display the document's dom structure. using the attach method of the tab object, you can attach a set of content scripts to a particular tab. the scripts are executed immediately. the following add-on creates a button which, when clicked, highlights all the div elements in the document loaded into the active tab: require("sdk/ui/button/action").actionbutton({ id: "highlight-divs", l...
...you could use this icon: . private windows if your add-on has not opted into private browsing, then your page-mods will not attach content scripts to documents loaded into private windows, even if their urls match the...
...And 9 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
this chapter, please include them. because a xul document is also an xml document, it can contain xhtml, svg, mathml, and other elements; if you use external entity references, the xml document's contents are modularized; combined with other xml-related technologies, such as dom, xlink, or xslt, you can use it for a number of different applications. <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet href="chrome://global/skin/"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <!-- contents go here. --> </window> listing 2: general structure of a xul document even with the internationalization of firefox and extensions, this kind of xml function is being used. reading in style sheets xul uses css to specify the appearance of its elements. again, sin...
...al/skin/"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <!-- contents go here. --> </window> listing 2: general structure of a xul document even with the internationalization of firefox and extensions, this kind of xml function is being used. reading in style sheets xul uses css to specify the appearance of its elements. again, since xul is a type of xml, stylesheets are read in using the xml-stylesheet processing instruction. on line 2 of listing 2, we’re reading in the theme’s standard style sheet. by referring to a special style sheet within chrome://global/skin/, we can make label and button sizes, window background color, etc, match the currently selected theme in firefox. we can also read in a stylesheet that we had set up ourselves. the xul...
...nt's orient attribute. for example, flex="1" indicates that the element should extend to fill that axis; if there are two elements with flex="1" in a row, they are adjusted to be of equal size. you can assign flex="2" (or higher values) as a size multiplier for elements. in listing 4, the second label will be displayed twice as big as the first (figure 3). <hbox> <label value="label1" flex="1" style="border: 1px solid;"/> <label value="label2" flex="2" style="border: 1px solid;"/> </hbox> listing 4: growing with flex figure 3: output of listing 4 ordinal within a xul box, elements will ordinarily be laid out following their order of appearance in the source code (laid out left to right or top to bottom). use the ordinal attribute to alter their order. the ordinal attribute takes pos...
...And 9 more matches
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
ad no significant effort invested into either for more than two years. i think that fact played a critical role in our team's willingness to try out something completely new. our engineering team actually needed the least convincing to convert over to a standards-based design, because they could also immediately envision the benefits to their workload and maintenance of the site. ...
...itical role in our team's willingness to try out something completely new. our engineering team actually needed the least convincing to convert over to a standards-based design, because they could also immediately envision the benefits to their workload and maintenance of the site. how is the site styled now that you've ripped out all the html-based presentation? technically, there are 13 total stylesheets used at any one time. ...
... how is the site styled now that you've ripped out all the html-based presentation? technically, there are 13 total stylesheets used at any one time. the breakdown: 1 master screen media file which imports 4 files: a base file (bulk of formatting) a file for finance/table formatting color file (override colors and background images for specific color scheme) temp file (used for styles associated with temporary features and ad-related pages) 1 print media file 1 aural media file 3 master alternate style sheets which import 1 file each the 3 imported files set alternate font sizes (small, large, larger) how much did the size of a typical wired news page shrink? the html went from 32 kb down to 19 kb, but images increased from 8 to 13 kb. we've noted that s...
...And 9 more matches
Binding Attachment and Detachment - Archive of obsolete content
f the binding document's url and the binding's document-unique identifier. in the following example, a binding is referenced that will be attached to all html checkbox elements. input[type="checkbox"] { -moz-binding: url("http://www.mozilla.org/xbl/htmlbindings.xml#checkbox"); } bindings attached through css will only remain on the bound element as long as the element continues to match the style rule. if at any time a resolution of style on the element determines that a different binding should be attached, the old binding (and all bindings that it explicitly extends in its inheritance chain) will be detached. no bindings will be attached to elements that match the style rule, but are inside an element that has style display:none set. see bug 307098. whenever an element is removed from...
...hed, the old binding (and all bindings that it explicitly extends in its inheritance chain) will be detached. no bindings will be attached to elements that match the style rule, but are inside an element that has style display:none set. see bug 307098. whenever an element is removed from a document, any bindings attached via css loaded by the document will be detached. attachment using element.style property none of the xbl inheritance properties of element.style.mozbinding described here are implemented (if ever). bindings can be attached to elements through the scripting by assigning the element.style.mozbinding property. respectively bindings can be detached by setting element.style.mozbinding to empty string. note: some older papers mentioned dom methods document.addbinding and docu...
...scripts that invoke this method should not assume that the binding is installed immediately after this method returns. see binding documents for more information. ...
...And 9 more matches
Table Reflow Internals - Archive of obsolete content
ing (the frame tree contains only viewport, scroll(s), canvas, html, body). the initial chunk of an xml doc is loaded. the initial chunk of an html doc (or a subsequent chunk of an xml doc) is loaded. the container posts a dirty reflow command with itself as the target. content is inserted, appended, or deleted through the dom. the container posts a dirty reflow command with itself as the target. style changes through the dom - javascript, browser change font (ctrl+/-), a preference changes, etc. review of reflow reflow starts with pres shell which reflows the reflow root (usually the viewport frame), which reflows it children, etc. ususally it starts when the pres shell processes its queue of reflow commands. the reflower positions reflowee (if it can) before actually reflowing in case...
...wer positions reflowee (if it can) before actually reflowing in case views are involved (e.g. absolutely positioned elements) reflows reflowee and passes a reflow state (in) and a reflow metrics (in/out) review of reflow the reflow state: is a node in a tree structurally equivalent to the frame tree of reflow participants contains: reflow type, avail size, various computed values, resolved style structs possible request for preferred size and more. review of reflow the reflow metrics contains: max element size (if requested) - the minimum size it can be preferred size (if requested) - the size it would like to be given no size constraints. desired size - the size it would like to be given the avail size. this is equivalent to preferred size if the avail size is not constrained. ...
...sm. kinds of reflows initial - reflowee's first reflow must be of this type (reflower's responsibility). resize - reflowee gets a change in available space only. similar to initial, except it can reoccur. incremental - has a reflow path (tree) where each node has a command with a target frame, reflow command types are: dirty - something changed inside a target (e.g. ...
...And 9 more matches
Browser Detection and Cross Browser Support - Archive of obsolete content
ide detection strategy can be found in the ultimate browser sniffer. this script and variants of it can be found today on many web sites where it is a common source of detection problems. netscape navigator 4 and internet explorer 4 introduced the ability to manipulate html content in a browser (dynamic html or dhtml) rather than on the web server and began the introduction of support for css to style content. this generation of browser, in addition to sharing several features which were not available in earlier versions, each implemented their own (incompatible) competing abilities to manipulate content in a web page. since each vendor's browser implemented different objects to perform dhtml, web authors began to use object detection to distinguish vendor/version through the existence of par...
...gly advise everyone to avoid this trap. problems caused by inappropriate browser detection excluding unknown browsers if you only provide tests for specific browsers in your detection logic, your site will not be usable if a visitor uses a different browser. consider the following example: // wrong approach - do not use! if (document.all) { // internet explorer 4+ document.write('<link rel="stylesheet" type="text/css" src="style-ie.css">'); } else if (document.layers) { // navigator 4 document.write('<link rel="stylesheet" type="text/css" src="style-nn.css">'); } note how the above example only provided stylesheets for internet explorer and navigator 4 and even then only if the visitor has javascript support turned on in their browser. users of netscape 6, netscape 7, compuserve 7, mozi...
...lorer features not available in // other browsers. </script> </body> </html> using netscape navigator 4's css limitations it is possible to use netscape navigator 4's limitations for css support to automatically exclude certain css rules from ever being seen by navigator 4. ...
...And 9 more matches
Manipulating documents - Learn web development
uage, a media stream from the user's webcam, etc. the document (represented by the dom in browsers) is the actual page loaded into the window, and is represented in javascript by the document object. you can use this object to return and manipulate information on the html and css that comprises the document, for example get a reference to an element in the dom, change its text content, apply new styles to it, create new elements and add them to the current element as children, or even delete it altogether. in this article we'll focus mostly on manipulating the document, but we'll show a few other useful bits besides. the document object model the document currently loaded in each one of your browser tabs is represented by a document object model. this is a "tree structure" representation c...
...nkpara); when you want to remove a node based only on a reference to itself, which is fairly common, you can use childnode.remove(): linkpara.remove(); this method is not supported in older browsers. they have no method to tell a node to remove itself, so you'd have to do the following. linkpara.parentnode.removechild(linkpara); have a go at adding the above lines to your code. manipulating styles it is possible to manipulate css styles via javascript in a variety of ways. to start with, you can get a list of all the stylesheets attached to a document using document.stylesheets, which returns an array-like object with cssstylesheet objects. you can then add/remove styles as wished. however, we're not going to expand on those features because they are a somewhat archaic and difficult way...
...le to manipulate css styles via javascript in a variety of ways. to start with, you can get a list of all the stylesheets attached to a document using document.stylesheets, which returns an array-like object with cssstylesheet objects. you can then add/remove styles as wished. however, we're not going to expand on those features because they are a somewhat archaic and difficult way to manipulate style. there are much easier ways. the first way is to add inline styles directly onto elements you want to dynamically style. this is done with the htmlelement.style property, which contains inline styling information for each element in the document. you can set properties of this object to directly update element styles. ...
...And 9 more matches
Examine and edit CSS - Firefox Developer Tools
a new rule; change the display based on the color scheme preference (as of firefox 72, you must set devtools.inspector.color-scheme-simulation.enabled to true in the configuration editor to enable this feature); change the display based on print media rules. a warning icon appears next to unsupported css properties or rules that have invalid values. this can help you understand why certain styles are not being applied. in the following example, a spelling error, "background-colour" instead of "background-color" has made the rule invalid: rule display it displays each rule as in a stylesheet, with a list of selectors followed by a list of property:value; declarations. highlight matched elements: next to the selector is a target icon: click this to highlight all nodes in the page ...
... can use this to toggle the declaration on or off. filename and line number: on the right-hand side is a link to the rule. see link to css file. if the element has a display: grid declaration, then it gets a grid icon next to it, like this: . click that icon to display the grid overlaid on the page, including grid lines and tracks. see examine grid layouts for more on this. ...
...r: on the right-hand side is a link to the rule. see link to css file. if the element has a display: grid declaration, then it gets a grid icon next to it, like this: . click that icon to display the grid overlaid on the page, including grid lines and tracks. see examine grid layouts for more on this. to view user-agent styles (i.e., browser-default css rules), enable "inspector > show browser styles" under the developer tool settings panel. (note that this setting is independent of the "browser styles" checkbox in the computed view.) user-agent styles are displayed against a different background, and the link to the filename and line number contains the prefix (user agent): element {} rule the element {} rule at the top of the rules list isn't actually a css rule. it represents the css...
...And 9 more matches
CSS Object Model (CSSOM) - Web APIs
the css object model is a set of apis allowing the manipulation of css from javascript. it is much like the dom, but for the css rather than the html. it allows users to read and modify css style dynamically. ...
... the css object model is a set of apis allowing the manipulation of css from javascript. it is much like the dom, but for the css rather than the html. it allows users to read and modify css style dynamically. ...
... than the html. it allows users to read and modify css style dynamically. ...
...And 9 more matches
Document - Web APIs
Web › API › Document
the document interface represents any web page loaded in the browser and serves as an entry point into the web page's content, which is the dom tree. the dom tree includes elements such as <body> and <table>, among many others. it provides functionality globally to the document, like how to obtain the page's url and create new elements in the document. ...
... the dom tree. the dom tree includes elements such as <body> and <table>, among many others. it provides functionality globally to the document, like how to obtain the page's url and create new elements in the document. ...
...urrent document. document.headread only returns the <head> element of the current document. document.hiddenread only returns a boolean value indicating if the page is considered hidden or not. document.imagesread only returns a list of the images in the current document. document.implementationread only returns the dom implementation associated with the current document. document.laststylesheetsetread only returns the name of the style sheet set that was last enabled. has the value null until the style sheet is changed by setting the value of selectedstylesheetset. document.linksread only returns a list of all the hyperlinks in the document. document.mozsyntheticdocument returns a boolean that is true only if this document is synthetic, such as a standalone image, video, a...
...And 9 more matches
HTML documentation index - HTML: Hypertext Markup Language
Web › HTML › Index
y, storage, data html provides a crossorigin attribute for images that, in combination with an appropriate cors header, allows images defined by the <img> element that are loaded from foreign origins to be used in a <canvas> as if they had been loaded from the current origin. 3 applying color to html elements using css beginner, css, css colors, guide, html, html colors, html styles, styling html, color with css, there are lots of ways to add color to your html elements to create just the look you want. this article is a primer introducing each of the ways css color can be used in html. 4 block-level elements beginner, development, guide, html, html5, web html (hypertext markup language) elements historically were categorized as either "block-leve...
...tten in, or the language that the editable elements should be written in by the user. the attribute contains a single “language tag” in the format defined in tags for identifying languages (bcp47). 27 part global attributes, html, reference, part the part global attribute contains a space-separated list of the part names of the element. part names allows css to select and style specific elements in a shadow tree via the ::part pseudo-element. 28 slot global attributes, html, reference the slot global attribute assigns a slot in a shadow dom shadow tree to an element: an element with a slot attribute is assigned to the slot created by the <slot> element whose name attribute's value matches that slot attribute's value. 29 spellcheck glo...
...a shadow dom shadow tree to an element: an element with a slot attribute is assigned to the slot created by the <slot> element whose name attribute's value matches that slot attribute's value. 29 spellcheck global attributes, html, reference the spellcheck global attribute is an enumerated attribute defines whether the element may be checked for spelling errors. 30 style global attributes, html, reference the style global attribute contains css styling declarations to be applied to the element. note that it is recommended for styles to be defined in a separate file or files. this attribute and the <style> element have mainly the purpose of allowing for quick styling, for example for testing purposes. 31 tabindex global attributes, html, r...
...And 9 more matches
Populating the page: how browsers work - Web Performance
response once we have an established connection to a web server, the browser sends an initial http get request on behalf of the user, which for websites is most often an html file. once the server receives the request, it will reply with relevant response headers and the contents of the html. <!doctype html> <html> <head> <meta charset="utf-8"/> <title>my simple page</title> <link rel="stylesheet" src="styles.css"/> <script src="myscript.js"></script> </head> <body> <h1 class="heading">my page</h1> <p>a paragraph with a <a href="https://example.com/about">link</a></p> <div> <img src="myimage.jpg" alt="image description"/> </div> <script src="anotherscript.js"></script> </body> </html> this response for this initial request contains the first byte of data received. ti...
...pt, and web fonts. thanks to the preload scanner, we don't have to wait until the parser finds a reference to an external resource to request it. it will retrieve resources in the background so that by the time the main html parser reaches requested assets, they may possibly already be in flight, or have been downloaded. the optimizations the preload scanner provides reduce blockages. <link rel="stylesheet" src="styles.css"/> <script src="myscript.js" async></script> <img src="myimage.jpg" alt="image description"/> <script src="anotherscript.js" async></script> in this example, while the main thread is parsing the html and css, the preload scanner will find the scripts and image, and start downloading them as well. to ensure the script doesn't block the process, add the async attribute, or t...
...nloading, but it does block javascript, because javascript is often used to query css properties’ impact on elements. building the cssom the second step in the critical rendering path is processing css and building the cssom tree. the css object model is similar to the dom. the dom and cssom are both trees. they are independent data structures. ...
...And 9 more matches
Using templates and slots - Web Components
ent; const shadowroot = this.attachshadow({mode: 'open'}) .appendchild(templatecontent.clonenode(true)); } } ); the key point to note here is that we append a clone of the template content to the shadow root, created using the node.clonenode() method. ...
...one of the template content to the shadow root, created using the node.clonenode() method. and because we are appending its contents to a shadow dom, we can include some styling information inside the template in a <style> element, which is then encapsulated inside the custom element. this wouldn't work if we just appended it to the standard dom. ...
... because we are appending its contents to a shadow dom, we can include some styling information inside the template in a <style> element, which is then encapsulated inside the custom element. this wouldn't work if we just appended it to the standard dom. so for example: <template id="my-paragraph"> <style> p { color: white; background-color: #666; padding: 5px; } </style> <p>my paragraph</p> </template> now we can use it by just adding it to our html document: <my-paragraph></my-paragraph> note: templates are well-supported in browsers; the shadow dom api is supported by default in firefox (version 63 onwards), chrome, opera, safari, and edge (starting with version 79). adding flexibility with slots so far so good, but the element isn't very flexible. w...
...And 9 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
a csp (content security policy) is used to detect and mitigate certain types of website related attacks like xss and data injections. 54 csrf glossary, security csrf (cross-site request forgery) is an attack that impersonates a trusted user and sends a website unwanted commands. 55 css css, codingscripting, glossary, web, l10n:priority css (cascading style sheets) is a declarative language that controls how webpages look in the browser. 56 css object model (cssom) css, cssom, dom, glossary, web performance the css object model (cssom) is a map of all css selectors and relevant properties for each selector in the form of a tree, with a root node, sibling, descendant, child, and other relationship. the cssom is very similar to th...
...audio-visual presentation) audio, glossary, media, multimedia, video the term media (more accurately, multimedia) refers to audio, video, or combined audio-visual material such as music, recorded speech, movies, tv shows, or any other form of content that is presented over a period of time. 265 media (css) css, glossary, intro, media in the context of css (cascading style sheets), the term media refers to the destination to which the document is to be drawn by the rendering engine. 266 metadata codingscripting, glossary, html, metadata metadata is — in its very simplest definition — data that describes data. for example, an html document is data, but html can also contain metadata in its <head> element that describes the document — for ...
...f the data that is being exchanged. the set of rules that defines a format is called a protocol. 340 prototype apps, composing, glossary a prototype is a model that displays the appearance and behavior of an application or product early in the development lifecycle. 341 prototype-based programming codingscripting, glossary prototype-based programming is a style of object-oriented programming in which classes are not explicitly defined, but rather derived by adding properties and methods to an instance of another class or, less frequently, adding them to an empty object. in simple words: this type of style allows the creation of an object without first defining its class. 342 proxy server glossary, proxy, server a proxy server is ...
...And 8 more matches
Getting started with HTML - Learn web development
tart of the line. to close the element, put the closing tag </em> at the end of the line. doing this should give the line italic text formatting! see your changes update live in the output area. if you make a mistake, you can clear your work using the reset button. if you get really stuck, press the show solution button to see the answer. playable code <h2>live output</h2> <div class="output" style="min-height: 50px;"> </div> <h2>editable code</h2> <p class="a11y-label">press esc to move focus away from the code area (tab inserts a tab character).</p> <textarea id="code" class="playable-code" style="min-height: 100px;width: 95%"> this is my text. </textarea> <div class="controls"> <input id="reset" type="button" value="reset" /> <input id="solution" type="button" value="show soluti...
...ealityripple.com/samples/d5/2be21e0477.png"> this would output the following: note: empty elements are sometimes called void elements. attributes elements can also have attributes. attributes look like this: attributes contain extra information about the element that won't appear in the content. in this example, the class attribute is an identifying name used to target the element with style information. an attribute should have: a space between it and the element name. (for an element with more than one attribute, the attributes should be separated by spaces too.) the attribute name, followed by an equal sign. an attribute value, wrapped with opening and closing quote marks. active learning: adding attributes to an element another example of an element is <a>. this stands f...
...ue of the title attribute, and when clicked, navigates to the web address in the href attribute. remember that you need to include a space between the element name, and between each attribute. if you make a mistake, you can always reset it using the reset button. if you get really stuck, press the show solution button to see the answer. ...
...And 8 more matches
Getting started with Svelte - Learn web development
vascript, generating optimal javascript code without any runtime overhead. to achieve this, svelte extends vanilla web technologies in the following ways: it extends html by allowing javascript expressions in markup and providing directives to use conditions and loops, in a fashion similar to handlebars. it extends css by adding a scoping mechanism, allowing each component to define their own styles without the risk of clashing with other component's styles. it extends javascript by reinterpreting specific directives of the language to achieve true reactivity and ease component state management. the compiler only intervenes in very specific situations and only in the context of svelte components. extensions to the javascript language are minimal and carefully picked in order to not break...
...to the body of our html page. public: this directory contains all the files that will be published in production. favicon.png: this is the favicon for your app. currently, it's the svelte logo. index.html: this is the main page of your app. initially it's just an empty html5 page that loads the css files and js bundles generated by svelte. global.css: this file contains unscoped styles. it's a regular css file that will be applied to the whole application. build: this folder contains the generated css and javascript source code. bundle.css: the css file that svelte generated from the styles defined for each component. bundle.js: the javascript file compiled from all your javascript source code. having a look at our first svelte component comp...
... bundle.css: the css file that svelte generated from the styles defined for each component. bundle.js: the javascript file compiled from all your javascript source code. having a look at our first svelte component components are the building blocks of svelte applications. they are written into .svelte files using a superset of html. all three sections — <script>, <styles>, and markup — are optional, and can appear in any order you like. <script> // logic goes here </script> <style> /* styles go here */ </style> <!-- markup (zero or more html elements) goes here --> note: for more information on the component format, have a look at the svelte documentation. with this in mind, let's have a look at the src/app.svelte file that came with the starter tem...
...And 8 more matches
Building the WebLock UI
browser component, where it will provide a small icon the user can click to access the web lock interface. weblock indicator in browser user interface package list the user interface described in this section is comprised of four files: weblockoverlay.xul is the file that defines the little status icon in the browser. weblock.xul defines the web lock manager dialog. weblock.css provides style rules for both of the xul files. weblock.js provides javascript functions for both of the xul files. each of these files is described briefly in the sections below. in the following chapter we'll describe how you can take these files and create a package, an installable archive that includes the weblock component and the new ui. because this step (particularly the overlay section) is so depen...
...l xul document in which the user interface for the dialog and the events that initiate interaction with the web locking are defined. at the top of all xul documents, an xml declaration is followed by the root element for the document, which is usually <window/> but for dialog boxes can also be the element <dialog/>. ...
..." for the xul file, then, looks like this: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <dialog id="weblock_ui" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" title="web lock manager" persist="screenx screeny" screenx="24" screeny="24"> </dialog> note that this part of the xul file also contains a stylesheet declaration, which imports css rules and applies them to particular parts of the interface. in gecko, css is used to do virtually all of the presentation of the xul interface - its color, position, style, and to some extent its behavior as well. the web lock manager dialog does not deviate from the look of a standard dialog, so it can use a single declaration to import the "global" skin from...
...And 8 more matches
Using the CSS Painting API - Web APIs
the css paint api is designed to enable developers to programmatically define images which can then be used anywhere a css image can be invoked, such as css background-image, border-image, mask-image, etc. to programmatically create an image used by a css stylesheet we need to work through a few steps: define a paint worklet using the registerpaint() function register the worklet include the paint() css function to elaborate over these steps, we're going to start by creating a half-highlight background, like on this header: css paint worklet in an external script file, we employ the registerpaint() function to name our css paint worklet. it takes two parameters. the first is the name we give the worklet — this is the name we will use in our css as the parameter of the pain...
...eaderhighlight', class { /* define if alphatransparency is allowed alpha is set to true by default. if set to false, all colours used on the canvas will be fully opaque */ static get contextoptions() { return { alpha: true }; } /* ctx is the 2d drawing context a subset of the html5 canvas api. */ paint(ctx) { ctx.fillstyle = 'hsla(55, 90%, 60%, 1.0)'; ctx.fillrect(0, 15, 200, 20); /* order: x, y, w, h */ } }); in this class example we have defined a single context option with the contextoptions() function: we returned a simple object stating alpha transparency is allowed. we have then used the paint() function to paint to our canvas. a paint() function can take three arguments. here we have provide...
...ontext (we'll look at more in due course), often refered to by the variable name ctx. the 2d rendering context is a subset of the html5 canvas api; the version available to houdini (called the paintrenderingcontext2d) is a further subset containing most of the features available in the full canvas api with the exception of the canvasimagedata, canvasuserinterface, canvastext, and canvastextdrawingstyles apis. we define the fillstyle as being hsla(55, 90%, 60%, 1.0), which is a shade of yellow, and then call fillrect() to create a rectangle of that color. the fillrect() parameters are, in order, x-axis origin, y-axis origin, width, and height. fillrect(0, 15, 200, 20) results in the creation of a rectangle that is 200 units wide by 20 units tall, positioned 0 units from the left and 15 units fr...
...And 8 more matches
Advanced animations - Web APIs
the ball, we will create a ball object which contains properties and a draw() method to paint it on the canvas. var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); var ball = { x: 100, y: 100, radius: 25, color: 'blue', draw: function() { ctx.beginpath(); ctx.arc(this.x, this.y, this.radius, 0, math.pi * 2, true); ctx.closepath(); ctx.fillstyle = this.color; ctx.fill(); } }; ball.draw(); nothing special here, the ball is actually a simple circle and gets drawn with the help of the arc() method. adding velocity now that we have a ball, we are ready to add a basic animation like we have learned in the last chapter of this tutorial. again, window.requestanimationframe() helps us to control the animation. the ball gets moving by a...
...n. for each frame, we also clear the canvas to remove old circles from prior frames. ...
...irection of the velocity vectors. to do so, we add the following checks to the draw method: if (ball.y + ball.vy > canvas.height || ball.y + ball.vy < 0) { ball.vy = -ball.vy; } if (ball.x + ball.vx > canvas.width || ball.x + ball.vx < 0) { ball.vx = -ball.vx; } first demo let's see how it looks in action so far. move your mouse into the canvas to start the animation. ...
...And 8 more matches
Compositing example - Web APIs
vas canvas1.width = width; canvas1.height = height; canvas2.width = width; canvas2.height = height; lightmix() colorsphere(); runcomposite(); return; }; and this code, runcomposite(), handles the bulk of the work, relying on a number of utility functions to do the hard parts. ...
...ight; canvas2.width = width; canvas2.height = height; lightmix() colorsphere(); runcomposite(); return; }; and this code, runcomposite(), handles the bulk of the work, relying on a number of utility functions to do the hard parts. ...
....height = height; lightmix() colorsphere(); runcomposite(); return; }; and this code, runcomposite(), handles the bulk of the work, relying on a number of utility functions to do the hard parts. ...
...And 8 more matches
HTML elements reference - HTML: Hypertext Markup Language
Web › HTML › Element
n the introduction to html article. main root element description <html> the html <html> element represents the root (top-level element) of an html document, so it is also referred to as the root element. all other elements must be descendants of this element. document metadata metadata contains information about the page. this includes information about styles, scripts and data to help software (search engines, browsers, etc.) use and render the page. metadata for styles and scripts may be defined in the page or link to another file that has the information. element description <base> the html <base> element specifies the base url to use for all relative urls in a document. <head> the html <head> element ...
...adata for styles and scripts may be defined in the page or link to another file that has the information. element description <base> the html <base> element specifies the base url to use for all relative urls in a document. <head> the html <head> element contains machine-readable information (metadata) about the document, like its title, scripts, and style sheets. <link> the html external resource link element (<link>) specifies relationships between the current document and an external resource. this element is most commonly used to link to stylesheets, but is also used to establish site icons (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things. <meta> the html <meta>...
... <title> the html title element (<title>) defines the document's title that is shown in a browser's title bar or a page's tab. ...
...And 8 more matches
HTTP Index - HTTP
Web › HTTP › Index
the accept request http header advertises which content types, expressed as mime types, the client is able to understand. using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice with the content-type response header. browsers set adequate values for this header depending on the context where the request is done: when fetching a css stylesheet a different value is set for the request than when fetching an image, video or a script. 48 accept-ch client hints, http, http header the accept-ch header is set by the server to specify which client hints headers client should include in subsequent requests. 49 accept-ch-lifetime client hints, http, header the accept-ch-lifetime header is set by the...
... the content security policy. these violation reports consist of json documents sent via an http post request to the specified uri. 96 csp: require-sri-for csp, directive, http, reference, security, subresource integrity, require-sri-for the http content-security-policy require-sri-for directive instructs the client to require the use of subresource integrity for scripts or styles on the page. 97 csp: sandbox csp, content-security-policy, directive, http, sandbox, security the http content-security-policy (csp) sandbox directive enables a sandbox for the requested resource similar to the <iframe> sandbox attribute. it applies restrictions to a page's actions including preventing popups, preventing the execution of plugins and scripts, and enforcing a ...
...ame-origin policy. 98 csp: script-src csp, content, content-security-policy, directive, http, reference, script, security, script-src, source the http content-security-policy (csp) script-src directive specifies valid sources for javascript. this includes not only urls loaded directly into <script> elements, but also things like inline script event handlers (onclick) and xslt stylesheets which can trigger script execution. 99 csp: script-src-attr csp, content, content-security-policy, directive, http, reference, script, security, script-src, source the http content-security-policy (csp) script-src-attr directive specifies valid sources for javascript inline event handlers. this includes only inline script event handlers like onclick, but not urls loaded...
...And 8 more matches
Elements - Archive of obsolete content
n. each binding child element defines a unique binding that can be attached to elements in other documents. an element can have only one binding attached (explicitly or inherited) at one moment. from several bindings only the last in the sequence will be used (like with any css rule). ...
...nt can have only one binding attached (explicitly or inherited) at one moment. from several bindings only the last in the sequence will be used (like with any css rule). ...
...(see bug 83830 for <table> specifics). css: div { -moz-binding: url(mybinding.xml#default); } dom: el...
...And 7 more matches
Creating toolbar buttons (Customize Toolbar Window) - Archive of obsolete content
.tooltip;" onclick="myextension.onclick(event);"/> </toolbarpalette> onclick: function(event) { switch(event.button) { case 0: // left click break; case 1: // middle click break; case 2: // right click break; } } to add more buttons, put more <toolbarbutton> elements inside the <toolbarpalette> element. wrap elements other than <toolbarbutton> in <toolbaritem>. adding the button bootstrap style adding a button to the browserpalette on runtime in a bootstrap addon is a bit different because the browserpalette is indirectly reached. a simple document.getelementbyid('browsertoolbarpalette') will not work. this is the code to create and add it in. let button = doc.createelement("toolbarbutton"); button.setattribute("id", button_id); button.setattribute("label", "replace bookmark"); button...
... document.getelementbyid('browsertoolbarpalette') will not work. this is the code to create and add it in. let button = doc.createelement("toolbarbutton"); button.setattribute("id", button_id); button.setattribute("label", "replace bookmark"); button.setattribute("class", "toolbarbutton-1 chromeclass-toolbar-additional"); button.setattribute("tooltiptext", "replace an existing bookmark"); button.style.liststyleimage = "url(" + icon + ")"; button.addeventlistener("command", main.action, false); toolbox.palette.appendchild(button); this code is thanks to dgutov and is seen in full context at his repository here at github: dgutov / bmreplace / bootstrap.js. watch for a snippet that you can copy and paste into scratchpad, and then run on gists@github here: _ff-addon-snippet-addtoolbarbuttontopal...
...to provide two icons for each of your toolbar buttons. ...
...And 7 more matches
HTML table basics - Learn web development
Learn › HTML › Tables › Basics
css applied. be under no illusion; for tables to be effective on the web, you need to provide some styling information with css, as well as good solid structure with html. in this module we are focusing on the html part; to find out about the css part you should visit our styling tables article after you've finished here. we won't focus on css in this module, but we have provided a minimal css stylesheet for you to use that will make your tables more readable than the default you get without any styling. you can find the stylesheet here, and you can also find an html template that applies the stylesheet — these together will give you a good starting point for experimenting with html tables. when should you not use html tables? html tables should be used for tabular data — this is what ...
...s. these exist because it can be a bit annoying and inefficient having to specify styling on columns — you generally have to specify your styling information on every <td> or <th> in the column, or use a complex selector such as :nth-child(). note: styling columns like this is limited to a few properties: border, background, width, and visibility. ...
...<td> or <th> in the column, or use a complex selector such as :nth-child(). note: styling columns like this is limited to a few properties: border, background, width, and visibility. to set other properties you'll have to either style every <td> or <th> in the column, or use a complex selector such as :nth-child(). ...
...And 7 more matches
Beginning our React todo list - Learn web development
he mouse or keyboard. delete any task, using the mouse or keyboard. edit any task, using the mouse or keyboard. view a specific subset of tasks: all tasks, only the active task, or only the completed tasks. we'll tackle these stories one-by-one. pre-project housekeeping create-react-app has made a few files we won't be using at all for our project. we're not going to write per-component stylesheets, so first delete the app.css import from the top of app.js. we are also not going to be using the logo.svg file, so remove that import too. then, copy and paste the following commands into your terminal to delete some unneeded files. make sure you’re starting in the app's root directory! # move into the src directory of your project cd src # delete a few files rm -- app.test.js app.cs...
... cd .. notes: two of the files we’re deleting are for testing the application. we will not cover testing here. if you stopped your server to do the terminal tasks mentioned above, you’ll have to start it again using npm start. project starter code as a starting point for this project, we're going to provide two things: an app() function to replace the one you have now, and some css to style your app. the jsx copy the following snippet to your clipboard, then paste it into app.js so that it replaces the existing app() function: function app(props) { return ( <div classname="todoapp stack-large"> <h1>todomatic</h1> <form> <h2 classname="label-wrapper"> <label htmlfor="new-todo-input" classname="label__lg"> what needs to be done? ...
...den">repeat</span> </button> </div> </li> </ul> </div> ); } now open public/index.html and change the <title> element’s text to todomatic. this way, it will match the <h1> at the top of our app. <title>todomatic</title> when your browser refreshes, you should see something like this: it's ugly, and doesn’t function yet, but that's okay — we'll style it in a moment. first, consider the jsx we have, and how it corresponds to our user stories: we have a <form> element, with an <input type="text"> for writing out a new task, and a button to submit the form. we have an array of buttons that will be used to filter our tasks. we have a heading that tells us how many tasks remain. we have our 3 tasks, arranged in an un-ordered list. each task ...
...And 7 more matches
CustomizableUI.jsm
he items in a customizable area. note that these are also abstract cross-window objects; customizableui will manage the actual dom manipulation involved with adding/moving/removing widgets in all windows for you. there are three main types of widgets: 'legacy' xul widgets, which are the way customizableui represents widgets whose dom representation is present (or overlaid) into a window; api-style widgets, which are the new widgets customizableui can create and manage for you. these come in 3 types themselves: button which are simple toolbar buttons which do something when clicked view which are toolbar buttons with a 'view' of further options. the view can be shown as its own panel when such a widget is in the toolbar, or as a sliding 'subview' of the menu panel when such a...
...ments you want to obtain. return value an array containing the widget ids that are in the area. getwidgetsinarea() get an array of widget wrappers for all the widgets in an area. this is the same as calling getwidgetidsinarea and .map()-ing the result through customizableui.getwidget. careful: this means that if there are ids in there which don't have corresponding dom nodes (like in the old-style currentset attribute), there might be nulls in this array, or items for which wrapper.forwindow(win) will return null. nb: will throw if called too early (before placements have been fetched) or if the area is not currently known to customizableui. parameters aarea the id of the area whose widgets you want to obtain. return value an array containing the widget wrappers and/or null values...
... var mywidgetlistener = { onwidgetadded: function(awidgetid, aarea, aposition) { console.log('a widget moved to an area, arguments:...
...And 7 more matches
nsIXSLTProcessor
ko 1.7 implemented by: @mozilla.org/document-transformer;1?type=xslt. ...
...@mozilla.org/document-transformer;1?type=xslt. ...
...n domstring namespaceuri, in domstring localname, in nsivariant value); nsidomdocument transformtodocument(in nsidomnode source); nsidomdocumentfragment transformtofragment(in nsidomnode source, in nsidomdocument output); methods clearparameters() removes all set parameters from this nsixsltprocessor. this will make the processor use the default-value for all parameters as specified in the stylesheet. void clearparameters(); parameters none. getparameter() gets a parameter if previously set by setparameter(). returns null otherwise. nsivariant getparameter( in domstring namespaceuri, in domstring localname ); parameters namespaceuri the namespaceuri of the xslt parameter. localname the local name of the xslt parameter. return value an nsivariant containing the value of the parame...
...And 7 more matches
Timing element visibility with the Intersection Observer API - Web APIs
hout the intersection observer api, this winds up being done using intervals and timeouts for each individual ad, or other techniques that tend to slow the page down. using this api lets everything get streamlined by the browser to reduce the impact on performance substantially. let's get started! site structure: the html the site's structure is not too complicated. ...
...he top is the site's header region, contained within a <header> block. below that, we define the site's sidebar as a list of links within an <aside> block. finally comes the main body. we start with an empty <main> element here. this box will be populated using script later. styling the site with css with the structure of the site defined, we turn to the styling for the site. let's look at the style for each component of the page individually. the basics we provide styles for the <body> and <main> elements to define the site's background as well as the grid the various parts of the site will be placed in. body { font-family: "open sans", "arial", "helvetica", sans-serif; background-color: aliceblue; } .wrapper { display: grid; grid-template-columns: auto minmax(min-content, 1fr);...
...re sized the same way as the columns: the first one is automatically sized and the one uses the remaining space, but at least enough space to provide room for all elements within it. the wrapper's width is fixed at 700px so that it will fit in the available space when presented inline on mdn below. the header the header is fairly simple, since for this example all it contains is some text. its style looks like this: header { grid-column: 1 / -1; grid-row: 1; background-color: aliceblue; } grid-row is set to 1, since we want the header to be placed in the top row of the site's grid. more interesting is our use of grid-column here; here we specify that we want the column to start in the first column and ends in the first column past the last grid line—in other words, the header spans...
...And 7 more matches
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
a primer introducing each of the ways css color can be used in html. fortunately, adding color to your html is actually really easy to do, and you can add color to nearly anything. we're going to touch on most of what you'll need to know when using color, including a list of what you can color and what css properties are involved, how you describe colors, and how to actually use colors both in stylesheets and in scripts. we'll also take a look at how to let the user pick a color. then we'll wrap things up with a brief discussion of how to use color wisely: how to select appropriate colors, keeping in mind the needs of people with differing visual capabilities. things that can have color at the element level, everything in html can have color applied to it. instead, let's look at things in...
...enerally used as a focus indicator, to show which element will receive input events. borders any element can have a border drawn around it. a basic element border is a line drawn around the edges of the element's content. see box properties in the box model to learn about the relationship between elements and their borders, and the article styling borders using css to learn more about applying styles to borders. you can use the border shorthand property, which lets you configure everything about the border in one shot (including non-color features of borders, such as its width, style (solid, dashed, etc.), and so forth. border-color specifies a single color to use for every side of the element's border. border-left-color, border-right-color, border-top-color, and border-bottom-color l...
...s", helvetica, arial, sans-serif; border-spacing: 0; border-collapse: collapse; } th, td { border: 1px solid black; padding:4px 6px; text-align: left; } th { background-color: hsl(0, 0%, 75%); } <table> <thead> <tr> <th scope="col">color in hsl notation</th> <th scope="col">example</th> </tr> </thead> <tbody> <tr> <td><code>hsl(90deg, 100%, 50%)</code></td> <td style="background-color: hsl(90deg, 100%, 50%);">&nbsp;</td> </tr> <tr> <td><code>hsl(90, 100%, 50%)</code></td> <td style="background-color: hsl(90, 100%, 50%);">&nbsp;</td> </tr> <tr> <td><code>hsl(0.15turn, 50%, 75%)</code></td> <td style="background-color: hsl(0.15turn, 50%, 75%);">&nbsp;</td> </tr> <tr> <td><code>hsl(0.15turn, 90%, 75%)</code></td> <td style="backgrou...
...And 7 more matches
Intl.NumberFormat() constructor - JavaScript
f the following properties: compactdisplay only used when notation is "compact". takes either "short" (default) or "long". currency the currency to use in currency formatting. possible values are the iso 4217 currency codes, such as "usd" for the us dollar, "eur" for the euro, or "cny" for the chinese rmb — see the current currency & funds code list. there is no default value; if the style is "currency", the currency property must be provided. currencydisplay how to display the currency in currency formatting. possible values are: "symbol" to use a localized currency symbol such as €, this is the default value, "narrowsymbol" to use a narrow format symbol ("$100" rather than "us$100"), "code" to use the iso currency code, "name" to use a localized currency name...
...u", "hanidec", "khmr", " knda", "laoo", "latn", "limb", "mlym", " mong", "mymr", "orya", "tamldec", " telu", "thai", "tibt". signdisplay when to display the sign for the number; defaults to "auto" "auto" sign display for negative numbers only "never" never display sign "always" always display sign "exceptzero" sign display for positive and negative numbers, but not zero style the formatting style to use , the default is "decimal". "decimal" for plain number formatting. "currency" for currency formatting. "percent" for percent formatting "unit" for unit formatting unit the unit to use in unit formatting, possible values are core unit identifiers, defined in uts #35, part 2, section 6. a subset of units from the full list was selected for use ...
...y formatting. "percent" for percent formatting "unit" for unit formatting unit the unit to use in unit formatting, possible values are core unit identifiers, defined in uts #35, part 2, section 6. a subset of units from the full list was selected for use in ecmascript. pairs of simple units can be concatenated with "-per-" to make a compound unit. there is no default value; if the style is "unit", the unit property must be provided. unitdisplay the unit formatting style to use in unit formatting, the defaults is "short". "long" (e.g., 16 litres) "short" (e.g., 16 l) "narrow" (e.g., 16l) usegrouping whether to use grouping separators, such as thousands separators or thousand/lakh/crore separators. possible values are true and false; the default is true. ...
...And 7 more matches
How to convert an overlay extension to restartless - Archive of obsolete content
s workaround module (n.b. as of may 29, 2017, that module does not work with packed extensions; i'm preserving the link in case the author updates the gist to fix this issue). step 5: no more internal jar files you know how i've been mentioning extractionless add-ons every once in a while thus far? well, you should probably consider switching to be extractionless when you go restartless. ...
... textbox({'id': 'coord-y', 'class': 'coord-box', 'placeholder': '0'}) ... that way you build elements hierarchy with not much interaction with dom, plus you can see tag properties and it children in a nice, structured way, just like in overlay.xul. you can find working example here. it involves using of firebug.sdk xul.js with few modifications. ...
...y', 'class': 'coord-box', 'placeholder': '0'}) ... that way you build elements hierarchy with not much interaction with dom, plus you can see tag properties and it children in a nice, structured way, just like in overlay.xul. you can find working example here. it involves using of firebug.sdk xul.js with few modifications. step 7: manually handle global css stylesheets any global css style sheets which you are using will need to be registered upon load and unregistered when your extension is unloaded. any css files used in any of your own xul files will function normally without any extra work needed. components.utils.import("resource://gre/modules/services.jsm"); var stylesheets = ["chrome://myextension/skin/mystylesheet.css"]; function startup(data,reason) { ... // load sty...
...And 6 more matches
XUL user interfaces - Archive of obsolete content
ces: xul (xml user-interface language, usually pronounced like "zool"). in xul, many common user interface features are built in. for example, xul provides specialized windows like dialogs and wizards, as well as status bars, menus, tool bars, and even browsers. more specialized features can be built from parts by using xul together with other technologies that you have seen in this tutorial: css style, javascript code, and xbl bindings. like other xml-based languages, xul uses css stylesheets. more details for more information about xul user interfaces, see the xul page in this wiki. action: a xul demonstration make a new xul document as a plain text file, doc7.xul. copy and paste the content from here, making sure that you scroll to get all of it: <?xml version="1.0"?> <?
...vascript code, and xbl bindings. like other xml-based languages, xul uses css stylesheets. more details for more information about xul user interfaces, see the xul page in this wiki. action: a xul demonstration make a new xul document as a plain text file, doc7.xul. ...
...like other xml-based languages, xul uses css stylesheets. more details for more information about xul user interfaces, see the xul page in this wiki. action: a xul demonstration make a new xul document as a plain text file, doc7.xul. ...
...And 6 more matches
CSS3 - Archive of obsolete content
it brings a lot of long-awaited novelties, like rounded corners, shadows, gradients, transitions or animations, as well as new layouts like multi-columns, flexible box or grid layouts. experimental parts are vendor-prefixed and should either be avoided in production environments, or used with extreme caution as both their syntax and semantics can change in the future. modules and the standardization process css level 2 needed 9 years, from august 2002 to june 2011 to reach the recommendation status. this was due to the fact that a few secondary features held back the whole specification. ...
...cument but also in some attributes of html elements, like the media attribute of the <link> element. the next iteration of this specification is in the work, allowing to tailor a web site regarding the input methods available on the user agent, with new media features like hover or pointer. detection of ecmascript support, using the script media features is also proposed. css style attributes recommendation since november 7th, 2013 formally defines the syntax of the content of the html style global attribute. css fonts module level 3 candidate recommendation since september 20th, 2018 amends the css2.1 font matching algorithm to be closer to what is really implemented. adds: support for downloadable fonts via th...
...tage, it plans to add the ability to clip a border (with the css border-clip, border-clip-top, border-clip-right, border-clip-bottom, and border-clip-left properties) or to control the shape of the border in a corner (using the css border-corner-shape property). css conditional rules module level 3 candidate recommendation adds features for conditional processing of parts of style sheets, conditioned on capabilities of the browser or the document the style sheet is being applied to. it consists mainly in allowing nested at-rules inside @media and the adding of a new css at-rule, @supports, and a new dom method css.supports(). css multi-column layout module working draft adds support for easy multi-column layouts using the css columns, column-cou...
...And 6 more matches
Introduction to XUL - Archive of obsolete content
e included in the file. namespaces must be treated carefully. correct namespace usage dictates that the namespace be used only for the tag, not in individual attributes. rare exceptions to this rule are bugs. xul file preamble xul is xml, and a good xul file begins with the standard xml version and doctype statements. ...
...e treated carefully. correct namespace usage dictates that the namespace be used only for the tag, not in individual attributes. rare exceptions to this rule are bugs. xul file preamble xul is xml, and a good xul file begins with the standard xml version and doctype statements. since xml has no implicit display semantics, there must always be associated stylesheets. mozilla includes a standard stylesheet, "xul.css". ...
... dictates that the namespace be used only for the tag, not in individual attributes. rare exceptions to this rule are bugs. xul file preamble xul is xml, and a good xul file begins with the standard xml version and doctype statements. since xml has no implicit display semantics, there must always be associated stylesheets. mozilla includes a standard stylesheet, "xul.css". ...
...And 6 more matches
Modifying the Default Skin - Archive of obsolete content
« previousnext » as of firefox 69, you must set the toolkit.legacyuserprofilecustomizations.stylesheets preference to true in about:config in order to load userchrome.css or usercontent.css files. this documentation has not been fully updated for firefox quantum. support for the userchrome.css file and any of its elements described below are not guaranteed in future versions of firefox. using it may lead to hard-to-diagnose bugs or crashes. use at your own risk! this section describes how to modify the skin of a window. skin basics a skin is a set of style sheets, images and behaviors that are applied to a xul file. by applying a different skin, you can change the look of a window without changing its functionality. firefox provides a skin by default, and you may download others. ...
...larger changes can be done by creating an entirely new skin. firefox has a theme manager for changing the default skin. ...
...larger changes can be done by creating an entirely new skin. ...
...And 6 more matches
Using Remote XUL - Archive of obsolete content
navigation as well as to build sophisticated web-based applications. [***aw: we should have a screenshot here of a xul document loaded in a content window***] this tutorial walks you through the process of building xul-based navigation for the mozilla.org web site. after completing the tutorial you should understand how to: create xul documents; serve them from a web server; use cascading style sheets (css) to change their appearance; use javascript to define their behavior. global web site navigation most web sites today have poor global navigation (features for locating and visiting pages across the entire site). it is difficult to discern the site's basic structure and available resources, which makes it hard to locate a particular page or find the one with the information you wa...
...defined in the xul specification, has no specific function in xul; it can store any data associated with the item. in our case we use it to store the url of the page to load when the user selects the item from the menu. source | rendered step 5: appearance there's an obvious problem with the menus: their labels look plain. this makes them ugly and not like menus at all. ...
...ion, has no specific function in xul; it can store any data associated with the item. in our case we use it to store the url of the page to load when the user selects the item from the menu. source | rendered step 5: appearance there's an obvious problem with the menus: their labels look plain. this makes them ugly and not like menus at all. ...
...And 6 more matches
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
le, and modify it to create your own simple stopwatch. you need to display a time as before, but in this example, you need: a "start" button to start the stopwatch running. a "stop" button to pause/stop it. a "reset" button to reset the time back to 0. the time display to show the number of seconds elapsed, rather than the actual time. here's a few hints for you: you can structure and style the button markup however you like; just make sure you use semantic html, with hooks to allow you to grab the button references using javascript. you probably want to create a variable that starts at 0, then increments by one every second using a constant loop. it is easier to create this example without using a date() object, like we've done in our version, but less accurate — you can't guar...
...over when the value is divided by 360) so the circle animation can continue uninterrupted, at a sensible, low value. note that this isn't strictly necessary, but it is easier to work with values of 0–359 degrees than values like "128000 degrees". if (rotatecount > 359) { rotatecount %= 360; } next, below the previous block add the following line to actually rotate the spinner: spinner.style.transform = `rotate(${rotatecount}deg)`; at the very bottom inside the draw() function, insert the following line. this is the key to the whole operation — you are setting the variable defined earlier to an active requestanimation() call, which takes the draw() function as its parameter. this starts the animation off, constantly running the draw() function at a rate as near 60 fps as poss...
... try this yourself first; if you get really stuck, check out of our live example and source code. throttling a requestanimationframe() animation one limitation of requestanimationframe() is that you can't choose your frame rate. this isn't a problem most of the time, as generally you want your animation to run as smoothly as possible. but what about when you want to create an old school, 8-bit-style animation? this was a problem, for example, in the monkey island-inspired walking animation from our drawing graphics article: in this example, you have to animate both the position of the character on the screen, and the sprite being shown. there are only 6 frames in the sprite's animation. if you showed a different sprite frame for every frame displayed on the screen by requestanimationfram...
...And 6 more matches
A first splash into JavaScript - Learn web development
ourse. with that in mind, let's look at the example we'll be building up in this article, and review the general process of dissecting it into tangible tasks. ...
...see if you can guess it in 10 turns or fewer. ...
...sfield'); let guesscount = 1; let resetbutton; function checkguess() { let userguess = number(guessfield.value); if (guesscount === 1) { guesses.textcontent = 'previous guesses: '; } guesses.textcontent += userguess + ' '; if (userguess === randomnumber) { lastresult.textcontent = 'congratulations! ...
...And 6 more matches
Starting our Svelte Todo list app - Learn web development
previous overview: client-side javascript frameworks next now that we have a basic understanding of how things work in svelte, we can start building our example app: a todo list. in this article we will first have a look at the desired functionality of our app, then we'll create a todos.svelte component and put static markup and styles in place, leaving everything ready to start developing our to-do list app features, which we'll go on to in subsequent articles. we want our users to be able to browse, add and delete tasks, and also to mark them as complete. this will be the basic functionality that we'll be developing in this tutorial series, plus we'll look at some more advanced concepts along the way too. prerequisites: at minimum, it is recommended that y...
...but let's have a look at the markup and see how it relates to our desired features: a label and a text box for entering new tasks. three buttons to filter by task status. a label showing the total number of tasks and the completed tasks. an unordered list, which holds a list item for each task. when the task is being edited, the list item has an input and t...
... class="visually-hidden">tasks</span> </button> here, aria-pressed tells assistive technology (like screen readers) that the button can be in one of two states: pressed or unpressed. think of these as analogs for on and off. setting a value of true means that the button is pressed by default. the class visually-hidden has no effect yet, because we have not included any css. once we have put our styles in place, though, any element with this class will be hidden from sighted users and still available to screen reader users — this is because these words are not needed by sighted users; they are there to provide more information about what the button does for screenreader users that do not have the extra visual context to help them. further down, you can find the following <ul> element: <ul ...
...And 6 more matches
Introduction to Layout in Mozilla
overview basic data flow key data structures detailed walk-through incrementalism future tech-talks wrap-up, q&a basic data flow source document arrives via network apis incrementally “pumped” through the single-threaded layout engine parse, compute style, render; repeat css used for rendering all content content theoretically separate from “presentation” key data structures content node elements, attributes, leaves dom frame rectangular formatting primitive geometric information [0..n] per content node 2nd thru nth are “continuations” style context non-geometric information may be shared by adjacent frames reference counted, owned by frame ...
...by frame view clipping, z-order, transparency [0..1] per frame, owned by frame widget native window [0..1] per view, owned by view key data structures the document owns the content model, and one or more presentations exposed programmatically via dom apis the presentation owns the frame hierarchy frames own the style contexts, views, widgets presentation has media type, dimensions, etc. may not be directly manipulated detailed walk-through setting up content model construction frame construction style resolution reflow painting setting up assume basic knowledge of embedding and network apis (doc shell, streams) content dll auto-registers a document loader factory (dlf) ...
... elements more buffering and fixup occurs here insertchildat, appendchildto, removechildat frame construction content sink uses nsidocument interface to notify of Δs in content model contentappended, contentinserted, contentremoved presshell is registered as document observer receives contentappended, etc. ...
...And 6 more matches
Basics
p(x) q(x) = a0 + a1x + a2 x2 + ... + an-1 xn-1 b0 + b1x + b2 x2 + ... + bn-1 xn-1 . you can also do other weird and risky things which are not portable, bongo warns, such as mixing mathml with other markups lizard + bongo = ∫ a b d x + mathml and javascript html content <p> and you can turn to javascript and the dom for dynamic operations. </p> <div style="text-align:center"> fill the gaps in this matrix with resizable input fields. </div> <math class="inputmath" display="block"> <mrow> <mi>a</mi> <mo>=</mo> <mo>[</mo> <mtable> <mtr> <mtd><mn>1</mn></mtd> <mtd> <mtext><input id="input12" value="?" size="1"/></mtext> </mtd> </mtr> <mtr> <mtd> <mtext><input id="input21" value="?" size="1"/></mtext> </mtd> <mtd><mn>4</mn></mtd> </mtr> </mtable> <mo>]...
...the gaps in this matrix with resizable input fields. ...
...2","1"); setselection("a33","1"); setselection("a41","1"); setselection("a42","1"); setselection("a43","1"); } function incrementinput(inputid, increment) { var inputelement = document.getelementbyid(inputid); var size = parseint(inputelement.size) + increment; if (size <= 0) size = 1 inputelement.size = size; } and there could be more... ...
...And 6 more matches
CSSMathSum - Web APIs
constructor cssmathsum.cssmathsum() creates a new cssmathsum object. properties cssmathsum.values returns a cssnumericarray object which contains one or more cssnumericvalue objects. event handlers no methods none. ...
...thsum.values returns a cssnumericarray object which contains one or more cssnumericvalue objects. event handlers no methods none. examples we create an element with a width determined using a calc() function, then console.log() the operator and values, and dig into the values a bit. ...
...ich contains one or more cssnumericvalue objects. event handlers no methods none. examples we create an element with a width determined using a calc() function, then console.log() the operator and values, and dig into the values a bit. ...
...And 6 more matches
CanvasRenderingContext2D - Web APIs
g point (x, y) and size (width, height) to transparent black, erasing any previously drawn content. canvasrenderingcontext2d.fillrect() draws a filled rectangle at (x, y) position whose size is determined by width and height. canvasrenderingcontext2d.strokerect() paints a rectangle which has a starting point at (x, y) and has a w width and an h height onto the canvas, using the current stroke style. ...
... canvasrenderingcontext2d.linewidth width of lines. default 1.0. canvasrenderingcontext2d.linecap type of endings on the end of lines. possible values: butt (default), round, square. canvasrenderingcontext2d.linejoin defines the type of corners where two lines meet. ...
...l, miter (default). canvasrenderingcontext2d.miterlimit miter limit ratio. default 10. canvasrenderingcontext2d.getlinedash() returns the current line dash pattern array containing an even number of non-negative numbers. canvasrenderingcontext2d.setlinedash() sets the current line dash pattern. canvasrenderingcontext2d.linedashoffset specifies where to start a dash array on a line. text styles the following properties control how text is laid out. canvasrenderingcontext2d.font font setting. default value 10px sans-serif. canvasrenderingcontext2d.textalign text alignment setting. possible values: start (default), end, left, right, center. canvasrenderingcontext2d.textbaseline baseline alignment setting. possible values: top, hanging, middle, alphabetic (default), ideographic, ...
...And 6 more matches
Transformations - Web APIs
he entire state of the canvas. restore() restores the most recently saved canvas state. canvas states are stored on a stack. every time the save() method is called, the current drawing state is pushed onto the stack. a drawing state consists of the transformations that have been applied (i.e. translate, rotate and scale – see below). the current values of the following attributes: strokestyle, fillstyle, globalalpha, linewidth, linecap, linejoin, miterlimit, linedashoffset, shadowoffsetx, shadowoffsety, shadowblur, shadowcolor, globalcompositeoperation, font, textalign, textbaseline, direction, imagesmoothingenabled. the current clipping path, which we'll see in the next section. you can call the save() method as many times as you like. each time the restore() method is called, the...
... restored. a save and restore canvas state example this example tries to illustrate how the stack of drawing states functions by drawing a set of consecutive rectangles. ...
...var ctx = document.getelementbyid('canvas').getcontext('2d'); ctx.fillrect(0, 0, 150, 150); // draw a rectangle with default settings ctx.save(); // save the default state ctx.fillstyle = '#09f'; // make changes to the settings ctx.fillrect(15, 15, 120, 120); // draw a rectangle with new settings ctx.save(); // save the current state ctx.fillstyle = '#fff'; // make changes to the settings ctx.globalalpha = 0.5; ctx.fillrect(30, 30, 90, 90); // draw a rectangle with new settings ctx.restore(); // restore previous state ctx.fillrect(45, 45, 60, 60); // draw a rectangle with restored settings ctx.restore(); // restore original state ctx.fillrect(60, 60, 30, 30); // draw a rectangle with res...
...And 6 more matches
Web Video Text Tracks Format (WebVTT) - Web APIs
- translation of that film i like note this translation was done by kyle so that some friends can watch it with their parents. 1 00:02:15.000 --> 00:02:20.000 - ta en kopp varmt te. - det är inte varmt. 2 00:02:20.000 --> 00:02:25.000 - har en kopp te. - det smakar som te. note this last line may not translate well. 3 00:02:25.000 --> 00:02:30.000 - ta en kopp styling webvtt cues you can style webvtt cues by looking for elements which match the ::cue pseudo-element. within site css video::cue { background-image: linear-gradient(to bottom, dimgray, lightgray); color: papayawhip; } video::cue(b) { color: peachpuff; } here, all video elements are styled to use a gray linear gradient as their backgrounds, with a foreground color of "papayawhip". in addition, text boldfaced using...
...lements are styled to use a gray linear gradient as their backgrounds, with a foreground color of "papayawhip". in addition, text boldfaced using the <b> element are colored "peachpuff". the html snippet below actually handles displaying the media itself. <video controls autoplay src="video.webm"> <track default src="track.vtt"> </video> within the webvtt file itself you can also define the style directly in the webvtt file. ...
...t boldfaced using the <b> element are colored "peachpuff". the html snippet below actually handles displaying the media itself. <video controls autoplay src="video.webm"> <track default src="track.vtt"> </video> within the webvtt file itself you can also define the style directly in the webvtt file. ...
...And 6 more matches
WindowOrWorkerGlobalScope.setInterval() - Web APIs
ple calls the flashtext() function once a second until the stop button is pressed. <!doctype html> <html> <head> <meta charset="utf-8" /> <title>setinterval/clearinterval example</title> <script> var nintervid; function changecolor() { nintervid = setinterval(flashtext, 1000); } function flashtext() { var oelem = document.getelementbyid('my_box'); oelem.style.color = oelem.style.color == 'red' ? 'blue' : 'red'; // oelem.style.color == 'red' ? 'blue' : 'red' is a conditional or ternary operator. } function stoptextcolor() { clearinterval(nintervid); } </script> </head> <body onload="changecolor();"> <div id="my_box"> <p>hello world</p> </div> <button onclick="stoptextcolor();">stop</button> </body> </html> examp...
...s.play = function () { if (btyping) { return; } if (bstart) { var aitems = document.queryselectorall(sselector); if (aitems.length === 0) { return; } for (var nitem = 0; nitem < aitems.length; nitem++) { asheets.push(new sheet(aitems[nitem])); /* uncomment the following line if you have previously hidden your elements via css: */ // aitems[nitem].style.visibility = "visible"; } bstart = false; } nintervid = setinterval(typewrite, this.rate); btyping = true; }; this.pause = function () { clearinterval(nintervid); btyping = false; }; this.terminate = function () { ocurrent.nodevalue += spart; spart = ""; for (nidx; nidx < asheets.length; scroll(asheets[nidx++], 0, false)); clean(); }; ...
... var otwexample1 = new typewriter(/* elements: */ '#article, h1, #info, #copyleft', /* frame rate (optional): */ 15); /* default frame rate is 100: */ var otwexample2 = new typewriter('#controls'); /* you can also change the frame rate value modifying the "rate" property; for example: */ // otwexample2.rate = 150; onload = function () { otwexample1.play(); otwexample2.play(); }; </script> <style type="text/css"> span.intlink, a, a:visited { cursor: pointer; color: #000000; text-decoration: underline; } #info { width: 180px; height: 150px; float: right; background-color: #eeeeff; padding: 4px; overflow: auto; font-size: 12px; margin: 4px; border-radius: 5px; /* visibility: hidden; */ } </style> </head> <body> <p id="copyleft" style="font-style: italic; font-si...
...And 6 more matches
Preloading content with rel="preload" - HTML: Hypertext Markup Language
ces that your page will need very soon, which you want to start loading early in the page lifecycle, before browsers' main rendering machinery kicks in. this ensures they are available earlier and are less likely to block the page's render, improving performance. this article provides a basic guide to how <link rel="preload"> works. the basics you most commonly use <link> to load a css file to style your page with: <link rel="stylesheet" href="styles/main.css"> here however, we will use a rel value of preload, which turns <link> into a preloader for any resource we want. you will also need to specify: the path to the resource in the href attribute. the type of resource in the as attribute. a simple example might look like this (see our js and css example source, and also live): <hea...
...ue of preload, which turns <link> into a preloader for any resource we want. you will also need to specify: the path to the resource in the href attribute. the type of resource in the as attribute. a simple example might look like this (see our js and css example source, and also live): <head> <meta charset="utf-8"> <title>js and css preload example</title> <link rel="preload" href="style.css" as="style"> <link rel="preload" href="main.js" as="script"> <link rel="stylesheet" href="style.css"> </head> <body> <h1>bouncing balls</h1> <canvas></canvas> <script src="main.js" defer></script> </body> here we preload our css and javascript files so they will be available as soon as they are required for the rendering of the page later on. this example is trivial, as the brow...
...for example: resources that are pointed to from inside css, like fonts or images. resources that javascript can request, like json, imported scripts, or web workers. ...
...And 6 more matches
MathML attribute reference - MathML
the xlink attributes on mathml elements: xlink:actuate, xlink:href, xlink:show and xlink:type are deprecated as well. ...
... the xlink attributes on mathml elements: xlink:actuate, xlink:href, xlink:show and xlink:type are deprecated as well. ...
...gnments of several elements (see element pages for details). unimplemented alignmentscope <mtable> a boolean value specifying whether table columns should act as alignment scopes or not. unimplemented altimg altimg-width altimg-height altimg-valign alttext <math> visual and textual fall-back options. bevelled <mfrac> specifies the style how the fraction should be displayed. deprecated. use u+2044 (fraction slash) instead. unimplemented charalign <mstack> specifies the horizontal alignment of digits. close <mfenced> a string for the closing delimiter. columnalign <mtable>, <mtd>, <mtr>, <mlabeledtr> specifies the horizontal alignment of table cells. columnlines <mtable> ...
...And 6 more matches
Boxes - Archive of obsolete content
wrapping contents in html you can use a div as a container and when the div changes size, the contents will wrap or adjust the layout. this does not happen with xul box (or hbox and vbox) by default. however, you can easily add this capability with a style change. ...
... wrapping contents in html you can use a div as a container and when the div changes size, the contents will wrap or adjust the layout. this does not happen with xul box (or hbox and vbox) by default. however, you can easily add this capability with a style change. ...
... wrapping contents in html you can use a div as a container and when the div changes size, the contents will wrap or adjust the layout. this does not happen with xul box (or hbox and vbox) by default. however, you can easily add this capability with a style change. ...
...And 5 more matches
Adding Toolbars and Toolbar Buttons - Archive of obsolete content
ird errors will begin to happen. always set the label and tooltiptext attributes of a toolbarbutton. in the case of a toolbaritem element (discussed later), use the title attribute instead of label. tooltips are very important for users that want to know what a button does before clicking it. ...
...on is done with css: #xulschoolhello-hello-world-button { list-style-image: url("chrome://xulschoolhello/skin/hello-world.png"); } it's not really that simple to set the image for a toolbar button, because we need to consider the appearance of the button on different systems, and also consider the different button states, but we'll get into that further ahead. the css file with your toolbar styles needs to be included in the overlay file, as you would expect, but also in the chrome.manifest file. this is very important because the toolbar customization dialog won't work correctly without this. ...
...systems, and also consider the different button states, but we'll get into that further ahead. the css file with your toolbar styles needs to be included in the overlay file, as you would expect, but also in the chrome.manifest file. this is very important because the toolbar customization dialog won't work correctly without this. the way to include the file in the manifest is to add this line: style chrome://global/content/customizetoolbar.xul chrome://xulschoolhello/skin/toolbar.css if you are using xbl bindings (explained way ahead) for your toolbar items, you'll have to include the css files for those as well, each in a new line like the one above. we now have code that adds one or more buttons to the toolbar palette. the user can now use the customize dialog to add the buttons to the ...
...And 5 more matches
Connecting to Remote Content - Archive of obsolete content
can also be used to extract information from web pages once they load, along with the page load interception techniques discussed previously. xpath is very useful for cases when you're receiving large and complex xml files, and you only need some of the data contained in them. using xpath to parse a complete xml document is probably not a good idea performance-wise. using xslt xslt (extensible stylesheet language transformations) is another tool used to manipulate xml documents and transform them into other forms of text output, such as html, xul, and so on. we can not cover all transformations to various output formats, so we'll just look into converting an xml document to xul. first you need to create an xslt stylesheet that acts as a template. this template will transform the xml you re...
...ansformations to various output formats, so we'll just look into converting an xml document to xul. first you need to create an xslt stylesheet that acts as a template. this template will transform the xml you receive (in our case, the example xml document above) and convert it into xul. the xslt tutorial contains details for building these templates. ...
...now, the processor is ready to perform the transformation. let domparser = components.classes["@mozilla.org/xmlextras/domparser;1"] .createinstance(components.interfaces.nsidomparser); let fi...
...And 5 more matches
Creating reusable content with CSS and XBL - Archive of obsolete content
easily reusable. note: xbl cannot be loaded over http, so this technique is only useful for local content accessed using the file:/// scheme, or from add-on code. you apply this technique in a simple demonstration. information: xbl bindings the structure provided by markup languages and css is not ideal for complex applications where parts need to be self-contained and reusable. you can place stylesheets in separate files, and you can place scripts in separate files. but you must link those files from the document as a whole. another structural limitation concerns content. you can use css to provide content for selected elements, but the content is limited to text and images, and its positioning is limited to before or after the selected element. mozilla provides a mechanism that overcomes ...
...the document as a whole. another structural limitation concerns content. you can use css to provide content for selected elements, but the content is limited to text and images, and its positioning is limited to before or after the selected element. mozilla provides a mechanism that overcomes these limitations: xbl (xml bindings language). you can use xbl to link selected elements to their own: stylesheets content properties and methods event handlers because you avoid linking everything at the document level, you can make self-contained parts that are easy to maintain and reuse. more details for more information about xbl bindings, see the xbl page in this wiki. action: an xbl demonstration make a new html document, doc6.html. copy and paste the content from here: <!
...ntained parts that are easy to maintain and reuse. more details for more information about xbl bindings, see the xbl page in this wiki. action: an xbl demonstration make a new html document, doc6.html. copy and paste the content from here: <!doctype html public "-//w3c//dtd html 4.0//en"> <html> <head> <title>mozilla css getting started - xbl demonstration</title> <link rel="stylesheet" type="text/css" href="style6.css"> </head> <body> <h1>xbl demonstration</h1> <div id="square">click me</div> </body> </html> make a new css file, style6.css. this stylesheet contains the document style. copy and paste the content from here: /*** xbl demonstration ***/ #square { -moz-binding: url("square.xbl#square"); } make a new text file, square.xbl. this file contains the xbl...
...And 5 more matches
Editor Embedding Guide - Archive of obsolete content
to a valid structure filled with relative parameters to acommand (see list below for legal params). 3. verify if a command is enabled -- iscommandenabled: commandmanager->iscommanddisabled(acommand, retval) 4. get the current command state of a given command -- getcommandstate: commandmanager->getcommandstate(acommand,acommandparams) index of commands and parameters cmd_bold toggles bold style on selection. getcommandstate "state_all"(boolean), "state_begin"(boolean), "state_end"(boolean), "state_mixed"(boolean), "state_enabled" (boolean) docommand no parameters example normal bold cmd_italics toggles italics style on selection. getcommandstate "state_all"(boolean), "state_begin"(boolean), "state_end"(boolean), "state_mixed"(boolean), "state_enabled" (boolean) docommand...
...boolean), "state_end"(boolean), "state_mixed"(boolean), "state_enabled" (boolean) docommand no parameters example normal italics cmd_underline toggles underline on selection. getcommandstate "state_all"(boolean), "state_begin"(boolean), "state_end"(boolean), "state_mixed"(boolean), "state_enabled" (boolean) docommand no parameters example normal underline cmd_tt toggles teletype style (monospace font) on selection. getcommandstate "state_all"(boolean), "state_begin"(boolean), "state_end"(boolean), "state_mixed"(boolean), "state_enabled" (boolean) docommand no parameters example normal teletype cmd_strikethrough toggles strikethrough style on selection. getcommandstate "state_all"(boolean), "state_begin"(boolean), "state_end"(boolean), "state_mixed"(boolean), "st...
... "state_mixed"(boolean), "state_enabled" (boolean) docommand no parameters example normal teletype cmd_strikethrough toggles strikethrough style on selection. getcommandstate "state_all"(boolean), "state_begin"(boolean), "state_end"(boolean), "state_mixed"(boolean), "state_enabled" (boolean) docommand no parameters example normal strikethrough cmd_superscript toggles superscript style on selection. getcommandstate "state_all"(boolean), "state_begin"(boolean), "state_end"(boolean), "state_mixed"(boolean), "state_enabled" (boolean) docommand no parameters example normal superscript cmd_subscript toggles subscript style on selection. getcommandstate "state_all"(boolean), "state_begin"(boolean), "state_end"(boolean), "state_mixed"(boolean), "state_enabled" (boolean)...
...And 5 more matches
Example Sticky Notes - Archive of obsolete content
notes.html all parts are made and commented by vk [schools_ring@yahoo.com]. all rights are given to the world. view this example <!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html401/strict.dtd"> <html> <head> <title>xbl demo : sticky notes</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <style type="text/css"> body { background-color: #ffffff; color: #000000; font: 1em verdana, sans-serif; } h1 { font-size: 1.5em; } /* binding: */ .sticker { -moz-binding: url(notes.xml#default); } </style> </head> <body> <h1><a href="http://developer.mozilla.org/en/docs/xbl:xbl_1.0_reference">xbl</a> demo : sticky notes</h1> <div class="sticker"><p>acme,&nbsp;inc. fax - respond today.</p></div> <div class="sticker"><p>don't forget t...
... </style> </head> <body> <h1><a href="http://developer.mozilla.org/en/docs/xbl:xbl_1.0_reference">xbl</a> demo : sticky notes</h1> <div class="sticker"><p>acme,&nbsp;inc. ...
... the others are only needed if you plan to handle ...
...And 5 more matches
Custom toolbar button - Archive of obsolete content
ation: this file contains information used by the application's extension manager. sections for target applications specify the versions where the extension works. the last section in the file specifies that this extension adds content to the application. 4. create a plain text file named chrome.manifest. ...
...ntent/button.xul # thunderbird address book overlay chrome://messenger/content/addressbook/addressbook.xul chrome://custombutton/content/button.xul # sunbird overlay chrome://calendar/content/calendar.xul chrome://custombutton/content/button.xul optionally remove the sections for toolbars that you do not need. save the file. explanation: this file defines the extension's content. it adds a stylesheet to the toolbar customization window. then it specifies an overlay for each toolbar. 5. create a directory named chrome. perform the following steps in that directory, creating five files there. explanation: the chrome directory contains files that specify what the extension does. 6. create a plain text file named button.xul. copy the following content, making sure that you scroll to ge...
...r. 5. create a directory named chrome. perform the following steps in that directory, creating five files there. explanation: the chrome directory contains files that specify what the extension does. 6. create a plain text file named button.xul. copy the following content, making sure that you scroll to get all of it. ...
...And 5 more matches
Adding more elements - Archive of obsolete content
og. adding elements to our find files example we will add some more elements to the find files dialog now. first, we will add the capability to search for other information such as the file size and date. <hbox> <menulist id="searchtype"> <menupopup> <menuitem label="name"/> <menuitem label="size"/> <menuitem label="date modified"/> </menupopup> </menulist> <spacer style="width: 10px;"/> <menulist id="searchmode"> <menupopup> <menuitem label="is"/> <menuitem label="is not"/> </menupopup> </menulist> <spacer style="width: 10px;"/> <textbox id="find-text" flex="1" style="min-width: 15em;"/> </hbox> two drop down boxes have been added to the dialog. a spacer has been added in between each element to separate them. these spacers have b...
...ox grows but the other components do not. you will also notice that the label was removed. if you resize the window vertically, the elements do not change size. this is because they are inside horizontal boxes. in might be more appropriate if the find and cancel buttons always stayed along the bottom of the window. this is easy to do by adding a spacer in between the two horizontal boxes. ...
...t be more appropriate if the find and cancel buttons always stayed along the bottom of the window. this is easy to do by adding a spacer in between the two horizontal boxes. ...
...And 5 more matches
Element Positioning - Archive of obsolete content
« previousnext » here we'll look at controlling the position and size of an element. box element positioning so far, we know how to position elements either horizontally or vertically inside a box. we will often need more control over the position and size of elements within the box. for this, we first need to look at how a box works. the position of an element is determined by the layout style of its container. for example, the position of a button in a horizontal box is to the right of the previous button, if any. the size of an element is determined by two factors, the size that the element wants to be and the size you specify. the size that an element wants to be is determined by what is in the element. for example, a button's width is determined by the amount of text inside the but...
...t allow you to control the size of an element. the quick way is to simply add the width and height attributes on an element, much like you might do on an html img tag. an example is shown below: example 1: source view <button label="ok" width="100" height="40"/> however, it is not recommended that you do this. it is not very portable and may not fit in with some themes. a better way is to use style properties, which work similarly to style sheets in html. the following css properties can be used. width this specifies the width of the element. note that the css global skin of the xul application may also specify a min-width for the buttons and other elements, thus if simply setting the width property does not set the button width as you expect, try also to modify the button min-width pro...
... and other elements, thus if simply setting the width property does not set the button width as you expect, try also to modify the button min-width property. height this specifies the height of the element. by setting either of the two properties, the element will be created with that width and height. if you specify only one size property, the other is calculated as needed. the size of these style properties should be specified as a number followed by a unit. flexible elements the sizes are fairly easy to calculate for non-flexible elements. they simply obey their specified widths and heights, and if the size wasn't specified, the element's default size is just large enough to fit the contents. for flexible elements, the calculation is slightly trickier. flexible elements are those that...
...And 5 more matches
tree - Archive of obsolete content
Archive › Mozilla › XUL › tree
keyboard access). ...
...hange the order in which they are displayed. firstordinalcolumn type: treecol element a reference to the first treecol element, which or may not be the first column displayed in the tree. inputfield type: textbox element read-only property that holds the textbox that is used for editing. seltype type: string gets and sets the value of the seltype attribute. selstyle type: string if set to the value primary, only the label of the primary column will be highlighted when an item in the tree is selected. otherwise, the entire row will be highlighted. to see the difference, compare the selection style in the folder list and the message list in mozilla mail. tabindex type: integer gets and sets the value of the tabindex attribu...
...etcelltext() method is called to change the cell contents). otherwise the cell label is reverted to the value it had prior to editing. related elements treecols, treecol, treechildren, treeitem, treerow, treecell and treeseparator.. ...
...And 5 more matches
treecol - Archive of obsolete content
ns to allow column resizing. you should always place an id attribute on a treecol element to ensure that the column positioning is handled properly. more information is available in the xul tutorial. attributes crop, cycler, dragging, editable, fixed, hidden, hideheader, ignoreincolumnpicker, label, primary, sort, sortactive, sortdirection, src, type, width properties accessibletype style classes treecol-image examples this example shows a checkbox in the first column, requires the style below. <tree flex="1" editable="true"> <treecols> <treecol label="active" type="checkbox" editable="true"/> <treecol label="name" flex="1" /> </treecols> <treechildren> <treeitem> <treerow> <treecell value="true"/> <treecell label="alice"/> </...
...however, chrome://global/skin/checkbox/cbox-check.gif is available in seamonkey on mac os x.. treechildren::-moz-tree-checkbox { /* unche...
... <treechildren> <treeitem> <treerow> <treecell value="true"/> <treecell label="alice"/> </treerow> </treeitem> <treeitem> <treerow> <treecell value="false"/> <treecell label="bob"/> </treerow> </treeitem> </treechildren> </tree> to make the checkbox visible on some platforms, the following styles need to be added to the stylesheet (see treecol.type). on firefox 2.x and 3.x, all operating systems other than mac os x already use these styles by default. if targeting firefox for mac os x, be sure to use these styles but include your own checkbox image. however, chrome://global/skin/checkbox/cbox-check.gif is available in seamonkey on mac os x.. treechildren::-moz-tree-checkbox { /* unchecked checkbox treecells. this s...
...And 5 more matches
Gecko Compatibility Handbook - Archive of obsolete content
plorer 4 and netscape navigator 4 share support for a large part of the html 3.2 standard and basic javascript. while they support the css 1 standard to some degree, the implementations are not complete and have non-standard features added. neither internet explorer 4 or netscape navigator 4 support the w3 dom. instead, each browser supports its own proprietary api for manipulating the content, style and position of html elements in a web page. in addition, internet explorer 4 and netscape navigator 4 use completely different methods of embedding third-party software into the browser. gecko is a cross-platform browser engine, compatible with a number of windows versions including windows xp, as well as mac and linux. because of gecko's cross-platform nature, functionality is generally very...
... versions that support the w3 standards and gecko browsers content differs in gecko browsers and internet explorer your css relies on bugs in internet explorer's implementation of css. internet explorer incorrectly treats id's and class names as case insensitive while gecko treats them correctly as case sensitive. inconsistent case between the css defining the style for html id's and classes results in gecko browsers not applying the styles to id's or class names that differ in case. internet explorer incorrectly specifies height and width of inline elements such as span. internet explorer implements the box model (padding, margins, borders) incorrectly. do not use internet explorer's invalid implementation of css. use only t...
...net explorer incorrectly specifies height and width of inline elements such as span. internet explorer implements the box model (padding, margins, borders) incorrectly. do not use internet explorer's invalid implementation of css. use only the cross-browser, standards conformant features of css. use consistent case when writing html id and class name attributes and css styles for those ids and classes. do not specify heights or widths on inline elements such as spans. use only cross-browser box specifications for margins, padding and borders. (more about css) content differs in gecko browsers and internet explorer incorrect layout mode specified by doctype. if pages should be displayed by legacy browsers such as netscape navigator 4...
...And 5 more matches
Properly Using CSS and JavaScript in XHTML Documents - Archive of obsolete content
ml. proper xhtml is an application of xml and as such requires that authors follow strict rules when authoring xhtml. in particular: raw < and & characters are not allowed except inside of cdata sections (<![cdata[ ... ]]>). comments (<!—— ... ——>) must not contain double dashes (——). content contained within comments (<!—— ... ——>) can be ignored. problems with inline style and script inline style and script tags can cause several different problems in xhtml when it is treated as xml rather than html. javascript contains characters which can not exist in xhtml javascript typically contains characters which can not exist in xhtml outside of cdata sections. <script type="text/javascript"> var i = 0; while (++i < 10) { // ... } </script> note that th...
... contains characters which can not exist in xhtml javascript typically contains characters which can not exist in xhtml outside of cdata sections. <script type="text/javascript"> var i = 0; while (++i < 10) { // ... } </script> note that this example is not well formed xhtml since the use of raw < is only allowed as a part of markup in xhtml or xml. ...
...hich can not exist in xhtml outside of cdata sections. <script type="text/javascript"> var i = 0; while (++i < 10) { // ... } </script> note that this example is not well formed xhtml since the use of raw < is only allowed as a part of markup in xhtml or xml. ...
...And 5 more matches
The Business Benefits of Web Standards - Archive of obsolete content
. this article discusses how adhering to web standards, and leaving behind proprietary markup and technologies, can contribute to a company's business goals. site wide consistent look and feel by separating structure (or content) from presentation, web designers have a lot to gain. specifically, presentation is defined using layout-oriented css language. ...
...the blogging community are particularly dynamic in this respect where on many platforms including wordpress, textpattern and habari, the site theme is a complete and discrete entity in its own right. ...
...sheet) and applying it to a set of html documents permits a complete change of presentation for all these documents in a snap. strict html (as opposed to the often-used transitional html markup), forces the designer not to use presentation tags in the html documents, naturally enforcing the separation of content from presentation. by locating all the style and design issues in one document - the style sheet - whole sites can be rethemed in one go. the blogging community are particularly dynamic in this respect where on many platforms including wordpress, textpattern and habari, the site theme is a complete and discrete entity in its own right. improved user experience: less bandwidth and fast loads html code is often much more compact (therefore easier to read and maintain) when used in conj...
...And 5 more matches
The box model - Learn web development
rnate box model. parts of a box making up a block box in css we have the: content box: the area where your content is displayed, which can be sized using properties like width and height. padding box: the padding sits around the content as white space; its size can be controlled using padding and related properties. border box: the border box wraps the content and any padding. its size and style can be controlled using border and related properties. margin box: the margin is the outermost layer, wrapping the content, padding and border as whitespace between this box and other elements. its size can be controlled using margin and related properties. the below diagram shows these layers: the standard css box model in the standard box model, if you give a box a width and a height att...
... the padding of a box. if you are using the standard box model, the size of the border is added to the width and height of the box. if you are using the alternative box model then the size of the border makes the content box smaller as it takes up some of that available width and height. ...
...order is added to the width and height of the box. if you are using the alternative box model then the size of the border makes the content box smaller as it takes up some of that available width and height. for styling borders, there are a large number of properties — there are four borders, and each border has a style, width and color that we might want to manipulate. you can set the width, style, or color of all four borders at once using the border property. ...
...And 5 more matches
What is CSS? - Learn web development
prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, and html basics (study introduction to html.) objective: to learn what css is. in the introduction to html module we covered what html is, and how it is used to mark up documents. these documents will be readable in a web browser. headings will look larger than regular text, paragraphs break onto a new line and have space between them. ...
... css is. in the introduction to html module we covered what html is, and how it is used to mark up documents. these documents will be readable in a web browser. headings will look larger than regular text, paragraphs break onto a new line and have space between them. links are colored and underlined to distinguish them from the rest of the text. what you are seeing is the browser's default styles — very basic styles that the browser applies to html to make sure it will be basically readable even if no explicit styling is specified by the author of the page. however, the web would be a boring place if all websites looked like that. using css you can control exactly how html elements look in the browser, presenting your markup using whatever design you like. for more on browser/defau...
... a document is usually a text file structured using a markup language — html is the most common markup language, but you may also come across other markup languages such as svg or xml. ...
...And 5 more matches
Introduction to events - Learn web development
we also define a function that returns a random number. the third part of the code is the event handler. the btn constant points to a <button> element, and this type of object has a number of events that can fire on it, and therefore, event handl...
... mechanisms and discuss which ones you should use. event handler properties these are the properties that exist to contain event handler code we have seen most frequently during the course. returning to the above example: const btn = document.queryselector('button'); btn.onclick = function() { const rndcol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')'; document.body.style.backgroundcolor = rndcol; } the onclick property is the event handler property being used in this situation. it is essentially a property like any other available on the button (e.g. btn.textcontent, or btn.style), but it is a special type — when you set it to be equal to some code, that code is run when the event fires on the button. you could also set the handler property to be equal to a n...
... equal to some code, that code is run when the event fires on the button. you could also set the handler property to be equal to a named function name (like we saw in build your own function). the following works just the same: const btn = document.queryselector('button'); function bgchange() { const rndcol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')'; document.body.style.backgroundcolor = rndcol; } btn.onclick = bgchange; there are many different event handler properties available. let's experiment. first, make a local copy of random-color-eventhandlerproperty.html, and open it in your browser. it's just a copy of the simple random color example we've played with already. now try changing btn.onclick to the following different values in turn, and observing the...
...And 5 more matches
CSS performance optimization - Learn web development
previous overview: performance next painting an unstyled page, and then repainting it once styles are parsed would be bad user experience. for this reason, css is render blocking, unless the browser knows the css is not currently needed. the browser can paint the page once it has downloaded the css and built the css object model. browsers follow a specific rendering path: paint only occurs after layout, which occurs after the render tree is created, which in turn requires both the dom and the cssom trees. to optimize the cssom construction, remove unnecessary styles, minify, compress and cache it, and split css not required at page load into additional files to reduce css render blocking. ...
...ow a specific rendering path: paint only occurs after layout, which occurs after the render tree is created, which in turn requires both the dom and the cssom trees. to optimize the cssom construction, remove unnecessary styles, minify, compress and cache it, and split css not required at page load into additional files to reduce css render blocking. optimizing for render blocking css can scope styles to particular conditions with media queries. media queries are important for a responsive web design and help us optimize a critical rendering path. the browser blocks rendering until it parses all of these styles but will not block rendering on styles it knows it will not use, such the print stylesheets. by splitting the css into multiple files based on media queries, you can prevent render blo...
... and help us optimize a critical rendering path. the browser blocks rendering until it parses all of these styles but will not block rendering on styles it knows it will not use, such the print stylesheets. by splitting the css into multiple files based on media queries, you can prevent render blocking during download of unused css. to create a non-blocking css link, move the not-immediately used styles, such as print styles, into separate file, add a <link> to the html mark up, and add a media query, in this case stating it's a print stylesheet. ...
...And 5 more matches
IME handling guide
ot connected adjacently. these clauses are called "converted clause"). if one or more clauses were not converted as expected, the user can choose one of the clauses with arrow keys and look for the expected result form the list in the drop down menu (in the following screenshot, the clause with the thicker underline is called "selected clause"). basically, composition string and each clause style is rendered by gecko. and the drop down menu is created by ime. each clause is represented with selection in the editor. from chrome script, you can check it with nsiselectioncontroller. in native code, you can access it with either nsiselectioncontroller or mozilla::selectiontype (the latter is recommended because of type safer). and editor sets these ime selections from mozilla::textrangetype ...
...process by this, the imestatemanager forgets all focus information (i.e., that indicates nobody has focus). when imestatemanager in parent process is notified of pseudo focus move from or to menubar while a remote process has focus, it notifies the remote process of "menu keyboard listener installed". then, tabchild calls imestatemanager::oninstalledmenukeyboardlistener() in the remote process. style of each clause the style of each ime selection is managed by lookandfeel class per platform. therefore, it can be overridden by prefs. background color, foreground color (text color) and underline color can be specified with following prefs. the values must be string of "#rrggbb" format. ui.imerawinputbackground ui.imerawinputforeground ui.imerawinputunderline ui.imeselectedrawtextbackgro...
...t. ...
...And 5 more matches
Scroll-linked effects
to be laggy, janky, or jittery — in short, something we want to avoid. below are a couple of examples of effects that would not work well with asynchronous scrolling, along with equivalent versions that would work well: example 1: sticky positioning here is an implementation of a sticky-positioning effect, where the "toolbar" div will stick to the top of the screen as you scroll down. <body style="height: 5000px" onscroll="document.getelementbyid('toolbar').style.top = math.max(100, window.scrolly) + 'px'"> <div id="toolbar" style="position: absolute; top: 100px; width: 100px; height: 20px; background-color: green"></div> </body> this implementation of sticky positioning relies on the scroll event listener to reposition the "toolbar" div. as the scroll event listener runs in the javascr...
...to the user-visible scroll, and so the div will not stay visually fixed as intended. instead, it will move with the user's scrolling, and then "snap" back into position when the scroll event handler runs. this constant moving and snapping will result in a jittery visual effect. one way to implement this without the scroll event listener is to use the css property designed for this purpose: <body style="height: 5000px"> <div id="toolbar" style="position: sticky; top: 0px; margin-top: 100px; width: 100px; height: 20px; background-color: green"></div> </body> this version works well with asynchronous scrolling because position of the "toolbar" div is updated by the browser as the user scrolls. example 2: scroll snapping below is an implementation of scroll snapping, where the scroll position ...
...h: 100px; height: 20px; background-color: green"></div> </body> this version works well with asynchronous scrolling because position of the "toolbar" div is updated by the browser as the user scrolls. example 2: scroll snapping below is an implementation of scroll snapping, where the scroll position snaps to a particular destination when the user's scrolling stops near that destination. ...
...And 5 more matches
nsIAccessNode
accessible/public/nsiaccessnode.idlscriptable an interface used by in-process accessibility clients to get style, window, markup and other information about a dom node. when accessibility is active in gecko, every dom node can have one nsiaccessnode. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) the nsiaccessnode implementations are instantiated lazily. the nsiaccessnode tree for a given dom window has a one to one relationship to the dom tree. if the dom node for this access node is "accessible", then a queryinterface to nsiaccessible will succeed. ...
... nsiaccessnode implementations are instantiated lazily. the nsiaccessnode tree for a given dom window has a one to one relationship to the dom tree. if the dom node for this access node is "accessible", then a queryinterface to nsiaccessible will succeed. ...
...ndow has a one to one relationship to the dom tree. if the dom node for this access node is "accessible", then a queryinterface to nsiaccessible will succeed. method overview nsiaccessnode getchildnodeat(in long childnum); obsolete since gecko 2.0 nsidomcssprimitivevalue getcomputedstylecssvalue(in domstring pseudoelt, in domstring propertyname); domstring getcomputedstylevalue(in domstring pseudoelt, in domstring propertyname); void scrollto(in unsigned long ascrolltype); void scrolltopoint(in unsigned long acoordinatetype, in long ax, in long ay); attributes note: attempting to access the attributes of a node that is unattached from the accessible tree will result in an exception - ns_error_failure. attribute type descr...
...And 5 more matches
nsIDOMWindowUtils
string aname); nsidomwindow getouterwindowwithid(in unsigned long long aouterwindowid); long getpccountscriptcount(); astring getpccountscriptsummary(in long ascript); astring getpccountscriptcontents(in long ascript); void getscrollxy(in boolean aflushlayout, out long ascrollx, out long ascrolly); astring getvisiteddependentcomputedstyle(in nsidomelement aelement, in astring apseudoelement, in astring apropertyname); boolean isinmodalstate(); void leavemodalstate(); void loadsheet(in nsiuri sheeturi, in unsigned long type); nsidomnodelist nodesfromrect(in float ax, in float ay, in float atopsize, in float arightsize, in float abottomsize, in float aleftsize, in boolean aignorerootscrollfram...
.... exceptions thrown ns_error_not_available there is no current inner window displaydpi float the dpi of the display. read only. doccharsetisforced boolean whether the charset of the window's current document has been forced by the user. cannot be accessed from unprivileged context (not content-accessible) read only. elementsrestyled read only unsigned long long the number of elements which have been restyled for the current document. keep in mind that during a restyle operation, an element may be restyled multiple times (for example, when an inline element contains blocks). this number also counts restyling of pseudo-elements and anonymous boxes. throws ns_error_not_available if the count can't be provided. ...
...tevent(). if this is set, the selection is set from aoffset + alength to aoffset. select_character 0 select_cluster 1 select_word 2 select_line 3 select_beginline 4 select_endline 5 select_paragraph 6 select_wordnospace 7 agent_sheet 0 a possible type of a style sheet loaded/removed with loadsheet()/removesheet(). see css2 specification for details. user_sheet 1 a possible type of a style sheet loaded/removed with loadsheet()/removesheet(). see css2 specification for details. author_sheet 2 a possible type of a style sheet loaded/removed with loadsheet()/removesheet(). see css2 specification for details. methods a...
...And 5 more matches
CSSPrimitiveValue - Web APIs
a cssprimitivevalue object only occurs in a context of a css property. ...
...a cssprimitivevalue object only occurs in a context of a css property. ...
...a cssprimitivevalue object only occurs in a context of a css property. ...
...And 5 more matches
CSS Typed Object Model API - Web APIs
generally, css values can be read and written in javascript as strings, which can be slow and cumbersome. ...
...erations defined for them). it is also generally faster, as values can be directly manipulated and then cheaply translated back into underlying values without having to both build and parse strings of css. css typed om both allows for the performant manipulation of values assigned to css properties while enabling maintainable code that is both more understand and easier to write. interfaces cssstylevalue the cssstylevalue interface of the the css typed object model api is the base class of all css values accessible through the typed om api. an instance of this class may be used anywhere a string is expected. cssstylevalue.parse(property, csstext) the parse() method of the cssstylevalue interface allows a cssnumericvalue to be constructed from a css string. it sets a specific css prop...
...del api is the base class of all css values accessible through the typed om api. an instance of this class may be used anywhere a string is expected. cssstylevalue.parse(property, csstext) the parse() method of the cssstylevalue interface allows a cssnumericvalue to be constructed from a css string. it sets a specific css property to the specified values and returns the first value as a cssstylevalue object. ...
...And 5 more matches
XSL Transformations in Mozilla FAQ - Web APIs
why isn't my stylesheet applied? ...
... why isn't my stylesheet applied? ...
... why isn't my stylesheet applied? ...
...And 5 more matches
ARIA: gridcell role - Accessibility
<div role="gridcell">potato</div> <div role="gridcell">cabbage</div> <div role="gridcell">onion</div> elements that have role="gridcell" applied to them must be the child of an element with a role of row. ...
...you require, use it instead of re-purposing an element and adding aria. instead use the native html td element in conjunction with the and contenteditable attribute: <td>potato</td> <td>cabbage</td> <td>onion</td> description gridcells with dynamically added, hidden, or removed rows and columns any element with a role="gridcell" applied to it should use aria to describe its order in the table-style grouping, provided the table, grid, or treegrid has the ability to have rows and/or columns dynamically added, hidden, or removed. use aria-colindex to describe a gridcell's order in the list of columns, and aria-rowindex to describe a gridcell's order in the list of rows. use aria-colcount and aria-rowcount on the parent element with role="grid" applied to it to set the total number of columns ...
... has the ability to have rows and/or columns dynamically added, hidden, or removed. use aria-colindex to describe a gridcell's order in the list of columns, and aria-rowindex to describe a gridcell's order in the list of rows. use aria-colcount and aria-rowcount on the parent element with role="grid" applied to it to set the total number of columns or rows. this sample code demonstrates a table-style grouping of information where the third and fourth columns have been removed. aria-colindex is being used to describe the rows' position and allows a person using assistive technology to infer that certain rows have been removed: <div role="grid" aria-colcount="6"> <div role="rowgroup"> <div role="row"> <div role="columnheader" aria-colindex="1">first name</div> <div role="colu...
...And 5 more matches
Content Security Policy (CSP) - HTTP
Web › HTTP › CSP
olicy should include a default-src policy directive, which is a fallback for other resource types when they don't have policies of their own (for a complete list, see the description of the default-src directive). a policy needs to include a default-src or script-src directive to prevent inline scripts from running, as well as blocking the use of eval(). a policy needs to include a default-src or style-src directive to restrict inline styles from being applied from a <style> element or a style attribute. there are specific directives for a wide variety of types of items, so that each type can have its own policy, including fonts, frames, images, audio and video media, scripts, and workers. examples: common use cases this section provides examples of some common security policy scenarios. exa...
...ed. document-uri the uri of the document in which the violation occurred. effective-directive the directive whose enforcement caused the violation. original-policy the original policy as specified by the content-security-policy http header. referrer the referrer of the document in which the violation occurred. script-sample the first 40 characters of the inline script, event handler, or style that caused the violation. status-code the http status code of the resource on which the global object was instantiated. violated-directive the name of the policy section that was violated. sample violation report let's consider a page located at http://example.com/signup.html. it uses the following policy, disallowing everything but stylesheets from cdn.example.com. content-security-pol...
...n. status-code the http status code of the resource on which the global object was instantiated. violated-directive the name of the policy section that was violated. sample violation report let's consider a page located at http://example.com/signup.html. it uses the following policy, disallowing everything but stylesheets from cdn.example.com. ...
...And 5 more matches
Critical rendering path - Web Performance
css, and javascript into pixels on the screen. optimizing the critical render path improves render performance.the critical rendering path includes the document object model (dom), css object model (cssom), render tree and layout. the document object model is created as the html is parsed. the html may request javascript, which may, in turn, alter the dom. the html includes or makes requests for styles, which in turn builds the css object model. the browser engine combines the two to create the render tree. layout determines the size and location of everything on the page. once layout is determined, pixels are painted to the screen. optimizing the critical rendering path improves the time to first render. understanding and optimizing the critical rendering path is important to ensure reflows ...
...sts and responses, loading, scripting, rendering, layout, and the painting of the pixels to the screen. a request for a web page or app starts with an html request. the server returns the html - response headers and data. the browser then begins parsing the html, converting the received bytes to the dom tree. the browser initiates requests every time it finds links to external resources, be they stylesheets, scripts, or embedded image references. some requests are blocking, which means the parsing of the rest of the html is halted until the imported asset is handled. the browser continues to parse the html making requests and building the dom, until it gets to the end, at which point it constructs the css object model. with the dom and cssom complete, the browser builds the render tree, comput...
...scripts, or embedded image references. some requests are blocking, which means the parsing of the rest of the html is halted until the imported asset is handled. the browser continues to parse the html making requests and building the dom, until it gets to the end, at which point it constructs the css object model. with the dom and cssom complete, the browser builds the render tree, computing the styles for all the visible content. after the render tree is complete, layout occurs, defining the location and size of all the render tree elements. once complete, the page is rendered, or 'painted' on the screen. document object model dom construction is incremental. the html response turns into tokens which turns into nodes which turn into the dom tree. a single dom node starts with a starttag tok...
...And 5 more matches
Media - Progressive web apps (PWAs)
{ #nav-area {display: none;} } some common media types are: screen color device display print printed paged media projection projected display all all media (the default) more details there are other ways to specify the media type for a set of rules. the document's markup language might allow the media type to be specified when the stylesheet is linked to the document. for example, in html, you have the option to specify the media type with a media attribute in the link element. in css, you can use @import at the start of a stylesheet to import another stylesheet from a url, optionally specifying the media type. these are ways of separating styling rules for different media types into different files. for full details of media...
... except that you cannot specify individual sides. some other features of user interfaces are implemented using attributes, in the normal way. for example, an element that is disabled or read-only has the disabled attribute or the readonly attribute. selectors can specify these attributes like any other attributes, by using square brackets: [disabled] or [readonly]. ...
...butes, by using square brackets: [disabled] or [readonly]. ...
...And 5 more matches
SVG documentation index - SVG: Scalable Vector Graphics
Web › SVG › Index
3 compatibility sources svg the following sources are used for the compatibility tables on svg elements and attributes: 4 content type needstechnicalreview, svg, types, data types svg makes use of a number of data types. this article lists these types along with their syntax and descriptions of what they're use...
...ndering svg, svg attribute the color-rendering attribute provides a hint to the svg user agent about how to optimize its color interpolation and compositing operations. 49 contentscripttype deprecated, svg, svg attribute the contentscripttype attribute specifies the default scripting language for the given document fragment on the <svg> element. 50 contentstyletype deprecated, svg, svg attribute the contentstyletype attribute specifies the style sheet language for the given document fragment on the <svg> element. 51 cursor svg, svg attribute the cursor attribute specifies the mouse cursor displayed when the mouse pointer is over an element. 52 cx svg, svg attribute the cx attribute define the x-axis co...
..., svg attribute the font-size-adjust attribute allows authors to specify an aspect value for an element that will preserve the x-height of the first choice font in a substitute font. 82 font-stretch needsexample, svg, svg attribute the font-stretch attribute indicates the desired amount of condensing or expansion in the glyphs used to render the text. 83 font-style css, font style, italic, oblique, svg, svg attribute, text, type, font the font-style attribute specifies whether the text is to be rendered using a normal, italic, or oblique face. 84 font-variant svg, svg attribute the font-variant attribute indicates whether the text is to be rendered using variations of the fontʼs glyphs. 85 font-weight svg, svg ...
...And 5 more matches
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
eitem(), and insertitembefore() on list objects making a copy of any list item being inserted that is already in another list implementation status unknown crossorigin attribute for <image> and <script> elements not implemented yet (at least for <image>; bug 1240357) rendering model change notes svg root and <foreignobject> not overflow:hidden in ua style sheet implementation status unknown allow overflow: auto; to clip and show scroll bars implementation status unknown allow overflow: scroll; to show scroll bars on <svg> elements implementation status unknown basic data types and interfaces change notes dommatrix or dommatrixreadonly instead of svgmatrix implementation status unknown ...
...326) allow leading and trailing whitespace in <length>, <angle>, <number> and <integer> implementation status unknown form feed (u+000c) in whitespace implementation status unknown svgelement.xmlbase, svgelement.xmllang and svgelement.xmlspace removed implementation status unknown svgviewspec removed implementation status unknown svgelement.style removed implementation status unknown svggraphicselement.gettransformtoelement() removed not removed yet svggraphicselement.getctm() on the outermost element implementation status unknown animval attribute alias of baseval implementation status unknown dataset attribute for svgelement implementation status unknown moved pathlength attrib...
... auto as initial value for width and height attributes of <svg> implementation status unknown baseprofile and version attributes removed from <svg> implementation status unknown svgsvgelement.forceredraw() deprecated turned into a no-op (bug 733764) svgsvgelement.deselectall() deprecated not yet deprecated (bug 1302705) <switch> not affecting <style> implementation status unknown requiredfeatures attribute removed implementation status unknown svgsvgelement.currentview and svgsvgelement.usecurrentview removed svgsvgelement.currentview was never implemented, svgsvgelement.usecurrentview not removed yet (bug 1174097) svgunknownelement not implemented (bug 1239218) lang attribute without namespace...
...And 5 more matches
Fills and Strokes - SVG: Scalable Vector Graphics
. the pattern then repeats. there are additional stroke and fill properties available, including fill-rule, which specifies how to color in shapes that overlap themselves; stroke-miterlimit, which determines if a stroke should draw miters; and stroke-dashoffset, which specifies where to start a dasharray on a line. using css in addition to setting attributes on objects, you can also use css to style fills and strokes. not all attributes can be set via css. attributes that deal with painting and filling are usually available, so fill, stroke, stroke-dasharray, etc... can all be set this way, in addition to the gradient and pattern versions of those shown below. attributes like width, height, or <path> commands cannot be set through css. it's easiest just to test and find out what is available...
...ttern versions of those shown below. attributes like width, height, or <path> commands cannot be set through css. it's easiest just to test and find out what is available and what isn't. note: the svg specification decides strictly between attributes that are properties and other attributes. the former can be modified with css, the latter not. css can be inserted inline with the element via the style attribute: <rect x="10" height="180" y="10" width="180" style="stroke: black; fill: red;"/> or it can be moved to a special style section that you include. instead of shoving such a section into a <head> section like you do in html, though, it's included in an area called <defs>. <defs> stands for definitions, and it is here that you can create elements that don't appear in the svg directly,...
...ad of shoving such a section into a <head> section like you do in html, though, it's included in an area called <defs>. <defs> stands for definitions, and it is here that you can create elements that don't appear in the svg directly, but are used by other elements. <?xml version="1.0" standalone="no"?> <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" version="1.1"> <defs> <style type="text/css"><![cdata[ #myrect { stroke: black; fill: red; } ]]></style> </defs> <rect x="10" height="180" y="10" width="180" id="myrect"/> </svg> moving styles to an area like this can make it easier to adjust properties on large groups of elements. you can also use things like the :hover pseudo class to create rollover effects: #myrect:hover { st...
...And 5 more matches
SVG In HTML Introduction - SVG: Scalable Vector Graphics
overview this article and its associated example shows how to use inline svg to provide a background picture for a form. it shows how javascript and css can be used to manipulate the picture in the same way you would script regular html. ...
...form. it shows how javascript and css can be used to manipulate the picture in the same way you would script regular html. ...
... the example: <html> <head> <title>xtech svg demo</title> <style> stop.begin { stop-color:yellow; } stop.end { stop-color:green; } body.invalid stop.end { stop-color:red; } #err { display:none; } body.invalid #err { display:inline; } </style> <script> function signalerror() { document.getelementbyid('body').setattribute("class", "invalid"); } </script> </head> <body id="body" style="position:absolute; z-index:0; border:1px solid black; left:5%; top:5%; width:90%; height:90%;"> <form> <fieldset> <legend>html form</legend> <p><label>enter something:</label> <input type="text"> <span id="err">incorrect value!</span></p> <p><input type="button" value="activate!" onclick="signalerror();"></p> </fieldset> </form> <svg viewbox="0 0 100 100" preserveaspec...
...And 5 more matches
Appendix F: Monitoring DOM changes - Archive of obsolete content
t document * * @returns {function} a function which may be called to unregister the * listener. ...
... a function which may be called to unregister the * listener. ...
... may be called to unregister the * listener. ...
...And 4 more matches
XML data - Archive of obsolete content
this page contains an example of how you can use css with xml data. you create a sample xml document, and a stylesheet that you can use to display it in your browser. this is the 3rd section of part ii of the css tutorial. previous section: svg next section: xbl binding information: xml data xml (extensible markup language) is a general-purpose language for any kind of structured data. by default, your mozilla browser displays xml in a format very similar to the original data in the xml file. you see the actual tags that define the data's structure. by linking a css stylesheet with the xml document, you can define other ways to display it. to do this, your stylesheet uses rules that map tags in the xml document to the display types used by html. example data in an xml document ...
...tags that define the data's structure. by linking a css stylesheet with the xml document, you can define other ways to display it. to do this, your stylesheet uses rules that map tags in the xml document to the display types used by html. example data in an xml document uses <info> tags. you want the document's info elements to be displayed like html paragraphs. ...
... more details other values of display display the element like a list item, or like a component of a table. for the full list of display types, see the display property in the css specification. ...
...And 4 more matches
SeaMonkey - making custom toolbar (SM ver. 1.x) - Archive of obsolete content
remove the sections for toolbars where you do not want your button. save the file. explanation: this file contains details of your extension, and specifies how it modifies seamonkey. 6. create a plain text file named button.xul. copy the following content, making sure that you scroll to get all of it. ...
...mbutton[1]()" class="toolbarbutton-1 custombutton" /> </overlay> optionally customize the file by changing the label, accesskey and tooltiptext attributes. change the text between double-quote characters on those lines. optionally remove the sections for toolbars that you do not need. save the file. explanation: this xul file adds the button to the toolbars. ...
...eed. save the file. explanation: this xul file adds the button to the toolbars. it also links to the stylesheet and javascript code that the button uses. the last section specifies details of the button. 7. create a plain text file named button.css. copy the following content, making sure that you scroll to get all of it. ...
...And 4 more matches
resizer - Archive of obsolete content
attribute, to use the resizer to resize the specified element instead of the window. ...
... of the window. ...
... resizing a window <window xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul" hidechrome="true" windowtype="main" orient="vertical" sizemode="normal" width="400" height="300" persist="screenx screeny width height"> <hbox flex="1"> <vbox width="2" style="background-color: grey;"> <resizer dir="topleft" height="2" style="cursor: nw-resize;"/> <resizer dir="left" flex="1" style="cursor: w-resize;"/> <resizer dir="bottomleft" height="2" style="cursor: sw-resize;"/> </vbox> <vbox flex="1"> <resizer dir="top" height="2" style="background-color: grey; cursor: n-resize;"/> <browser flex="1" id="browser" type="content-primary"/> <resizer dir="bottom" height="2" style="background-color: grey; cursor: s-resize;"/> </vbox> <vbox width="2" style="background-co...
...And 4 more matches
-ms-filter - Archive of obsolete content
reference for details. examples the following example shows how to use the -ms-filter attribute in internet explorer 8. ...
...amples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/filter_8.htm -ms-filter: 'progid:dximagetransform.microsoft.motionblur(strength=50), progid:dximagetransform.microsoft.basicimage(mirror=1)'; the following example shows how to use an inline style sheet to set the filter on an image. code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/filter_h.htm <img style="filter:progid:dximagetransform.microsoft.motionblur(strength=50) progid:dximagetransform.microsoft.basicimage(mirror=1)" src="/workshop/samples/author/dhtml/graphics/cone.jpg" height="80px" width="80px" alt="cone"> the following example shows how to use scripting to set the filter on an image. code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/filte...
...(mirror=1)" src="/workshop/samples/author/dhtml/graphics/cone.jpg" height="80px" width="80px" alt="cone"> the following example shows how to use scripting to set the filter on an image. code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/filter_s.htm <body> <p>click the image to start the filter.</p> // call the function. ...
...And 4 more matches
CSS and JavaScript accessibility best practices - Learn web development
tics has a lot to do with user expectations — elements look and behave in certain ways, according to their functionality, and these common conventions are expected by users. as an example, a screen reader user can't navigate a page via heading elements if the developer hasn't appropriately used heading elements to markup the content. by the same token, a heading loses its visual purpose if you style it so it doesn't look like a heading. the rule of thumb is that you can update the styling of a page feature to fit in your design, but don't change it so much that it no longer looks or behaves as expected. the following sections summarize the main html features to consider. "standard" text content structure headings, paragraphs, lists — the core text content of your page: <h1>heading</h1>...
...mentals and styling text for more information. emphasised text inline markup that confers specific emphasis to the text that it wraps: <p>the water is <em>very hot</em>.</p> <p>water droplets collecting on surfaces is called <strong>condensation</strong>.</p> you might want to add some simple coloring to your emphasised text: strong, em { color: #a60000; } you will however rarely need to style emphasis elements in any significant way. the standard conventions of bold and italic text are very recognisable, and changing the style can cause confusion. for more on emphasis, see emphasis and importance. abbreviations an element that allows an abbreviation, acronym, or initialization to be associated with its expansion: <p>web content is marked up using <abbr title="hypertext markup langu...
...for more on abbreviations, see abbreviations. ...
...And 4 more matches
How CSS works - Learn web development
previous overview: first steps next we have learned the basics of css, what it is for and how to write simple stylesheets. in this lesson we will take a look at how a browser takes css and html and turns that into a webpage. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, and html basics (study introduction to html.) objective: to understand the basics of how css and html are parsed by the browser, and what happens when a browser encounters css it does not understand. how does css actually work? when a browser displays a document, it must combine the document's content with its style information. it processes the document in a number of stages, which we've listed below. bear in mind that...
...s ... and linked css! javascript is handled a bit later on in the process, and we won't talk about it here to keep things simpler. the browser parses the fetched css, and sorts the different rules by their selector types into different "buckets", e.g. element, class, id, and so on. based on the selectors it finds, it works out which rules should be applied to which nodes in the dom, and attaches style to them as required (this intermediate step is called a render tree). the render tree is laid out in the structure it should appear in after the rules have been applied to it. the visual display of the page is shown on the screen (this stage is called painting). the following diagram also offers a simple view of the process. about the dom a dom has a tree-like structure. each element, att...
...s and the document's content meet up. when you start working with browser devtools you will be navigating the dom as you select items in order to see which rules apply. a real dom representation rather than a long, boring explanation, let's look at an example to see how a real html snippet is converted into a dom. ...
...And 4 more matches
Example 1 - Learn web development
ple of code that explains how to build a custom form widget. ...
.../div> css /* --------------- */ /* required styles */ /* --------------- */ .select { position: relative; display : inline-block; } .select.active, .select:focus { box-shadow: 0 0 3px 1px #227755; outline: none; } .select .optlist { position: absolute; top : 100%; left : 0; } .select .optlist.hidden { max-height: 0; visibility: hidden; } /* ------------ */ /* fancy styles */ /* ------------ */ .select { font-size : 0.625em; /* 10px */ font-family : verdana, arial, sans-serif; -moz-box-sizing : border-box; box-sizing : border-box; padding : 0.1em 2.5em 0.2em 0.5em; /* 1px 25px 2px 5px */ width : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 ...
...er { content : "▼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; padding: 0; background: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { padding: .2em .3em; } .select .highlight { background: #000; ...
...And 4 more matches
How to build custom form controls - Learn web development
h to implement the equivalent of the <optgroup> element later on? class names, however, provide no semantic value. in this current state, the screen reader user only "sees" an unordered list. we will add aria semantics in a bit. creating the look and feel using css now that we have a structure, we can start designing our control. the whole point of building this custom control is to be able to style it exactly how we want. to that end, we will split our css work into two parts: the first part will be the css rules absolutely necessary to make our control behave like a <select> element, and the second part will consist of the fancy styles used to make it look the way we want. required styles the required styles are those necessary to handle the three states of our control. .select { /* t...
...s; adding this to .select:focus-within will be a better option when fully supported */ position: relative; /* this will make our control become part of the text flow and sizable at the same time */ display : inline-block; } we need an extra class active to define the look and feel of our control when it is in its active state. because our control is focusable, we double this custom style with the :focus pseudo-class in order to be sure they will behave the same. .select .active, .select:focus { outline: none; /* this box-shadow property is not exactly required, however it's imperative to ensure active state is visible, especially to keyboard users, that we use it as a default value. */ box-shadow: 0 0 3px 1px #227755; } now, let's handle the list of options: /* the...
...t meta tag */ position: absolute; z-index : 1; /* this will be important to keep the arrow from overlapping the list of options */ top : 0; right : 0; box-sizing : border-box; height : 100%; width : 2em; padding-top : .1em; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; text-align : center; } next, let's style the list of options: .select .optlist { z-index : 2; /* we explicitly said the list of options will always be on top of the down arrow */ /* this will reset the default style of the ul element */ list-style: none; margin : 0; padding: 0; box-sizing : border-box; /* if the values are smaller than the control, the list of options will be as wide as the control itself */ min...
...And 4 more matches
Your first form - Learn web development
g more complex, creative button content. basic form styling now that you have finished writing your form's html code, try saving it and looking at it in a browser. at the moment, you'll see that it looks rather ugly. note: if you don't think you've got the html code right, try comparing it with our finished example — see first-form.html (also see it live). ...
...l see that it looks rather ugly. note: if you don't think you've got the html code right, try comparing it with our finished example — see first-form.html (also see it live). forms are notoriously tricky to style nicely. it is beyond the scope of this article to teach you form styling in detail, so for the moment we will just get you to add some css to make it look ok. first of all, add a <style> element to your page, inside your html head. ...
...l code right, try comparing it with our finished example — see first-form.html (also see it live). forms are notoriously tricky to style nicely. it is beyond the scope of this article to teach you form styling in detail, so for the moment we will just get you to add some css to make it look ok. first of all, add a <style> element to your page, inside your html head. ...
...And 4 more matches
Making decisions in your code — conditionals - Learn web development
ock of code is not controlled by the conditional statement, so it always runs, regardless of whether the condition returns true or false. this is not necessarily a bad thing, but it might not be what you want — often you want to run one block of code or the other, not both. as a final point, you may sometimes see if...else statements written without the curly braces, in the following shorthand style: if (condition) code to run if condition is true else run some other code instead this is perfectly valid code, but using it is not recommended — it is much easier to read the code and work out what is going on if you use the curly braces to delimit the blocks of code, and use multiple lines and indentation. a real example to understand this syntax better, let's consider a real example. ima...
... live example shows a simple theme chooser where the styling for the site is applied using a ternary operator. <label for="theme">select theme: </label> <select id="theme"> <option value="white">white</option> <option value="black">black</option> </select> <h1>this is my website</h1> const select = document.queryselector('select'); const html = document.queryselector('html'); document.body.style.padding = '10px'; function update(bgcolor, textcolor) { html.style.backgroundcolor = bgcolor; html.style.color = textcolor; } select.onchange = function() { ( select.value === 'black' ) ? update('black','white') : update('white','black'); } here we've got a <select> element to choose a theme (black or white), plus a simple <h1> to display a website title. we also have a function calle...
...or to group multiple months together into a single condition; many of them share the same number of days. think about which number of days is the most common, and use that as a default value. if you make a mistake, you can always reset the example with the "reset" button. if you get really stuck, press "show solution" to see a solution. ...
...And 4 more matches
Web performance resources - Learn web development
r bot traffic); for example, by using the loading attribute on the <img> element it is also crucial to realize what is really important to your users. it might not be absolute timing, but user perception. quick wins css web performance is all about user experience and perceived performance. ...
...nal link tag with rel="stylesheet" is synchronous and blocks rendering. optimize the rendering of your page by removing blocking css. to load css asynchronously one can simpy set the media type to print and then change to all once loaded. the following snippet includes an onload attribute, requiring javascript, so it is important to include a noscript tag with a traditional fallback. ...
... your page by removing blocking css. to load css asynchronously one can simpy set the media type to print and then change to all once loaded. the following snippet includes an onload attribute, requiring javascript, so it is important to include a noscript tag with a traditional fallback. ...
...And 4 more matches
Android-specific test suites
android-findbugs ensures that the code avoids common java coding errors. android-lint ensures that the code avoids common android coding errors. all of these suites require a functioning build of firefox for android — either a full build or an artifact build. all of the suites are configured by and invoked using gradle. android-test runs android-specific local unit tests. ...
...stsuccessrunnableisexecutedifpermissionsaregranted, add @ignore as follows: ... @runwith(testrunner.class) public class testpermissions { @ignore @test public void testsuccessrunnableisexecutedifpermissionsaregranted() { ... contact information android-test is currently owned by :sebastian and :nalexander. file tickets in the firefox for android product in bugzilla. ...
...onsaregranted, add @ignore as follows: ... @runwith(testrunner.class) public class testpermissions { @ignore @test public void testsuccessrunnableisexecutedifpermissionsaregranted() { ... contact information android-test is currently owned by :sebastian and :nalexander. file tickets in the firefox for android product in bugzilla. android-checkstyle verifies that the java coding style is consistent throughout. see http://checkstyle.sourceforge.net/index.html and https://docs.gradle.org/2.14/userguide/checkstyle_plugin.html for more details. running android-checkstyle to run android-checkstyle, first build firefox for android with your changes; then run ./mach android checkstyle this will run the tests and report the results to stdout, as well as produce an html report. d...
...And 4 more matches
SVG Guidelines
recommended to remove that kind of metadata since it doesn't bring much value. you shouldn't include doctypes in your svgs either; they are a source of many issues, and the svg wg recommends not to include them. see svg authoring guidelines. avoid the use of cdata sections cdata sections are used to avoid parsing some text as html. most of time, cdata isn't needed, for example, the content in <style> tags doesn't need to be wrapped in a cdata section as the content inside the tag is already correctly parsed as css. invisible shapes there are two kinds of invisible shapes: the off-screen ones and the uncolored ones. the offscreen shapes are hard to spot, even with an automated tool, and are usually context aware. those kinds of shapes are visible but off the svg view box. here's an example...
...visible shapes there are two kinds of invisible shapes: the off-screen ones and the uncolored ones. the offscreen shapes are hard to spot, even with an automated tool, and are usually context aware. those kinds of shapes are visible but off the svg view box. here's an example of a file with offscreen shapes. on the other hand, the uncolored ones are easier to spot, since they usually come with styles making them invisible. they must meet two conditions: they must be devoid of any fill (or a transparent one) or stroke. unused attributes on root <svg> element the root <svg> element can also host many useless attributes. here's an example taking into account the list below: version x="0" and y="0" enable-background (unsupported by gecko and now deprecated by the filter effects specificat...
... shapes or paths) clip-rule attribute when the element is not a descendant of a <clippath> fill-rule attribute when the element is a descendant of a <clippath> unreferenced/unused clip paths, masks or defs (example) styling basics privilege short lowercase hex for colors don't use excessive precision for numeric values (usually comes from illustrator) use descriptive ids avoid inline styles and use class names or svg attributes examples here are some examples for excessive number precision: 5.000000e-02 → 0.05 (as seen here) -3.728928e-10 → 0 (as seen here) translate(0.000000, -1.000000) → translate(0, -1) (as seen here) as for descriptive ids: for gradients: svg_id1 → gradient1 (as seen here) use of class names avoid using a class if that class is only us...
...And 4 more matches
Mozilla Content Localized in Your Language
this section of the style guide is for you to author. the content here should be what you and your localization team have decided, together, to follow when localizing mozilla products and web sites. you are free to add, edit, remove, and localize everything in this section according to how the localization team for your language agrees. all we ask is that you name this page according to this example, "mozilla content in spanish (es-mx)" and add your locale code tag at the bottom. ...
...tion team have decided, together, to follow when localizing mozilla products and web sites. you are free to add, edit, remove, and localize everything in this section according to how the localization team for your language agrees. all we ask is that you name this page according to this example, "mozilla content in spanish (es-mx)" and add your locale code tag at the bottom. enjoy developing your style guide! your language's style guide abbreviations how are abbreviations expressed in your language? numerals and metrics how are numerals and metrics expressed in your language? formal and informal forms, and separators (, or .) date format what are the date formats for weeks and months are expressed in the following forms: 1)fully spelled out, 2). 2 or 3 letters and 3). single letter. a...
...ference material on other languages can be found here. pluralization what is the appropriate form of expressing pluralization in your language? if yes, list all forms of plural forms and examples if there is more than one. additional discussions can be found here. voice what is the appropriate form of expressing voice in your language? how should emphasis be made in your language? character styles how are bold, italics, underlines, etc. used to express certain concepts in your language? if these are not applicable styles, what are some of the corresponding ways to express, emphasis or highlight some of the texts. address format what is the format in your language? ex: most asian countries start from big to small: [country] [postal code][state/province][city][district][street numbe...
...And 4 more matches
Mozilla Web Developer FAQ
therefore, the default margins for paragraphs apply even with markup such as <td><p>foo</p></td>. often the content of a cell in a table of tabular data does not constitute a paragraph. in that case, the easy solution is not to mark the contents of the cell as a paragraph. when the paragraph markup is called for but the default margins are unwanted, zero margins can be suggested using css. my style sheet doesn’t work! why? here’s the check list: does the html document validate? styling misnested markup may cause strange effects. the <link> and <style> elements should be inside the <head> element. does the css style sheet pass the syntax check? the css error handling rules require erroneous parts to be ignored rather than fixed by guessing. lengths other than zero ...
... does the css style sheet pass the syntax check? the css error handling rules require erroneous parts to be ignored rather than fixed by guessing. lengths other than zero should be followed by a proper unit without a space between the number and the unit (eg. 1.2em). the character to use between the property name and the value is the colon—not the equal sign. html markup, such as <style>, does not belong in .css files. font-face is not a real css property. the property is font-family and @font-face is an at-rule. if @import is used, it should be the first thing in a css file. css parsing errors are reported to the javascript console. is the server sending the proper content-type header for css style sheets? the correct type is text/css. in the standards m...
...nt-face is not a real css property. the property is font-family and @font-face is an at-rule. if @import is used, it should be the first thing in a css file. css parsing errors are reported to the javascript console. is the server sending the proper content-type header for css style sheets? the correct type is text/css. in the standards mode and the almost standards mode only style sheets with the correct type are applied. you can see the http headers sent by the server by using the livehttpheaders extension or by using the web sniffer. class names and ids are case-sensitive. the element selectors are case-sensitive with xml. style sheet processing instructions are only allowed in the prolog of xml documents. also, they only work in xml documents—not in documen...
...And 4 more matches
about:memory
...
...e represents all javascript window objects, which includes the browser tabs and ui windows. for example, the "top(http://edition.cnn.com/, id=8)" sub-tree represents the tab open to cnn.com, and "top(chrome://browser/content/browser.xul, id=3)" represents the main browser ui window. within each window's measurements are sub-trees for javascript ("js-compartment(...)" and "js-zone(...)"), layout, style-sheets, the dom, and other things. it's clear that the cnn.com tab is using more memory than the techcrunch.com tab, which is using more than the arstechnica.com tab. sub-trees with names like "(2 tiny)" are artificial nodes inserted to allow insignificant sub-trees to be collapsed by default. if you select the "verbose" checkbox before measuring, all trees will be shown fully expanded and no a...
...others are identified only by a hexadecimal identifier. you can look in about:support to see which add-on a particular identifier belongs to. for example, 59c81df5-4b7a-477b-912d-4e0fdf64e5f2 is chatzilla. all javascript memo...
...And 4 more matches
nsIParserUtils
l); nsidomdocumentfragment parsefragment(in astring fragment, in unsigned long flags, in boolean isxml, in nsiuri baseuri, in nsidomelement element); astring sanitize(in astring src, in unsigned long flags); constants constant value description sanitizerallowcomments (1 << 0) flag for sanitizer: allow comment nodes. sanitizerallowstyle (1 << 1) flag for sanitizer: allow <style> elements and style attributes (with contents sanitized in case of -moz-binding). note: if -moz-binding is absent, properties that might be xss risks in other web engines are preserved! sanitizercidembedsonly (1 << 2) flag for sanitizer: only allow cid: urls for embedded content. at present, sanitizing css backgro...
...tes (with contents sanitized in case of -moz-binding). note: if -moz-binding is absent, properties that might be xss risks in other web engines are preserved! sanitizercidembedsonly (1 << 2) flag for sanitizer: only allow cid: urls for embedded content. at present, sanitizing css backgrounds, and so on., is not supported, so setting this together with sanitizerallowstyle doesn't make sense. at present, sanitizing css syntax in svg presentational attributes is not supported, so this option flattens out svg. sanitizerdropnoncsspresentation (1 << 3) flag for sanitizer: drops non-css presentational html elements and attributes, such as <font>, <center>, and the bgcolor attribute. sanitizerdropforms (1 << 4) flag for sanitizer: drops...
..., so an explicit user action (following a link) after the content has been loaded can still leak information. by default, non-dangerous non-css presentational html elements and attributes or forms are not removed. to remove these, use sanitizerdropnoncsspresentation and/or sanitizerdropforms. by default, comments and css is removed. to preserve comments, use sanitizerallowcomments. ...
...And 4 more matches
CanvasRenderingContext2D.globalAlpha - Web APIs
syntax ctx.globalalpha = value; options value a number between 0.0 (fully transparent) and 1.0 (fully opaque), inclusive. the default value is 1.0. values outside that range, including infinity and nan, will not be set, and globalalpha will retain its previous value. ...
...that range, including infinity and nan, will not be set, and globalalpha will retain its previous value. examples drawing translucent shapes this example uses the globalalpha property to draw two semi-transparent rectangles. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.globalalpha = 0.5; ctx.fillstyle = 'blue'; ctx.fillrect(10, 10, 100, 100); ctx.fillstyle = 'red'; ctx.fillrect(50, 50, 100, 100); result overlaying transparent shapes this example illustrates the effect of overlaying multiple transparent shapes on top of each other. we begin by drawing a solid background composed of four differently colored squares. next, we set the globalalpha property to 0.2 (20% opaque); this alpha lev...
..., the opacity of the previous circles underneath is effectively increased. if we were to increase the step count (and thus draw more circles), the background would eventually disappear completely from the center of the image. ...
...And 4 more matches
Element: overflow event - Web APIs
the overflow event is fired when an element has been overflowed by its content or has been rendered for the first time in this state (only works for elements styled with overflow != visible). it is a proprietary event specific to gecko (firefox). ...
...n this state (only works for elements styled with overflow != visible). it is a proprietary event specific to gecko (firefox). ...
...t handler property unknown examples <div id="wrapper"> <div id="child"></div> </div> <br/> <label><input type="checkbox" id="toggle" checked/> overflow</label> <style> #wrapper { width: 20px; height: 20px; background: #000; padding: 5px; overflow: hidden; } #child { width: 40px; height: 40px; border: 2px solid grey; background: #ccc; } </style> <script> var wrapper = document.getelementbyid("wrapper"), child = document.getelementbyid("child"), toggle = document.getelementbyid("toggle"); wrapper.addeventlistener("overflow", function( event ) { console.log( event ); }, false); wrapper.addeventlistener("underflow", function( event ) { console.log( event ); }, false); toggle.addeventlistener("change"...
...And 4 more matches
HTMLElement.offsetLeft - Web APIs
he left in pixels from the closest relatively positioned parent element. example var colortable = document.getelementbyid("t1"); var toleft = colortable.offsetleft; if (toleft > 5) { // large left offset: do something here } this example shows a 'long' sentence that wraps within a div with a blue border, and a red box that one might think should describe the boundaries of the span. ...
...ositioned parent element. example var colortable = document.getelementbyid("t1"); var toleft = colortable.offsetleft; if (toleft > 5) { // large left offset: do something here } this example shows a 'long' sentence that wraps within a div with a blue border, and a red box that one might think should describe the boundaries of the span. <div style="width: 300px; border-color:blue; border-style:solid; border-width:1;"> <span>short span. ...
...e left offset: do something here } this example shows a 'long' sentence that wraps within a div with a blue border, and a red box that one might think should describe the boundaries of the span. <div style="width: 300px; border-color:blue; border-style:solid; border-width:1;"> <span>short span. ...
...And 4 more matches
ShadowRoot - Web APIs
properties included from documentorshadowroot the shadowroot interface includes the following properties defined on the documentorshadowroot mixin. note that this is currently only implemented by chrome; other browsers still implement them on the document interface. documentorshadowroot.activeelement read only returns the element within the shadow tree that has focus. documentorshadowroot.stylesheets read only returns a stylesheetlist of cssstylesheet objects for stylesheets explicitly linked into, or embedded in a document. methods the shadowroot interface includes the following methods defined on the documentorshadowroot mixin. note that this is currently only implemented by chrome; other browsers still implement them on the document interface. documentorshadowroot.getselectio...
...t, and caret's character offset within that node. examples the following snippets are taken from our life-cycle-callbacks example (see it live also), which creates an element that displays a square of a size and color specified in the element's attributes. ...
...e element's attributes. inside the <custom-square> element's class definition we include some life cycle callbacks that make a call to an external function, updatestyle(), which actually applies the size and color to the element. you'll see that we are passing it this (the custom element itself) as a parameter. ...
...And 4 more matches
Web APIs
Web › API
elow is a list of all the apis and interfaces (object types) that you may be able to use while developing your web app or site. web apis are typically used with javascript, although this doesn't always have to be the case. specifications this is a list of all the apis that are available. ...
...blob blobbuilder blobevent bluetooth bluetoothadvertisingdata bluetoothcharacteristicproperties bluetoothdevice bluetoothremotegattcharacteristic bluetoothremotegattdescriptor bluetoothremotegattserver bluetoothremotegattservice body broadcastchannel budgetservice budgetstate buffersource bytelengthqueuingstrategy bytestring c cdatasection css cssconditionrule csscounterstylerule cssgroupingrule cssimagevalue csskeyframerule csskeyframesrule csskeywordvalue cssmathproduct cssmathsum cssmathvalue cssmediarule cssnamespacerule cssnumericvalue cssomstring csspagerule csspositionvalue cssprimitivevalue csspseudoelement cssrule cssrulelist cssstyledeclaration cssstylerule cssstylesheet cssstylevalue csssupportsrule cssunitvalue cssunparsedvalue ...
...pe doublerange dragevent dynamicscompressornode e ext_blend_minmax ext_color_buffer_float ext_color_buffer_half_float ext_disjoint_timer_query ext_float_blend ext_frag_depth ext_srgb ext_shader_texture_lod ext_texture_compression_bptc ext_texture_compression_rgtc ext_texture_filter_anisotropic eckeygenparams eckeyimportparams ecdhkeyderiveparams ecdsaparams effecttiming element elementcssinlinestyle elementtraversal errorevent event eventlistener eventsource eventtarget extendableevent extendablemessageevent f featurepolicy federatedcredential fetchevent file fileentrysync fileerror fileexception filelist filereader filereadersync filerequest filesystem filesystemdirectoryentry filesystemdirectoryreader filesystementry filesystementrysync filesystemfileentry filesy...
...And 4 more matches
Adding captions and subtitles to HTML5 video - Developer guides
this article will take the same player and show how to add captions and subtitles to it, using the webvtt format and the <track> element. captioned video example in this article, we will refer to the video player with captions example. this example uses an excerpt from the sintel open movie, created by the blender foundation. note: you can find the source on github, and also view the example live. ...
...voldown">vol-</button> <button id="fs" type="button" data-state="go-fullscreen">fullscreen</button> <button id="subtitles" type="button" data-state="subtitles">cc</button> </div> css changes the video controls have undergone some minor changes in order to make space for the extra button, but these are relatively straightforward. no image is used for the captions button, so it is simply styled as: .controls button[data-state="subtitles"] { height:85%; text-indent:0; font-size:16px; font-size:1rem; font-weight:bold; color:#666; background:#000; border-radius:2px; } there are also other css changes that are specific to some extra javascript implementation, but these will be mentioned at the appropriate place below. subtitle implementation a lot of wha...
...it also sets up the required event listeners on the button to toggle the relevant subtitle set on or off. this is done by simply setting the required subtlte's mode attribute to showing,...
...And 4 more matches
Video player styling basics - Developer guides
preliminary modifications from the original example this section summarises the modifications that were made to the original video player example to make the styling task easier, before the bulk of the work was started. ...
... preliminary modifications from the original example this section summarises the modifications that were made to the original video player example to make the styling task easier, before the bulk of the work was started. ...
...ation. this "data-state" idea is also used for setting the current state of buttons within the video control set, which allows specific state styling. javascript as mentioned above, a data-state attribute is used in various places for styling purposes and these are set using javascript. specific implementations will be mentioned at appropriate places below. styling the resultant video player style used here is rather basic — this is intentional, as the purpose is to show how such a video player could be styled and be made responsive. note: in some cases some basic css is omitted from the code examples here as its use is either obvious or not specifically relevant to styling the video player. basic styling the html video and its controls are all contained within a <figure> element, w...
...And 4 more matches
HTML attribute: rel - HTML: Hypertext Markup Language
Web › HTML › Attributes › rel
se in the future. external resource not allowed not allowed prev indicates that the current document is a part of a series, and that the previous document in the series is the referenced document. link link link search gives a link to a resource that can be used to search through the current document and its related pages. link link link stylesheet imports a style sheet. external resource not allowed not allowed tag gives a tag (identified by the given address) that applies to the current document. not allowed link not allowed the rel attribute is relevant to the <link>, <a>, <area>, and <form> elements, but some values only relevant to a subset of those elements. like all html keyword attribute ...
... uses the non-standard apple-touch-icon and apple-touch-startup-image respectively. the shortcut link type is often seen before icon, but this link type is non-conforming, ignored and web authors must not use it anymore. alternate indicates an alternate representation of the current document. valid for link, a, and area, the meaning depends on the values of the other attributes. with the stylesheet keyword on a <link>, it creates an alternate stylesheet. <!-- a persistent style sheet --> <link rel="stylesheet" href="default.css"> <!-- alternate style sheets --> <link rel="alternate stylesheet" href="highcontrast.css" title="high contrast"> with an hreflang attribute that differs from the document language, it indicates a translation. with the type attribute, it indicates that...
...t helps reduce latency and thereby improves performance when the user does access the resources as the browser preemptively performed dns resolution for the origin of the specified resource. see dns-prefetch described in resource hints. external relevant to <form>, <a>, and <area>, it indicates the referenced document is not part of the current site. this can be used with attribute selectors to style external links in a way that indicates to the user that they will be leaving the current site. help relevant to <form>, <link>, <a>, and <area>, the help keyword indicates that the linked to content provides context-sensitive help, providing information for the parent of the element defining the hyperlink, and its children. when used within <link>, the help is for the whole document. when inclu...
...And 4 more matches
<tr>: The Table Row element - HTML: Hypertext Markup Language
Web › HTML › Element › tr
racter (such as "." or ","). bgcolorobsolete since html5 a domstring specifying a color to apply to the backgrounds of each of the row's cells. this can be either an hexadecimal #rrggbb or #rgb value or a color keyword. omitting the attribute or setting it to null in javascript causes the row's cells to inherit the row's parent element's background color. the <tr> element should be styled using css. to give a similar effect as the bgcolor attribute, use the css property background-color. charobsolete since html5 a domstring which sets the character to align the cells in each of the row's columns on (each row's centering that uses the same character gets aligned with others using the same character . typical values for this include a period (".") or comma (",") when att...
...cell span across two columns. once again, we haven't touched the css. table { border: 1px solid black; } th, td { border: 1px solid black; } result the output is entirely unchanged, despite the addition of useful contextual information under the hood: basic styling as is the case with all parts of a table, you can change the appearance of a table row and its contents using css. any styles applied to the <tr> element will affect the cells within the row unless overridden by styles applied to those cells. let's apply a basic style to the table to adjust the typeface being used, and add a background color to the header row. result again, let's take a look at the result first. <table> <thead> <tr> <th rowspan="2">name</th> <th rowspan="2">id</th> <th co...
...solid black; font: 16px "open sans", helvetica, arial, sans-serif; } thead > tr { background-color: rgb(228, 240, 245); } th, td { border: 1px solid black; padding:4px 6px; } while we add a font property to the <table> element here to set a more visually-appealing typeface (or an an abominable sans-serif typeface, depending on your personal opinion), the interesting part is the second style here, where we style <tr> elements located within the <thead> so they have a light blue background color. this is a way to quickly apply a background color to all of the cells in the heading area at once. this does not affect the style of the <th> elements in the first column, though, where we treat the member names as a row heading. advanced styling now we'll go all-out, with styles on rows i...
...And 4 more matches
Using shadow DOM - Web Components
the shadow dom api is a key part of this, providing a way to attach a hidden separated dom to an element. this article covers the basics of using the shadow dom. note: shadow dom is supported by default in firefox (63 and onwards), chrome, opera, and safari. the new chromium-based edge (75 and onwards) supports it too; the old edge didn't. ...
...t the shadow dom is attached to. shadow tree: the dom tree inside the shadow dom. shadow boundary: the place where the shadow dom ends, and the regular dom begins. shadow root: the root node of the shadow tree. you can affect the nodes in the shadow dom in exactly the same way as non-shadow nodes — for example appending children or setting attributes, styling individual nodes using element.style.foo, or adding style to the entire shadow dom tree inside a <style> element. the difference is that none of the code inside a shadow dom can affect anything outside it, allowing for handy encapsulation. note that the shadow dom is not a new thing by any means — browsers have used it for a long time to encapsulate the inner structure of an element. think for example of a <video> element, with t...
...'); // take attribute content and put it inside the info span let text = this.getattribute('data-text'); info.textcontent = text; // insert icon let imgurl; if(this.hasattribute('img')) { imgurl = this.getattribute('img'); } else { imgurl = 'img/default.png'; } let img = document.createelement('img'); img.src = imgurl; icon.appendchild(img); styling the shadow dom after that we create a <style> element and populate it with some css to style it: // create some css to apply to the shadow dom let style = document.createelement('style'); style.textcontent = ` .wrapper { position: relative; } .info { font-size: 0.8rem; width: 200px; display: inline-block; border: 1px solid black; padding: 10px; background: white; border-radius: 10px; opacity: 0; transition: 0.6s all; ...
...And 4 more matches
Modifying the Page Hosted by a Tab - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm. to modify the page hosted by a particular tab, load one or more content scripts into it using attach() method of tab object. the job of these scripts is to interact with web content. here's a simple example: var button = require("sdk/ui/button/action").actionbutton({ id: "style-tab", label: "style tab", icon: "./icon-16.png", onclick: function() { require("sdk/tabs").activetab.attach({ contentscript: 'document.body.style.border = "5px solid red";' }); } }); to run this example, save an icon file named "icon-16.png" in add-on's "data" directory. you could download this icon: . this add-on creates a button with mozilla favicon as an icon. it has a click handler which fetches the active tab and ...
.... this makes the code easier to maintain, debug, and review. to do this, provide option contentscriptfile not contentscript, whose value is a url pointing to one or more content script files. for example, if we save the script above under the add-on's data directory in a file called my-script.js: var self = require("sdk/self"); var button = require("sdk/ui/button/action").actionbutton({ id: "style-tab", label: "style tab", icon: "./icon-16.png", onclick: function() { require("sdk/tabs").activetab.attach({ contentscriptfile: self.data.url("my-script.js") }); } }); you can load more than one script, and the scripts can interact directly with each other. so you can load jquery, and then your content script can use that. loading several content script files the data a...
...cript, tab.attach() returns a worker object containing the port property you use to send messages to the content script. let's rewrite the example above to pass a message from the add-on to the content script. ...
...And 3 more matches
Extension Theming Guidelines - Archive of obsolete content
guidelines on how to control the look and feel of your extension while leaving it open for styling by custom themes. skin packages just as extension code should exist in chrome content packages, all of the styling for an extension including css and images should exist in a chrome skin package. ...
...ving it open for styling by custom themes. skin packages just as extension code should exist in chrome content packages, all of the styling for an extension including css and images should exist in a chrome skin package. custom themes may then register a replacement for your skin package allowing them to provide their own styles for all of your content. ...
... styling for an extension including css and images should exist in a chrome skin package. custom themes may then register a replacement for your skin package allowing them to provide their own styles for all of your content. branding certain items of your extensions style, in particular logos and icons can be kept in the chrome content package such that they are not replaceable by custom themes stylesheets guidelines include stylesheets for every new window that your extension adds and for every window that your extension overlays content into be sure to add a stylesheet from your chrome skin package. ...
...And 3 more matches
Appendix E: DOM Building and Insertion (HTML & XUL) - Archive of obsolete content
es contains any created nodes that have optionally been captured (for later convenient javascript access) by giving them a 'key' attribute; for example: " + capturednodes.mytestbutton123); another example this here is another example of using jsontodom but in the html scope, a complex form is created with ease. ...
...a document fragment while removing any scripts or other unsafe content in the process. let { cc, ci } = require("chrome"); /** * safely parse an html fragment, removing any executable * javascript, and return a document fragment. * * @param {document} doc the document in which to create the * returned dom tree. * @param {string} html the html fragment to parse. ...
...ile removing any scripts or other unsafe content in the process. let { cc, ci } = require("chrome"); /** * safely parse an html fragment, removing any executable * javascript, and return a document fragment. * * @param {document} doc the document in which to create the * returned dom tree. * @param {string} html the html fragment to parse. ...
...And 3 more matches
JXON - Archive of obsolete content
}, "input": [{ "@type": "hidden", "@name": "instid", "@value": 1234 }, { "@type": "hidden", "@name": "currency", "@value": "gbp" }, { "@type": "hidden", "@name": "amount", "@value": 0 }, { "@type": "hidden", "@name": "name", "@value": "captured" }], "table": { "tr": [{ "th": { "@style": "text-align: right;", "keyvalue": "product:" }, "td": { "span": [{ "input": { "@type": "radio", "@name": "nome", "@id": "rel_tshirt", "@value": "tshirt" }, "label": { "@for": "rel_tshirt", "keyvalue": "t-shirt" }, "@c...
...uct" }, { "input": { "@type": "radio", "@name": "nome", "@id": "rel_pullover", "@value": "pullover" }, "label": { "@for": "rel_pullover", "keyvalue": "pullover" }, "@class": "product" }] } }, { "th": { "@style": "text-align: right;", "keyvalue": "quantity:" }, "td": { "input": { "@type": "text", "@name": "myinput", "@onkeypress": "return numbersonly(this, event);", "@onpaste": "return false;" } } }] }, "p": { "input": { "@type": "submit", "@value": "purchase!" ...
...otocheckfield, okeyevent) { return okeyevent.charcode === 0 || /\d/.test(string.fromcharcode(okeyevent.charcode)); } </script> <input type="hidden" name="instid" value="1234" /> <input type="hidden" name="currency" value="gbp" /> <input type="hidden" name="amount" value="0" /> <input type="hidden" name="name" value="captured" /> <table> <tr> <th style="text-align: right;">product:</th> <td><span class="product"><input type="radio" name="nome" id="rel_tshirt" value="tshirt"/><label for="rel_tshirt">t-shirt</label></span><span class="product"><input type="radio" name="nome" id="rel_trousers" value="trousers"/><label for="rel_trousers">trousers</label></span><span class="product"><input type="radio" name="nome" id="rel_pullover" value="pu...
...And 3 more matches
Notes on HTML Reflow - Archive of obsolete content
n for each frame object that requires it. reflow may have the side-effect of creating new continuation frames, for example, for a text frame when the text must be wrapped. some reflows are immediate in response to user or script actions; for example, resizing the window or changing the document's default font. these are dispatched directly from the presentation shell (e.g., nsipresshell::stylechangereflow), and affect the entire frame tree. other reflows are incremental and are dealt with asynchronously; for example, when content streams in from the network. incremental reflows are queued by the presentation shell for batched dispatch. reflow state the reflow state object, nshtmlreflowstate, is used to pass constraining information "down" from parent frames to child f...
...able width) have changed; instead, something "within" the frame has changed, which may have bottom-up impact to the frame hierarchy. resize, when the containing boundary for the frame hierarchy changes. during a resize reflow, the frame can assume that none of the frame's internal state (e.g., a text frame's text) has changed; instead, a top-down change in the layout constraints has occurred. ...
...ext) has changed; instead, a top-down change in the layout constraints has occurred. stylechange, when the entire frame hierarchy must be traversed to recover from stylistic change; for example, a change in the default font size. dirty, when a container frame has consolidated several individual incremental reflows that have been targeted at its child frames. initial, incremental, resize, and style change reflows may each be performed as an immediate "global" reflow from the presentation shell: an initial reflow is performed when the presentation shell is initialized to flow the shell's initial frame hierarchy. incremental reflows are dispatched en masse when the presentation shell's incremental reflow queue is asynchronously serviced. a resize reflow is performed when...
...And 3 more matches
New Skin Notes - Archive of obsolete content
ia wordpress skins need footer information. -- dria when a page is redirected, need to say-so and what it was redirected from, (see document for an example of such.) this is only an issue in mw1.5 so far. devmo skin vs cavendish skin --callek i can probably pull-off this patch if needed (quickly), so dria or others do not have to hunt up "how". --callek add "what not to do" css class to stylesheet, as discussed on talk:core javascript 1.5 reference. what's the class called? --maian 21:08, 1 sep 2005 (pdt) in the new mw1.5 skin (not the one currently available here) there's class "wrong" and class "wrong-inline". those will be available after we do the wiki upgrades in the near future. --dria headers need a little padding. h1 could be smaller. --dria is it just me or visited li...
...omeone who uses devmo on regular basis sees some violet links just because he already worked with this site yesterday.also, the current color for visited links makes them less visible. --gandalf 00:45, 31 aug 2005 (pdt) i don't like the current color too, but i strongly disagree that we don't need to give visited links different color. this is not what user expects (well, i don't expect sites to style visited and non-visited links the same), and it's false that other documentation sites do this (i just checked apple's and microsoft's sites). your statement that "it looks odd when someone who uses devmo on regular basis sees some violet links just because he already worked with this site yesterday" holds true for every single place on the web, yet visited links use different styling on most sit...
... so i think we'll just leave the internal/external links colours the same. ==dria you've got to be kidding me, the colors are clearly different (rgb(0,51,153) vs rgb(51,102,187)). --nickolay 09:19, 25 aug 2005 (pdt) (moving this to a new item) on the contrary, the list of categories current page belongs to, should be near the footer (see mdc:policies_and_guidelines page) (dria: fix catlinks style) the arrows that appear if you select "enhanced recent changes" in your preferences have an ugly border around them. --nickolay 04:43, 25 aug 2005 (pdt) the radio buttons on history page are jumping in a weird way because the selected row becomes bold. --nickolay 04:46, 25 aug 2005 (pdt) the sidebar overrides content on diff pages --nickolay turns out this was fixed for 1.5 already. --dri...
...And 3 more matches
Anonymous Content - Archive of obsolete content
d the textfield within an html file upload control, then the file upload control is now also focused. if the user then focuses the button inside the file upload control, the focus event generated for the button is stopped before it reaches the file control, since the file control is already focused. because content in multiple scopes can be focused, the css :focus pseudo-element is hierarchical. style rules can be written with the assumption that they will match (in the above example) both the file control and the element focused inside the file control. in other words, an arbitrary chain of elements can be in the :focus state at the same time. mouseover and mouseout events mouseover and mouseout events are retargeted if the mouse genuinely enters or exits the bound element (in addition to e...
...lso have an arbitrary set of anonymous parents (created by bindings when child insertion points were used). child, descendant, and sibling selectors will match on any path of anonymous and explicit elements. as far as css is concerned, anonymous content nodes are children (or descendants) of the bound element, they are ancestors of explicit content, and they are siblings of the explicit content. style rules using the child, descendant, or sibling selectors transparently cross bind scopes and operate on the altered and original content models. the final modified content tree determines how css properties (e.g., fonts and colors) are inherited. an element either ends up underneath its explicit parent (just as in the content model), or it ends up being nested through a series of insertion points...
...oss bind scopes and operate on the altered and original content models. the final modified content tree determines how css properties (e.g., fonts and colors) are inherited. an element either ends up underneath its explicit parent (just as in the content model), or it ends up being nested through a series of insertion points. when nested, it inherits from the innermost anonymous parent. ...
...And 3 more matches
Things I've tried to do with XUL - Archive of obsolete content
he window is unfortunately very difficult. (to add insult, xul layout code *explicitly* trims off '%' from width/height, thus treating it as pixels.) for reference, i'd like the following to give a vbox that resizes along with the window, with the green, red, and blue inside boxes always maintaining a 30%-20%-50% ratio to the height of the parent vbox. ...
..., xul layout code *explicitly* trims off '%' from width/height, thus treating it as pixels.) for reference, i'd like the following to give a vbox that resizes along with the window, with the green, red, and blue inside boxes always maintaining a 30%-20%-50% ratio to the height of the parent vbox. ...
.../height, thus treating it as pixels.) for reference, i'd like the following to give a vbox that resizes along with the window, with the green, red, and blue inside boxes always maintaining a 30%-20%-50% ratio to the height of the parent vbox. ...
...And 3 more matches
Adding Methods to XBL-defined Elements - Archive of obsolete content
each calls the 'showtitle' method. this method checks to see whether the element is be...
...each calls the 'showtitle' method. this method checks to see whether the element is being hidden or shown from the 'state' parameter that is passed in. in either case, it grabs the first element ...
... used to change the visibility of the label. each calls the 'showtitle' method. this method checks to see whether the element is being hidden or shown from the 'state' parameter that is passed in. in either case, it grabs the first element of the anonymous array. this refers to the first child in the content element, which here is the first label widget. the visibility is changed by modifying the style on the element. accessing from inside the anonymous content to go the other way, and get the bound element from inside the anonymous content, you can use the getbindingparent method of the document to get the element that the binding is bound to. you can also use the the parentnode property to go up by a single node, but the getbindingparent method is useful for a node that is nested several le...
...And 3 more matches
XUL element attributes - Archive of obsolete content
the elements are aligned on their left edges. center the elements are centered horizontally. right the elements are aligned on their right edges. the pack attribute is related to the alignment but is used to specify the position in the opposite direction. you can also specify the value of align using the style property -moz-box-align. allowevents type: boolean if true, events are passed to children of the element. otherwise, events are passed to the element only. allownegativeassertions type: boolean valid on any element that has a datasources attribute. when multiple datasources are used, one may override an assertion from another. this attribute, if true, which is the default,...
...ssed to children of the element. otherwise, events are passed to the element only. allownegativeassertions type: boolean valid on any element that has a datasources attribute. when multiple datasources are used, one may override an assertion from another. this attribute, if true, which is the default, allows a datasource to negate an earlier assertion. class type: string the style class of the element. multiple classes may be specified by separating them with spaces. coalesceduplicatearcs type: boolean valid on any element that has a datasources attribute. when multiple datasources are used, one may override an assertion from another. this attribute, if true, which is the default, allows a datasource to negate an earlier assertion. collapsed type: boolean ...
...r maximum height. the css height property may also be used. hidden type: boolean if set to true, the element is not displayed. this is similar to setting the css display property to 'none'. id type: unique id a unique identifier so that you can identify the element with. you can use this as a parameter to getelementbyid() and other dom functions and to reference the element in style sheets. insertafter type: id when an element is in an overlay, the insertafter attribute specifies the id of the element in the base window that the element should appear after. this attribute overrides the insertbefore attribute. this value may be a comma-separated list of ids, which are scanned and the first one found in the window is used. insertbefore type: id when an elem...
...And 3 more matches
splitter - Archive of obsolete content
element which should appear before or after an element inside a container. when the splitter is dragged, the sibling elements of the splitter are resized. if a grippy is placed inside the splitter, one sibling element of the splitter is collapsed when the grippy is clicked. more information is available in the xul tutorial. attributes collapse, resizeafter, resizebefore, state, substate style classes tree-splitter examples <!-- this bar has some styling associated with it. the vbox is used to hold the .png image that a user clicks on to resize the search bar.--> <splitter tooltiptext="resize the search box" oncommand="alert('the splitter was dragged')"> <vbox id="example_vbox" /> </splitter> attributes collapse type: one of the values below determines which sid...
...t or above the splitter resizes. farthest the element that is the farthest away from the splitter to the left or above the splitter resizes. flex the closest flexible element resizes. state type: one of the values below indicates whether the splitter has collapsed content or not. this attribute will be updated automatically as the splitter is moved, and is generally used in a stylesheet to apply a different appearance for each state. open the content either before or after the splitter, depending on the value of the collapsed attribute, is currently displayed. collapsed the content either before or after the splitter is collapsed and is not visible. dragging the user is current adjusting the position of the splitter, typically by dragging it with the mouse. ...
...fter the splitter is collapsed. ...
...And 3 more matches
Summary of Changes - Archive of obsolete content
document.forms["formname"].formctrlname ie5+ document.forms(0) dom level 1: document.forms[0] ie elemref.innertext dom level 1 (core) interface we could introduce dom 3 core textcontent attribute here which is supported by mozilla 1.5+ and is a perfect equivalent to innertext. ...
... ie5+ document.forms(0) dom level 1: document.forms[0] ie elemref.innertext dom level 1 (core) interface we could introduce dom 3 core textcontent attribute here which is supported by mozilla 1.5+ and is a perfect equivalent to innertext. ...
...evel 1: document.forms[0] ie elemref.innertext dom level 1 (core) interface we could introduce dom 3 core textcontent attribute here which is supported by mozilla 1.5+ and is a perfect equivalent to innertext. ...
...And 3 more matches
Fixing Table Inheritance in Quirks Mode - Archive of obsolete content
this led to a number of workarounds which were designed to cater to these bugs, and also to gecko-based browsers emulating the behavior in some cases. ...
...m parent elements. find out why this happens and how to fix it in documents that have to remain in quirks mode. in version 4 browsers such as netscape navigator 4.x and internet explorer 4.x, tables generally "broke" the inheritance of font styling. if the author had set a font size on the body element, for example, the font size of text within a table would match the user's default, not the body style. this led to a number of workarounds which were designed to cater to these bugs, and also to gecko-based browsers emulating the behavior in some cases. fortunately, the behavior can be overcome in all cases with a single css2 rule. tables and inheritance in css terms, tables are like any other element when it comes to inheritance. if a css property can be inherited, then table elements and thei...
...rs emulating the behavior in some cases. fortunately, the behavior can be overcome in all cases with a single css2 rule. tables and inheritance in css terms, tables are like any other element when it comes to inheritance. if a css property can be inherited, then table elements and their components (tr, td, etc.) should inherit just as any other element would. for example, if an author writes: <style type="text/css"> body {font-size: 11px;} </style> ...then the text inside table cells should also be 11 pixels in size. browsers from the version-four era, however, treated tables differently. in these browsers, a table's text would be the same size as the user's default settings, regardless of the css assigned to ancestor elements such as body. this represented a violation of css inheritance r...
...And 3 more matches
Issues Arising From Arbitrary-Element hover - Archive of obsolete content
summary: thanks to long-standing limitations, we're used to thinking of hover styles as applying only to hyperlinks, which has led to some sloppy authoring practices that are now causing problems for some web sites. this technote explains the source of the problems and how to avoid encountering them. many authors make use of the css2 pseudo-class :hover to style their links. this innovation, first introduced by microsoft® internet explorer and later adopted into the css specification, is very popular for the styling of text links, particularly those that are supposed to look and act like javascript-driven "rollovers." however, advancing css support in browsers has caused some unexpectedly aggressive hovering behavior on some pages. hover and non-link elements section 5.11.3 of css2 defines ...
...tates are entered and left. scripting may change whether elements react to user events or not, and different devices and uas may have different ways of pointing to, or activating elements. thus, although authors are used to thinking of these states as applying exclusively to hyperlinks, they are not so restricted by css2. any element can, in theory, be in any of the three states, and thus can be styled based on those states. this has not traditionally been the case. bare pseudo-classes the second piece of the problem comes when we consider the effects of a "bare" pseudo-class in a selector. for example: :hover {color: red;} this is equivalent to the css2 rule: *:hover {color: red;} ..which translates as "any element that is being hovered should have its foreground colored red." thus, hov...
...r.html" class="nav">three</a> | <a href="fou.html" class="nav">four</a> </td> because the enclosing table cell has a class of nav, the vertical-bar characters will turn red when the user moves the mouse pointer anywhere within the table cell. the links will also turn red when they are hovered. gecko behavior in browsers based on netscape gecko builds later than 20020410 (netscape 6.1+), :hover styles can be applied to any element in a document. thus authors who have used bare pseudo-classes, or bare class-pseudo-class combinations, are at risk of seeing hover styles applied to more than just their links. the most reliable fix is to add the anchor element to the selectors, like this: a:hover {color: red;} a.nav:hover {color: red;} in an attempt to avoid causing problems for legacy documents...
...And 3 more matches
Create the Canvas and draw on it - Game development
the <canvas> element. the game's html the html document structure is quite simple, as the game will be rendered entirely on the <canvas> element. using your favourite text editor, create a new html document, save it as index.html, in a sensible location, and add the following code to it: <!doctype html> <html> <head> <meta charset="utf-8" /> <title>gamedev canvas workshop</title> <style> * { padding: 0; margin: 0; } canvas { background: #eee; display: block; margin: 0 auto; } </style> </head> <body> <canvas id="mycanvas" width="480" height="320"></canvas> <script> // javascript code goes here </script> </body> </html> we have a charset defined, <title> and some basic css in the header. the body contains <canvas> and <script> elements — we will render the ga...
... <canvas> element to the canvas variable. then we're creating the ctx variable to store the 2d rendering context — the actual tool we can use to paint on the canvas. let's see an example piece of code that prints a red square on the canvas. add this below your previous lines of javascript, then load your index.html in a browser to try it out. ctx.beginpath(); ctx.rect(20, 40, 50, 50); ctx.fillstyle = "#ff0000"; ctx.fill(); ctx.closepath(); all the instructions are between the beginpath() and closepath() methods. we are defining a rectangle using rect(): the first two values specify the coordinates of the top left corner of the rectangle on the canvas, while the second two specify the width and height of the rectangle. in our case the rectangle is painted 20 pixels from the left side of the...
... defining a rectangle using rect(): the first two values specify the coordinates of the top left corner of the rectangle on the canvas, while the second two specify the width and height of the rectangle. in our case the rectangle is painted 20 pixels from the left side of the screen and 40 pixels from the top side, and is 50 pixels wide and 50 pixels high, which makes it a perfect square. ...
...And 3 more matches
Web fonts - Learn web development
.ttf, .woff, .woff2, etc.; the exact fonts provided will be updated over time as browser support requirements change). as mentioned above, multiple fonts are needed for cross browser support — this is fontsquirrel's way of making sure you've got everything you need. a demo html file for each font — load these in your browser to see what the font will look like in different usage contexts. ...
...ing sure you've got everything you need. a demo html file for each font — load these in your browser to see what the font will look like in different usage contexts. a stylesheet.css file, which contains the generated @font-face code you'll need. to implement these fonts in your demo, follow these steps: rename the unzipped directory to something easy and simple, like fonts. open up the stylesheet.css file and copy both the @font-face blocks contained inside into your web-font-start.css file — you need to put them at the very top, before any of your css, as the fonts need to be imported before you can use them on your site. each of the url() functions points to a font file that we want to import into our css — we need to make sure the paths to the files are correct, so add fonts/...
...let's go through it to see what it does: font-family: this line specifies the name you want to refer to the font as. you can put this as anything you like, as long as you use it consistently throughout your css. sr...
...And 3 more matches
What are browser developer tools? - Learn web development
lts of your changes reflected live in the browser viewport. if you don't see the inspector, tap/click the inspector tab. in internet explorer, tap/click dom explorer, or press ctrl + 1. in microsoft edge, or opera, tap/click elements. in safari, the controls are not so clearly presented, but you should see the html if you haven't selected something else to appear in the window. press the style button to see the css. exploring the dom inspector for a start, right-click (ctrl-click) an html element in the dom inspector and look at the context menu. the available menu options vary among browsers, but the important ones are mostly the same: delete node (sometimes delete element). deletes the current element. edit as html (sometimes add attribute/edit text). lets you change the htm...
...s applied to the current element are shown in order of most-to-least-specific. click the checkboxes next to each declaration to see what would happen if you removed the declaration. click the little arrow next to each shorthand property to show the property's longhand equivalents. click a property name or value to bring up a text box, where you can key in a new value to get a live preview of a style change. next to each rule is the file name and line number the rule is defined in. clicking that rule causes the dev tools to jump to show it in its own view, where it can generally be edited and saved. you can also click the closing curly brace of any rule to bring up a text box on a new line, where you can write a completely new declaration for your page. you'll notice a number of clickable...
...defined in. clicking that rule causes the dev tools to jump to show it in its own view, where it can generally be edited and saved. you can also click the closing curly brace of any rule to bring up a text box on a new line, where you can write a completely new declaration for your page. you'll notice a number of clickable tabs at the top of the css viewer: computed: this shows the computed styles for the currently selected element (the final, normalized values that the browser applies). layout: in firefox, this area includes two sections: box model: represents visually the current element's box model, so you can see at a glance what padding, border and margin is applied to it, and how big its content is. grid: if the page you are inspecting uses css grid, this section allows yo...
...And 3 more matches
Client-side form validation - Learn web development
e. pattern: specifies a regular expression that defines a pattern the entered data needs to follow. if the data entered in a form field follows all of the rules specified by the above attributes, it is considered valid. if not, it is considered invalid. when an element is valid, the following things are true: the element matches the :valid css pseudo-class, which lets you apply a specific style to valid elements. if the user tries to send the data, the browser will submit the form, provided there is nothing else stopping it from doing so (e.g., javascript). when an element is invalid, the following things are true: the element matches the :invalid css pseudo-class, and sometimes other ui pseudo-classes (e.g., :out-of-range) depending on the error, which lets you apply a specific s...
... <option>lemon</option> <option>orange</option> </datalist> </p> <p> <label for="t2">what's your e-mail address?</label> <input type="email" id="t2" name="email"> </p> <p> <label for="t3">leave a short message</label> <textarea id="t3" name="msg" maxlength="140" rows="5"></textarea> </p> <p> <button>submit</button> </p> </form> and now some css to style the html: form { font: 1em sans-serif; max-width: 320px; } p > label { display: block; } input[type="text"], input[type="email"], input[type="number"], textarea, fieldset { width : 100%; border: 1px solid #333; box-sizing: border-box; } input:invalid { box-shadow: 0 0 5px 1px red; } input:focus:invalid { box-shadow: none; } this renders as follows: see validation-related ...
...alidate attribute to turn off the browser's automatic validation; this lets our script take control over validation. however, this doesn't disable support for the constraint validation api nor the application of css pseudo-classes like :valid, etc. that means that even though the browser doesn't automatically check the validity of the form before sending its data, you can still do it yourself and style the form accordingly. our input to validate is an <input type="email">, which is required, and has a minlength of 8 characters. let's check these using our own code, and show a custom error message for each one. we are aiming to show the error messages inside a <span> element. the aria-live attribute is set on that <span> to make sure that our custom error message will be presented to everyone,...
...And 3 more matches
Advanced text formatting - Learn web development
d> <dt>monologue</dt> <dd>in drama, where a character speaks their thoughts out loud to share them with the audience and any other characters present.</dd> <dt>aside</dt> <dd>in drama, where a character shares a comment only with the audience for humorous or dramatic effect. this is usually a feeling, thought, or piece of additional background information.</dd> </dl> the browser default styles will display description lists with the descriptions indented somewhat from the terms. note that it is permitted to have a single term with multiple descriptions, for example: <dl> <dt>aside</dt> <dd>in drama, where a character shares a comment only with the audience for humorous or dramatic effect. this is usually a feeling, thought, or piece of additional background information.</dd> ...
...description lists; add elements to the raw text in the input field so that it appears as a description list in the output field. you could try using your own terms and descriptions if you like. if you make a mistake, you can always reset it using the reset button. if you get really stuck, press the show solution button to see the answer. playable code <h2>live output</h2> <div class="output" style="min-height: 50px;"> </div> <h2>editable code</h2> <p class="a11y-label">press esc to move focus away from the code area (tab inserts a tab character).</p> <textarea id="code" class="input" style="min-height: 100px; width: 95%"> bacon the glue that binds the world together. eggs the glue that binds the cake together. coffee the drink that gets the world running in the morning. a light brown col...
... active learning: who said that? time for another active learning example! in this example we'd like you to: turn the middle paragraph into a blockquote, which includes a cite attribute. turn "the need to eliminate negative self talk" in the third paragraph into an inline quote, and include a cite attribute. wrap the title of each source in <cite> tags and turn...
...And 3 more matches
Adding vector graphics to the Web - Learn web development
eate a variety of illustrations using various graphics tools, and create approximations of photos (for example inkscape's trace bitmap feature.) svg has some additional advantages besides those described so far: text in vector images remains accessible (which also benefits your seo). svgs lend themselves well to styling/scripting, because each component of the image is an element that can be styled via css or scripted via javascript. so why would anyone want to use raster graphics over svg? well, svg does have some disadvantages: svg can get complicated very quickly, meaning that file sizes can grow; complex svgs can also take significant processing time in the browser. svg can be harder to create than raster images, depending on what kind of image you are trying to create. svg is n...
...alent available in the alt attribute. you can make the image into a hyperlink easily by nesting the <img> inside an <a> element. the svg file can be cached by the browser, resulting in faster loading times for any page that uses the image loaded in the future. cons you cannot manipulate the image with javascript. if you want to control the svg content with css, you must include inline css styles in your svg code. (external stylesheets invoked from the svg file take no effect.) you cannot restyle the image with css pseudoclasses (like :focus). troubleshooting and cross-browser support for browsers that don't support svg (ie 8 and below, android 2.3 and below), you could reference a png or jpg from your src attribute and use a srcset attribute (which only recent browsers recognize) to...
... and ends with the <svg></svg> tags (don't include anything outside those.) here's a very simple example of what you might paste into your document: <svg width="300" height="200"> <rect width="100%" height="100%" fill="green" /> </svg> pros putting your svg inline saves an http request, and therefore can reduce a bit your loading time. ...
...And 3 more matches
Introducing asynchronous JavaScript - Learn web development
n the ui somehow that's because you don't know how long the image will take to download, so when you come to run the second line it will throw an error (possibly intermittently, possibly every time) because the response is not yet available. instead, you need your code to wait until the response is returned before it tries to do anything else to it. there are two main types of asynchronous code style you'll come across in javascript code, old-style callbacks and newer promise-style code. in the below sections we'll review each of these in turn. async callbacks async callbacks are functions that are specified as arguments when calling a function which will start executing code in the background. when the background code finishes running, it calls the callback function to let you know the wor...
...ndex){ console.log(index + '. ' + eachname); }); in this example we loop through an array of greek gods and print the index numbers and values to the console. the expected parameter of foreach() is a callback function, which itself takes two parameters, a reference to the array name and index values. however, it doesn't wait for anything — it runs immediately. promises promises are the new style of async code that you'll see used in modern web apis. a good example is the fetch() api, which is basically like a modern, more efficient version of xmlhttprequest. let's look at a quick example, from our fetching data from the server article: fetch('products.json').then(function(response) { return response.json(); }).then(function(json) { products = json; initialize(); }).catch(function(...
... them fully yet. the event queue async operations like promises are put into an event queue, which runs after the main thread has finished processing so that they do not block subsequent javascript code from running. the queued operations will complete as soon as possible then return their results to the javascript environment. ...
...And 3 more matches
Client-side storage - Learn web development
em is stored in web storage if(localstorage.getitem('name')) { // if it is, display personalized greeting let name = localstorage.getitem('name'); h1.textcontent = 'welcome, ' + name; personalgreeting.textcontent = 'welcome to our website, ' + name + '! ...
...rage.getitem('name')) { // if it is, display personalized greeting let name = localstorage.getitem('name'); h1.textcontent = 'welcome, ' + name; personalgreeting.textcontent = 'welcome to our website, ' + name + '! ...
...if we don't do this, then the personalized greeting will not persist across page reloads. ...
...And 3 more matches
Useful string methods - Learn web development
? you'll then need to write a conditional test of the form operand1 operator operand2. is the thing on the left equal to the thing on the right? or in this case, does the method call on the left return the result on the right? hint: in this case it is probably more useful to test whether the method call isn't equal to a certain result. ...
...right? hint: in this case it is probably more useful to test whether the method call isn't equal to a certain result. ...
...per case. store the result of this replace procedure in another new variable. change the value of the result variable to equal to the final result, not the input. note: a hint — the parameters of the string methods don't have to be string literals; they can also be variables, or even variables with a method being invoked on them. ...
...And 3 more matches
Object building practice - Learn web development
of these apis, and we hope that by the time you've finished this article you'll be interested in exploring them more. along the way we'll make use of some nifty objects, and show you a couple of nice techniques like bouncing balls off walls, and checking whether they have hit each other (otherwise known as collision detection). ...
...ecking whether they have hit each other (otherwise known as collision detection). getting started to begin with, make local copies of our index.html, style.css, and main.js files. these contain the following, respectively: a very simple html document featuring an <h1> element, a <canvas> element to draw our balls on, and elements to apply our css and javascript to our html. some very simple styles, which mainly serve to style and position the <h1>, and get rid of any scrollbars or margin around the edge of the page (so that it looks nice and neat). some javascript that serves to set up the <canvas> element and provide a general function that we're going to use. the first part of the script looks like so: const canvas = document.queryselector('canvas'); const ctx = canvas.getcontext('...
...his much on each frame. color — each ball gets a color. size — each ball gets a size — this is its radius, in pixels. this handles the properties, but what about the methods? we want to get our balls to actually do something in our program. drawing the ball first add the following draw() method to the ball()'s prototype: ball.prototype.draw = function() { ctx.beginpath(); ctx.fillstyle = this.color; ctx.arc(this.x, this.y, this.size, 0, 2 * math.pi); ctx.fill(); } using this function, we can tell the ball to draw itself onto the screen, by calling a series of members of the 2d canvas context we defined earlier (ctx). the context is like the paper, and now we want to command our pen to draw something on it: first, we use beginpath() to state that we want to draw a shape ...
...And 3 more matches
Handling common accessibility problems - Learn web development
ogical sense in its source order — you can always place it where you want using css later on, but you should get the source order right to start with. as a test, you can turn off a site's css and see how understandable it is without it. ...
...e in its source order — you can always place it where you want using css later on, but you should get the source order right to start with. as a test, you can turn off a site's css and see how understandable it is without it. you could do this manually by just removing the css from your code, but the easiest way is to use browser features, for example: firefox: select view > page style > no style from the main menu. safari: select develop > disable styles from the main menu (to enable the develop menu, choose safari > preferences > advanced > show develop menu in menu bar). chrome: install the web developer toolbar extension, then restart the browser. click the gear icon that will appear, then select css > disable all styles. edge: select view > style > no style from the main menu. u...
... to interact with web pages, namely links, <button>s, and form elements like <input>. you can try this out using our native-keyboard-accessibility.html example (see the source code) — open this in a new tab, and try pressing the tab key; after a few presses, you should see the tab focus start to move through the different focusable elements; the focused elements are given a highlighted default style in every browser (it differs slightly between different browsers) so that you can tell what element is focused. you can then press enter/return to follow a focused link or press a button (we've included some javascript to make the buttons alert a message), or start typing to enter text in a text input (other form elements have different controls, for example the <select> element can have its o...
...And 3 more matches
Implementing feature detection - Learn web development
specific browser is accessing the site) — this is a terrible practice that should be discouraged at all costs. see using bad browser sniffing code for more details. writing your own feature detection tests in this section, we'll look at implementing your own feature detection tests, in both css and javascript. css you can write tests for css features by testing for the existence of element.style.property (e.g. paragraph.style.transform) in javascript. a classic example might be to test for flexbox support in a browser; for browsers that support the newest flexbox spec, we could use a flexible and robust flex layout. for browsers that don't, we could use a floated layout that works ok, although it is slightly more brittle and hacky, and not as cool-looking. let's implement something tha...
...it is slightly more brittle and hacky, and not as cool-looking. let's implement something that demonstrates this, although we'll keep it simple for now. start by making local copies of our css-feature-detect.html, flex-layout.css, float-layout.css, and basic-styling.css files. save them in a new directory. we will add the html5 shiv to our example too so that the html5 semantic elements will style properly in older versions of ie. download the latest version (see manual installation), unzip the zip file, copy the html5shiv-printshiv.min.js and html5shiv.min.js files into your example directory, and link to one of the files by putting the following under your <title> element: <script src="html5shiv.min.js"></script> have a look at your example css files — you'll see that basic-stylin...
...swap them as needed. first, remove the contents of the second <link> element's href attribute. we will fill this in dynamically later on. next, add a <script></script> element at the bottom of your body (just before the closing </body> tag). give it the following contents: const conditional = document.queryselector('.conditional'); const testelem = document.createelement('div'); if (testelem.style.flex !== undefined && testelem.style.flexflow !== undefined) { conditional.setattribute('href', 'flex-layout.css'); } else { conditional.setattribute('href', 'float-layout.css'); } here we are grabbing a reference to the second <link> element, and creating a <div> element as part of our test. in our conditional statement, we test that the flex and flex-flow properties exist in the browser...
...And 3 more matches
Displaying Places information using views
are generic and will save you a lot of time writing basic functionality so that you can focus on building your extension or application. places provides the following built-in views: tree menu toolbar instantiating the three built-in views are simply standard xul elements with a special type attribute whose value is "places". every xul document containing a built-in view must import the stylesheet browser/components/places/content/places.css and overlay the file browser/components/places/content/placesoverlay.xul: <?xml-stylesheet href="chrome://browser/content/places/places.css" ?> <?xul-overlay href="chrome://browser/content/places/placesoverlay.xul" ?> it's this stylesheet that binds elements with the special type attribute to one of the views. the overlay contains javascript req...
...the treechildren element should be empty: <tree type="places"> <treecols> <treecol id="title" flex="1" primary="true" /> <treecol id="url" flex="1" /> </treecols> <treechildren /> </tree> the tree view is implemented in browser/components/places/content/tree.xml. see the tree reference and trees tutorial for general information about trees. ...
...y: <tree type="places"> <treecols> <treecol id="title" flex="1" primary="true" /> <treecol id="url" flex="1" /> </treecols> <treechildren /> </tree> the tree view is implemented in browser/components/places/content/tree.xml. see the tree reference and trees tutorial for general information about trees. ...
...And 3 more matches
Extras
g"> <mi>log</mi> <mi>a</mi> </msub> <mo>&applyfunction;</mo> <mi>x</mi> </mrow> <mo>=</mo> <mfrac> <mrow> <mi title="natural log">ln</mi> <mo>&applyfunction;</mo> <mi>x</mi> </mrow> <mrow> <mi title="natural log">ln</mi> <mo>&applyfunction;</mo> <mi>a</mi> </mrow> </mfrac> </mrow> </math> rather than repeating the instructions, some css might be used to provide a visual cue. ...
...mi>a</mi> </msub> <mo>&applyfunction;</mo> <mi>x</mi> </mrow> <mo>=</mo> <mfrac> <mrow> <mi title="natural log">ln</mi> <mo>&applyfunction;</mo> <mi>x</mi> </mrow> <mrow> <mi title="natural log">ln</mi> <mo>&applyfunction;</mo> <mi>a</mi> </mrow> </mfrac> </mrow> </math> rather than repeating the instructions, some css might be used to provide a visual cue. ...
...><input value="type" size="4"/></mtext> </mtd> <mtd><mn>4</mn></mtd> </mtr> </mtable> <mo>]</mo> </mrow> </math> <math display="block"> <msqrt> <mpadded width="30px" height="15px" depth="15px" voffset="-15px"> <mtext> <svg width="30px" height="30px"> <defs> <radialgradient id="radgrad1" cx="50%" cy="50%" r="50%" fx="50%" fy="50%"> <stop offset="0%" style="stop-color:rgb(255,255,255); stop-opacity:1;"/> <stop offset="100%" style="stop-color:rgb(255,0,0); stop-opacity:.8;"/> </radialgradient> </defs> <g transform="translate(15,15)"> <g> <animatetransform attributename="transform" attributetype="xml" type="rotate" from="360" to="0" dur...
...And 3 more matches
nsIIOService
ed uri. aorigincharset the charset for the uri. may be null. abaseuri the base uri for the spec. may be null. if aspec is an absolute url, this parameter is ignored. aloadingnode the loadingdocument of the channel. this is the document/element that will get access to the result of this request. for example for an image load, it's the document in which the image will be loaded. and for a css stylesheet it's the document whose rendering will be affected by the stylesheet. if possible, pass in the element which is performing the load. but if the load is coming from a js api (such as xmlhttprequest) or if the load might be coalesced across multiple elements (such as for ) then pass in the document node instead. for loads that are not related to any document, such as loads coming from addons o...
...ill be used. atriggeringprincipal the triggeringprincipal of the load. the triggeringprincipal is the principal of the resource that caused this particular url to be loaded. most likely the triggeringprincipal and the loadingprincipal are identical, in which case the triggeringprincipal can be left out. in some cases the loadingprincipal and the triggeringprincipal are different however, e.g. a stylesheet may import a subresource. in that case the principal of the stylesheet which contains the import command is the triggeringprincipal, and the principal of the document whose rendering is affected is the loadingprincipal. asecurityflags the securityflags of the channel. any of the securityflags defined in nsiloadinfo. acontentpolicytype the contentpolicytype of the channel. any of the cont...
...emprincipal as the loadingprincipal. parameters auri an nsiuri from which to make a channel. aloadingnode the loadingdocument of the channel. the element or document where the result of this request will be used. this is the document/element that will get access to the result of this request. for example for an image load, it's the document in which the image will be loaded. and for a css stylesheet it's the document whose rendering will be affected by the stylesheet. if possible, pass in the element which is performing the load. but if the load is coming from a js api (such as xmlhttprequest) or if the load might be coalesced across multiple elements (such as for <img>) then pass in the document node instead. for loads that are not related to any document, such as loads coming from ...
...And 3 more matches
CSSRule - Web APIs
Web › API › CSSRule
the cssrule interface represents a single css rule. there are several types of rules, listed in the type constants section below. the cssrule interface specifies the properties common to all rules, while properties unique to specific rule types are specified in the more specialized interfaces for those rules' respective types. references to a cssrule may be obtained by looking at a cssstylesheet's cssrules list. properties common to all cssrule instances cssrule.csstext represents the textual representation of the rule, e.g. "h1,h2 { font-size: 16pt }" or "@import 'url'". to access or modify parts of the rule (e.g. the value of "font-size" in the example) use the properties on the specialized interface for the rule's type. cssrule.parentrule read only returns the containing rule, oth...
...all cssrule instances cssrule.csstext represents the textual representation of the rule, e.g. "h1,h2 { font-size: 16pt }" or "@import 'url'". to access or modify parts of the rule (e.g. the value of "font-size" in the example) use the properties on the specialized interface for the rule's type. cssrule.parentrule read only returns the containing rule, otherwise null. e.g. if this rule is a style rule inside an @media block, the parent rule would be that cssmediarule. cssrule.parentstylesheet read only returns the cssstylesheet object for the style sheet that contains this rule cssrule.type read only one of the type constants indicating the type of css rule. constants type constants the cssrule interface specifies integer constants that can be used in conjunction with a cssrule'...
... of css rule. constants type constants the cssrule interface specifies integer constants that can be used in conjunction with a cssrule's type property to discern the rule type (and therefore, which specialized interface it implements). the relationships between these constants and the interfaces are: type value rule-specific interface comments and examples cssrule.style_rule 1 cssstylerule the most common kind of rule: selector { prop1: val1; prop2: val2; } cssrule.import_rule 3 cssimportrule an @import rule. (until the documentation is completed, see the interface definition in the mozilla source code: nsidomcssimportrule.) cssrule.media_rule 4 cssmediarule cssrule.font_face_rule 5 cssfontfacerule...
...And 3 more matches
Pixel manipulation with canvas - Web APIs
ng the getimagedata() method to display the color under the mouse cursor. for this, we need the current position of the mouse with layerx and layery, then we look up the pixel data on that position in the pixel array that getimagedata() provides us. finally, we use the array data to set a background color and a text in the <div> to display the color. ...
...olor under the mouse cursor. for this, we need the current position of the mouse with layerx and layery, then we look up the pixel data on that position in the pixel array that getimagedata() provides us. finally, we use the array data to set a background color and a text in the <div> to display the color. ...
...iv> to display the color. ...
...And 3 more matches
Element.shadowRoot - Web APIs
(see element.attachshadow() for further details). examples the following snippets are taken from our life-cycle-callbacks example (see it live also), which creates an element that displays a square of a size and color specified in the element's attributes. ...
...e element's attributes. inside the <custom-square> element's class definition we include some life cycle callbacks that make a call to an external function, updatestyle(), which actually applies the size and color to the element. you'll see that we are passing it this (the custom element itself) as a parameter. ...
...n external function, updatestyle(), which actually applies the size and color to the element. you'll see that we are passing it this (the custom element itself) as a parameter. connectedcallback() { console.log('custom square element added to page.'); updatestyle(this); } attributechangedcallback(name, oldvalue, newvalue) { console.log('custom square element attributes changed.'); updatestyle(this); } in the updatestyle() function itself, we get a reference to the shadow dom using element.shadowroot. ...
...And 3 more matches
Element: underflow event - Web APIs
nly works for elements for which overflow is not set to visible. the counterpart overflow event is fired when overflow occurs. ...
...t handler property unknown examples <div id="wrapper"> <div id="child"></div> </div> <br/> <label><input type="checkbox" id="toggle" checked/> overflow</label> <style> #wrapper { width: 20px; height: 20px; background: #000; padding: 5px; overflow: hidden; } #child { width: 40px; height: 40px; border: 2px solid grey; background: #ccc; } </style> <script> var wrapper = document.getelementbyid("wrapper"), child = document.getelementbyid("child"), toggle = document.getelementbyid("toggle"); wrapper.addeventlistener("overflow", function( event ) { console.log( event ); }, false); wrapper.addeventlistener("underflow", function( event ) { console.log( event ); }, false); toggle.addeventlistener("change"...
... ...
...And 3 more matches
GlobalEventHandlers.ondragend - Web APIs
x var dragendhandler = targetelement.ondragend; return value dragendhandler the dragend event handler for element targetelement. example this example shows two ways to use the ondragend attribute handler to set an element's dragend event handler. ...
...ws two ways to use the ondragend attribute handler to set an element's dragend event handler. ...
...nt attribute</title> <meta content="width=device-width"> <style> div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function dragstart_handler(ev) { console.log("dragstart"); // change the source element's background color to signify drag has started ev.currenttarget.style.border = "dashed"; ev.datatransfer.setdata("text", ev.target.id); } function dragover_handler(ev) { console.log("dragover"); // change the target element's border to signify a drag over event // has occurred ev.currenttarget.style.background = "lightblue"; ev.preventdefault(); } function drop_handler(ev) { console.log("drop"); ev.preventdefault(); var data = ev.datatransfer.getdata("te...
...And 3 more matches
GlobalEventHandlers.ondragenter - Web APIs
agenterhandler = targetelement.ondragenter; return value dragenterhandler the dragenter event handler for element targetelement. example this example demonstrates using the ondragenter attribute handler to set an element's dragenter event handler. ...
...nstrates using the ondragenter attribute handler to set an element's dragenter event handler. ...
...nt attribute</title> <meta content="width=device-width"> <style> div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function dragstart_handler(ev) { console.log("dragstart"); // change the source element's background color to signify drag has started ev.currenttarget.style.border = "dashed"; ev.datatransfer.setdata("text", ev.target.id); } function dragover_handler(ev) { console.log("dragover"); // change the target element's border to signify a drag over event // has occurred ev.currenttarget.style.background = "lightblue"; ev.preventdefault(); } function drop_handler(ev) { console.log("drop"); ev.preventdefault(); var data = ev.datatransfer.getdata("te...
...And 3 more matches
GlobalEventHandlers.ondragexit - Web APIs
var dragexithandler = targetelement.ondragexit; return value dragexithandler the dragexit event handler for element targetelement. example this example demonstrates using the ondragexit attribute handler to set an element's dragexit event handler. ...
...monstrates using the ondragexit attribute handler to set an element's dragexit event handler. ...
...nt attribute</title> <meta content="width=device-width"> <style> div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function dragstart_handler(ev) { console.log("dragstart"); // change the source element's background color to signify drag has started ev.currenttarget.style.border = "dashed"; ev.datatransfer.setdata("text", ev.target.id); } function dragover_handler(ev) { console.log("dragover"); // change the target element's border to signify a drag over event // has occurred ev.currenttarget.style.background = "lightblue"; ev.preventdefault(); } function drop_handler(ev) { console.log("drop"); ev.preventdefault(); var data = ev.datatransfer.getdata("te...
...And 3 more matches
GlobalEventHandlers.ondragleave - Web APIs
agleavehandler = targetelement.ondragleave; return value dragleavehandler the dragleave event handler for element targetelement. example this example demonstrates using the ondragleave attribute handler to set an element's dragleave event handler. ...
...nstrates using the ondragleave attribute handler to set an element's dragleave event handler. ...
...global event attribute</title> <meta content="width=device-width"> <style> div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function dragstart_handler(ev) { console.log("dragstart"); // change the source element's border to signify drag has started ev.currenttarget.style.border = "dashed"; ev.datatransfer.setdata("text", ev.target.id); } function dragover_handler(ev) { console.log("dragover"); // change the target element's background color to signify a drag over event // has occurred ev.currenttarget.style.background = "lightblue"; ev.preventdefault(); } function drop_handler(ev) { console.log("drop"); ev.preventdefault(); var data = ev.datatransfer.g...
...And 3 more matches
HTMLElement - Web APIs
the htmlelement interface represents any html element. some elements directly implement this interface, while others implement it via an interface that inherits it. ...
... the htmlelement interface represents any html element. some elements directly implement this interface, while others implement it via an interface that inherits it. ...
... htmlelement.accesskey is a domstring representing the access key assigned to the element. htmlelement.accesskeylabel read only returns a domstring containing the element's assigned access key. htmlelement.contenteditable is a domstring, where a value of true means the element is editable and a value of false means it isn'...
...And 3 more matches
HTMLLinkElement - Web APIs
the htmllinkelement interface represents reference information for external resources and the relationship of those resources to a document and vice-versa (corresponds to <link> element; not to be confused with <a>, which is represented by htmlanchorelement). this object inherits all of the properties and methods of the htmlelement interface. ...
... those resources to a document and vice-versa (corresponds to <link> element; not to be confused with <a>, which is represented by htmlanchorelement). this object inherits all of the properties and methods of the htmlelement interface. ...
...th="150" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="416" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmllinkelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement, and linkstyle. htmllinkelement.as is a domstring representing the type of content being loaded by the html link. htmllinkelement.crossorigin is a domstring that corresponds to the cors setting for this link element. see cors settings attributes for details. htmllinkelement.disabled is a boolean which represents whether the link is disabled; currently only used with style sheet links. htmllinkeleme...
...And 3 more matches
Multi-touch interaction - Web APIs
f this application is available on github. the source code is available on github; pull requests and bug reports are welcome. example this example demonstrates using pointer events' various event types (pointerdown, pointermove, pointerup pointercancel, etc.) for different multi-touch interactions. define touch targets the application uses <div> to define three different touch target areas. <style> div { margin: 0em; padding: 2em; } #target1 { background: white; border: 1px solid black; } #target2 { background: white; border: 1px solid black; } #target3 { background: white; border: 1px solid black; } </style> global state to support multi-touch interaction, preserving a pointer's event state during various event phases is required. this ap...
...nt. function pointermove_handler(ev) { // note: if the user makes more than one "simultaneous" touch, most browsers // fire at least one pointermove event and some will fire several pointermoves. // // this function sets the target element's border to "dashed" to visually // indicate the target received a move event. if (logevents) log("pointermove", ev); update_background(ev); ev.target.style.border = "dashed"; } pointer up the pointerup event is fired when a pointer is raised from the contact surface. when this occurs, the event is removed from the associated event cache. in this application, this handler is also used for pointercancel, pointerleave and pointerout events. function pointerup_handler(ev) { if (logevents) log(ev.type, ev); // remove this touch point from the ca...
...ace. when this occurs, the event is removed from the associated event cache. in this application, this handler is also used for pointercancel, pointerleave and pointerout events. ...
...And 3 more matches
Storage - Web APIs
Web › API › Storage
ey's value if it already exists. storage.removeitem() when passed a key name, will remove that key from the storage. storage.clear() when invoked, will empty all keys out of the storage. examples here we access a storage object by calling localstorage. we first test whether the local storage contains data items using !localstorage.getitem('bgcolor'). ...
... key from the storage. storage.clear() when invoked, will empty all keys out of the storage. examples here we access a storage object by calling localstorage. we first test whether the local storage contains data items using !localstorage.getitem('bgcolor'). if it does, we run a function called setstyles() that grabs the data items using storage.getitem() and uses those values to update page styles. ...
...bject by calling localstorage. we first test whether the local storage contains data items using !localstorage.getitem('bgcolor'). if it does, we run a function called setstyles() that grabs the data items using storage.getitem() and uses those values to update page styles. if it doesn't, we run another function, populatestorage(), which uses storage.setitem() to set the item values, then runs setstyles(). ...
...And 3 more matches
Multi-touch interaction - Web APIs
nd pull requests and bug reports are welcome. example this example demonstrates using the touchstart, touchmove, touchcancel, and touchend) touch events for the following gestures: single touch, two (simultaneous) touches, more than two simultaneous touches, 1-finger swipe, and 2-finger move/pinch/swipe. define touch targets the application uses <div> elements to represent four touch areas. ...
... // log events flag var logevents = false; // touch point cache var tpcache = new array(); register event handlers event handlers are registered for all four touch event types. ...
...it also calls preventdefault() to keep the browser from applying further event handling (for example, mouse event emulation). function start_handler(ev) { // if the user makes simultaneous touches, t...
...And 3 more matches
Creating a cross-browser video player - Developer guides
this article describes a simple html5 video player that uses the media and fullscreen apis and works across most major desktop and mobile browsers. as well as working fullscreen, the player features custom controls rather than just using the browser defaults. the player controls themselves won't be styled beyond the basics required to get them working; full styling of the player will be taken care of in a future article. working example our example video player displays a clip from an open source movie called tears of steel, and includes typical video controls. note: you can see the example running live, or check out the source code on github. html markup to start off with, let's take a look at the html that makes up the player. the video first of all the <video> element is...
...so in html, which will be used to control the video. the control set most browser's default video controls have the following functionality: play/pause mute volume control progress bar skip ahead go fullscreen the custom control set will also support this functionality, with the addition of a stop button. once again the html is quite straightforward, using an unordered list with list-style-type:none set to enclose the controls, each of which is a list item with float:left. for the progress bar, the progress element is taken advantage of, with a fallback provided for browsers that don't support it (e.g. ie8 and ie9). this list is inserted after the <video> element, but inside the <figure> element (this is important for the fullscreen functionality, which is explained later on). <ul...
...ntainer = document.getelementbyid('videocontainer'); var video = document.getelementbyid('video'); var videocontrols = document.getelementbyid('video-controls'); as mentioned earlier, the browser's default controls now need to be disabled, and the custom controls need to be displayed: // hide the default controls video.controls = false; // display the user defined video controls videocontrols.style.display = 'block'; with that done, a variable pointing to each of the buttons is now required: var playpause = document.getelementbyid('playpause'); var stop = document.getelementbyid('stop'); var mute = document.getelementbyid('mute'); var volinc = document.getelementbyid('volinc'); var voldec = document.getelementbyid('voldec'); var progress = document.getelementbyid('progress'); var progres...
...And 3 more matches
Rich-Text Editing in Mozilla - Developer guides
t an entire line (indenting). when using contenteditable, calling execcommand will affect the currently active editable element. ...
...(indenting). when using contenteditable, calling execcommand will affect the currently active editable element. internet explorer differences one major difference between mozilla and internet explorer that affects designmode is the generated code in the editable document: while internet explorer uses html tags (em, i, etc), mozilla 1.3 will generate by default spans with inline style rules. ...
...ences one major difference between mozilla and internet explorer that affects designmode is the generated code in the editable document: while internet explorer uses html tags (em, i, etc), mozilla 1.3 will generate by default spans with inline style rules. the stylewithcss command can be used to toggle between css and html markup creation. ...
...And 3 more matches
HTML attribute reference - HTML: Hypertext Markup Language
with the public key. charset <meta>, <script> declares the character encoding of the page or script. checked <command>, <input> indicates whether the element should be checked on page load. cite <blockquote>, <del>, <ins>, <q> contains a uri which points to the source of the quote or change. class global attribute often used with css to style elements with common properties. code <applet> specifies the url of the applet's class file to be loaded and executed. codebase <applet> this attribute gives the absolute or relative url of the directory where applets' .class files referenced by the code attribute are stored. color <basefont>, <font>, <hr> this attribute sets the text color using ...
...lower bound of the upper range. href <a>, <area>, <base>, <link> the url of a linked resource. hreflang <a>, <area>, <link> specifies the language of the linked resource. http-equiv <meta> defines a pragma directive. icon <command> specifies a picture which represents the command. id global attribute often used with css to style a specific element. the value of this attribute must be unique. importance <iframe>, <img>, <link>, <script> indicates the relative fetch priority for the resource. integrity <link>, <script> specifies a subresource integrity value that allows browsers to verify what they fetch. intrinsicsize <img> this attribute tells the browser to ignor...
...lete, use <link rel="manifest"> instead. max <input>, <meter>, <progress> indicates the maximum value allowed. maxlength <input>, <textarea> defines the maximum number of characters allowed in the element. minlength <input>, <textarea> defines the minimum number of characters allowed in the element. media <a>, <area>, <link>, <source>, <style> specifies a hint of the media for which the linked resource was designed. method <form> defines which http method to use when submitting the form. can be get (default) or post. min <input>, <meter> indicates the minimum value allowed. multiple <input>, <select> indicates whether multiple values can be entered in an input of the type email or file. ...
...And 3 more matches
<kbd>: The Keyboard Input element - HTML: Hypertext Markup Language
Web › HTML › Element › kbd
n echoed back to the user by the system. see echoed input, below, for an example. nesting a <samp> element inside a <kbd> element, on the other hand, represents input which is based on text presented by the system, such as the names of menus and menu items, or the names of buttons displayed on the screen. see the example under representing onscreen input options below. you can define a custom style to override the browser's default font selection for the <kbd> element, although the user's preferences may potentially override your css. examples basic example <p>use the command <kbd>help mycommand</kbd> to view documentation for the command "mycommand".</p> representing keystrokes within an input to describe an input comprised of multiple keystrokes, you can nest multiple <kbd> eleme...
...sic example <p>use the command <kbd>help mycommand</kbd> to view documentation for the command "mycommand".</p> representing keystrokes within an input to describe an input comprised of multiple keystrokes, you can nest multiple <kbd> elements, with an outer <kbd> element representing the overall input and each individual keystroke or component of the input enclosed within its own <kbd>. unstyled first, let's look at what this looks like as just plain html. html <p>you can also create a new document using the keyboard shortcut <kbd><kbd>ctrl</kbd>+<kbd>n</kbd></kbd>.</p> this wraps the entire key sequence in an outer <kbd> element, then each individual key within its own, in order to denote the components of the sequence. note: you don't need to do all this wrapping; you can choose...
...bd>.</p> this wraps the entire key sequence in an outer <kbd> element, then each individual key within its own, in order to denote the components of the sequence. note: you don't need to do all this wrapping; you can choose to simplify it by leaving out the external <kbd> element. in other words, simplifying this to just <kbd>ctrl</kbd>+<kbd>n</kbd> would be perfectly valid. ...
...And 3 more matches
CSP: default-src - HTTP
ttp content-security-policy (csp) default-src directive serves as a fallback for the other csp fetch directives. ...
...-security-policy (csp) default-src directive serves as a fallback for the other csp fetch directives. ...
... (csp) default-src directive serves as a fallback for the other csp fetch directives. ...
...And 3 more matches
Intl.DateTimeFormat() constructor - JavaScript
ng", "mymr", "orya", "tamldec", "telu", "thai", "tibt". ca calendar. possible values include: "buddhist", "chinese", "coptic", "ethiopia", "ethiopic", "gregory", "hebrew", "indian", "islamic", "iso8601", "japanese", "persian", "roc". hc hour cycle. possible values include: "h11", "h12", "h23", "h24". options optional an object with some or all of the following properties: datestyle the date formatting style to use when calling format(). possible values include: "full" "long" "medium" "short" timestyle the time formatting style to use when calling format(). possible values include: "full" "long" "medium" "short" fractionalseconddigits the number of fractional seconds to apply when calling format(). valid values are 0-3. c...
...ations to find the best match. two algorithms are available for this negotiation and selected by the formatmatcher property: a fully specified "basic" algorithm and an implementation-dependent "best fit" algorithm. weekday the representation of the weekday. possible values are: "long" (e.g., thursday) "short" (e.g., thu) "narrow" (e.g., t). two weekdays may have the same narrow style for some locales (e.g. tuesday's narrow style is also t). era the representation of the era. possible values are: "long" (e.g., anno domini) "short" (e.g., ad) "narrow" (e.g., a) year the representation of the year. possible values are: "numeric" (e.g., 2012) "2-digit" (e.g., 12) month the representation of the month. possible values are: "...
... domini) "short" (e.g., ad) "narrow" (e.g., a) year the representation of the year. possible values are: "numeric" (e.g., 2012) "2-digit" (e.g., 12) month the representation of the month. possible values are: "numeric" (e.g., 2) "2-digit" (e.g., 02) "long" (e.g., march) "short" (e.g., mar) "narrow" (e.g., m). two months may have the same narrow style for some locales (e.g. may's narrow style is also m). day the representation of the day. possible values are: "numeric" (e.g., 1) "2-digit" (e.g., 01) hour the representation of the hour. possible values are "numeric", "2-digit". minute the representation of the minute. possible values are "numeric", "2-digit". second the representation of the second. possible...
...And 3 more matches
Authoring MathML - MathML
<head> <title>mathml in html5</title> </head> <body> <h1>mathml in html5</h1> <p> square root of two: <math> <msqrt> <mn>2</mn> </msqrt> </math> </p> </body> </html> content mathml is not supported by browsers. it's recommended to convert your content mathml markup into presentation mathml before publishing it, for example with the help of the ctop.xsl stylesheet. tools mentioned on this page generates presentation mathml. fallback for browsers without mathml support unfortunately, some browsers are not able to render mathml equations or only have a limited support. hence you will need to use a mathml polyfill to provide some fallback rendering. if you need only basic mathematical constructions such as those used on this mdn wiki then a small mathm...
... tools mentioned on this page generates presentation mathml. fallback for browsers without mathml support unfortunately, some browsers are not able to render mathml equations or only have a limited support. hence you will need to use a mathml polyfill to provide some fallback rendering. if you need only basic mathematical constructions such as those used on this mdn wiki then a small mathml.css stylesheet might be enough. to use it, just insert one line in your document header: <script src="https://fred-wang.github.io/mathml.css/mspace.js"></script> if you need more complex constructions, you might instead consider using the heavier mathjax library as a mathml polyfill: <script src="https://fred-wang.github.io/mathjax.js/mpadded-min.js"></script> note that these two scripts perform featur...
...and webkit). note that ua string sniffing is not the most reliable method and might break from version to version: var ua = navigator.useragent; var isgecko = ua.indexof("gecko") > -1 && ua.indexof("khtml") === -1 && ua.indexof('trident') === -1; var iswebkit = ua.indexof('applewebkit') > -1 && ua.indexof('chrome') === -1; mathematical fonts in order to get a good layout or to allow different style, it's important to have mathematical fonts available. it's always good to provide a link to mdn's font instructions, so that your visitors can verify whether they have appropriate fonts installed on their system. it's also good to provide a fallback with web fonts. prior to gecko 31.0 (firefox 31.0 / thunderbird 31.0 / seamonkey 2.28), it was a bit tedious to setup math fonts, see the font instr...
...And 3 more matches
Animation performance and frame rate - Web Performance
as they give the browser more control over when to render frames, and to drop frames if necessary. however, the performance cost of modifying a css property can vary from one property to another. it's commonly accepted that 60 frames per second is the rate at which animations will appear smooth. ...
...this operation is labeled "layout" but is also sometimes called "reflow". paint: finally, the browser needs to repaint the elements to the screen. ...
...animating expensive css properties can result in jank as the browser struggles to hit a smooth frame rate. the rendering waterfall the process a browser uses to paint changes to a page when an element is animating css properties can be described as a waterfall consisting of the following steps: recalculate style: when a property for an element changes, the browser must recalculate computed styles. layout: next, the browser uses the computed styles to figure out the position and geometry for the elements. this operation is labeled "layout" but is also sometimes called "reflow". paint: finally, the browser needs to repaint the elements to the screen. one last step is not shown in this sequence: the page may be split into layers, which are painted independently and then combined in a proc...
...And 3 more matches
Progressive loading - Progressive web apps (PWAs)
is all about deferring loading of as many resources as possible (html, css, javascript), and only loading those immediately that are really needed for the very first experience. bundling versus splitting many visitors won't go through every single page of a website, yet the usual approach is to bundle every feature we have into one big file. a bundle.js file can be many megabytes, and a single style.css bundle can contain everything from basic css structure definitions to all the possible styles of every version of the site: mobile, tablet, desktop, print only, etc. it is faster to load all that information as one file rather than many small ones, but if the user doesn't need everything at the very beginning, we could load only what's crucial and then manage other resources when needed. re...
... website access and completion of loading, the user sees a blank page, which is a bad experience. to fix that we can, for example, add defer to javascript files: <script src="app.js" defer></script> they will be downloaded and executed after the document itself has been parsed, so it won't block rendering the html structure. ...
...d completion of loading, the user sees a blank page, which is a bad experience. to fix that we can, for example, add defer to javascript files: <script src="app.js" defer></script> they will be downloaded and executed after the document itself has been parsed, so it won't block rendering the html structure. ...
...And 3 more matches
Applying SVG effects to HTML content - SVG: Scalable Vector Graphics
modern browsers support using svg within css styles to apply graphical effects to html content. you may specify svg in styles either within the same document or an external style sheet. there are 3 properties you can use: mask, clip-path, and filter. note: references to svg in external files must be to the same origin as the referencing document. using embedded svg to apply an svg effect using css styles, you first need to create the css style that references the svg to apply. <style>p { mask: url(#my-mask); }</style> in the above example, all paragraphs are masked by an svg <mask> with the id my-mask. example: masking for example, you can make a gradient mask for html content using svg and css code similar to the following, inside your html document: <svg height="0"> <mask ...
...dth: 300px; border: 1px solid #000; display: inline-block; } note that in the css, the mask is specified using a url to the id #mask-1, which is the id of the svg mask specified below it. everything else specifies details about the gradient mask itself. applying the svg effect to (x)html is accomplished by assigning the target class defined above to an element, like this: <p class="target" style="background:lime;"> lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam. </p> <p> lorem ipsum dolor sit amet, consectetur adipisicing <b class="target">elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</b> ut enim ad minim veniam. </p> the above example...
...or sit amet, consectetur adipisicing <b class="target">elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</b> ut enim ad minim veniam. </p> the above example would be rendered with the mask applied to it. example: clipping this example demonstrates using svg to clip html content. notice that even the clickable areas for links are clipped. <p class="target" style="background:lime;"> lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam. </p> <p> lorem ipsum dolor sit amet, consectetur adipisicing <b class="target">elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</b> ut enim ad minim veniam. </p> <button onclick="t...
...And 3 more matches
<symbol> - SVG: Scalable Vector Graphics
Web › SVG › Element › symbol
value type: <length>|<percentage> ; default ...
... value type: <length>|<percentage> ; default value: auto; animatable: yes preserveaspectratio this attribu...
... value type: <length>|<percentage> ; default value: auto; animatable: yes preserveaspectratio this attribute defines how the svg fragment must be deformed if it is embed...
...And 3 more matches
xml:base - XML: Extensible Markup Language
Web › XML › xml:base
he element. support was removed from blink (chrome and opera) in 2015: chromium bug 341854 blink-dev mailing list post and from firefox 66 in bug 903372. use cases if you have an inline svg you use as icons that needs to work in a document with a html baseelement , you can reset the uri on your icon sprite by setting the xml:base. ...
...341854 blink-dev mailing list post and from firefox 66 in bug 903372. use cases if you have an inline svg you use as icons that needs to work in a document with a html baseelement , you can reset the uri on your icon sprite by setting the xml:base. ...
...marker> </defs> <line x1="100" y1="100" x2="333" y2="333" marker-start="url(#arrow)" class="link"></line> </svg> </body> </html> imagine a svg with font references. e.g. ...
...And 3 more matches
Canvas code snippets - Archive of obsolete content
he pixel at position x and y of the canvas. this can be used to determine if the mouse cursor is inside a certain shape or not. function getpixelcolour(canvas, x, y) { var cx = canvas.getcontext('2d'); var pixel = cx.getimagedata(x, y, 1, 1); return { r: pixel.data[0], g: pixel.data[1], b: pixel.data[2], a: pixel.data[3] }; } chaining methods this class provides jquery-style chained access to 2d context methods and properties. function canvas2dcontext(canvas) { if (typeof canvas === 'string') { canvas = document.getelementbyid(canvas); } if (!(this instanceof canvas2dcontext)) { return new canvas2dcontext(canvas); } this.context = this.ctx = canvas.getcontext('2d'); if (!canvas2dcontext.prototype.arc) { canvas2dcontext.setup.call(this, this.c...
...'stroketext', 'transform', 'translate']; var gettermethods = ['createpattern', 'drawfocusring', 'ispointinpath', 'measuretext', // drawfocusring not currently supported // the following might instead be wrapped to be able to chain their child objects 'createimagedata', 'createlineargradient', 'createradialgradient', 'getimagedata', 'putimagedata' ]; var props = ['canvas', 'fillstyle', 'font', 'globalalpha', 'globalcompositeoperation', 'linecap', 'linejoin', 'linewidth', 'miterlimit', 'shadowoffsetx', 'shadowoffsety', 'shadowblur', 'shadowcolor', 'strokestyle', 'textalign', 'textbaseline']; for (let m of methods) { let method = m; canvas2dcontext.prototype[method] = function() { this.ctx[method].apply(this.ctx, arguments); return this; }; ...
...is.ctx, arguments); }; } for (let p of props) { let prop = p; canvas2dcontext.prototype[prop] = function(value) { if (value === undefined) return this.ctx[prop]; this.ctx[prop] = value; return this; }; } }; var canvas = document.getelementbyid('canvas'); // use context to get access to underlying context var ctx = canvas2dcontext(canvas) .strokestyle('rgb(30, 110, 210)') .transform(10, 3, 4, 5, 1, 0) .strokerect(2, 10, 15, 20) .context; // use property name as a function (but without arguments) to get the value var strokestyle = canvas2dcontext(canvas) .strokestyle('rgb(50, 110, 210)') .strokestyle(); code usable only from privileged code these snippets are only useful from privileged code, such as extensions or privileged apps.
...And 2 more matches
Forms related code snippets - Archive of obsolete content
t.appendchild(odecrmonth); ocapt.appendchild(oincryear); ocapt.appendchild(oincrmonth); ocapt.appendchild(this.display); this.container.appendchild(ocapt); this.container.appendchild(othead); this.current.setdate(1); this.writedays(); otarget.onclick = function () { if (otable.parentnode) { otable.parentnode.removechild(otable); return; } otable.style.zindex = nzindex++; otable.style.position = "absolute"; otable.style.left = otarget.offsetleft + "px"; otable.style.top = (otarget.offsettop + otarget.offsetheight) + "px"; otarget.parentnode.insertbefore(otable, otarget); }; ainstances.push(this); } datepicker.prototype.writedays = function () { const nendblanks = (this.current.getday() + bzeroi...
...-1 : 1, othiscal = ainstances[this.id.replace(rbgnnan, "")]; othiscal.current[bismonth ? "setmonth" : "setyear"](othiscal.current[bismonth ? "getmonth" : "getfullyear"]() + ndelta); othiscal.writedays(); return false; } function ondayclick () { co...
...ndex = 1000; window.addeventlistener ? addeventlistener("load", buildcalendars, false) : window.attachevent ? attachevent("onload", buildcalendars) : (onload = buildcalendars); document.addeventlistener ? document.addeventlistener("mousedown", ondocclick, false) : document.attachevent ? ...
...And 2 more matches
The Box Model - Archive of obsolete content
erride its dimensions using css. this is similarly the case for xul, except there are two flexibility directions to consider. an hbox is as big as its contents horizontally, but it will occupy all the available space vertically. you can make an hbox flexible horizontally with the css property -moz-box-flex or the flex attribute. the same applies to a vbox, but in the other direction. unlike most style attributes, the flex attribute is considered acceptable to use in xul code. this is because this attribute is used much too often, and it would require a great deal of css code to avoid using it. at any rate, it can always be overriden using css, so your extension won't lose skinability because of it. flexibility is defined as a numeric value. the default value for most elements is 0, which mean...
...nts, in this case, the labels and paddings in the buttons. if the label of the "parrot" button was something much longer, the size ratio would not be kept. you can have even more control over the size of flexible elements using the minwidth, maxwidth, minheight and maxheight attributes, or their css counterparts: min-width, max-width, min-height and max-height. the latter are recommended to keep style code in the skin section of the chrome. as their names should make clear, you can control the flexibility boundaries of elements, thus preventing them from growing or shrinking too much. all css properties involving lengths should be handled with caution. we recommended that you use proportional units (em, %) instead of absolute units (px) whenever possible. using the former allows the ui to s...
... practice. similarly as with wrapping, cropping will only occur is there is no room for the text to grow, so you'll need to restrict the width using css. text links xul makes it very easy for you to create a label that is also a link. all you need is to set the text-link class to the label, and add an onclick handler (oncommand won't work for this). the label is displayed with the expected link style so that users can easily recognize it as a link. a trickier case is when you need only part of a label to be clickable, just like in html. since labels can't handle rich text, workarounds have to implemented using javascript. one possibility is to use special markup in a locale property so that the link can be easily recognized: xulschoolhello.linkedtext.label = go to <a>our site</a> for more...
...And 2 more matches
Inner-browsing extending the browser navigation paradigm - Archive of obsolete content
o the existing dhtml ticker application is able to handle it. special markup to support the model it's important to add special markup that fulfills the requirements of the application. this example uses an iframe element as the mechanism to establish the communication with the server side application. so the following piece of html defines an iframe element which is not visible to the user: <div style="visibility:hidden; position:absolute; top:-1000px; left:-1000px"> <iframe id="bridgeframe" src=""></iframe> </div> the javascript code located in the data loader component will be interacting with this iframe element, requesting data from the server. note that when the data is available (a web page is loaded into the iframe) this will not affect the web page context because the iframe is not vis...
...// ie fix if(document.all) tagname="nde:"+tagname; paraa=article.getelementsbytagname(tagname).item(0).firstchild.nodevalue; linkk=article.getattribute("url"); strvalue="<div class='nde-blurb'><h3><a href='"+linkk+"'>"+valuee+"</a></h3><p>"+paraa+"</p></div>"; document.getelementbyid("container").innerhtml+=strvalue; } } if(previousele) { previousele.style.backgroundcolor="white"; } ele.style.backgroundcolor="#ddeeff"; previousele=ele; } var previousele=null; </script> <style> .tab { position:relative;top:1px; border: 1px solid #dddddd; color:white; background-color:white; padding-left: 5px; border-bottom:white;padding-right: 5px; padding-top:3px; text-decoration:none;} .tab:hover { background-color:#ddeeff; } </style> </head> <body ...
...ascript"> //// /// object detection // var xcomp=null; var testxmlhttprequest=false; try { xcomp = new xmlhttprequest(); if(xcomp) testxmlhttprequest=true; } catch (e) { try { xcomp = new activexobject("microsoft.xmlhttp"); if(xcomp) testxmlhttprequest=true; } catch (e) { } } if(testxmlhttprequest&&document.getelementsbytagname) { document.write("<span style=\"margin-left:1em;\"> <a href=\"javascript:\" class=\"tab \" onclick=\"calldevedge('/viewsource/catalog-new_en.xml',this);return false;\">devedge news</a> <a href=\"javascript:\" class=\"tab\" onclick=\"calldevedge('/central/css/catalog-new_en.xml',this);return false;\" title=\"css articles\">css</a> <a href=\"javascript:\" class=\"tab\" onclick=\"calldevedge('/central/xml/catalog-new_en.xml',thi...
...And 2 more matches
Images, Tables, and Mysterious Gaps - Archive of obsolete content
call on these "fixes." setting images to be blocks the first choice, and one that will work for most graphically-intense designs, is to convert the image from being an inline element to a block-level element. do that, and it no longer generates a line box, and so the problem goes away-- assuming that the image is the only thing that occupies that table cell. ...
... within the textthere is an icon <img src="icon2.gif"> that indicates a link to another site. it's very worldly. ...
... within the textthere is an icon <img src="icon2.gif"> that indicates a link to another site. it's very worldly. lorem ipsum, dolor sit amet...</p></td></tr></table> as we see in figure 8, that works well in some cases but not so well in others. ...
...And 2 more matches
Making it into a static overlay - Archive of obsolete content
distribution, before we package it up we need to separate the modifications into a different file and add them back in at run time via a dynamic xul overlay. a xul overlay is a xul file containing elements to be inserted into another xul file when the other xul file is rendered into an application interface. static overlays are added to a xul file via a reference at the top of the file (much like stylesheets and javascript scripts). dynamic overlays are added to a xul file via a reference in the chrome registry. overlays provide a way to break up a large xul file into several different files (one that describes the overall structure of an application window and the others to implement specific portions of the window) to improve code readability, maintainability, and extensability. dynamic overl...
...l file without actually changing the code of the file itself, which is necessary when installing an extension like ours. we'll first make the file into a static overlay, then we'll make it into a dynamic overlay. ...
...e://navigator/content/tinderstatus.js" /> <statusbar id="status-bar"> <statusbarpanel class="statusbarpanel-iconic" id="tinderbox-status" insertbefore="offline-status" status="none"/> </statusbar> </overlay> tinderstatusoverlay.xul starts with an xml processing instruction that identifies the file as xml (all xul files need to include this). its next line is the stylesheet reference we previously added to navigator.xul. after that is a xul overlay element. this element is the top-level element in a xul overlay file and serves to identify the file as an overlay. within that element is the script reference we previously added to navigator.xul. then there is a statusbar element containing a statusbarpanel element. the value of the id attribute of the statusbar el...
...And 2 more matches
Specifying the appearance - Archive of obsolete content
now that we have defined a panel in which to display an icon, we use css to specify which icon to display. ...
...icon to display. ...
...ed), then create a set of css rules that displays the icon corresponding to the current tinderbox state: statusbarpanel#tinderbox-status { list-style-image: url("chrome://navigator/content/tb-nostatus.png"); } statusbarpanel#tinderbox-status[status="success"] { list-style-image: url("chrome://navigator/content/tb-success.png"); } statusbarpanel#tinderbox-status[status="testfailed"] { list-style-image: url("chrome://navigator/content/tb-testfailed.png"); } statusbarpanel#tinderbox-status[status="busted"] { list-style-image: url("chrome://navigator/content/tb-busted.png"); } mozilla can have multiple sets of stylesheets that govern its appearance, and we don't want to have to add these rules to each set (and have our extension break when a new set gets installed), so we'll put this st...
...And 2 more matches
In-Depth - Archive of obsolete content
y have to run the installer again. load mozilla and one browser window. then open the dom inspector (tools->web development->dom inspector). click file->inspect and select the browser window. what appears in a tree view below is the actual code for the interface. using this, we can figure out what objects are where, what classes/id's they have applied to them, and most importantly, which file the style is located in. click on the inspect icon and then click on the back button in the browser window. what this will do is find the code for the back button and display it in the dom inspector. selected in the tree view will be xul:toolbarbutton. this is the portion of the icon with only the image. but the back button is made up of two parts (the back portion and the history portion), so if we move ...
... tree view will be xul:toolbarbutton. this is the portion of the icon with only the image. but the back button is made up of two parts (the back portion and the history portion), so if we move one level up in the tree we'll see toolbarbutton. this is what we want. on the right hand side of the dom inspector, what will be listed is the dom node information. but what we're interested in is the css style rules. click the icon located above the dom information and choose css style rules. the side bar will now be split into two parts. at the top, there is a list of all the groups of styles that are applied to this object. when you select an item in the list the bottom portion will display the actual styles that are applied. go through this list one item at a time and find the one which applies the ...
... there by default (chrome://navigator/skin/icons/btn1.gif) is actually a bunch of images grouped together in one file, so somewhere one of the css attributes is telling it what portion of the larger image to cut out and display. if you go back into the dom inspector and look at the rule column again, you'll see the #back-button id. select that one and it lists a bunch of -x-image-region-left type styles in chrome://navigator/skin/. open up navigator.css, again (if you closed it), and look for the #back-button section. it has a -moz-image-region style in there which you can change. if you look through the rest of this file, you'll also notice that there are regions for the different states of #back-button. change those to match your new image as well. just continue this process for everything th...
...And 2 more matches
Monitoring downloads - Archive of obsolete content
atement.getstring(0); row.setattribute("tooltiptext", sourcestr); sourcestr = sourcestr.slice(sourcestr.lastindexof("/")+1); cell.setattribute("label", sourcestr); // source row.appendchild(cell); cell = document.createelement('listcell'); cell.setattribute("label", (statement.getint64(1) / 1024).tofixed(1) + "kb"); // size cell.setattribute("style", "text-align:right"); row.appendchild(cell); var thedate = new date(statement.getint64(2) / 1000); // start time cell = document.createelement('listcell'); var datestr = thedate.tolocalestring(); cell.setattribute("label", datestr); row.appendchild(cell); thedate = new date(statement.getint64(3)); // end time cell = docu...
...nt.getint64(3)); // end time cell = document.createelement('listcell'); datestr = thedate.tolocalestring(); cell.setattribute("label", datestr); row.appendchild(cell); var speed = statement.getdouble(4) / 1024.0; cell = document.createelement('listcell'); cell.setattribute("label", speed.tofixed(1) + "kb/sec"); cell.setattribute("style", "text-align:right"); row.appendchild(cell); var status = statement.getint32(5); var style = "color:black"; cell = document.createelement('listcell'); var statusstr; switch(status) { case 0: statusstr = "downloading"; break; case 1: statusstr = "complete"; style = "color:green"; ...
...atus = statement.getint32(5); var style = "color:black"; cell = document.createelement('listcell'); var statusstr; switch(status) { case 0: statusstr = "downloading"; break; case 1: statusstr = "complete"; style = "color:green"; break; case 2: statusstr = "failed"; style = "color:red"; break; case 3: statusstr = "canceled"; style = "color:purple"; break; case 4: statusstr = "paused"; style = "color:blue"; break; case 5: statusstr = "queued"; style = "color:teal"; break; case 6: statusstr = "blocked"; ...
...And 2 more matches
XML in Mozilla - Archive of obsolete content
ations and drafts from the xml family of specifications are supported, as well as other related technologies. this page is outdated. please help updating it with current information. supported core xml w3c recommendations the core xml support includes parsing xml without validation (we use the expat parser), displaying xml with css, manipulating xml documents with scripts via dom, associating stylesheets with xml documents, and namespaces in xml. the core support is very good with few bugs. dtds and other external entities mozilla does not load external entities from the web. mozilla can load external entities whose system identifier uses the chrome protocol. this feature is used mainly to localize mozilla to different languages (the ui strings are stored in external dtd files). another exc...
...may also make an exception with xhtml documents, see below. mozilla will read internal (dtd) subsets, and in special circumstances external dtds as explained above and will use this information to recognize id type attributes, default attribute values, and general entities. other notes a lot of the document object model (dom, w3c recommendations and drafts) applies to xml. likewise, the cascading style sheets (css, w3c recommendations and drafts) style language can be used to style xml documents. the code for most the core xml can be found in the following directories on the mozilla mercurial repository: content/xml/, parser/expat/ and parser/htmlparser/. the newsgroup to discuss xml in mozilla depends a bit on the nature of the question. for example, dom related questions should probably be di...
...anguage can be used to style xml documents. the code for most the core xml can be found in the following directories on the mozilla mercurial repository: content/xml/, parser/expat/ and parser/htmlparser/. the newsgroup to discuss xml in mozilla depends a bit on the nature of the question. for example, dom related questions should probably be discussed in the mozilla.dev.tech.dom newsgroup, while style issues should be discussed on mozilla.dev.tech.css and so on. the catch-all newsgroup for xml discussion is mozilla.dev.tech.xml. ...
...And 2 more matches
Box Model Details - Archive of obsolete content
« previousnext » we've seen a lot of features of the box model. here, we'll find out some more details with some examples. more layout details the style properties such as min-width and max-height can be applied to any element. we've added them to buttons and textboxes, but we can also add them to spacers or boxes. in addition, the flex attribute can be applied to any element. example 1 : source view <hbox flex="1"> <button label="left" style="min-width: 100px;" flex="1"/> <spacer flex="1"/> <button label="right" style="min-width: 100px;" flex="1"/> </hbox> in the example above, all three elements will resize themselves as they are all flexible. the two buttons indicate a minimum width of 100 pixels. the buttons will never be smaller than this size but they may grow larg...
...ls this behavior on a horizontal box. you can also prevent this stretching by placing a maximum height on the elements or, better, on the box itself. if a box has a maximum height, the elements inside it are constrained by this. however, the problem with this is that you need to know how big the element will be beforehand. example 2 : source view <hbox flex="1" align="top"> <button label="left" style="min-width: 100px;" flex="1"/> <spacer flex="1"/> <button label="right" style="min-width: 100px;" flex="1"/> </hbox> summary of the box model to achieve complicated layouts, you will generally need to add nested boxes, specify minimum and maximum sizes on some elements, and make certain elements flexible. the best interface is one that can be displayed at various sizes without problems. the ...
...including inside an html element such as a table. however, the layout will be partly controlled by the html element. that means that the flex might not work exactly as you want it. remember that flexibility only has meaning for elements that are directly inside a box or an element that is a type of box. layout examples using spacers example 3 : source view <hbox> <button label="one"/> <spacer style="width: 5px"/> <button label="two"/> </hbox> here, a spacer is used as a separator between the two buttons, by setting an explicit width of 5 pixels. you could also set margins using the css margin property. centering buttons example 4 : source view <hbox pack="center" align="center" flex="1"> <button label="look at me!"/> <button label="push me!"/> </hbox> this example contains a horizon...
...And 2 more matches
Introduction to XBL - Archive of obsolete content
« previousnext » xul has a sister language, xbl (extensible bindings language). this language is used for declaring the behavior of xul widgets. bindings you can use xul to define the layout of a user interface for an application. you can customize the look of elements by applying styles to them. you can also create new skins by changing the styles. the basic appearance of all elements, such as scroll bars and check boxes may be modified by adjusting the style or by setting attributes on the element. however, xul provides no means in which you can change how an element works (or add a new element which can be reused). for example, you might want to change how the pieces of a scroll bar function. for this, you need xbl. an xbl file contains a set of bindings. each binding describes the...
...e added to the element that the binding is bound to. properties: properties added to the element. they can be accessed through a script. methods: methods added to the element. they can be called from a script. events: events, such as mouse clicks and keypresses that the element will respond to. the binding can add scripts to provide default handling. in addition new events can be defined. style: custom style properties that the xbl defined element has. binding example the box is generic enough that you can use it to create custom widgets (although you can use any element, even one you make up yourself). by assigning a class to a box tag, you can associate a binding to only those boxes that belong to that class. the following example demonstrates this. xul (example.xul): <?xml version="...
...e properties that the xbl defined element has. binding example the box is generic enough that you can use it to create custom widgets (although you can use any element, even one you make up yourself). by assigning a class to a box tag, you can associate a binding to only those boxes that belong to that class. the following example demonstrates this. ...
...And 2 more matches
XUL Structure - Archive of obsolete content
in much the same way as html or other types of content are handled. when you type the url of an html page into the browser's address field, the browser locates the web site and downloads the content. the mozilla rendering engine takes the content in the form of html source and transforms it into a document tree. the tree is then converted into a set of objects that can be displayed on the screen. style sheets (css), images, and other technologies are used to control the presentation. xul functions in much the same way. in fact, in mozilla, all document types, whether they are html or xul, or even svg, are all handled by the same underlying code. this means that the same css properties may be used to style both html and xul, and many of the features can be shared between both. however, there ar...
...ss preferences and bookmarks and perform other privileged operations. obviously, web pages do not get these privileges, unless they are signed with a digital certificate and the user has granted permission to perform these operations. this chrome package registration is the way firefox extensions are able to add features to the browser. the extensions are small packages of xul files, javascript, style sheets and images packed together into a single file. these packaged files can be created by using a zip utility. when the user downloads the zipped file, the packaged files will be installed onto the user's machine. the extension will hook into the browser using a xul specific feature called an overlay which allows the xul from the extension to mesh with the xul in the browser. to the user, it m...
...a similar way, but, of course, the xul for the application will be included as part of the installation, instead of having to be installed separately as an extension. however, this xul code will be registered in the chrome system such that the application can display the ui. it is worth noting that the mozilla browser itself is actually just a set of packages containing xul files, javascript and style sheets. these files are accessed via a chrome url and have enhanced privileges and work just like any other package. of course, the browser is much larger and more sophisticated than most extensions. firefox and thunderbird, as well as number of other components are all written in xul and are all accessible via chrome urls. you can examine these packages by looking in the chrome directory where f...
...And 2 more matches
XUL Questions and Answers - Archive of obsolete content
a scheme is in development to allow servers to open up their site for cross-site access, but that's not yet done. hidechrome="true" doesn’t work on a mac? unfortun...
... a scheme is in development to allow servers to open up their site for cross-site access, but that's not yet done. hidechrome="true" doesn’t work on a mac? unfortunately, no simple solution to this was posted. a workaro...
... a scheme is in development to allow servers to open up their site for cross-site access, but that's not yet done. hidechrome="true" doesn’t work on a mac? unfortunately, no simple solution to this was posted. a workaround is to open the c...
...And 2 more matches
listcell - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] a single cell of a listbox. by default it only contains text but iconic and checkbox listcells are also available. attributes crop, disabled, image, label, type properties disabled style classes listcell-iconic, examples (example needed) attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the ...
...ts and sets the value of the disabled attribute. ...
...the label will take up extra space even when no label text is set. if it is desired to center the image, use css to hide the label. tips if you need to right-align a cell's contents, you can do so ...
...And 2 more matches
separator - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] creates a small separating gap between elements. this type of separator should be used to separate parts of a dialog. it doesn't draw a bar visually, but is just a small space. it is functionally equivalent to a spacer except it defaults to a small size (usually 1.5 ems). attributes orient style classes groove, groove-thin, thin examples <separator class="groove-thin"/> attributes orient type: one of the values below used to specify whether the separator is a horizontal or vertical separator. note that the values are the reverse of what seems more likely. horizontal the separator separates vertically placed elements. vertical the separator separates horizontally...
...licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
...And 2 more matches
titlebar - Archive of obsolete content
will move the panel. elements inside the titlebar usually don't receive any mouse events, so e.g. buttons inside it can't be clicked and textboxes can't be focused with the mouse. if you don't want this behavior, you can override it by setting allowevents="true" on the titlebar element. the titlebar will send a command event after the move is complete. ...
...titlebar element. the titlebar will send a command event after the move is complete. examples this xul file will create a hud-style window that can be moved with the mouse. it will close if the mouse button is released. ...
... will create a hud-style window that can be moved with the mouse. it will close if the mouse button is released. ...
...And 2 more matches
window - Archive of obsolete content
ing for the "activate" and "deactivate" events. see window activation events. more information is available in the xul tutorial. ...
...or its contents have a minimum or maximum height. the css height property may also be used. hidechrome type: boolean set this attribute to true to have the chrome including the titlebar hidden. id type: unique id a unique identifier so that you can identify the element with. you can use this as a parameter to getelementbyid() and other dom functions and to reference the element in style sheets. inactivetitlebarcolor type: color string specify background color of the window's titlebar when it is inactive (background). moreover this hides separator between titlebar and window contents. this affects only on mac os x. lightweightthemes type: boolean true if the window supports lightweight themes, otherwise false. lightweightthemesfooter type: id specifies the id...
...the screen. sizemode type: one of the values below the state of the window. it can have one of the following values: maximized the window is maximized, and occupies the full size of the screen. normal the window appears in a normal state at the desired size. this attribute is used to save and restore the state of a window (together with the persist attribute) and for css styles (e.g. to hide the resizer grippy on maximized windows). note: when a window is minimized, the sizemode attribute is not updated. this is done so that if a window is closed while minimized, its persisted sizemode attribute wouldn't be minimized. setting this attribute does not change the window state. use window.maximize(), window.restore(), or window.minimize() to change the window state. to ...
...And 2 more matches
::-ms-ticks-after - Archive of obsolete content
a slider control is one possible representation of <input type="range">. these ticks are not shown by default. to show them, set the control's display property to block. it is possible to use the ::-ms-ticks-after, ::-ms-ticks-before, and ::-ms-track pseudo-elements together. to do so would create three sets of tick marks, but the best user experience is one set. to remove tick marks altogether, set the color property to transparent. ...
...ltogether, set the color property to transparent. allowable properties only the following css properties can be used in a rule with ::-ms-ticks-after in its selector. other properties are ignored. ...
...e properties only the following css properties can be used in a rule with ::-ms-ticks-after in its selector. other properties are ignored. ...
...And 2 more matches
::-ms-ticks-before - Archive of obsolete content
a slider control is one possible representation of <input type="range">. these ticks are not shown by default. to show them, set the control's display property to block. it is possible to use the ::-ms-ticks-after, ::-ms-ticks-before, and ::-ms-track pseudo-elements together. to do so would create three sets of tick marks, but the best user experience is one set. to remove tick marks altogether, set the color property to transparent. ...
...together, set the color property to transparent. allowable properties only the following css properties can be used in a rule with ::-ms-ticks-before in its selector. other properties are ignored. ...
... properties only the following css properties can be used in a rule with ::-ms-ticks-before in its selector. other properties are ignored. ...
...And 2 more matches
::-ms-value - Archive of obsolete content
d <input> control or the content of a <select> control. allowable properties only the following css properties can be used in a rule with ::-ms-value in its selector. other properties are ignored. ...
...lowable properties only the following css properties can be used in a rule with ::-ms-value in its selector. other properties are ignored. ...
...e used in a rule with ::-ms-value in its selector. other properties are ignored. ...
...And 2 more matches
Styling the Amazing Netscape Fish Cam Page - Archive of obsolete content
it's a well-known maxim that if you stick around long enough, you get a chance to see the tides of history turn. if you're lucky, you get to ride the surf that second time around without being knocked over by the waves. i was privileged enough to have that chance recently: i was asked to redesign the amazing netscape fish cam page for a new millennium. ...
...div class="card"> <img src="thumb_clown_trigger.jpg" alt="clown trigger" border="0" width="150" height="115"> <h3>clown trigger</h3> <p> our clown trigger is a bold little fish, though for a few weeks he slept a lot and didn't look well in general. he's much better now. </p> </div> basically, that's all that was needed. the reason for the class value being card is that the original idea was to style each fish's description like a trading card. although this design approach was abandoned fairly quickly, the class name stuck, kind of like a barnacle. giving the fish some style with the markup all set, it was time to style. the idea was to have the fish listed in a side-by-side arrangement, sort of like a two-column table, only without the table. this was most easily accomplished by floating ...
...next step was to place the images appropriately. this involved floating the image inside the floated div. it just seemed like a fish cam page should have a lot of floating for some reason. i also added a border to the image, so that it would have a nice frame. div.card {float: left; width: 45%; margin: 1em 2% 0 2%;} div.card img {float: left; border: 1px solid #339;} that done, it was time to style the fish names. these are enclosed in h3 elements, so the field was pretty wide open in terms of what we could do. since the image was floated, any background or border we set on the h3 would "slide under" the image; this is an expected effect with floated elements. rather than try to fight it or push the image below the h3's element box, i let the image mostly overlap the h3, but with a slight o...
...And 2 more matches
Writing JavaScript for XHTML - Archive of obsolete content
necessary because of the < in the code; otherwise you could have ignored it. a third solution is to use only external scripts, neatly sidestepping the special-character problem. alternatively, the cdata section can be couched within comments so as to be able to work in either application/xhtml+xml or text/html: <script type="text/javascript"> //<![cdata[ ... ...
...the code; otherwise you could have ignored it. a third solution is to use only external scripts, neatly sidestepping the special-character problem. alternatively, the cdata section can be couched within comments so as to be able to work in either application/xhtml+xml or text/html: <script type="text/javascript"> //<![cdata[ ... ...
...ution is to use only external scripts, neatly sidestepping the special-character problem. alternatively, the cdata section can be couched within comments so as to be able to work in either application/xhtml+xml or text/html: <script type="text/javascript"> //<![cdata[ ... //]]> </script> <!-- (for styles, it is different) --> <style type="text/css"> /*<![cdata[*/ ... ...
...And 2 more matches
Move the ball - Game development
unction will be executed within setinterval every 10 miliseconds: function draw() { // drawing code } setinterval(draw, 10); thanks to the infinite nature of setinterval the draw() function will be called every 10 milliseconds forever, or until we stop it. now, let's draw the ball — add the following inside your draw() function: ctx.beginpath(); ctx.arc(50, 50, 10, 0, math.pi*2); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); try your updated code now — the ball should be repainted on every frame. making it move you won't notice the ball being repainted constantly at the moment, as it's not moving. let's change that. first, instead of a hardcoded position at (50,50) we will define a starting point at the bottom center part of the canvas in variables called x and y, then ...
...e to define the position the circle is drawn at. first, add the following two lines above your draw() function, to define x and y: var x = canvas.width/2; var y = canvas.height-30; next update the draw() function to use the x and y variables in the arc() method, as shown in the following highlighted line: function draw() { ctx.beginpath(); ctx.arc(x, y, 10, 0, math.pi*2); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); } now comes the important part: we want to add a small value to x and y after every frame has been drawn to make it appear that the ball is moving. let's define these small values as dx and dy and set their values to 2 and -2 respectively. add the following below your x and y variable definitions: var dx = 2; var dy = -2; the last thing to do...
...add the following below your x and y variable definitions: var dx = 2; var dy = -2; the last thing to do is to update x and y with our dx and dy variable on every frame, so the ball will be painted in the new position on every update. add the following two new lines indicated below to your draw() function: function draw() { ctx.beginpath(); ctx.arc(x, y, 10, 0, math.pi*2); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); x += dx; y += dy; } save your code again and try it in your browser. this works ok, although it appears that the ball is leaving a trail behind it: clearing the canvas before each frame the ball is leaving a trail because we're painting a new circle on every frame without removing the previous one. don't worry, because there's a metho...
...And 2 more matches
Gecko FAQ - Gecko Redirect 1
der development at mozilla.org. gecko has been known previously by the code names "raptor" and "nglayout"; the new name was chosen following a trademark infringement dispute. for more information see the wikipedia article on gecko. what is a layout engine? basically, a layout engine takes content (such as html, xml, image files, applets, and so on) and formatting information (such as cascading style sheets, presentational html tags, etc.) and displays the formatted content on the screen. it paints the browser's content area, which is the blank area inside the browser window's chrome. formally, a layout engine defines the placement policy for a document and places content on a page. gecko's core is a very fast layout engine. gecko also offers the ability to parse various document types (html...
... scope-rowgroup, scope-colgroup, charoff, datasrc, datafld, dataformat, datapagesize, summary, event, dir, align on table columns, label attribute of option, alternate text of area elements, longdesc various metadata attributes: cite, datetime, lang, hreflang bidirectional text layout, which is only used in hebrew and arabic (ibm has begun work to add bidi support in a future release) style sheets css 1 - full support, except for: the application of styles to html column elements the ability to turn off author styles the names of certain mozilla extension pseudo-classes lack the moz- prefix css 2 - partial support is expected and has already been built into gecko, including support for css2 positioning, but no commitment has been made to achieve...
...dom 3 support is also planned for a future release. xml 1.0: full support, except for processing to manipulate default attributes rdf: full support, except for abouteach, abouteachprefix, and parsetype javascript 1.5, including ecma-262 edition 3 (ecmascript) compliance, except for date.todatestring and date.totimestring, which are not implemented transfer protocols: ...
...And 2 more matches
Backgrounds and borders - Learn web development
rders. from adding gradients, background images, and rounded corners, backgrounds and borders are the answer to a lot of styling questions in css. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn how to style the background and border of boxes. styling backgrounds in css the css background property is a shorthand for a number of background longhand properties that we will meet in this lesson. if you discover a complex background property in a stylesheet, it might seem a little hard to understand as so many values can be passed in at once. .box { background: linear-gradient(105deg, rgba(255,...
...re they should be purely decoration; any important content should be part of the html page and not contained in a background. borders when learning about the box model, we discovered how borders affect the size of our box. in this lesson we will look at how to use borders creatively. ...
... with css we use a shorthand property that sets the color, width, and style of the border in one line of css. we can set a border for all four sides of a box with border: .box { border: 1px solid black; } or we can target one edge of the box, for example: .box { border-top: 1px solid black; } the individual properties for these shorthands would be: .box { border-width: 1px; border-style: solid; border-color: black; } and for the longhands: .box { border-top-width: 1px; border-top-style: solid; border-top-color: black; } note: these top, right, bottom, and left border properties also have mapped logical properties that relate to the writing mode of the document (e.g. left-to-right or right-to-left text, or top-to-bottom). we'll be exploring these in the next lesson,...
...And 2 more matches
Images, media, and form elements - Learn web development
previous overview: building blocks next in this lesson we will take a look at how certain special elements are treated in css. images, other media, and form elements behave a little differently in terms of your ability to style them with css than regular boxes. understanding what is and isn't possible can save some frustration, and this lesson will highlight some of the main things that you need to know. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to understand the way that some elements behave unusually when styled with css. replaced elements images and video are described as rep...
...if the user enters something unexpected, or leaves a required field blank, the browser can show an error message. different browsers are inconsistent in how much styling and customization they allow for such items. styling text input elements elements that allow for text input, such as <input type="text">, specific types such as <input type="email">, and the <textarea> element are quite easy to style and tend to behave just like other boxes on your page. the default styling of these elements will differ however based on the operating system and browser that your user visits the site with. in the example below we have styled some text inputs using css — you can see that things such as borders, margins and padding all apply as you would expect. we are using attribute selectors to target the ...
...t" as a final step, we can wrap up the various properties discussed above into the following "form reset" to provide a consistent base to work from. this includes all the items mentioned in the last three sections: button, input, select, textarea { font-family: inherit; font-size: 100%; box-sizing: border-box; padding: 0; margin: 0; } textarea { overflow: auto; } note: normalizing stylesheets are used by many developers to create a set of baseline styles to use on all projects. typically these do similar things to those described above, making sure that anything different across browsers is set to a consistent default before you do your own work on the css. they are not as important as they once were, as browsers are typically more consistent than in the past. however if you wan...
...And 2 more matches
create fancy boxes - Learn web development
making them nice looking is both fun and challenging. it's fun because it's all about turning a design idea into working code; it's challenging because of annoying constraints and crazy freedom in the use of css. let's do some fancy boxes. before we start getting into the practical side of it, make sure you are familiar with the css box model. it's also a good idea, but not a prerequisite, to be familiar with some css layout basics. on the technical side, creating fancy boxes are all about mastering css border and background properties and how to apply them to a given box. but beyond the technics its also all about unleashing your creativity. ...
...reative ways. if you want to see some crazy examples, take a look at lea verou's css patterns. just remember that such use of gradient is quite expensive, performance wise. if you want to learn more about gradient, feel free to get into our dedicated article. pseudo-elements when styling a single box, you could find yourself limited and could wish to have more boxes to create even more amazing styles. most of the time, that leads to polluting the dom by adding extra html element for the unique purpose of style. even if it is necessary, it's somewhat considered bad practice. one solution to avoid such pitfalls is to use css pseudo-elements. a cloud <div class="fancy">hi! i want to be fancy.</div> let's have an example by turning our box into a cloud: .fancy { text-align: center; /*...
... : 80px 1em 0 1em; /* we make room for the "ears" of our cloud */ margin : 0 100px; position: relative; background-color: #a4c9cf; /* well, actually we are not making a full circle as we want the bottom of our cloud to be flat. feel free to tweak this example to make a cloud that isn't flat at the bottom ;) */ border-radius: 100% 100% 0 0; } /* those are common style that apply to both our ::before and ::after pseudo elements. */ .fancy::before, .fancy::after { /* this is required to be allowed to display the pseudo-elements, event if the value is an empty string */ content: ''; /* we positionnate our pseudo-elements on the left and right sides of the box, but always at the bottom */ position: absolute; bottom : 0; /* this mak...
...And 2 more matches
What’s in the head? Metadata in HTML - Learn web development
previous overview: introduction to html next the head of an html document is the part that is not displayed in the web browser when the page is loaded. it contains information such as the page <title>, links to css (if you choose to style your html content with css), links to custom favicons, and other metadata (data about the html, such as the author, and important keywords that describe the document.) in this article we'll cover all of the above and more, in order to give you a good basis for working with markup. prerequisites: basic html familiarity, as covered in getting started with html. objective: to learn about the html head, its purpose, the most important items it can contain, and what effect it can have on the html document. what is the html ...
...t all websites you'll use in the modern day will employ css to make them look cool, and javascript to power interactive functionality, such as video players, maps, games, and more. these are most commonly applied to a web page using the <link> element and the <script> element, respectively. the <link> element should always go inside the head of your document. ...
... css to make them look cool, and javascript to power interactive functionality, such as video players, maps, games, and more. these are most commonly applied to a web page using the <link> element and the <script> element, respectively. the <link> element should always go inside the head of your document. this takes two attributes, rel="stylesheet", which indicates that it is the document's stylesheet, and href, which contains the path to the stylesheet file: <link rel="stylesheet" href="my-css-file.css"> the <script> element should also go into the head, and should include a src attribute containing the path to the javascript you want to load, and defer, which basically instructs the browser to load the javascript at the same time as the page's html. this is useful as it makes s...
...And 2 more matches
Third-party APIs - Learn web development
cated on third party servers. to access them from javascript you first need to connect to the api functionality and make it available on your page. this typically involves first linking to a javascript library available on the server via a <script> element, as seen in our mapquest example: <script src="https://api.mqcdn.com/sdk/mapquest-js/v1.3.2/mapquest.js"></script> <link type="text/css" rel="stylesheet" href="https://api.mqcdn.com/sdk/mapquest-js/v1.3.2/mapquest.css"/> you can then start using the objects available in that library. for example: let map = l.mapquest.map('map', { center: [53.480759, -2.242631], layers: l.mapquest.tilelayer('map'), zoom: 12 }); here we are creating a variable to store the map information in, then creating a new map using the mapquest.map() method, wh...
...onal "callback url". you don't need to fill in a url here: just leave it blank.) open up your starting file, and replace the api key placeholder with your key. changing the type of map there are a number of different types of map that can be shown with the mapquest api. to do this, find the following line: layers: l.mapquest.tilelayer('map') try changing 'map' to 'hybrid' to show a hybrid-style map. try some other values too. the tilelayer reference page shows the different available options, plus a lot more information. adding different controls the map has a number of different controls available; by default it just shows a zoom control. you can expand the controls available using the map.addcontrol() method; add this to your code, inside the window.onload handler: map.addcontrol(l...
... to the displayresults() function so the data can be displayed in our ui. displaying the data ok, let's look at how we'll display the data. add the following function below your fetchresults() function. ...
...And 2 more matches
Video and Audio APIs - Learn web development
the <video> element contains two <source> elements so that different formats can be loaded depending on the browser viewing the site. the controls html is probably the most interesting: we have four <button>s — play/pause, stop, rewind, and fast forward. each <button> has a class name, a data-icon attribute for defining what icon should be shown on each button...
...this is an icon font — all the characters of the alphabet equate to common icons you might want to use in an applicat...
...ns a capital "p". we apply the custom web font to our buttons using font-family. in this font, "p" is actually a "play" icon, so therefore the play button has a "play" icon displayed on it. icon fonts are very cool for many reasons — cutting down on http requests because you don't need to download those icons as image files, great scalability, and the fact that you can use text properties to style them — like color and text-shadow. last but not least, let's look at the css for the timer: .timer { line-height: 38px; font-size: 10px; font-family: monospace; text-shadow: 1px 1px 0px black; color: white; flex: 5; position: relative; } .timer div { position: absolute; background-color: rgba(255,255,255,0.2); left: 0; top: 0; width: 0; height: 38px; z-index: 2; }...
...And 2 more matches
Getting started with Vue - Learn web development
create more sophisticated components. as a bonus, projects created with the vue cli are configured to use .vue files with webpack out of the box. in fact, if you look inside the src folder in the project we created with the cli, you'll see your first .vue file: app.vue. let's explore this now. app.vue open your app.vue file — you’ll see that it has three parts: <template>, <script>, and <style>, which contain the component’s template, scripting, and styling information. all single file components share this same basic structure. <template> contains all the markup structure and display logic of your component. your template can contain any valid html, as well as some vue-specific syntax that we'll cover later. note: by setting the lang attribute on the <template> tag, you can use p...
...ur app necessarily needs every component. import helloworld from './components/helloworld.vue'; export default { name: 'app', components: { //you can register components locally here. helloworld } }; note: if you want to use typescript syntax, you need to set the lang attribute on the <script> tag to signify to the compiler that you're using typescript — <script lang="ts">. ...
...d.vue'; export default { name: 'app', components: { //you can register components locally here. helloworld } }; note: if you want to use typescript syntax, you need to set the lang attribute on the <script> tag to signify to the compiler that you're using typescript — <script lang="ts">. <style> is where you write your css for the component. if you add a scoped attribute — <style scoped> — vue will scope the styles to the contents of your sfc. ...
...And 2 more matches
Introduction to automated testing - Learn web development
" } with this, you are ready to move on. setting up gulp automation let's look at setting up gulp and using it to automate some testing tools. to begin with, create a test npm project using the procedure detailed at the bottom of the previous section. next, you'll need some sample html, css and javascript content to test your system on — make copies of our sample index.html, main.js, and style.css files in a subfolder with the name src inside your project folder. you can try your own test content if you like, but bear in mind that such tools won't work on internal js/css — you need external files. first, install gulp globally (meaning, it will be available across all projects) using the following command: npm install --global gulp-cli next, run the following command inside your...
... created. ...
...t csslint = require('gulp-csslint'); add the following test to the bottom of gulpfile.js: function css(cb) { return gulp.src('src/style.css') .pipe(csslint()) .pipe(csslint.formatter('compact')) .pipe(autoprefixer({ browsers: ['last 5 versions'], cascade: false })) .pipe(gulp.dest('build')); cb(); } here we grab our style.css file, run csslint on it (which outputs a list of any errors in your css to the terminal), then runs it through autoprefixer to add any prefixes needed to make nascent css features run in older browsers. at the end of the pipe chain, we output our modified prefixed css to the build directory. note that this only works if csslint doesn't find any errors — try removing a curly brace from your ...
...And 2 more matches
Commenting IDL for better documentation
s and notes and turn them into beautiful, easy to search and read documentation. but by following the guidelines here, you can help make sure that our tools can generate a "good start" version of the documentation for your interfaces, and that the writers will be able to easily figure out what the tools are not able to do automatically. comment format doxygen supports several comment formats; for style and consistency reasons, we use the following: /** * */ note the two asterisks ("**") on the first line of the comment. that lets doxygen (and by extension, our automated documentation import tools) know that the comment should be absorbed into documentation. if you use any other format for your comments, our tools will ignore them. following the rules below will ensure that our tools are able...
...ill ensure that our tools are able to produce the best possible results, and will have the added bonus of making your comments easier to read! include documentation comments for everything, even if you think it is obvious what it means. automatic documentation generation tools can not see what is obvious to human brains. plus, what is obvious to you is likely not obvious to everyone. use doxygen style comments only for information that is directly useful to someone using or implementing the interface. this helps keep the documentation tidy. be concise and to the point. writers will expand upon your documentation if necessary. keep in mind that people for whom english is not their native language will be reading your comments (as well as the generated documentation), so try to avoid slang and a...
...an one brief per interface. @param parameter description every parameter of a method should be documented, only use the parameter name, leave out things like [in]/[out]. @returns description if the method returns something then this should be included. @throws error description the error should be the actual name of the error constant, in all caps. @note description used to include a note styled paragraph. @remarks remark a remark paragraph to be included in the remarks section of the documentation. note: this is not yet supported by our documentation tool. using it will make it easier for documenters. @see description either an interface or a html link. note: this is not yet supported by our documentation tool. using it will make it easier for documenters. - or . used at the be...
...And 2 more matches
Experimental features in Firefox
r point rather than radiating from it. see bug 1175958 for more details. release channel version added enabled by default? nightly 75 no developer edition 75 no beta 75 no release 75 no preference name layout.css.conic-gradient.enabled and gfx.webrender.all pseudo-class: :focus-visible allows focus styles to be applied to elements like buttons and form controls, only when they are focused using the keyboard (e.g. when tabbing between elements), and not when they are focused using a mouse or other pointing device. see bug 1617600 for more details. release channel version added enabled by default? nightly 75 no developer edition 75 no beta ...
...applies filter effects to the area behind an element. see bug 1178765 for more details. release channel version added enabled by default? nightly 70 no developer edition 70 no beta 70 no release 70 no preference name layout.css.backdrop-filter.enabled grid: masonry layout adds support for a masonry style layout based on grid layout where one axis has a masonry layout while having normal grid layout on the other. this allows to create gallery style layouts like on pinterest. see bug 1607954 for more details. release channel version added enabled by default? nightly 77 no developer edition 77 no beta 77 no release 77 no...
... this on desktop, but you can track the state of that just in case it changes in bug 1551302. release channel version added enabled by default? nightly 63 no developer edition 63 no beta 63 no release 63 starting in firefox 68, on android only preference name dom.visualviewport.enabled constructable stylesheets the addition of a constructor to the cssstylesheet interface as well as a variety of related changes makes it possible to directly create new stylesheets without having to add the sheet to the html. this makes it much easier to create reusable stylesheets for use with shadow dom. our implementation is not yet complete; see bug 1520690 for more details. release channel version ...
...And 2 more matches
Mozilla Quirks Mode Behavior
add padding if the very first node in an li is another ul or ol (bug 98636). obsolete since gecko 50 list bullets do not inherit the font size of the list (bug 97351). removed in firefox 50 (bug 648331). don't inherit font properties into tables except for font-family. make table borders gray rather than using the foreground color. ...
...lor. collapse top margin of body and td and bottom margin of td. collapse the bottom or top margins of empty elements (bug 97361). support <pre wrap>, <pre cols>, <pre width>. orphaned dd has generated content :before instead of margin (bug 5119). indent nested dl elements (bug 8749). map acts like an inline, not a block. give floated img a 3px margin (bug 58899). ...
... the css parser accepts colors not beginning with #, except in shorthands. ...
...And 2 more matches
Console messages - Firefox Developer Tools
ble ones: copy link location acts as you would expect, copying the url into the clipboard open in network panel switches context to the network tab, selects the request and shows you the details resend request sends the network request again. open url in new tab opens the url in a new browser tab. if the resource is an image, the image will be opened in a new tab. if the resource is a stylesheet, you will see the css rules, etc. js javascript errors contain a "learn more" link that takes you to the javascript error reference containing additional advice for fixing issues: source maps the web console understands source maps. this means that if your javascript sources are compressed, you can supply a source map for them. then any messages or errors your source generates will...
...esized or some javascript modifies an element's css — the layout is not recalculated immediately. instead, the reflow happens asynchronously, the next time the browser decides it needs to be done (generally, the next time the browser repaints). in this way the browser can save up a collection of invalidating changes and recalculate their effect at once. ...
...low happens asynchronously, the next time the browser decides it needs to be done (generally, the next time the browser repaints). in this way the browser can save up a collection of invalidating changes and recalculate their effect at once. however, if some javascript code reads a style that has been modified, then the browser must perform a synchronous reflow in order to calculate the computed style to return. ...
...And 2 more matches
CSSRuleList - Web APIs
a cssrulelist is an (indirect-modify only) array-like object containing an ordered collection of cssrule objects. description each cssrule can be accessed as rules.item(index), or simply rules[index], where rules is an object implementing the cssrulelist interface (such as cssstylesheet.cssrules), and index is the 0-based index of the rule, in the order as it appears in the style sheet css. the number of rules in the list is rules.length. note that being indirect-modify (changeable but only having read-methods), rules are not added or removed from the list directly, but instead here, only via its parent stylesheet. in fact, .insertrule() and .deleterule() are not even methods of cssrulelist, but only of cssstylesheet. if however, for some reason the list does need to be modified but has no ...
...ules in the list is rules.length. note that being indirect-modify (changeable but only having read-methods), rules are not added or removed from the list directly, but instead here, only via its parent stylesheet. in fact, .insertrule() and .deleterule() are not even methods of cssrulelist, but only of cssstylesheet. ...
...y, but instead here, only via its parent stylesheet. in fact, .insertrule() and .deleterule() are not even methods of cssrulelist, but only of cssstylesheet. if however, for some reason the list does need to be modified but has no parent stylesheet (perhaps being a livecopy of a list that does), it cannot just be assigned one (as it has no such property), and neither can it be assigned to one (as stylesheet.cssrules is read-only), but it must unfortunately be inserted into one, rule by rule, and unless combining lists, after any existing list therein is deleted, rule by rule. ...
...And 2 more matches
CanvasRenderingContext2D.createPattern() - Web APIs
the canvasrenderingcontext2d.createpattern() method of the canvas 2d api creates a pattern using the specified image and repetition. this method returns a canvaspattern. this method doesn't draw anything to the canvas directly. the pattern it creates must be assigned to the canvasrenderingcontext2d.fillstyle or canvasrenderingcontext2d.strokestyle properties, after which it is applied to any subsequent drawing. syntax canvaspattern ctx.createpattern(image, repetition); parameters image a canvasimagesource to be used as the pattern's image. it can be any of the following: htmlimageelement (<img>) svgimageelement (<image>) htmlvideoelement (<video>, by using the capture of the video) htmlcanvaselement (<canvas>) imagebitmap offscreencanvas repetition a domstring indi...
...f repetition is specified as an empty string ("") or null (but not undefined), a value of "repeat" will be used. return value canvaspattern an opaque object describing a pattern. examples creating a pattern from an image this example uses the createpattern() method to create a canvaspattern with a repeating source image. once created, the pattern is assigned to the canvas context's fill style and applied to a rectangle. the original image looks like this: html <canvas id="canvas" width="300" height="300"></canvas> javascript var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); var img = new image(); img.src = 'https://udn.realityripple.com/samples/04/aaeaf9aac4.png'; img.onload = function() { var pattern = ctx.createpattern(img, 'repeat'); ct...
...pplied to a rectangle. the original image looks like this: html <canvas id="canvas" width="300" height="300"></canvas> javascript var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); var img = new image(); img.src = 'https://udn.realityripple.com/samples/04/aaeaf9aac4.png'; img.onload = function() { var pattern = ctx.createpattern(img, 'repeat'); ctx.fillstyle = pattern; ctx.fillrect(0, 0, 300, 300); }; creating a pattern from a canvas in this example we create a pattern from the contents of an offscreen canvas. we then apply it to the fill style of our primary canvas, and fill that canvas with the pattern. javascript // create a pattern, offscreen const patterncanvas = document.createelement('canvas'); const patterncontext = patterncanvas.get...
...And 2 more matches
Traversing an HTML table with JavaScript and DOM Interfaces - Web APIs
set_background() { // get a list of all the body elements (there will only be one), // and then select the zeroth (or first) such element mybody = document.getelementsbytagname("body")[0]; // now, get all the p elements that are descendants of the body mybodyelements = mybody.getelementsbytagname("p"); // get the second item of the list of p elements myp = mybodyelements[1]; myp.style.background = "rgb(255,0,0)"; } in this example, we set the myp variable to the dom object for the second p element inside the body: first, we get a list of all the body elements via mybody = document.getelementsbytagname("body")[0] since there is only one body element in any valid html document, this list will have only one item, which we retrieve by selecting the first element in that ...
...eve by selecting the first element in that list using [0]. next, we get all the p elements that are descendants of the body: mybodyelements = mybody.getelementsbytagname("p"); finally, we get the second item from the list of p elements via myp = mybodyelements[1]; once you have gotten the dom object for an html element, you can set its properties. for example, if you want to set the style background color property, you just add: myp.style.background = "rgb(255,0,0)"; // setting inline style attribute creating textnodes with document.createtextnode("..") use the document object to invoke the createtextnode method and create your text node. you just need to pass the text content. the return value is an object that represents the text node. mytextnode = document.createtextnode("...
...nt of myceltext currenttext=document.createtextnode(myceltext.data); mybody.appendchild(currenttext); getting an attribute value at the end of sample1 there is a call to setattribute on the mytable object. this call was used to set the border property of the table. to retrieve the value of the attribute, use the getattribute method: mytable.getattribute("border"); hiding a column by changing style properties once you have the object in your javascript variable, you can set style properties directly. the following code is a modified version of sample1.html in which each cell of the second column is hidden and each cell of the first column is changed to have a red background. note that the style property was set directly. <html> <body onload="start()"> </body> <script> function start()...
...And 2 more matches
EffectTiming.fill - Web APIs
Web › API › EffectTiming › fill
that css looks like this: #box { width: 200px; height: 200px; left: 50px; top: 50px; border: 1px solid #7788ff; margin: 0; position: relative; background-color: #2233ff; display: flex; justify-content: center; } all this does is specify the size, border, and color information, as well as indicate that the box should be centered bot...
...line); alternatives to fill modes fill modes are primarily provided as a means of representing the animation-fill-mode feature of css animations. when used to persist the effect of an animation indefinitely, however, they have a number of drawbacks: the forwards fill of an animation (or backwards fill if the animation is playing in reverse) will continue to override any changes to specified style indefinitely which can lead to confusing behavior. this is because animations take priority in the css cascade over normal author styles. in order to avoid leaking memory when many filling animations overlap, the browser is required to remove overlapped animations which can lead to surprising results in some cases. rather than using fill modes to persist an animation, it is often simpler to se...
...use animations take priority in the css cascade over normal author styles. in order to avoid leaking memory when many filling animations overlap, the browser is required to remove overlapped animations which can lead to surprising results in some cases. rather than using fill modes to persist an animation, it is often simpler to set the final value of the animation effect directly in specified style: elem.animate({ transform: 'translatey(100px)' }, 200).finished.then(() => { elem.style.transform = 'translatey(100px)'; }); alternatively, it may be simpler still to set the final value in specified style before triggering the animation and then animate from the start value. this is the approach used in flip animation. ...
...And 2 more matches
Element.getClientRects() - Web APIs
lientrectsoverlay(elt) { /* absolutely position a div over each client rect so that its border width is the same as the rectangle's width. note: the overlays will be out of place if the user resizes or zooms. ...
...ion a div over each client rect so that its border width is the same as the rectangle's width. note: the overlays will be out of place if the user resizes or zooms. ...
...r (var i = 0; i != rects.length; i++) { var rect = rects[i]; var tablerectdiv = document.createelement('div'); tablerectdiv.style.position = 'absolute'; tablerectdiv.style.border = '1px solid red'; var scrolltop = document.documentelement.scrolltop || document.body.scrolltop; var scrollleft = document.documentelement.scrollleft || document.body.scrollleft; tablerectdiv.style.margin = tablerectdiv.style.padding = '0'; tablerectdiv.style.top = (rect.top + scrolltop) + 'px'; tablerectdiv.style.left = (rect.left + scrollleft) + 'px'; // we want rect.width to be the border width, so content width is 2px less. ...
...And 2 more matches
Using files from web applications - Web APIs
nts using the click() method you can hide the admittedly ugly file <input> element and present your own interface for opening the file picker and displaying which file or files the user has selected. you can do this by styling the input element with display:none and calling the click() method on the <input> element. ...
... using a label element to trigger a hidden file input element to allow opening the file picker without using javascript (the click() method), a <label> element can be used. ...
... 1px; width: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); } /* separate rule for compatibility, :focus-within is required on modern firefox and chrome */ input.visually-hidden:focus + label { outline: thin dotted; } input.visually-hidden:focus-within + label { outline: thin dotted; } there is no need to add javascript code to call fileelem.click(). also in this case you can style the label element as you wish. you need to provide a visual cue for the focus status of the hidden input field on its label, be it an outline as shown above, or background-color or box-shadow. (as of time of writing, firefox doesn’t show this visual cue for <input type="file"> elements.) selecting files using drag and drop you can also let the user drag and drop files into your web applicatio...
...And 2 more matches
HTMLCanvasElement.toDataURL() - Web APIs
lity = canvas.todataurl('image/jpeg', 0.1); example: dynamically change images you can use this technique in coordination with mouse events in order to dynamically change images (gray-scale vs. ...
... example: dynamically change images you can use this technique in coordination with mouse events in order to dynamically change images (gray-scale vs. ...
...tion with mouse events in order to dynamically change images (gray-scale vs. ...
...And 2 more matches
Node.isConnected - Web APIs
Web › API › Node › isConnected
ct, and false if not. ...
... standard dom a standard dom example: let test = document.createelement('p'); console.log(test.isconnected); // returns false document.body.appendchild(test); console.log(test.isconnected); // returns true shadow dom a shadow dom example: // create a shadow root var shadow = this.attachshadow({mode: 'open'}); // create some css to apply to the shadow dom var style = document.createelement('style'); console.log(style.isconnected); // returns false style.textcontent = ` .wrapper { position: relative; } .info { font-size: 0.8rem; width: 200px; display: inline-block; border: 1px solid black; padding: 10px; background: white; border-radius: 10px; opacity: 0; transition: 0.6s all; positions: absolute; bottom: 20px; left: 10px; z-index: 3 } `; // attach the create...
... * no warranty expressed or implied. use at your own risk. ...
...And 2 more matches
Using the Payment Request API - Web APIs
he paymentrequest.show() method on it to initiate the payment request. this returns a promise that fulfills with a paymentresponse object if the payment is successful: request.show().then(function(paymentresponse) { // here we would process the payment. for this demo, simulate immediate success: paymentresponse.complete('success') .then(function() { // for demo purposes: intropanel.style.display = 'none'; successpanel.style.display = 'block'; }); }) this object provides the developer with access to details they can use to complete the logical steps required after the payment completes, such as an email address to contact the customer, a shipping address for mailing goods out to them, etc. in the code above, you'll see that we've called the paymentresponse.complete() method...
...on.addeventlistener('click', function() { var request = new paymentrequest(buildsupportedpaymentmethoddata(), buildshoppingcartdetails()); request.show().then(function(paymentresponse) { // here we would process the payment. ...
... request = new paymentrequest(buildsupportedpaymentmethoddata(), buildshoppingcartdetails()); request.show().then(function(paymentresponse) { // here we would process the payment. ...
...And 2 more matches
Pinch zoom gestures - Web APIs
uding fingers, mice, and pens. the pinch in (zoom out) gesture, which moves the two pointers toward each other, changes the target element's background color to lightblue. the pinch out (zoom in) gesture, which moves the two pointers away from each other, changes the target element's background color to pink. define touch target the application uses <div> to define the pointers' target areas. <style> div { margin: 0em; padding: 2em; } #target { background: white; border: 1px solid black; } </style> global state supporting a two-pointer gesture requires preserving a pointer's event state during various event phases. this application uses two global variables to cache the event state. // global vars to cache event state var evcache = new array(); var prevdiff = -1; ...
... gesture. // // if the distance between the two pointers has increased (zoom in), // the target element's background is changed to "pink" and if the // distance is decreasing (zoom out), the color is changed to "lightblue". // // this function sets the target element's border to "dashed" to visually // indicate the pointer's target received a move event. ...
...eak; } } // if two pointers are down, check for pinch gestures if (evcache.length == 2) { // calculate the distance between the two pointers var curdiff = math.abs(evcache[0].clientx - evcache[1].clientx); if (prevdiff > 0) { if (curdiff > prevdiff) { // the distance between the two pointers has increased log("pinch moving out -> zoom in", ev); ev.target.style.background = "pink"; } if (curdiff < prevdiff) { // the distance between the two pointers has decreased log("pinch moving in -> zoom out",ev); ev.target.style.background = "lightblue"; } } // cache the distance for the next move event prevdiff = curdiff; } } pointer up the pointerup event is fired when a pointer is raised from the contact surface.
...And 2 more matches
Using Pointer Events - Web APIs
point on the surface. example the text below uses the term "finger" when describing the contact with the surface, but it could, of course, also be a stylus, mouse, or other method of pointing at a location. create a canvas the touch-action property is set to none to prevent the browser from applying its default touch behavior to the application. ...
... pointing at a location. create a canvas the touch-action property is set to none to prevent the browser from applying its default touch behavior to the application. <canvas id="canvas" width="600" height="600" style="border:solid black 1px; touch-action:none"> your browser does not support canvas element. </canvas> <br> <button onclick="startup()">initialize</button> <br> log: <pre id="log" style="border: 1px solid #ccc;"></pre> setting up the event handlers when the page loads, the startup() function shown below should be called by our <body> element's onload attribute (but in the example we use a button to trigger it, due to limitations of the mdn live example system). function startup() { var el = document.getelementsbytagname("canvas")[0]; el.addeventlistener("pointerdown", ha...
...we're using a 4-pixel wide line, so a 4 pixel radius circle will show up neatly. drawing as the pointers move each time one or more pointers moves, a pointermove event is delivered, resulting in our handlemove() function being called. it...
...And 2 more matches
Using the Web Storage API - Web APIs
as a storageevent is fired. note: as well as viewing the example pages live using the above links, you can also check out the source code. testing whether your storage has been populated to start with, in main.js, we test whether the storage object has already been populated (i.e., the page was previously accessed): if(!localstorage.getitem('bgcolor')) { populatestorage(); } else { setstyles(); } the storage.getitem() method is used to get a data item from storage; in this case, we are testing to see whether the bgcolor item exists; if not, we run populatestorage() to add the existing customization values to the storage. if there are already values there, we run setstyles() to update the page styling with the stored values. note: you could also use storage.length to test whether t...
... already values there, we run setstyles() to update the page styling with the stored values. note: you could also use storage.length to test whether the storage object is empty or not. getting values from storage as noted above, values can be retrieved from storage using storage.getitem(). this takes the key of the data item as an argument, and returns the data value. ...
...eturns the data value. for example: function setstyles() { var currentcolor = localstorage.getitem('bgcolor'); var currentfont = localstorage.getitem('font'); var currentimage = localstorage.getitem('image'); document.getelementbyid('bgcolor').value = currentcolor; document.getelementbyid('font').value = currentfont; document.getelementbyid('image').value = currentimage; htmlelem.style.backgroundcolor = '#' + currentcolor; pelem.style.fontfamily = currentfont; imgelem.setattribute('src', currentimage); } here, the first three lines grab the values from local storage. next, we set the values displayed in the form elements to those values, so that they keep in sync when you reload the page. ...
...And 2 more matches
XSLT Basic Example - Web APIs
this first example demonstrates the basics of setting up an xslt transformation in a browser. the example will take an xml document that contains information (title, list of authors and body text) about an article and present it in an human readable form. figure 1 shows the source of the basic xslt example. the xml document (example.xml) contains the information about the article. using the ?xml-stylesheet? processing instruction, it links to the xslt stylesheet (example.xsl) via its href attribute. an xslt stylesheet starts with the xsl:stylesheet element, which contains all the templates used to create the final output. the example in figure 1 has two templates - one that matches the root node and one that matches author nodes. the template that matches the root node outputs the article's ti...
...utput. the example in figure 1 has two templates - one that matches the root node and one that matches author nodes. the template that matches the root node outputs the article's title and then says to process all templates (via apply-templates) that match author nodes which are children of the authors node. ...
...via apply-templates) that match author nodes which are children of the authors node. figure 1 : simple xslt example xml document (example.xml) : <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="example.xsl"?> <article> <title>my article</title> <authors> <author>mr. foo</author> <author>mr. ...
...And 2 more matches
XSLTProcessor - Web APIs
an xsltprocessor applies an xslt stylesheet transformation to an xml document to produce a new xml document as output. it has methods to load the xslt stylesheet, to manipulate <xsl:param> parameter values, and to apply the transformation to documents. syntax the constructor has no parameters. new xsltprocessor() methods [throws] void xsltprocessor.importstylesheet(node stylesheet) imports the xslt stylesheet. if the given node is a document node, you can pass in a full xsl transform or a literal result element transform; otherwise, it must be an <xsl:stylesheet> or <xsl:transform> element. ...
...oid xsltprocessor.importstylesheet(node stylesheet) imports the xslt stylesheet. if the given node is a document node, you can pass in a full xsl transform or a literal result element transform; otherwise, it must be an <xsl:stylesheet> or <xsl:transform> element. [throws] documentfragment xsltprocessor.transformtofragment(node source, document owner) transforms the node source by applying the stylesheet imported using the xsltprocessor.importstylesheet() function. the owner document of the resulting document fragment is the owner node. [throws] document xsltprocessor.transformtodocument(node source) transforms the node source applying the stylesheet given importing using the xsltprocessor.importstylesheet() function. ...
...g the stylesheet imported using the xsltprocessor.importstylesheet() function. the owner document of the resulting document fragment is the owner node. [throws] document xsltprocessor.transformtodocument(node source) transforms the node source applying the stylesheet given importing using the xsltprocessor.importstylesheet() function. the resultant object depends on the output method of the stylesheet: output method result type html htmldocument xml xmldocument text xmldocument with a single root element <transformiix:result> with the text as a child [throws] void xsltprocessor.setparameter(string namespaceuri, string localname, any value) sets a parameter in the xslt stylesheet that was imported. (sets t...
...And 2 more matches
<input type="file"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › file
iles currently selected for upload</p> </div> <div> <button>submit</button> </div> </form> html { font-family: sans-serif; } form { width: 580px; background: #ccc; margin: 0 auto; padding: 20px; border: 1px solid black; } form ol { padding-left: 0; } form li, div > p { background: #eee; display: flex; justify-content: space-between; margin-bottom: 10px; list-style-type: none; border: 1px solid black; } form img { height: 64px; order: 1; } form p { line-height: 32px; padding-left: 10px; } form label, form button { background-color: #7f9ccb; padding: 5px 10px; border-radius: 5px; border: 1px ridge black; font-size: 0.8rem; height: auto; } form label:hover, form button:hover { background-color: #2d5ba3; color: white; } form labe...
...ctive { background-color: #0d3f8f; color: white; } this is similar to what we've seen before — nothing special to comment on. next, let's walk through the javascript. in the first lines of script, we get references to the form input itself, and the <div> element with the class of .preview. ...
...javascript. in the first lines of script, we get references to the form input itself, and the <div> element with the class of .preview. next, we hide the <input> element — we do this because file inputs tend to be ugly, difficult to style, and inconsistent in their design across browsers. you can activate the input element by clicking its <label>, so it is better to visually hide the input and style the label like a button, so the user will know to interact with it if they want to upload files. ...
...And 2 more matches
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
Web › HTML › Element › input
t match elements that can't be required. :blank <input> and <textarea> elements that currently have no value. :user-invalid similar to :invalid, but is activated on blur. matches invalid input but only after the user interaction, such as by focusing on the control, leaving the control, or attempting to submit the form containing the invalid control. examples we can style a checkbox label based on whether the checkbox is checked or not. in this example, we are styling the color and font-weight of the <label> that comes immediately after a checked input. we haven't applied any styles if the input is not checked. <input id="checkboxinput" type="checkbox"> <label for="checkboxinput">toggle the checkbox on and off</label> input:checked + label { color: red; fo...
...hes a password input */ input[type="password"] {} /* matches a form control whose valid values are limited to a range of values*/ input[min][max] {} /* matches a form control with with a pattern attribute */ input[pattern] {} ::placeholder by default, the appearance of placeholder text is a translucent or light gray. the ::placeholder pseudo-element is the input's placeholder text. ...
... you could make a <div> look like a radio button with div {appearance: radio;} or a radio look like a checkbox with [type="checkbox] {appearance: checkbox;}, but don't. ...
...And 2 more matches
<u>: The Unarticulated Annotation (Underline) element - HTML: Hypertext Markup Language
Web › HTML › Element › u
tion element (<u>) represents a span of inline text which should be rendered in a way that indicates that it has a non-textual annotation. this is rendered by default as a simple solid underline, but may be altered using css. this element used to be called the "underline" element in older versions of html, and is still sometimes misused in this way. to underline text, you should instead apply a style that includes the css text-decoration property set to underline. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. see the usage notes section for further details on when it's appropriate to use <u> and when it isn't. ...
... (as opposed to the non-textual annotations created with <u>), use the <ruby> element. to apply an underlined appearance without any semantic meaning, use the text-decoration property's value underline. ...
... result the result should be familiar to anyone who has used any of the more popular word processors available today. ...
...And 2 more matches
Content-Security-Policy-Report-Only - HTTP
t-uri the uri of the document in which the violation occurred. effective-directive the directive whose enforcement caused the violation. original-policy the original policy as specified by the content-security-policy-report-only http header. referrer the referrer of the document in which the violation occurred. script-sample the first 40 characters of the inline script, event handler, or style that caused the violation. status-code the http status code of the resource on which the global object was instantiated. violated-directive the name of the policy section that was violated. sample violation report let's consider a page located at http://example.com/signup.html. it uses the following policy, disallowing everything but stylesheets from cdn.example.com. content-security-pol...
...ode the http status code of the resource on which the global object was instantiated. violated-directive the name of the policy section that was violated. sample violation report let's consider a page located at http://example.com/signup.html. it uses the following policy, disallowing everything but stylesheets from cdn.example.com. ...
...ation report let's consider a page located at http://example.com/signup.html. it uses the following policy, disallowing everything but stylesheets from cdn.example.com. content-security-policy-report-only: default-src 'none'; style-src cdn.example.com; report-uri /_/csp-reports the html of signup.html looks like this: <!doctype html> <html> <head> <title>sign up</title> <link rel="stylesheet" href="css/style.css"> </head> <body> ... content ... </body> </html> can you spot the violation? stylesheets are only allowed to be loaded from cdn.example.com, yet the website tries to load one from its own origin (http://example.com). a browser capable of enforcing csp will send the following violation report as a post request to http://example.com/_/csp-reports, when the docum...
...And 2 more matches
CSS and JavaScript animation performance - Web Performance
imations or javascript-based animations (using requestanimationframe()). in this article, we analyse the performance differences between css- and javascript-based animation. css transitions and animations both css transitions and animations can be used to write animation. they each have their own user scenarios: css transitions provide an easy way to make animations occur between the current style and an end css state, e.g., a resting button state and a hover state. even if an element is in the middle of a transition, the new transition starts from the current style immediately instead of jumping to the end css state. see using css transitions for more details. css animations, on the other hand, allow developers to make animations between a set of starting property values and a final set ...
...see using css animations for more details. ...
...see using css animations for more details. ...
...And 2 more matches
The building blocks of responsive design - Progressive web apps (PWAs)
ted from the content width, not added to it. very useful! read more about this at * { box-sizing: border-box } ftw, by paul irish. flexible replaced elements things are working fairly well now, but there are still some issues just waiting to present themselves. for a start, let's have a look at what happens when we include the <video> and <img> elements inside our first two columns, naked and unstyled. because the size of replaced elements is dictated by the size of the media inserted into them, and the media is a fixed size, they explode out of their containing elements and make a mess of the layout. this is pretty horrible, but generally this kind of problem is easily fixed with some simple css: img, video { max-width: 100%; } this tells the replaced elements to remain constrained in...
...ectify the layout problem, and this can be done using media queries. note: media queries are a css3 feature that allow you to selectively apply css depending on the results of media feature tests — for more on the basics, read media queries. typical desktop layout in our example, we have a desktop layout, as we've already seen. this is created using the css rules included at the top of the stylesheet, before any media queries are encountered. mid-width layout we also have a mid-width layout, which is aimed at working well on tablets and narrow laptop screens. this is created by all of the css inside the first media query: @media all and (max-width: 1024px) { x-card:nth-child(1), x-card:nth-child(2) { width: 50%; } x-card:nth-child(3) { width: 100%; clear: left; ...
... next up, the font-size of the buttons is set to 6.8vw. why? because the top-margin of the x-cards was set to 17vw earlier on. all buttons in the app have been set to...
...And 2 more matches
SVG Styling Attributes - SVG: Scalable Vector Graphics
Web › SVG › Attribute › Styling
the svg styling attributes are all the attributes that can be specified on any svg element to apply css styling effects. class style attributes class assigns a class name or set of class names to an element. it functions identically to the class attribute in html. ...
... the svg styling attributes are all the attributes that can be specified on any svg element to apply css styling effects. class style attributes class assigns a class name or set of class names to an element. it functions identically to the class attribute in html. ...
... the svg styling attributes are all the attributes that can be specified on any svg element to apply css styling effects. class style attributes class assigns a class name or set of class names to an element. it functions identically to the class attribute in html. ...
...And 2 more matches
SVG Attribute reference - SVG: Scalable Vector Graphics
Web › SVG › Attribute
ve alignment-baseline allowreorder alphabetic amplitude arabic-form ascent attributename attributetype autoreverse azimuth b basefrequency baseline-shift baseprofile bbox begin bias by c calcmode cap-height class clip clippathunits clip-path clip-rule color color-interpolation color-interpolation-filters color-profile color-rendering contentscripttype contentstyletype cursor cx cy d d decelerate descent diffuseconstant direction display divisor dominant-baseline dur dx dy e edgemode elevation enable-background end exponent externalresourcesrequired f fill fill-opacity fill-rule filter filterres filterunits flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant fon...
...t result rotate rx ry s scale seed shape-rendering slope spacing specularconstant specularexponent speed spreadmethod startoffset stddeviation stemh stemv stitchtiles stop-color stop-opacity strikethrough-position strikethrough-thickness string stroke stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width style surfacescale systemlanguage t tabindex tablevalues target targetx targety text-anchor text-decoration text-rendering textlength to transform transform-origin type u u1 u2 underline-position underline-thickness unicode unicode-bidi unicode-range units-per-em v v-alphabetic v-hanging v-ideographic v-mathematical values vector-effect version vert-adv-y ver...
... xlink attributes xlink:href, xlink:type, xlink:role, xlink:arcrole, xlink:title, xlink:show, xlink:actuate presentation attributes note that all svg presentation attributes can be used as css properties. alignment-baseline, baseline-shift, clip, clip-p...
...And 2 more matches
SVG and CSS - SVG: Scalable Vector Graphics
example make a new svg document as a plain text file, doc8.svg. ...
... example make a new svg document as a plain text file, doc8.svg. ...
...copy and paste the content from here, making sure that you scroll to get all of it: /*** svg demonstration ***/ /* page */ svg { background-color: beige; } #heading { font-size: 24px; font-weight: bold; } #caption { font-size: 12px; } /* flower */ #flower:hover { cursor: crosshair; } /* gradient */ #fade-stop-1 { stop-color: blue; } #fade-stop-2 { stop-color: white; } ...
...And 2 more matches
XML introduction - XML: Extensible Markup Language
y again."> ]> <body> <message> &warning; </message> </body> you can also use numeric character references to specify special characters; for example, &#xa9; is the "©" symbol. displaying xml xml is usually used for descriptive purposes, but there are ways to display xml data. if you don't define a specific way for the xml to be rendered, the raw xml is displayed in the browser. ...
...so use numeric character references to specify special characters; for example, &#xa9; is the "©" symbol. displaying xml xml is usually used for descriptive purposes, but there are ways to display xml data. if you don't define a specific way for the xml to be rendered, the raw xml is displayed in the browser. one way to style xml output is to specify css to apply to the document using the xml-stylesheet processing instruction. ...
...cify special characters; for example, &#xa9; is the "©" symbol. displaying xml xml is usually used for descriptive purposes, but there are ways to display xml data. if you don't define a specific way for the xml to be rendered, the raw xml is displayed in the browser. one way to style xml output is to specify css to apply to the document using the xml-stylesheet processing instruction. ...
...And 2 more matches
dev/panel - Archive of obsolete content
however, it can receive messages from the add-on that created it, and the add-on can pass it the debuggee so it can communicate with the deb...
...clients connect to the server and send it messages to examine and modify the state of the program being debugged. the remote debugging protocol page describes the protocol in detail. when the user opens a panel and the panel is created, the framework calls the panel's setup method. the setup method will be pas...
...h gives you a javascript api to the remote debugging protocol. note that at the moment volcan.js does not support the complete remote debugging protocol. we're still working on documenting exactly which messages are supported by volcan.js. ...
...which is fulfilled with an object representing the root actor: volcan.connect(debuggee).then(gotroot); function gotroot(root) { // can use root actor here } actors actors in the remote debugging protocol are volcan.js objects. the messages actors can accept are methods of those objects. the message type becomes the method name. for example, the root actor object has a method listtabs and the stylesheet actor object has a method getstylesheets. any additional parameters sent in the message become arguments to the method. if a message is expected to get a reply, then the method returns a promise which is fulfilled with the reply. if the message reply in the remote debugging protocol would contain an actor id, then in volcan.js the object that fulfills the promise contains that actor instanc...
The Essentials of an Extension - Archive of obsolete content
nge namespace declarations when you mix different types of content in the same document, such as xul with html or svg. you may have noticed the naming we use on several places, such as the id xulschoolhello-browser-overlay. this is the namespacing standard that we use to avoid conflicts with firefox and other extensions, as well as making some development tasks easier. we namespace all ids and style classes in overlay elements because they will be mixed with other elements in the main browser window. if we used generic ids like container or input, they will likely conflict with ids used within firefox, or with ids from other extension overlays. using namespaces minimizes compatibility problems with other extensions. we use camel casing for file names, and all lower case with dashes for eleme...
...rlay elements because they will be mixed with other elements in the main browser window. if we used generic ids like container or input, they will likely conflict with ids used within firefox, or with ids from other extension overlays. using namespaces minimizes compatibility problems with other extensions. we use camel casing for file names, and all lower case with dashes for element ids and css style class names, but you're free to use your own system. <script type="application/x-javascript" src="chrome://xulschoolhello/content/browseroverlay.js" /> just like in html, this includes a javascript script file. you can have as many script elements in a xul document as you need. we'll look into its code later. you also probably noticed how we format our code, and wonder about the rule...
... this particular syntax, initializing an object as {} is the equivalent of initializing it to new object(). /** * controls the browser overlay for the hello world extension. */ xulschoolchrome.browseroverlay = { finally, browseroverlay is our object. naming and referencing objects in such a long and verbose manner can feel uncomfortable at first, but it's worth the cost. we use javadoc style comments on all namespaces, objects and object members. this is a similar standard to the one used in mozilla code, and some tools can generate documentation automatically from javadoc. sayhello : function(aevent) { let stringbundle = document.getelementbyid("xulschoolhello-string-bundle"); let message = stringbundle.getstring("xulschoolhello.greeting.label"); window.alert(message); }...
...f plural forms that are also language-dependent. skin styling xul is very similar to styling html. we'll look into some of the differences when we cover the xul box model, and other more advanced topics. there isn't much styling you can do to a minimal menu and a very simple alert message, so the hello world extension only includes an empty css file and the compulsory global skin file: <?xml-stylesheet type="text/css" href="chrome://global/skin/" ?> <?xml-stylesheet type="text/css" href="chrome://xulschoolhello/skin/browseroverlay.css" ?> the global skin css file holds the default styles for all xul elements and windows. forgetting to include this file in a xul window usually leads to interesting and often unwanted results. in our case we don't really need to include it, since we're...
Index of archived content - Archive of obsolete content
functional lang/type loader/cuddlefish loader/sandbox net/url net/xhr places/bookmarks places/favicon places/history platform/xpcom preferences/event-target preferences/service remote/child remote/parent stylesheet/style stylesheet/utils system/child_process system/environment system/events system/runtime system/unload system/xul-app tabs/utils test/assert test/harness test/httpd test/runner test/utils ui/butt...
...ension development environment signing an xpi signing an extension supporting search suggestions in search plugins tabbed browser techniques promises updating addons broken by private browsing changes using dependent libraries in extension components using the stylesheet service bookmarks.export() bookmarks.import() adding preferences to an extension an interview with douglas bowman of wired news archived mozilla and build documentation activex control for hosting netscape plug-ins in ie archived spidermonkey docs ...
... in a java application using javaxpcom error console exception logging in javascript existing content extension frequently asked questions external cvs snapshots in mozilla-central fast graphics performance with html firefox block and line layout cheat sheet content states and the style system disabling interruptible reflow document loading - from load start to finding a handler documentation for bidi mozilla downloading nightly or trunk builds jss build instructions for osx 10.6 layout faq layout system overview multiple firefox profiles repackaging firefox st...
...ds in your web pages developing cross-browser and cross-platform pages references summary of changes using the w3c dom using workers in extensions web standards choosing standards compliance over proprietary practices community correctly using titles with external stylesheets describing microformats in javascript displaying a graphic with audio samples fixing incorrectly sized list item markers fixing table inheritance in quirks mode issues arising from arbitrary-element hover mozilla's doctype sniffing parsing microformats in javascript popup window controls rdf in fifty w...
Fast Graphics Performance With HTML - Archive of obsolete content
make content that has scrolling content underneath it opaque e.g. use <div><div style="background:white; position:fixed">simple</div>lots of text...</div> instead of <div><div style="position:fixed">simple</div>lots of text...</div> make the content of scrollable sub frames opaque e.g. ...
... make content that has scrolling content underneath it opaque e.g. use <div><div style="background:white; position:fixed">simple</div>lots of text...</div> instead of <div><div style="position:fixed">simple</div>lots of text...</div> make the content of scrollable sub frames opaque e.g. ...
... make content that has scrolling content underneath it opaque e.g. use <div><div style="background:white; position:fixed">simple</div>lots of text...</div> instead of <div><div style="position:fixed">simple</div>lots of text...</div> make the content of scrollable sub frames opaque e.g. ...
... use <div><div style="background:white; position:fixed">simple</div>lots of text...</div> instead of <div><div style="position:fixed">simple</div>lots of text...</div> make the content of scrollable sub frames opaque e.g. ...
Block and Line Layout Cheat Sheet - Archive of obsolete content
a block consists of lines and other blocks, stacked vertically. a block frame has one nslinebox for each line, and one nslinebox for each block child. these are stored as a doubly-linked list in the mlines member of nsblockframe. nsinlineframe mflags ns_inline_frame_contains_percent_aware_child this flag is set if the inline frame has any children that have a percentage value set (via the style context) for the width or height of the content area, padding, border, or margin. nshtmlreflowstate the current state of reflow, built up as reflow recursively descends the frame tree. this is "passed in" to a child frame from its parent, and provides the constraints in which the child frame must size itself; e.g. the width and height available to the child frame. mcomputedwidth mcomputedh...
...a child frame from its parent, and provides the constraints in which the child frame must size itself; e.g. the width and height available to the child frame. mcomputedwidth mcomputedheight mcomputedmargin mcomputedborderpadding mcomputedpadding mcomputedoffsets mcomputedminwidth mcomputedmaxwidth mcomputedminheight mcomputedmaxheight given the current container frame and the style applied to the child, these values are the resolved values for the child frame's box. nshtmlreflowmetrics the structure that is "filled in" by a frame during reflow, and is used to communicate the frame's desired size information back to its container. mmaximumwidth the maximum width that the frame would consume if it were reflowed with an unconstrained available width. it might be better n...
... need to force a resize reflow when computing the final size. e.g., because...why? brs_isinlineincrreflow this flag is set in nsblockframe::reflow() if we detect that we're incrementally reflowing a linebox that contains inline frames. in this case, we can avoid some of the work that occurs during reflow. brs_nowrap this flag is set in the nsblockreflowstate constructor when the "white-space" style of the block frame is pre or nowrap. it is cleared, otherwise. brs_istopmarginroot this flag is set in the nsblockreflowstate constructor when reflowing a "block margin root" frame (i.e., a frame with the ns_block_margin_root flag set, for which margins apply by default). the flag is also set when reflowing a frame whose computed top border padding is zero. (why?) brs_isbottommarginroot this ...
...incremental reflow, this member holds current frame in the reflow chain. nslinelayout encapsulates the transient reflow state for a nslinebox that contains inline frames. a new nslinelayout object is created for each inline linebox that is flowed. mflags ll_endsinwhitespace set to true by default when starting line layout. ...
Table Layout Regression Tests - Archive of obsolete content
seful, the testing information is much less relevant now than it has been, as the "rtest" testing framework described here has been superseded by the reftest framework. it is unclear whether or how well rtest continues to work and whether it is still used or not. subject overview changes in layout, parser and content code can have unintended side effects, also known as regressions. it is good style to check for these unwanted regressions and fixing them before checkin rather than causing bugzilla avalanches. prerequisites in order to run these tests, you will need to have: make sure that your build is a debug build (in short you need ac_add_options --enable-debug in your .mozconfig file). to build the layoutdebugger itself, build either all extensions or include layoutdebug in your .m...
...s in rtest.lst (see: nsregressiontester::dumpframemodel). their name is generated by replacing the old extension .html or .xml with .rgd. for appendcells1.html a file appendcells1.rgd will be created in the baseline or verify subdirectory. ...
...textreset data="0 10[0xa]enum " /> <display data="0 1 0 0 0 0 0 0 0 0 0 0 " /> <visibility data="0 1 1.000000" /> <table data="0 0 4 -1 1 " /> <tableborder data="1 null null 0 2 " /> <content data="0 0 0 null " /> <quotes data="0 " /> <ui data="3 0 0 1 " /> <uireset data="7 0 4" /> <xul data="0 0 0 0 0 1 <svg data="0 1.000000 1.000000 0 1.000000" /> </stylecontext> the baseline log will look like: type manifest file: e:\moz_src\mozilla\obj-i586-pc-msvc\dist\bin\components\xpti.dat +++ javascript debugging hooks installed. ++webshell == 1 ++domwindow == 1 ++webshell == 2 ++domwindow == 2 note: styleverifytree is disabled note: frameverifytree is disabled note: verifyreflow is disabled ++webshell == 3 ++domwindow == 3 running baseline test for e:\mo...
...y subdirectories (verify) and compares each frame dump with the corresponding reference frame dump. if they differ in critical points the test fails. a typical part of the verify log would look like: type manifest file: e:\moz_src\mozilla\obj-i586-pc-msvc\dist\bin\components\xpti.dat +++ javascript debugging hooks installed. ++webshell == 1 ++domwindow == 1 ++webshell == 2 ++domwindow == 2 note: styleverifytree is disabled note: frameverifytree is disabled note: verifyreflow is disabled ++webshell == 3 ++domwindow == 3 running verify test for e:\moz_src\mozilla\layout\html\tests\block\rtest.lst. writing regression data to e:\moz_src\mozilla\layout\html\tests\table\core\verify\standards1.rgd comparing to regression data from e:\moz_src\mozilla\layout\html\tests\table\core\baseline\standards1.rg...
XBL 1.0 Reference - Archive of obsolete content
scribes extensible binding language (xbl) 1.0 as implemented in gecko browsers. extensible binding language is a xml-based markup language to implement reusable components (bindings) that can be bound to elements in other documents. the element with a binding specified, called the bound element, acquires the new behavior specified by the binding. bindings can be bound to elements using cascading style sheets (css) or dom. one element can be bound to several bindings at once. functionally bindings should be correlated with behaviors and viewlink but being implemented as one integrated xml solution. bindings can contain event handlers that are registered on the bound element, an implementation of new methods and properties that become accessible from the bound element, and anonymous content th...
...e reflected yet in this document. the documentation process is still in progress: please keep it in your mind while using the provided information. xbl elements xbl 1.0 elements are in the http://www.mozilla.org/xbl namespace. ...
... mind while using the provided information. xbl elements xbl 1.0 elements are in the http://www.mozilla.org/xbl namespace. ...
... this example is targeted to demonstrate the xbl usage rather than to be a practically useful application. for this reason it contains many comments and some blocks could be avoided in a mo...
Complete - Archive of obsolete content
s component in each of the themes that it supports. these themes are: classic for firefox etc. classic for seamonkey modern for seamonkey to make it easier to support different themes, developers place anything that might depend on the theme in separate files in a separate directory. in this extension, the only things that depend on the theme are the icon images on the buttons and the css style rules. for more information about themes, see the main themes page here. how a button gets themed when you look at button 1 in seamonkey, you see an image or style that depends on your theme. this is how it happens: this extension does not support modern in firefox etc., but you can see the registration details for classic in chrome.manifest. for example, if you are using modern, it loads: skin/m...
...classic in chrome.manifest. for example, if you are using modern, it loads: skin/modern/allcustom/seamonkey/allcustom.css from inside the jar. when you restart after installing the extension, the skins classic and modern are both registered for the component allcustom. you can see the registration details in installed-chrome.txt and chrome.rdf. ...
...you are using modern, it loads: skin/modern/allcustom/seamonkey/allcustom.css from inside the jar. when you restart after installing the extension, the skins classic and modern are both registered for the component allcustom. you can see the registration details in installed-chrome.txt and chrome.rdf. when the xul file, allcustom.xul is loaded, the stylesheet declaration near the top loads a stylesheet from chrome://allcustom/skin/. the application's chrome registry converts this to the correct css file for the theme you are using. the xul toolbarbutton tag has an id all-custom-1. the css stylesheet uses the corresponding selector #all-custom-1 to provide the appropriate image: button-1.png file structure in the new file structure, there is a skin directory for all the themes. each them...
...tton-1.png file structure in the new file structure, there is a skin directory for all the themes. each theme has its own directory there. in each theme's directory, there is an allcustom directory. this is useful when files from various components and extensions and all unpacked in the same place—it keeps each set of files separate. the allcustom directory contains the icon images and the css stylesheet. the file contents.rdf contains registration data used by seamonkey. testing a theme to test a theme in seamonkey, choose view – apply theme, then choose the theme. restart seamonkey. application differences some differences between firefox etc. and seamonkey cause complications for this extension. to resolve the differences, the extension uses firefox etc. and seamonkey's different regist...
Adding Buttons - Archive of obsolete content
tag has the following syntax: <button id="identifier" class="dialog" label="ok" image="images/image.jpg" disabled="true" accesskey="t"/> the attributes are as follows, all of which are optional: id a unique identifier so that you can identify the button with. you'll see this attribute on all elements. you'll want to use this if you want to refer to the button in a style sheet or script. however, you should add this attribute to almost all elements. it isn't always placed on elements in this tutorial for simplicity. class the style class of the button. this works the same as in html. it is used to indicate the style that the button appears in. in this case the value dialog is used. in most cases, you will not use a class for a button. label the label that w...
... disabled if this attribute is set to true, the button is disabled. this is usually drawn with the text in grey. if the button is disabled, the function of the button cannot be performed. if this attribute is left out entirely, the button is enabled. you can switch the disabled state of the button using javascript. ...
...he button appears in. in this case the value dialog is used. in most cases, you will not use a class for a button. label the label that will appear on the button. for example, ok or cancel. if this is left out, no text appears. image the url of the image to appear on the button. if this is attribute is left out, no image appears. you can also specify the image in a stylesheet using the list-style-image property. disabled if this attribute is set to true, the button is disabled. this is usually drawn with the text in grey. if the button is disabled, the function of the button cannot be performed. if this attribute is left out entirely, the button is enabled. you can switch the disabled state of the button using javascript. accesskey this should be set to a letter that is used as a sh...
...rmal browser windows. due to this, the buttons will appear to stretch across the window. you can add align="start" to the window tag to prevent the stretching. the findfile.xul example let's add this code to the file findfile.xul that we created in the previous section. the code needs to be inserted in-between the window tags. the code to add is shown in red below: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="findfile-window" title="find files" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <button id="find-button" label="find"/> <button id="cancel-button" label="cancel"/> </window> you'll notice that the cancel button was added also. the window has been given a...
Creating a Window - Archive of obsolete content
« previousnext » we're going to be creating a simple find files utility throughout this tutorial. first, however, we should look at the basic syntax of a xul file. creating a xul file an xul file can be given any name but it really should have a .xul extension. the simplest xul file has the following structure: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="findfile-window" title="find files" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <!-- other elements go here --> </window> this window will not do anything since it doesn't contain any ui elements. those will be added in the next section. in fact, there will not be shown any window at all. if you want to f...
...be added in the next section. in fact, there will not be shown any window at all. if you want to force the window to become visible you can add the width and height attribute to the window tag. here is a line by line breakdown of the code above: <?xml version="1.0"?> this line simply declares that this is an xml file. you would normally add this line as is at the top of each xul file. <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> this line is used to specify the style sheets to use for the file. this is the syntax that xml files use to import style sheets. in this case, we import the styles found in the global part of a skin package. we didn't specify a specific file so mozilla will determine which files in the directory to use. in this case, the all-important global.c...
...ic file so mozilla will determine which files in the directory to use. in this case, the all-important global.css file is selected. this file contains all the default declarations for all of the xul elements. because xml does not have any knowledge of how elements should be displayed, the file indicates how. generally, you will put this line at the top of every xul file. you can also import other style sheets using a similar syntax. note that you would normally import the global style sheet from within your own style sheet file. <window this line declares that you are describing a window. each user interface window is described in a separate file. this tag is much like the html tag which surrounds an entire html document, except that a user interface window is described instead of a document...
...top-level window without any browser chrome, such as the address field or menu. only chrome urls have additional privileges. the extension developer's extension contains an xul editor that allows you to type in xul code and see the results in real-time from within mozilla! troubleshooting if the xul window fails to show up on the desktop but has an icon on the desktop tool bar, check the xml-stylesheet declaration. make sure that you have included the stylesheet correctly: <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> in the next section, we will add some buttons to the window. « previousnext » ...
Localization - Archive of obsolete content
"> the example above uses two entities, one for the label on the undo menu item and the second for the access key. changing the find files example let's take a look at how we would put all of this together by modifying the find files dialog so that it uses a dtd file for all of its text strings. the entire xul file is shown below with the changes shown in red. ...
...he undo menu item and the second for the access key. changing the find files example let's take a look at how we would put all of this together by modifying the find files dialog so that it uses a dtd file for all of its text strings. the entire xul file is shown below with the changes shown in red. ...
...p> <menuitem label="rdf:http://www.xulplanet.com/rdf/recent#label" uri="rdf:*"/> </menupopup> </template> </menulist> </groupbox> </tabpanel> <tabpanel id="optionspanel" orient="vertical"> <checkbox id="casecheck" label="&casesensitive;"/> <checkbox id="wordscheck" label="&matchfilename;"/> </tabpanel> </tabpanels> </tabbox> <tree id="results" style="display: none;" flex="1"> <treecols> <treecol id="name" label="&results.filename;" flex="1"/> <treecol id="location" label="&results.location;" flex="2"/> <treecol id="size" label="&results.size;" flex="1"/> </treecols> <treechildren> <treeitem> <treerow> <treecell label="mozilla"/> <treecell label="/usr/local"/> <treecell label="&b...
...esults.location;" flex="2"/> <treecol id="size" label="&results.size;" flex="1"/> </treecols> <treechildren> <treeitem> <treerow> <treecell label="mozilla"/> <treecell label="/usr/local"/> <treecell label="&bytes.before;2520&bytes.after;"/> </treerow> </treeitem> </treechildren> </tree> <splitter id="splitbar" resizeafter="grow" style="display: none;"/> <spacer class="titlespace"/> <hbox> <progressmeter id="progmeter" value="50%" style="display: none;"/> <spacer flex="1"/> <button id="find-button" label="&button.find;" oncommand="dofind()"/> <button id="cancel-button" label="&button.cancel;" oncommand="window.close();"/> </hbox> </vbox> </window> each text string has been replaced by a...
More Button Features - Archive of obsolete content
then the image is displayed on the button. the button below will have both a label and the image 'happy.png'. the image will appear to the left of the label. you can change this position by using two other attributes. this will be explained in a moment. ...
...ge is displayed on the button. the button below will have both a label and the image 'happy.png'. the image will appear to the left of the label. you can change this position by using two other attributes. this will be explained in a moment. ...
...le 1 : source view <button label="help" image="happy.png"/> button with css image another way to specify the image is by using the css list-style-image style property on the button. this is designed to allow the 'skin' (in this case, the appearance of the image) to be changed without changing the xul file. an example is shown below. example 2 : source view <button id="find-button" label="find" style="list-style-image: url('happy.png')"/> in this case, the image 'happy.png' is displayed on the button. the style attribute functions similar to its html counterpart. in general, it can be used on all xul elements. note that you really should put the style declarations in a separate style sheet. positioning the images by default, the image on a button will appear to the left of the text label. th...
...with extra content buttons may have arbitrary markup contained inside them, and it will be rendered inside the button. you probably wouldn't use this very often, but you might use it when creating custom elements. for example, the following will create a button where two of the words are red: example 4 : source view <button> <description value="this is a"/> <description value="rather strange" style="color: red;"/> <description value="button"/> </button> any xul element may be placed inside the button. html elements will be ignored, so you need to wrap them inside a description element. if you specify the label attribute on the button, it will override any content placed inside the button. button with menupopup you can place a menupopup inside the button to cause a menu to drop down when ...
description - Archive of obsolete content
| properties | methods | related ] this element is used to create a block of text. the text can be set either with the value attribute or by placing text inside the open and close description tags. the value attribute is used to set text that appears in a single line. if text appears as a child of the description, it will wrap to multiple lines. ...
...e description tags. the value attribute is used to set text that appears in a single line. if text appears as a child of the description, it will wrap to multiple lines. it may contain arbitrary markup, which can be styled as needed. more information is available in the xul tutorial. attributes crop, disabled, tabindex value properties accessibletype, crop, disabled, tabindex, value style classes header, indent, monospace, plain, small-margin examples this is a long section of text that will word wrap when displayed <description> this is a long section of text that will word wrap when displayed. </description> this is a long section of text that will not word wrap <description value="this is a long section of text that will not word wrap"> </description> this is a long se...
...ng section of text that will word wrap when displayed <description> this is a long section of text that will word wrap when displayed. </description> this is a long section of text that will not word wrap <description value="this is a long section of text that will not word wrap"> </description> this is a long section of dynamically controlled text that will word wrap <description id="desc" style="width: 300px"></description> document.getelementbyid('desc').textcontent = "this is a long section of dynamic message text that will word wrap"; attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cr...
...typically, this will cause the text to appear bold. indent this class causes the text to be indented on its left side. monospace this class causes the text to be displayed in a monospace font. plain this class causes the element to be displayed with no border or margin. small-margin this class causes the text to be displayed with a sma...
image - Archive of obsolete content
Archive › Mozilla › XUL › image
rmation is available in the xul tutorial. note: prior to gecko 8.0, images did not shrink down with the same ratio in both directions when specifying maximum sizes using maxheight or maxwidth. the new behavior aligns more with the html <img> element and shrinks both the width and height down proportionally. attributes onerror, onload, src, validate properties accessibletype, src style classes alert-icon, error-icon, message-icon, question-icon examples <image src='firefoxlogo.png' width='135' height='130'/> attributes onerror type: script code this event is sent to an image element when an error occurs loading the image. image.onload type: script code this event handler will be called on the image element when the image has finished loading. this appl...
...mples <image src='firefoxlogo.png' width='135' height='130'/> attributes onerror type: script code this event is sent to an image element when an error occurs loading the image. image.onload type: script code this event handler will be called on the image element when the image has finished loading. this applies whether the image is applied via the src attribute or the list-style-image style property. if you change the image, the event will fire again when the new image loads. this event will not bubble up the element tree. src type: uri the uri of the content to appear in the element. validate type: one of the values below this attribute indicates whether to load the image from the cache or not. this would be useful if the images are ...
...rl gets and sets the value of the src attribute. ...
...this typically looks like an exclamation mark. this and the other icon classes may be used by image elements or other elements which can have an image. error-icon class that adds an error icon. this will typically be a red "x" icon. message-icon class that adds a message box icon. question-icon class that adds a questio...
scrollbox - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] a box that has additional functions that can be used to scroll the content. note that a scrollbox doesn't cause scrollbars to be displayed. it is intended to be used when an application wants to be able to adjust the scroll position itself. if you just want scrollbars to appear, add style='overflow: auto;'. this may also be used with any other container element. examples the following shows the xul for a bunch of labels. they come out in a box. if their container doesn't give enough room to hold them (geometrically) what happens depends on the enclosing elements; often the content is just clipped off on the bottom or right (depending on what's too big to fit). <vbox> <label value="01 four s...
...r to scroll around the big content in the small view space. for the most part, the horizontal and vertical scrollbars will independently handle too-tall and too-wide cases, but each scroll bar takes up additional width and so the appearance of one scroll bar can trigger the other one if it's close to the edge anyway. use overflow:scroll if you want the scroll bars on all the time. ...
...licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
<statusbarpanel> - Archive of obsolete content
an individual element of a statusbar. this is a special type of button which is drawn differently. unlike normal buttons, a statusbarpanel can only have a label or an image but not both. this element is often used with a short label or icon to indicate status, for instance whether the user is online or whether there are new messages. ...
... gets and sets the value of the label attribute. ...
... « xul reference home statusbarpanel-iconic use this class to have an image appear on the statusbarpanel. specify the image using the src attribute. the image will appear instead ...
...tnamespace(), isequalnode, issamenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata style classes the following classes may be used to style the element. these classes should be used instead of changing the style of the element directly since they will fit more naturally with the user's selected theme. « xul reference home statusbarpanel-iconic use this class to have an image appear on the statusbarpanel. specify the image using the src attribute. the image will appear instead of the label. statusbarpanel-iconic-text use this...
nsIContentPolicy - Archive of obsolete content
value description type_other 1 indicates content whose type is unknown, or is not interesting outside a limited use case. in general, you should try not to use this type unless none of the others is a fit. type_script 2 indicates an executable script (such as javascript). type_image 3 indicates an image (for example, <img> elements). type_stylesheet 4 indicates a stylesheet (for example, <style> elements). type_object 5 indicates a generic object (plugin-handled content typically falls under this category). type_document 6 indicates a dom document at the top-level (that is, directly within a browser tab). type_subdocument 7 indicates a document contained within another document (fo...
...st by a plugin. type_dtd 13 indicates a dtd loaded by an xml document. type_font 14 indicates a font loaded via @font-face rule. type_media 15 indicates a video or audio load. type_websocket 16 indicates a websocket load. type_csp_report 17 indicates a content security policy report. type_xslt 18 indicates a style sheet transformation. type_beacon 19 indicates a beacon post. type_fetch 20 indicates a load initiated by the globalfetch.fetch() method, which is available as a global in both window and worker contexts. type_imageset 21 indicates a request to load an <img> (with the srcset attribute or <picture>. type_web_manifest 22 indicates a reques...
... note: this rejection only applies to the current request on this server, not to future requests of the same type. accept 1 returned from shouldload() or shouldprocess() if the load or process request is not rejected. ...
...ading the requested resource. shouldload() can be called while the dom and layout of the document involved is in an inconsistent state. this means that implementers of this method must not do any of the following: modify the dom in any way (e.g., setting attributes is a no-no). query any dom properties that depend on layout (e.g., offset* properties). query any dom properties that depend on style (e.g., computed style). query any dom properties that depend on the current state of the dom outside the "context" node (e.g., lengths of node lists). [javascript implementations only] access properties of any sort on any object without using xpcnativewrapper (either explicitly or implicitly). due to various dom0 things, this leads to item 4. if you do any of these things in your shouldload()...
::-ms-clear - Archive of obsolete content
ties only the following css properties can be used in a rule with ::-ms-clear in its selector. other properties are ignored. ...
...le with ::-ms-clear in its selector. other properties are ignored. ...
...gnored. ...
...n background-position-x background-position-y background-repeat background-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width syntax ::-ms-clear exam...
::-ms-expand - Archive of obsolete content
ies only the following css properties can be used in a rule with ::-ms-expand in its selector. other properties are ignored. ...
...e with ::-ms-expand in its selector. other properties are ignored. ...
...gnored. ...
...n background-position-x background-position-y background-repeat background-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width syntax ::-ms-clear spec...
::-ms-fill-lower - Archive of obsolete content
e possible representation of <input type="range">. allowable properties only the following css properties can be used in a rule with ::-ms-fill-lower in its selector. other properties are ignored. ...
...le properties only the following css properties can be used in a rule with ::-ms-fill-lower in its selector. other properties are ignored. ...
...d in a rule with ::-ms-fill-lower in its selector. other properties are ignored. ...
...ound-color background-image background-origin background-repeat background-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-...
::-ms-fill-upper - Archive of obsolete content
e possible representation of <input type="range">. allowable properties only the following css properties can be used in a rule with ::-ms-fill-upper in its selector. other properties are ignored. ...
...le properties only the following css properties can be used in a rule with ::-ms-fill-upper in its selector. other properties are ignored. ...
...d in a rule with ::-ms-fill-upper in its selector. other properties are ignored. ...
...ound-color background-image background-origin background-repeat background-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-...
::-ms-reveal - Archive of obsolete content
element is specific to internet explorer 10 and later. allowable properties only the following css properties can be used in a rule with ::-ms-reveal in its selector. other properties are ignored. ...
...owable properties only the following css properties can be used in a rule with ::-ms-reveal in its selector. other properties are ignored. ...
... used in a rule with ::-ms-reveal in its selector. other properties are ignored. ...
...ound-color background-image background-origin background-repeat background-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-...
::-ms-thumb - Archive of obsolete content
is one possible representation of <input type="range">. allowable properties only the following css properties can be used in a rule with ::-ms-thumb in its selector. other properties are ignored. ...
...lowable properties only the following css properties can be used in a rule with ::-ms-thumb in its selector. other properties are ignored. ...
...e used in a rule with ::-ms-thumb in its selector. other properties are ignored. ...
...ound-color background-image background-origin background-repeat background-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-...
::-ms-track - Archive of obsolete content
arks altogether, set the color property to transparent. allowable properties only the following css properties can be used in a rule with ::-ms-track in its selector. other properties are ignored. ...
...lowable properties only the following css properties can be used in a rule with ::-ms-track in its selector. other properties are ignored. ...
...e used in a rule with ::-ms-track in its selector. other properties are ignored. ...
...ound-color background-image background-origin background-repeat background-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-...
XForms Alert Element - Archive of obsolete content
the alert element can be bound to any simple content. representations can be represented in two ways: modeless window that contains the alert element's message (default representation). the alert element's message can also be displayed immediately after the containing form control element in the xforms document's layout. this representation is used if the alert element has an inline display style. ...
...on). the alert element's message can also be displayed immediately after the containing form control element in the xforms document's layout. this representation is used if the alert element has an inline display style. ...
...yout. this representation is used if the alert element has an inline display style. ...
...the alert element has an inline display style. ...
Extra lives - Game development
ibility is initially set to false. making our text styling dry as you probably noticed we're using the same styling for all three texts: scoretext, livestext and lifelosttext. if we ever want to change the font size or color we will have to do it in multiple places. ...
...tyling dry as you probably noticed we're using the same styling for all three texts: scoretext, livestext and lifelosttext. if we ever want to change the font size or color we will have to do it in multiple places. ...
... the lives handling...
...t textstyle and place it before the text definitions: textstyle = { font: '18px arial', fill: '#0095dd' }; we can now use this variable when stlying our text labels — update your code so that the multiple instances of the text styling are replaced with the variable: scoretext = game.add.text(5, 5, 'points: 0', textstyle); livestext = game.add.text(game.world.width-5, 5, 'lives: '+lives, textstyle); livestext.anchor.set(1,0); lifelosttext = game.add.text(game.world.width*0.5, game.world.height*0.5, 'life lost, click to continue', textstyle); lifelosttext.anchor.set(0.5); lifelosttext.visible = false; this way changing the font in one variable will apply the changes to every place it is used. the lives handling code to implement lives in our game, let's first change the ball's function ...
CSS - MDN Web Docs Glossary: Definitions of Web-related terms
a css rule is a set of properties associated with a selector. ...
... a css rule is a set of properties associated with a selector. ...
... a css rule is a set of properties associated with a selector. ...
... a css rule is a set of properties associated with a selector. ...
WAI-ARIA basics - Learn web development
precise, and can only be used when the screenreader is reading from the top of the page. as another example, apps started to feature complex controls like date pickers for choosing dates, sliders for choosing values, etc. html5 provides special input types to render such controls: <input type="date"> <input type="range"> these are not well-supported across browsers, and it is also difficult to style them, making them not very useful for integrating with website designs. as a result, developers quite often rely on javascript libraries that generate such controls as a series of nested <div>s or table elements with classnames, which are then styled using css and controlled using javascript. the problem here is that visually they work, but screenreaders can't make any sense of what they are at ...
...ated like a notable landmark, beyond the actual input being called out as a search input (<input type="search">). in addition, some older browsers (most notably ie8) don't recognise the semantics of the html5 elements. let's improve it by the use of some aria features. first, we'll add some role attributes to our html structure. ...
...positioning. ...
...glemusician(bool) { let instruitem = formitems[formitems.length-1]; if(bool) { instruitem.input.disabled = false; instruitem.label.style.color = '#000'; instruitem.input.setattribute('aria-disabled', 'false'); hiddenalert.textcontent = 'instruments played field now enabled; use it to tell us what you play.'; } else { instruitem.input.disabled = true; instruitem.label.style.color = '#999'; instruitem.input.setattribute('aria-disabled', 'true'); instruitem.input.removeattribute('aria-label'); hiddenalert.textcontent = 'instruments played field now disabled.'; } } describing non-semantic buttons as buttons a few times in this course already, we've mentioned the native accessibilty of (and the accessibility issues behind using other elements to fake) bu...
CSS selectors - Learn web development
in this article and its sub-articles we'll run through the different types in great detail, seeing how they work. ...
...in this article and its sub-articles we'll run through the different types in great detail, seeing how they work. ...
...ine. h1, .special { color: blue; } in the live example below try combining the two selectors which have identical declarations. the visual display should be the same after combining them. when you group selectors in this way, if any selector is invalid the whole rule will be ignored. in the following example, the invalid class selector rule will be ignored, whereas the h1 would still be styled. h1 { color: blue; } ..special { color: blue; } when combined however, neither the h1 nor the class will be styled as the entire rule is deemed invalid. h1, ..special { color: blue; } types of selectors there are a few different groupings of selectors, and knowing which type of selector you might need will help you to find the right tool for the job. in this article's subarticles w...
...the :hover pseudo-class for example selects an element only when it is being hovered over by the mouse pointer: a:hover { } it also includes pseudo-elements, which select a certain part of an element rather than the element itself. for example, ::first-line always selects the first line of text inside an element (a <p> in the below case), acting as if a <span> was ...
Legacy layout methods - Learn web development
<div class="row"> <div class="col span1">13</div> <div class="col span6">14</div> <div class="col span3">15</div> <div class="col span2">16</div> </div> </div> the aim is to turn this into a demonstration grid of two rows on a twelve column grid — the top row demonstrating the size of the individual columns, the second row some different sized areas on the grid. in the <style> element, add the following code, which gives the wrapper container a width of 980 pixels, with padding on the right hand side of 20 pixels. this leaves us with 960 pixels for our total column/gutter widths — in this case, the padding is subtracted from the total content width because we have set box-sizing to border-box on all elements on the site (see changing the box model completely for mor...
...on for creating a grid system. there are many flexbox-based grid systems available and flexbox can solve many of the issues that we’ve already discovered when creating our grid above. however, flexbox was never designed as a grid system and poses a new set of challenges when used as one. ...
...visit the skeleton website, and choose "download" to download the zip file. unzip this and copy the skeleton.css and normalize.css files into a new directory. make a copy of our html-skeleton.html file and save it in the same directory as the skeleton and normalize css. include the skeleton and normalize css in the html page, by adding the following to its head: <link href="normalize.css" rel="stylesheet"> <link href="skeleton.css" rel="stylesheet"> skeleton includes more than a grid system — it also contains css for typography and other page elements that you can use as a starting point. we’ll leave these at the defaults for now, however — it’s the grid we are really interested in here. note: normalize is a really useful little css library written by nicolas gallagher, which auto...
...ns">15</div> <div class="two columns">16</div> </div> try saving your html file and loading it in your browser to see the effect. note: if you are having trouble getting this example to work, try comparing it to our html-skeleton-finished.html file (see it running live also). if you look in the skeleton.css file you can see how this works. for example, skeleton has the following defined to style elements with “three columns” classes added to them. .three.columns { width: 22%; } all skeleton (or any other grid framework) is doing is setting up predefined classes that you can use by adding them to your markup. it’s exactly the same as if you did the work of calculating these percentages yourself. as you can see, we need to write very little css when using skeleton. it deals with a...
Using CSS generated content - Learn web development
this article describes some ways in which you can use css to add content when a document is displayed. you modify your stylesheet to add text content or images. one of the important advantages of css is that it helps you to separate a document's style from its content. however, there are situations where it makes sense to specify certain content as part of the stylesheet, not as part of the document. you can specify text or image content within a stylesheet when that content is closely linked to the document's structure. note: content specified in a stylesheet does not become part of the dom. specifying content in a stylesheet can cause complications. for example, you might have different language versions of your document that share a stylesheet. if you specify content in your ...
... this issue does not arise if the content you specify consists of symbols or images that apply in all languages and cultures. ...
... this issue does not arise if the content you specify consists of symbols or images that apply in all languages and cultures. ...
... css can insert text content before or after an element. to specify this, make a rule and add ::before or ::after to the selector. in the declaration, specify the content property with the text content as its value. html a text where i need to <span class="ref">something</span> css .ref::before { font-weight: bold; color: navy; content: "reference "; } output the character set of a stylesheet is utf-8 by default, but it can also be specified in the link, in the stylesheet itself, or in other ways. for details, see 4.4 css style sheet representation in the css specification. individual characters can also be specified by an escape mechanism that uses backslash as the escape character. for example, "\265b" is the chess symbol for a black queen ♛. for details, see referring to ch...
Images in HTML - Learn web development
pelling the image url. set the image's correct width and height (hint: it is 200px wide and 171px high), then experiment with other values to see what the effect is. set a title on the image. if you make a mistake, you can always reset it using the reset button. ...
... you make a mistake, you can always reset it using the reset button. ...
...turn it into a figure: wrap it in a <figure> element. copy the text out of the title attribute, remove the title attribute, and put the text inside a <figcaption> element below the image. if you make a mistake, you can always reset it using the reset button. ...
...ou make a mistake, you can always reset it using the reset button. ...
Graceful asynchronous programming with Promises - Learn web development
as long as the app doesn't assume that streaming has begun, it can just keep on running. note: you can learn more about this somewhat advanced topic, if you're interested, in the article signaling and video calling. code similar to this, but much more complete, is used in that example. the trouble with callbacks to fully understand why promises are a good thing, it helps to think back to old-style callbacks and to appreciate why they are problematic. let's talk about ordering pizza as an analogy. there are certain steps that you have to take for your order to be successful, which doesn't really make sense to try to execute out of order, or in order but before each previous step has quite finished: you choose what toppings you want. this can take a while if you are indecisive, and may f...
... can take a while if you are indecisive, and may fail if you just can't make up your mind, or decide to get a curry instead. you then place your order. this can take a while to return a pizza and may fail if the restaurant does not have the required ingredients to cook it. you then collect your pizza and eat. ...
...chronous nature is basically faked using settimeout(), although it does still show that promises are useful for creating a custom function with a sensible flow of operations, good error handling, etc. one example we'd like to invite you to study, which does show a useful async application of the promise() constructor, is jake archibald's idb library. this takes the indexeddb api, which is an old-style callback-based api for storing and retrieving data on the client-side, and allows you to use it with promises. in the code you'll see the same kind of techniques we discussed above being used there. the following block converts the basic request model used by many indexeddb methods to use promises (see this code, for example). conclusion promises are a good way to build asynchronous application...
...s the basic request model used by many indexeddb methods to use promises (see this code, for example). conclusion promises are a good way to build asynchronous applications when we don’t know the return value of a function or how long it will take to return. they make it easier to express and reason about sequences of asynchronous operations without deeply nested callbacks, and they support a style of error handling that is similar to the synchronous try...catch statement. promises work in the latest versions of all modern browsers; the only place where promise support will be a problem is in opera mini and ie11 and earlier versions. we didn't touch on all promise features in this article, just the most interesting and useful ones. as you start to learn more about promises, you'll come ac...
Arrays - Learn web development
his. we want you to change the line just below // number 5 so that the itemtext variable is made equal to "current item name — $current item price", for example "shoes — $23.99" in each case, so the correct information for each item is printed on the invoice. this is just simple string concatenation, which should be familiar to you. ...
...h item is printed on the invoice. this is just simple string concatenation, which should be familiar to you. ...
...ping it simple for now. to complete the app, we need you to: add a line below the // number 1 comment that adds the current value entered into the search input to the start of the array. this can be retrieved using searchinput.value. add a line below the // number 2 comment that removes the value currently at the end of the array. ...
...ber 2 comment that removes the value currently at the end of the array. ...
Getting started with Ember - Learn web development
imizing the trivial differences between applications — all while being a modern and light layer on top of native javascript. ember also has immense backwards and forwards compatibility to help businesses stay up to date with the latest versions of ember and latest community-driven conventions. what does it mean to be a component-service framework? components are individual bundles of behavior, style, and markup — much like what other frontend frameworks provide, such as react, vue, and angular. the service side provides long-lived shared state, behavior, and an interface to integrating with other libraries or systems. for example, the router (which will be mentioned later in this tutorial) is a service. components and services make up the majority of any emberjs application. use cases ge...
...ur brand new project. if you don't have one configured already, the ember atlas has some guides on how to set up various editors. installing the shared assets for todomvc projects installing shared assets, as we're about to do, isn't normally a required step for new projects, but it allows us to use existing shared css so we don't need to try to guess at what css is needed to create the todomvc styles. first, enter into your todomvc directory in the terminal, for example using cd todomvc in macos/linux. now run the following command to place the common todomvc css inside your app: npm install --save-dev todomvc-app-css todomvc-common next, find the ember-cli-build.js file inside the todomvc directory (it's right there inside the root) and open it in your chosen code edito...
...d the following lines underneath it before saving the file: app.import('node_modules/todomvc-common/base.css'); app.import('node_modules/todomvc-app-css/index.css'); for more information on what ember-cli-build.js does, and for other ways in which you can customize your build / pipeline, the ember guides have a page on addons and dependencies. finally, find app.css, located at app/styles/app.css, and paste in the following: :focus, .view label:focus, .todo-list li .toggle:focus + label, .toggle-all:focus + label { /* !important needed because todomvc styles deliberately disable the outline */ outline: #d86f95 solid !important; } this css overrides some of the styles provided by the todomvc-app-css npm package, therefore allowing keyboard focus to be visible. this goes...
...(1) | 12ms the development server launches at http://localhost:4200, which you can visit in your browser to check out what your work looks like so far. if everything is working correctly, you should see a page like this: note: on windows systems without windows subsystem for linux (wsl), you will experience slower build-times overall compared to macos, linux, and window...
Command line crash course - Learn web development
as with some other programming tools, using the terminal (or command line) on windows has traditionally not been as simple or easy as on other operating systems. but things are getting better. windows has traditionally had its own terminal-like program called cmd (“the command prompt”) for a long time, but this definitely doesn’t have parity with unix commands, and is equivalent to the old-style windows dos prompt. better programs exist for providing a terminal experience on windows, such as powershell (see here to find installers), and gitbash (which comes as part of the git for windows toolset) however, the best option for windows in the modern day is the windows subsystem for linux (wsl) — a compatibility layer for running linux operating systems directly from inside windows 10, ...
...ok more at local installs and why they're good in the next article. installing prettier for this article we will install prettier as a global command line utility. prettier is an opinionated code formatting tool for front end developers, focusing around javascript-based languages and adding support for html, css, scss, json and more. prettier can: save the cognitive overhead of getting the style consistent manually across all your code files; prettier can do this for you automatically. help newcomers to web development format their code in best-practice fashion. be installed on any operating system and even as a direct part of project tooling, ensuring that colleagues and friends who work on your code use the code style you’re using. be configured to run upon save, as you type, or e...
...code in a new file called index.js, inside your test directory: const myobj = { a:1,b:{c:2}} function printme(obj){console.log(obj.b.c)} printme(myobj) we can run prettier against a codebase to just check if our code wants adjusting. cd into your directory, and try running this command: prettier --check index.js you should get on output along the lines of checking formatting... ...
...{c:2}} function printme(obj){console.log(obj.b.c)} printme(myobj) we can run prettier against a codebase to just check if our code wants adjusting. cd into your directory, and try running this command: prettier --check index.js you should get on output along the lines of checking formatting... index.js code style issues found in the above file(s). forgot to run prettier? so there's some code styles that can be fixed. no problem. adding the --write option to the prettier command will fix those up, leaving us to focus on actually writing useful code. now try running this version of the command: prettier --write index.js you’ll get an output like this checking formatting... index.js code style issues fixed in the above file(s). but more importantly, if you look back at your javascript ...
Accessibility information for UI designers and developers
e who cannot see the difference between the colors, can use the labels instead. or in this one, you could consider using patterns besides colored areas: again, if people are unable to distinguish the colors, they can rely on the patterns instead. see also: understanding sc 1.4.3: contrast the focus indicator users who navigate by keyboard (or other specialised input methods), rely on focus styles to see where they are on the page. only one element has focus at a given time, typically revealed by browsers with a dotted outline. css lets authors change what the focus indicator look like, so you can design it to match branding. here's an example of someone tabbing through a footer, the focus moves around: note: don't remove the focus indicator, as without it, users that can't or don't ...
...focus indicator look like, so you can design it to match branding. here's an example of someone tabbing through a footer, the focus moves around: note: don't remove the focus indicator, as without it, users that can't or don't use a mouse cannot see where they are. it would be like removing the mouse indicator. see also: understanding sc 2.4.7: focus visible be ready for resizing and custom styles on the web, users can use tools in their browser to make font sizes larger, or even provide custom css to meet their specific needs. ensure your design is flexible enough to allow for this. text sizing users should be able to enlarge their text size up to 200 percent without breaking functionality. text spacing users should be able to make the following changes to their text spacing: set...
... forms in forms, provide labels for all controls. this includes form elements like inputs and select boxes, but also buttons. for form elements, it should be clear what kind of input is expected. placeholders are best avoided for this, as they are often too low in contrast. it is more helpful to describe what an input element is for in text just above ...
...racter, say ‘k’, to jump directly to options starting with ‘k’. it is recommended to use native controls, visibly or under the hood. links vs buttons to keep your interface in line with user expectations, use links for interactions that go somewhere (on the current page or another page) and buttons for interactions that do something (like submit a form or open an overlay). links can be styled as buttons and vice versa, but designers are advised to avoid this where possible. motion on pages with transitions and animations, note that some users could experience distraction, dizziness or nausea. pages with a parallax effect can particularly cause troubles. to help these users, you could offer a setting to turn off animations, or wrap the css in the prefers-reduce-motion media query. ...
Chrome-only CSS reference
Mozilla › Gecko › Chrome › CSS
-moz-window-draggingthe -moz-window-dragging css property specifies whether a window is draggable or not. ...
... -moz-window-draggingthe -moz-window-dragging css property specifies whether a window is draggable or not. ...
...ree-drop-feedbackactivated by the properties attribute.::-moz-tree-imageactivated by the properties attribute.::-moz-tree-indentationactivated by the properties attribute.::-moz-tree-lineactivated by the properties attribute.::-moz-tree-progressmeteractivated when the type attribute is set to progressmeter. ...
...ly styles to tree rows.::-moz-tree-row(hover)the ::-moz-tree-row(hover) css pseudo-class will match an element if the mouse cursor is presently hovering over a tree row.::-moz-tree-separatoractivated by the properties attribute.::-moz-tree-twistyactivated by the properties attribute.css -moz-bool-pref() @supports functionthe -moz-bool-pref() @supports condition is available to gecko chrome and ua stylesheets to check if a boolean preference is enabled.css <display-xul> component</display-xul>firefox supports the following -moz- prefixed xul display values:overflow-clip-boxthe overflow-clip-box css property specifies relative to which box the clipping happens when there is an overflow. it is short hand for the overflow-clip-box-inline and overflow-clip-box-block properties.overflow-clip-box-bloc...
MathML Demo: <mfrac> - fractions
inline, auto, normal line sin ⁡ θ π , numerator and denominator should render script size. inline, display style, normal line ln ⁡ x y , numerator and denominator should render normal size. inline, text style, normal line tan ⁡ θ 67 , numerator and denominator should render script size. inline, auto, thick line x 2 + 1 x , the superscripted 2 should be script-script size. inline, display style, thick line x - 1 0.98 × 10 2 + y , the superscripted 2 should be script size. inline, text style, thick line x 2 + 1 x x 2 + 1 x the end. ...
...uld render script size. inline, auto, thick line x 2 + 1 x , the superscripted 2 should be script-script size. inline, display style, thick line x - 1 0.98 × 10 2 + y , the superscripted 2 should be script size. inline, text style, thick line x 2 + 1 x x 2 + 1 x the end. inline, auto, no line x 2 + 1 x the end. inline, display style, no line 1.234567 89 + x the end. inline, text style, no line x 2 + 1 x the end. inline binomial, auto, no line ( 5 8 ) the end. inline binomial, display style, no line ( n - k n ) the end. inline binomial, text style, no line ( log ⁡ x y ) the end. inline built-in verts, auto, no line | sin ⁡ θ m | the end. ...
...9 + x the end. inline, text style, no line x 2 + 1 x the end. inline binomial, auto, no line ( 5 8 ) the end. inline binomial, display style, no line ( n - k n ) the end. inline binomial, text style, no line ( log ⁡ x y ) the end. inline built-in verts, auto, no line | sin ⁡ θ m | the end. inline up arrows, display style, no line ↑ sin ⁡ θ m ↑ the end. inline down arrows, text style, no line ↓ sin ⁡ θ m ↓ the end. inline floor, auto, normal line ⌊ sin ⁡ θ m ⌋ the end. inline ceiling, display style, normal line ⌈ sin ⁡ θ m ⌉ the end. inline updown arrows, text style, normal line ↕ sin ⁡ θ m ↕ the end. inl...
......
Midas
n point. formatblock h1, h2, h3, h4, h5, h6, p, div, address, blockquote (more?) the selection surrounded by the given block element. heading h1, h2, h3, h4, h5, h6 selected block will be formatted as the given type of heading. hilitecolor a color code this command will set the hilite color of the selection or at the insertion point. it only works with stylewithcss enabled. increasefontsize this command will add a <big> tag around selection or at insertion point. indent indent the block where the caret is located. if the caret is inside a list, that item becomes a sub-item one level deeper. insertbronreturn true/false selects whether pressing return inside a paragraph creates another paragraph or just in...
...ut key will automatically trigger this command (typically accel-a) strikethrough if there is no selection, the insertion point will set strikethrough for subsequently typed characters. if there is a selection and all of the characters are already striked, the strikethrough will be removed. otherwise, all selected characters will have a line drawn through them. stylewithcss this command is used for toggling the format of generated content. by default (at least today), this is true. an example of the differences is that the "bold" command will generate <b> if the stylewithcss command is false and generate css style attribute if the stylewithcss command is true. subscript if there is no selection, the insertion point will set subscript fo...
... ...
...s within a link or if the current selection contains a link, the link will be removed and the text will remain. readonly this command has been replaced with contentreadonly. it takes the same values as contentreadonly, but the meaning of true and false are inversed. usecss this command has been replaced with stylewithcss. it takes the same values as stylewithcss, but the meaning of true and false are inversed. ...
NSPR Contributor Guide
compatible across even major releases. this means that the behavior of an existing public api item in nspr cannot change. should you need to have a similar api, with some slightly different behavior or different function prototype, then suggest a new api with a different name. c language api the nspr api is a c language api. please do not contribute java, c or other language wrappers. coding style nspr does not have a documented coding style guide. look at the extant code. make yours look like that. some guidelines concerning naming conventions can be found in nspr naming conventions in the nspr reference. see also: xxx ownership of your contribution when you contribute something to nspr, you must have intellectual property rights to that contribution. this means that you cannot give u...
...ht to incorporate it into nspr exists. license under mpl or gpl when you contribute material to nspr, you agree to allow your contribution to be licensed under the mpl or gpl. bugfixes use bugzilla to track bugs. document the bug or use an existing report. be verbose in describing what you are doing and why. include your changes as diffs in an attachment to the bugzilla report. use a coding style consistent with the source file you are changing. new features for purposes of this paper, a "new feature" is defined as some api addition that goes into the core nspr library, for example: libnspr4.dll nspr is mostly complete. new apis are driven mostly by the os vendors as they add new features. should you decide that there's something that nspr does not cover that should be covered, let's t...
...atform ports all nspr api items must be implemented platform specific headers in pr/include/md/_platformname.[h!cfg] platform specific code in pr/src/md/platform/*.c make rules in config/_platform.mk documentation the files for nspr's documentation are maintained using a proprietary word processing system [don't ask]. document your work as described in [#newfeatures new features]. use the style of other nspr documentation. we will see that your documentation is transcribed into the appropriate word processor and the derived html shows up on mozilla.org test cases you should provide test cases for all new features and new libraries. give consideration to providing a test case when fixing a bug if an existing test case did not catch a bug it should have caught. the new test cases shoul...
...tion. we will see that your documentation is transcribed into the appropriate word processor and the derived html shows up on mozilla.org test cases you should provide test cases for all new features and new libraries. give consideration to providing a test case when fixing a bug if an existing test case did not catch a bug it should have caught. the new test cases should be implemented in the style of other nspr test cases. test cases should prove that the added api items work as advertized. test cases should serve as an example of how to use the api items. test cases should provoke failure of every api item and report its failure. frequently asked questions (faq) q: why was my contribution rejected? a: check the bugzilla report covering your contribution. original document information...
Index
Mozilla › Tech › XPCOM › Index
reference the nsiaccessnode implementations are instantiated lazily. the nsiaccessnode tree for a given dom window has a one to one relationship to the dom tree. if the dom node for this access node is "accessible", then a queryinterface to nsiaccessible will succeed. 233 domnode no summary! 234 getchildnodeat no summary! 235 getcomputedstylecssvalue no summary! 236 getcomputedstylevalue no summary! 237 accessibledocument no summary! 238 firstchildnode no summary! 239 innerhtml for the dom property, see element.innerhtml. 240 language no summary! 241 lastchildnode no summary! 242 nex...
... add a uri to global history. 675 nsiglobalhistory3 interfaces, interfaces:scriptable, places, xpcom, xpcom api reference, xpcom interface reference this interface was originally created as part of nsiglobalhistory2, but was split off during the transition to places. 676 nsihtmleditor interfaces, interfaces:scriptable, needscontent registers a default style property with the editor. 677 nsihttpheaderlistener interfaces, interfaces:scriptable, needscontent, reference, référence(2), xpcom interface reference no summary! 678 nsihapticfeedback interfaces, interfaces:scriptable, mobile, xpcom interface reference implemented by: @mozilla.org/widget/hapticfeedback;1 as a service: 679 nsihttpactivitydis...
...r_true. this method is generally called within a loop to iterate over the strings in the enumerator. 928 nsistructuredclonecontainer interfaces, interfaces:scriptable, needscontent you can copy an object into an nsistructuredclonecontainer using initfromvariant() or initfrombase64(). it is an error to initialize an nsistructuredclonecontainer more than once. 929 nsistylesheetservice interfaces, interfaces:scriptable, stylesheets, xpcom, xpcom api reference, xpcom interface reference allows extensions or embeddors to add to the built-in list of user or agent style sheets. 930 nsisupports interfaces, interfaces:scriptable, xpcom, xpcom interface reference notifies the object that an interface pointer has been duplicated. 931 ...
...er message "senders" have a single "other side" to which messages are sent. for example, a child-process message manager will send messages that are only delivered to its one parent-process message manager. 994 nsitxttohtmlconv html, interfaces, interfaces:scriptable, xpcom interface reference prior versions of the interface named the methods using the initialcaps style instead of the intercaps style. 995 nsitaggingservice interfaces, interfaces:scriptable, places, xpcom, xpcom api reference, xpcom interface reference implemented by: @mozilla.org/browser/tagging-service;1. to use this service, use: 996 nsitaskbarpreview interfaces, interfaces:scriptable, taskbar, xpcom, xpcom interface reference you can not directly inst...
nsITreeBoxObject
view nsitreeview the view that backs the tree and that supplies it with its data. it is dynamically settable, either using a view attribute on the tree tag or by setting this attribute to a new value. focused boolean whether ...
...wcountchanged(rowindex+1, -1); beginupdatebatch() notify the tree that the view is about to perform a batch update, that is, add, remove or invalidate several rows at once. this must be followed by calling endupdatebatch(), otherwise the tree will get out of sync. ...
... the view is about to perform a batch update, that is, add, remove or invalidate several rows at once. this must be followed by calling endupdatebatch(), otherwise the tree will get out of sync. void beginupdatebatch(); endupdatebatch() notify the tree that the view has completed a batch update. ...
...ch update, that is, add, remove or invalidate several rows at once. this must be followed by calling endupdatebatch(), otherwise the tree will get out of sync. void beginupdatebatch(); endupdatebatch() notify the tree that the view has completed a batch update. ...
Mozilla
convenient to use for people with disabilities. mozilla strives to make its software accessible; the documents below cover the ways in which we do so. add-ons add-ons allow developers to extend and modify the functionality of firefox. adding a new css property this page describes how to add a new css property to the style system. the style system is the part of the code in gecko that is responsible for producing a computed value for every property for every element. see the gecko overview for more information about the style system. adding a new event this draft document covers how to add a new event to the mozilla (firefox) source code. adding a new word to...
...ode is hosted on github. this article offers a quick guide for getting started with mozilla code on github. it also lists some interesting github repositories containing mozilla project code. mozilla quirks mode behavior the following is a rough list of the differences that exist between mozilla's standards mode and quirks mode behavior. ...
...ffers a quick guide for getting started with mozilla code on github. it also lists some interesting github repositories containing mozilla project code. mozilla quirks mode behavior the following is a rough list of the differences that exist between mozilla's standards mode and quirks mode behavior. ...
... some interesting github repositories containing mozilla project code. mozilla quirks mode behavior the following is a rough list of the differences that exist between mozilla's standards mode and quirks mode behavior. mozilla style system the style system is the module of mozilla's code responsible for the loading and parsing of css style sheets, and the computation of computed values for all css properties. the handling of those computed values is the responsibility of other parts of the code. mozilla style system documentation see also the style techtalk for more complete although less detailed documentation. mozilla svg project since you have come this fa...
Examine and edit HTML - Firefox Developer Tools
context menu reference edit as html edit the element's html. (copy) inner html copy the inner html for the element. (copy) outer html copy the outer h...
...nner html outer html css selector css path xpath image data-url attribute paste inner html outer html before after as first child as last child expand all collapse all open link in new tab * open file in debugger * open file in style-editor * copy link address * * these options only appear in certain contexts, for example the "open file in style-editor" option only appears when you context-click over the top of a link to a css file. context menu reference edit as html edit the element's html. (copy) inner html copy the inner html for the element. (copy) outer html copy the outer html for the element. pressing ctrl + c (or cmd + c on a mac) also performs this action. (copy) uniq...
...attribute) edit the attribute. attribute/remove attribute (only when invoked on an attribute) remove the attribute. open link in new tab (only when invoked over a link, such as an href attribute) opens the linked item in a new tab. open file in debugger (only when invoked over a link to a js source) opens the linked source in the debugger. open file in style-editor (only when invoked over a link to a css source) opens the linked source in the style editor. copy link address (only when invoked over a url) copy the url. (change pseudo-class) hover set the :hover css pseudo-class. (change pseudo-class) active set the :active css pseudo-class. (change pseudo-class) focus set the :focus css pseudo-class. ...
...yling just as you would any other node in the document. you can access the same functionality using the "create new node" popup menu item. note that this button is disabled if the selected element's type is such that adding a last-child would have no effect (for example, if is is an <html> or <iframe> element). however, it is enabled in places where it is not valid to insert a <div>, such as <style> or <link>. in these cases the element is added as text. ...
Animating CSS properties - Firefox Developer Tools
however, the performance cost of modifying a css property can vary from one property to another. animating expensive css properties can result in jank as the browser struggles to hit a smooth frame rate. the css rendering waterfall the process the browser uses to update the page when a css property has changed can be described as a waterfall consisting of the following steps: recalculate style: every time a css property for an element changes, the browser must recalculate computed styles. layout: next, the browser uses the computed styles to figure out the position and geometry for the elements. this operation is labeled "layout" but is also sometimes called "reflow". paint: finally, the browser needs to repaint the elements to the screen. one last step is not shown in this sequence:...
...econd is the rate at which animations will appear smooth. for a rate of 60 frames per second, that gives the browser 16.7 milliseconds to execute the complete flow. css property cost in the context of the rendering waterfall, some properties are more expensive than others: property type cost examples properties that affect an element's geometry or position trigger a style recalculation, a layout and a repaint. left max-width border-width margin-left font-size properties that don't affect geometry or position, but are not rendered in their own layer, do not trigger a layout. color properties that are rendered in their own layer don't even trigger a repaint, because the update is hand...
...though, is that the frame rate is very jagged, with lots of dips into the twenties and teens. it's unlikely you'll see a smooth animation here, especially when you add in user interaction. waterfall the rest of the recording shows the waterfall view. if you scroll through this, you'll see a pattern like this: this is showing us the rendering waterfall. in each animation frame, we recalculate styles for every element, then perform a single layout, then a repaint. you can see that paint especially is hurting performance here. in the screenshot above we've highlighted a paint operation, and the box on the right tells us it took 13.11ms. with only 16.7ms in our total budget, it's not surprising we are missing a consistently high frame rate. you can experiment with this: try removing the box ...
...xt, we'll see how using transform instead of margin eliminates those expensive paints entirely. animating using transform now switch the radio button in the web page to "use transform", and make a new recording. it will look something like this: waterfall overview compared with the version that uses margin, we're seeing a lot less green and a lot more pink, which could be either layout or style recalculation. frame rate compared with the version that uses margin, this is looking pretty good. we're averaging nearly 60fps, and apart from one dip near the start, we're getting a consistently high frame rate. waterfall the timeline view shows the reason for the improved frame rate. compared with the version that uses margin, we're not spending any time time in layout or (more important...
Waterfall - Firefox Developer Tools
andler stack call stack, with links to functions. parse html time spent parsing the page's html. stack call stack, with links to functions. parse xml time spent parsing the page's xml. stack call stack, with links to functions. ...
... call stack, with links to functions. parse html time spent parsing the page's html. stack call stack, with links to functions. parse xml time spent parsing the page's xml. stack call stack, with links to functions. recalculate style calculating the computed styles that apply to page elements. ...
... parse html time spent parsing the page's html. stack call stack, with links to functions. parse xml time spent parsing the page's xml. stack call stack, with links to functions. recalculate style calculating the computed styles that apply to page elements. restyle hint a string indicating what kind of restyling is needed. the hint may be any of: self subtree latersiblings csstransitions cssanimations svgattranimations styleattribute styleattribute_animations force forcedescendants layout calculating the position and size of page elements. this operation is sometimes called "...
...ms. rendering waterfall one pattern that you'll often see in the waterfall view is something like this: this is a visualization of the basic algorithm the browser uses to update the page in response to some event: javascript function call: some event - for example, a dom event - causes some javascript in the page to run. the javascript changes some of the page's dom or cssom. recalculate style: if the browser thinks the computed styles for page elements have changed, it must then recalculate them. layout: next, the browser uses the computed styles to figure out the position and geometry for the elements. this operation is labeled "layout" but is also sometimes called "reflow". paint: finally, the browser needs to repaint the elements to the screen. one last step is not shown in this ...
Settings - Firefox Developer Tools
ersistent logs a setting to control whether or not the web console and network monitor clear their output when you navigate to a new page. if common preferences is not included in the settings, web console logs can be persisted by using the 'about:config' url in browser address bar, searching for: 'devtools.webconsole.persistlog' then toggling this value to true inspector show browser styles a setting to control whether styles applied by the browser (user-agent styles) should be displayed in the inspector's rules view. note that this setting is independent of the "browser styles" checkbox in the inspector's computed view. truncate dom attributes by default, the inspector truncates dom attributes that are more than 120 characters long. uncheck this box to prevent this behavior. th...
...ps controls whether the web console displays timestamps. the web console defaults to hiding timestamps. enable new console frontend switch to the experimental new console. this setting only exists in firefox nightly. debugger enable source maps enable source map support in the debugger. enable new debugger frontend enable the new debugger. this setting only exists in firefox nightly. ...
... new console frontend switch to the experimental new console. this setting only exists in firefox nightly. debugger enable source maps enable source map support in the debugger. enable new debugger frontend enable the new debugger. this setting only exists in firefox nightly. style editor show original sources when a css preprocessor supporting source maps is used, this enables the style editor to display the original, preprocessor, sources rather than the generated css. learn more about style editor support for css source maps. with this setting checked, the page inspector rules view will also provide links to the original sources. autocomplete css enable the style editor to offer autocomplete suggestions. screenshot behavior screenshot to clipboard when you click the ic...
... the screenshot image to the clipboard (the image will still be saved to your downloads directory). new in firefox 53. play camera shutter sound when you click the icon for the screenshot tool, play a shutter sound. new in firefox 53. editor preferences preferences for the codemirror source editor, which is included in firefox and used by several developer tools, including scratchpad and the style editor. detect indentation auto-indent new lines based on the current indentation. autoclose brackets determines whether typing an opening character like [ or { will cause the editor to insert the matching closing character ] or } for you. indent using spaces when checked, indentation will be performed using spaces, when off, the editor will use tabs instead. tab size the frequency of t...
AnalyserNode - Web APIs
one input and one output. the node works even if the output is not connected. ...
...t may be left unconnected) channel count mode "max" channel count 2 channel interpretation "speakers" inheritance this interface inherits from the following parent interfaces: <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alig...
...me-domain, data into a uint8array (unsigned byte array) passed into it. examples note: see the guide visualizations with web audio api for more information on creating audio visualizations. basic usage the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). var audioctx = new(window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); // ... analyser.fftsize = 2048; var bufferlength = analyser.frequencybincount; var dataarray = new uint8array(...
... var dataarray = new uint8array(bufferlength); analyser.getbytetimedomaindata(dataarray); // get a canvas defined with id "oscilloscope" var canvas = document.getelementbyid("oscilloscope"); var canvasctx = canvas.getcontext("2d"); // draw an oscilloscope of the current audio source function draw() { requestanimationframe(draw); analyser.getbytetimedomaindata(dataarray); canvasctx.fillstyle = "rgb(200, 200, 200)"; canvasctx.fillrect(0, 0, canvas.width, canvas.height); canvasctx.linewidth = 2; canvasctx.strokestyle = "rgb(0, 0, 0)"; canvasctx.beginpath(); var slicewidth = canvas.width * 1.0 / bufferlength; var x = 0; for (var i = 0; i < bufferlength; i++) { var v = dataarray[i] / 128.0; var y = v * canvas.height / 2; if (i === 0) { canvasctx.move...
CSSImageValue - Web APIs
the cssimagevalue interface of the css typed object model api represents values for properties that take an image, for example background-image, list-style-image, or border-image-source. the cssimagevalue object represents an <image> that involves an url, such as url() or image(), but not linear-gradient() or element() . properties none. methods none. ...
...linear-gradient() or element() . properties none. methods none. ...
...thods none. examples we create an element <button>magic wand</button> we add some css, including a background image requesting a binary file: button { display: inline-block; min-height: 100px; min-width: 100px; background: no-repeat 5% center url(https://mdn.mozillademos.org/files/16793/magicwand.png) aqua; } we get the element's style map. ...
...uesting a binary file: button { display: inline-block; min-height: 100px; min-width: 100px; background: no-repeat 5% center url(https://mdn.mozillademos.org/files/16793/magicwand.png) aqua; } we get the element's style map. we then get() the background-image from the stylemap and stringify it: // get the element const button = document.queryselector( 'button' ); // retrieve all computed styles with computedstylemap() const allcomputedstyles = button.computedstylemap(); // return the cssimagevalue example console.log( allcomputedstyles.get('background-image') ); console.log( allcomputedstyles.get('background-image').tostring() ); specifications specification status comment css typed om level 1the definition of 'cssimagevalue' in that specification. work...
CSSKeywordValue.CSSKeywordValue() - Web APIs
the csskeywordvalue constructor creates a new csskeywordvalue object which represents css keywords and other identifiers. syntax var csskeywordvalue = new csskeywordvalue(val) parameters value sets or returns the value of the new csskeywordvalue. ...
... the csskeywordvalue constructor creates a new csskeywordvalue object which represents css keywords and other identifiers. syntax var csskeywordvalue = new csskeywordvalue(val) parameters value sets or returns the value of the new csskeywordvalue. ...
...val) parameters value sets or returns the value of the new csskeywordvalue. examples the following example resets the css display property to its defaults, setting the inline style attribute to style="display: initial" if viewed in the developer tools inspector. ...
...ty to its defaults, setting the inline style attribute to style="display: initial" if viewed in the developer tools inspector. #myelement { display: flex; } <div id="myelement">check the developer tools to see the log in the console and to inspect the style attribute on this div.</div> let keyword = new csskeywordvalue('initial'); let myelement = document.getelementbyid('myelement').attributestylemap; myelement.set('display', keyword); console.log( myelement.get('display').value); // 'initial' console.dir( keyword ); specifications specification status comment css typed om level 1the definition of 'csskeywordvalue' in that specification. working draft initial definition. ...
CSSMathValue.operator - Web APIs
thmax "max" cssmathclamp "clamp" cssmathnegate "negate" cssmathinvert "invert" examples we create an element with a width determined using a calc() function, then console.log() the operator. ...
... cssmathnegate "negate" cssmathinvert "invert" examples we create an element with a width determined using a calc() function, then console.log() the operator. ...
...negate" cssmathinvert "invert" examples we create an element with a width determined using a calc() function, then console.log() the operator. ...
...calc() function, then console.log() the operator. <div>my width has a <code>calc()</code> function</div> we assign a width with a calculation div { width: calc(50% - 0.5vw); } we add the javascript const stylemap = document.queryselector('div').computedstylemap(); console.log( stylemap.get('width') ); // cssmathsum {values: cssnumericarray, operator: "sum"} console.log( stylemap.get('width').values ); // cssnumericarray {0: cssunitvalue, 1: cssmathnegate, length: 2} console.log( stylemap.get('width').operator ); // 'sum' console.log( stylemap.get('width').values[1].operator ) // 'negate' the cssmathvalue.operator returns sum for the equation and negate for the operator on the second value. specifications specification status co...
CanvasPattern.setTransform() - Web APIs
syntax void pattern.settransform(matrix); parameters matrix an svgmatrix or dommatrix to use as the pattern's transformation matrix. examples using the settransform method this is just a simple code snippet which uses the settransform method to create a canvaspattern with the specified pattern transformation from an svgmatrix. the pattern gets applied if you set it as the current fillstyle and gets drawn onto the canvas when using the fillrect() method, for example. html <canvas id="canvas"></canvas> <svg id="svg1"></svg> javascript var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); var svg1 = document.getelementbyid('svg1'); var matrix = svg1.createsvgmatrix(); var img = new image(); img.src = 'https://mdn.mozillademos.org/files/222/canvas_cr...
...as = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); var svg1 = document.getelementbyid('svg1'); var matrix = svg1.createsvgmatrix(); var img = new image(); img.src = 'https://mdn.mozillademos.org/files/222/canvas_createpattern.png'; img.onload = function() { var pattern = ctx.createpattern(img, 'repeat'); pattern.settransform(matrix.rotate(-45).scale(1.5)); ctx.fillstyle = pattern; ctx.fillrect(0, 0, 400, 400); }; note that newer browser versions started to support dommatrix as an input to settransform(), so for example you could replace the svgmatrix in the above example with the following: const matrix = new dommatrix([1, .2, .8, 1, 0, 0]); edit the code below and see your changes update live in the canvas: playable code <canvas id="canvas" width="400"...
...r browser versions started to support dommatrix as an input to settransform(), so for example you could replace the svgmatrix in the above example with the following: const matrix = new dommatrix([1, .2, .8, 1, 0, 0]); edit the code below and see your changes update live in the canvas: playable code <canvas id="canvas" width="400" height="200" class="playable-canvas"></canvas> <svg id="svg1" style="display:none"></svg> <div class="playable-buttons"> <input id="edit" type="button" value="edit" /> <input id="reset" type="button" value="reset" /> </div> <textarea id="code" class="playable-code" style="height:120px"> var img = new image(); img.src = 'https://mdn.mozillademos.org/files/222/canvas_createpattern.png'; img.onload = function() { var pattern = ctx.createpattern(img, 'repeat');...
..."edit" type="button" value="edit" /> <input id="reset" type="button" value="reset" /> </div> <textarea id="code" class="playable-code" style="height:120px"> var img = new image(); img.src = 'https://mdn.mozillademos.org/files/222/canvas_createpattern.png'; img.onload = function() { var pattern = ctx.createpattern(img, 'repeat'); pattern.settransform(matrix.rotate(-45).scale(1.5)); ctx.fillstyle = pattern; ctx.fillrect(0, 0, 400, 400); };</textarea> var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); var textarea = document.getelementbyid('code'); var reset = document.getelementbyid('reset'); var edit = document.getelementbyid('edit'); var code = textarea.value; var svg1 = document.getelementbyid('svg1'); var matrix = svg1.createsvgmatrix(); function ...
CanvasRenderingContext2D.arcTo() - Web APIs
second control point. without arcto(), these two segments would form a sharp corner: arcto() creates a circular arc that fits this corner and smooths is out. in other words, the arc is tangential to both segments. ...
...his corner and smooths is out. in other words, the arc is tangential to both segments. ...
...tangent lines are gray, control points are red, and the start point is blue.
...tangent lines are gray, control points are red, and the start point is blue. creating a rounded corner this example creates a rounded corner using arcto(). ...
CanvasRenderingContext2D.createLinearGradient() - Web APIs
note: gradient coordinates are global, i.e., relative to the current coordinate space. when applied to a shape, the coordinates are not relative to the shape's coordinates. ...
... note: gradient coordinates are global, i.e., relative to the current coordinate space. when applied to a shape, the coordinates are not relative to the shape's coordinates. ...
... living standard ...
... living standard ...
CanvasRenderingContext2D.createRadialGradient() - Web APIs
note: gradient coordinates are global, i.e., relative to the current coordinate space. when applied to a shape, the coordinates are not relative to the shape's coordinates. ...
... note: gradient coordinates are global, i.e., relative to the current coordinate space. when applied to a shape, the coordinates are not relative to the shape's coordinates. ...
... living standard ...
... living standard ...
CanvasRenderingContext2D.fillRect() - Web APIs
parameters x the x-axis coordinate of the rectangle's starting point. y the y-axis coordinate of the rectangle's starting point. ...
... parameters x the x-axis coordinate of the rectangle's starting point. y the y-axis coordinate of the rectangle's starting point. width the rectangle's width. positive values are to the right, and negative to the left. height the rectangle's height. ...
... parameters x the x-axis coordinate of the rectangle's starting point. y the y-axis coordinate of the rectangle's starting point. width the rectangle's width. positive values are to the right, and negative to the left. height the rectangle's height. positive values are down, and negative are up. ...
...t. positive values are down, and negative are up. examples a simple filled rectangle this example draws a filled green rectangle using the fillrect() method. html <canvas id="canvas"></canvas> javascript the rectangle's top-left corner is at (20, 10). it has a width of 150 and a height of 100. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.fillstyle = 'green'; ctx.fillrect(20, 10, 150, 100); result filling the whole canvas this code snippet fills the entire canvas with a rectangle. this is often useful for creating a background, on top of which other things may then be drawn. to achieve this, the dimensions of the rectangle are set to equal the <canvas> element's width and height attributes. const canvas = document.getelementbyid('can...
CanvasRenderingContext2D.stroke() - Web APIs
strokes are aligned to the center of a path; in other words, half of the stroke is drawn on the inner side, and half on the outer side. the stroke is drawn using the non-zero winding rule, which means that path intersections will still get filled. syntax void ctx.stroke(); void ctx.stroke(path); parameters path a path2d path to stroke. examples a simple stroked rectangle this example creates a rectangle using the rect() method, and then draws it to the canvas using stroke(). ...
... get stroked every time you call the stroke() method. in some cases, however, this may be the desired effect. html <canvas id="canvas"></canvas> javascript this code strokes the first path three times, the second path two times, and the third path only once. ...
...s id="canvas"></canvas> javascript this code strokes the first path three times, the second path two times, and the third path only once. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // first sub-path ctx.linewidth = 26; ctx.strokestyle = 'orange'; ctx.moveto(20, 20); ctx.lineto(160, 20); ctx.stroke(); // second sub-path ctx.linewidth = 14; ctx.strokestyle = 'green'; ctx.moveto(20, 80); ctx.lineto(220, 80); ctx.stroke(); // third sub-path ctx.linewidth = 4; ctx.strokestyle = 'pink'; ctx.moveto(20, 140); ctx.lineto(280, 140); ctx.stroke(); result stroking and filling if you want to both stroke and fill a path, the order in which you perform these actions will determine the result. in this example, the square on the left is drawn with the stro...
...path, the order in which you perform these actions will determine the result. in this example, the square on the left is drawn with the stroke on top of the fill. the square on the right is drawn with the fill on top of the stroke. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.linewidth = 16; ctx.strokestyle = 'red'; // stroke on top of fill ctx.beginpath(); ctx.rect(25, 25, 100, 100); ctx.fill(); ctx.stroke(); // fill on top of stroke ctx.beginpath(); ctx.rect(175, 25, 100, 100); ctx.stroke(); ctx.fill(); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.stroke' in that specification. living standard ...
Basic usage of canvas - Web APIs
pecifying your width and height attributes explicitly in the <canvas> attributes, and not using css. the id attribute isn't specific to the <canvas> element but is one of the global html attributes which can be applied to any html element (like class for instance). it is always a good idea to supply an id because this makes it much easier to identify it in a script. the <canvas> element can be styled just like any normal image (margin, border, background…). these rules, however, don't affect the actual drawing on the canvas. we'll see how this is done in a dedicated chapter of this tutorial. when no styling rules are applied to the canvas it will initially be fully transparent. fallback content the <canvas> element differs from an <img> tag in that, like for <video>, <audio>, or <pictur...
...mbed a script inside html. we do it here to keep the example concise. <!doctype html> <html> <head> <meta charset="utf-8"/> <title>canvas tutorial</title> <script type="text/javascript"> function draw() { var canvas = document.getelementbyid('tutorial'); if (canvas.getcontext) { var ctx = canvas.getcontext('2d'); } } </script> <style type="text/css"> canvas { border: 1px solid black; } </style> </head> <body onload="draw();"> <canvas id="tutorial" width="150" height="150"></canvas> </body> </html> the script includes a function called draw(), which is executed once the page finishes loading; this is done by listening for the load event on the document. this function, or one like it, could also be called ...
...raws two intersecting rectangles, one of which has alpha transparency. we'll explore how this works in more detail in later examples. ...
...ore how this works in more detail in later examples. ...
Drawing shapes with canvas - Web APIs
reenshotlive sample the fillrect() function draws a large black square 100 pixels on each side. the clearrect() function then erases a 60x60 pixel square from the center, and then strokerect() is called to create a rectangular outline 50x50 pixels within the cleared square. in upcoming pages we'll see two alternative methods for clearrect(), and we'll also see how to change the color and stroke style of the rendered shapes. unlike the path functions we'll see in the next section, all three rectangle functions draw immediately to the canvas. drawing paths now let's look at paths. a path is a list of points, connected by segments of lines that can be of different shapes, curved or not, of different width and of different color. a path, or even a subpath, can be closed. to make shapes using p...
...ctx.beginpath(); ctx.moveto(83, 116); ctx.lineto(83, 102); ctx.beziercurveto(83, 94, 89, 88, 97, 88); ctx.beziercurveto(105, 88, 111, 94, 111, 102); ctx.lineto(111, 116); ctx.lineto(106.333, 111.333); ctx.lineto(101.666, 116); ctx.lineto(97, 111.333); ctx.lineto(92.333, 116); ctx.lineto(87.666, 111.333); ctx.lineto(83, 116); ctx.fill(); ctx.fillstyle = 'white'; ctx.beginpath(); ctx.moveto(91, 96); ctx.beziercurveto(88, 96, 87, 99, 87, 101); ctx.beziercurveto(87, 103, 88, 106, 91, 106); ctx.beziercurveto(94, 106, 95, 103, 95, 101); ctx.beziercurveto(95, 99, 94, 96, 91, 96); ctx.moveto(103, 96); ctx.beziercurveto(100, 96, 99, 99, 99, 101); ctx.beziercurveto(99, 103, 100, 106, 103, 106); ctx.beziercurveto(...
... function roundedrect(ctx, x, y, width, height, radius) { ctx.beginpath(); ctx.moveto(x, y + radius); ctx.lineto(x, y + height - radius); c...
...ight-radius, radius); ctx.lineto(x + width, y + radius); ctx.arcto(x + width, y, x + width - radius, y, radius); ctx.lineto(x + radius, y); ctx.arcto(x, y, x, y + radius, radius); ctx.stroke(); } the resulting image looks like this: screenshotlive sample we won't go over this in detail, since it's actually surprisingly simple. the most important things to note are the use of the fillstyle property on the drawing context, and the use of a utility function (in this case roundedrect()). using utility functions for bits of drawing you do often can be very helpful and reduce the amount of code you need, as well as its complexity. we'll take another look at fillstyle, in more detail, later in this tutorial. here, all we're doing is using it to change the fill color for paths from the d...
Drawing text - Web APIs
« previousnext » after having seen how to apply styles and colors in the previous chapter, we will now have a look at how to draw text onto the canvas. drawing text the canvas rendering context provides two methods to render text: filltext(text, x, y [, maxwidth]) fills a given text at the given (x,y) position. optionally with a maximum width to draw. stroketext(text, x, y [, maxwidth]) strokes a given text at the given (x,y) position. optionally with a maximum width to draw. a filltext example the text is filled using the current fillstyle. function draw() { var ctx = document.getelementbyid('canvas').getcontext('2d'); ctx.font = '48px serif'; ctx.filltext('hello world', 10, 50); } <canvas id="canvas" width="300" height="100"></canvas> draw(); a st...
...n. optionally with a maximum width to draw. a filltext example the text is filled using the current fillstyle. function draw() { var ctx = document.getelementbyid('canvas').getcontext('2d'); ctx.font = '48px serif'; ctx.filltext('hello world', 10, 50); } <canvas id="canvas" width="300" height="100"></canvas> draw(); a stroketext example the text is filled using the current strokestyle. function draw() { var ctx = document.getelementbyid('canvas').getcontext('2d'); ctx.font = '48px serif'; ctx.stroketext('hello world', 10, 50); } <canvas id="canvas" width="300" height="100"></canvas> draw(); styling text in the examples above we are already making use of the font property to make the text a bit larger than the default size. there are some more properties which le...
...t = '48px serif'; ctx.stroketext('hello world', 10, 50); } <canvas id="canvas" width="300" height="100"></canvas> draw(); styling text in the examples above we are already making use of the font property to make the text a bit larger than the default size. there are some more properties which let you adjust the way the text gets displayed on the canvas: font = value the current text style being used when drawing text. this string uses the same syntax as the css font property. the default font is 10px sans-serif. textalign = value text alignment setting. possible values: start, end, left, right or center. the default value is start. textbaseline = value baseline alignment setting. possible values: top, hanging, middle, alphabetic, ideographic, bottom. the default value is alpha...
... textarea.focus(); }) textarea.addeventlistener('input', drawcanvas); window.addeventlistener('load', drawcanvas); advanced text measurements in the case you need to obtain more details about the text, the following method allows you to measure it. measuretext() returns a textmetrics object containing the width, in pixels, that the specified text will be when drawn in the current text style. the following code snippet shows how you can measure a text and get its width. function draw() { var ctx = document.getelementbyid('canvas').getcontext('2d'); var text = ctx.measuretext('foo'); // textmetrics object text.width; // 16; } gecko-specific notes in gecko (the rendering engine of firefox, firefox os and other mozilla based applications), some prefixed apis were implemented...
DataTransfer.clearData() - Web APIs
event.datatransfer.cleardata(); // set the drag's format and data (use event target's id for data) event.datatransfer.setdata('text/plain', event.target.id); data.innerhtml = event.datatransfer.getdata('text/plain'); } function d...
...a) event.datatransfer.setdata('text/plain', event.target.id); data.innerhtml = event.datatransfer.getdata('text/plain'); } function dragendhandler (event) { if (!dropped) { status.innerhtml = 'drag canceled'; } data.innerhtml = event.datatransfer.getdata('text/plain') || 'empty'; // change border to signify drag is no longer in process event.currenttarget.style.border = '1px solid black'; if (dropped) { // remove all event listeners draggable.removeeventlistener('dragstart', dragstarthandler); draggable.removeeventlistener('dragend', dragendhandler); dropable.removeeventlistener('dragover', dragoverhandler); dropable.removeeventlistener('dragleave', dragleavehandler); dropable.removeeventlistener('drop', drophand...
... living standard html 5.1the definition of 'datatransfer.clearda...
... living standard html 5.1the definition of 'datatransfer.cleardata()' in that specification. recomm...
Document: drag event - Web APIs
width: 200px; height: 20px; background: blueviolet; margin-bottom: 10px; padding: 10px; } javascript var dragged; /* events fired on the draggable target */ document.addeventlistener("drag", function(event) { }, false); document.addeventlistener("dragstart", function(event) { // store a ref. ...
...vents fired on the draggable target */ document.addeventlistener("drag", function(event) { }, false); document.addeventlistener("dragstart", function(event) { // store a ref. ...
...arget.style.opacity = ""; }, false); /* events fired on the drop targets */ document.addeventlistener("dragover", function(event) { // prevent default to allow drop event.preventdefault(); }, false); document.addeventlistener("dragenter", function(event) { // highlight potential drop target when the draggable element enters it if (event.target.classname == "dropzone") { event.target.style.background = "purple"; } }, false); document.addeventlistener("dragleave", function(event) { // reset background of potential drop target when the draggable element leaves it if (event.target.classname == "dropzone") { event.target.style.background = ""; } }, false); document.addeventlistener("drop", function(event) { // prevent default action (open as link for some elements) ...
... living standard ...
Using the Gamepad API - Web APIs
you can find a working demo and look at the full source code on github...
...you can find a working demo and look at the full source code on github. var haveevents = 'ongamepadconn...
...amepad.axes.length; i++) { var p = document.createelement("progress"); p.classname = "axis"; //p.id = "a" + i; p.setattribute("max", "2"); p.setattribute("value", "1"); p.innerhtml = i; a.appendchild(p); } d.appendchild(a); // see https://github.com/luser/gamepadtest/blob/master/index.html var start = document.getelementbyid("start"); if (start) { start.style.display = "none"; } document.body.appendchild(d); requestanimationframe(updatestatus); } function disconnecthandler(e) { removegamepad(e.gamepad); } function removegamepad(gamepad) { var d = document.getelementbyid("controller" + gamepad.index); document.body.removechild(d); delete controllers[gamepad.index]; } function updatestatus() { if (!haveevents) { scangamepads(); ...
...ment.getelementbyid("controller" + j); var buttons = d.getelementsbyclassname("button"); for (i = 0; i < controller.buttons.length; i++) { var b = buttons[i]; var val = controller.buttons[i]; var pressed = val == 1.0; if (typeof(val) == "object") { pressed = val.pressed; val = val.value; } var pct = math.round(val * 100) + "%"; b.style.backgroundsize = pct + " " + pct; if (pressed) { b.classname = "button pressed"; } else { b.classname = "button"; } } var axes = d.getelementsbyclassname("axis"); for (i = 0; i < controller.axes.length; i++) { var a = axes[i]; a.innerhtml = i + ": " + controller.axes[i].tofixed(4); a.setattribute("value", controller.axes[i] + 1); ...
GlobalEventHandlers.onanimationiteration - Web APIs
#box { width: var(--boxwidth); height: var(--boxwidth); left: 0; top: 0; border: 1px solid #7788ff; ...
...lucida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, let's take a look at the styles for the box that we're animating. first is the box itself. we set its size, position, color, and layout. note that there's nothing there about animation. that's because we don't want the box to start animating right away. we'll add the animation style later to start animating the box. #box { width: var(--boxwidth); height: var(--boxwidth); left: 0; top: 0; border: 1px solid #7788ff; margin: 0; position: relative; background-color: #2233ff; display: flex; justify-content: center; animation: 2s ease-in-out 0s infinite alternate both paused slidebox; } the animation's keyframes are defined next; they describe an animation...
...s slidebox { from { left:0; top:0; } to { left:calc(100% - var(--boxwidth)); top:calc(100% - var(--boxwidth)) } } javascript some javascript code will need to be written to handle the click on the button to start the next iteration. let's have a look. var box = document.getelementbyid("box"); var iterationcounter = 0; box.onanimationiteration = function(event) { box.style.animationplaystate = "paused"; document.getelementbyid("play").innerhtml = "start iteration #" + (iterationcounter+1); }; this sets up two global variables: box, which references the "box" element that we're animating, and iterationcounter, which is initially zero, which indicates how many iterations of the animation have occurred. the onanimationiteration event handler is then set up. it si...
...teration event handler is then set up. it simply sets the box's animation-play-state to "paused", then updates the text displayed in the button to indicate that clicking the button will start playing the next iteration of theanimation. finally, we set up a handler for a click on the button that runs the animation: document.getelementbyid("play").addeventlistener("click", function(event) { box.style.animationplaystate = "running"; iterationcounter++; }, false); this sets the box element's animation-play-state to "running" and increments the iteration counter. that's all there is to it! result assembled together, you get this: each time the box reaches the opposing corner, it stops, with the button reflecting which iteration number is up next, until you click the button to run the nex...
GlobalEventHandlers.ontransitioncancel - Web APIs
nd events to detect when the transition begins and ends, to cause a text update to occur during the transition. this could also be used to trigger animations or other effects, to allow chaining of reactions. in addition, we also use a click event to make the box dissappear (display: none;), showing how it triggers the transitioncancel event to fire. ...
... be used to trigger animations or other effects, to allow chaining of reactions. in addition, we also use a click event to make the box dissappear (display: none;), showing how it triggers the transitioncancel event to fire. html this simply creates a <div> which we'll style with css below to make into a box that resizes and changes color and such. ...
... fire. html this simply creates a <div> which we'll style with css below to make into a box that resizes and changes color and such. <div class="box"></div> css the css below styles the box and applies a transition effect which makes the box's color and size change, and causes the box to rotate, while the mouse cursor hovers over it. ...
...tate(180deg); transform: rotate(180deg); } javascript next, we need to establish our event handlers to change the text content of the box when the transition begins and ends. let box = document.queryselector(".box"); box.ontransitionrun = function(event) { box.innerhtml = "zooming..."; } box.ontransitionend = function(event) { box.innerhtml = "done!"; } box.onclick = function() { box.style.display = 'none'; timeout = window.settimeout(appear, 2000); function appear() { box.style.display = 'block'; } } box.ontransitioncancel = function(event) { console.log('transitioncancel fired after ' + event.elapsedtime + ' seconds.'); } result the resulting content looks like this: notice what happens when you hover your mouse cursor over the box, then move it away. also note...
Using the MediaStream Recording API - Web APIs
rer 9. checkbox hack for showing/hiding this is fairly well documented already, but we thought we'd give a mention to the checkbox hack, which abuses the fact that you can click on the <label> of a checkbox to toggle it checked/unchecked. in web dictaphone this powers the information screen, which is shown/hidden by clicking the question mark icon in the top right hand corner. ...
...z-index to always sit above the other elements and therefore be focusable/clickable: label { font-family: 'notocoloremoji'; font-size: 3rem; position: absolute; top: 2px; right: 3px; z-index: 5; cursor: pointer; } then we hide the actual checkbox, because we don't want it cluttering up our ui: input[type=checkbox] { position: absolute; top: -100px; } next, we style the information screen (wrapped in an <aside> element) how we want it, give it fixed position so that it doesn't appear in the layout flow and affect the main ui, transform it to the position we want it to sit in by default, and give it a transition for smooth showing/hiding: aside { position: fixed; top: 0; left: 0; text-shadow: 1px 1px 1px black; width: 100%; height: 100%; ...
...the mediarecorder interface that allow you to control recording of the media stream; in web dictaphone we just make use of two, and listen to some events. first of all, mediarecorder.start() is used to start recording the stream once the record button is pressed: record.onclick = function() { mediarecorder.start(); console.log(mediarecorder.state); console.log("recorder started"); record.style.background = "red"; record.style.color = "black"; } when the mediarecorder is recording, the mediarecorder.state property will return a value of "recording". as recording progresses, we need to collect the audio data. we register an event handler to do this using mediarecorder.ondataavailable: let chunks = []; mediarecorder.ondataavailable = function(e) { chunks.push(e.data); } note: th...
...ol this interval, or call mediarecorder.requestdata() to trigger an event when you need it. lastly, we use the mediarecorder.stop() method to stop the recording when the stop button is pressed, and finalize the blob ready for use somewhere else in our application. stop.onclick = function() { mediarecorder.stop(); console.log(mediarecorder.state); console.log("recorder stopped"); record.style.background = ""; record.style.color = ""; } note that the recording may also stop naturally if the media stream ends (e.g. if you were grabbing a song track and the track ended, or the user stopped sharing their microphone). grabbing and using the blob when recording has stopped, the state property returns a value of "inactive", and a stop event is fired. we register an event handler for thi...
Range.getBoundingClientRect() - Web APIs
working draft initial specificatio...
... working draft initial specification. ...
... working draft initial specification. ...
... working draft initial specification. ...
SVGElement - Web APIs
all of the svg dom interfaces that correspond directly to elements in the svg language derive from the svgelement interface. ...
... all of the svg dom interfaces that correspond directly to elements in the svg language derive from the svgelement interface. ...
...these can also be defined in svg using attributes of the form data-*, where * is the key name for the pair. this works just like html's htmlelement...
...tor <svg> element. null if the given element is the outermost <svg> element. svgelement.viewportelementread only the svgelement, which established the current viewport. often, the nearest ancestor <svg> element. null if the given element is the outermost <svg> element. methods this interface has no methods, but inherits methods from: documentandelementeventhandlers, element, elementcssinlinestyle, globaleventhandlers, htmlorforeignelement, svgelementinstance events listen to these events using addeventlistener() or by assigning an event listener to the equivalent on... handler property defined on globaleventhandlers or windoweventhandlers. abort fired when page loading is stopped before an svg element has been allowed to load completely. also available via the onabort property. er...
SVGRectElement - Web APIs
the svgrectelement interface provides access to the properties of <rect> elements, as well as methods to manipulate them. ...
... the svgrectelement interface provides access to the properties of <rect> elements, as well as methods to manipulate them. ...
...given <rect> element. methods this interface doesn't implement any specific methods, but inherits methods from its parent, svggeometryelement. example here is a simple usage of rect interface. ...
... specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgrectelement' in that specification. ...
Storage.getItem() - Web APIs
Web › API › Storage › getItem
ist, in the given storage object. syntax var avalue = storage.getitem(keyname); parameters keyname a domstring containing the name of the key you want to retrieve the value of. return value a domstring containing the value of the key. if the key does not exist, null is returned. ...
...t. syntax var avalue = storage.getitem(keyname); parameters keyname a domstring containing the name of the key you want to retrieve the value of. return value a domstring containing the value of the key. if the key does not exist, null is returned. example the following function retrieves three data items from local storage, then uses them to set custom styles on a page. ...
... specifications specification status comment html living standardthe definition of 'storage.getitem' in that specification. ...
... specifications specification status comment html living standardthe definition of 'storage.getitem' in that specification. living standard ...
Touch events - Web APIs
ple tracks multiple touchpoints at a time, allowing the user to draw in a <canvas> with more than one finger at a time. it will only work on a browser that supports touch events. note: the text below uses the term "finger" when describing the contact with the surface, but it could, of course, also be a stylus or other contact method. create a canvas <canvas id="canvas" width="600" height="600" style="border:solid black 1px;"> your browser does not support canvas element. </canvas> <br> log: <pre id="log" style="border: 1px solid #ccc;"></pre> setting up the event handlers when the page loads, the startup() function shown below will be called. function startup() { var el = document.getelementbyid("canvas"); el.addeventlistener("touchstart", handlestart, false); el.addeventlistener...
...then we get the context and pull the list of changed touch points out of the event's touchevent.changedtouches property. after that, we iterate over all the touch o...
...nuing touch "+idx); ctx.beginpath(); console.log("ctx.moveto(" + ongoingtouches[idx].pagex + ", " + ongoingtouches[idx].pagey + ");"); ctx.moveto(ongoingtouches[idx].pagex, ongoingtouches[idx].pagey); console.log("ctx.lineto(" + touches[i].pagex + ", " + touches[i].pagey + ");"); ctx.lineto(touches[i].pagex, touches[i].pagey); ctx.linewidth = 4; ctx.strokestyle = color; ctx.stroke(); ongoingtouches.splice(idx, 1, copytouch(touches[i])); // swap in the new touch record console.log("."); } else { console.log("can't figure out which touch to continue"); } } } this iterates over the changed touches as well, but it looks in our cached touch information array for the previous information about each touch to determine the ...
...list. ...
VisualViewport - Web APIs
ow to write a simple bit of code that will hide an overlaid box (which might contain an advert, say) when the user zooms in. this is a nice way to improve the user experience when zooming in on pages. a live sample is also available. var bottombar = document.getelementbyid('bottombar'); var viewport = window.visualviewport; function resizehandler() { if (viewport.scale > 1.3) bottombar.style.display = "none"; else bottombar.style.display = "block"; } window.visualviewport.addeventlistener('resize', resizehandler); simulating position: device-fixed this example, also taken from the visual viewport readme, shows how to use this api to simulate position: device-fixed, which fixes elements to the visual viewport. a live sample is also available. var bottombar = document.getel...
...youtviewport = document.getelementbyid('layoutviewport'); // since the bar is position: fixed we need to offset it by the visual // viewport's offset from the layout viewport origin. ...
...document.getelementbyid('layoutviewport'); // since the bar is position: fixed we need to offset it by the visual // viewport's offset from the layout viewport origin. ...
...bar is position: fixed we need to offset it by the visual // viewport's offset from the layout viewport origin. var offsetleft = viewport.offsetleft; var offsettop = viewport.height - layoutviewport.getboundingclientrect().height + viewport.offsettop; // you could also do this by setting style.left and style.top if you // use width: 100% instead. ...
Matrix math for the web - Web APIs
0, 0, 1, 0, x, y, z, 1 ]; place the distances along the three axes in the corresponding positions in the translation matrix, then multiply it by the point or matrix you need to move through 3d space. manipulating the dom with a matrix a really easy way to start using a matrix is to use the css matrix3d() transform. first we'll set up a simple <div> with some content. the style is not shown, but it's set to a fixed width and height and is centered on the page. the <div> has a transition set for the transform so that matrix is animated in making it easy to see what is being done. <div id='move-me' class='transformable'> <h2>move me with a matrix</h2> <p>lorem ipsum dolor sit amet, consectetur adipisicing elit...</p> </div> finally, for each of the examples we will...
... height and is centered on the page. the <div> has a transition set for the transform so that matrix is animated in making it easy to see what is being done. ...
...tur adipisicing elit...</p> </div> finally, for each of the examples we will generate a 4x4 matrix, then update the <div>'s style to have a transform applied to it, set to a matrix3d. bear in mind that even though the matrix is made up of 4 rows and 4 columns, it collapses into a single line of 16 values. matrices are always stored in one-dimensional lists in javascript. ...
...in typical (cartesian) coordinates. this causes stretching or contracting of the object in the corresponding directions. ...
Visualizations with Web Audio API - Web APIs
0, width, height); we now define the draw() function: function draw() { in here, we use requestanimationframe() to keep looping the drawing function once it has been started: var drawvisual = requestanimationframe(draw); next, we grab the time domain data and copy it into our array analyser.getbytetimedomaindata(dataarray); next, fill the canvas with a solid colour to start canvasctx.fillstyle = 'rgb(200, 200, 200)'; canvasctx.fillrect(0, 0, width, height); set a line width and stroke colour for the wave we will draw, then begin drawing a path canvasctx.linewidth = 2; canvasctx.strokestyle = 'rgb(0, 0, 0)'; canvasctx.beginpath(); determine the width of each segment of the line to be drawn by dividing the canvas width by the array length (equal to the frequencybincount, as defined ea...
...we have one available in voice-change-o-matic; let's look at how it's done. first, we again set up our analyser and data array, then clear the current canvas display with clearrect(). the only difference from before is that we have set the fft size to be much smaller; this is so that each bar in the graph is big enough to actually look like a bar rather than a thin strand. ...
... uint8array(bufferlength); canvasctx.clearrect(0, 0, width, height); next, we start our draw() function off, again setting up a loop with requestanimationframe() so that the displayed data keeps updating, and clearing the display with each animation frame. function draw() { drawvisual = requestanimationframe(draw); analyser.getbytefrequencydata(dataarray); canvasctx.fillstyle = 'rgb(0, 0, 0)'; canvasctx.fillrect(0, 0, width, height); now we set our barwidth to be equal to the canvas width divided by the number of bars (the buffer length). however, we are also multiplying that width by 2.5, because most of the frequencies will come back as having no audio in them, as most of the sounds we hear every day are in a certain lower frequency range. we don't want to di...
...rom the bottom of the canvas, not down from the top, as it would if we set the vertical position to 0. therefore, we instead set the vertical position each time to the height of the canvas minus barheight/2, so therefore each bar will be drawn from partway down the canvas, down to the bottom. for(var i = 0; i < bufferlength; i++) { barheight = dataarray[i]/2; canvasctx.fillstyle = 'rgb(' + (barheight+100) + ',50,50)'; canvasctx.fillrect(x,height-barheight/2,barwidth,barheight); x += barwidth + 1; } }; again, at the end of the code we invoke the draw() function to set the whole process in motion. draw(); this code gives us a result like the following: note: the examples listed in this article have shown usage of analysernode.getbytefreque...
Window.devicePixelRatio - Web APIs
correcting resolution in a <canvas> a <canvas> can appear too blurry on retina screens. use window.devicepixelratio to determine how much extra pixel density should be added to allow for a sharper image. html <canvas id="canvas"></canvas> javascript var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); // set display size (css pixels). ...
...as> a <canvas> can appear too blurry on retina screens. use window.devicepixelratio to determine how much extra pixel density should be added to allow for a sharper image. html <canvas id="canvas"></canvas> javascript var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); // set display size (css pixels). ...
...as.style.width = size + "px"; canvas.style.height = size + "px"; // set actual size in memory (scaled to account for extra pixel density). var scale = window.devicepixelratio; // change to 1 on retina screens to see blurry canvas. canvas.width = math.floor(size * scale); canvas.height = math.floor(size * scale); // normalize coordinate system to use css pixels. ...
..."px"; // set actual size in memory (scaled to account for extra pixel density). var scale = window.devicepixelratio; // change to 1 on retina screens to see blurry canvas. canvas.width = math.floor(size * scale); canvas.height = math.floor(size * scale); // normalize coordinate system to use css pixels. ...
Window - Web APIs
Web › API › Window
obal window seen by javascript code running within a given tab always represents the tab in which the code is running. that said, even in a tabbed browser, some properties and methods still apply to the overall window that contains the tab, such as resizeto() and innerheight. generally, anything that can't reasonably pertain to a tab pertains to the window instead. ...
...rowser, some properties and methods still apply to the overall window that contains the tab, such as resizeto() and innerheight. generally, anything that can't reasonably pertain to a tab pertains to the window instead. ...
...callback. window.clearimmediate() cancels the repeated execution set using setimmediate. window.close() closes the current window. window.confirm() displays a dialog with a message that the user needs to respond to. window.dump() writes a message to the console. window.find() searches for a given string in a window. window.focus() sets focus on the current window. window.getcomputedstyle() gets computed style for the specified element. computed style indicates the computed values of all css properties of the element. window.getdefaultcomputedstyle() gets default computed style for the specified element, ignoring author stylesheets. window.getselection() returns the selection object representing the selected item(s). window.matchmedia() returns a mediaquerylist object rep...
...r property. popstate fired when the active history entry changes. also available using the onpopstate event handler property. load & unload events beforeunload fired when the window, the document and its resources are about to be unloaded. also available via the onbeforeunload property. domcontentloaded fired when the document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading. load fired when the whole page has loaded, including all dependent resources such as stylesheets images. also available via the onload property. unload fired when the document or a child resource is being unloaded. also available via the onunload property. manifest events appinstalled fired when the browser has successfully installed a p...
Web accessibility for seizures and physical reactions - Accessibility
terchangably, they are not the same. according to the w3c, blinking is a distraction problem, whereas flashing refers to content that occurs more than 3 times per second, is large enough, and bright enough. section 508 prohibits flickering effects with a frequency greater than 3 hz (flickers per second) and lower than 55 hz. the epilepsy foundation's article "take advantage of media queries with <style> in setting up media queries, you are enabling controls by the user; these controls are made available in the browser or in the os. see the mdn document, "accessibility: what users can to to browse more safely" to see more details of how a user accesses the controls. prefers-reduced-motion support for prefers-reduced-motion in modern browsers is growing. @media screen and (prefers-reduced-mot...
...dn document, prefers-reduced-motion, or see the example below from the section on new in chrome 74. button { animation: vibrate 0.3s linear infinite both; } @media (prefers-reduced-motion: reduce) { button { animation: none; } } prefers-color-scheme this can be useful if the ambient light api is not available. support is emerging. @media (prefers-color-scheme: dark) { /* adust styles for dark mode */ } window​.match​media() there is a powerful tool available to developers via window.matchmedia(). a great resource is mdn's document on window.matchmedia() media update feature the more often the screen is refreshed, the more stable it appears to the human eye, and the less it "flickers". the vast majority of modern technology refreshes at a rate that does not cause prob...
...he brightess of the screen automatically. the specifications also note the difference in technology, such as e-ink, which remains readable in bright daylight, versus liquid crystals, which do not. environment-blending from w3c's draft document, media queries level 5: "the environment-blending media feature is used to query the characteristics of the user’s display so the author can adjust the style of the document. an author might choose to adjust the visuals and/or layout of the page depending on the display technology to increase the appeal or improve legibility." user preference media features (planned in media queries level 5) user preference media features in w3c editor's draft media queries level 5 are especially promising in providing user control over media. here are some highligh...
...r palette on the page". the user will need to be made aware of this ability, and it will need to play nice with the appropriate value for the prefers-color-scheme media query. light-level from w3c's draft document, media queries level 5 section on light-level: "the light-level media feature is used to query about the ambient light-level in which the device is used, to allow the author to adjust style of the document in response." this will be a godsend to those who have motor-skills problems, or for some with cognitive difficulties, who cannot find the right "button" to change their screen settings. prefers-contrast from w3c's draft document, media queries level 5 section on prefers-contrast: "the prefers-contrast media feature is used to detect if the user has requested the system increase...
EXSLT
exslt modules to use an exslt function, you need to declare the namespace the function is in, and then use the appropriate prefix when calling the function. for example, to use the regular ex...
... (set)the exslt sets package offers functions that let you perform set manipulation.strings (str)the exslt strings package provides functions that allow the manipulation of strings. exslt modules to use an exslt function, you need to declare the namespace the function is in, and then use the appropriate prefix when calling the function. ...
...the namespace for the common package is http://exslt.org/common. ...
...) exsl:object-type() math the exslt math package provides functions for working with numeric values and comparing nodes. the namespace for the math package is http://exslt.org/math. functions math:highest() math:lowest() math:max() math:min() regular expressions the exslt regular expressions package provides functions that allow testing, matching, and replacing text using javascript style regular expressions. the exslt regular expressions namespace is http://exslt.org/regular-expressions. functions regexp:match() regexp:replace() regexp:test() sets the exslt sets package offers functions that let you perform set manipulation. the namespace for these functions is http://exslt.org/sets. functions set:difference() set:distinct() set:intersection() set:has-same-node...
Block formatting context - Developer guides
of flow-root makes sense when you understand you are creating something that acts like the root element (<html> element in browser) in terms of how it creates a new context for the flow layout inside it. ...
...html <section> <div class="box"> <div class="float">i am a floated box!</div> <p>i am content inside the container.</p> </div> </section> <section> <div class="box" style="overflow:auto"> <div class="float">i am a floated box!</div> <p>i am content inside the <code>overflow:auto</code> container.</p> </div> </section> <section> <div class="box" style="display:flow-root"> <div class="float">i am a floated box!</div> <p>i am content inside the <code>display:flow-root</code> container.</p> </div> </section> css section { height:150px; } .box { background-color: rgb(224, 206, 247); border: 5px solid rebeccapurple; } .box[style] { background-color: aliceblue; border: 5px solid steelblue; } .float { f...
... columns layout, beacuse an element in the normal flow that establishes a new bfc must not overlap the margin box of any floats in the same block formatting context as the element itself. ...
...lass="float">try to resize this outer float</div> <div class="box"><p>normal</p></div> </section> <section> <div class="float">try to resize this outer float</div> <div class="box" style="display:flow-root"><p><code>display:flow-root</code><p></div> </section> css section { height:150px; } .box { background-color: rgb(224, 206, 247); border: 5px solid rebeccapurple; } .box[style] { background-color: aliceblue; border: 5px solid steelblue; } .float { float: left; overflow: hidden; /* required by resize:both */ resize: both; margin-right:25px; width: 200px; height: 100px; background-color: rgba(255, 255, 255, .75); border: 1px solid black; padding: 10px; } rather than inline-blocks with width:<percentage>, in ...
<input type="month"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › month
ue="submit form"> </div> </form> if you try to submit the form without both the month and year specified (or with a date outside the set bounds), the browser displays an error. try playing with the example now: here's a screenshot for those of you who aren't using a supporting browser: here's the css used in the above example. here we make use of the :valid and :invalid css properties to style the input based on whether or not the current value is valid. we had to put the icons on a <span> next to the input, not on the input itself, because in chrome the generated content is placed inside the form control, and can't be styled or shown effectively. div { margin-bottom: 10px; position: relative; } input[type="number"] { width: 100px; } input + span { padding-right: 30px; } in...
...d show the fallback picker ui instead. ...
... // define variables var nativepicker = document.queryselector('.nativedatepicker'); var fallbackpicker = document.queryselector('.fallbackdatepicker'); var fallbacklabel = document.queryselector('.fallbacklabel'); var yearselect = document.queryselector('#year'); var monthselect = document.queryselector('#month'); // hide fallback initially fallbackpicker.style.display = 'none'; fallbacklabel.style.display = 'none'; // test whether a new date input falls back to a text input or not var test = document.createelement('input'); try { test.type = 'month'; } catch (e) { console.log(e.description); } // if it does, run the code inside the if() {} block if(test.type === 'text') { // hide the native picker and show the fallback nativepicker.style.display = 'none'; fallbackpicker.style.
... a new date input falls back to a text input or not var test = document.createelement('input'); try { test.type = 'month'; } catch (e) { console.log(e.description); } // if it does, run the code inside the if() {} block if(test.type === 'text') { // hide the native picker and show the fallback nativepicker.style.display = 'none'; fallbackpicker.style.display = 'block'; fallbacklabel.style.display = 'block'; // populate the years dynamically // (the months are always the same, therefore hardcoded) populateyears(); } function populateyears() { // get the current year as a number var date = new date(); var year = date.getfullyear(); // make this year, and the 100 years before it available in the year <select> for(var i = 0; i <= 100; i++) { var option = documen...
<input type="number"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › number
ad. the input for the height in meters accepts decimals to two places. the html looks like this: <form> <div class="metersinputgroup"> <label for="meters">enter your height — meters:</label> <input id="meters" type="number" name="meters" step="0.01" min="0" placeholder="e.g. ...
...e="submit" value="submit form"> </div> </form> you'll see that we are using many of the attributes we've already looked at in the article earlier on. since we want to accept a meter value in centimeters, we've set the step value to 0.01, so that values like 1.78 are not seen as invalid. we've also provided a placeholder for that input. we've hidden the feet and inches inputs initially using style="display: none;", so that meters is the default entry type. now, onto the css. this looks very similar to the validation styling we saw before; nothing remarkable here. div { margin-bottom: 10px; position: relative; } input[type="number"] { width: 100px; } input + span { padding-right: 30px; } input:invalid+span:after { position: absolute; content: '✖'; padding-left: 5px; } ...
...tor('#meters'); let feetinput = document.queryselector('#feet'); let inchesinput = document.queryselector('#inches'); let switchbtn = document.queryselector('input[type="button"]'); switchbtn.addeventlistener('click', function() { if(switchbtn.getattribute('class') === 'meters') { switchbtn.setattribute('class', 'feet'); switchbtn.value = 'enter height in meters'; metersinputgroup.style.display = 'none'; feetinputgroup.style.display = 'block'; feetinput.setattribute('required', ''); inchesinput.setattribute('required', ''); metersinput.removeattribute('required'); metersinput.value = ''; } else { switchbtn.setattribute('class', 'meters'); switchbtn.value = 'enter height in feet and inches'; metersinputgroup.style.display = 'block'; feetin...
...= 'none'; feetinputgroup.style.display = 'block'; feetinput.setattribute('required', ''); inchesinput.setattribute('required', ''); metersinput.removeattribute('required'); metersinput.value = ''; } else { switchbtn.setattribute('class', 'meters'); switchbtn.value = 'enter height in feet and inches'; metersinputgroup.style.display = 'block'; feetinputgroup.style.display = 'none'; feetinput.removeattribute('required'); inchesinput.removeattribute('required'); metersinput.setattribute('required', ''); feetinput.value = ''; inchesinput.value = ''; } }); after declaring a few variables, an event listener is added to the button to control the switching mechanism. this is pretty simple, mostly involving changing over the button's class...
<input type="time"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › time
re setting a minimum time of 12:00 and a maximum time of 18:00: <form> <label for="appt-time">choose an appointment time (opening hours 12:00 to 18:00): </label> <input id="appt-time" type="time" name="appt-time" min="12:00" max="18:00"> <span class="validity"></span> </form> here's the css used in the above example. here we make use of the :valid and :invalid css properties to style the input based on whether or not the current value is valid. we had to put the icons on a <span> next to the input, not on the input itself, because in chrome the generated content is placed inside the form control, and can't be styled or shown effectively. div { margin-bottom: 10px; position: relative; } input[type="number"] { width: 100px; } input + span { padding-right: 30px; } in...
...lback picker ui (<select>s) instead. ...
...// define variables var nativepicker = document.queryselector('.nativetimepicker'); var fallbackpicker = document.queryselector('.fallbacktimepicker'); var fallbacklabel = document.queryselector('.fallbacklabel'); var hourselect = document.queryselector('#hour'); var minuteselect = document.queryselector('#minute'); // hide fallback initially fallbackpicker.style.display = 'none'; fallbacklabel.style.display = 'none'; // test whether a new date input falls back to a text input or not var test = document.createelement('input'); try { test.type = 'time'; } catch (e) { console.log(e.description); } // if it does, run the code inside the if() {} block if(test.type === 'text') { // hide the native picker and show the fallback nativepicker.style.display = 'none'; fallbackpicker.style.d...
...r a new date input falls back to a text input or not var test = document.createelement('input'); try { test.type = 'time'; } catch (e) { console.log(e.description); } // if it does, run the code inside the if() {} block if(test.type === 'text') { // hide the native picker and show the fallback nativepicker.style.display = 'none'; fallbackpicker.style.display = 'block'; fallbacklabel.style.display = 'block'; // populate the hours and minutes dynamically populatehours(); populateminutes(); } function populatehours() { // populate the hours <select> with the 6 open hours of the day for(var i = 12; i <= 18; i++) { var option = document.createelement('option'); option.textcontent = i; hourselect.appendchild(option); } } function populateminutes() { // popul...
<input type="week"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › week
ing example we are setting a minimum value of week 01, 2017 and a maximum value of week 52, 2017: <form> <label for="week">what week would you like to start?</label> <input id="week" type="week" name="week" min="2017-w01" max="2017-w52"> <span class="validity"></span> </form> here's the css used in the above example. here we make use of the :valid and :invalid css properties to style the input based on whether or not the current value is valid. we had to put the icons on a <span> next to the input, not on the input itself, because in chrome the generated content is placed inside the form control, and can't be styled or shown effectively. div { margin-bottom: 10px; position: relative; } input[type="number"] { width: 100px; } input + span { padding-right: 30px; } in...
...k picker ui (<select>s) instead. ...
...efine variables var nativepicker = document.queryselector('.nativeweekpicker'); var fallbackpicker = document.queryselector('.fallbackweekpicker'); var fallbacklabel = document.queryselector('.fallbacklabel'); var yearselect = document.queryselector('#year'); var weekselect = document.queryselector('#fallbackweek'); // hide fallback initially fallbackpicker.style.display = 'none'; fallbacklabel.style.display = 'none'; // test whether a new date input falls back to a text input or not var test = document.createelement('input'); try { test.type = 'week'; } catch (e) { console.log(e.description); } // if it does, run the code inside the if() {} block if(test.type === 'text') { // hide the native picker and show the fallback nativepicker.style.display = 'none'; fallbackpicker.style.d...
...("0" + i) : i; weekselect.appendchild(option); } } note: remember that some years have 53 weeks in them (see weeks per yea...
<ul>: The Unordered List element - HTML: Hypertext Markup Language
Web › HTML › Element › ul
ny element that accepts flow content. implicit aria role list permitted aria roles directory, group, listbox, menu, menubar, none, presentation, radiogroup, tablist, toolbar, tree dom interface htmlulistelement attributes this element includes the global attributes. compact this boolean attribute hints that the list should be rendered in a compact style. the interpretation of this attribute depends on the user agent, and it doesn't work in all browsers. warning: do not use this attribute, as it has been deprecated: use css instead. to give a similar effect as the compact attribute, the css property line-height can be used with a value of 80%. type this attribute sets the bullet style for the list. the values defined under html3.2 and...
...mpact attribute, the css property line-height can be used with a value of 80%. type this attribute sets the bullet style for the list. the values defined under html3.2 and the transitional version of html 4.0/4.01 are: circle disc square a fourth bullet type has been defined in the webtv interface, but not all browsers support it: triangle. if not present and if no css list-style-type property applies to the element, the user agent selects a bullet type depending on the nesting level of the list. warning: do not use this attribute, as it has been deprecated; use the css list-style-type property instead. usage notes the <ul> element is for grouping a collection of items that do not have a numerical ordering, and their order in the list is meaningless. typically, u...
... the <ul> and <ol> elements may be nested as deeply as desired. moreover, the nested lists may alternate between <ol> and <ul> without restriction. the <ol> and <ul> elements both represent a list of items. ...
... the <ul> and <ol> elements may be nested as deeply as desired. ...
Global attributes - HTML: Hypertext Markup Language
that non-editable elements are in, or the language that editable elements should be written in by the user. the attribute contains one “language tag” (made of hyphen-separated “language subtags”) in the format defined in tags for identifying languages (bcp47). xml:lang has priority over it. part a space-separated list of the part names of the element. part names allows css to select and style specific elements in a shadow tree via the ::part pseudo-element. slot assigns a slot in a shadow dom shadow tree to an element: an element with a slot attribute is assigned to the slot created by the <slot> element whose name attribute's value matches that slot attribute's value. spellcheck an enumerated attribute defines whether the element may be checked for spelling errors. it may have th...
...lot> element whose name attribute's value matches that slot attribute's value. spellcheck an enumerated attribute defines whether the element may be checked for spelling errors. it may have the following values: true, which indicates that the element should be, if possible, checked for spelling errors; false, which indicates that the element should not be checked for spelling errors. style contains css styling declarations to be applied to the element. note that it is recommended for styles to be defined in a separate file or files. this attribute and the <style> element have mainly the purpose of allowing for quick styling, for example for testing purposes. tabindex an integer attribute indicating if the element can take input focus (is focusable), if it should participate to s...
...lobal attributes' in that specification. recommendation snapshot of html living standard. from html5, contextmenu, draggable, dropzone, and spellcheck have been added. html5the definition of 'global attributes' in that specification. recommendation snapshot of html living standard. from html 4.01 specification, the concept of global attributes is introduced and the dir, lang, style, id, class, tabindex, accesskey, and title are now true global attributes. xml:lang which was initially part of xhtml, is now also part of html. hidden, data-*, contenteditable, and translate have been added. html 4.01 specification recommendation there are no global attributes defined. several attributes that will become global attributes in subsequent specifications are d...
...e now true global attributes. xml:lang which was initially part of xhtml, is now also part of html. hidden, data-*, contenteditable, and translate have been added. html 4.01 specification recommendation there are no global attributes defined. several attributes that will become global attributes in subsequent specifications are defined on a subset of elements. class and style are supported on all elements but <base>, <basefont>, <head>, <html>, <meta>, <param>, <script>, <style>, and <title>. dir is supported on all elements but <applet>, <base>, <basefont>, <bdo>, <br>, <frame>, <frameset>, <iframe>, <param>, and <script>. id is supported on all elements but <base>, <head>, <html>, <meta>, <script>, <style>, and <title>. lang is supported on all elements ...
CSP: script-src - HTTP
csp version 1 directive type fetch directive default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. ...
......
...ce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. see unsafe inline script for an example. in csp 2.0, this applie...
...however, if you absolutely have to use it, there are a few mechanisms that will allow them. to allow inline scripts and inline event handlers, 'unsafe-inline', a nonce-source or a hash-source that matches the inline block can be specified. content-security-policy: script-src 'unsafe-inline'; the above content security poli...
Index - HTTP
Web › HTTP › Headers › Index
the accept request http header advertises which content types, expressed as mime types, the client is able to understand. using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice with the content-type response header. browsers set adequate values for this header depending on the context where the request is done: when fetching a css stylesheet a different value is set for the request than when fetching an image, video or a script. 3 accept-charset content negotiation, http, http header, reference, request header the accept-charset request http header advertises which character set the client is able to understand. using content negotiation, the server then selects one of the proposals, uses it and informs the ...
...e user agent to report attempts to violate the content security policy. these violation reports consist of json documents sent via an http post request to the specified uri. 45 csp: require-sri-for csp, directive, http, reference, security the http content-security-policy require-sri-for directive instructs the client to require the use of subresource integrity for scripts or styles on the page. 46 csp: sandbox csp, directive, http, security the http content-security-policy (csp) sandbox directive enables a sandbox for the requested resource similar to the <iframe> sandbox attribute. it applies restrictions to a page's actions including preventing popups, preventing the execution of plugins and scripts, and enforcing a same-origin policy. 47 ...
...enting the execution of plugins and scripts, and enforcing a same-origin policy. 47 csp: script-src csp, directive, http, reference, security the http content-security-policy (csp) script-src directive specifies valid sources for javascript. this includes not only urls loaded directly into <script> elements, but also things like inline script event handlers (onclick) and xslt stylesheets which can trigger script execution. 48 csp: style-src csp, directive, http, reference, security the http content-security-policy (csp) style-src directive specifies valid sources for stylesheets. 49 csp: upgrade-insecure-requests csp, directive, http, reference, security the http content-security-policy (csp) upgrade-insecure-requests directive inst...
...e media type of the resource. 54 cookie cookies, http, reference, header, request the cookie http request header contains stored http cookies previously sent by the server with the set-cookie header. 55 cookie2 http, obsolete, reference, header, request the obsolete cookie2 http request header used to advise the server that the user agent understands "new-style" cookies, but nowadays user agents will use the cookie header instead, not this one. 56 dnt dnt, http, reference, header the dnt (do not track) request header indicates the user's tracking preference. it lets users indicate whether they would prefer privacy rather than personalized content. 57 date general header, http, reference, header the date general ...
Intl.ListFormat - JavaScript
nts of the list. intl.listformat.prototype.formattoparts() returns an array of objects representing the different components that can be used to format a list of values in a locale-aware fashion. examples using format the following example shows how to create a list formatter using the english language. ...
...that can be used to format a list of values in a locale-aware fashion. examples using format the following example shows how to create a list formatter using the english language. ...
...w to create a list formatter using the english language. ...
...b', { style: 'short', type: 'disjunction' }).format(list)); // > motorcycle, bus or car console.log(new intl.listformat('en-gb', { style: 'narrow', type: 'unit' }).format(list)); // > motorcycle bus car using formattoparts the following example shows how to create a list formatter returning formatted parts const list = ['motorcycle', 'bus', 'car']; console.log(new intl.listformat('en-gb', { style: 'long', type: 'conjunction' }).formattoparts(list)); // [ { "type": "element", "value": "motorcycle" }, // { "type": "literal", "value": ", " }, // { "type": "element", "value": "bus" }, // { "type": "literal", "value": ", and " }, // { "type": "element", "value": "car" } ]; specifications specification intl.listformatthe definition of 'listformat' in that speci...
<mo> - MathML
Web › MathML › Element › mo
an operator in a broad sense. besides operators in strict mathematical meaning, this element also includes "operators" like parentheses, separators like comma and semicolon, or "absolute value" bars. attributes accent if the operator is used as an under- or overscript this attribute specifies whether the operator should be treated as an accent. allowed values are true or false. class, id, style provided for use with stylesheets. dir the text direction. possible values are either ltr (left to right) or rtl (right to left). fence there is no visual effect for this attribute, but it specifies whether the operator is a fence (such as parentheses). allowed values are true or false. form specifies the role of the operator in an enclosed expression, which affects spacing and other defa...
...ne argument.) infix, for separators. (it is the default value if the operator is not included in a <mrow> element.) postfix, closing fences. (it is the default value if the operator is the last argument in a <mrow> element with more than one argument.) href used to set a hyperlink to a specified uri. largeop specifies whether the operator should be drawn larger than normal when displaystyle="true" is set. allowed values are either true or false. lspace the amount of space before the operator (see length for values and units). the constant thickmathspace (5/18em) is the default value. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. mathsize the size of the content. s...
... html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. mathsize the size of the content. see length for possible values. deprecated values are: small, normal and big. these will be removed in the future. mathvariant this attribute specifies the logical class of the operator which varies in typography. that is, although the names suggest the typographic style for the class, semantically, items with the same class are treated "the same" within an expression, which might or might not involve displaying them with the named typography. the following values are allowed: normal (default value) ; example bold ; example italic ; example bold-italic ; example double-struck ; example bold-fraktur ; example script ; example bold-script ; e...
...retchy is true, this attribute specifies the maximum size of the operator. allowed values are: infinity an arbitrary length minsize if stretchy is true, this attribute specifies the minimum size of the operator. allowed values are: infinity an arbitrary length movablelimits specifies whether attached under- and overscripts move to sub- and superscript positions when displaystyle is false. allowed values are either true or false. rspace the amount of space after the operator (see length for values and units). the constant thickmathspace (5/18em) is the default value. separator there is no visual effect for this attribute, but it specifies whether the operator is a separator (such as commas). allowed values are true or false. stretchy specifies whether the operator...
<mtable> - MathML
Web › MathML › Element › mtable
attributes align specifies the vertical alignment of the table with respect to its environment. ...
... attributes align specifies the vertical alignment of the table with respect to its environment. ...
...than the whole table. a negative integer value counts rows from the bottom of the table. starting with gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5) the interpretation of negative values has been corrected (bug 601436). in gecko 17.0 (firefox 17.0 / thunderbird 17.0 / seamonkey 2.14) the parsing has been updated to treat whitespace correctly. alignmentscope unimplemented class, id, style provided for use with stylesheets. columnalign specifies the horizontal alignment of the cells. multiple values separated by space are allowed and apply to the corresponding columns (e.g. columnalign="left right center"). possible values are: left, center (default) and right. columnlines specifies column borders. multiple values separated by space are allowed and apply to the corresponding c...
...e values are: left, center (default) and right. columnlines specifies column borders. multiple values separated by space are allowed and apply to the corresponding columns (e.g. columnlines="none none solid"). possible values are: none (default), solid and dashed. columnspacing specifies the space between table columns. unimplemented columnwidth specifies the width of table columns. displaystyle a boolean value specifying whether more vertical space is used for displayed equations or, if set to false, a more compact layout is used to display formulas. the main effect is that larger versions of operators are displayed, when displaystyle is set to true. unimplemented equalcolumns a boolean value indicating whether to force all columns to have the same total height. false is default. un...
Content type - SVG: Scalable Vector Graphics
for properties defined in css2, an angle unit identifier must be provided. ...
... #<elementid> or #xpointer(id<elementid>)). non-local iri references, where the iri reference does contain an <absoluteiri> or <relativeiri>. for the full specification of iri references in svg, see svg 1.1 (2nd edition): iri references. length <length> a length is a distance measurement, given as a number along with a unit. lengths are specified in one of two ways. when used in a stylesheet, a <length> is defined as follows: length ::= number (~"em" | ~"ex" | ~"px" | ~"in" | ~"cm" | ~"mm" | ~"pt" | ~"pc")? see the css2 specification for the meanings of the unit identifiers. for properties defined in css2, a length unit identifier must be provided. for length values in svg-specific properties and their corresponding presentation attributes, the length unit identifier is op...
...e t. for example, a <list-of-lengths> is represented in the svg dom using an svglengthlist or svganimatedlengthlist object. name <name> a name, which is a string where a few characters of syntactic significance are disallowed. name ::= [^,()#x20#x9#xd#xa] /* any char except ",", "(", ")" or wsp */ number <number> real numbers are specified in one of two ways. when used in a stylesheet, a <number> is defined as follows: number ::= integer | [+-]? [0-9]* "." [0-9]+ this syntax is the same as the definition in css (css2, section 4.3.1). when used in an svg attribute, a <number> is defined differently, to allow numbers with large magnitudes to be specified more concisely: number ::= integer ([ee] integer)? | [+-]? [0-9]* "." [0-9]+ ([ee] integer)...
...iven graphics element. the available options and syntax for <paint> are described in specifying paint. within the svg dom, <paint> values are represented using svgpaint objects. percentage <percentage> percentages are specified as a number followed by a "%" character: percentage ::= number "%" note that the definition of <number> depends on whether the percentage is specified in a stylesheet or in an attribute that is not also a presentation attribute. percentage values are always relative to another value (for example, a length). each attribute or property that allows percentages also defines the reference distance measurement to which the percentage refers. within the svg dom, a <percentage> is represented using an svgnumber or svganimatednumber object. time <time> ...
<feDropShadow> - SVG: Scalable Vector Graphics
value type: <number>; default value: 2; animatable: yes dy this attribute defines the y offset of the dro...
... value type: <number>; default value: 2; animatable: yes dy this attribute defines the y offset of the drop shadow. value type: <number>; default value: 2; animatable: yes stddeviation t...
...lood-color="cyan"/> </filter> <filter id="shadow3"> <fedropshadow dx="-0.8" dy="-0.8" stddeviation="0" flood-color="pink" flood-opacity="0.5"/> </filter> </defs> <circle cx="5" cy="50%" r="4" style="fill:pink; filter:url(#shadow);"/> <circle cx="15" cy="50%" r="4" style="fill:pink; filter:url(#shadow2);"/> <circle cx="25" cy="50%" r="4" style="fill:pink; filter:url(#shadow3);"/> </svg> attributes dx this attribute defines the x offset of the drop shadow. value type: <number>; default value: 2; animatable: yes dy this attribute defines the y offset of the drop shadow. value type: <number>; default value: 2; animatable: yes stddeviation this attribute defines the standard deviation for the blur operation in the drop shadow...
...; default value: 2; animatable: yes dy this attribute defines the y offset of the drop shadow. value type: <number>; default value: 2; animatable: yes stddeviation this attribute defines the standard deviation for the blur operation in the drop shadow. ...
<glyph> - SVG: Scalable Vector Graphics
Web › SVG › Element › glyph
h> defines a single glyph in an svg font. usage context categoriestext content elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> attributes global attributes core attributes presentation attributes class style specific attributes d horiz-adv-x vert-origin-x vert-origin-y vert-adv-y unicode glyph-name orientation arabic-form lang dom interface this element implements the svgglyphelement interface. example svg <svg width="400px" height="300px" version="1.1" xmlns="ht...
...ientation arabic-form lang dom interface this element implements the svgglyphelement interface. ...
... recommendation initial definition ...
... recommendation initial definition ...
<metadata> - SVG: Scalable Vector Graphics
Web › SVG › Element › metadata
used by hub symbol --> <symbol id="hubplug"> <desc>a 10baset/100basetx socket</desc> <path d="m0,10 h5 v-9 h12 v9 h5 v16 h-22 z"/...
...used by hub symbol --> <symbol id="hubplug"> <desc>a 10baset/100basetx socket</desc> <path d="m0,10 h5 v-9 h12 v9 h5 v16 h-22 z"/> </symbol> <!-- hub symb...
...nds rdf:resource="#socket4"/> <connect:ends rdf:resource="#socket5"/> </rdf:description> </rdf:rdf> </metadata> <title>network</title> <desc>an example of a computer network based on a hub.</desc> <style> svg { /* default styles to be inherited */ fill: white; stroke: black; } text { fill: black; stroke: none; } path { fill: none; } </style> <!-- define symbols used in the svg --> <defs> <!-- hubplug symbol. used by hub symbol --> <symbol id="hubplug"> <desc>a 10baset/100basetx socket</desc> <path d="m0,10 h5 v-9 h12 v9 h5 v16 h-22 z"/> </symbol> <!-- hub symbol --> <symbol id="hub"> <desc>a typical 10baset/100basetx network hub</desc> <text x="0" y="15">hub</text> <g transfor...
... 10 s 40 12 70 10 l 80 20z"/> </g> <g id="monitor"> <title>monitor</title> <desc>a very fancy monitor</desc> <rect width="160" height="120"/> <rect fill="lightgrey" width="138" height="95" x="11" y="12"/> </g> <g id="processor" transform="translate(0 142)"> <title>the computer</title> <desc>a desktop computer - broad flat box style</desc> <rect width="160" height="60"/> <g id="discdrive" transform="translate(70 8)"> <title>disc drive</title> <desc>a built-in disc drive</desc> <rect width="58" height="3" x="12" y="8"/> <rect width="8" height="2" x="12" y="15"/> </g> <circle cx="135" cy="40" r="5"/> </g> </symbol> </defs> <text x="0" y="15...
<text> - SVG: Scalable Vector Graphics
Web › SVG › Element › text
possible to apply a gradient, pattern, clipping path, mask, or filter to <text>, like any other svg graphics element. if text is included in svg not inside of a <text> element, it is not rendered. this is different than being hidden by default, as setting the display property won't show the text. ...
...operty won't show the text. html,body,svg { height:100% } <svg viewbox="0 0 240 80" xmlns="http://www.w3.org/2000/svg"> <style> .small { font: italic 13px sans-serif; } .heavy { font: bold 30px sans-serif; } /* note that the color of the text is set with the * * fill property, the color property is for html only */ .rrrrr { font: italic 40px serif; fill: red; } </style> <text x="20" y="35" class="small">my</text> <text x="40" y="35" class="heavy">cat</text> <text x="55" y="55" class="small">is</text> <text x="65" y="55" class="rrrrr">grumpy!</text> </svg> attributes x the x coordinate of the starting point of the text baseline. value type: <length>|<percentage> ; default value: 0; animatable: yes y the y coordinate of the starting point of t...
...w the text is stretched or compressed to fit the width defined by the textlength attribute. value type: spacing|spacingandglyphs; default value: spacing; animatable: yes textlength a width that the text should be scaled to fit. ...
...e textlength attribute. value type: spacing|spacingandglyphs; default value: spacing; animatable: yes textlength a width that the text should be scaled to fit. ...
SVG fonts - SVG: Scalable Vector Graphics
r plugin, batik and parts of inkscape support svg font embedding. the base for defining an svg font is the <font> element. defining a font there are some ingredients required for embedding a font in svg. let's show an example declaration (the one from the specification), and explain the details. ...
...ribute determines how wide a character is on average compared to the path definitions of the single glyphs. the value 1000 sets a reasonable value to work with. there are several accompanying attributes that help further define the basic glyph-box layout. the <font-face> element is the svg equivalent of the css @font-face declaration. it defines basic properties of the final font such as weight, style, etc. in the example above the first and most important to be defined is font-family, the value of which can then be referenced in css and svg font-family properties. the font-weight and font-style attributes have the same purpose as the equivalent descriptors in css. all following attributes are rendering instructions for the font layout engine, for example, how much of the glyphs' overall heigh...
...<font> <font-face font-family="super sans" /> <!-- and so on --> </font> <text font-family="super sans">my text uses super sans</text> however, you are free to combine several methods for great freedom of how and where to define the font. ...
...y="super sans">my text uses super sans</text> however, you are free to combine several methods for great freedom of how and where to define the font. ...
Texts - SVG: Scalable Vector Graphics
Web › SVG › Tutorial › Texts
efer to gradients or patterns, which makes simple coloring text in svg very powerful compared to css 2.1. setting font properties an essential part of a text is the font in which it is displayed. svg offers a set of attributes, many similar to their css counterparts, to enable font selection. each of the following properties can be set as an attribute or via a css declaration: font-family, font-style, font-weight, font-variant, font-stretch, font-size, font-size-adjust, kerning, letter-spacing, word-spacing and text-decoration. other text-related elements tspan this element is used to mark up sub-portions of a larger text. it must be a child of a text element or another tspan element. a typical usecase is to paint one word of a sentence bold red. <text> this is <tspan font-weight="bold"...
...ons of a larger text. it must be a child of a text element or another tspan element. a typical usecase is to paint one word of a sentence bold red. <text> this is <tspan font-weight="bold" fill="red">bold and red</tspan> </text> playable code <svg width="350" height="60" xmlns="http://www.w3.org/2000/svg"> <text> this is <tspan font-weight="bold" fill="red">bold and red</tspan> </text> <style><![cdata[ text{ dominant-baseline: hanging; font: 28px verdana, helvetica, arial, sans-serif; } ]]></style> </svg> the tspan element has the following custom attributes: x set a new absolute x coordinate for the containing text. this overwrites the default current text position. the attribute may also contain a list of numbers, that are one by one applied to the single charac...
...ext> <textpath xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#my_path"> a curve. ...
... playable code 2 <svg width="200" height="100" xmlns="http://www.w3.org/2000/svg"> <path id="my_path" d="m 20,20 c 80,60 100,40 120,20" fill="transparent" /> <text> <textpath xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#my_path"> a curve. </textpath> </text> <style><![cdata[ text{ dominant-baseline: hanging; font: 28px verdana, helvetica, arial, sans-serif; } ]]></style> </svg> « previousnext » ...
Subresource Integrity - Web security
urce-integrity verification of a resource served from an origin other than the document in which it’s embedded, browsers additionally check the resource using cross-origin resource sharing (cors), to ensure the origin serving the resource allows it to be shared with the requesting origin. how subresource integrity helps using content delivery networks (cdns) to host files such as scripts and stylesheets that are shared among multiple sites can improve site performance and conserve bandwidth. however, using cdns also comes with a risk, in that if an attacker gains control of a cdn, the attacker can inject arbitrary malicious content into files on the cdn (or replace the files completely) and thus can also potentially attack all sites that fetch files from that cdn. subresource integrity en...
... hash: sha384-oqvuafxrkap7fdgccy5uykm6+r9gqq8k/uxy9rx7hnqlgyl1kpzqho1wx4jwy8wc so oqvuafxrkap7fdgccy5uykm6+r9gqq8k/uxy9rx7hnqlgyl1kpzqho1wx4jwy8wc is the "hash" part, and the prefix sha384 indicates that it's a sha384 hash. note: an integrity value's "hash" part is, strictly speaking, a cryptographic digest formed by applying a particular hash function to some input (for example, a script or stylesheet file). but it’s common to use the shorthand "hash" to mean cryptographic digest, so that's what's used in this article. tools for generating sri hashes you can generate sri hashes from the command-line with openssl using a command invocation such as this: cat filename.js | openssl dgst -sha384 -binary | openssl base64 -a or with shasum using a command invocation such as this: shasum ...
...rx7hnqlgyl1kpzqho1wx4jwy8wc" crossorigin="anonymous"></script> note: for more details on the purpose of the crossorigin attribute, see cors settings attributes. how browsers handle subresource integrity browsers handle sri by doing the following: when a browser encounters a <script> or <link> element with an integrity attribute, before executing the script or before applying any stylesheet specified by the <link> element, the browser must first compare the script or stylesheet to the expected hash given in the integrity value. note: for subresource-integrity verification of a resource served from an origin other than the document in which it’s embedded, browsers additionally check the resource using cross-origin resource sharing (cors), to ensure the origin serving the res...
...ipt or stylesheet to the expected hash given in the integrity value. note: for subresource-integrity verification of a resource served from an origin other than the document in which it’s embedded, browsers additionally check the resource using cross-origin resource sharing (cors), to ensure the origin serving the resource allows it to be shared with the requesting origin. if the script or stylesheet doesn’t match its associated integrity value, the browser must refuse to execute the script or apply the stylesheet, and must instead return a network error indicating that fetching of that script or stylesheet failed. specifications specification status comment subresource integrity recommendation fetch living standard ...
Tutorials
. registering and logging in, sending feedback, buying products, and more. this module gets you started with creating the client-side parts of forms. tips for authoring fast-loading html pages optimize web pages to provide a more responsive site for visitors and reduce the load on your web server and internet connection. ...
... feedback, buying products, and more. this module gets you started with creating the client-side parts of forms. tips for authoring fast-loading html pages optimize web pages to provide a more responsive site for visitors and reduce the load on your web server and internet connection. css tutorials introductory level css basics css (cascading style sheets) is the code you use to style your webpage. ...
...oductory level css basics css (cascading style sheets) is the code you use to style your webpage. css basics takes you through what you need to get started. we'll answer questions like: how do i make my text black or red? how do i make my content show up in such-and-such a place on the screen? how do i decorate my webpage with background images and colors? css first steps css (cascading style sheets) is used to style and lay out web pages — for example, to alter the font, color, size, and spacing of your content, split it into multiple columns, or add animations and other decorative features. this module provides a gentle beginning to your path towards css mastery with the basics of how it works, what the syntax looks like, and how you can start using it to add styling to html. ...
...undamentals, including setting font, boldness, and italics, line and letter spacing, and drop shadows and other text features. we round off the module by looking at applying custom fonts to your page, and styling lists and links. common css questions common questions and answers for beginners. intermediate level css layout at this point we've already looked at css fundamentals, how to style text, and how to style and manipulate the boxes that your content sits inside. now it's time to look at how to place your boxes in the right place in relation to the viewport, and one another. we have covered the necessary prerequisites so can now dive deep into css layout, looking at different display settings, traditional layout methods involving float and positioning, and new fangled layout to...
XUL Migration Guide - Archive of obsolete content
29 onwards. the tabs/utils module gives you direct access to the tabbrowser object and the xul tab objects it contains. ...
...ccess to the tabbrowser object and the xul tab objects it contains. ...
...this is usefu...
content/mod - Archive of obsolete content
experimental provides functions to modify a page content. globals constructors functions attachto(modification, window) function applies given modification to a given window. for example, the following code applies a style to a content window, adding a border to all divs in page: var attachto = require("sdk/content/mod").attachto; var style = require("sdk/stylesheet/style").style; var style = style({ source: "div { border: 4px solid gray }" }); // assuming window points to the content page we want to modify attachto(style, window); parameters modification : object the modification we want to apply to the target. window : nsidomwindow the window to be modified. detachfrom(modification, window) function removes attached modification from a given window. if window is not spec...
...(style, window); parameters modification : object the modification we want to apply to the target. window : nsidomwindow the window to be modified. detachfrom(modification, window) function removes attached modification from a given window. if window is not specified, modification is removed from all the windows it's being attached to. for example, the following code applies and removes a style to a content window, adding a border to all divs in page: var { attachto, detachfrom } = require("sdk/content/mod"); var style = require("sdk/stylesheet/style").style; var style = style({ source: "div { border: 4px solid gray }" }); // assuming window points to the content page we want to modify attachto(style, window); // ... ...
...if window is not provided modification is removed from all targets it's being attached to. ...
Modifying Web Pages Based on URL - Archive of obsolete content
"); } }); the replacepage message isn't a built-in message: it's a message defined by the add-on in the port.emit() call. injecting css note that the feature described in this section is experimental at the moment. we'll most likely continue to support the feature, but api details may change. ...
...y the add-on in the port.emit() call. injecting css note that the feature described in this section is experimental at the moment. we'll most likely continue to support the feature, but api details may change. rather than injecting javascript into a page, you can inject css by setting the page-mod's contentstyle option. var pagemod = require("sdk/page-mod").pagemod({ include: "*", contentstyle: "body {" + " border: 5px solid green;" + "}" }); as with contentscript, there's a corresponding contentstylefile option that takes the url of a css file in your "data" directory; it's a good practice to use this option in preference to contentstyle if the css is even marginally complex. var pagemod = require("sdk/page-mod").pagemod({ include: "*", contents...
... solid green;" + "}" }); as with contentscript, there's a corresponding contentstylefile option that takes the url of a css file in your "data" directory; it's a good practice to use this option in preference to contentstyle if the css is even marginally complex. var pagemod = require("sdk/page-mod").pagemod({ include: "*", contentstylefile: require("sdk/self").data.url("my-style.css") }); or, from firefox 34, you can use the simpler version: var pagemod = require("sdk/page-mod").pagemod({ include: "*", contentstylefile: "./my-style.css" }); learning more to learn more about page-mod, see its api reference page. in particular, the pagemod constructor takes several additional options to control its behavior: by default, content scripts are not attached to a...
Dialogs and Prompts - Archive of obsolete content
w keyboard events (enter/esc and more), which is good for keyboard accessibility. add ok and cancel buttons in an order that is consistent with os default (but the button set and layout is highly customizable, see below). simple dialog code the following xul code defines a simple dialog with two buttons, ok and cancel (buttons="accept,cancel" attribute on dialog). <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?> <dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="..." title="..." buttons="accept,cancel" ondialogaccept="return onaccept();" ondialogcancel="return oncancel();"> <script src="chrome://..."/> <!-- content --> </dialog> you need to implement onaccept and oncancel functions in your script. if the...
...file and add a dlgtype attribute to them. valid values for dlgtype are the six button types listed above. be sure to use ondialog* attributes on dialog element instead of putting oncommand on the button with dlgtype, because button's oncommand is executed only when the button is pressed, and ondialog* handlers are executed for keyboard and other events too. ...
...ialogheader element to add "headers" to windows. to get an idea of what it looks like, open options (or preferences) dialog in firefox or thunderbird (v1.0 and earlier only). the header to the right of the sections buttons is made with <dialogheader>: <dialogheader title="general" description="whatever"/> note, that you should only use this element in a <dialog>, because otherwise it may be not styled properly. (although it seems to work in <window> as well). programmatic button access if you want to access the accept ("ok") and cancel buttons from script, use this: // disable the ok and cancel btns document.documentelement.getbutton("accept").disabled = true; document.documentelement.getbutton("cancel").disabled = true; links dialog.xml — xbl bindings for <dialog> and <dialogheade...
Label and description - Archive of obsolete content
this reduces all whitespace chunks (including newlines) to single spaces. ...
...whitespace chunks (including newlines) to single spaces. text is permitted to wrap. <description>i am your father's brother's nephew's cousin's former roommate. what's that make us? absolutely nothing!</description> with white-space: pre; all whitespace, including newlines, is rendered literally. text cannot wrap automatically but can still be achieved with <html:br/> if desired. <description style="white-space: pre-wrap;">i am your father's brother's nephew's cousin's former roommate. what's that make us? absolutely nothing!</description> with white-space: pre-wrap; all whitespace is rendered literally, but text is additionally permitted to wrap at spaces. note: prior to firefox 3, it was necessary to use -moz-pre-wrap instead of -pre-wrap. you may wish to use both for backward compati...
...p;">i am your father's brother's nephew's cousin's former roommate. what's that make us? absolutely nothing!</description> with white-space: pre-wrap; all whitespace is rendered literally, but text is additionally permitted to wrap at spaces. note: prior to firefox 3, it was necessary to use -moz-pre-wrap instead of -pre-wrap. you may wish to use both for backward compatibility. <description style="white-space: pre;">i am your father's brother's nephew's cousin's former roommate. what's that make us? absolutely nothing!</description> text can also be made to wrap by inserting an <html:br/> element regardless of the css style, but this creates a hard-break that does not change as parent elements resize. <description>i am your father's brother's nephew's cousin's former roommate.<html:b...
Chapter 2: Technologies used in developing extensions - Archive of obsolete content
es such as xhtml and svg can be interspersed in one another as a means to extend the language. all elements can carry a "namespace uri" identifier, which is unique for each language. for example, even though xhtml and svg have elements with the same name, these can be distinguished. the namespace uri for xhtml is "http://www.w3.org/1999/xhtml" ; for svg is it "http://www.w3.org/2000/svg". ...
...extend the language. all elements can carry a "namespace uri" identifier, which is unique for each language. for example, even though xhtml and svg have elements with the same name, these can be distinguished. the namespace uri for xhtml is "http://www.w3.org/1999/xhtml" ; for svg is it "http://www.w3.org/2000/svg". ...
...is unique for each language. for example, even though xhtml and svg have elements with the same name, these can be distinguished. the namespace uri for xhtml is "http://www.w3.org/1999/xhtml" ; for svg is it "http://www.w3.org/2000/svg". css: a style language to alter the display of xml documents like xml, cascading style sheets (css) is a technical specification established by the w3c; it is a style-description language defining the display of data marked up in xml and html. as shown in listing 1, it has an extremely simple syntax. by separating the structure of the data, expressed through html or xml, and the display style, indicated by css, data can be reused better than it is when structural and stylistic markup are both embedded in html. there are three css specifications (level 1 throu...
Custom XUL Elements with XBL - Archive of obsolete content
is the file that associates the element name to the xbl file. it associates the xshelloperson element name to the binding defined in the xbl file. since you can have more than one binding per file, the "#person" part points to the id of the one we want. ...
...ou can have more than one binding per file, the "#person" part points to the id of the one we want. this css file is located in the content because it's not something we would normally want to be replaced by a skin, and it's not really defining style; it defines content behavior instead. if you use bindings on toolbar elements, remember to include the css file in the customize dialog, using the style directive in the chrome.manifest file. with those 2 files properly defined, we can now use the new element. if you look at file bindingdialog.xul, you'll see that the css stylesheet is included, which means that the xshelloperson tag can now be used just like any xul tag. in this case we're adding the "persons" dynamically, so you'll have to look into the js file to see how xshelloperson element...
...the method uses the parent node to remove the person node. simple enough. you can do almost anything from xbl code, including using xpcom components, js code modules and available chrome scripts. the main setback is that you can't have script tags defined in a binding, so you depend on the scripts that have been included in the xul files that use the binding. also unlike scripts, you can include stylesheets using the stylesheet xbl element. dtd and properties files can be handled just like in regular xul. there are two conflicting patterns that you should always keep in mind: encapsulation and separation of presentation and logic. encapsulation mandates that you try to keep your xbl free of outside dependencies. that is, you shouldn't assume that script x will be included somewhere, because...
List of Mozilla-Based Applications - Archive of obsolete content
k xul remote remote control for amarok music player ample sdk javascript gui-framework aol instant messenger im client uses nss apache web server doesn't use nss by default, but can be configured to use nss with mod_nss ssl module apicawatch site performance monitoring tool uses firefox as part of its monitoring package astyle css editor editing tool atmail webmail client aviva for java mainframe connectivity product uses mozilla rhino babelgum internet tv service basilisk pre-servo xul-based web browser uses most of the firefox 55 source code batik java-based toolkit uses mozilla rhino bitbox security focused browser see...
...elbrot creates images of mandelbrot sets xulrunner application kazehakase gecko-based web browser for unix kirix strata data browser kiwix offline version of wikipedia kneemail prayer, praise, and journal application komodo and komodo edit and open komodo development tools mozilla-based application (pre-xulrunner style), xul ui kompozer wysiwyg html editor unofficial bug-fix release of nvu kylo video browser uses gecko biofortis labmatrix web-accessible software application used for information management and integration of patient clinical, specimen, genetic and molecular assay data based on xul liaison groupware client for novell’s email and collabora...
...al kiosk app uses xulrunner telekast teleprompter tenfourfox browser for powerpc-based macs timberwolf browser for amiga os4 based on firefox - project page mozilla thunderbird email 47 million dl tomtom home 2 pc application to manage tomtom gps devices review article from gps magazine; over 2.4m users topstyle html, xhtml and css editor seems to have optional gecko embedding but doesn't use it by default toxtox media browser for tv 5000 downloads trixul gui toolkit uses mozilla spidermonkey trustedbird email client thunderbird bundled with a set of extensions (formerly known as milimail) tuneup music collection organizer listed on xulrun...
Finding the file to modify - Archive of obsolete content
now that we have a hackable mozilla, it's time to find the file we want to hack. mozilla's ui is divided into three layers: the structure, the style, and the behavior. the structure layer identifies the widgets (menus, buttons, etc.) and their position in the ui relative to each other, the style layer defines how the widgets look (size, color, style, etc.) and their overall position (alignment), and the behavior layer specifies how the widgets behave and how users can use them to accomplish their goals. mention the localization layer (note: these layers are not completely mutually exclusive. ...
...the structure layer consists of xul files. ...
... etc.) and their overall position (alignment), and the behavior layer specifies how the widgets behave and how users can use them to accomplish their goals. mention the localization layer (note: these layers are not completely mutually exclusive. in particular, positioning information can be specified in both the structure layer and the style layer, and some behavior can be partly defined in the style layer.) we're going to add code to all three ui layers, starting with the structure layer. the structure layer consists of xul files. xul, which is short for xml-based user interface language (and is pronounced like "zool"), is an xml-based language specifically designed for describing application interfaces. it contains elements for all common ui widgets (menus, buttons, toolbars, etc.) and man...
Creating regular expressions for a microsummary generator - Archive of obsolete content
hes any combination of characters, including no characters at all, so it works even if "viewitem&" and "item=" are right next to each other (as in our example url) as well as when there are some characters between them. matching another ebay url we now have a regular expression that matches auction item urls, including those with multiple query parameters in any order. but ebay uses a different style of url in some cases (f.e. on its search results page). here's a url for the same item in that different style: http://cgi.ebay.com/mozilla-firefox-logo-1-inch-pin-badge-button-browser_w0qqitemz280018439106qqihz018qqcategoryz2036qqcmdzviewitem to accommodate these urls, we can create a second regular expression that matches them. as before, we should distinguish the components of the url whic...
...m in that different style: http://cgi.ebay.com/mozilla-firefox-logo-1-inch-pin-badge-button-browser_w0qqitemz280018439106qqihz018qqcategoryz2036qqcmdzviewitem to accommodate these urls, we can create a second regular expression that matches them. as before, we should distinguish the components of the url which are unique to the item from those which are common to all auction item urls of this style. ...
....com/mozilla-firefox-logo-1-inch-pin-badge-button-browser_w0qqitemz280018439106qqihz018qqcategoryz2036qqcmdzviewitem to accommodate these urls, we can create a second regular expression that matches them. as before, we should distinguish the components of the url which are unique to the item from those which are common to all auction item urls of this style. ...
Drag and Drop Example - Archive of obsolete content
ement to create an element of a particular type. first, we'll add the wrapper scripts: <script src="chrome://global/content/nsdraganddrop.js"/> <script src="chrome://global/content/nstransferable.js"/> <script src="dragboard.js"/> an additional script file dragboard.js is included which will contain the code we will write ourselves. the board will be created using a stack element. ...
...contain the code we will write ourselves. the board will be created using a stack element. we'll use some style properties to set the width and height of the stack. a maximum size is also specified so that it doesn't resize when new elements are dragged onto it. the board will need to respond to the dragdrop event so that an element is created when the user drags onto it. <stack id="board" style="width:300px; height: 300px; max-width: 300px; max-height: 300px" ondragover="nsdraganddrop.dragover(event, boardobserver)" ondragdrop="nsdraganddrop.drop(event, boardobserver)"> </stack> the board only needs to respond to the dragdrop and dragover events. we'll add a boardobserver to the file dragboard.js in a moment. next, a palette will be added to the right side of the window. ...
...y accept drags from the palette. ...
Twitter - Archive of obsolete content
for search, jetpack.lib.twitter.search(). replace slashes with dots. most of twitter's methods are supported, but not all. list methods, spam reporting methods, and oauth are not currently supported. if something is not supported but you would like it to be, please file a bug. (or write a patch!) arguments each and every method in the library takes a single argument, an object. there are two styles you can use to define this object. the first is simple: define properties on the object corresponding to the parameters of the twitter method. for instance, some twitter methods have an id parameter, so you would define an id property and set its value to a user's id. (you can read about the parameters of the various methods at twitter's api reference.) there are two special, optional properties...
...called like so: success(data, textstatus) data is twitter's decoded json response. textstatus is a simple string describing the status. error(xmlhttprequest, textstatus, errorthrown) xmlhttprequest is the xhr used in the request. textstatus is a simple string describing the type of error. errorthrown is an exception object, if one was thrown. the examples below all use this first, simpler style. the second style will be familiar if you have used jquery.ajax() -- in fact the object is passed as-is (almost) to it. in other words, define a data property that is itself an object whose properties correspond to the parameters of the twitter method. with this style you can use any of the various jquery.ajax() options in your request: data, success, complete, etc. example: jetpack.lib.twitter.s...
...options in your request: data, success, complete, etc. example: jetpack.lib.twitter.statuses.update({ data: { status: "o frabjous day!" }, username: "basic_auth_username", password: "basic_auth_password", success: function () console.log("hey!") }); user authentication you can supply a username and password to methods that require authentication using the second, more advanced call style described above. or you can simply rely on firefox. when you call a method that requires authentication -- such as jetpack.lib.twitter.statuses.update() -- without providing a username or password, firefox will prompt the user for them if she is not already authenticated with twitter. both methods use http basic authentication. in the future, the library may support oauth. see twitter's authent...
Mozilla Application Framework in Detail - Archive of obsolete content
rewritten to describe why use xulrunner to create your own application. related: xulrunner:what xulrunner provides, xulrunner hall of fame ui in mozilla mozilla's philosophy of using "the right tool for the right job" is manifested most prominently in the design of the user interface. we provide an xml-based language called xul for defining the user interface of your application. css is used to style these ui's and dtd's are used to localize the textual information - making your application extremely flexible and able to be utilized across the globe. javascript, considered by many to be the best scripting language ever designed is ideal for specifying the behavior of your interface widgets. where speed is the foremost consideration, we provide c++ libraries with multi-language interfaces for ...
...he technologies already mentioned, we go even further by allowing you to even create your own custom interface widgets. don't feel limited by the widgets that the framework already contains! xbl (extensible binding language) allows you to expand your library of interface elements, and even construct your own xml language for defining your ui. for instance imagine that you wanted to create a chess style game. you could easily create xml elements such as <chessboard> or <chesspiece> and via xbl map these to images and application logic. this is very powerful since you could make improvements to the underlying application logic without having to rewrite the higher level code. our platform also can take advantage of other internet standards such as xslt and rdf. rdf, a core element to the framework...
...gy offers small size, speed and industry leading standards support. gecko is the premier cross-platform, full-featured, mature and well-tested layout engine available, providing robust and high quality support for a massive array of standards. its ability to render web content correctly is exceptional. gecko consists roughly of an html parser and xml parser, a dom implementation, a css parser and style system, and the code for css-based and html-based layout and rendering. as personal connectivity expands from the desktop computer to new web-enabled products and devices, gecko is a browser engine that has been designed from the ground up to power a new generation of desktop browsers and browsing devices and to accelerate the growth and development of the next-generation internet. small, fast an...
Prism - Archive of obsolete content
asic desktop integration: support of desktop features can make using the app more natural and convenient for end users. this includes the ability to create desktop shortcuts, to place the application icon in the tray or dock and to display pop-up notifications. customization: apps can be run using a shared browser runtime and customized using client-side script (similar to greasemonkey). custom stylesheets can be used to tweak the ui. architectural overview prism is a xulrunner application. in addition to the browser engine included in xulrunner, it consists of: web app bundle management: code for creating new web app bundles and loading existing bundles. shortcut creation ui: a dialog box lets the user specify attributes of the web app (name, uri, icon, shortcut locations). javascrip...
...r specify attributes of the web app (name, uri, icon, shortcut locations). javascript api: an api that can be used by scripts inside the bundle to customize the application. we are refining this approach to make the api applicable in as many environments as possible (e.g. it might be useful even for applications running in a normal browser). it should be possible for developers to include prism-style extension directly in their web app. we would like to harmonize our api with those of similar projects such as adobe air and google gears. operating-system integration: binary components provided access to os-specific features like shortcut creation and dock/tray icons. we intend to propose these extensions for inclusion in future versions of xulrunner. firefox extension: a firefox extension,...
... a web application bundle is a zip archive that holds a configuration file, icons and an optional webapp js script. bundles can be installed locally, or directly from a website using the prism for firefox extension. configuration a webapp bundle should contain a webapp.ini configuration file. the configuration file is a simple, ini-style text file that specifies some parameters about a web application. styling one of prism's goals is to make web applications feel more like desktop applications. one way to make the illusion seem more real is to use styling (or theming). prism supports a simple styling system that allows the user to add css files to the webapp bundle. ...
Remotely debugging Firefox for Metro - Archive of obsolete content
firefox running in classic "desktop" mode on windows, mac os x, or linux, either on a separate computer or in a separate profile on the same computer. ...
... firefox running in classic "desktop" mode on windows, mac os x, or linux, either on a separate computer or in a separate profile on the same computer. ...
...see one entry under "available remote processes": this is the browser process itself. you'll choose this option if you want to debug the browser's own code. let's choose to attach to the mozilla.org website. the toolbox will open in its own window, attached to the firefox for metro tab that's currently hosting mozilla.org: the toolbox, and the tools it hosts (including the console, debugger, style editor, profiler, etc.), work in just the same way as they do when attached to local content. ...
A XUL Bestiary - Archive of obsolete content
ization strings are just a dtd, and the content is just the xul. the chrome url this concept of a chrome as an integrated, dynamic thing in some way divorced from the "appcore" is realized in the use of the chrome url to point to chunks of xul and their related files. the chrome url, which appears in place of the http url in pointers like the following global skin processing instruction: <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> specifies a chrome to be loaded by the gecko rendering engine. in the example above, the chrome is simply a skin file to be loaded into the xul file, but the chrome can also be used to load whole chromes, as when a <menuitem> in one window brings up a new chrome: <menuitem value="mozilla help" oncommand="window.opendialog('chrome://help/c...
...e advent of css2 and its new positioning capabilities. skinning is most often brought up in the context of dynamic changes to the overall look of an application. though this is not yet in the browser, very soon it will be possible to change the look of a whole application dynamically, but only to the extent that the skin is actually defined in the main global.css, or global skin. when you create styles in <style> tags, as style attributes for individual elements, or in custom css files, you break the ability of gecko to skin the application to which your xul belongs. widgets widgets are the pieces that you assemble to make an interface. menus, toolbars, buttons, and scrollbars are widgets, and so are such general purpose pieces as boxes and springs. these widgets can be created and placed wi...
...is the element and both value and the id are attributes. <menu id="file" label="file"> <menupopup> <menuitem label="new" oncommand="createnewdoc()" /> <menuitem label="open" oncommand="opendoc()" /> <menuitem label="close" oncommand="closedoc()" /> </menupopup> </menu> element names the item, the widget, while attributes describes features of that element, such as its name, its style, and so on. in object-oriented parlance, the element is analogous to the object itself while the attribute is like a property. the attribute has a value associated with it (such as the string "file" for the id attribute in the example above). note that the menu element includes both the opening tag at the top and the closing tag at the bottom of the example. in a way, the menu element comprises t...
treecol.type - Archive of obsolete content
nt as text. checkbox the content of the columns are checkboxes. progressmeter the content of the columns are a progress meters. this is used in mozilla's download manager window. text the content of the columns is text. if you are using type="checkbox", then the tree and each treecol must be editable. you need to apply css to make the checkbox toggle. here is an example css style using the current theme's checkboxes: treechildren::-moz-tree-checkbox { /* unchecked checkbox treecells. this style must come before treechildren::-moz-tree-checkbox(checked) otherwise it won't take effect. */ list-style-image: none; } treechildren::-moz-tree-checkbox(checked) { /* checked checkbox treecells. cbox-check.gif isn't available in firefox 1, 2, and 3 in mac os x so you sh...
...* unchecked checkbox treecells. this style must come before treechildren::-moz-tree-checkbox(checked) otherwise it won't take effect. */ list-style-image: none; } treechildren::-moz-tree-checkbox(checked) { /* checked checkbox treecells. cbox-check.gif isn't available in firefox 1, 2, and 3 in mac os x so you should specify a url to an image in your extension or elsewhere. */ list-style-image: url("chrome://global/skin/checkbox/cbox-check.gif"); } treechildren::-moz-tree-checkbox(disabled) { /* disabled checkbox treecells. cbox-check.gif isn't available in firefox 1, 2, and 3 in mac os x, so you should specify a url to an image in your extension or elsewhere. ...
...c os x so you should specify a url to an image in your extension or elsewhere. */ list-style-image: url("chrome://global/skin/checkbox/cbox-check.gif"); } treechildren::-moz-tree-checkbox(disabled) { /* disabled checkbox treecells. cbox-check.gif isn't available in firefox 1, 2, and 3 in mac os x, so you should specify a url to an image in your extension or elsewhere. ...
MenuItems - Archive of obsolete content
lass="menuitem-iconic" label="add bookmark" image="addbookmark.png"/> as the image appears on a menu item, you will want to ensure you use a fairly small image. although the exact size will vary depending on the theme being used, the size of menu item images should generally be around 16 by 16 pixels. instead of specifying the icon with the image attribute, you can also reference the image in a style sheet with the 'list-style-image' property. #add-bookmark { list-style-image: url('addbookmark.png'); } this technique can also be used to apply an image for the menu element, except you would want to use the "menu-iconic:" class instead. <menuitem id="bookmark" class="menu-iconic" label="bookmarks" image="bookmarks.png"/> menu icon animation in order to animate the menu item icon on hov...
...uare is the icon in normal state the bottom part in hovered state. note that the image element is on a child level underneath the menu or menuitem, and it will have the class menu-iconic-icon. ...
... checkbox menu items sometimes, you will want to have an item on a menu that acts as a toggle. for instance, a menuitem that can be used to toggle a toolbar on and off. ...
Positioning - Archive of obsolete content
s as to how the popup should be opened. positioning using coordinates a popup can be positioned further using the x and y arguments to openpopup. after the popup is positioned using the anchor, the x and y arguments may be used to offset the popup by a certain distance. the section on the openpopup method provides an example of this. ...
...opened. positioning using coordinates a popup can be positioned further using the x and y arguments to openpopup. after the popup is positioned using the anchor, the x and y arguments may be used to offset the popup by a certain distance. the section on the openpopup method provides an example of this. ...
...if you notice in the firefox browser when a tooltip is opened it appears not at the mouse position, but slightly below it. ...
Building Trees - Archive of obsolete content
in the tree cells. in this case, the member resource is used since that holds the photo’s url. however, it could be any other variable, a static value, or a combination of both. of course, we can’t really see the photos, since the tree’s rows are too small! it’s not normal to put photos in a tree like this—instead, the images would be used for icons. on the other hand, you could use a stylesheet to change the default height of the tree rows. you cannot make each row a different height, but you can change the height of all rows with some css: treechildren::-moz-tree-row { height: 150px; } since no elements are constructed by the tree builder, you cannot use the style or class attributes to change the style of a cell (this is the case with all trees). you must use syntax like that ...
...give each node a unique "id" attribute. these are used to track the current state of the disclosure triangles. support for this was introduced in gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4). using tree properties since we need to use special css for trees, the properties attribute on a cell becomes extremely useful. it can be used to define extra properties for reference later in a stylesheet. for example, if the properties attribute was set to the value "?creator", you could style the photos created by different people differently. alternatively, you could also use static values (in addition to variables) in the properties attribute. for instance, consider the following css: treechildren::-moz-tree-cell(dave) { background-color: lightgreen; } this would set the background col...
...differently. alternatively, you could also use static values (in addition to variables) in the properties attribute. for instance, consider the following css: treechildren::-moz-tree-cell(dave) { background-color: lightgreen; } this would set the background color of a cell to green for any cell with the “dave” property. you can also use the properties attribute on the treerow to change the style for an entire row. this example sets the country associated with a photo as a property of a tree’s rows. we can use that property to change the appearance of each row. <rule> <query> <content uri="?start"/> <member container="?start" child="?photo"/> <triple subject="?photo" predicate="http://www.xulplanet.com/rdf/country" object="?country"/> <triple su...
Adding Labels and Images - Archive of obsolete content
s xul has an element to display images within a window. this element is appropriately named image. note that the tag name is different than html (image instead of img). you can use the src attribute to specify the url of the image file. ...
...ropriately named image. note that the tag name is different than html (image instead of img). you can use the src attribute to specify the url of the image file. the example below shows this: <image src="images/banner.jpg"/> although you can use this syntax, it would be better in order to support different themes to use a style sheet to set the image url. a later section will describe how to use style sheets, but an example will be shown here for completeness. ...
... img). you can use the src attribute to specify the url of the image file. the example below shows this: <image src="images/banner.jpg"/> although you can use this syntax, it would be better in order to support different themes to use a style sheet to set the image url. a later section will describe how to use style sheets, but an example will be shown here for completeness. you can use the list-style-image css property to set the url for the image. here are some examples: xul: <image id="image1"/> <image id="search"/> style sheet: #image1 { list-style-image: url("chrome://findfile/skin/banner.jpg"); } #search { list-style-image: url("http://example.com/images/search.png"); } these images come from within the chrome directory, in the skin for the findfile package. because images...
Broadcasters and Observers - Archive of obsolete content
ute directly on the button, all attributes will be observed. broadcast event there is an additional event handler that we can place on the observes element which is onbroadcast. the event is called whenever the observer notices a change to the attributes of the broadcaster that it is watching. an example is shown below. example 3 : source view <broadcasterset> <broadcaster id="colorchanger" style="color: black"/> </broadcasterset> <button label="test"> <observes element="colorchanger" attribute="style" onbroadcast="alert('color changed');"/> </button> <button label="observer" oncommand="document.getelementbyid('colorchanger').setattribute('style','color: red');" /> two buttons have been created, one labeled test and the other labeled observer. if you click on the test button, noth...
...f you click on the test button, nothing special happens. however, if you click on the observer button, two things happen. first, the button changes to have red text and, second, an alert box appears with the message 'color changed'. what happens is the oncommand handler on the second button is called when the user presses on it. the script here gets a reference to the broadcaster and changes the style of it to have a color that is red. the broadcaster is not affected by the style change because it doesn't display on the screen. however, the first button has an observer which notices the change in style. the element and the attribute on the observes tag detect the style change. the style is applied to the first button automatically. next, because the broadcast occured, the event handler onbroa...
...ver which notices the change in style. the element and the attribute on the observes tag detect the style change. the style is applied to the first button automatically. next, because the broadcast occured, the event handler onbroadcast is called. this results in an alert message appearing. note that the broadcast only occurs if the attributes on the broadcaster element are changed. changing the style of the buttons directly will not cause the broadcast to occur so the alert box will not appear. if you tried duplicating the code for the first button several times, you would end up with a series of alert boxes appearing, one for each button. this is because each button is an observer and will be notified when the style changes. next, we'll look at using the document object model with xul elem...
Stacks and Decks - Archive of obsolete content
ng element. for example, a progress bar might be created using a bar and a label overlaid on top of it. shadowing with stacks one convenient use of the stack element however is that you could emulate a number of css properties with it. for example, you could create an effect similar to the text-shadow property with the following: example 1 : source view <stack> <description value="shadowed" style="padding-left: 1px; padding-top: 1px; font-size: 15pt"/> <description value="shadowed" style="color: red; font-size: 15pt;"/> </stack> both description elements create text with a size of 15 points. the first, however is offset one pixel to the right and down by adding a padding to its left and top sides. this has the result of drawing the same text 'shadowed' again but slightly offset from...
...eate text with a size of 15 points. the first, however is offset one pixel to the right and down by adding a padding to its left and top sides. this has the result of drawing the same text 'shadowed' again but slightly offset from the other. the second description element is drawn in red so the effect is more visible. this method has advantages over using text-shadow because you could completely style the shadow apart from the main text. it could have its own font, underline or size. (you could even make the shadow blink). it is also useful as mozilla doesn't currently support css text shadowing. a disadvantage is that the area taken up by the shadow makes the size of the stack larger. shadowing is very useful for creating the disabled appearance of buttons: example 2 : source view <stack st...
... underline or size. (you could even make the shadow blink). it is also useful as mozilla doesn't currently support css text shadowing. a disadvantage is that the area taken up by the shadow makes the size of the stack larger. shadowing is very useful for creating the disabled appearance of buttons: example 2 : source view <stack style="background-color: #c0c0c0"> <description value="disabled" style="color: white; padding-left: 1px; padding-top: 1px;"/> <description value="disabled" style="color: grey;"/> </stack> this arrangement of text and shadow colors creates the disabled look under some platforms. note that events such as mouse clicks and keypresses are passed to the element on the top of the stack, that is, the last element in the stack. that means that buttons will only work pro...
Tabboxes - Archive of obsolete content
ogress bar and the buttons can stay on the main dialog, outside of the tabs. <vbox flex="1"> <tabbox selectedindex="1"> <tabs> <tab label="search"/> <tab label="options"/> </tabs> <tabpanels> <tabpanel id="searchpanel" orient="vertical"> <description> enter your search criteria below and select the find button to begin the search. ...
...lect the find button to begin the search. ...
...searchtype"> <menupopup> <menuitem label="name"/> <menuitem label="size"/> <menuitem label="date modified"/> </menupopup> </menulist> <spacer style="width: 10px;"/> <menulist id="searchmode"> <menupopup> <menuitem label="is"/> <menuitem label="is not"/> </menupopup> </menulist> <spacer style="height: 10px"/> <textbox id="find-text" flex="1" style="min-width: 15em;"/> </groupbox> </tabpanel> <tabpanel id="optionspanel" orient="vertical"> <checkbox id="casecheck" label="case sensitive search"/> <checkbox id="wordscheck" label="match entire filename"/> </tabpanel> </tabpanels> </tabbox> the tab elements have been placed around the main content of the w...
Trees - Archive of obsolete content
Archive › Mozilla › XUL › Tutorial › Trees
which do most of the hard work for you. for most trees, especially when you first start to use trees, you will use one of these built-in types. however, you can create a view entirely from scratch if necessary. if you do, you might store the data in an array or javascript data structure, or load the data from an xml file. since the entire body of the tree is a single widget, you can't change the style of individual rows or cells in the normal way. this is because there are no elements that display the individual cells, like there is with the listbox. instead, all drawing is done by the tree body using data supplied by the view. this is an important point and many xul developers have trouble understanding this aspect. to modify the appearance of a tree cell, the view must instead associate a se...
... are no elements that display the individual cells, like there is with the listbox. instead, all drawing is done by the tree body using data supplied by the view. this is an important point and many xul developers have trouble understanding this aspect. to modify the appearance of a tree cell, the view must instead associate a set of keywords for a row and cell. a special css syntax is used which styles components of the tree body with those keywords. in a sense, it is somewhat like using css classes. tree styling will be discussed in detail in a later section. tree elements trees can be created with the tree element, which is described in the following sections. there are also two elements used to define the columns to be displayed in the tree. tree this is the outer element of a tree. ...
... by calling the view's getcelltext function, which in turn gets the data from the label of the appropriate treecell. however, the three elements listed above are not displayed directly. they are used only as the source for the data for the view. thus, only a handful of attributes apply to the treeitem and related elements. for instance, you cannot change the appearance of the tree rows using the style attribute or with other css properties and the box related features such as flexibility and orientation cannot be used. in addition, mouse and other user interface events do not fire at these elements. in fact, apart from some tree specific attributes, the only attributes that will have any effect will be the label attribute to set a text label for a cell and the src attribute to set an image. h...
Writing Skinnable XUL and CSS - Archive of obsolete content
ndant selector without first getting usage of the rule approved. the matching for these rules (unless you're very careful) will be inefficient, and when only using generic tag names, can be positively grotesque. i'll show you the evil rule i put into the global skin a few months back that was making trees slow. treehead treerow treecell { bad! evil! yuck! ... } this evil rule caused the style system, for every treecell that wasn't in a treehead (which is practically every treecell in a typical tree), to crawl up the whole parent chain to the root of the document in order to determine that the style rule wasn't a match. i'm usually seeing this rule misused by people who really wanted to use the child selector instead. that was my mistake with the above rule. i should have used treeh...
...going to be installed with navigator. if it is possible that the sidebar is a separate component that could be installed or uninstalled, then the overlaying should not occur in the xul file. it should instead take place through the chrome registry. examples of overlays that should take place using the chrome registry include the security padlock icon and any messenger ui in the navigator window. style="..." is prohibited in xul files without approval any usages of inline style are extremely dangerous, since they are overriding the included skin, and must be approved before their usage will be allowed. image chrome urls should never occur in xul. any chrome url that references an image in the skin is strictly forbidden in the xul. if you find yourself needing to display an image from the skin,...
...the problem here is that you'll end up placing a restriction on the skin, which will force the skin designer to supply an image with the exact name you've specified. this is not healthy. note that some particularly evil people put images chrome urls in dtds. this is even worse, and it also is strictly forbidden. ...
label - Archive of obsolete content
Archive › Mozilla › XUL › label
hods | related ] this element is used to provide a label for a control element. if the user clicks the label, it will move the focus to the associated control, specified with the control attribute. more information is available in the xul tutorial. attributes accesskey, control, crop, disabled, href, value properties accesskey, accessibletype, control, crop, disabled, value style classes header, indent, monospace, plain, small-margin, text-link examples <label value="email address" control="email"/> <textbox id="email"/> attributes accesskey type: character this should be set to a character that is used as a shortcut key. this should be one of the characters that appears in the label attribute for the element. control type: id this att...
... header a class used for headings. typically, this will cause the text to appear bold. indent this class causes the text to be indented on its left side. monospace this clas...
...ultnamespace(), isequalnode, issamenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata style classes the following classes may be used to style the element. these classes should be used instead of changing the style of the element directly since they will fit more naturally with the user's selected theme. header a class used for headings. typically, this will cause the text to appear bold. indent this class causes the text to be indented on its left side. monospace this class causes the text to be displayed in a monospace fo...
listitem - Archive of obsolete content
t it contains a single listcell element of type and class appropriate to that of the listitem. more information is available in the xul tutorial. attributes accesskey, checked, command, crop, current, disabled, image, label, preference, selected, tabindex, type, value properties accesskey, accessible, checked, control, crop, current, disabled, image, label, selected, tabindex, value style classes listitem-iconic examples <listbox id="thelist"> <listitem label="ruby"/> <listitem label="emerald"/> <listitem label="sapphire" selected="true"/> <listitem label="diamond"/> </listbox> attributes accesskey type: character this should be set to a character that is used as a shortcut key. this should be one of the characters that appears in the label attribute for ...
... listitem-iconic use this class to have an image appear on the listitem. specify the image using the image attribute. related elements listbox, listcell, listcol, listcols, li...
...tnamespace(), isequalnode, issamenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata style classes the following classes may be used to style the element. these classes should be used instead of changing the style of the element directly since they will fit more naturally with the user's selected theme. listitem-iconic use this class to have an image appear on the listitem. specify the image using the image attribute. related elements listbox, listcell, listcol, listcols, listhead, listheader interfaces nsiaccessibleprov...
menuitem - Archive of obsolete content
n a menu. more information is available in the xul tutorial. ...
...ing the textbox.value and menulist.value syntax. ...
...specify the image using the image attribute. menuitem-non-iconic normally, menuitems have a margin to the left for an image or checkmark. this class may be used to remove this margin so that the menuitem appears on the left edge of the menupopup. related elements menu, menubar, menulist, menupopup, menuse...
textbox - Archive of obsolete content
decimalplaces type: integer the number of decimal places to display. the default is 0, which doesn't show any decimal places. the value infinity may b...
... plain this class causes the element to be displayed with no border or margin. notes the maxlength attribute does not work when in multiline mode. a workaround using javascript a...
...tnamespace(), isequalnode, issamenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata style classes the following classes may be used to style the element. these classes should be used instead of changing the style of the element directly since they will fit more naturally with the user's selected theme. plain this class causes the element to be displayed with no border or margin. notes the maxlength attribute does not work when in multiline mode. a workaround using javascript and the onkeypress event handler as shown in abstract...
treechildren - Archive of obsolete content
ill be placed inside this element. this element is also used to define container rows in the tree. more information is available in the xul tutorial. attributes alternatingbackground attributes alternatingbackground obsolete since gecko 2.0 type: boolean if true, the background of the tree's rows will alternate between two colors. you can use the :-moz-tree-row css style to do this instead. inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, p...
...licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
treerow - Archive of obsolete content
. children of the treerow should be treecell elements. if child rows are necessary, they should be placed in a treechildren element inside the parent treeitem. more information is available in the xul tutorial. attributes properties examples (example needed) attributes properties type: space-separated list of property names sets the properties of the element, which can be used to style the element. for more information, see styling a tree. inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordin...
...licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
treeseparator - Archive of obsolete content
for more information, see styling a tree. ...
...licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
Windows and menus in XULRunner - Archive of obsolete content
ile may also contain other top-level declarations for css and dtd, which i will discuss in a moment. <window> is the basic windowing element in xul. it has attributes to set the title/caption as well as to control its width and height. although i have not seen it mentioned yet, i am assuming that you can only have one <window> element per xul file. here is an example: <?xml version="1.0"?> <?xml-stylesheet href="chrome://basicapp/skin/main.css" type="text/css"?> <!doctype window system "chrome://basicapp/locale/main.dtd"> <window id="main" title="&title;" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script src="main.js"/> ... </window> notice the references to css and dtd files. the css is used to apply formatting to elements, just as it would in html. ...
...wn icons. you can learn how to do it in the article window icons. menus and toolbars most desktop applications are complex enough to require some sort of menu and/or toolbar to structure the application’s available commands. xul provides elements to support both menus and toolbars. ...
...id="save" command="cmd_save"/> ... we can add images to the toolbar buttons through the css file. we could hard-code the images in the xul file itself, but css is a better practice. here’s the css file: /* global skin --------------------------------------------------- */ @import url(chrome://global/skin/); /* toolbar ------------------------------------------------------- */ #open { list-style-image: url(chrome://basicapp/skin/open.png); -moz-box-orient: vertical; } #save { list-style-image: url(chrome://basicapp/skin/save.png); -moz-box-orient: vertical; } of course, you need to make sure the png files are included in the application. there are quite a few things xul offers for application ui. more than i can fit into a single article, so we will continue looking at building...
Building a Theme - Archive of obsolete content
've copied the global and mozapps folders, a handful of other folders from the browser/omni.ja archive are required. it is located in the browser folder in the location mentioned above. the files we will be needing from the browser/omni.ja archive are located under chrome/browser/skin/classic. copy the contents of the following directories to their respective folders. this gives us a base set of styles to work with. browser to chrome/browser/ communicator to chrome/communicator/ you should end up with this directory structure: <ext path>/ /install.rdf /chrome.manifest /chrome/ browser/ communicator/ global/ mozapps/ after this, it would be a good idea to read the article setting up extens...
...l errors to you. see install manifests for a complete listing of the required and optional properties. save the file. styling the browser's ui with css firefox's user interface is written in xul and javascript. xul is an xml grammar that provides user interface widgets like buttons, menus, toolbars, trees, etc. user actions are bound to functionality using javascript. these xul elements are styled using css. if you don't know css, it's going to be a steep learning curve, and you may want to try some html-based tutorials to start with. the browser ui has absolutely no styling on its own - if you try to start up with an empty theme, firefox will be unusable, as the button elements will be drawn as plain text. this is why we copied the default styles in the setup step. when writing a theme...
... unused space on a toolbar. this should select a node of type "xul:toolbar" in the dom inspector. from here, you can play around with various different stylings for the toolbar and associated elements. by default, the right pane should show the dom node, which has useful styling information like the css class and node id. the element itself is of id navigator-toolbox, with no idea. to change its style within our theme, we need to write a selector rule to select this class. open up the file chrome/browser/browser.css in your theme. search this file for the #navigator-toolbox selector, and add a background: orange; rule to it. save the file. chrome uris next, we have to tell firefox where to find the theme files for your theme. css, xul, and other files are part of "chrome packages" - bund...
Developing cross-browser and cross-platform pages - Archive of obsolete content
this method has the advantage of not requiring you to test for anything except whether the particular features you code are supported in the visiting browser. let's see a basic, simple object support detection example. ...
...or anything except whether the particular features you code are supported in the visiting browser. let's see a basic, simple object support detection example. function hideelement(id_attribute_value) { if (document.getelementbyid && document.getelementbyid(id_attribute_value) && document.getelementbyid(id_attribute_value).style ) { document.getelementbyid(id_attribute_value).style.visibility = "hidden"; }; } // example: // <button type="button" onclick="hideelement('d1');">hide div</button> // <div id="d1">some text</div> these repeated calls to document.getelementbyid are not the most efficient way to check for the existence of particular objects or features in the browser's dom implementation, but they serve to illustrate clearly how object support detection works. ...
... to illustrate clearly how object support detection works. the top-level if clause looks to see if there is support for a method called getelementbyid on the document object, which is the one of the most basic levels of support for the dom in a browser. if there is, the code sees if document.getelementbyid(id_attribute_value) returns a reference to an existing element, which it then checks for a style object. if the style object exists on the element, then it sets that object's visibility property. the browser will not error if you set this unimplemented property, so you do not need to check that the visiblity property itself exists. so, instead of needing to know which browsers and browser versions support a particular dom method (or dom attribute or dom feature), you can verify the support ...
-ms-scrollbar-3dlight-color - Archive of obsolete content
lpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
...>? ...
...he -ms-scrollbar-3dlight-color property for a <textarea> element. code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/scrollbarcolor.htm <!doctype html> <html> <head> <title>scrollbar-3dlight-color</title> <style> .blue3dlight { -ms-scrollbar-3dlight-color: blue; scrollbar-3dlight-color: blue; /* use the standard when available. */ } </style> </head> <body> <textarea class="blue3dlight">the top and left edges of the thumb and button-face elements in the scroll bar for this element will be blue.</textarea> </body> </html> specifications not part of any specification. ...
::-ms-browse - Archive of obsolete content
y the following css properties can be used in a rule with ::-ms-browse in its selector. other properties are ignored. ...
...:-ms-browse in its selector. other properties are ignored. ...
... -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust background-clip background-color background-image background-origin background-repeat background-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top opacity outline-color outline-style outline-width padding-bottom padding-le...
::-ms-check - Archive of obsolete content
ly the following css properties can be used in a rule with ::-ms-check in its selector. other properties are ignored. ...
...::-ms-check in its selector. other properties are ignored. ...
... -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust background-clip background-color background-image background-origin background-repeat background-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top opacity outline-color outline-style outline-width padding-bottom padding-le...
CSS - Archive of obsolete content
Archive › Web › CSS
limit-zonethe -ms-hyphenate-limit-zone css property is a microsoft extension specifying the width of the hyphenation zone.-ms-ime-alignthe -ms-ime-align css property is a microsoft extension aligning the input method editor (ime) candidate window box relative to the element on which the ime composition is active. ...
...enate-limit-zone css property is a microsoft extension specifying the width of the hyphenation zone.-ms-ime-alignthe -ms-ime-align css property is a microsoft extension aligning the input method editor (ime) candidate window box relative to the element on which the ime composition is active. ...
...l field value rather than asterisks.::-ms-thumbthe ::-ms-thumb css pseudo-element is a microsoft extension that represents the thumb that the user moves within the track of a slider control to alter its numerical value. a slider control is one possible representation of <input type="range">.::-ms-ticks-afterthe ::-ms-ticks-after css pseudo-element is a microsoft extension that applies one or more styles to the tick marks that appear after the track of a slider control. a slider control is one possible representation of <input type="range">.::-ms-ticks-beforethe ::-ms-ticks-before css pseudo-element is a microsoft extension that applies one or more styles to the tick marks that appear before the track of a slider control. a slider control is one possible representation of <input type="range">.::...
Displaying a graphic with audio samples - Archive of obsolete content
the following example shows how to take samples from an audio stream and display them behind an image (in this case, the mozilla logo), giving the impression that the image is built from the samples. ...
...zilla logo), giving the impression that the image is built from the samples. ...
... signal = new float32array(fb.length / channels), magnitude; for (var i = 0, fbl = framebufferlength / 2; i < fbl; i++ ) { // assuming interlaced stereo channels, // need to split and merge into a stero-mix mono signal signal[i] = (fb[2*i] + fb[2*i+1]) / 2; } // clear the canvas before drawing spectrum ctx.fillstyle = "rgb(0,0,0)"; ctx.fillrect (0,0, canvas.width, canvas.height); ctx.fillstyle = "rgb(255,255,255)"; for (var i = 0; i < signal.length; i++ ) { // multiply spectrum by a zoom value magnitude = signal[i] * 1000; // draw rectangle bars for each frequency bin ctx.fillrect(i * 4, canvas.height, 3, -magnitude); } ...
Media (CSS) - MDN Web Docs Glossary: Definitions of Web-related terms
in the context of css (cascading style sheets), the term media refers to the destination to which the document is to be drawn by the rendering engine. typically, this is a screen—but it may also be a printer, a speech synthesizer, braille display, or another type of device. css offers several features that allow you to tweak your document's styles—or even offer different styles—according to the media type (such as screen or print, to name two) or media capabilities (such as width, resolution, or other values) of the viewer's device. ...
... window.matchmedia() test the viewing device against a media query. ...
... as screen or print, to name two) or media capabilities (such as width, resolution, or other values) of the viewer's device. learn more general knowledge using media queries technical reference media queries define a set of characteristics or parameters required to apply the css styles that are specified within the curly braces of the media query; for example: only applying certain css styles for devices below 768 pixels. @media at-rule conditionally apply part of a stylesheet, based on the result of a media query. window.matchmedia() test the viewing device against a media query. ...
Semantics - MDN Web Docs Glossary: Definitions of Web-related terms
i elements representing different types of fruits. ...
...senting different types of fruits. ...
... with div > ul > li, or .fruits__item? semantics in html in html, for example, the <h1> element is a semantic element, which gives the text it wraps around the role (or meaning) of "a top level heading on your page." <h1>this is a top level heading</h1> by default, most browser's user agent stylesheet will style an <h1> with a large font size to make it look like a heading (although you could style it to look like anything you wanted). on the other hand, you could make any element look like a top level heading. consider the following: <span style="font-size: 32px; margin: 21px 0;">is this a top level heading?</span> this will render it to look like a top level heading, but it has no semantic value, so it will not get any extra benefits as described above. it is therefore a good idea to u...
A cool-looking box - Learn web development
equisites: before attempting this assessment, you should have already worked through all the articles in this module. objective: to test comprehension of the css box model and other box-related features such as borders and backgrounds. starting point to get this assessment started, you should: make local copies of the starting html and css — save them as index.html and style.css in a new directory. alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html and fill in the css into one of these online editors. if the online editor you are using doesn't have a separate css panel, feel free to put it in a <style> element in the head of the document. note: if you get stuck, then ask us for help — see the assessment or f...
...use rems. write a comment about how you worked out the value. ...
...use rems. write a comment about how you worked out the value. a base color for the design. give the box this color as its background color. the same color for the text; make it readable using a black text shadow. a fairly subtle border radius. ...
Debugging CSS - Learn web development
rong and you are trying to work out which property is causing the problem. the following video provides some useful tips on debugging css using the firefox devtools: editing values in addition to turning properties on and off, you can edit their values. perhaps you want to see if another color looks better, or wish to tweak the size of something? devtools can save you a lot of time editing a stylesheet and reloading the page. with box1 selected, click on the swatch (the small colored circle) that shows the color applied to the border. a color picker will open up and you can try out some different colors; these will update in real time on the page. in a similar fashion, you could change the width or style of the border. adding a new property you can add properties using the devtools. p...
...st doesn't seem to take the css. what is generally happening here is that a more specific selector is overriding your changes, and here devtools will really help you out. in our example file there are two words that have been wrapped in an <em> element. one is displaying as orange and the other hotpink. in the css we have applied: em { color: hotpink; font-weight: bold; } above that in the stylesheet however is a rule with a .special selector: .special { color: orange; } as you will recall from the lesson on cascade and inheritance where we discussed specificity, class selectors are more specific than element selectors, and so this is the value that applies. devtools can help you find such issues, especially if the information is buried somewhere in a huge stylesheet. inspect the <e...
...hing for a while. sometimes the solution magically appears when you stop thinking about the problem, and even if not, working on it when feeling refreshed will be much easier. do you have valid html and css? browsers expect your css and html to be correctly written, however browsers are also very forgiving and will try their best to display your webpages even if you have errors in the markup or stylesheet. if you have mistakes in your code the browser needs to make a guess at what you meant, and it might make a different decision to what you had in mind. in addition, two different browsers might cope with the problem in two different ways. a good first step therefore is to run your html and css through a validator, to pick up and fix any errors. css validator html validator is the prope...
Fundamental CSS comprehension - Learn web development
lesets that you'll need to study and combine to answer part of this assessment. alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html and fill in the css into one of these online editors, and use this url to point the <img> element to the image file. if the online editor you are using doesn't have a separate css panel, feel free to put it in a <style> element in the head of the document. note: if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. project brief you have been provided with some raw html and an image, and need to write the necessary css to style this into a nifty little online business card, which can perhaps double as a gamer card or social media profile. the foll...
... link your css to your html file via a <link> element. the first two rulesets in the css resource file are yours, for free! after you've finished rejoicing at your good fortune, copy and paste them into the top of your new css file. use them as a test to make sure your css is properly applied to your html. ...
...o your html file via a <link> element. the first two rulesets in the css resource file are yours, for free! after you've finished rejoicing at your good fortune, copy and paste them into the top of your new css file. use them as a test to make sure your css is properly applied to your html. above the two rules, add a css comment with some text inside it to indicate that this is a set of general styles for the overall page. "general page styles" would do. also add three more comments at the bottom of the css file to indicate styles specific to the setup of the card container, styles specific to the header and footer, and styles specific to the main business card contents. from now on, subsequent styles added to the stylesheet should be organized in an appropriate place. taking care of the se...
CSS building blocks - Learn web development
derstanding. cascade and inheritance the aim of this lesson is to develop your understanding of some of the most fundamental concepts of css — the cascade, specificity, and inheritance — which control how css is applied to html and how conflicts are resolved. css selectors there are a wide variety of css selectors available, allowing for fine-grained precision when selecting elements to style. in this article and its sub-articles, we'll run through the different types in great detail, seeing how they work. the sub-articles are as follows: type, class, and id selectors attribute selectors pseudo-classes and pseudo-elements combinators the box model everything in css has a box around it, and understanding these boxes is key to being able to create layouts with css, or to...
...design will be is important, and in this lesson, we will summarize the various ways elements get a size via css and define a few terms around sizing that will help you in the future. images, media, and form elements in this lesson we will take a look at how certain special elements are treated in css. images, other media, and form elements behave a little differently in terms of your ability to style them with css than regular boxes. understanding what is and isn't possible can save some frustration, and this lesson will highlight some of the main things that you need to know. styling tables styling an html table isn't the most glamorous job in the world, but sometimes we all have to do it. this article provides a guide to making html tables look good, with some specific table styling techn...
...able styling techniques highlighted. debugging css sometimes when writing css you will encounter an issue where your css doesn't seem to be doing what you expect. this article will give you guidance on how to go about debugging a css problem, and show you how the devtools included in all modern browsers can help you find out what is going on. organizing your css as you start to work on larger stylesheets and big projects you will discover that maintaining a huge css file can be challenging. in this article, we will take a brief look at some best practices for writing your css to make it easily maintainable, and some of the solutions you will find in use by others to help improve maintainability. assessments want to test your css skills? the following assessments will test your understand...
Introduction to CSS layout - Learn web development
display property the main methods of achieving page layout in css are all values of the display property. this property allows us to change the default way something displays. everything in normal flow has a value of display, used as the default way that elements they are set on behave. for example, the fact that paragraphs in english display one below the other is due to the fact that they are styled with display: block. if you create a link around some text inside a paragraph, that link remains inline with the rest of the text, and doesn’t break onto a new line. this is because the <a> element is display: inline by default. you can change this default display behavior. for example, the <li> element is display: block by default, meaning that list items display one below the other in our e...
...e position: fixed. simple positioning example to provide familiarity with these page layout techniques, we'll show you a couple of quick examples. our examples will all feature the same html, which is as follows: <h1>positioning</h1> <p>i am a basic block level element.</p> <p class="positioned">i am a basic block level element.</p> <p>i am a basic block level element.</p> this html will be styled by default using the following css: body { width: 500px; margin: 0 auto; } p { background-color: rgb(207,232,220); border: 2px solid rgb(79,185,227); padding: 10px; margin: 10px; border-radius: 5px; } the rendered output is as follows: relative positioning relative positioning allows you to offset an item from the position in normal flow it would have by default. ...
...y. html { font-family: sans-serif; } form { display: table; margin: 0 auto; } form div { display: table-row; } form label, form input { display: table-cell; margin-bottom: 10px; } form label { width: 200px; padding-right: 5%; text-align: right; } form input { width: 300px; } form p { display: table-caption; caption-side: bottom; width: 300px; color: #999; font-style: italic; } this gives us the following result: you can also see this example live at css-tables-example.html (see the source code too.) multi-column layout the multi-column layout module gives us a way to lay out content in columns, similar to how text flows in a newspaper. while reading up and down columns is less useful in a web context as you don’t want to force users to scroll up and ...
Multiple-column layout - Learn web development
ng point contains some very simple html; a wrapper with a class of container inside which is a heading and some paragraphs. the <div> with a class of container will become our multicol container. we switch on multicol by using one of two properties column-count or column-width. the column-count property will create as many columns as the value you give it, so if you add the following css to your stylesheet and reload the page, you will get three columns: .container { column-count: 3; } the columns that you create have flexible widths — the browser works out how much space to assign each column. column-count example body { width: 90%; max-width: 900px; margin: 2em auto; font: .9em/1.2 arial, helvetica, sans-serif; } <div class="container"> <h1>simple multicol example...
... dolor, sed pretium metus suscipit vel. mauris ultricies lectus sed lobortis finibus. vivamus eu urna eget velit cursus viverra quis vestibulum sem. aliquam tincidunt eget purus in interdum. cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p> </div> .container { column-width: 200px; } styling the columns the columns created by multicol cannot be styled individually. there is no way to make one column bigger than other columns, or to change the background or text color of a single column. you have two opportunities to change the way that columns display: changing the size of the gap between columns using the column-gap. adding a rule between columns with column-rule. using your example above, change the size of the gap by adding a column-...
...ange the size of the gap by adding a column-gap property: .container { column-width: 200px; column-gap: 20px; } you can play around with different values — the property accepts any length unit. now add a rule between the columns, with column-rule. in a similar way to the border property that you encountered in previous lessons, column-rule is a shorthand for column-rule-color, column-rule-style, and column-rule-width, and accepts the same values as border. .container { column-count: 3; column-gap: 20px; column-rule: 4px dotted rgb(79, 185, 227); } try adding rules of different styles and colors. styling the columns body { width: 90%; max-width: 900px; margin: 2em auto; font: .9em/1.2 arial, helvetica, sans-serif; } .container { column-count: 3; column-gap: 20px; c...
Responsive design - Learn web development
e. media queries responsive design was only able to emerge due to the media query. the media queries level 3 specification became a candidate recommendation in 2009, meaning that it was deemed ready for implementation in browsers. media queries allow us to run a series of tests (e.g. whether the user's screen is greater than a certain width, or a certain resolution) and apply css selectively to style the page appropriately for the user's needs. for example, the following media query tests to see if the current web page is being displayed as screen media (therefore not a printed document) and the viewport is at least 800 pixels wide. the css for the .container selector will only be applied if these two things are true. @media screen and (min-width: 800px) { .container { margin: 1em 2em...
...ple, the following media query tests to see if the current web page is being displayed as screen media (therefore not a printed document) and the viewport is at least 800 pixels wide. the css for the .container selector will only be applied if these two things are true. @media screen and (min-width: 800px) { .container { margin: 1em 2em; } } you can add multiple media queries within a stylesheet, tweaking your whole layout or parts of it to best suit the various screen sizes. the points at which a media query is introduced, and the layout changed, are known as breakpoints. a common approach when using media queries is to create a simple single-column layout for narrow-screen devices (e.g mobile phones), then check for larger screens and implement a multiple-column layout when you k...
...ote: the grid layout version is even simpler as we can define the columns on the .wrapper: example, source code. responsive images the simplest approach to responsive images was as described in marcotte's early articles on responsive design. basically, you would take an image that was at the largest size that might be needed, and scale it down. this is still an approach used today, and in most stylesheets, you will find the following css somewhere: img { max-width: 100%; } there are obvious downsides to this approach. the image might be displayed a lot smaller than its intrinsic size, which is a waste of bandwidth — a mobile user may be downloading an image several times the size of what they actually see in the browser window. in addition, you may not want the same image aspect rati...
Using your new knowledge - Learn web development
this assessment gives you a chance to do that. prerequisites: before attempting this assessment you should have worked through the rest of the css basics module, and also have an understanding of html basics (study introduction to html). objective: to have a play with some css and test your new-found knowledge. ...
...ou prefer you could move this css to a separate file when you create the example on your local computer. alternatively use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. note: if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. working with css the following live example shows a biography, which has been styled using css. the css properties that i have used are as follows — each one links to its property page on mdn, which will give you more examples of its use. font-family color border-bottom font-weight font-size text-decoration i have used a mixture of selectors, styling elements such as h1 and h2, but also creating a class for the job title and styling that. use css to change how this ...
...is is a good practice to get into — it's very hard to help someone with a coding problem if you can't see their code. a link to the actual task or assessment page, so we can find the question you want help with. what's next? congratulations on finishing this first module. you should now have a good general understanding of css, and be able to understand much of what is happening in a stylesheet. in the next module, css building blocks, we will go on to look at a number of key areas in depth. previous overview: first steps in this module what is css? getting started with css how css is structured how css works using your new knowledge ...
CSS first steps - Learn web development
this module provides a gentle beginning to your path towards css mastery with the basics of how it works, what the syntax looks like, and how you can start using it to add styling to html. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started prerequisites before starting this module, you should have: basic familiarity with using computers, and using the web passively (i.e. ...
...king on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as jsbin or glitch. guides this module contains the following articles, which will take you through all the basic theory of css, and provide opportunities for you to test out some skills. what is css? css (cascading style sheets) allows you to create great-looking web pages, but how does it work under the hood? this article explains what css is, with a simple syntax example, and also covers some key terms about the language. getting started with css in this article we will take a simple html document and apply css to it, learning some practical things about the language along the way. how css is structured now...
... how css is structured now that you have an idea about what css is and the basics of using it, it is time to look a little deeper into the structure of the language itself. we have already met many of the concepts discussed here; you can return to this one to recap if you find any later concepts confusing. how css works we have learned the basics of css, what it is for and how to write simple stylesheets. in this lesson we will take a look at how a browser takes css and html and turns that into a webpage. using your new knowledge with the things you have learned in the last few lessons you should find that you can format simple text documents using css, to add your own style to them. this article gives you a chance to do that. ...
Use CSS to solve common problems - Learn web development
Learn › CSS › Howto
how to use background-clip ...
... how to use background-clip to control how much of the box your background image cov...
... to control the part of a css box that the background is drawn under how do i define inline, block, and inline-block? how to create fancy boxes (also see the styling boxes module, generally). how to use background-clip to control how much of the box your background image covers. how to change the box model completely using box-sizing how to control backgrounds how to control borders how to style an html table how to add shadows to boxes uncommon and advanced techniques css allows some advanced design techniques. these articles help demystify some of the more complicated use cases. general how to calculate specificity of a css selector how to control inheritance in css advanced effects how to use filters in css how to use blend modes in css layout using css flexible ...
Typesetting a community school homepage - Learn web development
you might just have some fun along the way. prerequisites: before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of css text styling techniques. ...
...he exercise, and the provided external link icon. make a copy of them on your local computer. alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html and fill in the css into one of these online editors, and use this url to point the background image. if the online editor you are using doesn't have a separate css panel, feel free to put it in a <style> element in the head of the document. note: if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. project brief you have been provided with some raw html for the homepage of an imaginary community college, plus some css that styles the page into a three column layout and provides some other rudimentary styling. you are to write your...
...ist items works well with the styling of the overall page. each list item should have the same line-height as a paragraph line, and each list should have the same spacing at its top and bottom as you have between paragraphs. give your list items a nice bullet, appropriate for the design of the page. it is up to you whether you choose a custom bullet image or something else. navigation menu: style your navigation menu so that it has an appropriate look for the look and feel for the page. hints and tips you don't need to edit the html in any way for this exercise. you don't necessarily have to make the nav menu look like buttons, but it needs to be a bit taller so that it doesn't look silly on the side of the page; also remember that you need to make this one a vertical nav menu. ex...
Styling text - Learn web development
s, you could try out (most of) the code examples in an online coding program such as jsbin, codepen or glitch. guides this module contains the following articles, which will teach you all of the essentials behind styling html text content. fundamental text and font styling in this article we go through all the basics of text/font styling in detail, including setting font weight, family and style, font shorthand, text alignment and other effects, and line and letter spacing. styling lists lists behave like any other text for the most part, but there are some css properties specific to lists that you need to know about, and some best practices to consider. this article explains all. styling links when styling links, it is important to understand how to make use of pseudo-classes to sty...
...her effects, and line and letter spacing. styling lists lists behave like any other text for the most part, but there are some css properties specific to lists that you need to know about, and some best practices to consider. this article explains all. styling links when styling links, it is important to understand how to make use of pseudo-classes to style link states effectively, and how to style links for use in common varied interface features such as navigation menus and tabs. we'll look at all these topics in this article. web fonts here we will explore web fonts in detail — these allow you to download custom fonts along with your web page, to allow for more varied, custom text styling. assessments the following assessments will test your understanding of the text styling techn...
... ...
HTML forms in legacy browsers - Learn web development
ange. if you alter a property, that may impact the appearance of the widget in unexpected ways. for example, [value] { background-color: #ccc; } may have been used to target every <input> with a value attribute, but changing the background-color or border radius on a <meter> will lead to likely unexpected results that differ across browsers. you can declare appearance: none; to remove the browser styles, but that generally defeats the purpose: as you lose all styling, removing the default look and feel your visitors are used to. to summarize, when it comes to styling form control widgets, the side effects of styling them with css can be unpredictable. so don't. as you can see from the complexity of the property compatibility table for form widgets article, it's very difficult. even if it's st...
... it comes to styling form control widgets, the side effects of styling them with css can be unpredictable. so don't. as you can see from the complexity of the property compatibility table for form widgets article, it's very difficult. even if it's still possible to do a few adjustments on text elements (such as sizing or font color), there are always side effects. the best approach remains to not style html form widgets at all. but you can still apply styles to all the surrounding items. and, if you must alter the default styles of your form widgets, define a style guide to ensure consistency among all your form controls so user experience is not destroyed. you can also investigate some hard techniques such as rebuilding widgets with javascript. but in that case, do not hesitate to charge your ...
...o ensure you don't break legacy browsers. before using features that aren't fully supported in the browsers your targeting, you should feature detect: css feature detection before styling a replaced form control widget, you can check to see if the browser supports the features you plan on using using @supports: @supports (appearance: none) { input[type="search"] { appearance: none; /* restyle the search input */ } theappearance property can be used to display an element using platform-native styling, or, as is done with the value of none, remove default platform-native based styling. unobtrusive javascript one of the biggest problems is the availability of apis. for that reason, it's considered best practice to work with "unobtrusive" javascript. it's a development pattern that de...
Dealing with files - Learn web development
when you're building a website, you need to assemble these files into a sensible structure on your local computer, make sure they can talk to one another, and get all your content looking right before you eventually upload them to a server. dealing with files discusses some issues you should be aware of so you can set up a sensible file structure for your website. ...
...e names lowercase with no spaces and with words separated by dashes, at least until you know what you're doing. that way you'll bump into fewer problems later down the road. what structure should your website have? next, let's look at what structure our test site should have. the most common things we'll have on any website project we create are an index html file and folders to contain images, style files, and script files. let's create these now: index.html: this file will generally contain your homepage content, that is, the text and images that people see when they first go to your site. using your text editor, create a new file called index.html and save it just inside your test-site folder. images folder: this folder will contain all the images that you use on your site. create a fo...
... index.html: this file will generally contain your homepage content, that is, the text and images that people see when they first go to your site. using your text editor, create a new file called index.html and save it just inside your test-site folder. images folder: this folder will contain all the images that you use on your site. create a folder called images, inside your test-site folder. styles folder: this folder will contain the css code used to style your content (for example, setting text and background colors). create a folder called styles, inside your test-site folder. scripts folder: this folder will contain all the javascript code used to add interactive functionality to your site (e.g. buttons that load data when clicked). create a folder called scripts, inside your test-sit...
HTML basics - Learn web development
an also have attributes that look like the following: attributes contain extra information about the element that you don't want to appear in the actual content. here, class is the attribute name and editor-note is the attribute value. the class attribute allows you to give the element a non-unique identifier that can be used to target it (and any other elements with the same class value) with style information and other things. an attribute should always have the following: a space between it and the element name (or the previous attribute, if the element already has one or more attributes). the attribute name followed by an equal sign. the attribute value wrapped by opening and closing quotation marks. note: simple attribute values that don't contain ascii whitespace (or any of th...
...nt. this element wraps all the content on the entire page and is sometimes known as the root element. <head></head> — the <head> element. this element acts as a container for all the stuff you want to include on the html page that isn't the content you are showing to your page's viewers. this includes things like keywords and a page description that you want to appear in search results, css to style our content, character set declarations and more. <meta charset="utf-8"> — this element sets the character set your document should use to utf-8 which includes most characters from the vast majority of written languages. essentially, it can now handle any textual content you might put on it. there is no reason not to set this and it can help avoid some problems later on. <title></title> — t...
..., chapter titles and subtitles, an html document can too. html contains 6 heading levels, <h1>–<h6>, although you'll commonly only use 3 to 4 at most: <h1>my main title</h1> <h2>my top level heading</h2> <h3>my subheading</h3> <h4>my sub-subheading</h4> now try adding a suitable title to your html page just above your <img> element. note: you'll see that your heading level 1 has an implicit style. don't use heading elements to make text bigger or bold, because they are used for accessibility and other reasons such as seo. try to create a meaningful sequence of headings on your pages, without skipping levels. paragraphs as explained above, <p> elements are for containing paragraphs of text; you'll use these frequently when marking up regular text content: <p>this is a single paragraph<...
HTML Cheatsheet - Learn web development
ne elements can be implemented within the <body></body> tags. ...
...implemented within the <body></body> tags. ...
...ppet result a simple link <a href="https://realityripple.com/">a link to realityripple</a> a link to realityripple a simple image <img src="https://udn.realityripple.com/samples/6e/d6ed76c6c7.png" width="25" /> a generic inline container <p>p its used to <span style="color:blue">style and group</span> particular elements </p> p its used to style and group particular elements another inline container <p>span its used to differentiate a part <span style="color:blue">of the content</span> that we will work on differently </p> span its used to differentiate a part of the content that we will work on differently emphasize some text <em>i'm posh</em> i'm posh italic textt you can mark a p...
Document and website structure - Learn web development
following code (you can also find the example in our github repository). we'd like you to look at the example above, and then look over the listing below to see what parts make up what section of the visual. ...
...le in our github repository). we'd like you to look at the example above, and then look over the listing below to see what parts make up what section of the visual. ...
...epository). we'd like you to look at the example above, and then look over the listing below to see what parts make up what section of the visual. ...
From object to iframe — other embedding technologies - Learn web development
the share or embed map option. select the embed map option, which will give you some <iframe> code — copy this. insert it into the input box below, and see what the result is in the output. if you make a mistake, you can always reset it using the reset button. if you get really stuck, press the show solution button to see an answer. ...
...you make a mistake, you can always reset it using the reset button. if you get really stuck, press the show solution button to see an answer. ...
...src="https://www.youtube.com/embed/qh2-tgulwu4" frameborder="0" allowfullscreen>\n</iframe>\n\n<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d37995.65748333395!2d-2.273568166412784!3d53.473310471916975!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x487bae6c05743d3d%3a0xf82fddd1e49fc0a1!2sthe+lowry!5e0!3m2!1sen!2suk!4v1518171785211" width="600" height="450" frameborder="0" style="border:0" allowfullscreen>\n</iframe>'; let solutionentry = htmlsolution; textarea.addeventlistener('input', updatecode); window.addeventlistener('load', updatecode); // stop tab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keycode === 9) { e.preventdefault(); insertatcaret('\t'); } if (e.keycode ==...
HTML table advanced features and accessibility - Learn web development
as caused the "sum" row to go down to the bottom of the table. next, add a colspan attribute to make the "sum" cell span across the first four columns, so the actual number appears at the bottom of the "cost" column. let's add some simple extra styling to the table, to give you an idea of how useful these elements are for applying css. inside the head of your html document, you'll see an empty <style> element. inside this element, add the following lines of css code: tbody { font-size: 95%; font-style: italic; } tfoot { font-weight: bold; } save and refresh, and have a look at the result. if the <tbody> and <tfoot> elements weren't in place, you'd have to write much more complicated selectors/rules to apply the same styling. note: we don't expect you to fully understand the cs...
...ect you to fully understand the css right now. you'll learn more about this when you go through our css modules (introduction to css is a good place to start; we also have an article specifically on styling tables). ...
... background-color: rgb(235,235,235); } td { text-align: center; } tr:nth-child(even) td { background-color: rgb(250,250,250); } tr:nth-child(odd) td { background-color: rgb(245,245,245); } caption { padding: 10px; } tbody { font-size: 90%; font-style: italic; } tfoot { font-weight: bold; } </style> </head> <body> <table> <caption>how i chose to spend my money</caption> <thead> <tr> <th>purchase</th> <th>location</th> <th>date</th> <th>evaluation</th> <th>cost (€)</th> </tr> </thead> ...
Build your own function - Learn web development
ion naming conventions, you should follow the same rules as variable naming conventions. this is fine, as you can tell them apart — function names appear with parentheses after them, and variables don't. start by accessing the function-start.html file and making a local copy. you'll see that the html is simple — the body contains just a single button. we've also provided some basic css to style the custom message box, and an empty <script> element to put our javascript in. next, add the following inside the <script> element: function displaymessage() { } we start off with the keyword function, which means we are defining a function. this is followed by the name we want to give to our function, a set of parentheses, and a set of curly braces. any parameters we want to give to our f...
...ctor('html'); the next section uses another dom api function called document.createelement() to create a <div> element and store a reference to it in a constant called panel. this element will be the outer container of our message box. we then use yet another dom api function called element.setattribute() to set a class attribute on our panel with a value of msgbox. this is to make it easier to style the element — if you look at the css on the page, you'll see that we are using a .msgbox class selector to style the message box and its contents. finally, we call a dom function called node.appendchild() on the html constant we stored earlier, which nests one element inside the other as a child of it. we specify the panel <div> as the child we want to append inside the <html> element. we need...
...idth: 200px; to width: 242px; next, add the following lines inside the .msgbox p { ... } rule: padding-left: 82px; background-position: 25px center; background-repeat: no-repeat; now we need to add code to our displaymessage() function to handle displaying the icons. add the following block just above the closing curly brace (}) of your function: if (msgtype === 'warning') { msg.style.backgroundimage = 'url(icons/warning.png)'; panel.style.backgroundcolor = 'red'; } else if (msgtype === 'chat') { msg.style.backgroundimage = 'url(icons/chat.png)'; panel.style.backgroundcolor = 'aqua'; } else { msg.style.paddingleft = '20px'; } here, if the msgtype parameter is set as 'warning', the warning icon is displayed and the panel's background color is set to red. if it is set ...
What is JavaScript? - Learn web development
volved. it is the third layer of the layer cake of standard web technologies, two of which (html and css) we have covered in much more detail in other parts of the learning area. html is the markup language that we use to structure and give meaning to our web content, for example defining paragraphs, headings, and data tables, or embedding images and videos in the page. css is a language of style rules that we use to apply styling to our html content, for example setting background colors and fonts, and laying out our content in multiple columns. javascript is a scripting language that enables you to create dynamically updating content, control multimedia, animate images, and pretty much everything else. (okay, not everything, but it is amazing what you can achieve with a few lines of ja...
...crews, and then put them together to make a bookshelf. they generally fall into two categories. browser apis are built into your web browser, and are able to expose data from the surrounding computer environment, or do useful complex things. for example: the dom (document object model) api allows you to manipulate html and css, creating, removing and changing html, dynamically applying new styles to your page, etc. every time you see a popup window appear on a page, or some new content displayed (as we saw above in our simple demo) for example, that's the dom in action. the geolocation api retrieves geographical information. this is how google maps is able to find your location and plot it on a map. the canvas and webgl apis allow you to create animated 2d and 3d graphics. people are d...
...ifferent in the two contexts, but related, and both approaches (server-side and client-side) usually work together. a web page with no dynamically updating content is referred to as static — it just shows the same content all the time. how do you add javascript to your page? javascript is applied to your html page in a similar manner to css. whereas css uses <link> elements to apply external stylesheets and <style> elements to apply internal stylesheets to html, javascript only needs one friend in the world of html — the <script> element. let's learn how this works. internal javascript first of all, make a local copy of our example file apply-javascript.html. save it in a directory somewhere sensible. open the file in your web browser and in your text editor. you'll see that the htm...
Adding features to our bouncing balls demo - Learn web development
as a starting point, and add some new and interesting features to it. prerequisites: before attempting this assessment you should have already worked through all the articles in this module. ...
... note: if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. hints and tips a couple of pointers before you get started. this assessment is quite challenging. read the whole assessment before you start coding, and take each step slowly and carefully. ...
...ribed below. draw() this method has the same purpose as ball()'s draw() method: it draws the object instance on the canvas. it will work in a very similar way, so you can start by copying the ball.prototype.draw definition. you should then make the following changes: we want the evil circle to not be filled in, but rather just have an outer line (stroke). you can achieve this by updating fillstyle and fill() to strokestyle and stroke(). we also want to make the stroke a bit thicker, so you can see the evil circle a bit more easily. this can be achieved by setting a value for linewidth somewhere after the beginpath() call (3 will do). checkbounds() this method will do the same thing as the first part of ball()'s update() function — look to see whether the evil circle is going to go of...
Properly configuring server MIME types - Learn web development
ime types as reported by web servers and web applications. what are mime types? mime types describe the media type of content either in email or served by web servers or web applications and are intended to help guide a web browser in how the content is to be processed and displayed. examples of mime types are: text/html for normal web pages text/plain for plain text text/css for cascading style sheets text/javascript for scripts application/octet-stream meaning "download this file" application/x-java-applet for java applets application/pdf for pdf documents technical background registered values for mime types are available in iana | mime media types. the http specification defines a superset of mime which is used to describe the media types used on the web. why are correct mime...
... important for security reasons; it's possible for malicious content to affect the user's computer by pretending to be a safe type of document when it is in fact not. note: historically, firefox has loaded css files even if they had the wrong mime type, as long as the html document that requested them was being processed in quirks mode. for security reasons, gecko 2.0 will no longer do this for stylesheets loaded from a different origin than the requesting document. if your stylesheet comes from a different origin than the document, you must serve it with the correct mime type (text/css). gecko 1.9.1.11 (firefox 3.5.11) and gecko 1.9.2.5 (firefox 3.6.5) also implement this security fix, but to improve compatibility, there was a temporary heuristic that allows the load if the first line in th...
...eets loaded from a different origin than the requesting document. if your stylesheet comes from a different origin than the document, you must serve it with the correct mime type (text/css). gecko 1.9.1.11 (firefox 3.5.11) and gecko 1.9.2.5 (firefox 3.6.5) also implement this security fix, but to improve compatibility, there was a temporary heuristic that allows the load if the first line in the style sheet appears to be a well-formed css construct; the heuristic has been removed in firefox 4, and you have to properly set the text/css mime types to have your css pages recognized. why browsers should not guess mime types apart from violating the http specification, it is a bad strategy for browsers to guess mime types for the following reasons: loss of control if the browser ignores the re...
React resources - Learn web development
client-side javascript frameworks next our final article provides you with a list of react resources that you can use to go further in your learning. prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. objective: to provide further resources for learning more about react. component-level styles although this tutorial doesn't use this approach, many react applications define their styles on a per-component basis, rather than in a single, monolithic stylesheet. create-react-app makes it possible to import css files into javascript modules, so that css is only sent to your user when the corresponding component is rendered. for this app, we could have for example written a dedicated form...
...al doesn't use this approach, many react applications define their styles on a per-component basis, rather than in a single, monolithic stylesheet. create-react-app makes it possible to import css files into javascript modules, so that css is only sent to your user when the corresponding component is rendered. for this app, we could have for example written a dedicated form.css file to house the styles of those respective components, then imported the styles into their respective modules like this: import form from './form'; import './form.css' this approach makes it easy to identify and manage the css that belongs to a specific component. however, it also fragments your stylesheet across your codebase, and this fragmentation might not be worthwhile. for larger applications with hundreds of ...
... this approach makes it easy to identify and manage the css that belongs to a specific component. however, it also fragments your stylesheet across your codebase, and this fragmentation might not be worthwhile. for larger applications with hundreds of unique views and lots of moving parts, it makes sense to limit the amount of irrelevant code that's sent to your user. you'll likely have app-wide styles and specific component styles that built on top of those. you can read more about component stylesheets in the create-react-app docs. react devtools we used console.log() to check on the state and props of our application in this tutorial, and you'll also have seen some of the useful warnings and error message that react gives you both in the cli and your browser's javascript console. but the...
Working with Svelte stores - Learn web development
w file named src/components/alert.svelte. ...
... at the beginning we import the alert store. next we import the ondestroy() lifecycle function, which lets us execute a callback after the component has been unmounted. we then create a local variable named alertcontent. remember that we can access top-level variables from the markup, and whenever they are modified the dom will update acco...
...f the component's dom. the subscribe() method also returns a clean-up function, which takes care of releasing the subscription. so we subscribe when the component is being initialized, and use ondestroy to unsubscribe when the component is unmounted. finally we use the alertcontent variable in our markup, and if the user clicks on the alert we clean it. at the end we include a few css lines to style our alert component. this setup allows us to work with stores in a reactive way. when the value of the store changes, the callback is executed. there we assign a new value to a local variable, and thanks to svelte reactivity all our markup and reactive dependencies are updated accordingly. using the component let's now use our component. in app.svelte we'll import the component; add the...
Chrome registration
define the user interface are also contained within the content packages, as well as most xbl binding files. locale localizable applications keep all their localized information in locale providers. this allows translators to plug in a different chrome package to translate an application without altering the rest of the source code. the two main types of localizable files are dtd files and java-style properties files. skin a skin provider is responsible for providing a complete set of files that describe the visual appearance of the chrome. typically a skin provider will provide css files and images. note: scripts (including those found in xbl) loaded from skin packages will not execute. the chrome registry the gecko runtime maintains a service known as the chrome registry that provid...
...preferences. skin a skin package is registered with the line: skin packagename skinname uri/to/files/ [flags] this will register a skin package when resolving the uri chrome://packagename/skin/... . the skinname is an opaque string identifying an installed skin. if more than one skin is registered for a package, the chrome registry will select the best-fit skin using the user's preferences. style style overlays (custom css which will be applied to a chrome page) are registered with the following syntax: style chrome://uri-to-style chrome://stylesheet-uri [flags] note: only stylesheets at chrome uris can be applied in this way. override in some cases an extension or embedder may wish to override a chrome file provided by the application or xulrunner. in order to allow for this, the c...
...pported in bootstrapped add-ons the following instructions are supported in bootstrapped extensions: manifest content locale skin override debugging a chrome manifest file the chrome list extension shows all registered chrome. this is very helpful when trying to write a chrome.manifest file as you can inspect where the files are being mapped from (jar files, local directory, etc.) old-style contents.rdf manifests before the plaintext manifests were introduced (which happened in firefox 1.5, toolkit 1.8), rdf manifests named "contents.rdf" were used to register chrome. this format is deprecated; however, seamonkey versions before version 2 do not support the plaintext manifest format yet, so contents.rdf manifests are required for extensions that wish to maintain backwards compatibi...
Getting from Content to Layout
/master/layout/base/nscssframeconstructor.cpp the frame constructor implements nsimutationobserver which allows it to "watch" the content tree. nscssframeconstructor gets notified from the document's presshell (which implements nsidocumentobserver and observes the document) about all nodes in the document. ...
...nts nsidocumentobserver and observes the document) about all nodes in the document. the frame constructor takes these notifications and does the following: dispatches "restyle events" which trigger the reprocessing of relevant css selectors and any restyling that needs to occur. adds and removes frames to make the frame tree a proper representation of the new content tree. restyling the restyletracker maintains a list of restyles to process. elements that need to be restyled are marked with flags (e.g element_has_pending_restyle) and are stored in the mpendingrestyles hashtable. ...
...processing of relevant css selectors and any restyling that needs to occur. adds and removes frames to make the frame tree a proper representation of the new content tree. restyling the restyletracker maintains a list of restyles to process. elements that need to be restyled are marked with flags (e.g element_has_pending_restyle) and are stored in the mpendingrestyles hashtable. a list of restyle roots (places in the content tree where all descendants need to be restyled but nothing on the parent chain does) are also stored. the restyles accumulated in the restyletracker are dispensed with from various method on the presshell that involve reflow and flushing notifications. frame construction regardless of whether content nodes are inserted/appended/deleted, frames can be created and de...
WebRequest.jsm
the opt_extrainfospec argument. statuscode number http response code. types resource types the resource type string identifies the kind of resource being fetched. it's used in two places: filtering requests by type, and as the type property of the argument passed to the listener. ...
...esource://gre/modules/webrequest.jsm", {}); cu.import("resource://gre/modules/matchpattern.jsm"); let pattern = new matchpattern("https:/developer.mozilla.org/*"); webrequest.onbeforerequest.addlistener(logurl, {urls: pattern}); function logurl(e) { console.log("loading: " + e.url); } this listener will be invoked for requests matching any of the three patterns, where the resource type is "stylesheet" or "image": let {webrequest} = cu.import("resource://gre/modules/webrequest.jsm", {}); cu.import("resource://gre/modules/matchpattern.jsm"); let pattern = new matchpattern(["https://mozorg.cdn.mozilla.net/*", "https://mdn.mozillademos.org/*", "https://developer.cdn.mozilla.net/*"]); webrequest.onbeforerequest.addlistener(lis...
...ules/matchpattern.jsm"); let pattern = new matchpattern(["https://mozorg.cdn.mozilla.net/*", "https://mdn.mozillademos.org/*", "https://developer.cdn.mozilla.net/*"]); webrequest.onbeforerequest.addlistener(listener, { urls: pattern, types: ["image", "stylesheet"] }); function listener(e) { console.log("matched: " + e.url); } canceling this example cancels requests to load content from "http://example.org/": let {webrequest} = cu.import("resource://gre/modules/webrequest.jsm", {}); cu.import("resource://gre/modules/matchpattern.jsm"); let pattern = new matchpattern("http://example.org/*"); webrequest.on...
JavaScript code modules
repository.jsm provides a search of add-ons in the repository. assert.jsm implements the commonjs unit testing specification version 1.1, which provides a basic standardized interface for performing in-code logical assertions with optional, customizable error reporting. bookmarkhtmlutils.jsm provides utility functions for importing and exporting bookmarks from the old-school "bookmarks.html" style bookmark files. ctypes.jsm provides an interface that allows javascript code to call native libraries without requiring the development of an xpcom component. customizableui.jsm allows you to interact with customizable buttons and items in firefox's main window ui. deferredtask.jsm run a task after a delay. dict.jsm provides an api for key/value pair dictionaries. downloadlastdir.jsm su...
...es. http.jsm a wrapper for xmlhttprequest that provides convenient and simplified api for dealing with http requests. jni.jsm abstracts the js-ctypes to provide an interface that allows javascript code to call code running in native jvms. iso8601dateutils.jsm provides routines to convert between javascript date objects and iso 8601 date strings. log.jsm (formerly log4moz) provides a log4j style api for logging, log messages to various endpoints, such as the browser console or a file on disk. netutil.jsm provides helpful networking utility functions, including the ability to easily copy data from an input stream to an output stream asynchronously. openlocationlasturl.jsm provides access to the last url opened using the "open location" option in the file menu. osfile.jsm allow...
...otifications to users. promise.jsm implements the promises/a+ proposal as known in april 2013. promiseworker.jsm a version of chromeworker which uses promises to return the worker's result instead of using an event to do so. services.jsm provides getters for conveniently obtaining access to commonly-used services. source-editor.jsm the source editor is used by developer tools such as, the style editor; this interface implements the editor and lets you interact with it. sqlite.jsm a promise-based api to mozistorage/sqlite. task.jsm implements a subset of task.js to make sequential, asynchronous operations simple, using the power of javascript's yield operator. timer.jsm a pure js implementation of window.settimeout. webapps.jsm provides an interface to manage open web apps. webr...
Index
used in the mozilla source code. with that document, users can see immediately two localized files in their user interface by following closely and carefully the steps to create a language pack or a binary file that is ready for installation. repeating the process allows a localizer to create a testable package to see his or her work as they progress to a final version. 28 mozilla l10n style guide localization cultural references, idioms, and slang require a full understanding of these references between the cultures of your source and target languages. an example of a cultural reference in english would be the phrase, "kick-off meeting." this is a reference that uses an american football term. it means a meeting to begin a project. to translate it, you can follow one of tw...
...ces between the cultures of your source and target languages. an example of a cultural reference in english would be the phrase, "kick-off meeting." this is a reference that uses an american football term. it means a meeting to begin a project. to translate it, you can follow one of two approaches: 29 mozilla content localized in your language localization, mdn, mozilla, reference, style guide no summary! 30 mozilla content localized in your language localization this section of the style guide is for you to author. the content here should be what you and your localization team have decided, together, to follow when localizing mozilla products and web sites. you are free to add, edit, remove, and localize everything in this section according to how the ...
...tion team have decided, together, to follow when localizing mozilla products and web sites. you are free to add, edit, remove, and localize everything in this section according to how the localization team for your language agrees. all we ask is that you name this page according to this example, "mozilla content in spanish (es-mx)" and add your locale code tag at the bottom. enjoy developing your style guide! 31 patching a localization localization say you have found a problem with an existing localization. more specifically, it's a problem with an already released localization. what do you do now? well, you have come to the right place! this page will walk you through creating a patch for an existing localization. the steps below are fairly generic; for the most part they ...
MathML In Action
dy have a mathml-enabled build but what you see on the screenshot is not what you get? in that case you are probably missing some crucial mathml fonts. now that you are well-equipped, you should be able to see this inline equation with varying accents: x ^ + x⁢y ^ + x⁢y⁢z ^ . next to it is this tiny formula, det | a c b d | = a d - b c , which can also be typeset in displaystyle as det | a b c d | = a d - b c . mathematical typesetting is picky. mathml in mozilla aims at complying with the mathml specification so that what you see is what you markup, or to put it another way what you see is what you made, or in short "wysiwym". the difference between these two is in the markup! ( ... ( ( a 0 + a 1 ) n 1 + a 2 ) n 2 + ... + a p ) ...
...n 2 + ... + a p ) n p the roots of this bold equation y 3 + p y + q = 0 are also bold y = - q 2 + q 2 4 + p 3 27 2 3 + - q 2 - q 2 4 + p 3 27 2 3 . ...
... addeventlistener("click", zoomtoggle, false); } window.add...
NSS Developer Tutorial
nss coding style formatting line length should not exceed 80 characters. indentation level is 4. tabs are used heavily in many nss source files. try to stay consistent when you modify existing code. the proper use of tabs has often been confusing for new nss developers, so in nss/lib/ssl, we're gradually removing the use of tabs. curly braces: both of the following styles are allowed: if (condition) { action1(); } else { action2(); } or: if (condition) { action1(); } else { action2(); } the former style is more common. when modifying existing code, try to stay consistent. in new code, prefer the former style, as it conserves vertical space. when a block of code consists of a single statement, nss doesn’t require curly braces, so both of these examples are...
...vertical space. when a block of code consists of a single statement, nss doesn’t require curly braces, so both of these examples are fine: if (condition) { action(); } or: if (condition) action(); although the use of curly braces is more common. ...
... miscellaneous goto can be used, to simplify resource deallocation, before returning from a function. ...
XPCOM array guide
Mozilla › Tech › XPCOM › Guide › Arrays
g pointers, doesn't own the pointer. nsisupportsarray xpcom object yes no yes* no reference counted, strong (*) note: concrete c++ arrays can be made read-only by declaring them const. ...
...in the case of scriptable arrays like nsiarray however, the enumeration mechanism is often preferred because it avoids the addref / release overhead that comes from accessing each object. ...
...const, so we can modify the array void tweakarray(nscomarray<nsielement>& elements, nsielement* newelement) { elements.removeobjectat(0); elements.appendobject(newelement); } in-place enumeration the callback-based enumeration in nscomarray<t> is about as fast as, if not faster than, standard loop-based iteration. the callback mechanism can be useful when integrating with existing callback-style code however. one particularly nice thing about the callback mechanism is that it is typesafe. for instance: pr_callback prbool getfirstvisible(nsielement* element, void* closure) { prbool isvisible; element->isvisible(&isvisible); // stop at first object if (isvisible) { ns_static_cast(closureobject*,closure)->element = element; return pr_false; } return pr_true; } ... // enumera...
nsIDOMWindow
nates from the de-facto dom level 0 standard. starting in firefox 3, dom windows are actually based on nsidomwindow2, which is a subclass of nsidomwindow that adds some new features to this interface. in gecko 7.0 nsidomwindow2 has been merged into this interface. in gecko 8.0 nsidomstoragewindow and nsidomwindowinternal have been merged into this interface. ...
...level 0 standard. starting in firefox 3, dom windows are actually based on nsidomwindow2, which is a subclass of nsidomwindow that adds some new features to this interface. in gecko 7.0 nsidomwindow2 has been merged into this interface. in gecko 8.0 nsidomstoragewindow and nsidomwindowinternal have been merged into this interface. ...
...me-content boundaries. this attribute is "replaceable" in javascript. read only. windowroot nsidomeventtarget the window root for this window. this is useful for connecting event listeners to this window as well as every other window nested in that window root. read only. native code only! note: prior to gecko 7.0 this attribute was part of nsidomwindow2. methods getcomputedstyle() see dom-window-getcomputedstyle for details. nsidomcssstyledeclaration getcomputedstyle( in nsidomelement elt, in domstring pseudoelt optional ); parameters elt pseudoelt optional return value getselection() returns the nsiselection object indicating what if any content is currently selected in the window. nsiselection getselection(); parameters none. return value ...
nsIFile
n this nsifile references the top of the volume. for example, c:\ does not have a parent. read only. path astring this attribute exposes the full platform-specific path of the nsifile (including the leafname). read only. example, this could return "/home/user/foo.txt" or "c:\images\my.jpeg" permissions unsigned long the value of this attribute is a unix-style file permission mask for this nsifile. changing the permissions of a nsifile operates on the underlying filesystem. as of gecko 1.7, changing the permissions of a non-existent file has undefined behavior. permissionsoflink unsigned long the value of this attribute is a unix-style file permission mask for this nsifile. unlike permissions, this attribute corresponds to ...
... the file system corresponding to the file path represented by this nsifile. this method will create any path segments that do not already exist. void create( in unsigned long type, in unsigned long permissions ); parameters type this specifies the type of file system object to be made. the only two types at this time are file and directory which are defined above. permissions a unix-style file permissions value. for example, the octal value 0600 may be used to limit read and write access to the current user of the system. this parameter may be ignored on systems that do not support file permissions. exceptions thrown ns_error_file_already_exists indicates that the file or directory already exists. ns_error_file_unknown_type indicates that the value of "type" does not corre...
...eaf name "suggestedname" until we find one that did not already exist. this method will create any path segments that do not already exist. void createunique( in unsigned long type, in unsigned long permissions ); parameters type this specifies the type of file system object to be made. the only two types at this time are file and directory which are defined above. permissions a unix-style file permissions value. for example, the octal value 0600 may be used to limit read and write access to the current user of the system. this parameter may be ignored on systems that do not support file permissions. exceptions thrown ns_error_file_unknown_type indicates that the value of "type" does not correspond to a known type. ns_error_file_too_big indicates that the search for nonexis...
nsIHTMLEditor
returninparagraphcreatesnewparagraph boolean a boolean indicating if a return key pressed in a paragraph creates another paragraph or just inserts a <br> at the caret. constants constant value description eleft 0 ecenter 1 eright 2 ejustify 3 methods adddefaultproperty() registers a default style property with the editor. void adddefaultproperty( in nsiatom aproperty, in astring aattribute, in astring avalue ); parameters aproperty the property to set by default. aattribute the attribute of the property, if applicable. may be null. example: aproperty="font", aattribute="color" avalue if aattribute is not null, the value of the attribute. example: aproperty="font", aattrib...
...e entirelist abullettype nodeisblock() tests if a node is a block element according the the html 4.0 dtd. this does not consider css effect on display type. boolean nodeisblock( in nsidomnode node ); parameters node return value pastenoformatting() paste the text in the os clipboard at the cursor position, replacing the selected text (if any), but strip out any html styles and formatting. void pastenoformatting( in long aselectiontype ); parameters aselectiontype rebuilddocumentfromsource() rebuild the entire document from source html needed to be able to edit head and other outside-of-body content. void rebuilddocumentfromsource( in astring asourcestring ); parameters asourcestring html source string of the entire new document. removealld...
... in long aselectiontype ); parameters aselectiontype rebuilddocumentfromsource() rebuild the entire document from source html needed to be able to edit head and other outside-of-body content. void rebuilddocumentfromsource( in astring asourcestring ); parameters asourcestring html source string of the entire new document. removealldefaultproperties() unregisters all default style properties with the editor. void removealldefaultproperties(); parameters none. removeallinlineproperties() deletes all the inline properties from all text in the current selection. void removeallinlineproperties(); parameters none. removedefaultproperty() unregisters a default style property with the editor. void removedefaultproperty( in nsiatom aproperty, in astring aattribute...
nsISelectionPrivate
pe(in nsidomrange range); void removeselectionlistener(in nsiselectionlistener listenertoremove); void scrollintoview(in short aregion, in boolean aissynchronous, in short avpercent, in short ahpercent); void setancestorlimiter(in nsicontent acontent); native code only! void setpresshell(in nsipresshell apresshell); native code only! void settextrangestyle(in nsidomrange range, in consttextrangestyleref textrangestyle); native code only! void startbatchchanges(); wstring tostringwithformat(in string formattype, in unsigned long flags, in print32 wrapcolumn); attributes attribute type description cancacheframeoffset boolean frame offset cache can be used just during calling nseditor::endp...
... entire frame to be visible horizontally (if possible). native code only!setancestorlimiter void setancestorlimiter( in nsicontent acontent ); parameters acontent native code only!setpresshell internal utility method to set the pres shell on a newly created selection. ...
...e horizontally (if possible). native code only!setancestorlimiter void setancestorlimiter( in nsicontent acontent ); parameters acontent native code only!setpresshell internal utility method to set the pres shell on a newly created selection. void setpresshell( in nsipresshell apresshell ); parameters apresshell native code only!settextrangestyle set the painting style for the range. the range must be a range in the selection. the textrangestyle will be used by text frame when it is painting the selection. void settextrangestyle( in nsidomrange range, in consttextrangestyleref textrangestyle ); parameters range textrangestyle startbatchchanges() will stop user interface updates while multiple selection methods are called. call endbatchchange...
XUL Overlays
Mozilla › Tech › XUL › Overlays
l). the layout engine loads any overlay files and then flows the resulting xul document, so problems associated with incremental insertion in menus, boxes, tables, and forms are avoided. any number of overlays can be loaded into a master document, and an overlay can also load other overlays. because an overlay is superimposed on the master document, there are no ambiguities relating to scoping of style sheets or scripts. style sheets and scripts loaded by the overlay simply apply to the entire master document. loading overlays dynamically the chrome registry makes it possible to load xul overlays dynamically -- or only when necessary. the chrome registry, which is a special rdf datasource into which user-specific information is persisted, or stored, contains information about the components or ...
... unlike base files, overlays should never load the master skin file for a package. the navigatoroverlay.xul file, for example, does not and should never load the navigator.css file that defines the master skin for the navigator package. since the purpose of an overlay is to define new ui elements for a package within the context of that package's skin, the overlay should add structure but not new style. any skins that are loaded by an overlay destructively replace the master skin for the base file, and can change the basic appearance of the package's skin in unfortunate ways. note: the master skin is not the same as the global skin. for any package, the master skin file is that css file named after the package itself. the master skin file for the bookmarks package, for example, is called book...
...dialog that wants to overlay these buttons just declares the overlay at the top: <?xul-overlay href="chrome://global/content/dialogoverlay.xul"?> and includes an empty box with an id of okcancelbuttons in the ui. the following snippet shows a dialog with custom ui elements at the top and a reference to the overlay's ok and cancel buttons at the bottom: <box align="horizontal" id="bx1" flex="100%" style="margin-bottom: 1em; width: 100%;"> <html:input type="checkbox" id="dialog.newwindow"/> <html:label for="dialog.newwindow">&openwin.label;</html:label> <spring flex="100%"/> </box> <box id="okcancelbuttons"/> for more detail, see the ok and cancel button definitions being referenced here in the global component file platformdialogoverlay.xul. toolbars, submenus, boxes, and any other subtrees ...
Zombie compartments
── object-type-tables [2] │ │ │ │ └──0.01 mb (00.00%) -- sundries │ │ │ │ ├──0.01 mb (00.00%) ── malloc-heap [2] │ │ │ │ └──0.00 mb (00.00%) ── gc-heap [2] │ │ │ └───5.83 mb (01.17%) -- (4 tiny) │ │ │ ├──4.19 mb (00.84%) ++ layout │ │ │ ├──1.03 mb (00.21%) ── style-sheets [2] │ │ │ ├──0.60 mb (00.12%) ++ dom │ │ │ └──0.01 mb (00.00%) ── property-tables [2] │ │ ├───8.86 mb (01.78%) -- cached/window(https://www.google.de/?gws_rd=ssl) │ │ │ ├──4.23 mb (00.85%) -- layout │ │ │ │ ├──3.80 mb (00.76%) ── style-sets │ │ │ │ ├──0.29 mb (00.06%) ─...
...] │ │ ├───8.86 mb (01.78%) -- cached/window(https://www.google.de/?gws_rd=ssl) │ │ │ ├──4.23 mb (00.85%) -- layout │ │ │ │ ├──3.80 mb (00.76%) ── style-sets │ │ │ │ ├──0.29 mb (00.06%) ── pres-shell │ │ │ │ ├──0.05 mb (00.01%) ── rule-nodes │ │ │ │ ├──0.04 mb (00.01%) ── style-contexts │ │ │ │ ├──0.03 mb (00.01%) -- frames │ │ │ │ │ ├──0.02 mb (00.00%) ── sundries │ │ │ │ │ └──0.01 mb (00.00%) ── nsblockframe │ │ │ │ ├──0.01 mb (00.00%) ── pres-contexts │ │ │ │ ├──0.01 mb (00.00%) ── line-boxes │ │ │ │ └──0.00 mb (00.00%) ── ...
......
ctypes
ied as a pathname string. return value a library object representing the opened library. examples example of structtype() on windows let's say we need tb_button, this type needs to be created. so we look up on msdn what the tb_button structures is (msdn :: tb_button structure) and it says it is: typedef struct { int ibitmap; int idcommand; byte fsstate; byte fsstyle; #ifdef _win64 byte breserved[6]; #else #if defined(_win32) byte breserved[2]; #endif #endif dword_ptr dwdata; int_ptr istring; } tbbutton, *ptbbutton, *lptbbutton; so now notice that if it's 64-bit process it's different than if it's 32-bit process. so we will figure that out and create the structure appropriately. this is what the final looks like: var struct_tbbutton; if ...
...at if it's 64-bit process it's different than if it's 32-bit process. so we will figure that out and create the structure appropriately. ...
...style': ctypes.unsigned_char}, {'breserved': ctypes.unsigned_char}, {'breserved2': ctypes.unsigned_char}, {'dwdata': ctypes.uintptr_t}, {'istring': ctypes.intptr_t} ]); } else if (ctypes.voidptr_t.size == 8 /* 64-bit */) { struct_tbbutton = ctypes.structtype('tbbutton', [ {'ibitmap': ctypes.int}, {'idcommand': ctypes.int}, {'fbstate': ctypes.unsigned_char}, {'fsstyle': ctypes.unsigned_char}, {'breserved': ctypes.unsigned_char}, {'breserved2': ctypes.unsigned_char}, {'breserved3': ctypes.unsigned_char}, {'breserved4': ctypes.unsigned_char}, {'breserved5': ctypes.unsigned_char}, {'breserved6': ctypes.unsigned_char}, {'dwdata': ctypes.uintptr_t}, {'istring': ctypes.intptr_t} ]); } else { throw new error("wut?!"); } console.lo...
Plug-in Basics - Plugins
using the object element. though the object element has no hidden attribute, you can create css rules to override the sizing attributes of the object element object { visibility: visible; } object.hiddenobject { visibility: hidden !important; width: 0px !important; height: 0px !important; margin: 0px !important; padding: 0px !important; border-style: none !important; border-width: 0px !important; max-width: 0px !important; max-height: 0px !important; } in this case, the object element that picks up these special style definitions would have a class of hidden. using the class attribute and the css block above, you can simulate the behavior of the hidden plug-in in the embed element: <object data="audiplay.aiff" type="...
...n references section below for more information about embedding activex controls in plug-ins or embedding plug-ins in activex applications. the following examples demonstrate this use of nested object elements with markup more congenial to gecko included as children of the parent object element. ...
... plug-ins or embedding plug-ins in activex applications. the following examples demonstrate this use of nested object elements with markup more congenial to gecko included as children of the parent object element. ...
All keyboard shortcuts - Firefox Developer Tools
toolbox (if the toolbox is in a separate window and in foreground) ctrl + shift + i or f12 cmd + opt + i or f12 ctrl + shift + i or f12 open web console 1 ctrl + shift + k cmd + opt + k ctrl + shift + k toggle "pick an element from the page" (opens the toolbox and/or focus the inspector tab) ctrl + shift + c cmd + opt + c ctrl + shift + c open style editor shift + f7 shift + f7 * shift + f7 open profiler shift + f5 shift + f5 * shift + f5 open network monitor 2 ctrl + shift + e cmd + opt + e ctrl + shift + e toggle responsive design mode ctrl + shift + m cmd + opt + m ctrl + shift + m open browser console ctrl + shift + j cmd + shift + j ctrl + shift + j ...
...+ down arrow alt + down arrow (ctrl + down arrow from firefox 60 onwards). show/hide more information about current property (computed view only, when a property is selected) enter or space return or space enter or space open mdn reference page about current property (computed view only, when a property is selected) f1 f1 f1 open current css file in style editor (computed view only, when more information is shown for a property and a css file reference is focused). enter return enter debugger command windows macos linux close current file ctrl + w cmd + w ctrl + w search for a string in the current file ctrl + f cmd + f ctrl + f search for a string in all files ct...
...xt autocomplete suggestion down arrow down arrow down arrow page up through autocomplete suggestions page up page up page up page down through autocomplete suggestions page down page down page down scroll to start of autocomplete suggestions home home home scroll to end of autocomplete suggestions end end end style editor command windows macos linux open the style editor shift + f7 shift + f7 shift + f7 open autocomplete popup ctrl + space cmd + space ctrl + space scratchpad command windows macos linux open the scratchpad shift + f4 shift + f4 shift + f4 run scratchpad code ctrl + r cmd + r ...
Edit fonts - Firefox Developer Tools
unit of measure from em to px, the value will become 30px. weight the font-weight for the inspected element. you can select values using the slider or enter a numeric value directly into the text box. for non-variable fonts the slider ranges from 100 to 900 in increments of 100. note: for variable fonts (see below) that define a wght variation axis, this range is custom. italic the font-style for the inspected element. this setting toggles between italic and normal values for the font-style css property. note: as you change settings, firefox applies inline styles to the element to make the changes instantly visible on the page. all fonts on page the remaining area, at the bottom of the fonts tab, shows an expandable list of all of the fonts in use on the page. the list is u...
...n the case of fonts loaded from your computer (either default system fonts, or web fonts that you've also got installed on your system). you can copy the url to the font file by clicking on the icon to the right of the url. the @font-face descriptor that loads the font into the page, in the case of web fonts. the descriptor is expandable — when opened it shows its full syntax as defined in the stylesheet. a text sample, to give you an idea of what the font looks like when rendered. the default text for the sample is "abc" but the preview text can be edited by clicking on the input field at the top of the section and entering a new value. once entered, all of the sample text will be set to the same custom value. variable font support in firefox developer tools firefox 62 added support for...
...aracteristics set using font-variation-settings will always override those set using the corresponding basic font properties, e.g. font-weight, no matter where they appear in the cascade. here are the registered axes along with their corresponding css properties: axis tag css property "wght" font-weight "wdth" font-stretch "slnt" (slant) font-style: oblique + angle "ital" font-style: italic "opsz" font-optical-sizing any axis that is not on the list of registered axes is considered a custom axis. custom axes do not have corresponding css font properties. font designers can define whatever axis they want; each one needs to be given a unique four-character tag. the axis name and its range is up to the f...
Paint Flashing Tool - Firefox Developer Tools
and css, determines how to lay it out, and then paints it to actually display the content on the screen. whenever an event happens that might change a visible part of the web page then the browser must repaint some portion of the page. for example, a repaint will be needed if the user scrolls the page or moves the mouse pointer over an element with a :hover pseudo-class that changes the element's style. repainting can be an expensive operation, so the browser tries to minimise the amount of repainting that it needs to do. it tries to work out which parts of the screen are "damaged" and repaint only those. the browser also splits its model of the page into layers that it expects will be updated independently of each other. layers are painted independently and then composited, so a change in the...
...her it is repainting more than it needs to. using the paint flashing tool open the toolbox, then click the icon labeled "highlight painted area": then try using the page. after moving the mouse around and scrolling a bit, the above page looks like this: in this example, there are two main sources of repaints: moving the mouse over links makes the browser repaint them, because they have a style applied using the :hover pseudo-class scrolling makes the browser repaint the new part of the page coming into view at the bottom of the screen, and also the scrollbar at the top-right to deactivate paint flashing, click the "highlight painted area" icon in the toolbox again. example: css transitions one area where implementation choices can affect repaint efficiency is in css transitions. t...
...ies of repaints as the element moves, while the transform version only causes repaints in the start and end positions. why? well, when you use transform, the browser creates a separate layer for the element. so when the element is moved, all that's changed is the relation of the two layers to each other, which is handled in composition: neither layer needs a repaint. in this case, with a simple style, the extra repaints don't make much of a difference. but if the style were computationally expensive to paint, they might. it's difficult to know what optimizations the browser will make to minimize repaints, and they are subject to change from one version to the next. so testing your website with the paint flashing tool helps ensure that it's still performing optimally. ...
AnalyserNode.fftSize - Web APIs
512, 1024, 2048, 4096, 8192, 16384, and 32768. defaults to 2048. note: if its value is not a power of 2, or it is outside the specified range, a domexception with the name indexsizeerror is thrown. example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); ... analyser.fftsize = 2048; var bufferlength = analyser.frequencybincount ; var dataarray = new uint8array...
...analyser = audioctx.createanalyser(); ... ...
...y = new uint8array(bufferlength); analyser.getbytetimedomaindata(dataarray); // draw an oscilloscope of the current audio source function draw() { drawvisual = requestanimationframe(draw); analyser.getbytetimedomaindata(dataarray); canvasctx.fillstyle = 'rgb(200, 200, 200)'; canvasctx.fillrect(0, 0, width, height); canvasctx.linewidth = 2; canvasctx.strokestyle = 'rgb(0, 0, 0)'; canvasctx.beginpath(); var slicewidth = width * 1.0 / bufferlength; var x = 0; for(var i = 0; i < bufferlength; i++) { var v = dataarray[i] / 128.0; var y = v * height/2; if(i === 0) { canvasctx.moveto(x, y); } else { canvasctx.lineto(x, y); } x += slicewidth; } canvasc...
AnalyserNode.frequencyBinCount - Web APIs
related to how the fast fourier transform is defined, it is always half the value of analysernode.fftsize. therefore, it will be one of 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, and 16384. example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect frequency data repeatedly and draw a "winamp bargraph style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); analyser.mindecibels = -90; analyser.maxdecibels = -10; ... analyser.fftsize = 256; var bufferlength = anal...
...ioctx.createanalyser(); analyser.mindecibels = -90; analyser.maxdecibels = -10; ... ...
... working draft ...
AnalyserNode.getByteFrequencyData() - Web APIs
nity. if the array has fewer elements than the analysernode.frequencybincount, excess elements are dropped. if it has more elements than needed, excess elements are ignored. return value none. example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect frequency data repeatedly and draw a "winamp bargraph style" output of the current audio input. for more examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); ... analyser.fftsize = 256; var bufferlength = analyser.frequencybincount; console.log(bufferlength); var dataarray = new ui...
...text || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); ... ...
...asctx.clearrect(0, 0, width, height); function draw() { drawvisual = requestanimationframe(draw); analyser.getbytefrequencydata(dataarray); canvasctx.fillstyle = 'rgb(0, 0, 0)'; canvasctx.fillrect(0, 0, width, height); var barwidth = (width / bufferlength) * 2.5; var barheight; var x = 0; for(var i = 0; i < bufferlength; i++) { barheight = dataarray[i]; canvasctx.fillstyle = 'rgb(' + (barheight+100) + ',50,50)'; canvasctx.fillrect(x,height-barheight/2,barwidth,barheight/2); x += barwidth + 1; } }; draw(); parameters array the uint8array that the frequency domain data will be copied to. specifications specification status comment web audio apithe definition of 'getbytefrequencydata()' in that specification. working draf...
AnalyserNode.getByteTimeDomainData() - Web APIs
copied to. if the array has fewer elements than the analysernode.fftsize, excess elements are dropped. if it has more elements than needed, excess elements are ignored. return value void | none example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). const audioctx = new (window.audiocontext || window.webkitaudiocontext)(); const analyser = audioctx.createanalyser(); ... analyser.fftsize = 2048; const bufferlength = analyser.fftsize; const dataarray = new uint8array(bu...
...udiocontext)(); const analyser = audioctx.createanalyser(); ... ...
...ser.fftsize; const dataarray = new uint8array(bufferlength); analyser.getbytetimedomaindata(dataarray); // draw an oscilloscope of the current audio source function draw() { drawvisual = requestanimationframe(draw); analyser.getbytetimedomaindata(dataarray); canvasctx.fillstyle = 'rgb(200, 200, 200)'; canvasctx.fillrect(0, 0, width, height); canvasctx.linewidth = 2; canvasctx.strokestyle = 'rgb(0, 0, 0)'; const slicewidth = width * 1.0 / bufferlength; let x = 0; canvasctx.beginpath(); for(var i = 0; i < bufferlength; i++) { const v = dataarray[i]/128.0; const y = v * height/2; if(i === 0) canvasctx.moveto(x, y); else canvasctx.lineto(x, y); x += slicewidth; } canvasctx.lineto(width, height/2); canvasctx.stroke(); }; draw(); sp...
AnalyserNode.getFloatFrequencyData() - Web APIs
ncybincount); // fill the float32array with data returned from getfloatfrequencydata() analyser.getfloatfrequencydata(mydataarray); drawing a spectrum the following example shows basic usage of an audiocontext to connect a mediaelementaudiosourcenode to an analysernode. while the audio is playing, we collect the frequency data repeatedly with requestanimationframe() and draw a "winamp bargraph style" to a <canvas> element. for more complete applied examples/information, check out our voice-change-o-matic-float-data demo (see the source code too). <!doctype html> <body> <script> const audioctx = new audiocontext(); //create audio source //here, we use an audio file, but this could also be e.g. microphone input const audioele = new audio(); audioele.src = 'my-audio.mp3';//insert file name h...
...dioele); //create analyser node const analysernode = audioctx.createanalyser(); analysernode.fftsize = 256; const bufferlength = analysernode.frequencybincount; const dataarray = new float32array(bufferlength); //set up audio node network audiosourcenode.connect(analysernode); analysernode.connect(audioctx.destination); //create 2d canvas const canvas = document.createelement('canvas'); canvas.style.position = 'absolute'; canvas.style.top = 0; canvas.style.left = 0; canvas.width = window.innerwidth; canvas.height = window.innerheight; document.body.appendchild(canvas); const canvasctx = canvas.getcontext('2d'); canvasctx.clearrect(0, 0, canvas.width, canvas.height); function draw() { //schedule next redraw requestanimationframe(draw); //get spectrum data analysernode.getfloatfrequ...
...= 0; canvas.width = window.innerwidth; canvas.height = window.innerheight; document.body.appendchild(canvas); const canvasctx = canvas.getcontext('2d'); canvasctx.clearrect(0, 0, canvas.width, canvas.height); function draw() { //schedule next redraw requestanimationframe(draw); //get spectrum data analysernode.getfloatfrequencydata(dataarray); //draw black background canvasctx.fillstyle = 'rgb(0, 0, 0)'; canvasctx.fillrect(0, 0, canvas.width, canvas.height); //draw spectrum const barwidth = (canvas.width / bufferlength) * 2.5; let posx = 0; for (let i = 0; i < bufferlength; i++) { const barheight = (dataarray[i] + 140) * 2; canvasctx.fillstyle = 'rgb(' + math.floor(barheight + 100) + ', 50, 50)'; canvasctx.fillrect(posx, canvas.height - barheight / 2, barw...
AnalyserNode.getFloatTimeDomainData() - Web APIs
ied to. if the array has fewer elements than the analysernode.frequencybincount, excess elements are dropped. if it has more elements than needed, excess elements are ignored. return value none. example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic-float-data demo (see the source code too). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); ... analyser.fftsize = 1024; var bufferlength = analyser.fftsize; console.log(bufferlength); var dataarray = new floa...
...diocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); ... ...
... var bufferlength = analyser.fftsize; console.log(bufferlength); var dataarray = new float32array(bufferlength); canvasctx.clearrect(0, 0, width, height); function draw() { drawvisual = requestanimationframe(draw); analyser.getfloattimedomaindata(dataarray); canvasctx.fillstyle = 'rgb(200, 200, 200)'; canvasctx.fillrect(0, 0, width, height); canvasctx.linewidth = 2; canvasctx.strokestyle = 'rgb(0, 0, 0)'; canvasctx.beginpath(); var slicewidth = width * 1.0 / bufferlength; var x = 0; for(var i = 0; i < bufferlength; i++) { var v = dataarray[i] * 200.0; var y = height/2 + v; if(i === 0) { canvasctx.moveto(x, y); } else { canvasctx.lineto(x, y); } x += slicewidth; } canvasctx.lineto(canvas.width, canvas.height/2); canvasctx.strok...
AnalyserNode.maxDecibels - Web APIs
h an amplitude of maxdecibels or higher will be returned as +1.0 or 255, respectively. note: if a value less than or equal to analysernode.mindecibels is set, an indexsizeerror exception is thrown. example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect frequency data repeatedly and draw a "winamp bargraph style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); analyser.mindecibels = -90; analyser.maxdecibels = -10; ... analyser.fftsize = 256; var bufferlength = anal...
...ioctx.createanalyser(); analyser.mindecibels = -90; analyser.maxdecibels = -10; ... ...
... working draft ...
AnalyserNode.minDecibels - Web APIs
uencies with an amplitude of mindecibels or lower will be returned as 0.0 or 0, respectively. note: if a value greater than analysernode.maxdecibels is set, an index_size_err exception is thrown. example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect frequency data repeatedly and draw a "winamp bargraph style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); analyser.mindecibels = -90; analyser.maxdecibels = -10; ... analyser.fftsize = 256; var bufferlength = anal...
...ioctx.createanalyser(); analyser.mindecibels = -90; analyser.maxdecibels = -10; ... ...
... working draft ...
AnalyserNode.smoothingTimeConstant - Web APIs
apply a blackman window and smooth the values over time. the default value is good enough for most cases. note: if a value outside the range 0–1 is set, an index_size_err exception is thrown. example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect frequency data repeatedly and draw a "winamp bargraph style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). if you are curious about the effect the smoothingtimeconstant() has, try cloning the above example and setting analyser.smoothingtimeconstant = 0; instead. you'll notice that the value changes are much more jarring. var audio...
...ibels = -90; analyser.maxdecibels = -10; analyser.smoothingtimeconstant = 0.85; ... ...
... working draft ...
BaseAudioContext.createAnalyser() - Web APIs
nd frequency data and create data visualisations. note: for more on using this node, see the analysernode page. syntax var analysernode = baseaudiocontext.createanalyser(); returns an analysernode. example the following example shows basic usage of an audiocontext to create an analyser node, then use requestanimationframe() to collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); ... analyser.fftsize = 2048; var bufferlength = analyser.frequencybincount; var dataarray = new uint8array(...
... analyser = audioctx.createanalyser(); ... ...
...y = new uint8array(bufferlength); analyser.getbytetimedomaindata(dataarray); // draw an oscilloscope of the current audio source function draw() { drawvisual = requestanimationframe(draw); analyser.getbytetimedomaindata(dataarray); canvasctx.fillstyle = 'rgb(200, 200, 200)'; canvasctx.fillrect(0, 0, width, height); canvasctx.linewidth = 2; canvasctx.strokestyle = 'rgb(0, 0, 0)'; canvasctx.beginpath(); var slicewidth = width * 1.0 / bufferlength; var x = 0; for(var i = 0; i < bufferlength; i++) { var v = dataarray[i] / 128.0; var y = v * height/2; if(i === 0) { canvasctx.moveto(x, y); } else { canvasctx.lineto(x, y); } x += slicewidth; } canvasc...
CSSKeywordValue - Web APIs
sent css keywords and other identifiers. the interface instance name is a stringifier meaning that when used anywhere a string is expected it will return the value of csskeyword.value. constructor csskeywordvalue.csskeywordvalue() creates a new csskeywordvalue object. properties csskeywordvalue.value returns or sets the value of the csskeywordvalue. ...
...where a string is expected it will return the value of csskeyword.value. constructor csskeywordvalue.csskeywordvalue() creates a new csskeywordvalue object. properties csskeywordvalue.value returns or sets the value of the csskeywordvalue. methods inherits methods from cssstylevalue. examples the following example resets the css display property to its defaults, setting the inline style attribute to style="display: initial" if viewed in the developer tools inspector. ...
...the value of the csskeywordvalue. methods inherits methods from cssstylevalue. examples the following example resets the css display property to its defaults, setting the inline style attribute to style="display: initial" if viewed in the developer tools inspector. #myelement { display: flex; } <div id="myelement">check the developer tools to see the log in the console and to inspect the style attribute on this div.</div> let myelement = document.getelementbyid('myelement').attributestylemap; myelement.set('display', new csskeywordvalue('initial')); console.log( myelement.get('display').value); // 'initial' specifications specification status comment css typed om level 1the definition of 'csskeywordvalue' in that specification. working draft ini...
CSSValueList - Web APIs
ace derives from the cssvalue interface and provides the abstraction of an ordered collection of css values. some properties allow an empty list in their syntax. in that case, these properties take the none identifier. so, an empty list means that the property has the value none. the items in the cssvaluelist are accessible via an integral index, starting from 0. ...
... their syntax. in that case, these properties take the none identifier. so, an empty list means that the property has the value none. the items in the cssvaluelist are accessible via an integral index, starting from 0. ...
...></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, cssvalue. cssvaluelist.lengthread only an unsigned long representing the number of cssvalues in the list. methods cssvaluelist.item() this method is used to retrieve a cssvalue by ordinal index. the order in this collection represents the order of the values in the css style property. if index is greater than or equal to the number of values in the list, this returns null. specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssvalueslist' in that specification. obsolete initial definition ...
Managing screen orientation - Web APIs
>a</li> <li>b</li> <li>c</li> </ul> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. duis lacinia nisi nec sem viverra vitae fringilla nulla ultricies. in ac est dolor, quis tincidunt leo. cras commodo quam non tortor consectetur eget rutrum dolor ultricies. ut interdum tristique dapibus. ...
...nsectetur adipiscing elit. duis lacinia nisi nec sem viverra vitae fringilla nulla ultricies. in ac est dolor, quis tincidunt leo. cras commodo quam non tortor consectetur eget rutrum dolor ultricies. ut interdum tristique dapibus. ...
... nullam quis malesuada est.</p> css relies on the orientation media query to handle specific styles based on the screen orientation /* first let's define some common styles */ html, body { width : 100%; height: 100%; } body { border: 1px solid black; -moz-box-sizing: border-box; box-sizing: border-box; } p { font : 1em sans-serif; margin : 0; padding: .5em; } ul { list-style: none; font : 1em monospace; margin : 0; padding: .5em; -moz-box-sizing: border-box; box-sizing: border-box; background: black; } li { display: inline-block; margin : 0; padding: 0.5em; background: white; } once we have some common styles we can start defining a special case for the orientation /* for portrait, we want the tool bar on top */ @media screen and (orient...
CanvasRenderingContext2D.isPointInPath() - Web APIs
cified path whenever you move the mouse, this example checks whether the cursor is in a circular path2d path. if yes, the circle becomes green, otherwise it is red. ...
... living standard ...
... living standard ...
CanvasRenderingContext2D.isPointInStroke() - Web APIs
ursor is in the stroke of an elliptical path2d path. if yes, the ellipse's stroke becomes green, otherwise it is red. ...
... living standard ...
... living standard ...
CanvasRenderingContext2D.strokeRect() - Web APIs
this method draws directly to the canvas without modifying the current path, so any subsequent fill() or stroke() calls will have no effect on it. syntax void ctx.strokerect(x, y, width, height); the strokerect() method draws a stroked rectangle whose starting point is at (x, y) and whose size is specified by width and height. parameters x the x-axis coordinate of the rectangle's starting point. y the y-axis coordinate of the rectangle's starting point. ...
...alues are down, and negative are up. examples a simple stroked rectangle this example draws a rectangle with a green outline using the strokerect() method. html <canvas id="canvas"></canvas> javascript the rectangle's top-left corner is at (20, 10). it has a width of 160 and a height of 100. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.strokestyle = 'green'; ctx.strokerect(20, 10, 160, 100); result applying various context settings this example draws a rectangle with a drop shadow and thick, beveled outlines. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.shadowcolor = '#d53'; ctx.shadowblur = 20; ctx.linejoin = 'bevel'; ctx.linewidth = 15;...
... ctx.strokerect(20, 10, 160, 100); result applying various context settings this example draws a rectangle with a drop shadow and thick, beveled outlines. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.shadowcolor = '#d53'; ctx.shadowblur = 20; ctx.linejoin = 'bevel'; ctx.linewidth = 15; ctx.strokestyle = '#38f'; ctx.strokerect(30, 30, 160, 90); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.strokerect' in that specification. living standard ...
Optimizing canvas - Web APIs
our game into three <canvas> layers. the ui would change only upon user input, the gameplay layer would change with every new frame, and the background would remain generally unchanged. ...
...ight="320"></canvas> <canvas id="game-layer" width="480" height="320"></canvas> <canvas id="background-layer" width="480" height="320"></canvas> </div> <style> #stage { width: 480px; height: 320px; position: relative; border: 2px solid black; } canvas { position: absolute; } #ui-layer { z-index: 3; } #game-layer { z-index: 2; } #background-layer { z-index: 1; } </style> use plain css for large background images if you have a static background image, you can draw it onto a plain <div> element using the css background property and position it under the canvas. this will negate the need to render the background to the canvas on every tick. scaling canvas using css transforms css transforms are faster since they use the gpu. the best case is to not scale the c...
...ing canvas using css transforms css transforms are faster since they use the gpu. the best case is to not scale the canvas, or have a smaller canvas and scale up rather than a bigger canvas and scale down. var scalex = window.innerwidth / canvas.width; var scaley = window.innerheight / canvas.height; var scaletofit = math.min(scalex, scaley); var scaletocover = math.max(scalex, scaley); stage.style.transformorigin = '0 0'; //scale from top left stage.style.transform = 'scale(' + scaletofit + ')'; turn off transparency if your application uses canvas and doesn’t need a transparent backdrop, set the alpha option to false when creating a drawing context with htmlcanvaselement.getcontext(). this information can be used internally by the browser to optimize rendering. var ctx = canvas.getc...
Document.readyState - Web APIs
es the loading state of the document. when the value of this property changes, a readystatechange event fires on the document object. syntax var string = document.readystate; values the readystate of a document can be one of following: loading the document is still loading. interactive the document has finished loading and the document has been parsed but sub-resources such as images, stylesheets and frames are still loading. complete the document and all sub-resources have finished loading. the state indicates that the load event is about to fire. examples different states of readiness switch (document.readystate) { case "loading": // the document is still loading. break; case "interactive": // the document has finished loading. we can now access the dom eleme...
... the document and all sub-resources have finished loading. the state indicates that the load event is about to fire. examples different states of readiness switch (document.readystate) { case "loading": // the document is still loading. break; case "interactive": // the document has finished loading. we can now access the dom elements. ...
.../ the document has finished loading. we can now access the dom elements. // but sub-resources such as images, stylesheets and frames are still loading. var span = document.createelement("span"); span.textcontent = "a <span> element."; document.body.appendchild(span); break; case "complete": // the page is fully loaded. ...
Introduction to the DOM - Web APIs
and content of a document on the web. in this guide, we'll briefly introduce the dom. we'll look at how the dom represents an html or xml document in memory and how you use apis to create web content and applications. what is the dom? the document object model (dom) is a programming interface for html and xml documents. it represents the page so that programs can change the document structure, style, and content. the dom represents the document as nodes and objects. that way, programming languages can connect to the page. a web page is a document. this document can be either displayed in the browser window or as the html source. but it is the same document in both cases. the document object model (dom) represents that same document so it can be manipulated. the dom is an object-oriented rep...
...lements may also have specific interfaces for dealing with the kind of data those elements hold, as in the table object example in the previous section. the following is a brief list of common apis in web and xml page scripting using the dom. document.getelementbyid(id) document.getelementsbytagname(name) document.createelement(name) parentnode.appendchild(node) element.innerhtml element.style.left element.setattribute() element.getattribute() element.addeventlistener() window.content window.onload window.scrollto() testing the dom api this document provides samples for every interface that you can use in your own web development. in some cases, the samples are complete html pages, with the dom access in a <script> element, the interface (e.g, buttons) necessary to fire up the...
...erested in and see how they work on the browser platform. you can update the contents of the test() function as needed, create more buttons, or add elements as necessary. ...
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
vigation menu items. because they are blocks, many people expect that they will behave as such, but really they don’t. if there is formatting whitespace between adjacent inline elements, this will result in space in the layout, just like the spaces between words in text. ...
... visible): .people-list { list-style-type: none; margin: 0; padding: 0; } .people-list li { display: inline-block; width: 2em; height: 2em; background: #f06; border: 1px solid; } <ul class="people-list">⏎ ◦◦<li></li>⏎ ◦◦<li></li>⏎ ◦◦<li></li>⏎ ◦◦<li></li>⏎ ◦◦<li></li>⏎ </ul> this renders as follows: hidden example 3 .people-list { list-style-type: none; margin: 0; padding: 0; } .people-list li { display: inline-block; width: 2em; height: 2em; background: #f06; border: 1px solid; } <ul class="people-list"> <li></li> <li></li> <li></li> <li></li> <li></li> </ul> you probably don't want the gaps in between the blocks — depending on the use case (is this a list of avatars, or horizontal nav buttons?), you probably...
... elements are taking up — useful if you are wondering what is causing the problem, and are maybe thinking you've got some extra margin in there or something! there are a few ways of getting around this problem: use flexbox to create the horizontal list of items instead of trying an inline-block solution. this handles everything for you, and is definitely the preferred solution: ul { list-style-type: none; margin: 0; padding: 0; display: flex; } if you need to rely on inline-block, you could set the font-size of the list to 0. this only works if your blocks are not sized with ems (based on the font-size, so the block size would also end up being 0). rems would be a good choice here: ul { font-size: 0; ... } li { display: inline-block; width: 2rem; height: 2rem; ... ...
Document Object Model (DOM) - Web APIs
ting a web page—in memory. usually, that means javascript, although modeling html, svg, or xml documents as objects are not part of the core javascript language, as such. the dom represents a document with a logical tree. each branch of the tree ends in a node, and each node contains objects. dom methods allow programmatic access to the tree. with them, you can change the document's structure, style, or content. nodes can also have event handlers attached to them. once an event is triggered, the event handlers get executed. to learn more about what the dom is and how it represents documents, see our article introduction to the dom. dom interfaces attr cdatasection characterdata childnode comment customevent document documentfragment documenttype domerror domexception ...
...ontaining html is described using the document interface, which is extended by the html specification to include various html-specific features. in particular, the element interface is enhanced to become htmlelement and various subclasses, each representing one of (or a family of closely related) elements. the html dom api provides access to various browser features such as tabs and windows, css styles and stylesheets, browser history, and so forth. these interfaces are discussed further in the html dom api documentation. svg interfaces svg element interfaces svgaelement svgaltglyphelement svgaltglyphdefelement svgaltglyphitemelement svganimationelement svganimateelement svganimatecolorelement svganimatemotionelement svganimatetransformelement svgcircleelement svgclippa...
... static ...
Element: blur event - Web APIs
html <form id="form"> <input type="text" placeholder="text input"> <input type="pa...
... html <form id="form"> <input type="text" placeholder="text input"> <input type="password" placeholder="password"> </form> javascript const form = document.getelementbyid('for...
...ways of implementing event delegation for this event: by using the focusout event, or by setting the usecapture parameter of addeventlistener() to true. html <form id="form"> <input type="text" placeholder="text input"> <input type="password" placeholder="password"> </form> javascript const form = document.getelementbyid('form'); form.addeventlistener('focus', (event) => { event.target.style.background = 'pink'; }, true); form.addeventlistener('blur', (event) => { event.target.style.background = ''; }, true); result specifications specification status comment ui events working draft added info that this event is composed. document object model (dom) level 3 events specification obsolete initial definition ...
Element: focus event - Web APIs
html <form id="form"> <input type="text" placeholder="text input"> <input type="pas...
... html <form id="form"> <input type="text" placeholder="text input"> <input type="password" placeholder="password"> </form> javascript const form = document.getelementbyid('form...
... ways of implementing event delegation for this event: by using the focusin event, or by setting the usecapture parameter of addeventlistener() to true. html <form id="form"> <input type="text" placeholder="text input"> <input type="password" placeholder="password"> </form> javascript const form = document.getelementbyid('form'); form.addeventlistener('focus', (event) => { event.target.style.background = 'pink'; }, true); form.addeventlistener('blur', (event) => { event.target.style.background = ''; }, true); result specifications specification status comment ui events working draft added info that this event is composed. document object model (dom) level 3 events specification obsolete initial definition ...
Element - Web APIs
Web › API › Element
specific classes inherit from element. for example, the htmlelement interface is the base interface for html elements, while the svgelement interface is the basis for all svg elements. most functionality is specified further down the class hierarchy. languages outside the realm of the web platform, like xul through the xulelement interface, also implement element. ...
...e is the basis for all svg elements. most functionality is specified further down the class hierarchy. languages outside the realm of the web platform, like xul through the xulelement interface, also implement element. ...
...nd run an animation on an element. returns the created animation object instance. element.closest() returns the element which is the closest ancestor of the current element (or the current element itself) which matches the selectors given in parameter. element.createshadowroot() creates a shadow dom on on the element, turning it into a shadow host. returns a shadowroot. element.computedstylemap() returns a stylepropertymapreadonly interface which provides a read-only representation of a css declaration block that is an alternative to cssstyledeclaration. eventtarget.dispatchevent() dispatches an event to this node in the dom and returns a boolean that indicates whether no handler canceled the event. element.getanimations() returns an array of animation objects currently acti...
Comparison of Event Targets - Web APIs
n-native target of the event before composition from shadow dom. ...
...le { border-collapse: collapse; height: 150px; width: 100%; } td { border: 1px solid #ccc; font-weight: bold; padding: 5px; min-height: 30px; } .standard { background-color: #99ff99; } .non-standard { background-color: #902d37; } </style> </head> <body> <table> <thead> <tr> <td class="standard">original target dispatching the event <small>event.target</small></td> <td class="standard">target who's event listener is being processed <small>event.currenttarget</small></td> <td class="standard">identify other element (if any) involved in the event <small>event.relatedtarget</small><...
...ting device exited the eventtarget which the pointing device entered todo: also needs descriptions for dragenter and dragexit events. example <hbox id="outer"> <hbox id="inner" onmouseover="dump('mouseover ' + event.relatedtarget.id + ' > ' + event.target.id + '\n');" onmouseout="dump('mouseout ' + event.target.id + ' > ' + event.relatedtarget.id + '\n');" style="margin: 100px; border: 10px solid black; width: 100px; height: 100px;" /> </hbox> ...
GlobalEventHandlers.onanimationend - Web APIs
#box { width: var(--boxwidth); height: var(--boxwidth); left: 0; top: 0; border: 1px solid #7788ff; ...
...cida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, let's take a look at the styles for the box that we're animating. first is the box itself. we set its size, position, color, and layout. note that there's nothing there about animation. that's because we don't want the box to start animating right away. we'll add the animation style later to start animating the box. #box { width: var(--boxwidth); height: var(--boxwidth); left: 0; top: 0; border: 1px solid #7788ff; margin: 0; position: relative; background-color: #2233ff; display: flex; justify-content: center; } the animation sequence is described next. first, the "slideanimation" class, which establishes the animation that will cause the box to move...
...for information about why, and how to support running an animation more than once, see run an animation again in css animations tips and tricks. result assembled together, you get t...
GlobalEventHandlers.onanimationstart - Web APIs
#box { width: var(--boxwidth); height: var(--boxwidth); left: 0; top: 0; border: 1px solid #7788ff; ...
...cida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, let's take a look at the styles for the box that we're animating. first is the box itself. we set its size, position, color, and layout. note that there's nothing there about animation. that's because we don't want the box to start animating right away. we'll add the animation style later to start animating the box. #box { width: var(--boxwidth); height: var(--boxwidth); left: 0; top: 0; border: 1px solid #7788ff; margin: 0; position: relative; background-color: #2233ff; display: flex; justify-content: center; } the animation sequence is described next. first, the "slideanimation" class, which establishes the animation that will cause the box to move...
...for information about why, and how to support running an animation more than once, see run an animation again in css animations tips and tricks. result assembled together, you get t...
GlobalEventHandlers.ondrag - Web APIs
for the drag event. syntax var draghandler = targetelement.ondrag; return value draghandler the drag event handler for element targetelement. example this example includes the use of the ondrag attribute handler to set an element's drag event handler. ...
...his example includes the use of the ondrag attribute handler to set an element's drag event handler. ...
...margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("drag"); } function dragstart_handler(ev) { console.log("dragstart"); ev.datatransfer.setdata("text", ev.target.id); } function drop_handler(ev) { console.log("drop"); ev.currenttarget.style.background = "lightyellow"; ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); } </script> <body> <h1>examples of <code>ondrag</code>, <code>ondrop</code>, <code>ondragstart</code>, <code>ondragover</code></h1> <div> <!-- <div class="source"> ...
GlobalEventHandlers.ondragover - Web APIs
yntax var dragoverhandler = targetelement.ondragover; return value dragoverhandler the dragover event handler for element targetelement. example this example demonstrates using the ondragover attribute handler to set an element's dragover event handler. ...
...mple demonstrates using the ondragover attribute handler to set an element's dragover event handler. ...
...margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("drag"); } function dragstart_handler(ev) { console.log("dragstart"); ev.datatransfer.setdata("text", ev.target.id); } function drop_handler(ev) { console.log("drop"); ev.currenttarget.style.background = "lightyellow"; ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); } </script> <body> <h1>examples of <code>ondrag</code>, <code>ondrop</code>, <code>ondragstart</code>, <code>ondragover</code></h1> <div> <p id="source" ondrag="...
GlobalEventHandlers.ondragstart - Web APIs
var dragstarthandler = targetelement.ondragstart; return value dragstarthandler the dragstart event handler for element targetelement. example this example demonstrates using the ondragstart attribute handler to set an element's dragstart event handler. ...
...le demonstrates using the ondragstart attribute handler to set an element's dragstart event handler. ...
...margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("drag"); } function dragstart_handler(ev) { console.log("dragstart"); ev.datatransfer.setdata("text", ev.target.id); } function drop_handler(ev) { console.log("drop"); ev.currenttarget.style.background = "lightyellow"; ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); } </script> <body> <h1>examples of <code>ondrag</code>, <code>ondrop</code>, <code>ondragstart</code>, <code>ondragover</code></h1> <div> <p id="source" ondrag="...
GlobalEventHandlers.ondrop - Web APIs
r for the drop event. syntax var drophandler = targetelement.ondrop; return value drophandler the drop event handler for element targetelement. example this example demonstrates the use of the ondrop attribute to define an element's drop event handler. ...
...this example demonstrates the use of the ondrop attribute to define an element's drop event handler. ...
...margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("drag"); } function dragstart_handler(ev) { console.log("dragstart"); ev.datatransfer.setdata("text", ev.target.id); } function drop_handler(ev) { console.log("drop"); ev.currenttarget.style.background = "lightyellow"; ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); } </script> <body> <h1>examples of <code>ondrag</code>, <code>ondrop</code>, <code>ondragstart</code>, <code>ondragover</code></h1> <div class="source"> <p id="s...
GlobalEventHandlers.ontransitionend - Web APIs
sedtime, which is zero until the delay period ends and the animation begins. example in this example, we use the transitionrun and transitionend events to detect when the transition begins and ends, to cause a text update to occur during the transition. this could also be used to trigger animations or other effects, to allow chaining of reactions. ...
...un and transitionend events to detect when the transition begins and ends, to cause a text update to occur during the transition. this could also be used to trigger animations or other effects, to allow chaining of reactions. html this simply creates a <div> which we'll style with css below to make into a box that resizes and changes color and such. ...
...tions. html this simply creates a <div> which we'll style with css below to make into a box that resizes and changes color and such. <div class="box"></div> css the css below styles the box and applies a transition effect which makes the box's color and size change, and causes the box to rotate, while the mouse cursor hovers over it. ...
HTMLButtonElement - Web APIs
the htmlbuttonelement interface provides properties and methods (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating <button> elements. ...
... the htmlbuttonelement interface provides properties and methods (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating <button> elements. ...
...ent name return type description checkvalidity() boolean not supported for reset or button elements. reportvalidity() boolean not supported for reset or button elements. setcustomvalidity(in domstring error) void not supported for reset or button elements. with gecko-based browser, use the :-moz-submit-invalid pseudo-class to style submit buttons based on the validation of a form. specifications specification status comment html living standardthe definition of 'htmlbuttonelement' in that specification. living standard html 5.2the definition of 'htmlbuttonelement' in that specification. recommendation the menu attribute and type="menu" value have been removed. htm...
HTMLCanvasElement.toBlob() - Web APIs
pport converting from png to ico, so it uses bmp instead. a download link is created by setting the download attribute. the value of the download attribute is the name it will use as the file name. ...
...r canvas = document.getelementbyid('canvas'); var d = canvas.width; ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.moveto(d / 2, 0); ctx.lineto(d, d); ctx.lineto(0, d); ctx.closepath(); ctx.fillstyle = 'yellow'; ctx.fill(); function blobcallback(iconname) { return function(b) { var a = document.createelement('a'); a.textcontent = 'download'; document.body.appendchild(a); a.style.display = 'block'; a.download = iconname + '.ico'; a.href = window.url.createobjecturl(b); } } canvas.toblob(blobcallback('passthisstring'), 'image/vnd.microsoft.icon', '-moz-parse-options:format=bmp;bpp=32'); save toblob to disk with os.file (chrome/add-on context only) this technique saves it to the desktop and is only useful in firefox chrome context or add-on code ...
...blob to disk with os.file (chrome/add-on context only) this technique saves it to the desktop and is only useful in firefox chrome context or add-on code as os apis are not present on web sites. var canvas = document.getelementbyid('canvas'); var d = canvas.width; ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.moveto(d / 2, 0); ctx.lineto(d, d); ctx.lineto(0, d); ctx.closepath(); ctx.fillstyle = 'yellow'; ctx.fill(); function blobcallback(iconname) { return function(b) { var r = new filereader(); r.onloadend = function () { // r.result contains the arraybuffer. cu.import('resource://gre/modules/osfile.jsm'); var writepath = os.path.join(os.constants.path.desktopdir, iconname + '.ico'); var promise = os.file.writeatomic(writepa...
HTMLElement.innerText - Web APIs
ed text content of an element. if the element itself is not being rendered (e.g detached from the document or is hidden from view), the returned value is the same as the node.textcontent property. example this example compares innertext with node.textcontent. note how innertext is aware of things like <br> elements, and ignores hidden elements. ...
...dered (e.g detached from the document or is hidden from view), the returned value is the same as the node.textcontent property. example this example compares innertext with node.textcontent. note how innertext is aware of things like <br> elements, and ignores hidden elements. ...
... node.textcontent property. example this example compares innertext with node.textcontent. note how innertext is aware of things like <br> elements, and ignores hidden elements. ...
HTMLElement.offsetTop - Web APIs
(having display:none does not affect this browser.) ...
...(having display:none does not affect this browser.) ...
...(having display:none does not affect this browser.) ...
HTMLLIElement - Web APIs
the htmllielement interface exposes specific properties and methods (beyond those defined by regular htmlelement interface it also has available to it by inheritance) for manipulating list elements. ...
... the htmllielement interface exposes specific properties and methods (beyond those defined by regular htmlelement interface it also has available to it by inheritance) for manipulating list elements. ...
... fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmllielement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmllielement.type is a domstring representing the type of the bullets, "disc", "square" or "circle". as the standard way of defining the list type is via the css list-style-type property, use the cssom methods to set it via a script. htmllielement.value is a long indicating the ordinal position of the list element inside a given <ol>. it reflects the value attribute of the html <li> element, and can be smaller than 0. if the <li> element is not a child of an <ol> element, the property has no meaning. methods no specific method; inherits properties from its pare...
HTMLMarqueeElement - Web APIs
the htmlmarqueeelement interface provides methods to manipulate <marquee> elements. it inherits properties and methods from the htmlelement interface. ...
... the htmlmarqueeelement interface provides methods to manipulate <marquee> elements. it inherits properties and methods from the htmlelement interface. ...
...ethods inherits methods from its parent, htmlelement. htmlmarqueeelement.start() starts scrolling of the marquee. htmlmarqueeelement.stop() stops scrolling of the marquee. examples <marquee>this text will scroll from right to left</marquee> <marquee direction="up">this text will scroll from bottom to top</marquee> <marquee direction="down" width="250" height="200" behavior="alternate" style="border:solid"> <marquee behavior="alternate"> this text will bounce </marquee> </marquee> specifications specification status comment html living standardthe definition of 'htmlmarqueeelement' in that specification. living standard made obsolete in favor of css but define its expected behavior for backward compatibility. html 5.2the definition o...
HTMLSelectElement - Web APIs
the htmlselectelement interface represents a <select> html element. these elements also share all of the properties and methods of other html elements via the htmlelement interface. ...
... the htmlselectelement interface represents a <select> html element. these elements also share all of the properties and methods of other html elements via the htmlelement interface. ...
...tisfies them. if the element fails its constraints, the browser fires a cancelable invalid event at the element (and returns false). htmlselectelement.focus() gives input focus to this element. this method is now implemented on htmlelement. htmlselectelement.item() gets an item from the options collection for this <select> element. you can also access an item by specifying the index in array-style brackets or parentheses, without calling this method explicitly. htmlselectelement.nameditem() gets the item in the options collection with the specified name. the name string can match either the id or the name attribute of an option node. you can also access an item by specifying the name in array-style brackets or parentheses, without calling this method explicitly. htmlselectelement.remove...
HTMLTextAreaElement - Web APIs
the htmltextareaelement interface provides special properties and methods for manipulating the layout and presentation of <textarea> elements. ...
... the htmltextareaelement interface provides special properties and methods for manipulating the layout and presentation of <textarea> elements. ...
...events using addeventlistener() or by assigning an event listener to the oneventname property of this interface: input event fires when the value of an <input>, <select>, or <textarea> element has been changed. ...
InputEvent.dataTransfer - Web APIs
a datatransfer object. examples in the following simple example we've set up an event listener on the input event so that when any content is pasted into the contenteditable <p> element, its html source is retrieved via the inputevent.datatransfer.getdata() method and reported in the paragraph below the input. try copying and pasting some of the content provided to see the effects. ...
...an event listener on the input event so that when any content is pasted into the contenteditable <p> element, its html source is retrieved via the inputevent.datatransfer.getdata() method and reported in the paragraph below the input. try copying and pasting some of the content provided to see the effects. ...
...tener on the input event so that when any content is pasted into the contenteditable <p> element, its html source is retrieved via the inputevent.datatransfer.getdata() method and reported in the paragraph below the input. try copying and pasting some of the content provided to see the effects. ...
Using the Permissions API - Web APIs
cation" button appear). "denied" the "enable geolocation" button is revealed (this code needs to be here too, in case the permission state is already set to denied for this origin when the page is first loaded). ...
...oo, in case the permission state is already set to denied for this origin when the page is first loaded). ...
...some apis have more complex permissio...
ProcessingInstruction - Web APIs
ion targeting a specific application but that can be ignored by any other applications which don't recognize the instruction. a processing instruction is different from the xml declaration. ...
...processing instruction is different from the xml declaration. user-defined processing instructions cannot begin with "xml", as xml-prefixed processing-instruction target names are reserved by the xml specification for particular, standard uses (see, for example, <?xml-stylesheet ?>). the processinginstruction interface inherits methods and properties from node. ...
...-prefixed processing-instruction target names are reserved by the xml specification for particular, standard uses (see, for example, <?xml-stylesheet ?>). the processinginstruction interface inherits methods and properties from node. ...
ProgressEvent - Web APIs
the progressevent interface represents events measuring progress of an underlying process, like an http request (for an xmlhttprequest, or the loading of the underlying resource of an <img>, <audio>, <video>, <style> or <link>). ...
... the progressevent interface represents events measuring progress of an underlying process, like an http request (for an xmlhttprequest, or the loading of the underlying resource of an <img>, <audio>, <video>, <style> or <link>). ...
...essevent interface represents events measuring progress of an underlying process, like an http request (for an xmlhttprequest, or the loading of the underlying resource of an <img>, <audio>, <video>, <style> or <link>). ...
ResizeObserver.observe() - Web APIs
sets which box model the observer will observe changes to. possible values are content-box (the default), and border-box. return value void. exceptions none. ...
...-box (the default), and border-box. return value void. exceptions none. ...
...wing snippet is taken from the resize-observer-text.html (see source) example: const resizeobserver = new resizeobserver(entries => { for (let entry of entries) { if(entry.contentboxsize) { h1elem.style.fontsize = math.max(1.5, entry.contentboxsize.inlinesize/200) + 'rem'; pelem.style.fontsize = math.max(1, entry.contentboxsize.inlinesize/600) + 'rem'; } else { h1elem.style.fontsize = math.max(1.5, entry.contentrect.width/200) + 'rem'; pelem.style.fontsize = math.max(1, entry.contentrect.width/600) + 'rem'; } } }); resizeobserver.observe(divelem); an observe() call with an options object would look like so: resizeobserver.observe(divelem, { box : 'border-box' }); specifications specification status comment resize observerthe ...
ResizeObserver.unobserve() - Web APIs
or svgelement. syntax void unobserve(target); parameters target a reference to an element or svgelement to be unobserved. return value void. exceptions none. ...
...element or svgelement to be unobserved. return value void. exceptions none. ...
...wing snippet is taken from the resize-observer-text.html (see source) example: const resizeobserver = new resizeobserver(entries => { for (let entry of entries) { if(entry.contentboxsize) { h1elem.style.fontsize = math.max(1.5, entry.contentboxsize.inlinesize/200) + 'rem'; pelem.style.fontsize = math.max(1, entry.contentboxsize.inlinesize/600) + 'rem'; } else { h1elem.style.fontsize = math.max(1.5, entry.contentrect.width/200) + 'rem'; pelem.style.fontsize = math.max(1, entry.contentrect.width/600) + 'rem'; } } }); resizeobserver.observe(divelem); checkbox.addeventlistener('change', () => { if(checkbox.checked) { resizeobserver.observe(divelem); } else { resizeobserver.unobserve(divelem); } }); specifications specification ...
ResizeObserver - Web APIs
f it is turned off, the text will not change in response to the <div>'s width changing. ...
...th changing. ...
...'body > div'); const slider = document.queryselector('input[type="range"]'); const checkbox = document.queryselector('input[type="checkbox"]'); divelem.style.width = '600px'; slider.addeventlistener('input', () => { divelem.style.width = slider.value + 'px'; }) const resizeobserver = new resizeobserver(entries => { for (const entry of entries) { if (entry.contentboxsize) { h1elem.style.fontsize = math.max(1.5, entry.contentboxsize.inlinesize / 200) + 'rem'; pelem.style.fontsize = math.max(1, entry.contentboxsize.inlinesize / 600) + 'rem'; } else { h1elem.style.fontsize = math.max(1.5, entry.contentrect.width / 200) + 'rem'; pelem.style.fontsize = math.max(1, entry.contentrect.width / 600) + 'rem'; } } }); resizeobserver.observe(divelem); checkbox.a...
ResizeObserverEntry.contentRect - Web APIs
rom the resize-observer-text.html (see source) example. this uses a simple feature detection test to see if the browser supports the newer resizeobserverentry.contentboxsize property — if so, it uses that to get the sizing data it needs. if not, it uses contentrect. ...
...ion test to see if the browser supports the newer resizeobserverentry.contentboxsize property — if so, it uses that to get the sizing data it needs. if not, it uses contentrect. ...
...so, it uses that to get the sizing data it needs. if not, it uses contentrect. const resizeobserver = new resizeobserver(entries => { for (let entry of entries) { if(entry.contentboxsize) { h1elem.style.fontsize = math.max(1.5, entry.contentboxsize.inlinesize/200) + 'rem'; pelem.style.fontsize = math.max(1, entry.contentboxsize.inlinesize/600) + 'rem'; } else { h1elem.style.fontsize = math.max(1.5, entry.contentrect.width/200) + 'rem'; pelem.style.fontsize = math.max(1, entry.contentrect.width/600) + 'rem'; } } }); resizeobserver.observe(divelem); specifications specification status comment resize observerthe definition of 'contentrect' in that specification. editor's draft initial definition. ...
ResizeObserverEntry.target - Web APIs
on to the size of the box. we could just implement this using border-radius with a percentage, but that quickly leads to ugly-looking elliptical corners; this solution gives you nice square corners that scale with the box size. ...
...s solution gives you nice square corners that scale with the box size. to grab a reference to the observed element so we can update its border-radius value after each change, we make use of the target property of each entry — entry.target.style.borderradius. ...
...perty of each entry — entry.target.style.borderradius. const resizeobserver = new resizeobserver(entries => { for (let entry of entries) { if(entry.contentboxsize) { entry.target.style.borderradius = math.min(100, (entry.contentboxsize.inlinesize/10) + (entry.contentboxsize.blocksize/10)) + 'px'; } else { entry.target.style.borderradius = math.min(100, (entry.contentrect.width/10) + (entry.contentrect.height/10)) + 'px'; } } }); resizeobserver.observe(document.queryselector('div')); specifications specification status comment resize observerthe definition of 'target' in that specification. editor's draft initial definition. ...
ResizeObserverEntry - Web APIs
from the resize-observer-text.html (see source) example. this uses a simple feature detection test to see if the browser supports the newer contentboxsize property — if so, it uses that to get the sizing data it needs. if not, it uses the older contentrect property. ...
...tion test to see if the browser supports the newer contentboxsize property — if so, it uses that to get the sizing data it needs. if not, it uses the older contentrect property. ...
... get the sizing data it needs. if not, it uses the older contentrect property. const resizeobserver = new resizeobserver(entries => { for (let entry of entries) { if(entry.contentboxsize) { h1elem.style.fontsize = math.max(1.5, entry.contentboxsize.inlinesize/200) + 'rem'; pelem.style.fontsize = math.max(1, entry.contentboxsize.inlinesize/600) + 'rem'; } else { h1elem.style.fontsize = math.max(1.5, entry.contentrect.width/200) + 'rem'; pelem.style.fontsize = math.max(1, entry.contentrect.width/600) + 'rem'; } } }); resizeobserver.observe(divelem); specifications specification status comment resize observerthe definition of 'resizeobserverentry' in that specification. editor's draft initial definition. ...
Resize Observer API - Web APIs
e to a specific element's size changing, which isn't the outer container? to achieve this, a limited solution would be to listen to changes to a suitable event that hints at the element you are interested in changing size (e.g. the window resize event), then figure out what the new dimensions or other features of the element after a resize using element.getboundingclientrect or window.getcomputedstyle, for example. such a solution tends to only work for limited use cases, be bad for performance (continually calling the above methods would result in a big performance hit), and often won't work when the browser window size is not changed. the resize observer api provides a solution to exactly these kinds of problems, and more besides, allowing you to easily observe and respond to changes in th...
...using the containing <div> to change width. this shows that you can respond to changes in an element’s size, even if they have nothing to do with the viewport. ...
... ...
SVGSVGElement - Web APIs
the svgsvgelement interface provides access to the properties of <svg> elements, as well as methods to manipulate them. this interface contains also various miscellaneous commonly-used utility methods, such as matrix operations and the ability to control the time of redraw on visual rendering devices. ...
... well as methods to manipulate them. this interface contains also various miscellaneous commonly-used utility methods, such as matrix operations and the ability to control the time of redraw on visual rendering devices. ...
...ment. svgsvgelement.width read only an svganimatedlength corresponding to the width attribute of the given <svg> element. svgsvgelement.height read only an svganimatedlength corresponding to the height attribute of the given <svg> element. svgsvgelement.contentscripttype an svganimatedlength corresponding to the contentscripttype attribute of the given <svg> element. svgsvgelement.contentstyletype an svganimatedlength corresponding to the contentstyletype attribute of the given <svg> element. svgsvgelement.viewport an svgrect containing the position and size of the viewport (implicit or explicit) that corresponds to the given <svg> element. when the browser is actually rendering the content, then the position and size values represent the actual values when rendering. the position a...
Using the Screen Capture API - Web APIs
ing on browsers that support it but do not implement the current standard api. this works with at least chrome, edge, and firefox. capturing screen contents capturing screen contents as a live mediastream is initiated by calling navigator.mediadevices.getdisplaymedia(), which returns a promise that resolves to a stream containing the live screen contents. ...
...tions) { let capturestream = null; try { capturestream = await navigator.mediadevices.getdisplaymedia(displaymediaoptions); } catch(err) { console.error("error: " + err); } return capturestream; } you can write this code either using an asynchronous function and the await operator, as shown above, or using the promise directly, as seen below. starting screen capture: promise style function startcapture(displaymediaoptions) { let capturestream = null; return navigator.mediadevices.getdisplaymedia(displaymediaoptions) .catch(err => { console.error("error:" + err); return null; }); } either way, the user agent responds by presenting a user interface that prompts the user to choose the screen area to share. both of these implementations of startcapture() return the me...
...ntents are streamed. a <pre> block into which logged text is placed by the intercepted consolemethod. css the css is entirely cosmetic in this example. the video is given a border, and its width is set to occupy nearly the entire available horizontal space (width: 98%). max-width is set to 860px to set an absolute upper limit on the video's size, the error, warn, and info classes are used to style the corresponding console output types. #video { border: 1px solid #999; width: 98%; max-width: 860px; } .error { color: red; } .warn { color: orange; } .info { color: darkgreen; } result the final product looks like this. if your browser supports screen capture api, clicking "start capture" will present the user agent's interface for selecting a screen, window, or tab to share.
Visual Viewport API - Web APIs
iewport'); // since the bar is position: fixed we need to offset it by the // visual viewport's offset from the layout viewport origin. ...
... // since the bar is position: fixed we need to offset it by the // visual viewport's offset from the layout viewport origin. ...
...e // visual viewport's offset from the layout viewport origin. var viewport = event.target; var offsetleft = viewport.offsetleft; var offsettop = viewport.height - layoutviewport.getboundingclientrect().height + viewport.offsettop; // you could also do this by setting style.left and style.top if you // use width: 100% instead. ...
Keyboard-navigable JavaScript widgets - Accessibility
trol keyboard access <ul id="mb1" tabindex="0"> <li id="mb1_menu1" tabindex="-1"> font <ul id="fontmenu" title="font" tabindex="-1"> <li id="sans-serif" tabindex="-1">sans-serif</li> <li id="serif" tabindex="-1">serif</li> <li id="monospace" tabindex="-1">monospace</li> <li id="fantasy" tabindex="-1">fantasy</li> </ul> </li> <li id="mb1_menu2" tabindex="-1"> style <ul id="stylemenu" title="style" tabindex="-1"> <li id="italic" tabindex="-1">italics</li> <li id="bold" tabindex="-1">bold</li> <li id="underline" tabindex="-1">underlined</li> </ul> </li> <li id="mb1_menu3" tabindex="-1"> justification <ul id="justificationmenu" title="justication" tabindex="-1"> <li id="left" tabindex="-1">left</li> <li id="center"...
...to track a "virtual" focus. (for more information about aria, see this overview of accessible web applications and widgets.) the aria-activedescendant property identifies the id of the descendent element that currently has the virtual focus. the event handler on the container must respond to key and mouse events by updating the value of aria-activedescendant and ensuring that the current item is styled appropriately (for example, with a border or background color). see the source code of this aria radiogroup example for a direct illustration of how this works. general guidelines use onkeydown to trap key events, not onkeypress ie will not fire keypress events for non-alphanumeric keys. use onkeydown instead. ensure that keyboard and mouse produce the same experience to ensure that the use...
...ick="dosomething()", you should bind dosomething() to the key down event as well: onkeydown="return event.keycode != 13 || dosomething();". always draw the focus for tabindex="-1" items and elements that receive focus programatically ie will not automatically draw the focus outline for items that programatically receive focus. choose between changing the background color via something like this.style.backgroundcolor = "gray"; or add a dotted border via this.style.border = "1px dotted invert". in the dotted border case you will need to make sure those elements have an invisible 1px border to start with, so that the element doesn't grow when the border style is applied (borders take up space, and ie doesn't implement css outlines). prevent used key events from performing browser functions if ...
Event reference
mozilla specific a touch point is moved along the touch surface (use touchmove instead). moztouchup mozilla specific a touch point is removed from the touch surface (use touchend instead). overflow uievent mozilla specific an element has been overflowed by its content or has been rendered for the first time in this state (only works for elements styled with overflow != visible). smartcard-insert mozilla specific a smartcard has been inserted. smartcard-remove mozilla specific a smartcard has been removed. stkcommand firefox os specific the stk proactive command is issued from icc. stksessionend firefox os specific the stk session is terminated by icc. touchent...
...pecific the stk proactive command is issued from icc. stksessionend firefox os specific the stk session is terminated by icc. touchenter touchevent touch events removed touchleave touchevent touch events removed underflow uievent mozilla specific an element is no longer overflowed by its content (only works for elements styled with overflow != visible). uploadprogress progressevent mozilla specific upload is in progress (see progress). ussdreceived firefox os specific a new ussd message is received mscontentzoom microsoft specific msmanipulationstatechanged microsoft specific mspointerhover microsoft specific ...
... tabhide addons specific a tab has been hidden. tabpinned addons specific a tab has been pinned. tabunpinned addons specific a tab has been unpinned. developer tool-specific events event name event type specification fired when... cssruleviewrefreshed devtools specific the "rules" view of the style inspector has been updated. cssruleviewchanged devtools specific the "rules" view of the style inspector has been changed. cssruleviewcsslinkclicked devtools specific a link to a css file has been clicked in the "rules" view of the style inspector. ...
Getting Started - Developer guides
let's send some data to the server and receive a response. our javascript will request a dynamic page this time, test.php, which will take the data we send and return a "computed" string - "hello, [user data]!" - which we'll alert(). ...
..., and the last timestamp, onto the page. this is repeated every 5 seconds, using a setinterval() call. the idea would be that a server-side script of some kind would continually update the text file with new timestamps, and our xhr code would be used to report the latest timestamp on the client-side. ...
... timestamp, onto the page. this is repeated every 5 seconds, using a setinterval() call. the idea would be that a server-side script of some kind would continually update the text file with new timestamps, and our xhr code would be used to report the latest timestamp on the client-side. ...
Cross-browser audio basics - Developer guides
"my-audio"> <source src="https://udn.realityripple.com/samples/6c/d385042de2.mp3" type="audio/mpeg"> <source src="https://udn.realityripple.com/samples/28/191a7bd2a5.ogg" type="audio/ogg"> <!-- place fallback here as <audio> supporting browsers will ignore it --> <a href="audiofile.mp3">audiofile.mp3</a> </audio> <div id="controls"> <span id="loading">loading</span> <button id="play" style="display:none">play</button> <button id="pause" style="display:none" >pause</button> </div> <div id="progress"> <div id="bar"></div> </div> styled like so: #controls { width: 80px; float: left; } #progress { margin-left: 80px; border: 1px solid black; } #bar { height: 20px; background-color: green; width: 0; } now let's wire this thing up with javascript: window.onl...
...olor: green; width: 0; } now let's wire this thing up with javascript: window.onload = function(){ var myaudio = document.getelementbyid('my-audio'); var play = document.getelementbyid('play'); var pause = document.getelementbyid('pause'); var loading = document.getelementbyid('loading'); var bar = document.getelementbyid('bar'); function displaycontrols() { loading.style.display = "none"; play.style.display = "block"; } // check that the media is ready before displaying the controls if (myaudio.paused) { displaycontrols(); } else { // not ready yet - wait for canplay event myaudio.addeventlistener('canplay', function() { displaycontrols(); }); } play.addeventlistener('click', function() { myaudio.pl...
...; play.style.display = "block"; } // check that the media is ready before displaying the controls if (myaudio.paused) { displaycontrols(); } else { // not ready yet - wait for canplay event myaudio.addeventlistener('canplay', function() { displaycontrols(); }); } play.addeventlistener('click', function() { myaudio.play(); play.style.display = "none"; pause.style.display = "block"; }); pause.addeventlistener('click', function() { myaudio.pause(); pause.style.display = "none"; play.style.display = "block"; }); // display progress myaudio.addeventlistener('timeupdate', function() { //sets the percentage bar.style.width = parseint(((myaudio.currenttime / myaudio.duration) * 1...
Media buffering, seeking, and time ranges - Developer guides
io id="my-audio" controls> <source src="music.mp3" type="audio/mpeg"> </audio> </p> <p> <canvas id="my-canvas" width="300" height="20"> </canvas> </p> and a little bit of javascript: window.onload = function(){ var myaudio = document.getelementbyid('my-audio'); var mycanvas = document.getelementbyid('my-canvas'); var context = mycanvas.getcontext('2d'); context.fillstyle = 'lightgray'; context.fillrect(0, 0, mycanvas.width, mycanvas.height); context.fillstyle = 'red'; context.strokestyle = 'white'; var inc = mycanvas.width / myaudio.duration; // display timeranges myaudio.addeventlistener('seeked', function() { for (i = 0; i < myaudio.buffered.length; i++) { var startx = myaudio.buffered.start(i) * inc; var endx =...
...ally downloaded — this what the browser's native players seem to display. so let's build this. ...
...ad = function(){ var myaudio = document.getelementbyid('my-audio'); myaudio.addeventlistener('progress', function() { var duration = myaudio.duration; if (duration > 0) { for (var i = 0; i < myaudio.buffered.length; i++) { if (myaudio.buffered.start(myaudio.buffered.length - 1 - i) < myaudio.currenttime) { document.getelementbyid("buffered-amount").style.width = (myaudio.buffered.end(myaudio.buffered.length - 1 - i) / duration) * 100 + "%"; break; } } } }); myaudio.addeventlistener('timeupdate', function() { var duration = myaudio.duration; if (duration > 0) { document.getelementbyid('progress-amount').style.width = ((myaudio.currenttime / duration)*100) + "%"; } }); } the progres...
Index - Developer guides
Web › Guide › Index
in firefox and opera, this is changing fast. you can find compatibility information in the guide to media types and formats on the web. 7 adding captions and subtitles to html5 video html5, media, webvtt, captions, subtitles, track in other articles we looked at how to build a cross browser video player using the htmlmediaelement and window.fullscreen apis, and also at how to style the player. this article will take the same player and show how to add captions and subtitles to it, using the webvtt format and the <track> element. 8 creating a cross-browser video player apps, html5, video, full screen this article describes a simple html5 video player that uses the media and fullscreen apis and works across most major desktop and mobile browsers. as well ...
...ement. 8 creating a cross-browser video player apps, html5, video, full screen this article describes a simple html5 video player that uses the media and fullscreen apis and works across most major desktop and mobile browsers. as well as working fullscreen, the player features custom controls rather than just using the browser defaults. the player controls themselves won't be styled beyond the basics required to get them working; full styling of the player will be taken care of in a future article. 9 cross-browser audio basics apps, audio, guide, html5, media, events this article provides: a basic guide to creating a cross-browser html5 audio player with all the associated attributes, properties, and events explained a guide to custom controls crea...
... you do that? this article explains how, looking at two of the most common formats: mpeg-dash and hls (http live streaming.) 13 video player styling basics apps, guide, media, styling, video in the previous cross browser video player article we described how to build a cross-browser html5 video player using the media and fullscreen apis. this follow-up article looks at how to style this custom player, including making it responsive. 14 web audio playbackrate explained apps, audio, media, video, playbackrate the playbackrate property of the <audio> and <video> elements allows us to change the speed, or rate, at which a piece of web audio or video is playing 15 writing web audio api code that works in every browser api you probably ha...
Printing - Developer guides
there may be times in which your web site or application would like to improve the user's experience when printing content. there are a number of possible scenarios: you wish to adjust layout to take advantage of the size and shape of the paper. you wish to use different styles to enhance the appearance of your content on paper. you wish to use higher resolution images for a better result. ...
...ion images for a better result. you want to adjust the user experience of printing, such as presenting a specially-formatted version of your content before printing begins. there may be other cases in which you want to manage the printing process, but these are some of the most common scenarios. this article provides tips and techniques for helping your web content print better. using a print style sheet add the following to your <head> tag. <link href="/path/to/print.css" media="print" rel="stylesheet" /> using media queries to improve layout detecting print requests some browsers (including firefox 6 and later and internet explorer) send beforeprint and afterprint events to let content determine when printing may have occurred. you can use this to adjust the user interface presented...
...ild(this.__container__); } function setprint () { this.contentwindow.__container__ = this; this.contentwindow.onbeforeunload = closeprint; this.contentwindow.onafterprint = closeprint; this.contentwindow.focus(); // required for ie this.contentwindow.print(); } function printpage (surl) { var ohiddframe = document.createelement("iframe"); ohiddframe.onload = setprint; ohiddframe.style.position = "fixed"; ohiddframe.style.right = "0"; ohiddframe.style.bottom = "0"; ohiddframe.style.width = "0"; ohiddframe.style.height = "0"; ohiddframe.style.border = "0"; ohiddframe.src = surl; document.body.appendchild(ohiddframe); } </script> </head> <body> <p><span onclick="printpage('externalpage.html');" style="cursor:pointer;text-decoration:underline;color:#0000ff;">print...
<button>: The Button element - HTML: Hypertext Markup Language
Web › HTML › Element › button
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ted with the button’s name when it’s submitted with the form data. this value is passed to the server in params when the form is submitted. notes a submit button with the attribute formaction set, but without an associated form does nothing. you have to set a form owner, either by wrapping it in a <form> or set the attribute form to the id of the form. <button> elements are much easier to style than <input> elements. you can add inner html content (think <i>, <br>, or even <img>), and use ::after and ::before pseudo-elements for complex rendering. if your buttons are not for submitting form data to a server, be sure to set their type attribute to button. otherwise they will try to submit form data and to load the (nonexistent) response, possibly destroying the current state of the docu...
... separating them. this spacing is beneficial for people who are experiencing motor control issues, who may accidentally activate the wrong interactive content. spacing may be created using css properties such as margin. hand tremors and the giant-button-problem - axess lab firefox firefox will add a small dotted border on a focused button. this border is declared through css in the browser stylesheet, but you can override it to add your own focused style using button::-moz-focus-inner { }. if overridden, it is important to ensure that the state change when focus is moved to the button is high enough that people experiencing low vision conditions will be able to perceive it. color contrast ratio is determined by comparing the luminosity of the button text and background color values com...
<details>: The Details disclosure element - HTML: Hypertext Markup Language
Web › HTML › Element › details
e triangle and the label inside <summary> (or a user agent-defined default string if no <summary>). this might look like the following: here we see a standard disclosure widget with the label "system requirements", in its default closed state. when the user clicks on the widget or focuses it then presses the space bar, it "twists" open, revealing its contents: from there, you can use css to style the disclosure widget, and you can programmatically open and close the widget by setting/removing its open attribute. by default when closed, the widget is only tall enough to display the disclosure triangle and summary. when open, it expands to display the details contained within. note: unfortunately, at this time there's no built-in way to animate the transition between open and closed. f...
...is recommended.</p> </details> result customizing the disclosure widget the disclosure triangle itself can be customized, although this is not as broadly supported. there are variations in how browsers support this customization due to experimental implementations as the element was standardized, so we'll have to use multiple approaches for a while. the <summary> element supports the list-style shorthand property and its longhand properties, such as list-style-type, to change the disclosure triangle to whatever you choose (usually with list-style-image). for example, we can remove the disclosure widget icon by setting list-style: none. chrome doesn't support this yet, however, so we also need to use its non-standard ::-webkit-details-marker pseudo-element to customize the appearance in...
...e doesn't support this yet, however, so we also need to use its non-standard ::-webkit-details-marker pseudo-element to customize the appearance in that browser. css details { font: 16px "open sans", calibri, sans-serif; width: 620px; } details > summary { padding: 2px 6px; width: 15em; background-color: #ddd; border: none; box-shadow: 3px 3px 4px black; cursor: pointer; list-style: none; } details > summary::-webkit-details-marker { display: none; } details > p { border-radius: 0 0 10px 10px; background-color: #ddd; padding: 2px 6px; margin: 0; box-shadow: 3px 3px 4px black; } this css creates a look similar to a tabbed interface, where activating the tab expands and opens it to reveal its contents. html <details> <summary>system requirements</summary> ...
<input type="button"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › button
5px; padding: 5px; } input[type="color"], input[type="button"] { width: 90%; margin: 0 auto; display: block; } input[type="range"] { width: 70%; } span { position: relative; bottom: 5px; } var canvas = document.queryselector('.mycanvas'); var width = canvas.width = window.innerwidth; var height = canvas.height = window.innerheight-85; var ctx = canvas.getcontext('2d'); ctx.fillstyle = 'rgb(0,0,0)'; ctx.fillrect(0,0,width,height); var colorpicker = document.queryselector('input[type="color"]'); var sizepicker = document.queryselector('input[type="range"]'); var output = document.queryselector('.output'); var clearbtn = document.queryselector('input[type="button"]'); // covert degrees to radians function degtorad(degrees) { return degrees * math.pi / 180; }; // update siz...
...t.documentelement.scrollleft ? document.documentelement.scrollleft : document.body.scrollleft); cury = (window.event) ? e.pagey : e.clienty + (document.documentelement.scrolltop ? ...
... living standard html5the definition...
<input type="checkbox"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › checkbox
...
... living standard html5the definition of '<input type="checkbox">' in that specification. recommendation ...
... living standard html5the definition of '<input type="checkbox">' in that specification. recommendation ...
<input type="color"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › color
es the color picker. in both cases, you can determine the new value of the element by looking at its value. here's an example that watches changes over time to the color value: colorpicker.addeventlistener("input", updatefirst, false); colorpicker.addeventlistener("change", watchcolorpicker, false); function watchcolorpicker(event) { document.queryselectorall("p").foreach(function(p) { p.style.color = event.target.value; }); } selecting the value if the <input> element's implementation of the color type on the user's browser doesn't support a color well, but is instead a text field for entering the color string directly, you can use the select() method to select the text currently in the edit field. if the browser instead uses a color well, select() does nothing. you should be awa...
... event. it changes the color of the first paragraph element in the document to match the new value of the color input. since input events are fired every time an adjustment is made to the value (for example, if the brightness of the color is increased), these will happen repeatedly as the color picker is used. function updatefirst(event) { var p = document.queryselector("p"); if (p) { p.style.color = event.target.value; } } when the color picker is dismissed, indicating that the value will not be changing again (unless the user re-opens the color picker), a change event is sent to the element. we handle that event using the updateall() function, using event.target.value to obtain the final selected color: function updateall(event) { document.queryselectorall("p").foreach(functio...
...t.target.value; } } when the color picker is dismissed, indicating that the value will not be changing again (unless the user re-opens the color picker), a change event is sent to the element. we handle that event using the updateall() function, using event.target.value to obtain the final selected color: function updateall(event) { document.queryselectorall("p").foreach(function(p) { p.style.color = event.target.value; }); } this sets the color of every <p> block so that its color attribute matches the current value of the color input, which is referred to using event.target. result the final result looks like this: specifications specification status comment html living standard living standard initial definition html5 recommen...
<input type="date"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › date
t using a supporting browser: here's the css used in the above example. we make use of the :valid and :invalid pseudo-elements to add an icon next to the input, based on whether or not the current value is valid. we had to put the icon on a <span> next to the input, not on the input itself, because in chrome at least the input's generated content is placed inside the form control, and can't be styled or shown effectively. label { display: flex; align-items: center; } span::after { padding-left: 5px; } input:invalid + span::after { content: '✖'; } input:valid+span::after { content: '✓'; } important: client-side form validation is no substitute for validating on the server. it's easy for someone to modify the html, or bypass your html entirely and submit the data directly t...
...e variables var nativepicker = document.queryselector('.nativedatepicker'); var fallbackpicker = document.queryselector('.fallbackdatepicker'); var fallbacklabel = document.queryselector('.fallbacklabel'); var yearselect = document.queryselector('#year'); var monthselect = document.queryselector('#month'); var dayselect = document.queryselector('#day'); // hide fallback initially fallbackpicker.style.display = 'none'; fallbacklabel.style.display = 'none'; // test whether a new date input falls back to a text input or not var test = document.createelement('input'); try { test.type = 'date'; } catch (e) { console.log(e.description); } // if it does, run the code inside the if() {} block if(test.type === 'text') { // hide the native picker and show the fallback nativepicker.style.disp...
...l.style.display = 'none'; // test whether a new date input falls back to a text input or not var test = document.createelement('input'); try { test.type = 'date'; } catch (e) { console.log(e.description); } // if it does, run the code inside the if() {} block if(test.type === 'text') { // hide the native picker and show the fallback nativepicker.style.display = 'none'; fallbackpicker.style.display = 'block'; fallbacklabel.style.display = 'block'; // populate the days and years dynamically // (the months are always the same, therefore hardcoded) populatedays(monthselect.value); populateyears(); } function populatedays(month) { // delete the current set of <option> elements out of the // day <select>, ready for the next set to be injected while(dayselect.firstchild)...
<input type="datetime-local"> - HTML: Hypertext Markup Language
ype="submit" value="book party!"> </div> </form> if you try to submit the form with an incomplete date (or with a date outside the set bounds), the browser displays an error. try playing with the example now: here's a screenshot for those of you who aren't using a supporting browser: here's the css used in the above example. here we make use of the :valid and :invalid css properties to style the input based on whether or not the current value is valid. we had to put the icons on a <span> next to the input, not on the input itself, because in chrome the generated content is placed inside the form control, and can't be styled or shown effectively. div { margin-bottom: 10px; display: flex; align-items: center; } label { display: inline-block; width: 300px; } input:inv...
...eryselector('.fallbackdatetimepicker'); var fallbacklabel = document.queryselector('.fallbacklabel'); var yearselect = document.queryselector('#year'); var monthselect = document.queryselector('#month'); var dayselect = document.queryselector('#day'); var hourselect = document.queryselector('#hour'); var minuteselect = document.queryselector('#minute'); // hide fallback initially fallbackpicker.style.display = 'none'; fallbacklabel.style.display = 'none'; // test whether a new datetime-local input falls back to a text input or not var test = document.createelement('input'); try { test.type = 'datetime-local'; } catch (e) { console.log(e.description); } // if it does, run the code inside the if() {} block if(test.type === 'text') { // hide the native picker and show the fallback nat...
... 'none'; fallbacklabel.style.display = 'none'; // test whether a new datetime-local input falls back to a text input or not var test = document.createelement('input'); try { test.type = 'datetime-local'; } catch (e) { console.log(e.description); } // if it does, run the code inside the if() {} block if(test.type === 'text') { // hide the native picker and show the fallback nativepicker.style.display = 'none'; fallbackpicker.style.display = 'block'; fallbacklabel.style.display = 'block'; // populate the days and years dynamically // (the months are always the same, therefore hardcoded) populatedays(monthselect.value); populateyears(); populatehours(); populateminutes(); } function populatedays(month) { // delete the current set of <option> elements out of the // ...
<input type="radio"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › radio
e; background-color: black; padding: 5px 10px; border-radius: 0; border: 0; font-size: 14px; } button:hover, button:focus { color: #999; } button:active { background-color: white; color: black; outline: 1px solid black; } most notable here is the use of the -moz-appearance property (with prefixes needed to support some browsers). ...
...px 10px; border-radius: 0; border: 0; font-size: 14px; } button:hover, button:focus { color: #999; } button:active { background-color: white; color: black; outline: 1px solid black; } most notable here is the use of the -moz-appearance property (with prefixes needed to support some browsers). by default, radio buttons (and checkboxes) are styled with the operating system's native styles for those controls. by specifying appearance: none, you can remove the native styling altogether, and create your own styles for them. here we've used a border along with border-radius and a transition to create a nice animating radio selection. notice also how the :checked pseudo-class is used to specify the styles for the radio button's appearance when selected. compatibility note: if you wi...
...t is supported in most modern browsers, its implementation varies widely. in older browsers, even the keyword none does not have the same effect across different browsers, and some do not support it at all. the differences are smaller in the newest browsers. notice that when clicking on a radio button, there's a nice, smooth fade out/in effect as the two buttons change state. in addition, the style and coloring of the legend and submit button are customized to have strong contrast. this might not be a look you'd want in a real web application, but it definitely shows off the possibilities. specifications specification status html living standardthe definition of '<input type="radio">' in that specification. living standard html5the definition o...
<tbody>: The Table Body element - HTML: Hypertext Markup Language
Web › HTML › Element › tbody
> <th>major</th> </tr> </thead> <tbody> <tr> <td>3741255</td> <td>jones, martha</td> <td>computer science</td> </tr> <tr> <td>3971244</td> <td>nim, victor</td> <td>russian literature</td> </tr> <tr> <td>4100332</td> <td>petrov, alexandra</td> <td>astrophysics</td> </tr> </tbody> </table> css the css to style our table is shown next. table { border: 2px solid #555; border-collapse: collapse; font: 16px "lucida grande", "helvetica", "arial", sans-serif; } first, the table's overall style attributes are set, configuring the thickness, style, and color of the table's exterior borders and using border-collapse to ensure that the border lines are shared among adjacent cells rather than each having ...
...yle attributes are set, configuring the thickness, style, and color of the table's exterior borders and using border-collapse to ensure that the border lines are shared among adjacent cells rather than each having its own borders with space in between. font is used to establish an initial font for the table. th, td { border: 1px solid #bbb; padding: 2px 8px 0; text-align: left; } then the style is set for the majority of the cells in the table, including all data cells but also those styles shared between our <td> and <th> cells. the cells are given a light gray outline which is a single pixel thick, padding is adjusted, and all cells are left-aligned using text-align thead > tr > th { background-color: #cce; font-size: 18px; border-bottom: 2px solid #999; } finally, header cell...
...eir name. css table { border: 2px solid #555; border-collapse: collapse; font: 16px "lucida grande", "helvetica", "arial", sans-serif; } th, td { border: 1px solid #bbb; padding: 2px 8px 0; text-align: left; } thead > tr > th { background-color: #cce; font-size: 18px; border-bottom: 2px solid #999; } most of the css is unchanged. we do, however, add a slightly more subtle style for header cells contained directly within a <tbody> (as opposed to those which reside in a <thead>). this is used for the headers indicating each table section's corresponding major. tbody > tr > th { background-color: #dde; border-bottom: 1.5px solid #bbb; font-weight: normal; } specifications specification status comment html living standardthe definition of 't...
<var>: The Variable element - HTML: Hypertext Markup Language
Web › HTML › Element › var
any dom interface htmlelement attributes this element only includes the global attributes. usage notes related elements other elements that are used in contexts in which <var> is commonly used include: <code>: the html code element <kbd>: the html keyboard input element <samp>: the html sample output element if you encounter code that is mistakenly using <var> for style purposes rather than semantic purposes, you should either use a <span> with appropriate css or, an appropriate semantic element among the following: <em> <i> <q> default style most browsers apply font-style to "italic" when rendering <var>. this can be overridden in css, like this: var { font: bold 15px "courier", "courier new", monospace; } examples basic example here's a simple ex...
...in this example, variable names are rendered using bold courier if it's available, otherwise it falls back to the default monospace font. ...
...talic" when rendering <var>. this can be overridden in css, like this: var { font: bold 15px "courier", "courier new", monospace; } examples basic example here's a simple example, using <var> to denote variable names in a mathematical equation. <p>a simple equation: <var>x</var> = <var>y</var> + 2 </p> the output: overriding the default style using css, you can override the default style for the <var> element. in this example, variable names are rendered using bold courier if it's available, otherwise it falls back to the default monospace font. css var { font: bold 15px "courier", "courier new", monospace; } html <p>the variables <var>minspeed</var> and <var>maxspeed</var> control the minimum and maximum speed of the apparatus in revolutions per minute (rpm).</p> th...
Link types - HTML: Hypertext Markup Language
k types indicate the relationship between two documents, in which one links to the other using an <a>, <area>, <form>, or <link> element. list of the defined link types and their significance in html link type description allowed in these elements not allowed in these elements alternate if the element is <link> and the rel attribute also contains the stylesheet type, the link defines an alternative style sheet; in that case the title attribute must be present and not be the empty string. if the type is set to application/rss+xml or application/atom+xml, the link defines a syndication feed. the first one defined on the page is the default. otherwise, the link defines an alternative page, of one of these types: for another med...
...o 63 indicates that the hyperlink leads to a resource that would be better suited for a secondary browsing context, like a sidebar. browsers, that don't have such a context will ignore this keyword. while once part of the html specification, this has been removed from the spec and is only implemented by versions of firefox prior to firefox 63. <a>, <area>, <link> <form> stylesheet defines an external resource to be used as a stylesheet. if the type is not set, the browser should assume it is a text/css stylesheet until further inspection. if used in combination with the alternate keyword, it defines an alternative style sheet; in that case the title attribute must be present and not be the empty string. <link> <a>, <area>, <form> tag indi...
...arget="_blank" links. html5the definition of 'link types' in that specification. recommendation added tag, search, prefetch, noreferrer, nofollow, icon, and author. renamed copyright to license. removed start, chapter, section, subsection, and appendix html 4.01 specificationthe definition of 'link types' in that specification. recommendation added alternate, stylesheet, start, chapter, section, subsection, appendix, and bookmark. renamed previous to prev. removed top, and search. unknownthe definition of '<link>' in that specification. obsolete added top, contents, index, glossary, copyright, next, previous, help, and search. rfc 1866: html 2.0 obsolete initial definition. ...
CSP: font-src - HTTP
the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. if you only need to allow inline event handlers and not inline <script> elements or javascript: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resourc...
...ce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. see unsafe inline script for an example. in csp 2.0 this applied...
...ation and whitespace matter, including leading or trailing whitespace. see unsafe inline script for an example. in csp 2.0 this applied only to inline scripts. csp 3.0 allows it in the case of script-src for external scripts. examples violation cases given this csp header: content-security-policy: font-src https://example.com/ the following font resource loading is blocked and won't load: <style> @font-face { font-family: "myfont"; src: url("https://not-example.com/font"); } body { font-family: "myfont"; } </style> specifications specification status comment content security policy level 3the definition of 'font-src' in that specification. working draft no changes. content security policy level 2the definition of 'font-src' in ...
Content-Security-Policy - HTTP
refore it is recommended to restrict this fetch-directive (e.g., explicitly set object-src 'none' if possible). prefetch-src specifies valid sources to be prefetched or prerendered. script-src specifies valid sources for javascript. script-src-elem specifies valid sources for javascript <script> elements. script-src-attr specifies valid sources for javascript inline event handlers. style-src specifies valid sources for stylesheets. style-src-elem specifies valid sources for stylesheets <style> elements and <link> elements with rel="stylesheet". style-src-attr specifies valid sources for inline styles applied to individual dom elements. worker-src specifies valid sources for worker, sharedworker, or serviceworker scripts. document directives document directives govern...
...directive will be ignored. report-to fires a securitypolicyviolationevent. other directives block-all-mixed-content prevents loading any assets using http when the page is loaded using https. referrer used to specify information in the referer (sic) header for links away from a page. use the referrer-policy header instead. require-sri-for requires the use of sri for scripts or styles on the page. require-trusted-types-for enforces trusted types at the dom xss injection sinks. trusted-types used to specify an allow-list of trusted types policies. trusted types allows applications to lock down dom xss injection sinks to only accept non-spoofable, typed values in place of strings. upgrade-insecure-requests instructs user agents to treat all of a site's insecure ur...
... ...
JavaScript modules - JavaScript
n a module is being pointed to, as you'll see below. exporting module features the first thing you do to get access to module features is export them. this is done using the export statement. the easiest way to use it is to place it in front of any items you want exported out of the module, for example: export const name = 'square'; export function draw(ctx, length, x, y, color) { ctx.fillstyle = color; ctx.fillrect(x, y, length, length); return { length: length, x: x, y: y, color: color }; } you can export functions, var, let, const, and — as we'll see later — classes. they need to be top-level items; you can't use export inside a function, for example. a more convenient way of exporting all the items you want to export is to use a single export statement a...
... note that you could solve the problem in the module files instead, e.g. // in square.js export { name as squarename, draw as drawsquare, reportarea as reportsquarearea, reportperimeter as reportsquareperimeter }; // in main.js import { squarename, drawsquare, reportsquarearea, reportsquareperimeter } from './modules/square.js'; and it would work just the same. what style you use is up to you, however it arguably makes more sense to leave your module code alone, and make the changes in the imports. this especially makes sense when you are importing from third party modules that you don't have any control over. creating a module object the above method works ok, but it's a little messy and longwinded. an even better solution is to import each module's features in...
..., reportlist); so you can now write the code just the same as before (as long as you include the object names where needed), and the imports are much neater. modules and classes as we hinted at earlier, you can also export and import classes; this is another option for avoiding conflicts in your code, and is especially useful if you've already got your module code written in an object-oriented style. you can see an example of our shape drawing module rewritten with es classes in our classes directory. as an example, the square.js file now contains all its functionality in a single class: class square { constructor(ctx, listid, length, x, y, color) { ... } draw() { ... } ... } which we then export: export { square }; over in main.js, we import it like this: import { ...
Text formatting - JavaScript
al(firststring); // returns the number 4 eval(secondstring); // returns the string "2 + 2" a string object has one property, length, that indicates the number of utf-16 code units in the string. for example, the following code assigns hellolength the value 13, because "hello, world!" has 13 characters, each represented by one utf-16 code unit. you can access each code unit using an array bracket style. you can't change individual characters because strings are immutable array-like objects: const hello = 'hello, world!'; const hellolength = hello.length; hello[0] = 'l'; // this has no effect, because strings are immutable hello[0]; // this returns "h" characters whose unicode scalar values are greater than u+ffff (such as some rare chinese/japanese/korean/vietnamese characters and some emoji...
... hour: '2-digit', minute: '2-digit', timezonename: 'short' }; const americandatetime = new intl.datetimeformat('en-us', options).format; console.log(americandatetime(july172014)); // 07/16/14, 5:00 pm pdt number formatting the numberformat object is useful for formatting numbers, for example currencies. ...
...ng the numberformat object is useful for formatting numbers, for example currencies. const gasprice = new intl.numberformat('en-us', { style: 'currency', currency: 'usd', minimumfractiondigits: 3 }); console.log(gasprice.format(5.259)); // $5.259 const handecimalrmbinchina = new intl.numberformat('zh-cn-u-nu-hanidec', { style: 'currency', currency: 'cny' }); console.log(handecimalrmbinchina.format(1314.25)); // ¥ 一,三一四.二五 collation the collator object is useful for comparing and sorting strings. for example, there are actually two different sort orders in german, phonebook and dictionary. phonebook sort emphasizes sound, and it’s as if “ä”, “ö”, and so on were expanded to “ae”, “oe...
Intl.DisplayNames.prototype.resolvedOptions() - JavaScript
the intl.displaynames.prototype.resolvedoptions() method returns a new object with properties reflecting the locale and style formatting options computed during the construction of the current displaynames object. syntax displaynames.resolvedoptions() return value an object with properties reflecting the locale and formatting options computed during the construction of the given displaynames object. description the object returned by resolvedoptions() has the following properties: locale the bcp 47 language tag for the locale actually used. ...
...onstruction of the given displaynames object. description the object returned by resolvedoptions() has the following properties: locale the bcp 47 language tag for the locale actually used. if any unicode extension values were requested in the input bcp 47 language tag that led to this locale, the key-value pairs that were requested and are supported for this locale are included in locale. style the value provided for this property in the options argument of the constructor or the default value ("long"). its value is either "long", "short", or "narrow". type the value provided for this property in the options argument of the constructor or the default value ("language"). its value is either "language", "region", "script", or "currency". fallback the value provided for this property ...
...rrency". fallback the value provided for this property in the options argument of the constructor or the default value ("code"). its value is either "code" or "none". examples using resolvedoptions const displaynames = new intl.displaynames(['de-de'], {type: 'region'}); const usedoptions = displaynames.resolvedoptions(); console.log(usedoptions.locale); // "de-de" console.log(usedoptions.style); // "long" console.log(usedoptions.type); // "region" console.log(usedoptions.fallback); // "code" specifications specification intl.displaynamesthe definition of 'resolvedoptions()' in that specification. ...
Intl.ListFormat() constructor - JavaScript
alues are "lookup" and "best fit"; the default is "best fit". for information about this option, see the intl page. type the format of output message. possible values are "conjunction" that stands for "and"-based lists (default, e.g., a, b, and c), or "disjunction" that stands for "or"-based lists (e.g., a, b, or c). "unit" stands for lists of values with units (e.g., 5 pounds, 12 ounces). style the length of the formated message. possible values are: "long" (default, e.g., a, b, and c); "short" (e.g., a, b, c), or "narrow" (e.g., a b c). when style is short or narrow, unit is the only allowed value for the type option. examples using format the following example shows how to create a list formatter using the english language. const list = ['motorcycle', 'bus', 'car']; cons...
... possible values are: "long" (default, e.g., a, b, and c); "short" (e.g., a, b, c), or "narrow" (e.g., a b c). when style is short or narrow, unit is the only allowed value for the type option. examples using format the following example shows how to create a list formatter using the english language. ...
...ort or narrow, unit is the only allowed value for the type option. examples using format the following example shows how to create a list formatter using the english language. const list = ['motorcycle', 'bus', 'car']; console.log(new intl.listformat('en-gb', { style: 'long', type: 'conjunction' }).format(list)); // > motorcycle, bus and car console.log(new intl.listformat('en-gb', { style: 'short', type: 'disjunction' }).format(list)); // > motorcycle, bus or car console.log(new intl.listformat('en-gb', { style: 'narrow', type: 'unit' }).format(list)); // > motorcycle bus car specifications specification intl.listformatthe definition of 'listformat()' in that specification. ...
Intl​.List​Format​.prototype​.formatToParts() - JavaScript
in a locale-aware fashion. syntax intl.listformat.prototype.formattoparts(list) parameters list an array of values to be formatted according to a locale. return value an array of components which contains the formatted parts from the list. ...
...ocale and style options), formattoparts() returns an array of the different components of the formated string. each element of the resulting array has two properties: type and value. the type property may be either "element", which refers to a value from the list, or "literal" which refers to a linguistic construct. the value property gives the content, as a string, of the token. the locale and style options used for formatting are given when constructing the intl.listformat instance. ...
..., which refers to a value from the list, or "literal" which refers to a linguistic construct. the value property gives the content, as a string, of the token. the locale and style options used for formatting are given when constructing the intl.listformat instance. ...
Intl​.List​Format​.prototype​.resolvedOptions() - JavaScript
the intl.listformat.prototype.resolvedoptions() method returns a new object with properties reflecting the locale and style formatting options computed during the construction of the current listformat object. syntax listformat.resolvedoptions() return value an object with properties reflecting the locale and formatting options computed during the construction of the given listformat object. description the object returned by resolvedoptions() has the following properties: locale the bcp 47 language tag for the locale actually used. ...
... construction of the given listformat object. description the object returned by resolvedoptions() has the following properties: locale the bcp 47 language tag for the locale actually used. if any unicode extension values were requested in the input bcp 47 language tag that led to this locale, the key-value pairs that were requested and are supported for this locale are included in locale. style the value provided for this property in the options argument of the constructor or the default value ("long"). its value is either "long", "short", or "narrow". type the value provided for this property in the options argument of the constructor or the default value ("conjunction"). its value is either "conjunction", "disjunction", or "unit". examples using resolvedoptions const delistform...
...in the options argument of the constructor or the default value ("long"). its value is either "long", "short", or "narrow". type the value provided for this property in the options argument of the constructor or the default value ("conjunction"). its value is either "conjunction", "disjunction", or "unit". examples using resolvedoptions const delistformatter = new intl.listformat("de-de", { style: "short" }); const usedoptions = de.resolvedoptions(); console.log(usedoptions.locale); // "de-de" console.log(usedoptions.style); // "short" console.log(usedoptions.type); // "conjunction" (the default value) specifications specification intl.listformatthe definition of 'resolvedoptions()' in that specification. ...
Intl.Locale.prototype.collation - JavaScript
by a particular locale. below is a table with the available collation types, taken from the unicode collation specification. valid collation types collation type description big5han pinyin ordering for latin, big5 charset ordering for cjk characters (used in chinese) compat a previous version of the ordering, for compatibility dict dictionary style ordering (such as in sinhala) the direct collation type has been deprected. do not use. direct binary code point order (used in hindi) ducet the default unicode collation element table order emoji recommended ordering for emoji characters eor european ordering rules gb2312 pinyin ordering for latin, gb2312han char...
...been deprected. do not use. ...
... (used in chinese) reformed reformed ordering (such as in swedish) search special collation type for string search searchjl special collation type for korean initial consonant search standard default ordering for each language stroke pinyin ordering for latin, stroke order for cjk characters (used in chinese) trad traditional style ordering (such as in spanish) unihan pinyin ordering for latin, unihan radical-stroke ordering for cjk characters (used in chinese) zhuyin pinyin ordering for latin, zhuyin order for bopomofo and cjk characters (used in chinese) examples like other locale subtags, the collation type can be added to the intl.locale object via the locale string, or a configu...
Intl.NumberFormat - JavaScript
八九 // when requesting a language that may not be supported, such as // balinese, include a fallback language, in this case indonesian console.log(new intl.numberformat(['ban', 'id']).format(number)); // → 123.456,789 using options the results can be customized using the options argument: var number = 123456.789; // request a currency format console.log(new intl.numberformat('de-de', { style: 'currency', currency: 'eur' }).format(number)); // → 123.456,79 € // the japanese yen doesn't use a minor unit console.log(new intl.numberformat('ja-jp', { style: 'currency', currency: 'jpy' }).format(number)); // → ¥123,457 // limit to three significant digits console.log(new intl.numberformat('en-in', { maximumsignificantdigits: 3 }).format(number)); // → 1,23,000 using style and...
... ...
... ...
<math> - MathML
Web › MathML › Element › math
dir overall directionality of formulas. ...
... dir overall directionality of formulas. ...
... dir overall directionality of formulas. ...
<mn> - MathML
Web › MathML › Element › mn
dir the text direction. possible values are either ltr (left to right) or rtl (right to left). href used to set a hyperlink to a specified uri. mathbackground the background color. ...
... dir the text direction. possible values are either ltr (left to right) or rtl (right to left). href used to set a hyperlink to a specified uri. mathbackground the background color. ...
...nd html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. mathsize the size of the content. see length for possible values. deprecated values are: small, normal and big. these will be removed in the future. mathvariant this attribute specifies the logical class of the number which varies in typography. that is, although the names suggest the typographic style for the class, semantically, items with the same class are treated "the same" within an expression, which might or might not involve displaying them with the named typography. the following values are allowed: normal (default value) ; example bold ; example italic ; example bold-italic ; example double-struck ; example bold-fraktur ; example script ; example bold-script ; e...
<msubsup> - MathML
href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. ...
... href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. ...
...he baseline of the expression, as a length value. this attribute is deprecated and will be removed in the future. superscriptshift the minimum space by which to shift the superscript above the baseline of the expression, as a length value. this attribute is deprecated and will be removed in the future. examples sample rendering: rendering in your browser: ∫ 0 1 <math displaystyle="true"> <msubsup> <mo> &#x222b;<!--integral --> </mo> <mn> 0 </mn> <mn> 1 </mn> </msubsup> </math> specifications specification status comment mathml 3.0the definition of 'msubsup' in that specification. recommendation current specification mathml 2.0the definition of 'msubsup' in that specification. recommendation initial spe...
<munderover> - MathML
ression. accentunder if true, the underscript is an accent, which is drawn closer to the base expression. if false (default value), the underscript is a limit under the base expression. align the alignment of both underscript and overscript. possible values are: left, center, and right. this attribute is deprecated and will be removed in the future. use css text-align instead. ...
...e, the underscript is an accent, which is drawn closer to the base expression. if false (default value), the underscript is a limit under the base expression. align the alignment of both underscript and overscript. possible values are: left, center, and right. this attribute is deprecated and will be removed in the future. use css text-align instead. class, id, style provided for use with stylesheets. ...
...he future. use css text-align instead. class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. examples sample rendering: rendering in your browser: ∫ 0 ∞ <math displaystyle="true"> <munderover > <mo> &#x222b; <!--integral--> </mo> <mn> 0 </mn> <mi> &#x221e; <!--infinity--> </mi> </munderover> </math> specifications specification status comment mathml 3.0the definition of 'munderover' in that specification. recommendation current specification mathml 2.0the definition of 'munderover' in that specificatio...
Add to Home screen - Progressive web apps (PWAs)
e; top: 1px; left: 1px; } javascript for handling the install at the bottom of our index.js file, we added some javascript to handle the installation. first of all, we declare a deferredprompt variable (which we'll explain later on), get a reference to our install button, and set it to display: none initially: let deferredprompt; const addbtn = document.queryselector('.add-button'); addbtn.style.display = 'none'; we hide the button initially because the pwa will not be available for install until it follows the a2hs criteria. when this happens, supporting browsers will fire a beforeinstallprompt event. we can then use a handler like the one below to handle the installation: window.addeventlistener('beforeinstallprompt', (e) => { // prevent chrome 67 and earlier from automatically sho...
...e a beforeinstallprompt event. we can then use a handler like the one below to handle the installation: window.addeventlistener('beforeinstallprompt', (e) => { // prevent chrome 67 and earlier from automatically showing the prompt e.preventdefault(); // stash the event so it can be triggered later. ...
...tallprompt', (e) => { // prevent chrome 67 and earlier from automatically showing the prompt e.preventdefault(); // stash the event so it can be triggered later. ...
Progressive web app structure - Progressive web apps (PWAs)
any of the major browsers. when it is available, it will be the fastest way of serving the content — the benefits are going to be huge in terms of performance. for working examples and more information, see the streams api documentation. structure of our example application the js13kpwa website structure is quite simple: it consists of a single html file (index.html) with basic css styling (style.css), and a few images, scripts, and fonts. the folder structure looks like this: the html from the html point of view, the app shell is everything outside the content section: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>js13kgames a-frame entries</title> <meta name="description" content="a list of a-frame entries submitted to the js13kgames 2017 competition, use...
...-frame entries submitted to the js13kgames 2017 competition, used as an example for the mdn articles about progressive web apps."> <meta name="author" content="end3r"> <meta name="theme-color" content="#b12a34"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta property="og:image" content="icons/icon-512.png"> <link rel="shortcut icon" href="favicon.ico"> <link rel="stylesheet" href="style.css"> <link rel="manifest" href="js13kpwa.webmanifest"> <script src="data/games.js" defer></script> <script src="app.js" defer></script> </head> <body> <header> <p><a class="logo" href="http://js13kgames.com"><img src="img/js13kgames.png" alt="js13kgames"></a></p> </header> <main> <h1>js13kgames a-frame entries</h1> <p class="description">list of games submitted to the <a ...
...at is the service worker: sw.js — it first imports data from the games.js file: self.importscripts('data/games.js'); next, it creates a list of all the files to be cached, both from the app shell and the content: var cachename = 'js13kpwa-v1'; var appshellfiles = [ '/pwa-examples/js13kpwa/', '/pwa-examples/js13kpwa/index.html', '/pwa-examples/js13kpwa/app.js', '/pwa-examples/js13kpwa/style.css', '/pwa-examples/js13kpwa/fonts/graduate.eot', '/pwa-examples/js13kpwa/fonts/graduate.ttf', '/pwa-examples/js13kpwa/fonts/graduate.woff', '/pwa-examples/js13kpwa/favicon.ico', '/pwa-examples/js13kpwa/img/js13kgames.png', '/pwa-examples/js13kpwa/img/bg.png', '/pwa-examples/js13kpwa/icons/icon-32.png', '/pwa-examples/js13kpwa/icons/icon-64.png', '/pwa-examples/js13kpwa/icons/i...
Structural overview of progressive web apps - Progressive web apps (PWAs)
or browsers. once it's available, however, it will be the fastest way to serve your app's content. the performance benefits will be truly spectacular. for working examples and more information, see the streams api documentation. structure of a sample application the js13kpwa web site's structure is quite simple. it consists of a single html file (index.html), with basic css styling provided in style.css. also included are a few images, scripts, and fonts. the file and folder hierarchy looks like this: app.js data/ games.js img/ favicon.ico fonts/ icons/ img/ bg.png js13kgames.png index.html js13kpwa.webmanifest style.css sw.js the html the html in the file index.html creates the structure of the app. the parts that are directly relevant to the app shell m...
...-frame entries submitted to the js13kgames 2017 competition, used as an example for the mdn articles about progressive web apps."> <meta name="author" content="end3r"> <meta name="theme-color" content="#b12a34"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta property="og:image" content="icons/icon-512.png"> <link rel="shortcut icon" href="favicon.ico"> <link rel="stylesheet" href="style.css"> <link rel="manifest" href="js13kpwa.webmanifest"> <script src="data/games.js" defer></script> <script src="app.js" defer></script> </head> <body> <header> <p><a class="logo" href="http://js13kgames.com"><img src="img/js13kgames.png" alt="js13kgames"></a></p> </header> <main> <h1>js13kgames a-frame entries</h1> <p class="description">list of games submitted to the <a ...
...rom the file games.js in the data directory: self.importscripts("data/games.js"); then it creates a list of all the files that the service worker needs to cache. ...
class - SVG: Scalable Vector Graphics
Web › SVG › Attribute › class
« svg attribute reference home assigns a class name or set of class names to an element. you may assign the same class name or names to any number of elements, however, multiple class names must be separated by whitespace characters. an element's class name serves two key roles: as a style sheet selector, for when an author assigns style information to a set of elements. for general use by the browser. you can use this class to style svg content using css. usage context categories none value <list-of-class-names> animatable yes normative document svg 1.1 (2nd edition): the class attribute list-of-ts <list-of-ts> (where t is some type.) a list consists of a separated sequence of values. unless explicitly described di...
...values of a <list-of-ts> type are represented by an interface specific for the particular type t. for example, a <list-of-lengths> is represented in the svg dom using an svglengthlist or svganimatedlengthlist object. ...
....org/2000/svg"> <style type="text/css" > <![cdata[ rect.rectclass { stroke: #000066; fill: #00cc00; } circle.circleclass { stroke: #006600; fill: #cc0000; } ]]> </style> <rect class="rectclass" x="10" y="10" width="100" height="100"/> <circle class="circleclass" cx="40" cy="50" r="26"/> </svg> </body> </html> elements the following elements can use the class attribute: <a> <altglyph> <circle> <clippath> <defs> <desc> <ellipse> <feblend> <fecolormatrix> <fecomponenttransfer> <fecomposite> <feconvolvematrix>...
in - SVG: Scalable Vector Graphics
Web › SVG › Attribute › in
in the same filter element. if no value is provided, the output will only be available for re-use as the implicit input into the next filter primitive if that filter primitive provides no value for its in attribute. workaround for backgroundimage instead of using in="backgroundimage", we need to import one of the images to blend inside the filter itself, using an <feimage> element. html <div style="width: 420px; height: 220px;"> <svg style="width:200px; height:200px; display: inline;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <filter id="backgroundmultiply"> <!-- this will not work. --> <feblend in="backgroundimage" in2="sourcegraphic" mode="multiply"/> </filter> </defs> <image xlink:href="https://developer.mozilla.org/f...
...mlns:xlink="http://www.w3.org/1999/xlink"> <defs> <filter id="backgroundmultiply"> <!-- this will not work. --> <feblend in="backgroundimage" in2="sourcegraphic" mode="multiply"/> </filter> </defs> <image xlink:href="https://developer.mozilla.org/files/6457/mdn_logo_only_color.png" x="10%" y="10%" width="80%" height="80%"/> <circle cx="50%" cy="40%" r="40%" fill="#c00" style="filter:url(#backgroundmultiply);" /> </svg> <svg style="width:200px; height:200px; display: inline;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <filter id="imagemultiply"> <!-- this is a workaround. --> <feimage xlink:href="https://developer.mozilla.org/files/6457/mdn_logo_only_color.png" x="10%" y="10%" width="80%" height="80%"/> ...
...w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <filter id="imagemultiply"> <!-- this is a workaround. --> <feimage xlink:href="https://developer.mozilla.org/files/6457/mdn_logo_only_color.png" x="10%" y="10%" width="80%" height="80%"/> <feblend in2="sourcegraphic" mode="multiply"/> </filter> </defs> <circle cx="50%" cy="40%" r="40%" fill="#c00" style="filter:url(#imagemultiply);"/> </svg> </div> result specifications specification status comment filter effects module level 1the definition of 'in' in that specification. working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'in' in that specification. recommendation initial definition ...
numOctaves - SVG: Scalable Vector Graphics
negative values are forbidden. example <svg width="200" height="200" viewbox="0 0 220 220" xmlns="...
...negative values are forbidden. example <svg width="200" height="200" viewbox="0 0 220 220" xmlns="http://www.w3.org/2000/svg"> <filter id="displacementfilter"> <feturbule...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'numoctaves' in that specification. recommendation initial definition ...
requiredFeatures - SVG: Scalable Vector Graphics
http://www.w3.org/tr/svg11/feature#svg-static the browser supports all the following features: http://www.w3.org/tr/svg11/feature#coreattribute http://www.w3.org/tr/svg11/feature#structure http://www.w3.org/tr/svg11/feature#containerattribute http://www.w3.org/tr/svg11/feature#conditionalprocessing http://www.w3.org/tr/svg11/feature#image http://www.w3.org/tr/svg11/feature#style http://www.w3.org/tr/svg11/feature#viewportattribute http://www.w3.org/tr/svg11/feature#shape http://www.w3.org/tr/svg11/feature#text http://www.w3.org/tr/svg11/feature#paintattribute http://www.w3.org/tr/svg11/feature#opacityattribute http://www.w3.org/tr/svg11/feature#graphicsattribute http://www.w3.org/tr/svg11/feature#marker http://www.w3.org/tr/svg11/feature#colorprofile ht...
...rg/tr/svg11/feature#containerattribute the browser supports the enable-background attribute http://www.w3.org/tr/svg11/feature#conditionalprocessing the browser supports the <switch> element, and the requiredfeatures, requiredextensions, systemlanguage attributes http://www.w3.org/tr/svg11/feature#image the browser supports the <image> element. http://www.w3.org/tr/svg11/feature#style the browser supports the <style> element. http://www.w3.org/tr/svg11/feature#viewportattribute the browser supports the clip and overflow attributes. http://www.w3.org/tr/svg11/feature#shape the browser supports the <rect>, <circle>, <line>, <polyline>, <polygon>, <ellipse> and <path> elements. http://www.w3.org/tr/svg11/feature#text the browser supports the <text>, <tspan>, ...
...nditionalprocessing</text> <!-- testing : http://www.w3.org/tr/svg11/feature#image --> <rect class="ko" x="10" y="335" height="25" width="430" /> <rect class="ok" x="10" y="335" height="25" width="430" requiredfeatures="http://www.w3.org/tr/svg11/feature#image" /> <text x="20" y="352">http://www.w3.org/tr/svg11/feature#image</text> <!-- testing : http://www.w3.org/tr/svg11/feature#style --> <rect class="ko" x="10" y="360" height="25" width="430" /> <rect class="ok" x="10" y="360" height="25" width="430" requiredfeatures="http://www.w3.org/tr/svg11/feature#style" /> <text x="20" y="377">http://www.w3.org/tr/svg11/feature#style</text> <!-- testing : http://www.w3.org/tr/svg11/feature#viewportattribute --> <rect class="ko" x="10" y="385" height="25" width="430" /> <r...
text-decoration - SVG: Scalable Vector Graphics
the fill and stroke of the text decoration are given by the fill and stroke of the text at the point where the text decoration is declared. the paint order of the text decoration, i.e. the fill and stroke, is determined by the value of the paint-order attribute at the point where the text decoration is declared. note: as a presentation attribute, text-decoration can be used as a css property. ...
... specifications specification status comment css text decoration module level 3the definition of 'text-decoration' in that specification. candidate recommendation d...
...erties animatable yes for a description of the values, please refer to the css text-decoration property. specifications specification status comment css text decoration module level 3the definition of 'text-decoration' in that specification. candidate recommendation defines the property as a shorthand for text-decoration-line, text-decoration-style, and text-decoration-color. scalable vector graphics (svg) 2the definition of 'text-decoration' in that specification. candidate recommendation mainly refers to the definition in css text decoration 3 turning the property into a shorthand for text-decoration-line and text-decoration-style. scalable vector graphics (svg) 1.1 (second edition)the definition of 'text-decoratio...
<a> - SVG: Scalable Vector Graphics
Web › SVG › Element › a
see warning below */ svg|a:link, svg|a:visited { cursor: pointer; } svg|a text, text svg|a { fill: blue; /* even for text, svg uses fill over color */ text-decoration: underline; } svg|a:hover, svg|a:active { ...
... type for the linked url. value type: <string> ; default value: none; animatable: yes xlink:href deprecated since svg 2 the url or url fragment that the hyperlink points to. may be required for backwards compatibility for older browsers. ...
... candidate recommendation replaced xlink:href attribute by href scalable vector graphics (svg) 1.1 (second edition)the definition of '<a>' in that specification. recommendation initial definition ...
<feComponentTransfer> - SVG: Scalable Vector Graphics
anging each channel (r, g, b, and a) to the result of what the children <fefuncr>, <fefuncb>, <fefuncg>, and <fefunca> return. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<fefunca>, <fefuncr>, <fefuncb>, <fefuncg> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in dom interface this element implements the svgfecomponenttransferelement interface. example svg <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 600 300"> <defs> <lineargradient id="rainbow" gradientunits="userspaceonuse" x1="0" y1="0" x2="100%" y2="0"> <stop offset="0" stop-color="#ff0000"></stop> <stop offset="0.2" stop-color="#ffff00"></st...
...type="gamma" amplitude="4" exponent="4" offset="0"></fefuncg> <fefuncb type="gamma" amplitude="4" exponent="1" offset="0"></fefuncb> </fecomponenttransfer> </filter> </defs> <g font-weight="bold"> <text x="0" y="20">default</text> <rect x="0" y="30" width="100%" height="20"></rect> <text x="0" y="70">identity</text> <rect x="0" y="80" width="100%" height="20" style="filter:url(#identity)"></rect> <text x="0" y="120">table lookup</text> <rect x="0" y="130" width="100%" height="20" style="filter:url(#table)"></rect> <text x="0" y="170">discrete table lookup</text> <rect x="0" y="180" width="100%" height="20" style="filter:url(#discrete)"></rect> <text x="0" y="220">linear function</text> <rect x="0" y="230" width="100%" height="20" sty...
...yle="filter:url(#table)"></rect> <text x="0" y="170">discrete table lookup</text> <rect x="0" y="180" width="100%" height="20" style="filter:url(#discrete)"></rect> <text x="0" y="220">linear function</text> <rect x="0" y="230" width="100%" height="20" style="filter:url(#linear)"></rect> <text x="0" y="270">gamma function</text> <rect x="0" y="280" width="100%" height="20" style="filter:url(#gamma)"></rect> </g> </svg> css rect { fill: url(#rainbow); } result specifications specification status comment filter effects module level 1the definition of '<fecomponenttransfer>' in that specification. working draft specified that missing transfer function elements are treated like they were specified with their type attributes set to...
<foreignObject> - SVG: Scalable Vector Graphics
the <foreignobject> svg element includes elements from a different xml namespace. in the context of a browser, it is most likely (x)html. ...
... the <foreignobject> svg element includes elements from a different xml namespace. in the context of a browser, it is most likely (x)html. ...
... default value: 0; animatable: yes y the y coordinate of the foreignobject. value type: <length>|<percentage> ; default value: 0; animatable: yes note: starting with svg2, x, y, width, and height are geometry properties, meaning those attributes can also be used as css properties for that element. ...
<svg> - SVG: Scalable Vector Graphics
Web › SVG › Element › svg
cx="5" cy="5" r="4" /> </svg> </svg> attributes baseprofile deprecated since svg 2 the minimum svg language profile that the document requires. value type: <string> ; default value: none; animatable: no contentscripttype deprecated since svg 2 the default scripting language used by the svg fragment. value type: <string> ; default value: application/ecmascript; animatable: no contentstyletype deprecated since svg 2 the default style sheet language used by the svg fragment. value type: <string> ; default value: text/css; animatable: no height the displayed height of the rectangular viewport. (not the height of its coordinate system.) value type: <length>|<percentage> ; default value: auto; animatable: yes preserveaspectratio how the svg fragment must be deformed if it is dis...
... yes y the displayed y coordinate of the svg container. no effect on outermost svg elements. value type: <length>|<percentage> ; default value: 0; animatable: yes note: starting with svg2, x, y, width, and height are geometry properties, meaning these attributes can also be used as css properties. ...
... candidate recommendation scalable vector graphics (svg) 1.1 (second edition)the definition of '<svg>' in that specification. recommendation initial definition ...
<use> - SVG: Scalable Vector Graphics
Web › SVG › Element › use
e set in the ancestor. that's why the circles have different x positions, but the same stroke value. --> </svg> the effect is the same as if the nodes were deeply cloned into a non-exposed dom, then pasted where the use element is, much like cloned template elements in html5. most attributes on use do not override those already on the element referenced by use. ...
...css properties are not guaranteed to be inherited by the cloned dom unless you explicitly request them using css inheritance. for security reasons, browsers may apply the same-origin policy on use elements and may refuse to load a cross-origin url in the href attribute. ...
...e no effect on use elements, unless the element referenced has a viewbox - i.e. they only have an effect when use refers to a svg or symbol element. note: starting with svg2, x, y, width, and height are geometry properties, meaning those attributes can also be used as css properties for that element. ...
SVG element reference - SVG: Scalable Vector Graphics
Web › SVG › Element
ht> <fespecularlighting> <fespotlight> <fetile> <feturbulence> <filter> <foreignobject> g <g> h <hatch> <hatchpath> i <image> l <line> <lineargradient> m <marker> <mask> <mesh> <meshgradient> <meshpatch> <meshrow> <metadata> <mpath> p <path> <pattern> <polygon> <polyline> r <radialgradient> <rect> s <script> <set> <solidcolor> <stop> <style> <svg> <switch> <symbol> t <text> <textpath> <title> <tspan> u <unknown> <use> v <view> svg elements by category animation elements <animate>, <animatecolor>, <animatemotion>, <animatetransform>, <discard>, <mpath>, <set> basic shapes <circle>, <ellipse>, <line>, <polygon>, <polyline>, <rect> container elements <a>, <defs>, <g>, <marker>, <mask>, <missing-glyph>, <p...
...op> graphics elements <circle>, <ellipse>, <image>, <line>, <mesh>, <path>, <polygon>, <polyline>, <rect>, <text>, <use> graphics referencing elements <mesh>, <use> light source elements <fedistantlight>, <fepointlight>, <fespotlight> never-rendered elements <clippath>, <defs>, <hatch>, <lineargradient>, <marker>, <mask>, <meshgradient>, <metadata>, <pattern>, <radialgradient>, <script>, <style>, <symbol>, <title> paint server elements <hatch>, <lineargradient>, <meshgradient>, <pattern>, <radialgradient>, <solidcolor> renderable elements <a>, <circle>, <ellipse>, <foreignobject>, <g>, <image>, <line>, <mesh>, <path>, <polygon>, <polyline>, <rect>, <svg>, <switch>, <symbol>, <text>, <textpath>, <tspan>, <unknown>, <use> shape elements <circle>, <ellipse>, <line>, <mesh>, <path>, <...
...you should never use them in new projects, and should replace them in old projects as soon as you can. they are listed here for informational purposes only. a <altglyph>, <altglyphdef>, <altglyphitem>, <animatecolor> c <cursor> f <font>, <font-face>, <font-face-form...
Specification Deviations - SVG: Scalable Vector Graphics
there are a few places where we have consciously decided to make gecko deviate from or extend the svg specification. this page lists those deviations/extensions and our reasoning for them. the 'class' and 'style' attributes unlike html and mathml, the svg specification does not specify the 'style' and 'class' attributes on all svg elements. nevertheless, to allow mozilla to more cleanly share internal 'class' and 'style' related code, we will implement these attributes on all svg elements as of firefox 3. in general this change will not be visible to svg authors (the elements for which the svg specification does not define the 'class' and 'style' attribute are elements that are not displayed directly). however, there are two exceptions. extending the 'class' attribute to apply to all...
... elements that are not displayed directly). however, there are two exceptions. extending the 'class' attribute to apply to all svg elements will allow svg authors to use the selectors api to select any svg element based on class. this seems like a good thing. requiring svg authors to know which elements can and cannot take a 'class' attribute would just put an extra burden on them. ...
...all svg elements will allow svg authors to use the selectors api to select any svg element based on class. this seems like a good thing. requiring svg authors to know which elements can and cannot take a 'class' attribute would just put an extra burden on them. extending the 'style' attribute to apply to all svg elements should only really be visible to svg authors if they call viewcss.getcomputedstyle on the element or one of its descendants. since these elements and their descendants are not displayed, it seems unlikely that anyone will either specify 'style' or call getcomputedstyle on them. note that this extension does not mean that we add a css::cssstyledeclaration 'style' property to the dom of elements that do not implement the svgstylable interface. ...
Web Components
fferent technologies allowing you to create reusable custom elements — with their functionality encapsulated away from the rest of your code — and utilize them in your web apps. concepts and usage as developers, we all know that reusing code as much as possible is a good idea. this has traditionally not been so easy for custom markup structures — think of the complex html (and associated style and script) you've sometimes had to write to render custom ui controls, and how using them multiple times can turn your page into a mess if you are not careful. web components aims to solve such problems — it consists of three main technologies, which can be used together to create versatile custom elements with encapsulated functionality that can be reused wherever you like without fear of co...
...you to define custom elements and their behaviour, which can then be used as desired in your user interface. shadow dom: a set of javascript apis for attaching an encapsulated "shadow" dom tree to an element — which is rendered separately from the main document dom — and controlling associated functionality. in this way, you can keep an element's features private, so they can be scripted and styled without the fear of collision with other parts of the document. html templates: the <template> and <slot> elements enable you to write markup templates that are not displayed in the rendered page. these can then be reused multiple times as the basis of a custom element's structure. the basic approach for implementing a web component generally looks something like this: create a class in wh...
...t like you would any regular html element. tutorials using custom elements a guide showing how to use the features of custom elements to create simple web components, as well as looking into lifecycle callbacks and some other more advanced features. using shadow dom a guide that looks at shadow dom fundamentals, showing how to attach a shadow dom to an element, add to the shadow dom tree, style it, and more. using templates and slots a guide showing how to define a reusable html structure using <template> and <slot> elements, and then use that structure inside your web components. reference custom elements customelementregistry contains functionality related to custom elements, most notably the customelementregistry.define() method used to register new custom elements so they c...
Web technology for developers
mozilla code itself. view all... web technology references web apis reference material for each of the individual apis that comprise the web's powerful scriptability, including the dom and all of the related apis and interfaces you can use to build web content and apps. html hypertext markup language is the language used to describe and define the content of a web page. css cascading style sheets are used to describe the appearance of web content. svg scalable vector graphics let you describe images as sets of vectors and shapes in order to allow them to scale smoothly regardless of the size at which they're drawn. mathml the mathematical markup language makes it possible to display complex mathematical equations and syntax. temporary the stuff below here is temporary to h...
... sets of vectors and shapes in order to allow them to scale smoothly regardless of the size at which they're drawn. mathml the mathematical markup language makes it possible to display complex mathematical equations and syntax. temporary the stuff below here is temporary to help keep track of things while organization work is ongoing. pay it no mind. ...
...nologiesdeveloper guidesexsltevent referencehtml: hypertext markup languagehttpjavascriptmathmlopensearch description formatprivacy, permissions, and information securityprogressive web apps (pwas)svg: scalable vector graphicstutorialsweb apisweb componentsweb performanceweb app manifestsweb media technologiesweb securityweb technology referencexml: extensible markup languagexpathxslt: extensible stylesheet language transformations ...
Content Scripts - Archive of obsolete content
ed on amo. instead, keep the script in a separate file and load it using contentscriptfile. this makes your code easier to maintain, secure, debug and review. ...
...ely after the document element for the page is inserted into the dom. at this point the dom content hasn't been loaded yet, so the script won't be able to interact with it. "ready": load the scripts after the dom for the page has been loaded: that is, at the point the domcontentloaded event fires. at this point, content scripts are able to interact with the dom content, but externally-referenced stylesheets and images may not have finished loading. "end": load the scripts after all content (dom, js, css, images) for the page has been loaded, at the time the window.onload event fires. the default value is "end". note that tab.attach() doesn't accept contentscriptwhen, because it's generally called after the page has loaded. passing configuration options the contentscriptoptions is a json ...
core/promise - Archive of obsolete content
ntation of promises to make asynchronous programming easier. rationale most of the js apis are asynchronous complementing its non-blocking nature. while this has a good reason and many advantages, it comes with a price. ...
...comes with a price. ...
io/file - Archive of obsolete content
experimental provides access to the local filesystem. usage paths path specifications in this api are platform-specific. this means that on windows paths are specified using the backslash path separator (\), and on unix-like systems like linux and os x paths are specified using the forward slash path separator (/). if your add-on uses literal windows-style path specifications with this api, your add-on likely won't work when users run it on unix-like systems. likewise, if your add-on uses literal unix-style path specifications, it won't work for users on windows. to ensure your add-on works for everyone, generate paths using the join function. unfortunately this api does not currently provide a way to obtain an absolute base path which you could then use with join. for now, you need to...
...rk for users on windows. to ensure your add-on works for everyone, generate paths using the join function. unfortunately this api does not currently provide a way to obtain an absolute base path which you could then use with join. for now, you need to require("chrome") and use the xpcom directory service as described in this article about file i/o. note that if you do decide to hardcode windows-style paths, be sure to escape backslashes in strings. for example, to specify the file at c:\users\myk, you need to use the string "c:\\users\\myk", not "c:\users\myk". read more about escaping characters in strings. globals functions basename(path) the path parameter must be an absolute path, relative paths will cause an error. use the fs/path module for relative path support. returns the la...
ui/frame - Archive of obsolete content
ou create a frame, then supply it to the toolbar's constructor, and the content is then displayed inside the toolbar. constructing frames the frame constructor takes one mandatory option, which is a url pointing to an html document supplied under your add-ons "data" directory. ...
...ames the frame constructor takes one mandatory option, which is a url pointing to an html document supplied under your add-ons "data" directory. ...
Release notes - Archive of obsolete content
s made after this release entered aurora. bugs fixed between firefox 34 and firefox 35. this will not include any uplifts made after this release entered aurora. firefox 34 highlights new api: dev/panel enables you to extend the firefox developer tools. jpm beta released. "./my-file" introduced everywhere as an alias for require("sdk/self").data.url("my-file") added the ability to attach stylesheets to individual tabs. details github commits made between firefox 33 and firefox 34. this will not include any uplifts made after this release entered aurora. bugs fixed between firefox 33 and firefox 34. this will not include any uplifts made after this release entered aurora. firefox 33 highlights added support for context menus in panels via a new option in the panel constructor. ...
...this release entered aurora. bugs fixed between firefox 31 and firefox 32. this will not include any uplifts made after this release entered aurora. firefox 31 highlights add-on debugger added the ability to convert between high-level browserwindow objects and dom windows, and between high-level tab objects and xul tabs. updated the default theme used for panels on mac os x. added contentstyle and contentstylefile options to panel. details github commits made between firefox 30 and firefox 31. this will not include any uplifts made after this release entered aurora. bugs fixed between firefox 30 and firefox 31. this will not include any uplifts made after this release entered aurora. firefox 30 highlights added the ability to anchor panels to buttons. changes in the way conte...
Storing annotations - Archive of obsolete content
e main browser window rather than the panel. so the content script binds a click handler to the links which will send the url to the add-on. save this file in data/list as annotation-list.js. ...
... updating main.js here's the code to create the panel, which can go in the main function. var annotationlist = panels.panel({ ...
Display a Popup - Archive of obsolete content
xt); textarea.value = ''; } }, false); // listen for the "show" event being sent from the // main add-on code. it means that the panel's about // to be shown. // // set the focus to the text area so the user can // just start typing. ...
...s about // to be shown. // // set the focus to the text area so the user can // just start typing. ...
Customizing the download progress bar - Archive of obsolete content
this example illustrates how to customize the progress bar displayed for a given download in the downloads window. first you need to overlay the downloads window so that you can add a new stylesheet. ...
...a given download in the downloads window. first you need to overlay the downloads window so that you can add a new stylesheet. in your jar.mn file, add the following (replacing "myextension" with the name of your extension's chrome package): % overlay chrome://mozapps/content/downloads/downloads.xul chrome://myextension/content/downloads-overlay.xul in downloads-overlay.xul, reference the new stylesheet: <?xml version="1.0"?> <?xml-stylesheet href="chrome://myextension/skin/myextension.css" type="text/css"?> <overlay id="mydownloadoverlay" xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul"> </overlay> in jar.mn, make sure that there is an asterisk in front of the entry for myextension.css so that it will be preprocessed. this is required since it contains platform-speci...
HTML to DOM - Archive of obsolete content
advantageous to turn that html string into dom for easier manipulation. however, there are potential dangers involved in injecting remote content in a privileged context in your extension, so it can be desirable to parse the html safely. the function below will safely parse simple html and return a dom object which can be manipulated like web page elements. this will remove tags like <script>, <style>, <head>, <body>, <title>, and <iframe>. it will also remove all javascript, including element attributes that contain javascript. function htmlparser(ahtmlstring){ var html = document.implementation.createdocument("http://www.w3.org/1999/xhtml", "html", null), body = document.createelementns("http://www.w3.org/1999/xhtml", "body"); html.documentelement.appendchild(body); body.appendc...
...ou can add to your browser overlay .xul file. ...
Scrollbar - Archive of obsolete content
tested on windows xp. example assumes a structure like this: app/chrome/chrome.manifest app/chrome/skin/global/ copy the scrollbars.css from xulrunner/chrome/classic.jar/skin/classic/global to app/chrome/skin/global/scrollbars.css open the app/chrome/chrome.manifest and add: skin app-global standard/1.0 skin/global/ override chrome://global/skin/xulscrollbars.css chrome://app-global/skin/scrollbars.css xulscrollbars.css are used for windows xp, and nativescrollbars.css on osx. ...
...kin/scrollbars.css xulscrollbars.css are used for windows xp, and nativescrollbars.css on osx. ...
Displaying web content in an extension without security issues - Archive of obsolete content
via innerhtml. but <img src="does_not_exist" onerror="alert('xss')"> for example will still run javascript code, and there are many more possibilities. so properly sanitizing input is still required when using innerhtml and it is far from trivial. it is much easier to use dom manipulation methods that won’t have unexpected side-effects. ...
...xss')"> for example will still run javascript code, and there are many more possibilities. so properly sanitizing input is still required when using innerhtml and it is far from trivial. it is much easier to use dom manipulation methods that won’t have unexpected side-effects. ...
Chapter 1: Introduction to Extensions - Archive of obsolete content
t platform. one-trick gag extensions fixme: update this. there are a number of one-trick gag extensions that aren’t very useful. this is a very brief survey of a few extensions, but there are many other unique extensions available. table 1: advanced customization methods for firefox customization method does it work for web sites? does it work for firefox? user style sheets (change appearance through css) yes; you can change the usercontent.css file, or use the stylish extension. yes; you can change the userchrome.css file, or use the stylish extension. user scripts (change appearance and functionality through javascript) yes; you can use the greasemonkey extension or "bookmarklets." yes; you can change use...
...klets." yes; you can change userchrome.js to add functionality through javascript. extensions (these can do anything) yes yes theming (this changes the look of the browser) no yes let's build an extension table 1 shows the various customization options available to a user in firefox. users have flexible customization options, using css in user style sheets and javascript/dom in user scripts (these depend on stylish, greasemonkey, and userchrome.js). in addition to css and javascript, extensions can take advantage of xul and xpcom technologies for more sophisticated features. themes, which alter firefox's appearance, are a kind of add-on. in order to create an extension, you need an idea and just a little programming ability. the following ...
Adding sidebars - Archive of obsolete content
ll also look at some handy xul elements in this section. they allow you to stack content on top of other content and switch between different sections easily. the tabbox element the « xul reference « element creates a tabbed view of one or more tabpanel elements. you can see an example of a tabbox element if you open the firefox preferences window and select the advanced section. the tabs are styled to match the operating system you're using, so you should avoid changing the css in tab boxes. on the other hand, if you need ui that behaves like a tabbox but doesn't look like one, you should still favor using a tabbox and use css to change its look. using custom-made elements are likely to cause accessibility and functional problems. creating a tabbed view is simple: <tabbox id="xulschool...
... xml code that is hard to follow. this is why most of the uses of the tree element are for displaying data from an external datasource. even handling the construction of a tree using javascript and dom functions can become very convoluted, which is why trees are better used along with templates. this topic will be covered later when we look at different kinds of datasources and templates. adding style to a tree can also be challenging, which is why there's a guide specifically covering how to style a tree. looking at the bookmarks and history sidebars should make it clear that trees are quite customizable with css. « previousnext » this tutorial was kindly donated to mozilla by appcoast. ...
Adding windows and dialogs - Archive of obsolete content
are very simple and shouldn't be too hard to implement manually using xul. well, it's more complicated than that. different operating systems order and position their buttons differently in their dialogs. there are also subtle aspects about window size, margins and paddings that are not the same for all systems, so you should avoid making dialogs from scratch or overriding the default dialog css styles. the dialog element handles all of this transparently. all you need to do is define which buttons you'll need and the actions associated with them. <dialog id="xulschoolhello-hello-dialog" title="&xulschoolhello.hellodialog.title;" buttons="accept,cancel" ondialogaccept="return xulschoolchrome.hellodialog.accept();" ondialogcancel="return xulschoolchrome.hellodialog.cancel();" xmln...
... shouldn't be seen as an aesthetic device, but a logical one. if all you need is a border, use css. the groupbox element should be used when enclosed elements share some function which is separate from other elements or groups in the same window. it's also a useful accessibility feature, because screen readers will read the caption right before reading any text in its contents. you can change its style using css in case you don't want the borders to appear. see the firefox preferences window for an example of this: sections are defined using groupbox elements, but their style is quite different from the default. attribute persistence user actions can change the state of your windows, such as selecting an option in a listbox, or entering text in a textbox. if the user closes and then reopens y...
Setting Up a Development Environment - Archive of obsolete content
eparated as another add-on you can add and remove. it's a very useful inspection tool that lets you look into the dom of html and xul documents, as well as applied css rules and associated javascript objects. introduction to dom inspector is a good guide on how to get started using it. the dom inspector is particularly useful in finding out how to overlay a window, and how to replace default css style rules. you can see the names of the files involved, which gives you a good starting point when looking into the mozilla source. you can even change styles, attributes and execute javascript code in it, although that's not completely reliable. javascript debugger the name says it all. the venkman javascript debugger is a great way to trace execution of your javascript code. to debug extension a...
... having to close the instance of firefox you use to browse normally. make any modifications you want to the xul school project, run make install and restart firefox to see the extension work with your changes. install dom inspector. use it to locate the menu you created. hint: you can search for an element by id. inspect the css rules firefox applies to it by default. look at the final, computed style for the menu items. browse around the rest of the firefox dom, and try to figure out what the nodes correspond to in the firefox ui. install the firebug extension. open the firebug window and go to an ajax-heavy page such as gmail or facebook. open and enable the net tab. try to identify what is going on with some of the requests being sent. now that you know how to quickly monitor your projec...
Tabbed browser - Archive of obsolete content
etinterface(ci.nsidomwindow); var gbrowser = adomwindow.gbrowser; //this is the gbrowser object of the firefox window this tab is in var atab = gbrowser._gettabforcontentwindow(contentwindow.top); //this is the clickable tab xul element, the one found in the tab strip of the firefox window, atab.linkedbrowser is same as browser var above //can stylize tab like atab.style.backgroundcolor = 'blue'; //can stylize the tab like atab.style.fontcolor = 'red'; var browser = atab.linkedbrowser; //this is the browser within the tab //this is what the example in the previous section gives //end getting other useful stuff } else { components.utils.reporterror('exception: load context not found!!'); /...
... .queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsidomwindow); var gbrowser = adomwindow.gbrowser; var atab = gbrowser._gettabforcontentwindow(contentwindow.top); //this is the clickable tab xul element, the one found in the tab strip of the firefox window, atab.linkedbrowser is same as browser var above //can stylize tab like atab.style.backgroundcolor = 'blue'; //can stylize the tab like atab.style.fontcolor = 'red'; var browser = atab.linkedbrowser; //this is the browser within the tab //this is where the example in the previous section ends return { adomwindow: adomwindow, gbrowser: gbrowser, atab: atab, browser: browser, c...
Firefox addons developer guide - Archive of obsolete content
some reference to the xuldev website (we want to host source code on mdc, not on xuldev), and to japanese things (like some specific locales, which have been translated to french since non-latin characters are not well supported). there are a few things that could be done to make this fit the site better, and for general cleaning up: tables should use the "standard-table" css class so they're styled the same as those on the rest of mdc. there should be some introductory text on the table of contents page at https://developer.mozilla.org/en/firefox_addons_developer_guide obviously there are a number of fixme items in the content that need dealing with, but those are already known. these should use the previous, next, and prevnext templates to add quick routes to get from chapter to chapte...
...s is done everywhere else in mdc. the stuff about installing the dom inspector (https://developer.mozilla.org/en/firefox_addons_developer_guide/let%27s_build_a_firefox_extension#install_the_dom_inspector) is not accurate for firefox 3 or later, since it's no longer included in the firefox installer and must be downloaded from amo. filenames should use <code> styling. this is available from the style drop-down menu in the editor. variable and function names use <code> styling. xpi should be in all caps instead of written as ("xpi"). method and function names should have parentheses after them. for example, here: https://developer.mozilla.org/en/firefox_addons_developer_guide/let's_build_a_firefox_extension#init_method the text of the paragraph should begin "the <code>init()</code> method...
Creating a Firefox sidebar extension - Archive of obsolete content
itle "emptysidebar"> <!entity openemptysidebar.commandkey "e"> <!entity openemptysidebar.modifierskey "shift accel"> the content folder includes our sidebar, the emptysidebar.xul is shown in example 3. it creates a page holding one label. other elements can be included, please read the xul tutorials for more information. example 3. ...
...entity openemptysidebar.modifierskey "shift accel"> the content folder includes our sidebar, the emptysidebar.xul is shown in example 3. it creates a page holding one label. other elements can be included, please read the xul tutorials for more information. example 3. ...
Making it into a dynamic overlay and packaging it up for distribution - Archive of obsolete content
the content sub-subdirectory: tinderstatusoverlay.xul tinderstatus.js tinderstatus.css tb-busted.png tb-nostatus.png tb-success.png tb-testfailed.png these are the files we're going to put into the xpi. ...
...pe="application/javascript" src="chrome://tinderstatus/content/tinderstatus.js" /> <statusbar id="status-bar"> <statusbarpanel class="statusbarpanel-iconic" id="tinderbox-status" insertbefore="offline-status" status="none"/> </statusbar> </overlay> we also need to change the urls in the copy of tinderstatus.css: statusbarpanel#tinderbox-status { list-style-image: url("chrome://tinderstatus/content/tb-nostatus.png"); } statusbarpanel#tinderbox-status[status="success"] { list-style-image: url("chrome://tinderstatus/content/tb-success.png"); } statusbarpanel#tinderbox-status[status="testfailed"] { list-style-image: url("chrome://tinderstatus/content/tb-testfailed.png"); } statusbarpanel#tinderbox-status[status="busted"] { list-style-image: ur...
Documentation for BiDi Mozilla - Archive of obsolete content
(lro, rlo, etc, and their html equivalents). bidi processing for a given html document will only take place if one of the following is true: the page includes a hebrew or arabic character or a hindi digit. this is determined in nstextfragment::setto the page includes a element with the attribute dir=rtl, either explicitly (nsgenerichtmlelement::mapcommonattributesinto), or as a consequence of a style rule (mapdeclarationtextinto in nscssstylerule.cpp) all these cases use nsdocument::enablebidi to set the flag mbidienabled. in a bidi-enabled document, the following things happen: during a reflow, nsbidipresutils::resolve is called. this method uses the uba to determine the directional properties of the text and reorder frames if necessary. if necessary, text frames are split so that every fr...
...rols: based on bidi options in preferences, the text mode of form controls may be "logical", "visual" or "like containing document". we have also tested behaviour of all controls with dir=rtl and added support where necessary. some support added for alignment in tables and lists, and fixes for problems with different combinations of dir and align. ...
Layout FAQ - Archive of obsolete content
prof can also be used. also lists some profiles. how do you find out if there are any reflows that are pending and wait to show the view until afterwards, but if none are pending, show the view immediately? what is the best way to determine whether there are any pending changes? on the reflow branch you could check the dirty and dirty_children framestate flags. that won't help with pending style changes, but it'll work to detect cases when the popup or something in it needs to be reflown. what are the lowercase items called "line"? block(body)(1)@035ff490 {120,120,8820,600} [state=00000010] sc=035ff264(i=2,b=0)< line 035ffc18: count=1 state=inline,clean,prevmarginclean,not impacted,not wrapped,before:nobr,after:linebr[0x5100] {0,0,330,300} < inline(span)(0)@035ffa04 next=035...
... "\nabc" > frame(br)(1)@035ffb1c {330,225,0,0} [state=00000020] [content=035aebf0] > > the linebox is used to contain everything on a single line: example how do you fix inconsistent float behavior in firefox involving a two column layout using display:table and floating div elements? this is a bug in firefox. you can work around it by removing display:table in the style rule with the "#main" selector or adding clear:both to it. why does move movement disappear when i use mouse events to click and drag? since the dragging action is involved, you might need to disable it. try using event.preventdefault() what is the purpose of the ns_lossyconvertucs2toascii() function? this function converts an nsastring to an nsacstring by assuming that all the 16-bit uni...
Introducing the Audio API extension - Archive of obsolete content
r second mozframebufferlength: number of samples collected in all channels this information is needed later to decode the audio data stream. ...
...e1 channel2-sample1 channel1-sample2 channel2-sample2 channel1-sample3 channel2-sample3. ...
Clipboard Test - Archive of obsolete content
<style></style> <style>.description{ display: block; font-size: 13pt; color: #444; font-style: italic; margin-bottom: 7px; } .method>.returns{display: none;} .method>.name>.param:not(:last-child):after{content: ","; padding-right: .5em; } .method>.name>.param:not(:last-child):after{content: ","; padding-right: .5em; } .method>.name>.param>.name:after{content: " as "; font-weight: normal; } .method>.params{display: block; color:#555;} .method>.params>.param{display: block; margin-bottom:5px;} .method>.params>.param>.name{font-weight:bold; margin-right:.5em; min-width:80px; display:inline-block;} .method>.params>.param>.description{display:inline-block; width:300px; vertical-align:top;margin-right:30px} .method>.params>.param>.type{display:inline-block; width:100px; vertical-align:top;font-weight...
...features can get and set the clipboard in various flavors of data type. the namespace associated with this api is jetpack.clipboard which provides both read and write access to the clipboard. the api is fairly straightforward; examples can be found here. this api currently lives in the fut...
Microsummary XML grammar reference - Archive of obsolete content
attribute for them. child elements: <template> (required) defines how to transform pages into their microsummaries. <pages> (required) identifies the set of pages that the generator is able to summarize. <update> (optional) specifies how frequently firefox should update the microsummaries. the <template> element the <template> element contains the xslt stylesheet which transforms web pages into their microsummaries. attributes: none. child elements: <stylesheet> or <transform> (required) the xslt stylesheet which performs the transformation. per xslt, you may specify the stylesheet child element using either the <stylesheet> or the <transform> tag, which are interchangeable. note: although the <template> element must be in the micr...
... the <pages> element the <pages> element identifies the set of pages that the generator is able to summarize. attributes: none. ...
Table Layout Strategy - Archive of obsolete content
en fixed and auto layout of tables has been introduced. the auto-layout mechanism is implemented in basictablelayoutstrategy.cpp the fixed-layout in fixedtablelayoutstrategy.cpp. all these files are in the layout/html/table/src subdirectory. the code the layout strategies are invoked from nstableframe::reflow. the overload of the initialize and balancecolumnwidths routines depends on the table style and is decided at runtime. on the first reflow nstableframe::balancecolumnwidths is called. inside this routine the corresponding table layout strategy is created and initialized (basictablelayoutstrategy::initialize). later the column widths are balanced by basictablelayoutstrategy::balancecolumnwidths or the fixed layout counter part. in the following the basic table layout strategy is discusse...
...these informations are very often conflicting. for instance one cell could have a large min width,the next could have a specified fixed width and another a specified pct width. for a given width type the maximum wins. special cases note: the following examples are not shown correctly due to technical constraints on wiki...
Creating XPI Installer Modules - Archive of obsolete content
p unarchiver[zip] to open it. all of the resources described in this article are in the xpi archive and can be adapted for use in your own development. developing the resources needless to say, one of the first things you will have to create is the actual software you wish to make redistributable. ...
...ight="375" x="20" y="20" persist="width height x y" orient="vertical" autostretch="always"> <script src="barley.js"/> <image src="barley.gif" /> <box orient="horizontal" autostretch="never"> <button label="barley corn" /> <button label="show aphids" oncommand="bar();" /> </box> </window> the other files that the window imports are defined in dark blue. note that the stylesheet processing instruction at the top of the xul file does not refer to any new skin, but imports communicator.css to make use of that skin's basic widget styles. the javascript file barley.js contains a single function, bar(), defined as follows: function bar() { alert("aphids"); } if you want to use the same gif image that is used in the barley package, it can be grabbed from here. while ...
width - Archive of obsolete content
layed width may be different if the element or its contents have a minimum or maximum width, or the size is adjusted by the flexibility or alignment of its parent. the css width property may also be used. in this example, the preferred width of the inner hbox will be displayed at 40 pixels. the displayed width is also 40 pixels as no flexibility or alignment applies. ...
...d at 40 pixels. the displayed width is also 40 pixels as no flexibility or alignment applies. <hbox> <hbox width="40" style="background-color: red;"> <label value="40"/> </hbox> </hbox> however, in the following example, despite that the preferred width of the box is 30 pixels, the displayed size of the box will be larger to accommodate the larger label. <vbox width="30" align="start" style="background-color: red;"> <label value="vbox xul width 10px red"/> </vbox> note: when used on treecol objects, the width attribute can be used to allow a tree to be scrolled horizontally if the column widths add up to be wider than the containing object. ...
Textbox (XPFE autocomplete) - Archive of obsolete content
er key is pressed radio/check box when the state is changed select list when the selected item is changed what is accessible the script context at this point can only access the following things: global values/functions i.e. ...
... titles associated with each url. if this attribute is not specified, the comment column doesn't appear. showpopup type: boolean note: applies to: thunderbird, seamonkeyif true, the popup will be shown. if false, the popup will not be shown, but the autocomplete results will still be available. you can set this to false and set the autofill attribute to true to emulate a communicator 4.x style autocomplete textbox. the default value is true. size type: integer the number of characters that can be displayed in the textbox. tabindex type: integer the tab order of the element. the tab order is the order in which the focus is moved when the user presses the "tab" key. elements with a higher tabindex are later in the tab sequence. tabscrolling obsolete since ge...
Tree Widget Changes - Archive of obsolete content
ribute to true, or leaving out the attribute. note that it's the value attribute you use, not the label attribute. <treecell/> <treecell value="true"/> you need to specify the checkbox image with css for the checkbox to display. (do not set id of the column to be 'checked' it will cause problems with the css) treechildren::-moz-tree-checkbox(checked) { /* css for checked cells */ list-style-image: url("chrome://global/skin/checkbox/cbox-check.gif"); } in addition, checkmark columns support editing: <tree editable="true"> <treecols> <treecol type="checkbox" editable="true"> ... </treecol> </treecols> </tree> if the column is editable, the user can click the cell to change the state of the checkbox. when the user clicks the cell, the view's setcellvalue method w...
... nsitreeview.setcellvalue() and nsitreeview.setcelltext() functions to change the tree content with a script for other types of cells. for instance: var col = tree.columns.getprimarycolumn(); treecell.setcelltext(5, col, "banana"); this will change the label of the cell in row 5 and the primary column to banana. however, this paves the way in the future for more general tree editing features. style improvements you can now specify the cursor to use for a cell using the css cursor property. treechildren::-moz-tree-cell-text { cursor: pointer; } this allows you to create separate cursors for cells. the :-moz-tree-separator pseudo has been improved to make it a proper box type and now has additional styling capabilities. example: treechildren::-moz-tree-separator { margin-top: ...
Anonymous Content - Archive of obsolete content
on each side of it. this would be created with a box to hold the image and two buttons. the image element has to be placed outside the xbl as it will differ with each use. xul: <box class="zoombox"> <image src="images/happy.jpg"/> <image src="images/angry.jpg"/> </box> xbl: <binding id="zoombox"> <content> <xul:box flex="1"> <xul:button label="zoom in"/> <xul:box flex="1" style="border: 1px solid black"> <children includes="image"/> </xul:box> <xul:button label="zoom out"/> </xul:box> </content> </binding> the explicit children in the xul file will be placed at the location of the children tag. there are two images, so both will be added next to each other. this results in a display that is equivalent to the following: <binding id="zoombox"> ...
...utton label="zoom out"/> </xul:box> </content> </binding> the explicit children in the xul file will be placed at the location of the children tag. there are two images, so both will be added next to each other. this results in a display that is equivalent to the following: <binding id="zoombox"> <content> <xul:box flex="1"> <xul:button label="zoom in"/> <xul:box flex="1" style="border: 1px solid black"> <xul:image src="images/happy.jpg"/> <xul:image src="images/angry.jpg"/> </xul:box> <xul:button label="zoom out"/> </xul:box> </content> </binding> from the dom's perspective, the child elements are still in their original location. that is, the outer xul box has two children, which are the two images. the inner box with the border has ...
Creating Dialogs - Archive of obsolete content
uct up to four buttons along the bottom of the dialog forok,cancel, and so on. you do not need to include the xul for each button; however, you do need to supply code to perform the appropriate tasks when the user presses each button. this mechanism is necessary because different platforms have a specific order in which the buttons appear. ...
...es are buttonlabelaccept - label to appear on the accept button egsave buttonaccesskeyaccept - access key to use for the accept button egs defaultbutton - button is activated when the enter key is pressed note: the label attributes are required by remote sites and are probably missing in the above examples due to bug 224996. ...
Focus and Selection - Archive of obsolete content
ontrol attribute pointing to the id of the textbox. finally, the other label which displays the tag name has no control attribute, so clicking it has no effect on the focused element. only focusable elements can be focused. making a label focusable if you were creating custom elements, you might have a need to change whether an element can have the focus or not. for this, you can use a special style property -moz-user-focus. this property controls whether an element can be focused. for instance, you could make a label focusable, as in the example below. example 4 : source view <label id="focused" style="-moz-user-focus: normal;" onkeypress="alert('label focused');" value="focus me"/> the style property is set to normal. you can also set it to ignore to turn off the focus for an el...
...n the command dispatcher. these methods move the focus to the next element in sequence or the previous element respectively. this is what happens when the user presses tab or shift+tab. for textboxes, a special attribute, focused is added whenever the element has the focus. you can check for the presence of this attribute to determine if the element has the focus, either from a script or within a style sheet. it will have the value true if the textbox has the focus and, if the textbox does not have the focus, the attribute will not be present. suppose you wanted to move the focus from where it currently is, to the next place the browser thinks it should be. a user typically does this by hitting the "tab" key. you can do this anywhere you have a xul browser document by simply: document.com...
Tree View Details - Archive of obsolete content
rack of this. the tree will call this method to determine which containers are open and which are closed. note that the tree will call neither iscontainerempty nor iscontaineropen for rows that are not containers as indicated by the return value of the iscontainer method. a container may be rendered differently than a non-container. for instance, a container may have a folder icon beside it. a style sheet may be used to style items based on various properties such as whether a row is open. this is described in a later section. a non-empty container will be displayed with a twisty next to it so that the user may open and close the row to see child items. empty containers will not have a twisty, but will still be treated like a container. when the user clicks the twisty to open a row, the tre...
...a row, we need to tell the tree to repaint the twisty in the new state. the easiest way to do this is to invalidate the row. complete example there are several other view functions we can implement but they don't need to do anything in this example, so we can create functions that do nothing for those. ...
Using the Editor from XUL - Archive of obsolete content
one loading. the xul contains an <editor> tag, e.g.: <editor type="content-primary" id="content-frame" src="about:blank" flex="1"/> the attribute type="content-primary" identifies this as the window content element, i.e. that which you get from window._content. having an id attribute, id="content-frame", allows us to find this element with document.getelementbyid("content-frame"), and to style it from css. editoronload() is called. it does some getting of window.arguments (which is a way callers can pass parameters to new windows -- we use this to get the url to be loaded), then it calls editorstartup(), where the real work happens. it passes two parameters; the first indicates whether we want a plain text or html editor (pass text or html here), and the second is the <iframe>...
...handled entirely by the rules code, in the willdoaction()call. in composer, we are using nshtmleditrules, so we end up in nshtmleditrules::willdoaction(). for text insertion, this drops into nshtmleditrules::willinserttext(). this code first deletes the selection if there is one (e.g. you are typing over selected text), then calls a generic pre-insertion call willinsert(), which sets up inline styles for the inserted text, and moves the selection to an appropriate place where the text is to be inserted. now we are ready to actually insert the text. recall that we're going through a generic inserttext() call, so this code deals with pasting long strings, as well as inserting single characters. the code thus has to do the correct thing with linebreaks, so has a special case for inserting in...
XUL accessibility guidelines - Archive of obsolete content
lbox and listbox, are made to scroll automatically. as a general rule, elements set to scroll are inaccessible if the user cannot scroll to all the content using the keyboard. the arrowscrollbox, for example, is a non-focusable element and cannot be scrolled using a keyboard. a listbox, however, can receive focus so its contents can scroll. almost any xul element can be set to scroll by setting a style to "overflow: auto" or "overflow: scroll". this flexibility should be used carefully. maintaining focus the user should typically control where the current focus is located. avoid changing the focus automatically. however, disabling, hiding, or destroying the focus element (or any ancestor of the focus element) can cause a loss of focus. to prevent this, move the focus to the next element befor...
...he correct label for textbox is actually the same, but we don't want assistive technologies to read or show it twice. we need a way of specifying in the source that the checkbox, editbox, and nearby text labels are all part of a single entity, and that they essentially label each other. to solve this problem, we use the aria-labelledby attribute on both controls (note the double l—aria uses uk-style spelling) to specify that the checkbox and the textbox are both labeled by the the entire group of components. put into xul, this looking something like the following. <checkbox id="rememberhistorydays" aria-labelledby="historydaysprelabel historybox historydayspostlabel"> <label id="historydaysprelabel">remember visited pages for the last</label> <textbox id="historydays" aria-labelledby=...
XML - Archive of obsolete content
l, its parent language. xul syntax & rules xul is a standards-based interface definition language. it attempts to balance precise control of layout with flexibility and ease of use, and in this respect it does a great job. using a combination of xul's ready-made widgets (e.g., menubar, scrollbar, progressmeter, and so on) and xul's incorporation of such standards as html4, dom1/2, and cascading stylesheets, you can design any interface that you can imagine, using any number of different features, tools, and methodologies. there are many times, for example, when you may use javascript tricks to add extra behavior. but the necessary tradeoff for xul's flexibility is a lack of implicit functionality -- the lack ofintuition, you might say, that xul has in interpreting what it is you want. in orde...
...els on the screen. mozilla is a product made with all these technologies, but gecko is the thing sitting inside that renders that product. gecko was designed to be lightweight, standards-compliant and cross-platform, so rather than defining on its own how these widgets should be rendered, gecko depends for all but the most basic behavioral and presentational aspects of the widgets upon cascading stylesheets. the combination of structure, as defined in the xul, style as defined by the stylesheets, and the other standards are rendered by gecko into the interface. the heavy lifting is done by the ingredients rather than the chef. this arrangement creates new possibilities for truly cross-platform web applications, application serving, web appliances and embedded systems, and all sort of other ...
XUL Event Propagation - Archive of obsolete content
nts, even by the event target itself. the combination of basic these two basic event flow mechanisms, event bubbling and event capturing, mean that events raised in the interface can be caught anywhere above the element that raised the event. this flexibility in the xul event model is the focus of this article. ...
... flexibility in the xul event model is the focus of this article. ...
action - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, r...
...ext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelements...
arrowscrollbox - Archive of obsolete content
if false, the mouse must be hovered over the arrows to scroll automatically. disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is disabled. dis...
...ndex are later in the tab sequence. properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width disabled type: boolean gets and sets the value of the disabled attribute. scrollboxobject type: nsiscrollboxobject the scroll box object implements the nsiscrollboxobject interface, which may be used to retrieve and adjust the scroll position of the list box. scrollincrement type: integer a read only property that lets...
assign - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
bbox - Archive of obsolete content
Archive › Mozilla › XUL › bbox
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
binding - Archive of obsolete content
it can be a variable reference, an rdf resource uri, or an rdf literal value. predicate type: uri the predicate or property to match. this must be a uri of the property. subject type: string the subject of the element. it can be a variable reference or a...
...n be a variable reference or an rdf resource uri. ...
bindings - Archive of obsolete content
it can be a variable reference, an rdf resource uri, or an rdf literal value. predicate type: uri the predicate or property to match. this must be a uri of the property. subject type: string the subject of the element. it can be a variable reference or an rdf ...
...le reference or an rdf resource uri. ...
box - Archive of obsolete content
Archive › Mozilla › XUL › box
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
broadcaster - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
broadcasterset - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
column - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
columns - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
conditions - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
deck - Archive of obsolete content
Archive › Mozilla › XUL › deck
you may select an item by assigning its index to this property. by assigning -1 to this property, all items will be deselected. returns -1 if no items are selected do not hide panels; the deck element only underst...
... to this property will modify the selected panel. ...
dialogheader - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] a heading row for a dialog box. this element should be placed inside a dialog element. the header may have a title and a description. ...
...ear in the title bar of the window. ...
dropmarker - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , le...
...he type of accessibility object for the element. ...
grid - Archive of obsolete content
Archive › Mozilla › XUL › grid
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
grippy - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
groupbox - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , le...
...he type of accessibility object for the element. ...
hbox - Archive of obsolete content
Archive › Mozilla › XUL › hbox
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
keyset - Archive of obsolete content
if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. if the element is disabled, it does not respond to user actions, it cannot be focused, and the command event will not fire. in the case of form...
... need to update additional state. ...
listcol - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
listcols - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
listhead - Archive of obsolete content
disabled type: boolean gets and sets the value of the disabled attribute. inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , co...
...ts and sets the value of the disabled attribute. ...
listheader - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , le...
...he type of accessibility object for the element. ...
member - Archive of obsolete content
container type: ? a variable reference to a node that is expected to be a container. if the variable is the same as the uri attribute on the content ele...
...ce must be a container element in order to match. ...
menu - Archive of obsolete content
Archive › Mozilla › XUL › menu
l. ...
...pecified index. insertitemat( index, label, value ) return type: element this method creates a new item and inserts it at the specified position. you may optionally set a value. the new item element is returned. removeitemat( index ) return type: element removes the child item in the element at the specified index. the method returns the removed item. style classes menu-iconic use this class to have an image appear on the menu. specify the image using the image attribute. related elements menubar, menuitem, menulist, menupopup, menuseparator interfaces nsiaccessibleprovider, nsidomxulcontainerelement, nsidomxulcontaineritemelement, nsidomxulselectcontrolitemelement ...
observes - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
page - Archive of obsolete content
Archive › Mozilla › XUL › page
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
popupset - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
preferences - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...also executes code specified in onchanged attribute of the element. see also the description of change event of <preference>. void observe(in nsisupports asubject, in string atopic, in wstring adata); ...
progressmeter - Archive of obsolete content
max type: integer gets and sets the value of the max attribute. mode type: string gets and sets the value of the mode attribute. value type: string gets...
...ng the textbox.value and menulist.value syntax. ...
query - Archive of obsolete content
Archive › Mozilla › XUL › query
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
queryset - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
row - Archive of obsolete content
Archive › Mozilla › XUL › row
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
rows - Archive of obsolete content
Archive › Mozilla › XUL › rows
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
script - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
scrollcorner - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
spacer - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
spinbuttons - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
stack - Archive of obsolete content
Archive › Mozilla › XUL › stack
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
statusbar - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left...
...he type of accessibility object for the element. ...
stringbundleset - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
tab - Archive of obsolete content
Archive › Mozilla › XUL › tab
as it may need to update additional state. fadein type: boolean this attribute is set to true if the tab is fading in or out. this typically means that the tab is in the process of appearing or disappearing. first-tab type: boolean this attribute will be set to true for the first tab. this attribute should not be set manually, but is useful in a theme if the first tab should be styled differently. image type: uri the uri of the image to appear on the element. if this attribute is empty or left out, no image appears. the position of the image is determined by the dir and orient attributes. label type: string the label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is cop...
...he label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. last-tab type: boolean this attribute will be set to true for the last tab. this attribute should not be set manually, but is useful in a theme if the last tab should be styled differently. linkedpanel type: id the id of the linked tabpanel element that will be displayed when the tab is selected. if this attribute is not used, the tab will be connected to the panel at the corresponding index in the tabpanels element that the tab is in its tabs container. however, if this attribute is used, this behavior is overridden, and the tab will always be linked to a spe...
tabpanel - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
template - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
textnode - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
toolbar - Archive of obsolete content
lem for extensions that depend on being able to identify all possible toolbar items by looking in the toolbarpalette. ...
...otherwise, this option will be ignored for this toolbar and it will always be visible. related elements toolbarbutton, toolbargrippy, toolbaritem, toolbarpalette, toolbarseparator, toolbarset, toolbarspacer, toolbarspr...
toolbargrippy - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, m...
...returns the accessibility object for the element. ...
toolbaritem - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
toolbarpalette - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
toolbarseparator - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left,...
...the type of accessibility object for the element. ...
toolbarset - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, re...
...text, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsb...
toolbarspacer - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , le...
...he type of accessibility object for the element. ...
toolbarspring - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left...
...he type of accessibility object for the element. ...
toolbox - Archive of obsolete content
ts provided by the toolbox's externaltoolbars property. more information is available in the xul tutorial. if you'd like to detect when toolbars in a toolbox are changed, see toolbar customization events. ...
... customtoolbarcount firefox only type: integer the number of custom toolbars currently within the toolbox. externaltoolbars type: array of elements an array of external toolbars; t...
tooltip - Archive of obsolete content
ment. more information is available in the xul tutorial. ...
...an ellipsis will be used in place of the cropped t...
treecell - Archive of obsolete content
mines the type of progress meter to use. none no progress meter is displayed. the cell text is displayed instead. normal the cell uses its value attribute to determine the amount of the bar that is filled in. undetermined the progressmeter is indeterminate. properties type: space-separated list of property names sets the properties of the element, which can be used to style the element. for more information, see styling a tree. ref type: uri for template-generated elements, this attribute is used to specify the root rdf node where content generation begins. this will correspond to the value of an about attribute on an rdf container. this attribute should be placed alongside the datasources attribute. src type: uri set this to the uri of an image to...
...contents displayed to the user. ...
treecols - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , le...
...he type of accessibility object for the element. ...
triple - Archive of obsolete content
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
vbox - Archive of obsolete content
Archive › Mozilla › XUL › vbox
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
where - Archive of obsolete content
Archive › Mozilla › XUL › where
licatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, ...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
CommandLine - Archive of obsolete content
</window> original document informa...
...</window> original document information author: georges-etienne legendre last updated date: august 21st, 2007 ...
Getting started with XULRunner - Archive of obsolete content
are described in further detail in xulrunner:specifying startup chrome window. the debugging preferences are discussed in debugging a xulrunner application step 7: create some xul finally, we need to create a simple xul window, which is described in the file main.xul. nothing fancy here, just the minimum we need to make a window. no menus or anything. ...
...l run instead of the firefox browser that normally starts. this is similar to starting a xul app using xulrunner. see using firefox to run xulrunner applications. this does not work if firefox itself was installed as a xul app - you need to use the installed xulrunner directly. further reading: there are many things you can do with xulrunner (who would have thought that? typical mozilla writing style at play here). before you get too far into things you might want to read the xulrunner tips article. also, throughout this tutorial you've been introduced to various bits of the toolkit api and it may help you to get familiar with it. once you've got an application that's ready for the world you'll love our article titled deploying xulrunner. for now, click the "next" link to learn about windows...
Archived Mozilla and build documentation - Archive of obsolete content
etting started download the latest version of firefox and install it. be sure to install the dom inspector extension as well. creating a skin for mozilla in order to create a skin for mozilla, you will need to know three things. how to edit images, extract zip files, and how to modify css. mozilla uses standard gif, png, and jpeg images for the buttons and css to style everything else in the interface. creating a skin for seamonkey 2.x you're going to make a theme for seamonkey 2, but don't know how? i hope this manual will help you. creating regular expressions for a microsummary generator a regular expression is a special kind of string (i.e. a sequence of characters) that matches patterns of charact...
...able cellmap the table layout use the cellmap for two purposes: table cellmap - border collapse this document describes the additional information that is stored for border collapse tables in the cellmap. table layout regression tests changes in layout, parser and content code can have unintended side effects, also known as regressions. it is good style to check for these unwanted regressions and fixing them before checkin rather than causing bugzilla avalanches. table layout strategy the table layout algorithm is based on two w3c recommendations: html 4.01 (chapter 11) and css2.1 (chapter 17).in css2 a distinction between fixed and auto layout of tables has been introduced. the auto-layout mechanism i...
Extentsions FAQ - Archive of obsolete content
ch, which is chosen)? i have two states switching images in the tool bar and would have no problem implementing a third, so yes it's possible. ...
...telementbyid("toolbar-button").setattribute("toolbar-button", "on"); //or document.getelementbyid("toolbar-button").setattribute("toolbar-button","off"); //css #myexten-toolbar-button[myexten-toolbar-button="on"] { list-style-image: url("chrome://myexten/skin/toolbar-button.png"); -moz-image-region: rect(0px 24px 24px 0px);} #myexten-toolbar-button[myexten-toolbar-button="off"] { list-style-image: url("chrome://myexten/skin/toolbar-button-off.png"); -moz-image-region: rect(0px 24px 24px 0px);} to implement a third i would simply change add an attribute and the corresponding css see http://www.w3.org/tr/rec-css2/cascade.html#cascade friday, october 13 - 20, 2006 (↑ top) how to get a refenece to the sidebar window assuming you have chrome privileges, this should work: ...
Writing a plugin for Mac OS X - Archive of obsolete content
getting started if you check out the mozilla source code in mac os x, you can simply open basicplugin.xcodeproj in xcode, click build, and you're done. ...
...s so the browser can find them, which means they need to be prefixed by an underscore, and must not have the c++ obfuscation that is generated by the c++ compiler. the three symbols that must always be visible are: np_initialize() np_getentrypoints() np_shutdown() the sample plugin is written entirely in c, using a standard xcode build configuration, so by default all of its symbols are c-style and visible. if you want to implement your plugin in c++ or objective-c++, you need to tell the compiler to export them in c format by using extern "c" in the header, like this: #pragma gcc visibility push(default) extern "c" { nperror np_initialize(npnetscapefuncs *browserfuncs); nperror np_getentrypoints(nppluginfuncs *pluginfuncs); void np_shutdown(void); } #pragma gcc visibility pop...
-ms-scrollbar-darkshadow-color - Archive of obsolete content
lpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
...ere <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples the following example shows how to create a style rule that sets the -ms-scrollbar-darkshadow-color property for a <textarea> element. code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/scrollbarcolor.htm <!doctype html> <html> <head> <title>scrollbar-darkshadow-color</title> <style> .blueshadow { scrollbar-darkshadow-color: blue; } </style> </head> <body> <textarea class="blueshadow">the gutter elements in the scroll bar for this element will be blue.</textarea> </body> </html> specifications not part of any specification. ...
-ms-scrollbar-shadow-color - Archive of obsolete content
lpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
...e> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples the following example shows how to create a style rule that sets the -ms-scrollbar-shadow-color property for a <textarea> element. <!doctype html> <html> <head> <title>scrollbar-shadow-color</title> <style> .blueshadow { scrollbar-shadow-color: blue; } </style> </head> <body> <textarea class="blueshadow">the gutter elements in the scroll bar for this element will be blue.</textarea> </body> </html> specifications not part of any specification. ...
::-ms-fill - Archive of obsolete content
ther properties are ignored. ...
...ck, none) font height margin -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color, outline-style, and outline-width padding transform and transform-origin visibility syntax ::-ms-fill example html <progress value="10" max="50"></progress> css progress::-ms-fill { background-color: orange; } result a progress bar using this style might look something like this: ...
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
s very possible to produce a single page application which could also include any number of external assets such as a popular third party framework. listing 6 shows the beginning of our application which takes advantage of some of these concepts. ...
...hich takes advantage of some of these concepts. ...
Reference - Archive of obsolete content
title capitalization there's an inconsistency in the capitalization of section titles. some capitalize everything as if it's a book title. others just capitalize the first word. which scheme should we take, or does it even matter? --maian 07:11, 8 september 2005 (pdt) if you want to make them consistent, i think we should go with the "first word only" capitalization, rather than the book-title style. thanks :) -- dria deprecated pre box is there any wiki markup available for deprecated examples? --maian 20:24, 25 aug 2005 (pdt) help:custom_templates#template:deprecated_header --nickolay 00:58, 26 aug 2005 (pdt) hmm, that was a bad question. what i meant to ask is: what markup should i use for bad examples (which aren't necessarily deprecated), i.e. examples that show what not to do? -...
...y deprecated), i.e. examples that show what not to do? --maian 02:07, 26 aug 2005 (pdt) oh, i don't think so, but you can ask dria to create a css class for that. --nickolay 11:50, 26 aug 2005 (pdt) i'll add it to my todo list for the new skins. i have to go through them again this weekend to fix up some stuff anyhow. good idea, maian. thanks :) -- dria 21:06, 26 aug 2005 (pdt) coding style should semicolons be added to all the examples? --maian 21:06, 25 aug 2005 (pdt) the original authors didn't use semicolons, but i'd add them. --nickolay 00:58, 26 aug 2005 (pdt) (more coding style questions) --maian 04:06, 31 aug 2005 (pdt) i'd say, just make a note here about decisions you make. it would be best to have all examples to use the same style. --nickolay 05:37, 31 aug 2005 (pd...
XForms Styling - Archive of obsolete content
just a starting draft. hopefully someone more proficient in mozilla xforms and css can clean this up repeats see the mozilla xforms specials page for some general points. switches can be styled as tabs. triggers use appearance="minimal" to be able to style buttons portability the mozilla xforms extension is one of the few xforms processors which allow for styling of the xforms elements directly, using mostly standard css. processors such as chiba create "old-style" html forms from xforms documents, and must be styled accordingly. however, most of the time the transition is straight-forward: view the source after processing of your xforms document, and map the old styles to the new elements. appearance attributes can also make a big difference. experimenting with these can gi...
... accordingly. however, most of the time the transition is straight-forward: view the source after processing of your xforms document, and map the old styles to the new elements. appearance attributes can also make a big difference. experimenting with these can give you some easier way of styling the contents than just using the default. === example === here's a small example that shows equivalent styles for chiba and mozilla xforms. xforms: <pre></pre> chiba html: <pre></pre> mozilla css: <pre></pre> chiba css: <pre></pre> formsplayer css: <pre></pre> ...
Fixing Incorrectly Sized List Item Markers - Archive of obsolete content
ms. the following rule is derived from mozilla's html.css file: *|*:-moz-list-bullet, *|*:-moz-list-number {font-size: 1em;} this rule tells gecko-based browsers to use the computed value of font-size for the marker's parent, which is the list item itself. thus the font sizes of the marker and the content will be the same. since this rule is not valid css, it will prevent the validation of any stylesheet that contains it. one solution is to move the rule into its own stylesheet, and accept that the stylesheet in question will never validate. this might also be a place to put any explorer-specific css-like rules (such as scrollbar styling rules), which also will not validate. authors who are not concerned with making sure the rule applies across all namespaces can use a slightly more simplif...
...authors who are not concerned with making sure the rule applies across all namespaces can use a slightly more simplified rule: *:-moz-list-bullet, *:-moz-list-number {font-size: 1em;} recommendations if it is important to make list item markers match the font size of the content, use one of the suggested rules. in situations where validation is a priority, segregate the rule into a separate stylesheet so that the rule will not confuse css validators run against the main stylesheet. related links bug 110360 bug 97351 original document information author(s): eric a. meyer, netscape communications last updated date: published 04 oct 2002; revised 07 mar 2003 copyright information: copyright © 2001-2003 netscape. all rights reserved. note: this reprinted article was originally...
Examples - Game development
tims (ga.me.) polycraft a shipwreck 'n survive game. explore the island and defeat the monsters. hexgl a fast-paced, futuristic racing game. dead trigger 2 classic zombie splatter action, made with unity3d. angry bots a futuristic aliens-esque isometric 3rd person shooter demo, made with unity3d. nutmeg cute retro scrolling platforming action. back to candyland a match-3 (candy crush) style game. biolab disaster side-scrolling platform shooter. x-type vertically scrolling space shooter demo. xibalba retro (doom-style) first person shooter. gorescript another retro style first person shooter. the wizard a turn-based, dungeon puzzle game. hextris tetris-like hexagonal puzzle game. 2048 a sliding number tiles puzzle game. bananabread a multiplayer, 3d first-person shoot...
...irst-person shooter game developed using emscripten, webgl, and webrtc. monster madness a webgl and asm.js-based multiplayer online shooter, developed by nom nom games and trendy entertainment. auralux webgl and asm.js-based strategy game: capture all the suns to win! browserquest a mmorpg created by the little workshop and mozilla. shoot the rocks a canvas 2d single-player shooter in the style of atari's classic asteroids arcade game from 1979. star citadel a new take on star castle, cinematronics' classic 1980 arcade game, built with canvas 2d. classic platformer canvas 2d game based on `visual-ts game engine` - physics based on matter.js commercial games oort online a mmo exploration, building, and battle game (currently in development.) a wizard's lizard top down zelda...
Building up a basic demo with Babylon.js - Game development
atest firefox or chrome. creating a directory to store your experiments in. saving a copy of the latest babylon.js engine inside your directory. opening the babylon.js documentation in a separate tab — it is useful to refer to. ...
...babylon.js engine inside your directory. opening the babylon.js documentation in a separate tab — it is useful to refer to. ...
Building up a basic demo with the PlayCanvas engine - Game development
latest firefox or chrome. creating a directory to store your experiments in. saving a copy of the latest playcanvas engine inside your directory. opening the playcanvas documentation in a separate tab — it is useful to refer to. html structure here's the html structure we will use. ...
... latest playcanvas engine inside your directory. opening the playcanvas documentation in a separate tab — it is useful to refer to. html structure here's the html structure we will use. ...
Building up a basic demo with Three.js - Game development
uch as the latest firefox or chrome. create a directory to store your experiments in. save a copy of the latest minimized three.js library inside your directory. open the three.js documentation in a separate tab — it is useful to refer to. ...
...n. save a copy of the latest minimized three.js library inside your directory. open the three.js documentation in a separate tab — it is useful to refer to. ...
GLSL Shaders - Game development
you should: make sure you are using a modern browser with good webgl support, such as the latest firefox or chrome. create a directory to store your experiments in. save a copy of the latest minimized three.js library inside your directory. html structure here's the html structure we will use. ...
...t firefox or chrome. create a directory to store your experiments in. save a copy of the latest minimized three.js library inside your directory. html structure here's the html structure we will use. ...
Build the brick field - Game development
eate a function to loop through all the bricks in the array and draw them on the screen. our code might look like this: function drawbricks() { for(var c=0; c<brickcolumncount; c++) { for(var r=0; r<brickrowcount; r++) { bricks[c][r].x = 0; bricks[c][r].y = 0; ctx.beginpath(); ctx.rect(0, 0, brickwidth, brickheight); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); } } } again, we're looping through the rows and columns to set the x and y position of each brick, and we're also painting a brick on the canvas — size brickwidth x brickheight — with each loop iteration. the problem is that we're painting them all in one place, at coordinates (0,0). what we need to do is include s...
...add the following just above the drawball() call: drawbricks(); compare your code at this po...
Initialize the framework - Game development
ure is quite simple, as the game will be rendered entirely on the <canvas> element generated by the framework. ...
...l be rendered entirely on the <canvas> element generated by the framework. ...
2D maze game with device orientation - Game development
the game. setting up the canvas we will be rendering our game on canvas, but we won't do it manually — this will be taken care of by the framework. let’s set it up: our starting point is the index.html file with the following content. ...
...rendering our game on canvas, but we won't do it manually — this will be taken care of by the framework. let’s set it up: our starting point is the index.html file with the following content. ...
Visual typescript game engine - Game development
om the client part also config is not common. i just like it like that. ...
...ck.json ├── webpack.config.js ├── tsconfig.json ├── tslint.json ├── launch.json ├── workplace.code-workspace logo.png license ├── build/ (this is auto generated) | ├── externals/ | ├── templates/ | ├── imgs/ | ├── styles/ | | └── favicon.ico | ├── visualjs2.js | ├── app.html ├── src/ | ├── style/ | | ├── styles.css | ├── libs/ | | ├── class/ | | | ├── networking/ | | | | ├── rtc-multi-connection/ | | | | | ├── filebufferreader.js | | | | | ├── rtcmulticonnection2.js | | | | | ├── rtcmulticonnection3.js | | | | | ├── linkify.js | | | | | ├── gethtmlmediaele...
Selector (CSS) - MDN Web Docs Glossary: Definitions of Web-related terms
a css selector is the part of a css rule that describes what elements in a document the rule will match. the matching elements will have the rule's specified style applied to them. consider this css: p { color: green; } div.warning { width: 100%; border: 2px solid yellow; color: white; background-color: darkred; padding: 0.8em 0.8em 0.6em; } #customized { font: 16px lucida grande, arial, helvetica, sans-serif; } the selectors here are "p" (which applies the color green to the text inside any <p> element), "div.warning" (which makes any <div> element with the class "warning" look like a warning box), and "#customized", which sets the base font of the element with the id "customized" to 16-pixel tall lucida grande or one of a few fallback fonts. we can then apply thi...
...f a few fallback fonts. ...
jQuery - MDN Web Docs Glossary: Definitions of Web-related terms
ent(s) to an event. to explain it in detail, $(selector) will call jquery to select selector element(s), and assign it to an event api called .action(). ...
...alled .action(). ...
Speculative parsing - MDN Web Docs Glossary: Definitions of Web-related terms
traditionally in browsers the html parser ran on the main thread and was blocked after a </script> tag until the script has been retrieved from the network and executed. some html parser, such as firefox since firefox 4, support speculative parsing off of the main thread. it parses ahead while scripts are being downloaded and executed. the html parser starts speculative loads for scripts, style sheets and images it finds ahead in the stream and runs the html tree construction algorithm speculatively. the upside is that when a speculation succeeds, there's no need to reparse the part of the incoming file that was already scanned for scripts, style sheets and images. the downside is that there's more work lost when the speculation fails. this document helps you avoid the kind of things t...
...if you use a <base> element to override the base uri of your page, put the element in the non-scripted part of the document. don't add it via document.write() or document.createelement. ...
MDN Web Docs Glossary: Definitions of Web-related terms
n engineers) smtp snap positions soap spa (single-page application) specification speculative parsing speed index sql sql injection sri stacking context state machine statement static method static typing strict mode string stun style origin stylesheet svg svn symbol symmetric-key cryptography synchronous syntax syntax error synthetic monitoring t tag tcp tcp handshake tcp slow start telnet texel thread three js time to first byte time to inte...
... 404 502 alpn at-rule attack byte-order mark character set client cryptosystem debug digital signature execution flex-direction glsl interface library memory management routers self-executing anonymous function stylesheet vector image ...
Assessment: Accessibility troubleshooting - Learn web development
containing the files that comprise the example. decompress the contents into a new directory somewhere on your local computer. alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html, css, and javascript into one of these online editors. if the online editor you are using doesn't have a separate css/js panel, feel free to put them in appropriate <style> / <script> elements. the finished assessment site should look like so: you will see some differences/issues with the display of the starting state of the assessment — this is mainly due to the differences in the markup, which in turn cause some styling issues as the css is not applied properly. don't worry — you'll be fixing these problems in the upcoming sections! note: if you get stu...
...n you try to navigate it using a screenreader. can you update the article text to make it easier for screenreader users to navigate? the navigation menu part of the site (wrapped in <div class="nav"></div>) could be made more accessible by putting it in a proper html5 semantic element. which one should it be updated to? make the update. note: you'll need to update the css rule selectors that style the tags to their proper equivalents for the semantic headings. once you add paragraph elements, you'll notice the styling looking better. the images the images are currently inaccessible to screenreader users. can you fix this? the audio player the <audio> player isn't accessible to hearing impaired (deaf) people — can you add some kind of accessible alternative for these users? the ...
HTML: A good basis for accessibility - Learn web development
f you try our longer version out with a screen reader (see bad-semantics.html), you'll not have a very good experience — the screen reader hasn't got anything to use as signposts, so you can't retrieve a useful table of contents, and the whole page is seen as a single giant block, so it is just read out in one go, all at once. there are other issues too beyond accessibility — it is harder to style the content using css, or manipulate it with javascript, for example, because there are no elements to use as selectors. using clear language the language you use can also affect accessibility. in general, you should use clear language that is not overly complex and doesn't use unnecessary jargon or slang terms. this not only benefits people with cognitive or other disabilities; it benefits rea...
...of ui controls is that by default, browsers allow them to be manipulated by the keyboard. you can try this out using our native-keyboard-accessibility.html example (see the source code). open this in a new tab, and try pressing the tab key; after a few presses, you should see the tab focus start to move through the different focusable elements. the focused elements are given a highlighted default style in every browser (it differs slightly between different browsers) so that you can tell what element is focused. you can then press enter/return to follow a focused link or press a button (we've included some javascript to make the buttons alert a message), or start typing to enter text in a text input. other form elements have different controls, for example, the <select> element can have its ...
HTML: A good basis for accessibility - Learn web development
f you try our longer version out with a screen reader (see bad-semantics.html), you'll not have a very good experience — the screen reader hasn't got anything to use as signposts, so you can't retrieve a useful table of contents, and the whole page is seen as a single giant block, so it is just read out in one go, all at once. there are other issues too beyond accessibility — it is harder to style the content using css, or manipulate it with javascript, for example, because there are no elements to use as selectors. using clear language the language you use can also affect accessibility. in general, you should use clear language that is not overly complex and doesn't use unnecessary jargon or slang terms. this not only benefits people with cognitive or other disabilities; it benefits rea...
...of ui controls is that by default, browsers allow them to be manipulated by the keyboard. you can try this out using our native-keyboard-accessibility.html example (see the source code). open this in a new tab, and try pressing the tab key; after a few presses, you should see the tab focus start to move through the different focusable elements. the focused elements are given a highlighted default style in every browser (it differs slightly between different browsers) so that you can tell what element is focused. you can then press enter/return to follow a focused link or press a button (we've included some javascript to make the buttons alert a message), or start typing to enter text in a text input. other form elements have different controls, for example, the <select> element can have its ...
Creating fancy letterheaded paper - Learn web development
prerequisites: before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of css box model, and other box-related features such as implementing backgrounds. ...
... note: if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. project brief you have been given the files needed to create a letterheaded paper template. you just need to put the files together. to get there, you need to: the main letter apply the css to the html. ...
Type, class, and ID selectors - Learn web development
objective: to learn about the different css selectors we can use to apply css to a document. type selectors a type selector is sometimes referred to as a tag name selector or element selector, because it selects an html tag/element in your document. in the example below we have used the span, em and strong selectors. all instances of <span>, <em> and <strong> elements are therefore styled accordingly. try adding a css rule to select the <h1> element and change its color to blue. the universal selector the universal selector is indicated by an asterisk (*) and selects everything in the document (or inside the parent element if it is being chained together with another element and a descendant combinator). in the following example we have used the universal selector to remove ...
...r element and a descendant combinator). in the following example we have used the universal selector to remove the margins on all elements. this means that instead of the default styling added by the browser, which spaces out headings and paragraphs with margins, everything is close together and we can't see the different paragraphs easily. this kind of behavior can sometimes be seen in "reset stylesheets", which strips out all of the browser styling. since the universal selector makes global changes, we use it to deal with very specific situations such as the one outlined below. using the universal selector to make your selectors easier to read one use of the universal selector is to make selectors easier to read and more obvious in terms of what they are doing. for example, if i wanted t...
Beginner's guide to media queries - Learn web development
proach would be exactly the same. walkthrough: a simple mobile-first layout our starting point is an html document with some css applied to add background colors to the various parts of the layout. ...
.... this could be achieved using the following: <ul class="grid"> <li> <h2>card 1</h2> <p>...</p> </li> <li> <h2>card 2</h2> <p>...</p> </li> <li> <h2>card 3</h2> <p>...</p> </li> <li> <h2>card 4</h2> <p>...</p> </li> <li> <h2>card 5</h2> <p>...</p> </li> </ul> .grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); } .grid li { border: 1px solid #666; padding: 10px; } open the grid layout example in the browser, or view the source. with the example open in your browser, make the screen wider and narrower to see the number of column tracks change. the nice thing...
CSS layout - Learn web development
now it's time to look at how to place your boxes in the right place in relation to the viewport, and one another. we have covered the necessary prerequisites so we can now dive deep into css layout, looking at different display settings, modern layout tools like flexbox, css grid, and positioning, and some of the legacy techniques you might still want to know about. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. ...
...e a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started prerequisites before starting this module, you should already: have basic familiarity with html, as discussed in the introduction to html module. be comfortable with css fundamentals, as discussed in introduction to css. understand how to style boxes. note: if you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as jsbin or glitch. guides these articles will provide instruction on the fundamental layout tools and techniques available in css. at the end of the lessons is an assessment to help you ch...
What is a web server? - Learn web development
rver, and a search engine. objective: you will learn what a web server is and gain a general understanding of how it works. summary the term web server can refer to hardware or software, or both of them working together. on the hardware side, a web server is a computer that stores web server software and a website's component files. (for example, html documents, images, css stylesheets, and javascript files) a web server connects to the internet and supports physical data interchange with other devices connected to the web. on the software side, a web server includes several parts that control how web users access hosted files. at a minimum, this is an http server. an http server is software that understands urls (web addresses) and http (the protocol your browser uses t...
...age, your browser sends a request to the web server, which searches for the requested file in its own storage space. upon finding the file, the server reads it, processes it as-needed, and sends it to the browser. let's look at those steps in more detail. hosting files first, a web server has to store the website's files, namely all html documents and their related assets, including images, css stylesheets, javascript files, fonts, and video. technically, you could host all those files on your own computer, but it's far more convenient to store files all on a dedicated web server because: a dedicated web server is typically more available. (up and running) excusing downtime and systems troubles, a dedicated web server is always connected to the internet. a dedicated web server can have ...
Example 2 - Learn web development
"optlist hidden"> <li class="option">cherry</li> <li class="option">lemon</li> <li class="option">banana</li> <li class="option">strawberry</li> <li class="option">apple</li> </ul> </div> <form> css content .widget select, .no-widget .select { position : absolute; left : -5000em; height : 0; overflow : hidden; } /* --------------- */ /* required styles */ /* --------------- */ .select { position: relative; display : inline-block; } .select.active, .select:focus { box-shadow: 0 0 3px 1px #227755; outline: none; } .select .optlist { position: absolute; top : 100%; left : 0; } .select .optlist.hidden { max-height: 0; visibility: hidden; } /* ------------ */ /* fancy styles */ /* ------------ */ .select { font-size...
...er { content : "▼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; padding: 0; background: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); -moz-box-sizing : border-box; box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { padding: .2em .3em; } .select .h...
Example 3 - Learn web development
ptlist hidden"> <li class="option">cherry</li> <li class="option">lemon</li> <li class="option">banana</li> <li class="option">strawberry</li> <li class="option">apple</li> </ul> </div> </form> css content .widget select, .no-widget .select { position : absolute; left : -5000em; height : 0; overflow : hidden; } /* --------------- */ /* required styles */ /* --------------- */ .select { position: relative; display : inline-block; } .select.active, .select:focus { box-shadow: 0 0 3px 1px #227755; outline: none; } .select .optlist { position: absolute; top : 100%; left : 0; } .select .optlist.hidden { max-height: 0; visibility: hidden; } /* ------------ */ /* fancy styles */ /* ------------ */ .select { font-size...
...er { content : "▼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; padding: 0; background: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); -moz-box-sizing : border-box; box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { padding: .2em .3em; } .select .h...
Example 4 - Learn web development
ptlist hidden"> <li class="option">cherry</li> <li class="option">lemon</li> <li class="option">banana</li> <li class="option">strawberry</li> <li class="option">apple</li> </ul> </div> </form> css content .widget select, .no-widget .select { position : absolute; left : -5000em; height : 0; overflow : hidden; } /* --------------- */ /* required styles */ /* --------------- */ .select { position: relative; display : inline-block; } .select.active, .select:focus { box-shadow: 0 0 3px 1px #227755; outline: none; } .select .optlist { position: absolute; top : 100%; left : 0; } .select .optlist.hidden { max-height: 0; visibility: hidden; } /* ------------ */ /* fancy styles */ /* ------------ */ .select { font-size...
...er { content : "▼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; padding: 0; background: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); -moz-box-sizing : border-box; box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { padding: .2em .3em; } .select .h...
Example 5 - Learn web development
<li class="option" role="option">lemon</li> <li class="option" role="option">banana</li> <li class="option" role="option">strawberry</li> <li class="option" role="option">apple</li> </ul> </div> </form> css content .widget select, .no-widget .select { position : absolute; left : -5000em; height : 0; overflow : hidden; } /* --------------- */ /* required styles */ /* --------------- */ .select { position: relative; display : inline-block; } .select.active, .select:focus { box-shadow: 0 0 3px 1px #227755; outline: none; } .select .optlist { position: absolute; top : 100%; left : 0; } .select .optlist.hidden { max-height: 0; visibility: hidden; } /* ------------ */ /* fancy styles */ /* ------------ */ .select { font-size...
...er { content : "▼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; padding: 0; background: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); -moz-box-sizing : border-box; box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { padding: .2em .3em; } .select .h...
How to structure a web form - Learn web development
s widget with a <li> element within a <ul> or <ol> list. <p> and <div> elements are also commonly used. lists are recommended for structuring multiple checkboxes or radio buttons. in addition to the <fieldset> element, it's also common practice to use html titles (e.g. <h1>, <h2>) and sectioning (e.g. <section>) to structure complex forms. above all, it is up to you to find a comfortable coding style that results in accessible, usable forms. each separate section of functionality should be contained in a separate <section> element, with <fieldset> elements to contain radio buttons. active learning: building a form structure let's put these ideas into practice and build a slightly more involved form — a payment form. this form will contain a number of control types that you may not yet und...
...efully as you follow the below instructions, and start to form an appreciation of which wrapper elements we are using to structure the form, and why. to start with, make a local copy of our blank template file and the css for our payment form in a new directory on your computer. apply the css to the html by adding the following line inside the html <head>: <link href="payment-form.css" rel="stylesheet"> next, create your form by adding the outer <form> element: <form> </form> inside the <form> tags, add a heading and paragraph to inform users how required fields are marked: <h1>payment form</h1> <p>required fields are followed by <strong><abbr title="required">*</abbr></strong>.</p> next we'll add a larger section of code into the form, below our previous entry. here you'll ...
CSS property compatibility table for form controls - Learn web development
border and background background yes yes border-radius yes[1] yes[1] on opera the border-radius property is applied only if an explicit border is set. box-shadow no partial[1] ie9 does not support this property. number see the number input type. there is no standard way to change the style of spinners used to change the value of the field, with the spinners on safari being outside the field. property n t note css box model width yes yes height partial[1] partial[1] on opera, the spinners are zoomed in, which can hide the content of the field. border yes yes margin ...
...w n.a. n.a. text-transform n.a. n.a. border and background background no[1] no[1] supported, but there is too much inconsistency between browsers to be reliable. border-radius no[1] no[1] box-shadow no[1] no[1] range see the range input type. there is no standard way to change the style of the range grip and opera has no way to tweak the default rendering of the range widget. property n t note css box model width yes yes height partial[1] partial[1] chrome and opera add some extra space around the widget, whereas opera on windows 7 stretches the range grip. border no yes ...
Test your skills: Advanced styling - Learn web development
ample: download the starting point for this task to work in your own editor or in an online editor. advanced form styling 2 in our next task we provide you with a set of three radio buttons. we want you to give them custom styling. we've already provided you with a basic reset to build upon. first of all, get rid of their default styling. next, give the radio buttons a reasonable base style — the style they have when the page first loads. this can be anything you like, but you probably want to set a width and height (of somewhere between about 18 and 24 pixels), and a subtle border and/or background color. now give the radio buttons a different style for when they are selected. align the radio buttons nicely with the labels. try updating the live code below to recreate the fin...
... what we'd like you to do is make use of some advanced pseudo-classes to provide some useful indicators of validity. ...
Web forms — Working with user data - Learn web development
towards your goal. get started prerequisites before starting this module, you should at least work through our introduction to html. at this point you should find the introductory guides easy to understand, and also be able to make use of our basic native form controls guide. mastering forms however requires more than just html knowledge — you also need to learn some specific techniques to style form controls, and some scripting knowledge is required to handle things like validation and creating custom form controls. therefore, before you look at the other sections listed below we'd recommend that you go away and learn some css and javascript first. the above text is a good indicator as to why we've put web forms into its own standalone module, rather than trying to mix bits of it into ...
..., such as <select>, <textarea>, <meter>, and <progress>. form styling guides styling web forms this article provides an introduction to styling forms with css, including all the basics you might need to know for basic styling tasks. advanced form styling here we look at some more advanced form styling techniques that need to be used when trying to deal with some of the more difficult-to-style form elements. ui pseudo-classes an introduction to the ui pseudo-classes enabling html form controls to be targeted based on their current state. validating and submitting form data client-side form validation sending data is not enough — we also need to make sure that the data users enter into forms is in the correct format to process it successfully, and that it won't break our appli...
The web and web standards - Learn web development
ments you can wrap (mark up) content in to give it meaning (semantics) and structure. simple html looks like this: <h1>this is a top-level heading</h1> <p>this is a paragraph of text.</p> <img src="cat.jpg" alt="a picture of my cat"> if we adopted a house-building analogy, html would be like the foundations and walls of the house, which give it structure and hold it together. cascading style sheets (css) is a rule-based language used to apply styles to your html, for example setting text and background colors, adding borders, animating things, or laying out a page in a certain way. as a simple example, the following code would turn our html paragraph red: p { color: red; } in the house analogy, css is like the paint, wallpaper, carpets and paintings you'd use to make the house...
...nd colors, adding borders, animating things, or laying out a page in a certain way. as a simple example, the following code would turn our html paragraph red: p { color: red; } in the house analogy, css is like the paint, wallpaper, carpets and paintings you'd use to make the house look nice. javascript is the programming language we use to add interactivity to web sites, from dynamic style switching, to fetching updates from the server, right through to complex 3d graphics. the following simple javascript will store a reference to our paragraph in memory and change the text inside it: let pelem = document.queryselector('p'); pelem.textcontent = 'we changed the text!'; in the house analogy, javascript is like the cooker, tv, microwave, or hairdryer — the things that give your...
Getting started with the Web - Learn web development
web development. what will your website look like? before you start writing the code for your website, you should plan it first. what information are you showcasing? what fonts and colors are you using? what will your website look like? we outline a simple method you can follow to plan out your site's content and design. dealing with files a website consists of many files: text content, code, stylesheets, media content, and so on. when you're building a website, you need to assemble these files into a sensible structure and make sure they can talk to one another. dealing with files explains how to set up a sensible file structure for your website and what issues you should be aware of. html basics hypertext markup language (html) is the code that you use to structure your web content and ...
...re of. html basics hypertext markup language (html) is the code that you use to structure your web content and give it meaning and purpose. for example, is my content a set of paragraphs or a list of bullet points? do i have images inserted on my page? do i have a data table? without overwhelming you, html basics provides enough information to make you familiar with html. css basics cascading stylesheets (css) is the code that you use to style your website. for example, do you want the text to be black or red? where should content be drawn on the screen? what background images and colors should be used to decorate your website? css basics takes you through what you need to get started. javascript basics javascript is the programming language that you use to add interactive features to you...
Choosing the right approach - Learn web development
commendations and reminders of common pitfalls where appropriate. we'll probably add to this resource as time goes on. prerequisites: basic computer literacy, a reasonable understanding of javascript fundamentals. objective: to be able to make a sound choice of when to use different asynchronous programming techniques. asynchronous callbacks generally found in old-style apis, involves a function being passed into another function as a parameter, which is then invoked when an asynchronous operation has been completed, so that the callback can in turn do something with the result. this is the precursor to promises; it's not as efficient or flexible. use only when necessary. useful for... single delayed operation repeating operation multiple sequen...
...if you need to run your animation at a slower framerate, you'll need to use setinterval() or recursive settimeout(). browser compatibility desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome...
Image gallery - Learn web development
o and grab the zip file for the example, unzip it somewhere on your computer, and do the exercise locally to begin with. alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html, css and javascript into one of these online editors. if the online editor you are using doesn't have separate javascript/css panels, feel free to put them inline <script>/<style> elements inside the html page. note: if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. project brief you have been provided with some html, css and image assets and a few lines of javascript code; you need to write the necessary javascript to turn this into a working program. the html body looks like this: <h1>image gallery ex...
...d the background-color of the overlay <div> to "rgba(0,0,0,0.5)". if the class name not "dark", changes the <button> class to "dark", its text content back to "darken", and the background-color of the overlay <div> to "rgba(0,0,0,0)". the following lines provide a basis for achieving the changes stipulated in points 2 and 3 above. btn.setattribute('class', xxx); btn.textcontent = xxx; overlay.style.backgroundcolor = xxx; hints and tips you don't need to edit the html or css in any way. assessment or further help if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should i...
Introduction to web APIs - Learn web development
ndex page. common browser apis in particular, the most common categories of browser apis you'll use (and which we'll cover in this module in greater detail) are: apis for manipulating documents loaded into the browser. the most obvious example is the dom (document object model) api, which allows you to manipulate html and css — creating, removing and changing html, dynamically applying new styles to your page, etc. every time you see a popup window appear on a page or some new content displayed, for example, that's the dom in action. find out more about these types of api in manipulating documents. apis that fetch data from the server to update small sections of a webpage on their own are very commonly used. this seemingly small detail has had a huge impact on the performance and behavi...
... they use events to handle changes in state we already discussed events earlier on in the course in our introduction to events article, which looks in detail at what client-side web events are and how they are used in...
Silly story generator - Learn web development
objective: to test comprehension of javascript fundamentals, such as variables, numbers, operators, strings, and arrays. starting point to get this assessment started, you should: go and grab the html file for the example, save a local copy of it as index.html in a new directory somewhere on your computer, and do the assessment locally to begin with. this also has the css to style the example contained within it. go to the page containing the raw text and keep this open in a separate browser tab somewhere. you'll need it later. alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html, css and javascript into one of these online editors. if the online editor you are using doesn't have a separate javascript panel, feel free ...
...applied to your html properly, try removing everything else from the javascript file temporarily, adding in a simple bit of javascript that you know will create an obvious effect, then saving and refreshing. the following for example turns the background of the <html> element red — so the entire browser window should go red if the javascript is applied properly: document.queryselector('html').style.backgroundcolor = 'red'; math.round() is a built-in javascript method that simply rounds the result of a calculation to the nearest whole number. there are three instances of strings that need to be replaced. you may repeat the replace() method multiple times, or you can use regular expressions. for instance, let text = 'i am the biggest lover, i love my love'; text.replace(/love/g,'like'); w...
Aprender y obtener ayuda - Learn web development
igh-level layout — header, horizontal navigation menu, main content area with main and side columns, and footer. implement a horizontal navigation menu etc. then you could break it down further, for example, "implement horizontal navigation menu" could be written out as: make a list of menu items sit horizontally in a line. remove unneeded defaults, like list spacing and bullet points. style hover/focus/active states of menu items appropriately. make the menu items equally spaced along the line. give the menu items enough vertical spacing. make sure the text is centered inside each menu item etc. each of these problems doesn't seem nearly as difficult to solve as the one big problem you had initially. now you've just got to go through and solve them all! learn and recognise th...
... if you are a complete beginner to web development, you'll have to do some study and web searches and lookup solutions to such problems. if you are a professional web developer you'll probably remember the last time you solved a similar problem, and only have to look up a few bits of the syntax that you forgot since then. when you find solutions to such problems...
Perceived performance - Learn web development
e weight of all your assets hasn't improved -- in fact, you may need to add some code -- but because the download of non-immediately necessary assets are delayed in a manner that is not perceptible the the user, the user will feel like the download was faster. to minimize the assets required for initial load, separate interactive functionality from content so that required content -- the text, styles, and images visible at initial load -- can be loaded first. delay, or lazy load, the rest of the assets. don't load images or scripts that aren’t used or visible on the initial page load. either delay their load, loading them when the page becomes usable, or, loading them when they become necessary. loading additional assets and resources after initial page load improves perceived performance...
...ump or resize, especially after the site has become interactive. avoid font file delays font use can both help and harm user experience. selecting the right fonts is an art form, and can greatly improve the user experience. fonts can also harm user experience, especially if the fonts used need to be imported, and if the importing is not optimal, or if comic sans is used (kidding). flicker of unstyled text and missing text both harm performance. make fallback fonts the same size and weight so that when fonts load the page change is less noticeable. interactive elements are interactive make sure visible interactive elements are always interactive and responsive. if input elements are visible, the user should be able to interact with them without a lag. users feel that something is laggy whe...
Web performance - Learn web development
er experience. this article outlines some javascript best practices that should be considered to ensure even complex content is as performant as possible. html performance features some attributes and the source order of your mark-up can impact the performance or your website. by minimizing the number of dom nodes, making sure the best order and attributes are used for including content such as styles, scripts, media, and third-party scripts, you can drastically improve the user experience. this article looks in detail at how html can be used to ensure maximum performance. css performance features css may be a less important optimization focus for improved performance, but there are some css features that impact performance more than others. in this article we look at some css properties th...
...rastically improve the user experience. this article looks in detail at how html can be used to ensure maximum performance. css performance features css may be a less important optimization focus for improved performance, but there are some css features that impact performance more than others. in this article we look at some css properties that impact performance and suggested ways of handling styles to ensure performance is not negatively impacted. fonts and performance a look at whether you need to include external fonts and, if you do, how to include the fonts your design requires with the least impact on your sites performance. mobile performance with web access on mobile devices being so popular, and all mobile platforms having fully-fledged web browsers, but possibly limited ba...
Dynamic behavior in Svelte: working with variables and props - Learn web development
in this article we'll be using variables and props to make our app dynamic, allowing us to add and delete todos, mark them as complete, and filter them by status. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. you'll need a terminal with node + npm installed to compile and build your app. ...
...ed'} aria-pressed={filter === 'completed'} on:click={()=> filter = 'completed'} > <span class="visually-hidden">show</span> <span>completed</span> <span class="visually-hidden">tasks</span> </button> </div> there are a couple of things going on in this markup. we will show the current filter by applying the btn__primary class to the active filter button. to conditionally apply style classes to an element we use the class:name={value} directive. if the value expression evaluates to truthy, the class name will be applied. you can add many of these directives, with different conditions, to the same element. so when we issue class:btn__primary={filter === 'all'}, svelte will apply the btn__primary class if filter equals all. note: svelte provides a shortcut which allows us...
Vue conditional rendering: editing existing todos - Learn web development
type: string, required: true }, id: { type: string, required: true } }, data() { return { newlabel: this.label }; }, methods: { onsubmit() { if (this.newlabel && this.newlabel !== this.label) { this.$emit("item-edited", this.newlabel); } }, oncancel() { this.$emit("edit-cancelled"); } } }; </script> <style scoped> .edit-label { font-family: arial, sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; color: #0b0c0c; display: block; margin-bottom: 5px; } input { display: inline-block; margin-top: 0.4rem; width: 100%; min-height: 4.4rem; padding: 0.4rem 0.8rem; border: 2px solid #565656; } form { display: flex; flex-direction: row; flex-wra...
...this is a useful way to help reinforce everything you've learned so far. this code sets up the core of the edit functionality. we create a form with an <input> field for editing the name of our to-do. there is a "save" button and a "cancel" button...
Handling common JavaScript problems - Learn web development
but for both css and javascript, it is probably better to use an established feature detection library rather than writing your own all the time. modernizr is the industry standard for feature detection tests. as a last point, don't confuse feature detection with browser sniffing (detecting what specific browser is accessing the site) — ...
... like the following: if("geolocation" in navigator) { navigator.geolocation.getcurrentposition(function(position) { // show the location on a map, perhaps using the google maps api }); } else { // give the user a choice of static maps instead perhaps } you could also write such a test for a css feature, for example by testing for the existence of element.style.property (e.g. paragraph.style.transform !== undefined). but for both css and javascript, it is probably better to use an established feature detection library rather than writing your own all the time. modernizr is the industry standard for feature detection tests. as a last point, don't confuse feature detection with browser sniffing (detecting what specific browser is accessing the site) — this is a terrible practice tha...
Client-side tooling overview - Learn web development
e from scratch each time. a few very common safety net tool types you will find being used by developers are as follows. linters linters are tools that check through your code and tell you about any errors that are present, what error types they are, and what code lines they are present on. often linters can be configured to not only report errors, but also report any violations of a specified style guide that you team might be using (for example code that is using the wrong number of spaces for indentation, or using template literals rather than regular string literals). eslint is the industry standard javascript linter — a highly configurable tool for catching potential syntax errors and encouraging "best practices" throughout your code. some companies and projects have also shared thei...
...own server instance, or use a hosted source control website such as github, gitlab, or bitbucket. we'll be using github in this module. you can find more information about it at git and github. code formatters code formatters are somewhat related to linters, except that rather than point out errors in your code, they usually tend to make sure your code is formatted correctly, according to your style rules, ideally automatically fixing errors that they find. prettier is a very popular example of a code formatter, which we’ll make use of later on in the module. bundlers/packagers these are tools that get your code ready for production, for example by “tree-shaking” to make sure only the parts of your code libraries that you are actually using are put into your final production code, o...
Chrome Worker Modules
opened through require(). any value you define in that file is private by default. ...
...if you do, know that any call to module.exports will overwrite all calls to `exports.foo = bar. you should not modify exports or module.exports once your module initialization is complete. the module loader supports cyclic calls to require(). however, if you have cyclic requirements, some of the modules involved in the cyclic requirements may be...
Accessibility Features in Firefox
p. mozilla can follow the system appearance whether it's high or low contrast, with large or small fonts. text files used in configuration (techies only): configuration files are easily edited with any text editor. for example, prefs.js gives access to a large number of configuration options not available in the preferences window. also, usercontent.css allows users knowledgeable about cascading style sheets to customize the appearance of all pages that are displayed. finally, bookmarks.html contains all your bookmarks, and is easy to move around from computer to computer. view selection source (techies only): when you select some text and right click or press shift+f10, you can "view selection source". this will show the html source for only the selected text, which is useful for understandi...
...xamples of accessible extensions, although there are hundreds more to try (thank you to the gw micro knowledge base for some of this information): adblock plus removes ads (and other objects, like banners) from web pages greasemonkey lets you add bits of javascript ("user scripts") to any web page to change its behavior. in much the same way that user css lets you take control of a web page's style, user scripts let you easily control any aspect of a web page's design or interaction. we expect enterprising script writers will eventually fix annoying accessibility issues in popular web pages, and (hopefully) share their tricks with everyone! fire vox extension by charles l. chen is a screen reader extension built just for firefox which can read mathml community contributions the real rea...
Embedding API for Accessibility
it's a w3c uaag requirement */ setboolpref("browser.selection.use_system_colors", usesystemcolors); no content waiting alerts setcharpref("alert.audio.mail_waiting", pathtosoundfile); setcharpref("alert.audi...
...ity settings per url a powerful possibility is that we design an interface for setting certain preferences based on the url. if we can find a clean way to present it to the user, this would be extremely useful. for example, settings per url would allow a user to accept scripts from their known benign web pages, but not others. users may want similarity abilities with applets, background images, style sheets, etc. we have a permissions system for cookies and images based on url's. perhaps it can be extended to store accessibility preferences. this is a ui issue we'll need to settle before we know where to go with the embedding accessibility interface. ...
Cookies Preferences in Mozilla
new in thunderbird 3 this preference is applicable to thunderbird 3 and later. earlier versions of thunderbird only allowed cookies on rss feeds. network.cookie.prefsmigrated default value: false migration pref for users with older profiles (before mozilla 1.7). if you have the old-sty...
...yle uris false = allow cookies in these situations this preference is applicable to all versions of seamonkey. new in thunderbird 3 this preference is applicable to thunderbird 3 and later. earlier versions of thunderbird only allowed cookies on rss feeds. network.cookie.prefsmigrated default value: false migration pref for users with older profiles (before mozilla 1.7). if you have the old-style prefs, they will be migrated when starting the application. (the old prefs are network.cookie.lifetime.enabled, network.cookie.lifetime.behavior, and network.cookie.warnaboutcookies.) true = prefs have been migrated false = migrate prefs on next startup original document information author(s): mike connor last updated date: may 22, 2004 copyright information: portions of this content are...
Debugging Table Reflow
table_strategy editor's note: the following examples are not shown correctly due to the wiki's technical constraint. ...
...at this step the final size is 360 twips. min_con des_con fix min_adj des_adj fix_adj pct pct_adj min_pro final 360 540 1230 -1 -1 -1 -1 -1 -1 360 there was no change till the entrance of balancecolumnwidths balancecolumnwidths en count=1 ***start table dump*** mcolwidths=360 360 360 360 col frame cache -> 0=00b93138 1=00b931f0 2=024dd7...
pymake
/c/foo/bar) path. ...
...does, your pymake alias is connected and you are ready to type in pymake -f client.mk to start the build. unlike gmake on windows, pymake is capable of doing parallel builds, so you can set a moz_make_flags=-jn in your .mozconfig without risk of deadlocks. note: on windows, if using an absolute path moz_objdir in your .mozconfig, it must be a windows-style (i.e. c:/foo/bar) rather than an msys-style (i.e. /c/foo/bar) path. ...
Gecko Logging
h" static mozilla::lazylogmodule sfoolog("foo"); logging interface a basic interface is provided in the form of 2 macros and an enum class. mozilla logging macros moz_log(module, level, message) outputs the given message if the module has the given log level enabled. module - the log module to use. level - the log level of the message. message - a printf-style message to output. must be enclosed in parentheses. moz_log_test(module, level) checks if the module has the given level enabled. module - the log module to use. level - the output level of the message. log level numeric value purpose mozilla logging levels disabled 0 indicates logging is disabled. this s...
...e to gecko, and rust crates typically use a different approach to logging. many rust libraries use the log crate to log messages, which works together with env_logger at the application level to control what's actually printed via rust_log. you can set an overall logging level, though it could be quite verbose: set rust_log="debug" you can also target individual modules by path: set rust_log="style::style_resolver=debug" for linux/macos users, you need to use export rather than set. if you're only interested in the content process you can use rust_log_child rather than rust_log. the log crate lists the available log levels: log level purpose rust logging levels error designates very serious errors. warn designates hazardous situations. ...
Using the Browser API
Mozilla › Gecko › Chrome › API › Browser API › Using
htmliframeelement.getcangoback() and htmliframeelement.getcangoforward(), which return a boolean defining whether backward/forward navigation is possible at this point in the history. if true is returned, the relevant button is disabled, and if false is returned, the relevant button is enabled. note that promise versions of browser api dom request methods also exist, so you can use async promise style syntax if you so wish. for example: function canmovebwd() { browser.getcangoback().then(function(result) { if (result) { back.disabled = false; console.log("it's possible to navigate the history backward."); } else { back.disabled = true; console.log("it's not possible to navigate the history backward."); } }); } implementing the url bar the url bar for ...
...he page is loading (each with a different icon displayed). this is implemented in our sample app with the following functions: browser.addeventlistener('mozbrowserloadstart',function() { stopreload.textcontent = 'x'; }); browser.addeventlistener('mozbrowserloadend',function(e) { canmovebwd(); canmovefwd(); stopreload.textcontent = 'r'; console.log(e.detail.backgroundcolor); controls.style.background = e.detail.backgroundcolor; }); when the mozbrowserloadstart event fires, the latest page request has started loading, and we change the button to a cross to indicate "stop". when the mozbrowserloadend event fires, the latest page request has finished loading, and at this point we want to change the icon back to the reload icon (in this case we are just using a capital "r"). notice th...
CSS -moz-bool-pref() @supports function
html <div id="pref-test"> this will have a green background if the <code>test</code> preference is enabled. ...
... html <div id="pref-test"> this will have a green background if the <code>test</code> preference is enabled. ...
::-moz-tree-image
activated by the properties attribute. ...
... activated by the properties attribute. ...
::-moz-tree-column
activated by the properties attribute. ...
... activated by the properties attribute. ...
::-moz-tree-twisty
activated by the properties attribute. ...
... activated by the properties attribute. ...
MozBeforePaint
is intentional, because modern operating systems and hardware won't let the browser display more frames than that anyway. limiting the frame rate avoids wasting work, thereby saving cpu usage and power and improving overall system performance. example this example performs a simple animation, moving a box a short distance after a short period of time. ...
...ormance. example this example performs a simple animation, moving a box a short distance after a short period of time. <!doctype html> <html> <body> <div id="d" style="width:100px; height:100px; background:lime; position:relative;"></div> <script> var d = document.getelementbyid("d"); var start = window.mozanimationstarttime; function step(event) { var progress = event.timestamp - start; d.style.left = math.min(progress/10, 200) + "px"; if (progress < 2000) { window.mozrequestanimationframe(); } else { window.removeeventlistener("mozbeforepaint", step, false); } } window.addeventlistener("mozbeforepaint", step, false); window.mozrequestanimationframe(); </script> </body> </html> as you can see, each time the mozbeforepaint event fires, our step() method is called. this co...
HTML parser threading
d to the parser-thread tokenizer. likewise for the tree builders. the "last was carriage return" flag is copied over also. a runnable is dispatched to the parser thread to call to mark the parser uninterrupted and to call nshtml5streamparser::parseavailabledata() on the parser thread. mtokenizermutex is released. speculative loads when the tree builder on the parser thread encounters html script, stylesheet link, video (with a poster frame), base or img or svg script, style or image elements, preload operations are appended to a speculative load queue. there speculative load operations are flushed to the main thread (via the staging area) whenever tree ops are flushed and also whenever nshtml5streamparser::parseavailabledata() is about to stop working. that is, when the parser thread is parsing...
...ree builder synchronously also sends speculative loads to the tree op executor. the executor acts on the speculative load queue when the runnable dispatched by nshtml5streamparser::parseavailabledata() fires and right before executing tree ops whenever tree ops are executed. when the executor acts on speculative loads, it starts speculative http fetches for images (including video poster frames), style sheets and scripts. additionally, the speculative load queue is used for transferring information from the parser thread to the main thread when the information needs to arrive before starting any speculative loads and when the information is known not to be speculative. there are two such pieces of information: the manifest url for an app cache manifest and the character encoding for the documen...
How to implement a custom autocomplete search component
.length; }, /** * @return {string} the value of the result at the given index */ getvalueat: function(index) { return this._results[index]; }, /** * @return {string} the comment of the result at the given index */ getcommentat: function(index) { if (this._comments) return this._comments[index]; else return ''; }, /** * @return {string} the style hint for the result at the given index */ getstyleat: function(index) { if (!this._comments || !this._comments[index]) return null; // not a category label, so no special styling if (index == 0) return 'suggestfirst'; // category label on first line of results return 'suggesthint'; // category label on any other line of results }, /** * gets the image fo...
... }, /** * the number of matches */ get matchcount() { return this._results.length; }, /** * get the value of the result at the given index */ getvalueat: function(index) { return this._results[index]; }, /** * get the comment of the result at the given index */ getcommentat: function(index) { return this._comments[index]; }, /** * get the style hint for the result at the given index */ getstyleat: function(index) { if (!this._comments[index]) return null; // not a category label, so no special styling if (index == 0) return "suggestfirst"; // category label on first line of results return "suggesthint"; // category label on any other line of results }, /** * get the image for the result at the ...
Application Translation with Mercurial
. for this reason, updating patches kann be necessary so mercurial is still able to find the lines in the files which it has to replace or where it has to add them. mercurial queues allow to revert changes and also pull changes and reapply your local changes. go back to the localization directory: cd /c/mozilla/de-mozilla-aurora initiate mercurial queues: hg qinit get to know the translation style for having good chances that the translation suggestions get accepted, they should match the translation style of the texts in the application already translated. in general, the labels in the applications should have the same style like the operating system, e.g. use the same order of subject, verb and objects; decline verbs or not like the operating system does. the following resources can he...
...he translation suggestions get accepted, they should match the translation style of the texts in the application already translated. in general, the labels in the applications should have the same style like the operating system, e.g. use the same order of subject, verb and objects; decline verbs or not like the operating system does. the following resources can help figuring out the translation style and translate according to them: check your localization team's page by clicking on the team with your language code (e.g. "de" for german) for a style guide (e.g. style guide for german). transvision offers searching for texts and text ids ("entities" or "keys"), allowing to quickly find translations for already translated texts. microsoft's terminology search allows fast lookups of localiz...
Creating localizable web applications
><?= printf(_("if you are interested in supporting the approval process by becoming an approver, please email <a href=\"mailto:%1$s\">%1$s</a>."), 'personas@mozilla.com')?> </p> the same goes for variables that are unknown until the code is interpreted. localizers should have a possibility to adapt the order of the sentence (including the variable part) to the grammar and preferred style used in their language. consider the following example. snippet 6. bad: <p class="added"><?= _("<strong>added:</strong>") . $persona['date']; ?></p> snippet 7. good: <p class="added"><? printf( /* l10n: %s is a date */ _("<strong>added:</strong> %s"), $persona['date']);?></p> in snippet 6 the concatenation causes the ordering of the sentence to be fixed, while some grammars might require, fo...
...printf (_("did you know you can test a persona before you submit it? <b><a href=\"%s\">find out how!</a>&raquo;</b>"), $locale_conf->url('/demo_create_3#test'));?> </div> notice that the icon has been moved to css, so that it doesn't sit in a <img/> element. this is generally considered a good practice for decorative graphics. don't use images as buttons instead, use <button/> and style it with css. image 1. bad: snippet 1. good: css: .button { font-weight: bold; color: #0077a6; font-family: arial, sans-serif; border: none; background: none; cursor: pointer; overflow: visible; width: auto; height: 30px; text-decoration: none; vertical-align: middle; } .button span { background: #fff url(../img/main-sprites.png) no-repeat scr...
Fonts for Mozilla's MathML engine
athematical alphabetic symbols. if you are likely to need these characters, we recommend to install the xits or amiri fonts. installation without administrator privilege if you need to install fonts on a system without adminstrator privilege, the easiest option is to use math font the mathml-fonts add-on. note that using the add-on is not optimal since it forces your gecko browser to load a css stylesheet on each page you visit as well as web math fonts on all pages with mathml content. a better alternative on unix systems is to install the otf files for latin modern math and stix into some local font folder and (if necessary) to run fc-cache on it. on os x and linux, the standard paths are ~/library/fonts/ and ~/.fonts. fonts with a math table you can actually render mathml using any font ...
...see the authoring mathml page for details and try the mathml torture test. you can use fontforge and fonttools to edit the math table and create your own mathematical fonts. ...
Mozilla MathML Status
implemented. see bug 534962. altimg, altimg-width, altimg-height, altimg-valign, alttext accepted, but do not have any effect on the rendering. mathml is always enabled since bug 660762. cdgroup accepted, but does not have any effect on the rendering. attributes shared by all mathml elements see § 2.1.6 and § 3.1.10. attribute notes id, class, style implemented. xref accepted, but does not have any effect on the rendering. href implemented. the user interface works correctly in seamonkey but not in firefox. see bug 958957. mathcolor implemented. mathbackground implemented. token elements element [- attribute] notes mi implemented. the mathvariant attribute is f...
...entation attributes not implemented. see bug 534962. mtext implemented. mspace implemented. mspace - linebreak not implemented. see bug 534962. ms implemented. general layout schemata element notes mrow implemented. mfrac implemented. msqrt implemented. mroot implemented. mstyle implemented. we are only interested in supporting attributes "inherited from the surrounding context", which are those effectively used in practice. see bug 838509. merror implemented. mpadded implemented. mphantom implemented. mfenced implemented. menclose implemented. script and limit schemata element [- attribute] ...
BloatView
0976 nsstr 20 6261600 3781900 1120920 1791340 12955760 222760 48760 13280 76160 360960 nshashkey 8 610568 1842400 2457872 1134592 6045432 32000 536 568 1216 34320 nstexttransformer 548 8220 469088 1414936 1532756 3425000 0 0 0 0 0 nsstylecontextdata 736 259808 325312 489440 338560 1413120 141312 220800 -11040 94944 446016 nslinelayout 1100 2200 225500 402600 562100 1192400 0 0 0 0 0 nslocalfile 424 558832 19928 1696 1272 581728 72080 1272 424 -424 73352 the first set of columns, bytes a...
...n/bloatlogs/all-1999-10-22-133450.txt previous file: dist/win32_d.obj/bin/bloatlogs/all-1999-10-16-010302.txt -------------------------------------------------------------------------- class leaks delta bloat delta -------------------------------------------------------------------------- total 6113530 2.79% 67064808 9.18% stylecontextimpl 265440 81.19% 283584 -26.99% ctoken 236500 17.32% 306676 20.64% nsstr 217760 14.94% 5817060 7.63% nsxulattribute 113048 -70.92% 113568 -71.16% literalimpl 53280 26.62% 75840 19.40% nsxulelement 51648 0.00% 51648 0.00...
Preference reference
der mode in firefox mobile is only enabled if the memory is greater than 384mb.ui.alertnotificationoriginui.alertnotificationorigin controls the position and direction from which popup notifications invoked by nsialertsservice are sliding in.ui.spellcheckerunderlineui.spellcheckerunderline holds the colour which is used to underline words not recognized by the spellchecker.ui.spellcheckerunderlinestyleui.spellcheckerunderlinestyle holds the style which is used to underline words not recognized by the spellchecker.ui.textselectbackgroundui.textselectbackground saves the color in which the background of a text selection in the user interface or in content will be styled.ui.textselectforegroundui.textselectforeground saves the color in which the text of a text selection in the user interface or th...
...erlinestyle holds the style which is used to underline words not recognized by the spellchecker.ui.textselectbackgroundui.textselectbackground saves the color in which the background of a text selection in the user interface or in content will be styled.ui.textselectforegroundui.textselectforeground saves the color in which the text of a text selection in the user interface or the content will be styled.ui.tooltipdelayui.tooltipdelay stores the delay in milliseconds between the mouse stopping over an element and the appearing of its tooltip.view_source.syntax_highlightthe preference view_source.syntax_highlight controls whether markup in the view source view is syntax highlighted. ...
Introduction to NSPR
le source code base on macintosh (ppc), win32 (nt 3.51, nt 4.0, win'95), and over twenty versions of unix. nspr does not provide a platform for porting existing code. it must be used from the beginning of a software project. ...
...es not provide a platform for porting existing code. it must be used from the beginning of a software project. nspr naming conventions naming of nspr types, functions, and macros follows the following conventions: types exported by nspr begin with pr and are followed by intercap-style declarations, like this: print, prfiledesc function definitions begin with pr_ and are followed by intercap-style declarations, like this: pr_read, pr_jointhread preprocessor macros begin with the letters pr and are followed by all uppercase characters separated with the underscore character (_), like this: pr_bytes_per_short, pr_extern nspr threads nspr provides an execution environment that promotes the use of lightweight threads. each thread is an execution entity that is scheduled independently from ...
NSS API Guidelines
sfoo_verifypointer(arg1) ) return (rv *)null; if( !nssbar_verifypointer(arg2) ) return (rv *)null; #endif /* debug */ return nsstype_method(t, arg1, arg2); } aside from error cases, all documented entry points should check pointers in a debug, wherever possible. pointers to user-supplied buffers, and templates, should be checked against null. pointers to context-style functions should be checked using special debug macros. these macros only define code when debug is turned on, providing a way for systems to register, deregister, and check valid pointers. secport_decl_ptr_class(classname, size) - declare a class of pointers (labelled classname) this object file needs to check. this class is local only to this object file. size is the expected number of pointer...
...n the case of removal, the search can either be either restarted, or terminated. this method is a more complicated than the other methods: requiring the calling of search code tolerant to often repeated element inspection. examples of the previous strategies can be found in security/nss/lib/pk11wrap/pk11slot.c. where possible use the nspr list primitives. from these you can even set up secutil style thread-safe lists that use some combination of the above strategies. in order to be fully thread safe, your code must understand the semantics of the service functions it calls, and whether they are thread safe. for now, we should internally document which service functions we call, and how we expect them to behave in a threaded environment. finally, from an api point of view, we should examine...
Secure Development Guidelines
bb...
...n is confusing because the size argument is the maximum number of bytes being appended, not the size of the buffer. this can lead to security bugs. pl_strncpyz this function copies a string and guarantees null termination. pl_strcatn the size argument for this function is the size of the buffer and it guarantees zero termination. ...
Generating GUIDs
rname.addons.mozilla.org should be fine; no one will care. remember, these are identifiers, not e-mail addresses, and they're never resolved. canonical form the common form of a guid is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where each x stands for a hexadecimal digit. there are a number of tools that can be used to generate a guid in the canonical form. note: if you do choose to use an email-style id for your add-on, you probably don't want it to be a real email address, since it might attract spam. online tools generate guid online uuid (guid) generator on the web uuid generator for mozilla code (both idl and c++.h forms) you can get a guid from one of the bots (such as botbot, firebot) on #firefox irc channel by /msging "uuid" to them. windows windows users can use the guidgen...
...t, firebot) on #firefox irc channel by /msging "uuid" to them. windows windows users can use the guidgen tool from microsoft to obtain a guid. (this tool is also part of ms visual c++) linux use /usr/bin/uuidgen. this can be found in package uuid-runtime (debian). mac os x use /usr/bin/uuidgen. perl jkeiser's mozilla tools include a uuid generator with output format of both c++ and idl style. sfink's update-uuids will change the uuid for a given interface and all of its descendants, updating all *.idl files within a directory tree. nsiuuidgenerator a uuid can be generated from privileged mozilla code using nsiuuidgenerator. see the linked page for details. com/xpcom format when #define-ing iids and cids in mozilla c++ code, you generally use the following format: // xxxxxxxx-x...
nsIBinaryInputStream
t read alength bytes. readbytes() reads an opaque byte array from the stream. void readbytes( in pruint32 alength, [size_is(alength), retval] out string astring ); parameters alength the number of bytes to read. astring a string containing the bytes read from the stream. exceptions thrown ns_error_failure if it can't read alength bytes. readcstring() reads an 8-bit pascal style string from the stream. 32-bit length field, followed by length 8-bit chars. acstring readcstring(); parameters none. return value the string read from the stream. readdouble() reads from the stream. double readdouble(); parameters none. return value a double read from the stream. readfloat() reads from the stream. float readfloat(); parameters none. return value a float rea...
... length 8-bit chars. acstring readcstring(); parameters none. return value the string read from the stream. readdouble() reads from the stream. double readdouble(); parameters none. return value a double read from the stream. readfloat() reads from the stream. float readfloat(); parameters none. return value a float read from the stream. readstring() reads an 16-bit pascal style string from the stream. 32-bit length field, followed by length prunichars. astring readstring(); parameters none. return value the string read from the stream. setinputstream() void setinputstream( in nsiinputstream ainputstream ); parameters ainputstream the stream from which to read. see also nsibinaryoutputstream nsiinputstream nsioutputstream ...
nsIBinaryOutputStream
ite to the stream. writedouble() writes a double precision floating point number to the stream. void writedouble( in double adouble ); parameters adouble the double to write to the stream. writefloat() writes a floating point number to the stream. void writefloat( in float afloat ); parameters afloat the floating point value to write to the stream. writestringz() writes an 8-bit pascal style string to the stream. the output data consists of a 32-bit length field, followed by that many 8-bit characters. void writestringz( in string astring ); parameters astring the string to write to the stream. writeutf8z() writes an 8-bit pascal style string (utf8-encoded) to the stream. the output data consists of a 32-bit length field, followed by that many 8-bit characters. void writeutf8z( ...
...the output data consists of a 32-bit length field, followed by that many prunichars. ...
Building an Account Manager Extension
package. this means the xul file for the new panel has to be located in chrome://example@mozilla.org/content/am-devmo-account.xul. and the property file needs to be in chrome://example@mozilla.org/locale/am-devmo-account.properties. the xul file needs a page element as root element, with a special on load command. ...
..., with a special on load command. furthermore you should include the accountmanager.js script and accountmanage.css styles. it is common practice to use for the javascript of the new panel, the same naming as used for the xul. this means in our example, the javascript file should be located in chrome://example@mozilla.org/content/am-devmo-account.js. ...
nsIXPConnect
deals with cases where the passed in jsobject already has an associated xpcom interface for the cases: 1) the jsobject has already been wrapped as an nsixpconnectwrappedjs. 2) the jsobject is in fact an nsixpconnectwrappednative and thus already has an underlying xpcom object. 3) the jsobject is of a jsclass which supports getting the nsisupports from the jsobject directly. this is used for idlc style objects (e.g., dom objects). it *might* be possible to queryinterface the resulting interface pointer to nsixpconnectwrappedjs. returns: success: ns_ok failure: ns_error_xpc_bad_convert_js ns_error_failure. void wrapjs( in jscontextptr ajscontext, in jsobjectptr ajsobj, in nsiidref aiid, [iid_is(aiid),retval] out nsqiresult result ); parameters ajscontext missing description ajs...
...his method now correctly deals with cases where the passed in xpcom object already has an associated jsobject for the cases: 1) the xpcom object has already been wrapped for use in the same scope as an nsixpconnectwrappednative. 2) the xpcom object is in fact an nsixpconnectwrappedjs and thus already has an underlying jsobject. 3) the xpcom object implements nsiscriptobjectowner; i.e., is an idlc style dom object for which we can call getscriptobject to get the jsobject it uses to represent itself into javascript. it *might* be possible to queryinterface the nsixpconnectjsobjectholder returned by the method into an nsixpconnectwrappednative or an nsixpconnectwrappedjs. this method will never wrap the jsobject involved in an xpcnativewrapper before returning. returns: success: ns_ok failure: ...
nsIXSLTException
read only. ...
...read only. ...
Reference Manual
or deleted. nscomptr<nsifoo> foo = ...; foo->addref(); // error: |addref| is private delete foo.get(); // error: |operator delete| is private ns_release(foo); // error: |release| is private of course, the most important safety feature provided by nscomptr is that it addrefs and releases automatically at the appropriate times. ...
...omptr<nsifoo> foo = ...; foo->addref(); // error: |addref| is private delete foo.get(); // error: |operator delete| is private ns_release(foo); // error: |release| is private of course, the most important safety feature provided by nscomptr is that it addrefs and releases automatically at the appropriate times. casting never use old-style c/c++ casts on an nscomptr. an old-style cast is guaranteed to compile, even if it can't do the right thing. old-style casts degenerate into the equivalent of reinterpret_cast if no conversion is defined. such a cast can easily by-pass nscomptrs machinery, causing leaks, type mismatches, and other calamities. // old-style c/c++ casts by-pass |nscomptr|s machinery and cause leaks... nsresult rv; nscomptr<nsifo...
Using popup notifications
at is, actions provided to the user through the drop-down menu. this notification looks like this: that's not very pretty; where's the icon? adding an icon to your notification adding an icon to a notification is simple. you just need to provide the appropriate css. the popupnotifications.jsm code module adds a popupid attribute to the notification object's icon element. ...
...ks like this: that's not very pretty; where's the icon? adding an icon to your notification adding an icon to a notification is simple. you just need to provide the appropriate css. the popupnotifications.jsm code module adds a popupid attribute to the notification object's icon element. ...
Type conversion
boolean type target type source converted value ctype.bool js value toboolean(src) console.log(ctypes.bool("123").tostring()); // 'ctypes.bool(true)' console.log(ctypes.bool("").tostring()); // 'ctypes.bool(false)' integer types target type source converted value any integer types js number except -infinity, infinity, nan c-style cast -infinity 0 infinity nan ctypes.int64 c-style cast ctypes.uint64 js string with base-10 or base-16 string (only if fits to the size) parse src as base-10 or base-16 string console.log(ctypes.int32_t(infinity).tostring()); // 'ctypes.int32_t(0)' console.log(ctypes.int32_t("0xff").tostring())); // 'ctype...
... console.log(ctypes.int32_t(infinity).tostring()); // 'ctypes.int32_t(0)' console.log(ctypes.int32_t("0xff").tostring())); // 'ctypes.int32_t(255)' console.log(ctypes.int32_t(ctypes.int64(10)).tostring()); // 'ctypes.int32_t(10)' pointer types target type source converted value any pointer types js number (only if fits to the pointer size) c-style cast ctypes.int64 (only if fits to the pointer size) c-style cast console.log(ctypes.int32_t.ptr(0xfffffffff).tostring()); // 'ctypes.int32_t.ptr(ctypes.uint64("0xfffffffff"))' see also working with arraybuffers ...
Using js-ctypes
n defining types and replicate it: declaring types var lib = ctypes.open("user32.dll"); or even without the extension. var lib = ctypes.open("user32"); calling carbon routines on mac os x this example demonstrates how to use ctypes to call a carbon function on mac os x. ...
...note that this only works correctly if the string is in fact under 256 characters; if it's longer, this will fail spectacularly. in line 9, the carbon library is loaded from the system's carbon framework. line 11 declares the stdalert() function, which will call the carbon standardalert routine. it uses the...
Introduction to DOM Inspector - Firefox Developer Tools
lable from the menupopup accessed from the upper left corner of the the object pane. in order to find out what the actual name of the file is being used to provide the search go icon, you can select the css rules viewer from this menu and see the various selectors and rules that have been applied. the rule that applies the search icon to the element uses a class simple selector and uses a list-style-image property to point to a file in the current theme. the list of viewers available from the viewer menu gives you some idea about how extensive the dom inspector's inspecting capabilities are. the following descriptions provide an overview of what these viewers are about: the dom nodes viewer shows attributes of nodes that can take them, or the text content of text nodes, comments, and proce...
...odel viewer gives various metrics about xul and html elements, including placement and size. the xbl bindings viewer lists the xbl bindings attached to elements. if a binding extends another binding, the binding menulist will list them in descending order to to "root" binding. the css rules viewer shows the css rules that are applied to the node. alternatively, when used in conjunction with the style sheets viewer, the css rules viewer lists all recognized rules from that style sheet in order. properties may be also be edited. rules applying to pseudo-elements do not appear. the javascript object viewer gives a hierarchical tree of the object pane's subject. the javascript object viewer also allows javascript to be evaluated by selecting the appropriate menuitem in the context menu. basic a...
Index - Firefox Developer Tools
ow long the browser takes to download the different parts of your site. 53 throttling 110n:priority, debugging, dev tools, firefox, guide, networking, tools the network monitor allows you to throttle your network speed to emulate various connection speeds so you can see how your app will behave under different connection types. 54 page inspector css, dom, html, stylesheets, web development, web development:tools, l10n:priority use the page inspector to examine and modify the html and css of a page. 55 how to links for various how to's can be found here. these links describe in depth the how to techniques. 56 css flexbox inspector: examine flexbox layouts guide, inspector, tools, flexbox the flexbox inspector al...
... 110 local storage / session storage dev tools, firefox, guide, local storage, session storage, storage, storage inspector, tools, l10n:priority when an origin corresponding to local storage or session storage is selected within the storage inspector, the names and values of all the items corresponding to local storage or session storage will be listed in a table. 111 style editor css, stylesheets, tools, web development, web development:tools the style editor enables you to: 112 taking screenshots screenshot, tools you can use the developer tools to take a screenshot of the entire page, or of a single element in the page. 113 the firefox javascript debugger debugger, debugging, dev tools, javascript, tools, l10n:priorit...
Network request list - Firefox Developer Tools
hod:post domain shows resources coming from a specifc domain. domain:mozilla.org remote-ip shows resources coming from a server with the specified ip. remote-ip:63.245.215.53 remote-ip:[2400:cb00:2048:1::6810:2802] cause shows resources matching a specific cause type. the types can be found in the description of the cause column. cause:js cause:stylesheet cause:img transferred shows resources having a specific transferred size or a transferred size close to the one specified. k can be used as suffix for kilobytes and m for megabytes, e.g. the value 1k is equivalent to 1024. transferred:1k size shows resources having a specific size (after decompression) or a size close to the one specified. k can be used as suf...
...ges made. edit and resend opens an editor enabling you to edit the request's method, url, parameters, and headers, and resend the request. block url blocks the selected url for future requests. see blocking a specific url from the request list. open in new tab resends the request in a new tab — very useful for debugging asynchronous requests. open in style editor for a css resource, opens it in the style editor. start performance analysis use as fetch in console submits the request as a call to the fetch() method in the console. copy as curl the command may include the following options: -x [method] if the method is not get or post --data for url encoded request parameters --data...
Page inspector 3-pane mode - Firefox Developer Tools
how to use the page inspector's 3-pane mode. feature summary from firefox 62 onwards, the page inspector has a new mode available — 3-pane mode. when activated, this allows you to see the following simultaneously: the html pane on the left hand side, as usual. the css rules in the middle in their own separate pane, rather than as a tab. ...
...you just need to have the relevant tab open to see the effect. a brief walkthrough the 3-pane inspector is disabled by default. it is enabled via a toggle control found in the tabs pane on the left hand side. press the toggle control to toggle between the 2- and 3-pane views. ...
AbstractRange - Web APIs
ge is an object that indicates the start and end points of a section of content within the document. as an abstract interface, you will not directly instantiate an object of type abstractrange. instead, you will use the range or staticrange interfaces. to understand the difference between those two interfaces, and how to choose which is appropriate for your needs. ...
...y instantiate an object of type abstractrange. instead, you will use the range or staticrange interfaces. to understand the difference between those two interfaces, and how to choose which is appropriate for your needs. ...
Animation - Web APIs
Web › API › Animation
s and sets the event handler for the cancel event. animation.onfinish gets and sets the event handler for the finish event. animation.onremove allows you to set and run an event handler that fires when the animation is removed (i.e., put into an active replace state). methods animation.cancel() clears all keyframeeffects caused by this animation and aborts its playback. animation.commitstyles() commits the end styling state of an animation to the element being animated, even after that animation has been removed. it will cause the end styling state to be written to the element being animated, in the form of properties inside a style attribute. animation.finish() seeks either end of an animation, depending on whether the animation is playing or reversing. animation.pause() ...
...a huge animations list, which could create a memory leak. for this reason, modern browsers have implemented the part of the web animations spec that automatically removes overriding forward filling animations, unless the developer explicitly specifies to keep them. you can see this in action in our simple replace indefinite animations demo. the related javascript features are: animation.commitstyles() for commiting the end styling state of an animation to the element being animated, even after that animation has been removed. animation.onremove for setting and running an event handler that fires when the animation is removed (i.e., put into an active replace state). animation.persist() for when you explicitly want an animations to be retained. animation.replacestate to return the replace...
AnimationEvent - Web APIs
the animationevent interface represents events providing information related to animations. ...
... the animationevent interface represents events providing information related to animations. ...
Attr - Web APIs
Web › API › Attr
the attr interface represents one of a dom element's attributes as an object. in most dom methods, you will directly retrieve the attribute as a string (e.g., element.getattribute()), but certain functions (e.g., element.getattributenode()) or means of iterating return attr types. ...
...s as an object. in most dom methods, you will directly retrieve the attribute as a string (e.g., element.getattribute()), but certain functions (e.g., element.getattributenode()) or means of iterating return attr types. ...
AudioBufferSourceNode - Web APIs
r playing back audio which has particularly stringent timing accuracy requirements, such as for sounds that must match a specific rhythm and can be kept in memory rather than being played from disk or the network. to play sounds which require accurate timing but must be streamed from the network or played from disk, use a audioworkletnode to implement its playback. ...
...kept in memory rather than being played from disk or the network. to play sounds which require accurate timing but must be streamed from the network or played from disk, use a audioworkletnode to implement its playback. ...
AudioContext - Web APIs
ns and the execution of the audio processing, or decoding. you need to create an audiocontext before you do anything else, as everything happens inside a context. it's recommended to create one audiocontext and reuse it instead of initializing a new one each time, and it's ok to use a single audiocontext for several different audio source and pipeline concurrently. ...
...ide a context. it's recommended to create one audiocontext and reuse it instead of initializing a new one each time, and it's ok to use a single audiocontext for several different audio source and pipeline concurrently. ...
AudioNode - Web APIs
Web › API › AudioNode
the audionode interface is a generic interface for representing an audio processing module. examples include: an audio source (e.g. an html <audio> or <video> element, an oscillatornode, etc.), the audio destination, intermediate processing module (e.g. ...
...rce (e.g. an html <audio> or <video> element, an oscillatornode, etc.), the audio destination, intermediate processing module (e.g. ...
BaseAudioContext - Web APIs
eb audio api acts as a base definition for online and offline audio-processing graphs, as represented by audiocontext and offlineaudiocontext respectively. you wouldn't use baseaudiocontext directly — you'd use its features via one of these two inheriting interfaces. a baseaudiocontext can be a target of events, therefore it implements the eventtarget interface. ...
...tively. you wouldn't use baseaudiocontext directly — you'd use its features via one of these two inheriting interfaces. a baseaudiocontext can be a target of events, therefore it implements the eventtarget interface. ...
BeforeInstallPromptEvent - Web APIs
the beforeinstallpromptevent is fired at the window.onbeforeinstallprompt handler before a user is prompted to "install" a web site to a home screen on mobile. this interface inherits from the event interface. ...
... the beforeinstallpromptevent is fired at the window.onbeforeinstallprompt handler before a user is prompted to "install" a web site to a home screen on mobile. this interface inherits from the event interface. ...
BeforeUnloadEvent - Web APIs
ned to the returnvalue event property, a dialog box appears, asking the users for confirmation to leave the page (see example below). when no value is provided, the event is processed silently. some implementations only show the dialog box if the frame or any embedded frame receives a user gesture or user interaction. see browser compatibility for more information. ...
.... when no value is provided, the event is processed silently. some implementations only show the dialog box if the frame or any embedded frame receives a user gesture or user interaction. see browser compatibility for more information. ...
BluetoothDevice - Web APIs
the bluetoothdevice interface of the web bluetooth api represents a bluetooth device inside a particular script execution environment. ...
... the bluetoothdevice interface of the web bluetooth api represents a bluetooth device inside a particular script execution environment. ...
BroadcastChannel - Web APIs
represents a named channel that any browsing context of a given origin can subscribe to. it allows communication between different documents (in different windows, tabs, frames or iframes) of the same origin. messages are broadcasted via a message event fired at all broadcastchannel objects listening to the channel. note: this feature is available in web workers. ...
...fferent windows, tabs, frames or iframes) of the same origin. messages are broadcasted via a message event fired at all broadcastchannel objects listening to the channel. note: this feature is available in web workers. ...
CDATASection - Web APIs
: <![cdata[ ... ]]> for example: <foo>here is a cdata section: <![cdata[ < > & ]]> with all kinds of unescaped text.</foo> the only sequence which is not allowed within a cdata section is the closing sequence of a cdata section itself, ]]>: <![cdata[ ]]> will cause an error ]]> note that cdata sections should not be used within html; they only work in xml. ...
... only sequence which is not allowed within a cdata section is the closing sequence of a cdata section itself, ]]>: <![cdata[ ]]> will cause an error ]]> note that cdata sections should not be used within html; they only work in xml. ...
CSS numeric factory functions - Web APIs
working draft initial definition ...
... working draft initial definition ...
CSS.supports() - Web APIs
Web › API › CSS › supports
a domstring containing the name of the css property to check. value a domstring containing the value of the css property to check. the second syntax takes one parameter matching the condition of @supports: supportcondition a domstring containing the condition to check. return value true if the browser supports the rule, otherwise false. ...
... the second syntax takes one parameter matching the condition of @supports: supportcondition a domstring containing the condition to check. return value true if the browser supports the rule, otherwise false. examples result = css.supports("text-decoration-style", "blink"); result = css.supports("display: flex"); result = css.supports("(--foo: red)"); result = css.supports(`(transform-style: preserve) or (-moz-transform-style: preserve) or (-o-transform-style: preserve) or (-webkit-transform-style: preserve)`); // result is true or false specification specification status comment css conditional rules module level 3the definition of 'css: supports()' in that specification. candidate recommendation initial definition. ...
CSSMathValue - Web APIs
thproduct cssmathsum properties cssmathvalue.operator indicates the operator that the current subtype represents. event handlers no methods none. examples we create an element with a width determined using a calc() function, then console.log() the operator. ...
...ue.operator indicates the operator that the current subtype represents. event handlers no methods none. examples we create an element with a width determined using a calc() function, then console.log() the operator. <div>has width</div> we assign a width with a calculation div { width: calc(30% - 20px); } we add the javascript const stylemap = document.queryselector('div').computedstylemap(); console.log( stylemap.get('width') ); // cssmathsum {values: cssnumericarray, operator: "sum"} console.log( stylemap.get('width').operator ); // 'sum' console.log( stylemap.get('width').values[1].value ); // -20 the cssmathvalue.operator returns 'sum' because stylemap.get('width').values[1].value ); is -20: adding a negative number. specifications ...
CSSMediaRule - Web APIs
ebidl format. interface cssmediarule : cssconditionrule { readonly attribute medialist media; } properties as a cssconditionrule, and therefore both a cssgroupingrule and a cssrule, cssmediarule also implements the properties of these interfaces. it has the following specific property: cssmediarule.media read only specifies a medialist representing the intended destination medium for style information. methods as a cssconditionrule, and therefore both a cssgroupingrule and a cssrule, cssmediarule also implements the methods of that interface. it has no specific methods. specifications specification status comment css conditional rules module level 3the definition of 'cssmediarule' in that specification. candidate recommendation make it derived...
...specifications specification status comment css conditional rules module level 3the definition of 'cssmediarule' in that specification. candidate recommendation make it derived from the cssconditionrule. css object model (cssom)the definition of 'cssmediarule' in that specification. working draft no changes from document object model (dom) level 2 style specification document object model (dom) level 2 style specificationthe definition of 'cssmediarule' in that specification. obsolete ...
CSSPageRule - Web APIs
csspagerule is an interface representing a single css @page rule. it implements the cssrule interface with a type value of 6 (cssrule.page_rule). syntax the syntax is described using the webidl format. interface csspagerule : cssrule { attribute domstring selectortext; readonly attribute cssstyledeclaration style; }; properties as a cssrule, csspagerule also implements the properties of this interface. it has the following specific properties: csspagerule.selectortext represents the text of the page selector associated with the at-rule. csspagerule.style read only returns the declaration block associated with the at-rule. methods as a cssrule, csspagerule also implements the methods of that interface. it has no specific methods. specifications specification st...
...y returns the declaration block associated with the at-rule. methods as a cssrule, csspagerule also implements the methods of that interface. it has no specific methods. specifications specification status comment css object model (cssom)the definition of 'csspagerule' in that specification. working draft no changes from document object model (dom) level 2 style specification document object model (dom) level 2 style specificationthe definition of 'csspagerule' in that specification. obsolete initial definition ...
CSSPositionValue - Web APIs
osition along the web page's horizontal axis. csspositionvalue.y returns the item's position along the vertical axis. methods none. examples the following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. let replacedel = document.getelementbyid( 'image' ); let position = new csspositionvalue( css.px(35), css.px(40) ); replacedel.attributestylemap.set( 'object-position', position ); console.log( position.x.value, position.y.value ); console.log( replacedel.computedstylemap().get('object-position') ); we set the object-position property, then check the values returned. #image { width: 300px; height: 300px; border: 1px solid black; background-color: #dededf; object-fit: none; } <p>check the developer tools to see the log in t...
...sition ); console.log( position.x.value, position.y.value ); console.log( replacedel.computedstylemap().get('object-position') ); we set the object-position property, then check the values returned. ...
CSSPrimitiveValue.getRGBColorValue() - Web APIs
the getrgbcolorvalue() method of the cssprimitivevalue interface is used to get an rgb color value. if this css value doesn't contain a rgb color value, a domexception is raised. modification to the corresponding style property can be achieved using the rgbcolor interface. syntax var rgbcolorvalue = cssprimitivevalue.getrgbcolorvalue(); return value an rgbcolor object representing the color value. exceptions type description domexception an invalid_access_err is raised if the attached property can't return an rgb color value (i.e. ...
...ed using the rgbcolor interface. syntax var rgbcolorvalue = cssprimitivevalue.getrgbcolorvalue(); return value an rgbcolor object representing the color value. exceptions type description domexception an invalid_access_err is raised if the attached property can't return an rgb color value (i.e. this is not css_rgbcolor). example var cs = window.getcomputedstyle(document.body); var cssvalue = cs.getpropertycssvalue("color"); console.log(cssvalue.getrgbcolorvalue()); specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssprimitivevalue.getrgbcolorvalue' in that specification. obsolete initial definition ...
CSSPrimitiveValue.getRectValue() - Web APIs
the getrectvalue() method of the cssprimitivevalue interface is used to get a rect value. if this css value doesn't contain a rect value, a domexception is raised. modification to the corresponding style property can be achieved using the rect interface. syntax var rectvalue = cssprimitivevalue.getrectvalue(); return value a rect object representing the rect value. exceptions type description domexception an invalid_access_err is raised if the css value doesn't contain a rect value. (i.e. this is not css_rect). ...
...ing style property can be achieved using the rect interface. syntax var rectvalue = cssprimitivevalue.getrectvalue(); return value a rect object representing the rect value. exceptions type description domexception an invalid_access_err is raised if the css value doesn't contain a rect value. (i.e. this is not css_rect). example var cs = window.getcomputedstyle(document.getelementbyid("clippeddiv")); var cssvalue = cs.getpropertycssvalue("clip"); console.log(cssvalue.getrectvalue()); specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssprimitivevalue.getrectvalue' in that specification. obsolete initial definition ...
CSSRule.cssText - Web APIs
Web › API › CSSRule › cssText
the csstext property of the cssrule interface returns the actual text of a cssstylesheet style-rule. note: do not confuse this property with element-style cssstyledeclaration.csstext. be aware that this property can no longer be set directly, as it is now specified to be functionally modify-only, and silently so. in other words, attempting to set it does absolutely nothing, and doesn't even omit a warning or error. furthermore, it has no settable sub-properties. therefore, to modify it, use the stylesheet's cssrules[index] properties .selectortext and .style (or its sub-properties). see using dynamic styling information for details. ...
...dify-only, and silently so. in other words, attempting to set it does absolutely nothing, and doesn't even omit a warning or error. furthermore, it has no settable sub-properties. therefore, to modify it, use the stylesheet's cssrules[index] properties .selectortext and .style (or its sub-properties). see using dynamic styling information for details. syntax string = cssrule.csstext example <style> body { background-color: darkblue; } </style> <script> var stylesheet = document.stylesheets[0]; alert(stylesheet.cssrules[0].csstext); // body { background-color: darkblue; } </script> specifications specification status comment css object model (cssom)the definition of 'cssrule: csstext' in that specification. working draft ...
CSS Painting API - Web APIs
nctionality allowing developers to create custom values for paint(), a css <image> function. you can then apply these values to properties like background-image to set complex custom backgrounds on an element. for example: aside { background-image: paint(mypaintedimage); } the api defines paintworklet, a worklet that can be used to programmatically generate an image that responds to computed style changes. to find out more about how this is used, consult using the css painting api. interfaces paintworklet programmatically generates an image where a css property expects a file. access this interface through css.paintworklet. paintworkletglobalscope the global execution context of the paintworklet. paintrenderingcontext2d implements a subset of the canvasrenderingcontext2d api. it...
...size.height * 0.3; const blockwidth = size.width * 0.33; const blockheight = size.height * 0.85; const thecolor = props.get( '--boxcolor' ); const stroketype = args[0].tostring(); const strokewidth = parseint(args[1]); console.log(thecolor); if ( strokewidth ) { ctx.linewidth = strokewidth; } else { ctx.linewidth = 1.0; } if ( stroketype === 'stroke' ) { ctx.fillstyle = 'transparent'; ctx.strokestyle = thecolor; } else if ( stroketype === 'filled' ) { ctx.fillstyle = thecolor; ctx.strokestyle = thecolor; } else { ctx.fillstyle = 'none'; ctx.strokestyle = 'none'; } ctx.beginpath(); ctx.moveto( x, y ); ctx.lineto( blockwidth, y ); ctx.lineto( blockwidth + blockheight, blockheight ); ctx.lineto( x, blockheight ); ctx.lineto( x,...
CanvasGradient - Web APIs
properties as an opaque object, there is no exposed property. methods there is no inherited method. canvasgradient.addcolorstop() adds a new stop, defined by an offset and a color, to the gradient. ...
... properties as an opaque object, there is no exposed property. methods there is no inherited method. canvasgradient.addcolorstop() adds a new stop, defined by an offset and a color, to the gradient. ...
CanvasPattern - Web APIs
properties as an opaque object, this has no exposed property. methods there are no inherited method. canvaspattern.settransform() applies an svgmatrix or dommatrix representing a linear transform to the pattern. ...
... properties as an opaque object, this has no exposed property. methods there are no inherited method. canvaspattern.settransform() applies an svgmatrix or dommatrix representing a linear transform to the pattern. ...
CanvasRenderingContext2D.clearRect() - Web APIs
wish background. the clearrect() method then erases part of the canvas. html <canvas id="canvas"></canvas> javascript the cleared area is rectangular in shape, with its top-left corner at (10, 10). the cleared area has a width of 120 and a height of 100. ...
...vascript the cleared area is rectangular in shape, with its top-left corner at (10, 10). the cleared area has a width of 120 and a height of 100. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // draw yellow background ctx.beginpath(); ctx.fillstyle = '#ff6'; ctx.fillrect(0, 0, canvas.width, canvas.height); // draw blue triangle ctx.beginpath(); ctx.fillstyle = 'blue'; ctx.moveto(20, 20); ctx.lineto(180, 20); ctx.lineto(130, 130); ctx.closepath(); ctx.fill(); // clear part of the canvas ctx.clearrect(10, 10, 120, 100); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.clearrect' in that specification. living standard ...
CanvasRenderingContext2D.clip() - Web APIs
lipping region are rendered. html <canvas id="canvas"></canvas> javascript the clipping region is a full circle, with its center at (100, 75), and a radius of 50. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // create circular clipping region ctx.beginpath(); ctx.arc(100, 75, 50, 0, math.pi * 2); ctx.clip(); // draw stuff that gets clipped ctx.fillstyle = 'blue'; ctx.fillrect(0, 0, canvas.width, canvas.height); ctx.fillstyle = 'orange'; ctx.fillrect(0, 0, 100, 100); result specifying a path and a fillrule this example saves two rectangles to a path2d object, which is then made the current clipping region using the clip() method. the "evenodd" rule creates a hole where the clipping rectangles intersect; by default (with the "nonzero" rule),...
...angles intersect; by default (with the "nonzero" rule), there would be no hole. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // create clipping path let region = new path2d(); region.rect(80, 10, 20, 130); region.rect(40, 50, 100, 50); ctx.clip(region, "evenodd"); // draw stuff that gets clipped ctx.fillstyle = 'blue'; ctx.fillrect(0, 0, canvas.width, canvas.height); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.clip' in that specification. living standard ...
CanvasRenderingContext2D.drawFocusIfNeeded() - Web APIs
'blue' : 'black'; ctx.filltext(el.textcontent, x + width / 2, y + height / 2); // define clickable area ctx.beginpath(); ctx.rect(x, y, width, height); // draw focus ring, if approp...
...pointinpath(x, y)) { button2.focus(); } } function drawbutton(el, x, y) { const active = document.activeelement === el; const width = 150; const height = 40; // button background ctx.fillstyle = active ? 'pink' : 'lightgray'; ctx.fillrect(x, y, width, height); // button text ctx.font = '15px sans-serif'; ctx.textalign = 'center'; ctx.textbaseline = 'middle'; ctx.fillstyle = active ? 'blue' : 'black'; ctx.filltext(el.textcontent, x + width / 2, y + height / 2); // define clickable area ctx.beginpath(); ctx.rect(x, y, width, height); // draw focus ring, if appropriate ctx.drawfocusifneeded(el); } result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.drawfocusifne...
CanvasRenderingContext2D.ellipse() - Web APIs
troke(); // draw the ellipse's line of reflection ctx.beginpath(); ctx.setlinedash([5, 5]); ctx.moveto(0, 200); ctx.lineto(200, 0); ctx.stroke(); result various elliptical arcs this example creates three elliptical paths with varying properties. ...
...x.lineto(200, 0); ctx.stroke(); result various elliptical arcs this example creates three elliptical paths with varying properties. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.fillstyle = 'red'; ctx.beginpath(); ctx.ellipse(60, 75, 50, 30, math.pi * .25, 0, math.pi * 1.5); ctx.fill(); ctx.fillstyle = 'blue'; ctx.beginpath(); ctx.ellipse(150, 75, 50, 30, math.pi * .25, 0, math.pi); ctx.fill(); ctx.fillstyle = 'green'; ctx.beginpath(); ctx.ellipse(240, 75, 50, 30, math.pi * .25, 0, math.pi, true); ctx.fill(); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.ellipse' in that specification. livin...
CanvasRenderingContext2D.fill() - Web APIs
syntax void ctx.fill([fillrule]); void ctx.fill(path [, fillrule]); parameters fillrule the algorithm by which to determine if a point is inside or outside the filling region. possible values: "nonzero": the non-zero winding rule. default rule. "evenodd": the even-odd winding rule. path a path2d path to fill. examples filling a rectangle this example fills a rectangle with the fill() method. ...
..., the hole would also be filled. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // create path let region = new path2d(); region.moveto(30, 90); region.lineto(110, 20); region.lineto(240, 130); region.lineto(60, 130); region.lineto(190, 20); region.lineto(270, 90); region.closepath(); // fill path ctx.fillstyle = 'green'; ctx.fill(region, 'evenodd'); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.fill' in that specification. living standard ...
CanvasRenderingContext2D.lineCap - Web APIs
o the end that has a radius half the width of the line. the line on the right uses the "square" option. this adds a box with an equal width and half the height of the line thickness. ...
...ght of the line thickness. <canvas id="canvas" width="150" height="150"></canvas> const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); const linecap = ['butt', 'round', 'square']; // draw guides ctx.strokestyle = '#09f'; ctx.beginpath(); ctx.moveto(10, 10); ctx.lineto(140, 10); ctx.moveto(10, 140); ctx.lineto(140, 140); ctx.stroke(); // draw lines ctx.strokestyle = 'black'; for (let i = 0; i < linecap.length; i++) { ctx.linewidth = 15; ctx.linecap = linecap[i]; ctx.beginpath(); ctx.moveto(25 + i * 50, 10); ctx.lineto(25 + i * 50, 140); ctx.stroke(); } screenshotlive sample specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.linecap' in that specification. li...
CanvasRenderingContext2D.rotate() - Web APIs
thod. examples rotating a shape this example rotates a rectangle by 45°. note that the center of rotation is the top-left corner of the canvas, and not a location relative to any shape. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // point of transform origin ctx.arc(0, 0, 5, 0, 2 * math.pi); ctx.fillstyle = 'blue'; ctx.fill(); // non-rotated rectangle ctx.fillstyle = 'gray'; ctx.fillrect(100, 0, 80, 20); // rotated rectangle ctx.rotate(45 * math.pi / 180); ctx.fillstyle = 'red'; ctx.fillrect(100, 0, 80, 20); // reset transformation matrix to the identity matrix ctx.settransform(1, 0, 0, 1, 0, 0); result the center of rotation is blue. the non-rotated rectangle is gray, and the rotated rectan...
... html <canvas id="canvas"></canvas> javascript the shape is a rectangle with its corner at (80, 60), a width of 140, a height of 30. its horizontal center is at (80 + 140 / 2), or 150. its vertical center is at (60 + 30 / 2), or 75. thus, the center point is at (150, 75). const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // non-rotated rectangle ctx.fillstyle = 'gray'; ctx.fillrect(80, 60, 140, 30); // matrix transformation ctx.translate(150, 75); ctx.rotate(math.pi / 2); ctx.translate(-150, -75); // rotated rectangle ctx.fillstyle = 'red'; ctx.fillrect(80, 60, 140, 30); result the non-rotated rectangle is gray, and the rotated rectangle is red. specifications specification status comment html living standardthe defini...
CanvasRenderingContext2D.save() - Web APIs
the canvasrenderingcontext2d.save() method of the canvas 2d api saves the entire state of the canvas by pushing the current state onto a stack. the drawing state the drawing state that gets saved onto a stack consists of: the current transformation matrix. the current clipping region. the current dash list. the current values of the following attributes: strokestyle, fillstyle, globalalpha, linewidth, linecap, linejoin, miterlimit, linedashoffset, shadowoffsetx, shadowoffsety, shadowblur, shadowcolor, globalcompositeoperation, font, textalign, textbaseline, direction, imagesmoothingenabled. syntax void ctx.save(); examples saving the drawing state this example uses the save() method to save the default state and restore() to restore it later, so that you are able to draw a rect w...
...d ctx.save(); examples saving the drawing state this example uses the save() method to save the default state and restore() to restore it later, so that you are able to draw a rect with the default state later. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // save the default state ctx.save(); ctx.fillstyle = 'green'; ctx.fillrect(10, 10, 100, 100); // restore the default state ctx.restore(); ctx.fillrect(150, 40, 100, 100); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.save' in that specification. living standard ...
CanvasRenderingContext2D.shadowColor - Web APIs
note: shadows are only drawn if the shadowcolor property is set to a non-transparent value. one of the shadowblur, shadowoffsetx, or shadowoffsety properties must be non-zero, as well. syntax ctx.shadowcolor = color; color a domstring parsed as a css <color> value. the default value is fully-transparent black. ...
...ml <canvas id="canvas"></canvas> javascript the resulting alpha value of the fill shadow is .8 * .2, or .16. the alpha of the stroke shadow is .8 * .6, or .48. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // shadow ctx.shadowcolor = 'rgba(255, 0, 0, .8)'; ctx.shadowblur = 8; ctx.shadowoffsetx = 30; ctx.shadowoffsety = 20; // filled rectangle ctx.fillstyle = 'rgba(0, 255, 0, .2)'; ctx.fillrect(10, 10, 150, 100); // stroked rectangle ctx.linewidth = 10; ctx.strokestyle = 'rgba(0, 0, 255, .6)'; ctx.strokerect(10, 10, 150, 100); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.shadowcolor' in that specification. living standard ...
Manipulating video using canvas - Web APIs
of the video element with a canvas, you can manipulate video data in real time to incorporate a variety of visual effects to the video being displayed. this tutorial demonstrates how to perform chroma-keying (also known as the "green screen effect") using javascript code. the document content the html document used to render this content is shown below. ...
...s content is shown below. ...
Using images - Web APIs
one of the more exciting features of <canvas> is the ability to use images. these can be used to do dynamic photo compositing or as backdrops of graphs, for sprites in games, and so forth. external images can be used in any format supported by the browser, such as png, gif, or jpeg. you can even use the image produced by other canvas elements on the same page as the source! importing images into a canvas is basically a two step process: get a reference to an htmlimageelement object or to another canvas element as a source. it is also possible to use images by providing a url. ...
...ll slice out its head and composite it into a picture frame. the picture frame image is a 24-bit png which includes a drop shadow. because 24-bit png images include a full 8-bit alpha channel, unlike gif and 8-bit png images, it can be placed onto any background without worrying about a matte color. ...
Canvas API - Web APIs
simple example draws a green rectangle onto a canvas. html <canvas id="canvas"></canvas> javascript the document.getelementbyid() method gets a reference to the html <canvas> element. next, the htmlcanvaselement.getcontext() method gets that element's context—the thing onto which the drawing will be rendered. the actual drawing is done using the canvasrenderingcontext2d interface. ...
...nt's context—the thing onto which the drawing will be rendered. the actual drawing is done using the canvasrenderingcontext2d interface. the fillstyle property makes the rectangle green. the fillrect() method places its top-left corner at (10, 10), and gives it a size of 150 units wide by 100 tall. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.fillstyle = 'green'; ctx.fillrect(10, 10, 150, 100); result reference htmlcanvaselement canvasrenderingcontext2d canvasgradient canvasimagesource canvaspattern imagebitmap imagedata renderingcontext textmetrics offscreencanvas path2d imagebitmaprenderingcontext note: the interfaces related to the webglrenderingcontext are referenced under webgl. canvascapturemediastream is a...
CharacterData - Web APIs
the characterdata abstract interface represents a node object that contains characters. this is an abstract interface, meaning there aren't any object of type characterdata: it is implemented by other interfaces, like text, comment, or processinginstruction which aren't abstract. ...
... that contains characters. this is an abstract interface, meaning there aren't any object of type characterdata: it is implemented by other interfaces, like text, comment, or processinginstruction which aren't abstract. ...
Comment - Web APIs
Web › API › Comment
the comment interface represents textual notations within markup; although it is generally not visually shown, such comments are available to be read in the source view. comments are represented in html and xml as content between '<!--' and '-->'. in xml, the character sequence '--' cannot be used within a comment. ...
...sually shown, such comments are available to be read in the source view. comments are represented in html and xml as content between '<!--' and '-->'. in xml, the character sequence '--' cannot be used within a comment. ...
CompositionEvent - Web APIs
the dom compositionevent represents events that occur due to the user indirectly entering text. ...
... the dom compositionevent represents events that occur due to the user indirectly entering text. ...
console - Web APIs
Web › API › Console
ing message. you may use string substitution and additional arguments with this method. examples outputting text to the console the most frequently-used feature of the console is logging of text and other data. there are four categories of output you can generate, using the console.log(), console.info(), console.warn(), and console.error() methods respectively. each of these results in output styled differently in the log, and you can use the filtering controls provided by your browser to only view the kinds of output that interest you. there are two ways to use each of the output methods; you can simply pass in a list of objects whose string representations get concatenated into one string, then output to the console, or you can pass in a string containing zero or more substitution string...
...led me %d times.", "bob", i+1); } the output looks like this: [13:14:13.481] hello, bob. you've called me 1 times. [13:14:13.483] hello, bob. you've called me 2 times. [13:14:13.485] hello, bob. you've called me 3 times. [13:14:13.487] hello, bob. you've called me 4 times. [13:14:13.488] hello, bob. you've called me 5 times. styling console output you can use the %c directive to apply a css style to console output: console.log("this is %cmy stylish message", "color: yellow; font-style: italic; background-color: blue;padding: 2px"); the text before the directive will not be affected, but the text after the directive will be styled using the css declarations in the parameter. the properties usable along with the %c syntax are as follows (at least, in firefox — they may differ in othe...
CustomElementRegistry.define() - Web APIs
info span var text = this.getattribute('text'); info.textcontent = text; // insert icon var imgurl; if(this.hasattribute('img')) { imgurl = this.getattribute('img'); } else { imgurl = 'img/default.png'; } var img = document.createelement('img'); img.src = imgurl; icon.appendchild(img); // create some css to apply to the shadow dom var style = document.createelement('style'); style.textcontent = '.wrapper {' + 'position: relative;' + '}' + '.info {' + 'font-size: 0.8rem;' + 'width: 200px;' + 'display: inline-block;' + 'border: 1px solid black;...
... 'z-index: 3;' + '}' + 'img {' + 'width: 1.2rem' + '}' + '.icon:hover + .info, .icon:focus + .info {' + 'opacity: 1;' + '}'; // attach the created elements to the shadow dom shadow.appendchild(style); shadow.appendchild(wrapper); wrapper.appendchild(icon); wrapper.appendchild(info); } } // define the new element customelements.define('popup-info', popupinfo); <popup-info img="img/alt.png" text="your card validation code (cvc) is an extra security feature — it is the last 3 or 4 numbers on the back of y...
DOMRect - Web APIs
Web › API › DOMRect
a domrect represents a rectangle. the type of box represented by the domrect is specified by the method or property that returned it. for example, vreyeparameters.renderrect from the defunct webvr api specified the viewport of a canvas into which visuals for one eye of a head mounted display should be rendered. it inherits from its parent, domrectreadonly. ...
...ample, vreyeparameters.renderrect from the defunct webvr api specified the viewport of a canvas into which visuals for one eye of a head mounted display should be rendered. it inherits from its parent, domrectreadonly. ...
DataTransfer.effectAllowed - Web APIs
o effectallowed has no effect and the old value is retained. internet explorer will change the value to be lowercased; thus, linkmove will become linkmove, and so on. example this example shows the use of the effectallowed and dropeffect properties. ...
... on. example this example shows the use of the effectallowed and dropeffect properties. ...
DataTransfer.getData() - Web APIs
gover="allowdrop(event)"> <span id="drag" draggable="true" ondragstart="drag(event)">drag me to the other box</span> </div> <div id="div2" ondrop="drop(event)" ondragover="allowdrop(event)"></div> css content #div1, #div2 { width:100px; height:50px; padding:10px; border:1px solid #aaaaaa; } javascript content function allowdrop(allowdropevent) { allowdropevent.target.style.color = 'blue'; allowdropevent.preventdefault(); } function drag(dragevent) { dragevent.datatransfer.setdata("text", dragevent.target.id); dragevent.target.style.color = 'green'; } function drop(dropevent) { dropevent.preventdefault(); var data = dropevent.datatransfer.getdata("text"); dropevent.target.appendchild(document.getelementbyid(data)); document.getelementby...
... living standard html 5.1the definition of 'getdata()' in that specification. recommendation initial definition ...
DataTransfer.items - Web APIs
containing datatransferitem objects representing the items being dragged in a drag operation, one list item for each object being dragged. if the drag operation had no data, the list is empty. example this example shows the use of the items and types properties. ...
...st item for each object being dragged. if the drag operation had no data, the list is empty. example this example shows the use of the items and types properties. ...
DataTransfer.types - Web APIs
ration. each format is string. if the drag operation included no data, this list will be empty. if any files are included in the drag operation, then one of the types will be the string files. example this example shows the use of the types and items properties. ...
...y files are included in the drag operation, then one of the types will be the string files. example this example shows the use of the types and items properties. ...
Detecting device orientation - Web APIs
warning: chrome and firefox do not handle the angles the same way, so on some axes the direction are reversed. ...
... warning: chrome and firefox do not handle the angles the same way, so on some axes the direction are reversed. processing motion events motion events are h...
Document: DOMContentLoaded event - Web APIs
the domcontentloaded event fires when the initial html document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading. bubbles yes cancelable yes (although specified as a simple event that isn't cancelable) interface event event handler property none a different event, load, should be used only to detect a fully-loaded page. it is a common mistake to use load where domcontentloaded would be more appropriate. synchronous javascript pauses parsing of the dom. ...
...dler property none a different event, load, should be used only to detect a fully-loaded page. it is a common mistake to use load where domcontentloaded would be more appropriate. synchronous javascript pauses parsing of the dom. if you want the dom to get parsed as fast as possible after the user has requested the page, you can make your javascript asynchronous and optimize loading of stylesheets. if loaded as usual, stylesheets slow down dom parsing as they're loaded in parallel, "stealing" traffic from the main html document. examples basic usage document.addeventlistener('domcontentloaded', (event) => { console.log('dom fully loaded and parsed'); }); delaying domcontentloaded <script> document.addeventlistener('domcontentloaded', (event) => { console.log('dom full...
Document.createProcessingInstruction() - Web APIs
carry, after the target. the data is up to you, but it can't contain ?>, since that closes the processing instruction. ...
... instruction target is invalid — it should be a valid xml name that doesn't contain "xml", "xml", or any case combination of the two, other than standardized ones such as <?xml-stylesheet ?>. the closing processing instruction sequence (?>) is part of the data. example var doc = new domparser().parsefromstring('<foo />', 'application/xml'); var pi = doc.createprocessinginstruction('xml-stylesheet', 'href="mycss.css" type="text/css"'); doc.insertbefore(pi, doc.firstchild); console.log(new xmlserializer().serializetostring(doc)); // displays: <?xml-stylesheet href="mycss.css" type="text/css"?><foo/> specifications specification status comment domthe definition of 'createprocessinginstruction()' in that specification. living standard no change ...
Document.execCommand() - Web APIs
owdefaultui a boolean indicating whether the default user interface should be shown. this is not implemented in mozilla. avalueargument for commands which require an input argument, is a domstring providing that information. for example, insertimage requires the url of the image to insert. specify null if no argument is needed. commands backcolor changes the document background color. in stylewithcss mode, it affects the background color of the containing block instead. this requires a <color> value string to be passed in as a value argument. note that internet explorer uses this to set the text background color. bold toggles bold on/off for the selection or at the insertion point. internet explorer uses the <strong> tag instead of <b>. clearauthenticationcache clears all authentic...
...point. undo undoes the last executed command. unlink removes the anchor element from a selected hyperlink. usecss toggles the use of html tags or css for the generated markup. requires a boolean true/false as a value argument. note: this argument is logically backwards (i.e. use false to use css, true to use html) and unsupported by internet explorer. this has been deprecated in favor of stylewithcss. stylewithcss replaces the usecss command. true modifies/generates style attributes in markup, false generates presentational elements. example an example of how to use it on codepen. specifications specification status comment execcommand unofficial draft ...
Document.hasFocus() - Web APIs
Web › API › Document › hasFocus
the button to open a new window, and try switching between the two pages. ...
... l...
Document.mozSetImageElement() - Web APIs
ndicating the name of an element that has been specified as a background image using the -moz-element css function. imageelement is the new element to use as the background corresponding to that image element string. specify null to remove the background element. example this example changes the background of a <div> block each time the block is clicked by the user. view this example live. <style type="text/css"> #mybox { background-image: -moz-element(#canvasbg); text-align: center; width: 400px; height: 400px; cursor: pointer; } </style> the css defined by the <style> block above is used by our <div> to use an element with the id "canvasbg" as its background. var c = 0x00; function clicked() { var canvas = document.createelement("canvas"); canvas.setattrib...
...idth: 400px; height: 400px; cursor: pointer; } </style> the css defined by the <style> block above is used by our <div> to use an element with the id "canvasbg" as its background. var c = 0x00; function clicked() { var canvas = document.createelement("canvas"); canvas.setattribute("width", 100); canvas.setattribute("height", 100); var ctx = canvas.getcontext('2d'); ctx.fillstyle = "#" + c.tostring(16) + "0000"; ctx.fillrect(25, 25, 75, 75); c += 0x11; if (c > 0xff) { c = 0x00; } document.mozsetimageelement("canvasbg", canvas); } the code here is called each time the user clicks the <div> element. it creates a new <canvas> with the width and height set to 100 pixels, then draws into it a 50 by 50 pixel square. each time the function is called, the square...
DocumentFragment - Web APIs
lightweight version of document that stores a segment of a document structure comprised of nodes just like a standard document. the key difference is due to the fact that the document fragment isn't part of the active document tree structure. changes made to the fragment don't affect the document (even on reflow) or incur any performance impact when changes are made. ...
...s due to the fact that the document fragment isn't part of the active document tree structure. changes made to the fragment don't affect the document (even on reflow) or incur any performance impact when changes are made. ...
DocumentType - Web APIs
the documenttype interface represents a node containing a doctype. ...
... the documenttype interface represents a node containing a doctype. ...
Element: auxclick event - Web APIs
he demo out with a multi-button mouse (see it live on github; also see the source code). ...
... html <button><h1>click me!</h1></button> css html { height...
Element: focusin event - Web APIs
document object model (dom) level 3 events specification obsolete initial definition ...
... document object model (dom) level 3 events specification obsolete initial definition ...
Element: focusout event - Web APIs
document object model (dom) level 3 events specification obsolete initial definition ...
... document object model (dom) level 3 events specification obsolete initial definition ...
Element.insertAdjacentElement() - Web APIs
ment specified is not a valid element. visualization of position names <!-- beforebegin --> <p> <!-- afterbegin --> foo <!-- beforeend --> </p> <!-- afterend --> note: the beforebegin and afterend positions work only if the node is in a tree and has an element parent. ...
...nd has an element parent. example beforebtn.addeventlistener('click', function() { var tempdiv = document.createelement('div'); tempdiv.style.backgroundcolor = randomcolor(); if (activeelem) { activeelem.insertadjacentelement('beforebegin',tempdiv); } setlistener(tempdiv); }); afterbtn.addeventlistener('click', function() { var tempdiv = document.createelement('div'); tempdiv.style.backgroundcolor = randomcolor(); if (activeelem) { activeelem.insertadjacentelement('afterend',tempdiv); } setlistener(tempdiv); }); have a look at our insertadjacentelement.html demo on github (see the source code too.) here we have a sequence of <div> elements inside a container. when one is clicked, it becomes selected and you can then press the insert before and insert after button...
Element: mouseenter event - Web APIs
i> </ul> </div> css styling the div to make it more visible. ...
...eeventcount = 0; const mousetarget = document.getelementbyid('mousetarget'); const unorderedlist = document.getelementbyid('unorderedlist'); mousetarget.addeventlistener('mouseenter', e => { mousetarget.style.border = '5px dotted orange'; entereventcount++; addlistitem('this is mouseenter event ' + entereventcount + '.'); }); mousetarget.addeventlistener('mouseleave', e => { mousetarget.style.border = '1px solid #333'; leaveeventcount++; addlistitem('this is mouseleave event ' + leaveeventcount + '.'); }); function addlistitem(text) { // create a new text node using the supplied text var newtextnode = document.createtextnode(text); // create a new li element var newlistitem = document.createelement("li"); // add the text node to the li element newlistitem.appendchil...
Element: mouseleave event - Web APIs
</ul> </div> css styling the <div> to make it more visible. ...
...eeventcount = 0; const mousetarget = document.getelementbyid('mousetarget'); const unorderedlist = document.getelementbyid('unorderedlist'); mousetarget.addeventlistener('mouseenter', e => { mousetarget.style.border = '5px dotted orange'; entereventcount++; addlistitem('this is mouseenter event ' + entereventcount + '.'); }); mousetarget.addeventlistener('mouseleave', e => { mousetarget.style.border = '1px solid #333'; leaveeventcount++; addlistitem('this is mouseleave event ' + leaveeventcount + '.'); }); function addlistitem(text) { // create a new text node using the supplied text var newtextnode = document.createtextnode(text); // create a new li element var newlistitem = document.createelement("li"); // add the text node to the li element newlistitem.appendchil...
Element: mouseout event - Web APIs
hy of the items and the fact that list items obscure the underlying <ul>. ...
.../li> <li>item 2</li> <li>item 3</li> </ul> javascript let test = document.getelementbyid("test"); // briefly make the list purple when the mouse moves off the // <ul> element test.addeventlistener("mouseleave", function( event ) { // highlight the mouseleave target event.target.style.color = "purple"; // reset the color after a short delay settimeout(function() { event.target.style.color = ""; }, 1000); }, false); // briefly make an <li> orange when the mouse moves off of it test.addeventlistener("mouseout", function( event ) { // highlight the mouseout target event.target.style.color = "orange"; // reset the color after a short delay settimeout(function() { event.target.style.color = ""; }, 500); }, false); result specifications specificatio...
Element: mouseover event - Web APIs
es the difference between mouseover and mouseenter events. ...
... 2</li> <li>item 3</li> </ul> javascript let test = document.getelementbyid("test"); // this handler will be executed only once when the cursor // moves over the unordered list test.addeventlistener("mouseenter", function( event ) { // highlight the mouseenter target event.target.style.color = "purple"; // reset the color after a short delay settimeout(function() { event.target.style.color = ""; }, 500); }, false); // this handler will be executed every time the cursor // is moved over a different list item test.addeventlistener("mouseover", function( event ) { // highlight the mouseover target event.target.style.color = "orange"; // reset the color after a short delay settimeout(function() { event.target.style.color = ""; }, 500); }, false); result spec...
Element.querySelector() - Web APIs
amined to see if they are descendants of baseelement. the first match of those remaining elements is returned by the queryselector() method. if no matches are found, the returned value is null. exceptions syntaxerror the specified selectors are invalid. examples let's consider a few examples. ...
... if no matches are found, the returned value is null. exceptions syntaxerror the specified selectors are invalid. examples let's consider a few examples. find a specific element with specific values of an attribute in this first example, the first <style> element which either has no type or has type "text/css" in the html document body is returned: var el = document.body.queryselector("style[type='text/css'], style:not([type])"); the entire hierarchy counts this example demonstrates that the hierarchy of the entire document is considered when applying selectors, so that levels outside the specified baseelement are still considered when locating matches. html <div> <h5>original content</h5> <p> inside paragraph <span>inside span</span> inside paragraph </p> </di...
Element.scrollWidth - Web APIs
ent can fit without a need for horizontal scrollbar, its scrollwidth is equal to clientwidth this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). syntax var xscrollwidth = element.scrollwidth; xscrollwidth is the width of the content of element in pixels. ...
...scrollwidth is the width of the content of element in pixels. ...
Element.setCapture() - Web APIs
events api. syntax element.setcapture(retargettoelement); retargettoelement if true, all events are targeted directly to this element; if false, events can also fire at descendants of this element. example in this example, the current mouse coordinates are drawn while you mouse around after clicking and holding down on an element. ...
...vents can also fire at descendants of this element. example in this example, the current mouse coordinates are drawn while you mouse around after clicking and holding down on an element. ...
ErrorEvent - Web APIs
the errorevent interface represents events providing information related to errors in scripts or in files. ...
... the errorevent interface represents events providing information related to errors in scripts or in files. ...
Event.eventPhase - Web APIs
Web › API › Event › eventPhase
"none" : e.eventphase == 1 ? "capturing" : e.eventphase == 2 ? "target" : e.eventphase == 3 ? "bubbling" : "error"; divinfo.innerhtml += e.currenttarget.id + "; eventphase: " + level + "<br/>"; } function clear() { for (let i = 0; i < divs.length; i++) { if (divs[i].id != "divinfo") { div...
... living standard dom4the definition of 'event.eventphase' in that specification. obsolete document object model (dom) level 2 events speci...
EventTarget.removeEventListener() - Web APIs
nttarget has no effect. example this example shows how to add a mouseover-based event listener that removes a click-based event listener. ...
... add a mouseover-based event listener that removes a click-based event listener. ...
EventTarget - Web APIs
can receive events and may have listeners for them. element, document, and window are the most common event targets, but other objects can be event targets, too. for example xmlhttprequest, audionode, audiocontext, and others. many event targets (including elements, documents, and windows) also support setting event handlers via onevent properties and attributes. ...
... targets, too. for example xmlhttprequest, audionode, audiocontext, and others. many event targets (including elements, documents, and windows) also support setting event handlers via onevent properties and attributes. ...
ExtendableEvent - Web APIs
led outside of the extendableevent handler, the browser should throw an invalidstateerror; note also that multiple calls will stack up, and the resulting promises will be added to the list of extend lifetime promises. note: the behaviour described in the above paragraph was fixed in firefox 43 (see bug 1180274.) this interface inherits from the event interface. ...
...ulting promises will be added to the list of extend lifetime promises. note: the behaviour described in the above paragraph was fixed in firefox 43 (see bug 1180274.) this interface inherits from the event interface. ...
FetchEvent.respondWith() - Web APIs
he response.url value will be propagated to the intercepted network request as the final resolved url. if the response.url value is the empty string, then the fetchevent.request.url is used as the final url. in the past the fetchevent.request.url was used as the final url in all cases. the provided response.url was effectively ignored. this means, for example, if a service worker intercepts a stylesheet or worker script, then the provided response.url will be used to resolve any relative @import or importscripts() subresource loads (bug 1222008). for most types of network request this change has no impact because you can't observe the final url. there are a few, though, where it does matter: if a fetch() is intercepted, then you can observe the final url on the result's response.url. ...
...or most types of network request this change has no impact because you can't observe the final url. there are a few, though, where it does matter: if a fetch() is intercepted, then you can observe the final url on the result's response.url. if a worker script is intercepted, then the final url is used to set self.location and used as the base url for relative urls in the worker script. if a stylesheet is intercepted, then the final url is used as the base url for resolving relative @import loads. note that navigation requests for windows and iframes do not use the final url. the way the html specification handles redirects for navigations ends up using the request url for the resulting window.location. this means sites can still provide an "alternate" view of a web page when offline w...
File - Web APIs
Web › API › File
tatransfer object, or from the mozgetasfile() api on an htmlcanvaselement. a file object is a specific kind of a blob, and can be used in any context that a blob can. in particular, filereader, url.createobjecturl(), createimagebitmap(), and xmlhttprequest.send() accept both blobs and files. see using files from web applications for more information and examples. ...
...xt that a blob can. in particular, filereader, url.createobjecturl(), createimagebitmap(), and xmlhttprequest.send() accept both blobs and files. see using files from web applications for more information and examples. ...
FocusEvent - Web APIs
the focusevent interface represents focus-related events, including focus, blur, focusin, and focusout. ...
... the focusevent interface represents focus-related events, including focus, blur, focusin, and focusout. ...
FontFace.FontFace() - Web APIs
Web › API › FontFace › FontFace
, descriptors); parameters family specifies a name that will be used as the font face value for font properties. takes the same type of values as the font-family descriptor of @font-face . source the font source. this can be either: a url binary font data descriptors optional a set of optional descriptors passed as an object. ...
...iptors); parameters family specifies a name that will be used as the font face value for font properties. takes the same type of values as the font-family descriptor of @font-face . source the font source. this can be either: a url binary font data descriptors optional a set of optional descriptors passed as an object. ...
Gamepad.axes - Web APIs
Web › API › Gamepad › axes
specifications specification status comment gamepadthe definition of 'gamepad.axes' in that specification. working draft initial definition ...
... specifications specification status comment gamepadthe definition of 'gamepad.axes' in that specification. working draft initial definition ...
Gamepad.buttons - Web APIs
Web › API › Gamepad › buttons
specifications specification status comment gamepadthe definition of 'gamepad.buttons' in that specification. working draft initial definition ...
... specifications specification status comment gamepadthe definition of 'gamepad.buttons' in that specification. working draft initial definition ...
GamepadButton - Web APIs
working draft initial definition ...
... working draft initial definition ...
GlobalEventHandlers.onanimationcancel - Web APIs
first is the box itself, with all its properties, including animation, defined. we go ahead and describe the animation in-place here because the animation is intended to begin as soon as the page loads, rather than based on an event. #box { width: var(--boxwidth); height: var(--boxwidth); left: 0; top: 0; border: 1px solid #7788ff; margin: 0; posi...
... starting a new animation or effect, or terminating some dependent operation. function handlecancelevent(event) { log("animation canceled", event); }; then we add a method to handle toggle display between "flex" and "none" and establish it as the handler for a click event on the "hide/show" the box button: document.getelementbyid('togglebox').addeventlistener('click', function() { if (box.style.display == "none") { box.style.display = "flex"; document.getelementbyid("togglebox").innerhtml = "hide the box"; } else { box.style.display = "none"; document.getelementbyid("togglebox").innerhtml = "show the box"; } }); toggling the box to display: none has the effect of aborting its animation. in browsers that support animationcancel, the event is fired and this handler i...
HTMLAnchorElement - Web APIs
the htmlanchorelement interface represents hyperlink elements and provides special properties and methods (beyond those of the regular htmlelement object interface that they inherit from) for manipulating the layout and presentation of such elements. ...
...lar htmlelement object interface that they inherit from) for manipulating the layout and presentation of such elements. ...
HTMLAreaElement - Web APIs
the htmlareaelement interface provides special properties and methods (beyond those of the regular object htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of <area> elements. ...
...he htmlareaelement interface provides special properties and methods (beyond those of the regular object htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of <area> elements. ...
HTMLAudioElement - Web APIs
the htmlaudioelement interface provides access to the properties of <audio> elements, as well as methods to manipulate them. it's based on, and inherits properties and methods from, the htmlmediaelement interface. ...
... the htmlaudioelement interface provides access to the properties of <audio> elements, as well as methods to manipulate them. it's based on, and inherits properties and methods from, the htmlmediaelement interface. ...
HTMLBRElement - Web APIs
the htmlbrelement interface represents a html line break element (<br>). it inherits from htmlelement. ...
... the htmlbrelement interface represents a html line break element (<br>). it inherits from htmlelement. ...
HTMLBaseElement - Web APIs
the htmlbaseelement interface contains the base uri for a document. this object inherits all of the properties and methods as described in the htmlelement interface. ...
... the htmlbaseelement interface contains the base uri for a document. this object inherits all of the properties and methods as described in the htmlelement interface. ...
HTMLBodyElement - Web APIs
the htmlbodyelement interface provides special properties (beyond those inherited from the regular htmlelement interface) for manipulating <body> elements. ...
... the htmlbodyelement interface provides special properties (beyond those inherited from the regular htmlelement interface) for manipulating <body> elements. ...
HTMLCanvasElement.mozGetAsFile() - Web APIs
y out mozgetasfile()</a>.</p> javascript the following code uses mozgetasfile() to create a file object from the canvas and appends it as an image to the page by loading it as a data url using the readasdataurl() method. then a new <img> element is created using the new data url. ...
...zgetasfile() to create a file object from the canvas and appends it as an image to the page by loading it as a data url using the readasdataurl() method. then a new <img> element is created using the new data url. ...
HTMLCanvasElement - Web APIs
the htmlcanvaselement interface provides properties and methods for manipulating the layout and presentation of <canvas> elements. the htmlcanvaselement interface also inherits the properties and methods of the htmlelement interface. ...
... the htmlcanvaselement interface provides properties and methods for manipulating the layout and presentation of <canvas> elements. the htmlcanvaselement interface also inherits the properties and methods of the htmlelement interface. ...
HTMLDListElement - Web APIs
the htmldlistelement interface provides special properties (beyond those of the regular htmlelement interface it also has available to it by inheritance) for manipulating definition list (<dl>) elements. ...
... the htmldlistelement interface provides special properties (beyond those of the regular htmlelement interface it also has available to it by inheritance) for manipulating definition list (<dl>) elements. ...
HTMLDataElement - Web APIs
the htmldataelement interface provides special properties (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating <data> elements. ...
... the htmldataelement interface provides special properties (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating <data> elements. ...
HTMLDataListElement - Web APIs
the htmldatalistelement interface provides special properties (beyond the htmlelement object interface it also has available to it by inheritance) to manipulate <datalist> elements and their content. ...
... the htmldatalistelement interface provides special properties (beyond the htmlelement object interface it also has available to it by inheritance) to manipulate <datalist> elements and their content. ...
HTMLDetailsElement - Web APIs
the htmldetailselement interface provides special properties (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating <details> elements. ...
... the htmldetailselement interface provides special properties (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating <details> elements. ...
HTMLDialogElement - Web APIs
the htmldialogelement interface provides methods to manipulate <dialog> elements. it inherits properties and methods from the htmlelement interface. ...
... the htmldialogelement interface provides methods to manipulate <dialog> elements. it inherits properties and methods from the htmlelement interface. ...
HTMLDivElement - Web APIs
the htmldivelement interface provides special properties (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating <div> elements. ...
... the htmldivelement interface provides special properties (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating <div> elements. ...
HTMLDocument - Web APIs
the htmldocument interface, which may be accessed through the window.htmldocument property, extends the window.htmldocument property to include methods and properties that are specific to html documents. ...
... the htmldocument interface, which may be accessed through the window.htmldocument property, extends the window.htmldocument property to include methods and properties that are specific to html documents. ...
HTMLElement: animationcancel event - Web APIs
animationcancel examples this code gets an element that's currently being animated and adds a listener to the animationcancel event. it then sets the element's display property to none, which will trigger the animationcancel event. ...
...imated = document.queryselector('.animated'); animated.addeventlistener('animationcancel', () => { console.log('animation canceled'); }); animated.style.display = 'none'; the same, but using the onanimationcancel property instead of addeventlistener(): const animated = document.queryselector('.animated'); animated.onanimationcancel = () => { console.log('animation canceled'); }; animated.style.display = 'none'; live example html <div class="animation-example"> <div class="container"> <p class="animation">you chose a cold night to visit our planet.</p> </div> <button class="activate" type="button">activate animation</button> <div class="event-log"></div> </div> css .container { height: 3rem; } .event-log { width: 25rem; height: 2rem; border: 1px so...
HTMLEmbedElement - Web APIs
the htmlembedelement interface provides special properties (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating <embed> elements. this topic describes the htmlembedelement interface as defined in the standard. it does not address earlier, non-standardized version of the interface. ...
...e it also has available to it by inheritance) for manipulating <embed> elements. this topic describes the htmlembedelement interface as defined in the standard. it does not address earlier, non-standardized version of the interface. ...
HTMLFieldSetElement - Web APIs
the htmlfieldsetelement interface provides special properties and methods (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of <fieldset> elements. ...
... the htmlfieldsetelement interface provides special properties and methods (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of <fieldset> elements. ...
HTMLFormControlsCollection - Web APIs
the htmlformcontrolscollection interface represents a collection of html form control elements. it represents the lists returned by the htmlformelement interface's elements property and the htmlfieldsetelement interface's elements property. this interface replaces one method from htmlcollection, on which it is based. ...
...epresents the lists returned by the htmlformelement interface's elements property and the htmlfieldsetelement interface's elements property. this interface replaces one method from htmlcollection, on which it is based. ...
HTMLFormElement - Web APIs
the htmlformelement interface represents a <form> element in the dom. it allows access to—and, in some cases, modification of—aspects of the form, as well as access to its component elements. ...
... the htmlformelement interface represents a <form> element in the dom. it allows access to—and, in some cases, modification of—aspects of the form, as well as access to its component elements. ...
HTMLHRElement - Web APIs
the htmlhrelement interface provides special properties (beyond those of the htmlelement interface it also has available to it by inheritance) for manipulating <hr> elements. ...
... the htmlhrelement interface provides special properties (beyond those of the htmlelement interface it also has available to it by inheritance) for manipulating <hr> elements. ...
HTMLHeadElement - Web APIs
the htmlheadelement interface contains the descriptive information, or metadata, for a document. this object inherits all of the properties and methods described in the htmlelement interface. ...
... the htmlheadelement interface contains the descriptive information, or metadata, for a document. this object inherits all of the properties and methods described in the htmlelement interface. ...
HTMLHeadingElement - Web APIs
the htmlheadingelement interface represents the different heading elements, <h1> through <h6>. it inherits methods and properties from the htmlelement interface. ...
... the htmlheadingelement interface represents the different heading elements, <h1> through <h6>. it inherits methods and properties from the htmlelement interface. ...
HTMLHtmlElement - Web APIs
the htmlhtmlelement interface serves as the root node for a given html document. this object inherits the properties and methods described in the htmlelement interface. you can retrieve the htmlhtmlelement object for a given document by reading the value of the document.documentelement property. ...
...ven html document. this object inherits the properties and methods described in the htmlelement interface. you can retrieve the htmlhtmlelement object for a given document by reading the value of the document.documentelement property. ...
HTMLIFrameElement - Web APIs
the htmliframeelement interface provides special properties and methods (beyond those of the htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of inline frame elements. ...
... the htmliframeelement interface provides special properties and methods (beyond those of the htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of inline frame elements. ...
HTMLImageElement.border - Web APIs
the border property or its longhand properties to not only set the thickness of the border but to potentially apply a wide variety of other styling options to it. ...
... be no border drawn. the default value of border is 0 usage notes do not use border. it is obsolete. instead, use the css border property and its longhand properties to establish borders around images. for example, if you have the following html: <img src="image.png" border="2"> the following will provide the same appearance using css instead of this obsolete property: <img src="image.png" style="border: 2px;"> you can further provide additional information to change the color and other features of the border: <img src="image.png" style="border: dashed 2px #333388;"> specifications specification status comment html living standardthe definition of 'htmlimageelement.border' in that specification. living standard html 4.01 specificationthe de...
HTMLImageElement - Web APIs
the htmlimageelement interface represents an html <img> element, providing the properties and methods used to manipulate image elements. ...
... the htmlimageelement interface represents an html <img> element, providing the properties and methods used to manipulate image elements. ...
HTMLInputElement - Web APIs
the htmlinputelement interface provides special properties and methods for manipulating the options, layout, and presentation of <input> elements. ...
... the htmlinputelement interface provides special properties and methods for manipulating the options, layout, and presentation of <input> elements. ...
HTMLLabelElement - Web APIs
the htmllabelelement interface gives access to properties specific to <label> elements. it inherits methods and properties from the base htmlelement interface. ...
... the htmllabelelement interface gives access to properties specific to <label> elements. it inherits methods and properties from the base htmlelement interface. ...
HTMLLegendElement - Web APIs
the htmllegendelement is an interface allowing to access properties of the <legend> elements. it inherits properties and methods from the htmlelement interface. ...
... the htmllegendelement is an interface allowing to access properties of the <legend> elements. it inherits properties and methods from the htmlelement interface. ...
HTMLMapElement - Web APIs
the htmlmapelement interface provides special properties and methods (beyond those of the regular object htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of map elements. ...
... the htmlmapelement interface provides special properties and methods (beyond those of the regular object htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of map elements. ...
HTMLMediaElement.onencrypted - Web APIs
the onencrypted property of the htmlmediaelement is an event handler, fired whenever an encrypted event occurs, denoting the media is encrypted. this interface inherits from the extendableevent interface. ...
... the onencrypted property of the htmlmediaelement is an event handler, fired whenever an encrypted event occurs, denoting the media is encrypted. this interface inherits from the extendableevent interface. ...
HTMLMediaElement.onwaitingforkey - Web APIs
the onwaitingforkey property of the htmlmediaelement is an event handler, fired when a waitingforkey event occurs, when playback is blocked while waiting for an encryption key. this interface inherits from the extendableevent interface. ...
...y property of the htmlmediaelement is an event handler, fired when a waitingforkey event occurs, when playback is blocked while waiting for an encryption key. this interface inherits from the extendableevent interface. ...
HTMLMediaElement - Web APIs
the htmlmediaelement interface adds to htmlelement the properties and methods needed to support basic media-related capabilities that are common to audio and video. the htmlvideoelement and htmlaudioelement elements both inherit this interface. ...
...ediaelement interface adds to htmlelement the properties and methods needed to support basic media-related capabilities that are common to audio and video. the htmlvideoelement and htmlaudioelement elements both inherit this interface. ...
HTMLMenuElement - Web APIs
the htmlmenuelement interface provides special properties (beyond those defined on the regular htmlelement interface it also has available to it by inheritance) for manipulating <menu> elements. ...
... the htmlmenuelement interface provides special properties (beyond those defined on the regular htmlelement interface it also has available to it by inheritance) for manipulating <menu> elements. ...
HTMLMenuItemElement - Web APIs
the htmlmenuitemelement interface provides special properties (beyond those defined on the regular htmlelement interface it also has available to it by inheritance) for manipulating <menuitem> elements. ...
... the htmlmenuitemelement interface provides special properties (beyond those defined on the regular htmlelement interface it also has available to it by inheritance) for manipulating <menuitem> elements. ...
HTMLMetaElement - Web APIs
the htmlmetaelement interface contains descriptive metadata about a document. it inherits all of the properties and methods described in the htmlelement interface. ...
... the htmlmetaelement interface contains descriptive metadata about a document. it inherits all of the properties and methods described in the htmlelement interface. ...
HTMLMeterElement - Web APIs
the html <meter> elements expose the htmlmeterelement interface, which provides special properties and methods (beyond the htmlelement object interface they also have available to them by inheritance) for manipulating the layout and presentation of <meter> elements. ...
...e the htmlmeterelement interface, which provides special properties and methods (beyond the htmlelement object interface they also have available to them by inheritance) for manipulating the layout and presentation of <meter> elements. ...
HTMLModElement - Web APIs
the htmlmodelement interface provides special properties (beyond the regular methods and properties available through the htmlelement interface they also have available to them by inheritance) for manipulating modification elements, that is <del> and <ins>. ...
...erface provides special properties (beyond the regular methods and properties available through the htmlelement interface they also have available to them by inheritance) for manipulating modification elements, that is <del> and <ins>. ...
HTMLOListElement - Web APIs
the htmlolistelement interface provides special properties (beyond those defined on the regular htmlelement interface it also has available to it by inheritance) for manipulating ordered list elements. ...
... the htmlolistelement interface provides special properties (beyond those defined on the regular htmlelement interface it also has available to it by inheritance) for manipulating ordered list elements. ...
HTMLObjectElement - Web APIs
the htmlobjectelement interface provides special properties and methods (beyond those on the htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of <object> element, representing external resources. ...
...interface provides special properties and methods (beyond those on the htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of <object> element, representing external resources. ...
HTMLOptGroupElement - Web APIs
the htmloptgroupelement interface provides special properties and methods (beyond the regular htmlelement object interface they also have available to them by inheritance) for manipulating the layout and presentation of <optgroup> elements. ...
...tmloptgroupelement interface provides special properties and methods (beyond the regular htmlelement object interface they also have available to them by inheritance) for manipulating the layout and presentation of <optgroup> elements. ...
HTMLOptionElement - Web APIs
the htmloptionelement interface represents <option> elements and inherits all classes and methods of the htmlelement interface. ...
... the htmloptionelement interface represents <option> elements and inherits all classes and methods of the htmlelement interface. ...
HTMLOptionsCollection - Web APIs
the htmloptionscollection interface represents a collection of <option> html elements (in document order) and offers methods and properties for selecting from the list as well as optionally altering its items. this object is returned only by the options property of select. ...
...tion of <option> html elements (in document order) and offers methods and properties for selecting from the list as well as optionally altering its items. this object is returned only by the options property of select. ...
HTMLOrForeignElement.dataset - Web APIs
acters: dash (-), dot (.), colon (:), underscore (_)—but not any ascii capital letters (a to z). in javascript, the name of a custom data attribute is the name of the same html attribute, but in camelcase and with no dashes, dots, etc. in addition to the information below, you'll find a how-to guide for using html data attributes in our article using data attributes. ...
...a custom data attribute name is transformed to a key for the domstringmap entry with the following rules the prefix data- is removed (including the dash); for any dash (u+002d) followed by an ascii lowercase letter a to z, the dash is removed, and the letter is transformed into its uppercase counterpart; other characters (including other dashes) are left unchanged. ...
HTMLElement.focus() - Web APIs
living standard html 5.1the definition of 'focus' in that specification. recommendation h...
... living standard html 5.1the definition of 'focus' in that specification. recommendation html5the definition of 'focus' in that specification. recommendation ...
HTMLOutputElement - Web APIs
the htmloutputelement interface provides properties and methods (beyond those inherited from htmlelement) for manipulating the layout and presentation of <output> elements. ...
... the htmloutputelement interface provides properties and methods (beyond those inherited from htmlelement) for manipulating the layout and presentation of <output> elements. ...
HTMLParagraphElement - Web APIs
the htmlparagraphelement interface provides special properties (beyond those of the regular htmlelement object interface it inherits) for manipulating <p> elements. ...
... the htmlparagraphelement interface provides special properties (beyond those of the regular htmlelement object interface it inherits) for manipulating <p> elements. ...
HTMLParamElement - Web APIs
the htmlparamelement interface provides special properties (beyond those of the regular htmlelement object interface it inherits) for manipulating <param> elements, representing a pair of a key and a value that acts as a parameter for an <object> element. ...
... interface provides special properties (beyond those of the regular htmlelement object interface it inherits) for manipulating <param> elements, representing a pair of a key and a value that acts as a parameter for an <object> element. ...
HTMLPictureElement - Web APIs
the htmlpictureelement interface represents a <picture> html element. it doesn't implement specific properties or methods. ...
... the htmlpictureelement interface represents a <picture> html element. it doesn't implement specific properties or methods. ...
HTMLPreElement - Web APIs
the htmlpreelement interface exposes specific properties and methods (beyond those of the htmlelement interface it also has available to it by inheritance) for manipulating a block of preformatted text (<pre>). ...
... the htmlpreelement interface exposes specific properties and methods (beyond those of the htmlelement interface it also has available to it by inheritance) for manipulating a block of preformatted text (<pre>). ...
HTMLProgressElement - Web APIs
the htmlprogresselement interface provides special properties and methods (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of <progress> elements. ...
... the htmlprogresselement interface provides special properties and methods (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of <progress> elements. ...
HTMLQuoteElement - Web APIs
the htmlquoteelement interface provides special properties and methods (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating quoting elements, like <blockquote> and <q>, but not the <cite> element. ...
...teelement interface provides special properties and methods (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating quoting elements, like <blockquote> and <q>, but not the <cite> element. ...
HTMLScriptElement - Web APIs
inherited htmlelement interface). javascript files should be served with the application/javascript mime type, but browsers are lenient and block them only if the script is served with an image type (image/*), video type (video/*), audio type (audio/*), or text/csv. if the script is blocked, its element receives an error event; otherwise, it receives a load event. ...
...ient and block them only if the script is served with an image type (image/*), video type (video/*), audio type (audio/*), or text/csv. if the script is blocked, its element receives an error event; otherwise, it receives a load event. ...
HTMLShadowElement - Web APIs
the htmlshadowelement interface represents a <shadow> html element, which is used in shadow dom. ...
... the htmlshadowelement interface represents a <shadow> html element, which is used in shadow dom. ...
HTMLSourceElement - Web APIs
the htmlsourceelement interface provides special properties (beyond the regular htmlelement object interface it also has available to it by inheritance) for manipulating <source> elements. ...
... the htmlsourceelement interface provides special properties (beyond the regular htmlelement object interface it also has available to it by inheritance) for manipulating <source> elements. ...
HTMLSpanElement - Web APIs
the htmlspanelement interface represents a <span> element and derives from the htmlelement interface, but without implementing any additional properties or methods. ...
... the htmlspanelement interface represents a <span> element and derives from the htmlelement interface, but without implementing any additional properties or methods. ...
HTMLTableCaptionElement - Web APIs
the htmltablecaptionelement interface special properties (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating table caption elements. ...
... the htmltablecaptionelement interface special properties (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating table caption elements. ...
HTMLTableCellElement - Web APIs
the htmltablecellelement interface provides special properties and methods (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of table cells, either header or data cells, in an html document. ...
...rovides special properties and methods (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of table cells, either header or data cells, in an html document. ...
HTMLTableColElement - Web APIs
the htmltablecolelement interface provides special properties (beyond the htmlelement interface it also has available to it inheritance) for manipulating single or grouped table column elements. ...
... the htmltablecolelement interface provides special properties (beyond the htmlelement interface it also has available to it inheritance) for manipulating single or grouped table column elements. ...
HTMLTableElement.bgColor - Web APIs
also available on dom tbody, row and cell objects. ...
... also available on dom tbody, row and cell objects. ...
HTMLTableElement - Web APIs
the htmltableelement interface provides special properties and methods (beyond the regular htmlelement object interface it also has available to it by inheritance) for manipulating the layout and presentation of tables in an html document. ...
...htmltableelement interface provides special properties and methods (beyond the regular htmlelement object interface it also has available to it by inheritance) for manipulating the layout and presentation of tables in an html document. ...
HTMLTableRowElement - Web APIs
the htmltablerowelement interface provides special properties and methods (beyond the htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of rows in an html table. ...
... the htmltablerowelement interface provides special properties and methods (beyond the htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of rows in an html table. ...
HTMLTableSectionElement - Web APIs
the htmltablesectionelement interface provides special properties and methods (beyond the htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of sections, that is headers, footers and bodies, in an html table. ...
...face provides special properties and methods (beyond the htmlelement interface it also has available to it by inheritance) for manipulating the layout and presentation of sections, that is headers, footers and bodies, in an html table. ...
HTMLTemplateElement - Web APIs
the htmltemplateelement interface enables access to the contents of an html <template> element. ...
... the htmltemplateelement interface enables access to the contents of an html <template> element. ...
HTMLTimeElement - Web APIs
the htmltimeelement interface provides special properties (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating <time> elements. ...
... the htmltimeelement interface provides special properties (beyond the regular htmlelement interface it also has available to it by inheritance) for manipulating <time> elements. ...
HTMLTitleElement - Web APIs
the htmltitleelement interface contains the title for a document. this element inherits all of the properties and methods of the htmlelement interface. ...
... the htmltitleelement interface contains the title for a document. this element inherits all of the properties and methods of the htmlelement interface. ...
HTMLTrackElement - Web APIs
the htmltrackelement interface represents an html <track> element within the dom. this element can be used as a child of either <audio> or <video> to specify a text track containing information such as closed captions or subtitles. ...
... the htmltrackelement interface represents an html <track> element within the dom. this element can be used as a child of either <audio> or <video> to specify a text track containing information such as closed captions or subtitles. ...
HTMLUListElement - Web APIs
the htmlulistelement interface provides special properties (beyond those defined on the regular htmlelement interface it also has available to it by inheritance) for manipulating unordered list elements. ...
... the htmlulistelement interface provides special properties (beyond those defined on the regular htmlelement interface it also has available to it by inheritance) for manipulating unordered list elements. ...
HTMLUnknownElement - Web APIs
the htmlunknownelement interface represents an invalid html element and derives from the htmlelement interface, but without implementing any additional properties or methods. ...
... the htmlunknownelement interface represents an invalid html element and derives from the htmlelement interface, but without implementing any additional properties or methods. ...
HTMLVideoElement - Web APIs
. it also inherits properties and methods of htmlmediaelement and htmlelement. the list of supported media formats varies from one browser to the other. you should either provide your video in a single format that all the relevant browsers supports, or provide multiple video sources in enough different formats that all the browsers you need to support are covered. ...
...ther. you should either provide your video in a single format that all the relevant browsers supports, or provide multiple video sources in enough different formats that all the browsers you need to support are covered. ...
HashChangeEvent - Web APIs
the hashchangeevent interface represents events that fire when the fragment identifier of the url has changed. the fragment identifier is the part of the url that follows (and includes) the # symbol. ...
... the hashchangeevent interface represents events that fire when the fragment identifier of the url has changed. the fragment identifier is the part of the url that follows (and includes) the # symbol. ...
Ajax navigation example - Web APIs
it is shared between all ajax pages.
...="first_page.php">first example</a> | <a class="ajax-nav" href="second_page.php">second example</a> | <a class="ajax-nav" href="third_page.php">third example</a> | <a class="ajax-nav" href="unexisting.php">unexisting page</a> ] </p> include/header.php: <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="js/ajax_nav.js"></script> <link rel="stylesheet" href="css/style.css" /> js/ajax_nav.js: "use strict"; const ajaxrequest = new (function () { function closereq () { oloadingbox.parentnode && document.body.removechild(oloadingbox); bisloading = false; } function abortreq () { if (!bisloading) { return; } oreq.abort(); closereq(); } function ajaxerror () { alert("un...
IDBCursorWithValue - Web APIs
ecord keys. the cursor enables an application to asynchronously process all the records in the cursor's range. you can have an unlimited number of cursors at the same time. you always get the same idbcursorwithvalue object representing a given cursor. operations are performed on the underlying index or object store. note: this feature is available in web workers. ...
...cursors at the same time. you always get the same idbcursorwithvalue object representing a given cursor. operations are performed on the underlying index or object store. note: this feature is available in web workers. ...
IDBDatabase - Web APIs
le in web workers. note: everything you do in indexeddb always happens in the context of a transaction, representing interactions with data in the database. all objects in indexeddb — including object stores, indexes, and cursors — are tied to a particular transaction. thus, you cannot execute commands, access data, or open anything outside of a transaction. ...
... database. all objects in indexeddb — including object stores, indexes, and cursors — are tied to a particular transaction. thus, you cannot execute commands, access data, or open anything outside of a transaction. ...
IDBOpenDBRequest - Web APIs
the idbopendbrequest interface of the indexeddb api provides access to the results of requests to open or delete databases (performed using idbfactory.open and idbfactory.deletedatabase), using specific event handler attributes. note: this feature is available in web workers. ...
...s access to the results of requests to open or delete databases (performed using idbfactory.open and idbfactory.deletedatabase), using specific event handler attributes. note: this feature is available in web workers. ...
IDBRequest - Web APIs
e result property and an event indicating success is fired at the request (idbrequest.onsuccess). if an error occurs while performing the operation, the exception is made available through the result property and an error event is fired (idbrequest.onerror). the interface idbopendbrequest is derived from idbrequest. note: this feature is available in web workers. ...
... the exception is made available through the result property and an error event is fired (idbrequest.onerror). the interface idbopendbrequest is derived from idbrequest. note: this feature is available in web workers. ...
IDBTransaction - Web APIs
attributes. all reading and writing of data is done within transactions. you use idbdatabase to start transactions, idbtransaction to set the mode of the transaction (e.g. is it readonly or readwrite), and you access an idbobjectstore to make a request. you can also use an idbtransaction object to abort transactions. note: this feature is available in web workers. ...
...f the transaction (e.g. is it readonly or readwrite), and you access an idbobjectstore to make a request. you can also use an idbtransaction object to abort transactions. note: this feature is available in web workers. ...
InputEvent - Web APIs
the inputevent interface represents an event notifying of editable content change. ...
... the inputevent interface represents an event notifying of editable content change. ...
InstallEvent - Web APIs
the parameter passed into the oninstall handler, the installevent interface represents an install action that is dispatched on the serviceworkerglobalscope of a serviceworker. as a child of extendableevent, it ensures that functional events such as fetchevent are not dispatched during installation. this interface inherits from the extendableevent interface. ...
...kerglobalscope of a serviceworker. as a child of extendableevent, it ensures that functional events such as fetchevent are not dispatched during installation. this interface inherits from the extendableevent interface. ...
KeyboardEvent - Web APIs
ent events just indicate what interaction the user had with a key on the keyboard at a low level, providing no contextual meaning to that interaction. when you need to handle text input, use the input event instead. keyboard events may not be fired if the user is using an alternate means of entering text, such as a handwriting system on a tablet or graphics tablet. ...
...n. when you need to handle text input, use the input event instead. keyboard events may not be fired if the user is using an alternate means of entering text, such as a handwriting system on a tablet or graphics tablet. ...
MathMLElement - Web APIs
the mathmlelement interface represents any mathml element. ...
... the mathmlelement interface represents any mathml element. ...
MediaKeyMessageEvent - Web APIs
the mediakeymessageevent interface of the encryptedmediaextensions api contains the content and related data when the content decryption module generates a message for the session. ...
... the mediakeymessageevent interface of the encryptedmediaextensions api contains the content and related data when the content decryption module generates a message for the session. ...
MediaKeySession.onkeystatuseschange - Web APIs
the onkeystatuseschange property of the mediakeysession is an event handler, fired whenever a keystatuschange event ocurrs, denoting there has been a change in the keys or their statuses within a session. this interface inherits from the extendableevent interface. ...
...keysession is an event handler, fired whenever a keystatuschange event ocurrs, denoting there has been a change in the keys or their statuses within a session. this interface inherits from the extendableevent interface. ...
MediaKeySession.onmessage - Web APIs
the onmessage property of the mediakeysession is an event handler, fired whenever a mediakeymessageevent occurs, denoting a message is generated by the content decryption module. this interface inherits from the extendableevent interface. ...
...rty of the mediakeysession is an event handler, fired whenever a mediakeymessageevent occurs, denoting a message is generated by the content decryption module. this interface inherits from the extendableevent interface. ...
MediaList.mediaText - Web APIs
each one is separated by a comma, for example screen and (min-width: 480px), print. ...
...s separated by commas, e.g. screen, print. note that the medialist is a live list; updating the list via mediatext will immediately update the behavior of the document. also note that is you try to set mediatext to null, it will be treated as an empty string, i.e. the value will be set to "". examples the following would log to the console a textual representation of the medialist of the first stylesheet applied to the current document. const stylesheets = document.stylesheets; let stylesheet = stylesheets[0]; console.log(stylesheet.media.mediatext); specifications specification status comment css object model (cssom)the definition of 'mediatext' in that specification. working draft ...
MediaList - Web APIs
Web › API › MediaList
those set using a <link> element's media attribute. note: medialist is a live list; updating the list using properties or methods listed below will immediately update the behavior of the document. properties medialist.mediatext a stringifier that returns a domstring representing the medialist as text, and also allows you to set a new medialist. medialist.length read only returns the number of media queries in the medialist. methods medialist.appendmedium() adds a media query to the medialist. medialist.deletemedium() removes a media query from the medialist. ...
... methods medialist.appendmedium() adds a media query to the medialist. medialist.deletemedium() removes a media query from the medialist. medialist.item() a getter that returns a cssomstring representing a media query as text, given the media query's index value inside the medialist. examples the following would log to the console a textual representation of the medialist of the first stylesheet applied to the current document. const stylesheets = document.stylesheets; let stylesheet = stylesheets[0]; console.log(stylesheet.media.mediatext); specifications specification status comment css object model (cssom)the definition of 'medialist' in that specification. working draft ...
MediaQueryList.addListener() - Web APIs
rd function, and the event object is a mediaquerylistevent, which inherits from event. return value void. ...
... working draft initial definition ...
MediaQueryList.removeListener() - Web APIs
ylistlistener object. in the new implementation the standard event mechanism is used, and the callback is a standard function. return value void. ...
... working draft initial definition ...
MediaQueryListEvent.matches - Web APIs
ax var matches = mediaquerylistevent.matches; value a boolean; returns true if the document currently matches the media query list, false if not. ...
... working draft initial definition ...
MediaQueryListEvent.media - Web APIs
ng representing a serialized media query. syntax var media = mediaquerylistevent.media; value a domstring representing a serialized media query. ...
... working draft initial definition ...
MediaQueryListEvent - Web APIs
domstring representing a serialized media query. methods the mediaquerylistevent interface inherits methods from its parent interface, event. ...
... working draft initial definition ...
MediaSource - Web APIs
the mediasource interface of the media source extensions api represents a source of media data for an htmlmediaelement object. a mediasource object can be attached to a htmlmediaelement to be played in the user agent. ...
... the mediasource interface of the media source extensions api represents a source of media data for an htmlmediaelement object. a mediasource object can be attached to a htmlmediaelement to be played in the user agent. ...
MediaStreamTrack: mute event - Web APIs
cancelable no interface event event handler property onmute examples in this example, event handlers are established for the mute and unmute events in order to detect when the media is not flowing from the source for the mediastreamtrack referenced by musictrack. musictrack.addeventlistener("mute", event => { document.getelementbyid("timeline-widget").style.backgroundcolor = "#aaa"; }, false); musictrack.addeventlistener("unmute", event => { document.getelementbyid("timeline-widget").style.backgroundcolor = "#fff"; }, false); with these event handlers in place, when the track musictrack enters its muted state, the element with the id timeline-widget gets its background color changed to #aaa. when the track exits the muted state—detected by the...
... muted state—detected by the arrival of an unmute event—the background color is restored to white. you can also use the onmute event handler property to set up a handler for this event; similarly, the onunmute event handler is available for setting up a handler for the unmute event. the following example shows this: musictrack.onmute = event => { document.getelementbyid("timeline-widget").style.backgroundcolor = "#aaa"; } musictrack.mute = event = > { document.getelementbyid("timeline-widget").style.backgroundcolor = "#fff"; } specifications specification status comment media capture and streamsthe definition of 'mute' in that specification. candidate recommendation initial specification. ...
MediaStreamTrack: unmute event - Web APIs
tually managed using the mediastreamtrack.enabled property, for which there are no events. examples in this example, event handlers are established for the mute and unmute events in order to detect when the media is not flowing from the source for the mediastreamtrack stored in the variable musictrack. musictrack.addeventlistener("mute", event => { document.getelementbyid("timeline-widget").style.backgroundcolor = "#aaa"; }, false); musictrack.addeventlistener("unmute", event => { document.getelementbyid("timeline-widget").style.backgroundcolor = "#fff"; }, false); with these event handlers in place, when the track musictrack enters its muted state, the element with the id timeline-widget gets its background color changed to #aaa. when the track exits the muted state—detected by the...
...e muted state—detected by the arrival of an unmuted event—the background color is restored to white. you can also use the onunmute event handler property to set up a handler for this event; similarly, the onmute event handler is available for setting up a handler for the mute event. the following example shows this: musictrack.onmute = event => { document.getelementbyid("timeline-widget").style.backgroundcolor = "#aaa"; } musictrack.mute = event = > { document.getelementbyid("timeline-widget").style.backgroundcolor = "#fff"; } specifications specification status comment media capture and streamsthe definition of 'unmute' in that specification. candidate recommendation initial specification. ...
MediaStreamTrackEvent - Web APIs
the mediastreamtrackevent interface represents events which indicate that a mediastream has had tracks added to or removed from the stream through calls to media stream api methods. these events are sent to the stream when these changes occur. ...
...t interface represents events which indicate that a mediastream has had tracks added to or removed from the stream through calls to media stream api methods. these events are sent to the stream when these changes occur. ...
MessageEvent - Web APIs
etc.) broadcast channels (see broadcastchannel.postmessage()) and broadcastchannel.onmessage). webrtc data channels (see rtcdatachannel.onmessage). the action triggered by this event is defined in a function set as the event handler for the relevant message event (e.g. using an onmessage handler as listed above). note: this feature is available in web workers. ...
.... the action triggered by this event is defined in a function set as the event handler for the relevant message event (e.g. using an onmessage handler as listed above). note: this feature is available in web workers. ...
MouseEvent - Web APIs
nclude click, dblclick, mouseup, mousedown. mouseevent derives from uievent, which in turn derives from event. though the mouseevent.initmouseevent() method is kept for backward compatibility, creating of a mouseevent object should be done using the mouseevent() constructor. several more specific events are based on mouseevent, including wheelevent and dragevent. ...
...() method is kept for backward compatibility, creating of a mouseevent object should be done using the mouseevent() constructor. several more specific events are based on mouseevent, including wheelevent and dragevent. ...
Node - Web APIs
Web › API › Node
cumenttype, notation, entity, and entityreference. in some cases, a particular feature of the base node interface may not apply to one of its child interfaces; in that case, the inheriting node may return null or throw an exception, depending on circumstances. for example, attempting to add children to a node type that cannot have children will throw an exception. ...
... interfaces; in that case, the inheriting node may return null or throw an exception, depending on circumstances. for example, attempting to add children to a node type that cannot have children will throw an exception. ...
OfflineAudioContext - Web APIs
the offlineaudiocontext interface is an audiocontext interface representing an audio-processing graph built from linked together audionodes. in contrast with a standard audiocontext, an offlineaudiocontext doesn't render the audio to the device hardware; instead, it generates it, as fast as it can, and outputs the result to an audiobuffer. ...
...gether audionodes. in contrast with a standard audiocontext, an offlineaudiocontext doesn't render the audio to the device hardware; instead, it generates it, as fast as it can, and outputs the result to an audiobuffer. ...
PageTransitionEvent - Web APIs
the pagetransitionevent event object is available inside handler functions for the pageshow and pagehide events, fired when a document is being loaded or unloaded. ...
... the pagetransitionevent event object is available inside handler functions for the pageshow and pagehide events, fired when a document is being loaded or unloaded. ...
PaintWorklet - Web APIs
out a reference to paintworklet. class checkerboardpainter { paint(ctx, geom, properties) { // use `ctx` as if it was a normal canvas const colors = ['red', 'green', 'blue']; const size = 32; for(let y = 0; y < geom.height/size; y++) { for(let x = 0; x < geom.width/size; x++) { const color = colors[(x + y) % colors.length]; ctx.beginpath(); ctx.fillstyle = color; ctx.rect(x * size, y * size, size, size); ctx.fill(); } } } } // register our class under a specific name registerpaint('checkerboard', checkerboardpainter); load a paintworklet the following example demonstrates loading the above worklet from its js file and does so by feature detection. <script> if ('paintworklet' in css) { css.paintworklet.addmodu...
...ster our class under a specific name registerpaint('checkerboard', checkerboardpainter); load a paintworklet the following example demonstrates loading the above worklet from its js file and does so by feature detection. <script> if ('paintworklet' in css) { css.paintworklet.addmodule('checkerboard.js'); } </script> use a paintworklet this example shows how to use a paintworklet in a stylesheet, including the simplest way to provide a fallback if paintworklet isn't supported. <style> textarea { background-image: url(checkerboard); background-image: paint(checkerboard); } </style> <textarea></textarea> you can also use the @supports at-rule. @supports (background: paint(id)) { background-image: paint(checkerboard); } specifications specification statu...
PerformanceFrameTiming - Web APIs
a good responsive user experience. this means the browser should process a frame in about 16.7ms. an application can register a performanceobserver for "frame" performance entry types and the observer can retrieve data about the duration of each frame event. this information can be used to help identify areas that take too long to provide a good user experience. ...
...er for "frame" performance entry types and the observer can retrieve data about the duration of each frame event. this information can be used to help identify areas that take too long to provide a good user experience. ...
PerformanceLongTaskTiming - Web APIs
the performancelongtasktiming interface of the the long tasks api reports instances of long tasks. ...
... the performancelongtasktiming interface of the the long tasks api reports instances of long tasks. ...
PerformanceMark - Web APIs
performancemark is an abstract interface for performanceentry objects with an entrytype of "mark". entries of this type are created by calling performance.mark() to add a named domhighrestimestamp (the mark) to the browser's performance timeline. ...
...act interface for performanceentry objects with an entrytype of "mark". entries of this type are created by calling performance.mark() to add a named domhighrestimestamp (the mark) to the browser's performance timeline. ...
PerformanceMeasure - Web APIs
performancemeasure is an abstract interface for performanceentry objects with an entrytype of "measure". entries of this type are created by calling performance.measure() to add a named domhighrestimestamp (the measure) between two marks to the browser's performance timeline. ...
...ceentry objects with an entrytype of "measure". entries of this type are created by calling performance.measure() to add a named domhighrestimestamp (the measure) between two marks to the browser's performance timeline. ...
PerformanceNavigationTiming - Web APIs
the performancenavigationtiming interface provides methods and properties to store and retrieve metrics regarding the browser's document navigation events. for example, this interface can be used to determine how much time it takes to load or unload a document. ...
...provides methods and properties to store and retrieve metrics regarding the browser's document navigation events. for example, this interface can be used to determine how much time it takes to load or unload a document. ...
PerformancePaintTiming - Web APIs
ender") operations during web page construction. "paint" refers to conversion of the render tree to on-screen pixels. an application can register a performanceobserver for "paint" performance entry types and the observer can retrieve the times that paint events occur. use this information to help identify areas that take too long to provide a good user experience. ...
... performanceobserver for "paint" performance entry types and the observer can retrieve the times that paint events occur. use this information to help identify areas that take too long to provide a good user experience. ...
PerformanceResourceTiming - Web APIs
meline with high-resolution timestamps for network events such as redirect start and end times, fetch start, dns lookup start and end times, response start and end times, etc.. additionally, the interface extends performanceentry with other properties which provide data about the size of the fetched resource as well as the type of resource that initiated the fetch. ...
...e start and end times, etc.. additionally, the interface extends performanceentry with other properties which provide data about the size of the fetched resource as well as the type of resource that initiated the fetch. ...
Pointer Lock API - Web APIs
if you lock one iframe, you cannot try to lock another iframe and transfer the target to it; pointer lock will error out. to avoid this limitation, first unl...
...if you lock one iframe, you cannot try to lock another iframe and transfer the target to it; pointer lock will error out. to avoid this limitation, first unlock the locked iframe, and then lock the other. while iframes work by default...
PromiseRejectionEvent - Web APIs
the promiserejectionevent interface represents events which are sent to the global script context when javascript promises are rejected. these events are particularly useful for telemetry and debugging purposes. for details on promise rejection events, see promise rejection events in using promises. ...
...nt to the global script context when javascript promises are rejected. these events are particularly useful for telemetry and debugging purposes. for details on promise rejection events, see promise rejection events in using promises. ...
RTCDTMFSender - Web APIs
pose for webrtc's dtmf support is to allow webrtc-based communication clients to be connected to a public-switched telephone network (pstn) or other legacy telephone service, including extant voice over ip (voip) services. for that reason, dtmf can't be used between two webrtc-based devices, because there is no mechanism provided by webrtc for receiving dtmf codes. ...
... legacy telephone service, including extant voice over ip (voip) services. for that reason, dtmf can't be used between two webrtc-based devices, because there is no mechanism provided by webrtc for receiving dtmf codes. ...
RTCDtlsTransport - Web APIs
dtls transport is also used to provide information about sctp packets transmitted and received by an connection's data channels. features of the dtls transport include the addition of security to the underlying transport; the rtcdtlstransport interface can be used to obtain information about the underlying transport and the security added to it by the dtls layer. ...
...tls transport include the addition of security to the underlying transport; the rtcdtlstransport interface can be used to obtain information about the underlying transport and the security added to it by the dtls layer. ...
RTCPeerConnection - Web APIs
the rtcpeerconnection interface represents a webrtc connection between the local computer and a remote peer. it provides methods to connect to a remote peer, maintain and monitor the connection, and close the connection once it's no longer needed. ...
...ace represents a webrtc connection between the local computer and a remote peer. it provides methods to connect to a remote peer, maintain and monitor the connection, and close the connection once it's no longer needed. ...
RadioNodeList - Web APIs
the radionodelist interface represents a collection of radio elements in a <form> or a <fieldset> element. ...
... the radionodelist interface represents a collection of radio elements in a <form> or a <fieldset> element. ...
ResizeObserverEntry.borderBoxSize - Web APIs
dimension, or width; if the writing-mode is vertical, this is the vertical dimension, or height. note: for more explanation of writing modes and block and inline dimensions, read handling different text directions. ...
...rections. examples const resizeobserver = new resizeobserver(entries => { for (let entry of entries) { if(entry.borderboxsize && entry.borderboxsize.length > 0) { entry.target.style.borderradius = math.min(100, (entry.borderboxsize[0].inlinesize/10) + (entry.borderboxsize[0].blocksize/10)) + 'px'; } else { entry.target.style.borderradius = math.min(100, (entry.contentrect.width/10) + (entry.contentrect.height/10)) + 'px'; } } }); resizeobserver.observe(document.queryselector('div')); specifications specification status comment resize observerthe definition of 'target' in that specification. editor's draft initial definition. ...
ResizeObserverEntry.contentBoxSize - Web APIs
rounded corners change in proportion to the size of the box. we could just implement this using border-radius with a percentage, but that quickly leads to ugly-looking elliptical corners; this solution gives you nice square corners that scale with the box size. ...
...ves you nice square corners that scale with the box size. const resizeobserver = new resizeobserver(entries => { for (let entry of entries) { if(entry.contentboxsize) { entry.target.style.borderradius = math.min(100, (entry.contentboxsize.inlinesize/10) + (entry.contentboxsize.blocksize/10)) + 'px'; } else { entry.target.style.borderradius = math.min(100, (entry.contentrect.width/10) + (entry.contentrect.height/10)) + 'px'; } } }); resizeobserver.observe(document.queryselector('div')); specifications specification status comment resize observerthe definition of 'target' in that specification. editor's draft initial definition. ...
SVGAltGlyphDefElement - Web APIs
the svgaltglyphdefelement interface corresponds to the <altglyphdef> element. ...
... the svgaltglyphdefelement interface corresponds to the <altglyphdef> element. ...
SVGAltGlyphItemElement - Web APIs
the svgaltglyphitemelement interface corresponds to the <altglyphitem> element. ...
... the svgaltglyphitemelement interface corresponds to the <altglyphitem> element. ...
SVGAnimateColorElement - Web APIs
the svganimatecolorelement interface corresponds to the <animatecolor> element. ...
... the svganimatecolorelement interface corresponds to the <animatecolor> element. ...
SVGAnimateElement - Web APIs
the svganimateelement interface corresponds to the <animate> element. ...
... the svganimateelement interface corresponds to the <animate> element. ...
SVGAnimateMotionElement - Web APIs
the svganimatemotionelement interface corresponds to the <animatemotion> element. ...
... the svganimatemotionelement interface corresponds to the <animatemotion> element. ...
SVGAnimateTransformElement - Web APIs
the svganimatetransformelement interface corresponds to the <animatetransform> element. ...
... the svganimatetransformelement interface corresponds to the <animatetransform> element. ...
SVGAnimationElement - Web APIs
the svganimationelement interface is the base interface for all of the animation element interfaces: svganimateelement, svgsetelement, svganimatecolorelement, svganimatemotionelement and svganimatetransformelement. ...
... the svganimationelement interface is the base interface for all of the animation element interfaces: svganimateelement, svgsetelement, svganimatecolorelement, svganimatemotionelement and svganimatetransformelement. ...
SVGCircleElement - Web APIs
the svgcircleelement interface is an interface for the <circle> element. ...
... the svgcircleelement interface is an interface for the <circle> element. ...
SVGClipPathElement - Web APIs
the svgclippathelement interface provides access to the properties of <clippath> elements, as well as methods to manipulate them. ...
... the svgclippathelement interface provides access to the properties of <clippath> elements, as well as methods to manipulate them. ...
SVGComponentTransferFunctionElement - Web APIs
the svgcomponenttransferfunctionelement interface defines a base interface used by the component transfer function interfaces. ...
... the svgcomponenttransferfunctionelement interface defines a base interface used by the component transfer function interfaces. ...
SVGCursorElement - Web APIs
the svgcursorelement interface provides access to the properties of <cursor> elements, as well as methods to manipulate them. ...
... the svgcursorelement interface provides access to the properties of <cursor> elements, as well as methods to manipulate them. ...
SVGDefsElement - Web APIs
the svgdefselement interface corresponds to the <defs> element. ...
... the svgdefselement interface corresponds to the <defs> element. ...
SVGDescElement - Web APIs
the svgdescelement interface corresponds to the <desc> element. ...
... the svgdescelement interface corresponds to the <desc> element. ...
SVGEllipseElement - Web APIs
the svgellipseelement interface provides access to the properties of <ellipse> elements. ...
... the svgellipseelement interface provides access to the properties of <ellipse> elements. ...
SVGExternalResourcesRequired - Web APIs
the svgexternalresourcesrequired interface defines an interface which applies to all elements where this element or one of its descendants can reference an external resource. ...
... the svgexternalresourcesrequired interface defines an interface which applies to all elements where this element or one of its descendants can reference an external resource. ...
SVGFEBlendElement - Web APIs
the svgfeblendelement interface corresponds to the <feblend> element. ...
... the svgfeblendelement interface corresponds to the <feblend> element. ...
SVGFEColorMatrixElement - Web APIs
the svgfecolormatrixelement interface corresponds to the <fecolormatrix> element. ...
... the svgfecolormatrixelement interface corresponds to the <fecolormatrix> element. ...
SVGFEComponentTransferElement - Web APIs
the svgfecomponenttransferelement interface corresponds to the <fecomponenttransfer> element. ...
... the svgfecomponenttransferelement interface corresponds to the <fecomponenttransfer> element. ...
SVGFECompositeElement - Web APIs
the svgfecompositeelement interface corresponds to the <fecomposite> element. ...
... the svgfecompositeelement interface corresponds to the <fecomposite> element. ...
SVGFEConvolveMatrixElement - Web APIs
the svgfeconvolvematrixelement interface corresponds to the <feconvolvematrix> element. ...
... the svgfeconvolvematrixelement interface corresponds to the <feconvolvematrix> element. ...
SVGFEDiffuseLightingElement - Web APIs
the svgfediffuselightingelement interface corresponds to the <fediffuselighting> element. ...
... the svgfediffuselightingelement interface corresponds to the <fediffuselighting> element. ...
SVGFEDisplacementMapElement - Web APIs
the svgfedisplacementmapelement interface corresponds to the <fedisplacementmap> element. ...
... the svgfedisplacementmapelement interface corresponds to the <fedisplacementmap> element. ...
SVGFEDistantLightElement - Web APIs
the svgfedistantlightelement interface corresponds to the <fedistantlight> element. ...
... the svgfedistantlightelement interface corresponds to the <fedistantlight> element. ...
SVGFEDropShadowElement - Web APIs
the svgfedropshadowelement interface corresponds to the <fedropshadow> element. ...
... the svgfedropshadowelement interface corresponds to the <fedropshadow> element. ...
SVGFEFloodElement - Web APIs
the svgfefloodelement interface corresponds to the <feflood> element. ...
... the svgfefloodelement interface corresponds to the <feflood> element. ...
SVGFEFuncAElement - Web APIs
the svgfefuncaelement interface corresponds to the <fefunca> element. ...
... the svgfefuncaelement interface corresponds to the <fefunca> element. ...
SVGFEFuncBElement - Web APIs
the svgfefuncbelement interface corresponds to the <fefuncb> element. ...
... the svgfefuncbelement interface corresponds to the <fefuncb> element. ...
SVGFEFuncGElement - Web APIs
the svgfefuncgelement interface corresponds to the <fefuncg> element. ...
... the svgfefuncgelement interface corresponds to the <fefuncg> element. ...
SVGFEFuncRElement - Web APIs
the svgfefuncrelement interface corresponds to the <fefuncr> element. ...
... the svgfefuncrelement interface corresponds to the <fefuncr> element. ...
SVGFEGaussianBlurElement - Web APIs
the svgfegaussianblurelement interface corresponds to the <fegaussianblur> element. ...
... the svgfegaussianblurelement interface corresponds to the <fegaussianblur> element. ...
SVGFEImageElement - Web APIs
the svgfeimageelement interface corresponds to the <feimage> element. ...
... the svgfeimageelement interface corresponds to the <feimage> element. ...
SVGFEMergeElement - Web APIs
the svgfemergeelement interface corresponds to the <femerge> element. ...
... the svgfemergeelement interface corresponds to the <femerge> element. ...
SVGFEMergeNodeElement - Web APIs
the svgfemergenodeelement interface corresponds to the <femergenode> element. ...
... the svgfemergenodeelement interface corresponds to the <femergenode> element. ...
SVGFEMorphologyElement - Web APIs
the svgfemorphologyelement interface corresponds to the <femorphology> element. ...
... the svgfemorphologyelement interface corresponds to the <femorphology> element. ...
SVGFEOffsetElement - Web APIs
the svgfeoffsetelement interface corresponds to the <feoffset> element. ...
... the svgfeoffsetelement interface corresponds to the <feoffset> element. ...
SVGFEPointLightElement - Web APIs
the svgfepointlightelement interface corresponds to the <fepointlight> element. ...
... the svgfepointlightelement interface corresponds to the <fepointlight> element. ...
SVGFESpecularLightingElement - Web APIs
the svgfespecularlightingelement interface corresponds to the <fespecularlighting> element. ...
... the svgfespecularlightingelement interface corresponds to the <fespecularlighting> element. ...
SVGFESpotLightElement - Web APIs
the svgfespotlightelement interface corresponds to the <fespotlight> element. ...
... the svgfespotlightelement interface corresponds to the <fespotlight> element. ...
SVGFETileElement - Web APIs
the svgfetileelement interface corresponds to the <fetile> element. ...
... the svgfetileelement interface corresponds to the <fetile> element. ...
SVGFETurbulenceElement - Web APIs
the svgfeturbulenceelement interface corresponds to the <feturbulence> element. ...
... the svgfeturbulenceelement interface corresponds to the <feturbulence> element. ...
SVGFilterElement - Web APIs
the svgfilterelement interface provides access to the properties of <filter> elements, as well as methods to manipulate them. ...
... the svgfilterelement interface provides access to the properties of <filter> elements, as well as methods to manipulate them. ...
SVGFilterPrimitiveStandardAttributes - Web APIs
the svgfilterprimitivestandardattributes interface defines the set of dom attributes that are common across the filter primitive interfaces. ...
... the svgfilterprimitivestandardattributes interface defines the set of dom attributes that are common across the filter primitive interfaces. ...
SVGFontElement - Web APIs
the svgfontelement interface corresponds to the <font> elements. object-oriented access to the attributes of the <font> element via the svg dom is not possible. ...
... the svgfontelement interface corresponds to the <font> elements. object-oriented access to the attributes of the <font> element via the svg dom is not possible. ...
SVGFontFaceElement - Web APIs
the svgfontfaceelement interface corresponds to the <font-face> elements. object-oriented access to the attributes of the <font-face> element via the svg dom is not possible. ...
... the svgfontfaceelement interface corresponds to the <font-face> elements. object-oriented access to the attributes of the <font-face> element via the svg dom is not possible. ...
SVGFontFaceFormatElement - Web APIs
the svgfontfaceformatelement interface corresponds to the <font-face-format> elements. object-oriented access to the attributes of the <font-face-format> element via the svg dom is not possible. ...
... the svgfontfaceformatelement interface corresponds to the <font-face-format> elements. object-oriented access to the attributes of the <font-face-format> element via the svg dom is not possible. ...
SVGFontFaceNameElement - Web APIs
the svgfontfacenameelement interface corresponds to the <font-face-name> elements. object-oriented access to the attributes of the <font-face-name> element via the svg dom is not possible. ...
... the svgfontfacenameelement interface corresponds to the <font-face-name> elements. object-oriented access to the attributes of the <font-face-name> element via the svg dom is not possible. ...
SVGFontFaceSrcElement - Web APIs
the svgfontfacesrcelement interface corresponds to the <font-face-src> elements. object-oriented access to the attributes of the <font-face-src> element via the svg dom is not possible. ...
... the svgfontfacesrcelement interface corresponds to the <font-face-src> elements. object-oriented access to the attributes of the <font-face-src> element via the svg dom is not possible. ...
SVGFontFaceUriElement - Web APIs
the svgfontfaceurielement interface corresponds to the <font-face-uri> elements. object-oriented access to the attributes of the <font-face-uri> element via the svg dom is not possible. ...
... the svgfontfaceurielement interface corresponds to the <font-face-uri> elements. object-oriented access to the attributes of the <font-face-uri> element via the svg dom is not possible. ...
SVGForeignObjectElement - Web APIs
the svgforeignobjectelement interface provides access to the properties of <foreignobject> elements, as well as methods to manipulate them. ...
... the svgforeignobjectelement interface provides access to the properties of <foreignobject> elements, as well as methods to manipulate them. ...
SVGGElement - Web APIs
the svggelement interface corresponds to the <g> element. ...
... the svggelement interface corresponds to the <g> element. ...
SVGGeometryElement - Web APIs
the svggeometryelement interface represents svg elements whose rendering is defined by geometry with an equivalent path, and which can be filled and stroked. this includes paths and the basic shapes. ...
... the svggeometryelement interface represents svg elements whose rendering is defined by geometry with an equivalent path, and which can be filled and stroked. this includes paths and the basic shapes. ...
SVGGlyphElement - Web APIs
the svgglyphelement interface corresponds to the <glyph> element. object-oriented access to the attributes of the <glyph> element via the svg dom is not possible. ...
... the svgglyphelement interface corresponds to the <glyph> element. object-oriented access to the attributes of the <glyph> element via the svg dom is not possible. ...
SVGGlyphRefElement - Web APIs
the svgglyphrefelement interface corresponds to the <glyphref> elements. ...
... the svgglyphrefelement interface corresponds to the <glyphref> elements. ...
SVGGradientElement - Web APIs
the svggradient interface is a base interface used by svglineargradientelement and svgradialgradientelement. ...
... the svggradient interface is a base interface used by svglineargradientelement and svgradialgradientelement. ...
SVGGraphicsElement - Web APIs
the svggraphicselement interface represents svg elements whose primary purpose is to directly render graphics into a group. ...
... the svggraphicselement interface represents svg elements whose primary purpose is to directly render graphics into a group. ...
SVGHKernElement - Web APIs
the svghkernelement interface corresponds to the <hkern> elements. object-oriented access to the attributes of the <hkern> element via the svg dom is not possible. ...
... the svghkernelement interface corresponds to the <hkern> elements. object-oriented access to the attributes of the <hkern> element via the svg dom is not possible. ...
SVGImageElement - Web APIs
the svgimageelement interface corresponds to the <image> element. ...
... the svgimageelement interface corresponds to the <image> element. ...
SVGLineElement - Web APIs
the svglineelement interface provides access to the properties of <line> elements, as well as methods to manipulate them. ...
... the svglineelement interface provides access to the properties of <line> elements, as well as methods to manipulate them. ...
SVGLinearGradientElement - Web APIs
the svglineargradientelement interface corresponds to the <lineargradient> element. ...
... the svglineargradientelement interface corresponds to the <lineargradient> element. ...
SVGMPathElement - Web APIs
the svgmpathelement interface corresponds to the <mpath> element. ...
... the svgmpathelement interface corresponds to the <mpath> element. ...
SVGMaskElement - Web APIs
the svgmaskelement interface provides access to the properties of <mask> elements, as well as methods to manipulate them. ...
... the svgmaskelement interface provides access to the properties of <mask> elements, as well as methods to manipulate them. ...
SVGMeshElement - Web APIs
the svgmeshelement interface provides access to the properties of <mesh> elements. ...
... the svgmeshelement interface provides access to the properties of <mesh> elements. ...
SVGMetadataElement - Web APIs
the svgmetadataelement interface corresponds to the <metadata> element. ...
... the svgmetadataelement interface corresponds to the <metadata> element. ...
SVGMissingGlyphElement - Web APIs
the svgmissingglyphelement interface corresponds to the <missing-glyph> elements. object-oriented access to the attributes of the <missing-glyph> element via the svg dom is not possible. ...
... the svgmissingglyphelement interface corresponds to the <missing-glyph> elements. object-oriented access to the attributes of the <missing-glyph> element via the svg dom is not possible. ...
SVGPathElement - Web APIs
the svgpathelement interface corresponds to the <path> element. ...
... the svgpathelement interface corresponds to the <path> element. ...
SVGPatternElement - Web APIs
the svgpatternelement interface corresponds to the <pattern> element. ...
... the svgpatternelement interface corresponds to the <pattern> element. ...
SVGPolygonElement - Web APIs
the svgpolygonelement interface provides access to the properties of <polygon> elements, as well as methods to manipulate them. ...
... the svgpolygonelement interface provides access to the properties of <polygon> elements, as well as methods to manipulate them. ...
SVGPolylineElement - Web APIs
the svgpolylineelement interface provides access to the properties of <polyline> elements, as well as methods to manipulate them. ...
... the svgpolylineelement interface provides access to the properties of <polyline> elements, as well as methods to manipulate them. ...
SVGRadialGradientElement - Web APIs
the svgradialgradientelement interface corresponds to the <radialgradient> element. ...
... the svgradialgradientelement interface corresponds to the <radialgradient> element. ...
The 'X' property - Web APIs
atable yes simple usage a <coordinate> is a length in the user coordinate system that is the given distance from the origin of the user coordinate system along the relevant axis (the x-axis for x coordinates, the y-axis for y coordinates). ...
...ordinates). ...
SVGRect - Web APIs
Web › API › SVGRect
the svgrect represents a rectangle. rectangles consist of an x and y coordinate pair identifying a minimum x value, a minimum y value, and a width and height, which are constrained to be non-negative. an svgrect object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. ...
...imum y value, and a width and height, which are constrained to be non-negative. an svgrect object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. ...
SVGRenderingIntent - Web APIs
the svgrenderingintent interface defines the enumerated list of possible values for rendering-intent attributes or descriptors. ...
... the svgrenderingintent interface defines the enumerated list of possible values for rendering-intent attributes or descriptors. ...
SVGScriptElement - Web APIs
the svgscriptelement interface corresponds to the svg <script> element. ...
... the svgscriptelement interface corresponds to the svg <script> element. ...
SVGSetElement - Web APIs
the svgsetelement interface corresponds to the <set> element. ...
... the svgsetelement interface corresponds to the <set> element. ...
SVGSolidcolorElement - Web APIs
the svgsolidcolorelement interface corresponds to the <solidcolor> element. ...
... the svgsolidcolorelement interface corresponds to the <solidcolor> element. ...
SVGStopElement - Web APIs
the svgstopelement interface corresponds to the <stop> element. ...
... the svgstopelement interface corresponds to the <stop> element. ...
SVGSwitchElement - Web APIs
the svgswitchelement interface corresponds to the <switch> element. ...
... the svgswitchelement interface corresponds to the <switch> element. ...
SVGSymbolElement - Web APIs
the svgsymbolelement interface corresponds to the <symbol> element. ...
... the svgsymbolelement interface corresponds to the <symbol> element. ...
SVGTRefElement - Web APIs
the svgtrefelement interface corresponds to the <tref> elements. object-oriented access to the attributes of the <tref> element via the svg dom is not possible. ...
... the svgtrefelement interface corresponds to the <tref> elements. object-oriented access to the attributes of the <tref> element via the svg dom is not possible. ...
SVGTSpanElement - Web APIs
the svgtspanelement interface represents a <tspan> element. ...
... the svgtspanelement interface represents a <tspan> element. ...
SVGTextContentElement - Web APIs
the svgtextcontentelement interface is implemented by elements that support rendering child text content. it is inherited by various text-related interfaces, such as svgtextelement, svgtspanelement, svgtrefelement, svgaltglyphelement and svgtextpathelement. ...
...ent interface is implemented by elements that support rendering child text content. it is inherited by various text-related interfaces, such as svgtextelement, svgtspanelement, svgtrefelement, svgaltglyphelement and svgtextpathelement. ...
SVGTextElement - Web APIs
the svgtextelement interface corresponds to the <text> elements. ...
... the svgtextelement interface corresponds to the <text> elements. ...
SVGTextPathElement - Web APIs
the svgtextpathelement interface corresponds to the <textpath> element. ...
... the svgtextpathelement interface corresponds to the <textpath> element. ...
SVGTextPositioningElement - Web APIs
the svgtextpositioningelement interface is implemented by elements that support attributes that position individual text glyphs. it is inherited by svgtextelement, svgtspanelement, svgtrefelement and svgaltglyphelement. ...
... the svgtextpositioningelement interface is implemented by elements that support attributes that position individual text glyphs. it is inherited by svgtextelement, svgtspanelement, svgtrefelement and svgaltglyphelement. ...
SVGTitleElement - Web APIs
the svgtitleelement interface corresponds to the <title> element. ...
... the svgtitleelement interface corresponds to the <title> element. ...
SVGURIReference - Web APIs
the svgurireference interface is used to reflect the href attribute and the deprecated xlink:href attribute. ...
... the svgurireference interface is used to reflect the href attribute and the deprecated xlink:href attribute. ...
SVGUnitTypes - Web APIs
the svgunittypes interface defines a commonly used set of constants used for reflecting gradientunits, patterncontentunits and other similar attributes. ...
... the svgunittypes interface defines a commonly used set of constants used for reflecting gradientunits, patterncontentunits and other similar attributes. ...
SVGUseElement - Web APIs
svg use dom interface the svguseelement interface corresponds to the <use> element. ...
... svg use dom interface the svguseelement interface corresponds to the <use> element. ...
SVGVKernElement - Web APIs
the svgvkernelement interface corresponds to the <vkern> elements. object-oriented access to the attributes of the <vkern> element via the svg dom is not possible. ...
... the svgvkernelement interface corresponds to the <vkern> elements. object-oriented access to the attributes of the <vkern> element via the svg dom is not possible. ...
SVGZoomAndPan - Web APIs
the svgzoomandpan interface is used to reflect the zoomandpan attribute, and is mixed in to other interfaces for elements that support this attribute. ...
... the svgzoomandpan interface is used to reflect the zoomandpan attribute, and is mixed in to other interfaces for elements that support this attribute. ...
ServiceWorkerGlobalScope - Web APIs
.onmessage. additionally, synchronous requests are not allowed from within a service worker — only asynchronous requests, like those initiated via the fetch() method, can be used. this interface inherits from the workerglobalscope interface, and its parent eventtarget, and therefore implements properties from windowtimers, windowbase64, and windoweventhandlers. ...
...a the fetch() method, can be used. this interface inherits from the workerglobalscope interface, and its parent eventtarget, and therefore implements properties from windowtimers, windowbase64, and windoweventhandlers. ...
Using Service Workers - Web APIs
le in google's topeka demo, or perhaps store your assets in indexeddb. ...
...uch pages still loaded, the new service worker activates. you’ll want to update your install event listener in the new service worker to something like this (notice the new version number): self.addeventlistener('install', (event) => { event.waituntil( caches.open('v2').then((cache) => { return cache.addall([ './sw-test/', './sw-test/index.html', './sw-test/style.css', './sw-test/app.js', './sw-test/image-list.js', … // include other new resources for the new version... ]); }) ); }); while this happens, the previous version is still responsible for fetches. the new version is installing in the background. we are calling the new cache v2, so the previous v1 cache isn't disturbed. when no pages are using the...
SourceBuffer - Web APIs
the sourcebuffer interface represents a chunk of media to be passed into an htmlmediaelement and played, via a mediasource object. this can be made up of one or several media segments. ...
... the sourcebuffer interface represents a chunk of media to be passed into an htmlmediaelement and played, via a mediasource object. this can be made up of one or several media segments. ...
SourceBufferList - Web APIs
rcebufferlist interface represents a simple container list for multiple sourcebuffer objects. the source buffer list containing the sourcebuffers appended to a particular mediasource can be retrieved using the mediasource.sourcebuffers property. the individual source buffers can be accessed using array operator (i.e. []) or functions such as foreach() for example. ...
...ppended to a particular mediasource can be retrieved using the mediasource.sourcebuffers property. the individual source buffers can be accessed using array operator (i.e. []) or functions such as foreach() for example. ...
SpeechRecognition: result event - Web APIs
onresult examples this code is excerpted from our speech color changer example. ...
... draft ...
StaticRange - Web APIs
the dom staticrange interface extends abstractrange to provide a method to specify a range of content in the dom whose contents don't update to reflect changes which occur within the dom tree. it offers the same set of properties and methods as abstractrange. abstractrange and staticrange are not available from web workers. ...
...e dom whose contents don't update to reflect changes which occur within the dom tree. it offers the same set of properties and methods as abstractrange. abstractrange and staticrange are not available from web workers. ...
StorageEvent - Web APIs
a storageevent is sent to a window when a storage area it has access to is changed within the context of another document. ...
... a storageevent is sent to a window when a storage area it has access to is changed within the context of another document. ...
SyncEvent - Web APIs
Web › API › SyncEvent
the syncevent interface represents a sync action that is dispatched on the serviceworkerglobalscope of a serviceworker. this interface inherits from the extendableevent interface. ...
... the syncevent interface represents a sync action that is dispatched on the serviceworkerglobalscope of a serviceworker. this interface inherits from the extendableevent interface. ...
TaskAttributionTiming - Web APIs
the taskattributiontiming interface of the long tasks api returns information about the work involved in a long task and its associate frame context. the frame context, also called the container, is the iframe, embed or object that is being implicated, on the whole, for a long task. ...
...s information about the work involved in a long task and its associate frame context. the frame context, also called the container, is the iframe, embed or object that is being implicated, on the whole, for a long task. ...
Text - Web APIs
Web › API › Text
text. however, if the element contains markup, it is parsed into information items and text nodes that form its children. new documents have a single text node for each block of text. over time, more text nodes may be created as the document's content changes. the node.normalize() method merges adjacent text objects back into a single node for each block of text. ...
...gle text node for each block of text. over time, more text nodes may be created as the document's content changes. the node.normalize() method merges adjacent text objects back into a single node for each block of text. ...
TimeEvent - Web APIs
Web › API › TimeEvent
the timeevent interface, a part of svg smil animation, provides specific contextual information associated with time events. ...
... the timeevent interface, a part of svg smil animation, provides specific contextual information associated with time events. ...
TouchEvent - Web APIs
le. the event can describe one or more points of contact with the screen and includes support for detecting movement, addition and removal of contact points, and so forth. touches are represented by the touch object; each touch is described by a position, size and shape, amount of pressure, and target element. lists of touches are represented by touchlist objects. ...
...t points, and so forth. touches are represented by the touch object; each touch is described by a position, size and shape, amount of pressure, and target element. lists of touches are represented by touchlist objects. ...
UIEvent - Web APIs
Web › API › UIEvent
mple user interface events. uievent derives from event. although the uievent.inituievent() method is kept for backward compatibility, you should create a uievent object using the uievent() constructor. several interfaces are direct or indirect descendants of this one: mouseevent, touchevent, focusevent, keyboardevent, wheelevent, inputevent, and compositionevent. ...
...eate a uievent object using the uievent() constructor. several interfaces are direct or indirect descendants of this one: mouseevent, touchevent, focusevent, keyboardevent, wheelevent, inputevent, and compositionevent. ...
WebGLContextEvent - Web APIs
the webcontextevent interface is part of the webgl api and is an interface for an event that is generated in response to a status change to the webgl rendering context. inheritance this interface inherits properties and methods from its parent interface, event. ...
...webgl api and is an interface for an event that is generated in response to a status change to the webgl rendering context. inheritance this interface inherits properties and methods from its parent interface, event. ...
Taking still photos with WebRTC - Web APIs
is where we call the clearphoto() method we'll describe below in the section clearing the photo box. clearing the photo box clearing the photo box involves creating an image, then converting it into a format usable by the <img> element that displays the most recently captured frame. that code looks like this: function clearphoto() { var context = canvas.getcontext('2d'); context.fillstyle = "#aaa"; context.fillrect(0, 0, canvas.width, canvas.height); var data = canvas.todataurl('image/png'); photo.setattribute('src', data); } we start by getting a reference to the hidden <canvas> element that we use for offscreen rendering. next we set the fillstyle to #aaa (a fairly light grey), and fill the entire canvas with that color by calling fillrect(). last in this funct...
... a <video> element, we can very easily apply filters and fun effects to the video. as it turns out, any css filters you apply to the element using the filter property affect the captured photo. these filters can range from the simple (making the image black and white) to the extreme (gaussian blurs and hue rotation). you can play with this effect using, for example, the firefox developer tools' style editor; see edit css filters for details on how to do so. using specific devices you can, if needed, restrict the set of permitted video sources to a specific device or set of devices. to do so, call navigator.mediadevices.enumeratedevices(). when the promise is fulfilled with an array of mediadeviceinfo objects describing the available devices, find the ones that you want to allow and specify...
Inputs and input sources - Web APIs
ler. this input may be a button, trigger, trackpad tap or click, a voice command, or special hand gesture, or possibly some other form of input. for example, on a hand controller with a trackpad that can be clicked on, a trigger control, as well as back and "menu" buttons, clicking the trackpad is likely to be the primary action. some controllers might have a button labeled "select." on a gamepad-style controller, the "a" button is likely to be the primary action. the primary squeeze action is the action which is engaged when the user squeezes the controller. this "squeezing" may be detected by literally using a pressure sensor in the controller, or may be simulated using a trigger, hand gesture, or other mechanism. for example, if the input controller is a haptic glove, it might report that t...
...rt point for rendering your object as you apply any rotation needed to orient your model correctly to align with the grip space's orientation. <<<--- diagram needed: applying transform to grip space to position/orient object --->>> advanced controllers using the gamepad object an xrinputsource has a gamepad property whose value, if not null, is a gamepad object which provides access to gamepad-style buttons, axis controllers (such as joysticks or thumbpads), and so forth. this may include the same buttons that trigger the standard xrinputsource actions, but may include any number of additional buttons and controls. note: while gamepad is defined by the gamepad api, it is not managed by the gamepad api, so you must not attempt to use any gamepad api methods with it. the object type is reuse...
Advanced techniques: Creating and sequencing audio - Web APIs
drawn; let currenttime = audioctx.currenttime; while (notesinqueue.length && notesinqueue[0].time < currenttime) { drawnote = notesinqueue[0].note; notesinqueue.splice(0,1); // remove note from queue } // we only need to draw if the note has moved. if (lastnotedrawn != drawnote) { pads.foreach(function(el, i) { el.children[lastnotedrawn].style.bordercolor = 'hsla(0, 0%, 10%, 1)'; el.children[drawnote].style.bordercolor = 'hsla(49, 99%, 50%, 1)'; }); lastnotedrawn = drawnote; } // set up to draw again requestanimationframe(draw); } putting it all together now all that's left to do is make sure we've loaded the sample before we are able to play the instrument. we'll add a loading screen that dis...
...t. we'll add a loading screen that disappears when the file has been fetched and decoded, then we can allow the scheduler to start using the play button click event. ...
Using IIR filters - Web APIs
ontainer = document.queryselector('.filter-graph'); const canvasel = document.createelement('canvas'); canvascontainer.appendchild(canvasel); // set 2d context and set dimesions const canvasctx = canvasel.getcontext('2d'); const width = canvascontainer.offsetwidth; const height = canvascontainer.offsetheight; canvasel.width = width; canvasel.height = height; // set background fill canvasctx.fillstyle = 'white'; canvasctx.fillrect(0, 0, width, height); // set up some spacing based on size const spacing = width/16; const fontsize = math.floor(spacing/1.5); // draw our axis canvasctx.linewidth = 2; canvasctx.strokestyle = 'grey'; canvasctx.beginpath(); canvasctx.moveto(spacing, spacing); canvasctx.lineto(spacing, height-spacing); canvasctx.lineto(width-spacing, height-spacing); canvasctx.stro...
...idth/16; const fontsize = math.floor(spacing/1.5); // draw our axis canvasctx.linewidth = 2; canvasctx.strokestyle = 'grey'; canvasctx.beginpath(); canvasctx.moveto(spacing, spacing); canvasctx.lineto(spacing, height-spacing); canvasctx.lineto(width-spacing, height-spacing); canvasctx.stroke(); // axis is gain by frequency -> make labels canvasctx.font = fontsize+'px sans-serif'; canvasctx.fillstyle = 'grey'; canvasctx.filltext('1', spacing-fontsize, spacing+fontsize); canvasctx.filltext('g', spacing-fontsize, (height-spacing+fontsize)/2); canvasctx.filltext('0', spacing-fontsize, height-spacing+fontsize); canvasctx.filltext('hz', width/2, height-spacing+fontsize); canvasctx.filltext('20k', width-spacing, height-spacing+fontsize); // loop over our magnitude response data and plot our filter...
Using the Web Speech API - Web APIs
ce will start. this is achieved by calling speechrecognition.start(). the foreach() method is used to output colored indicators showing what colors to try saying. var diagnostic = document.queryselector('.output'); var bg = document.queryselector('html'); var hints = document.queryselector('.hints'); var colorhtml= ''; colors.foreach(function(v, i, a){ console.log(v, i); colorhtml += '<span style="background-color:' + v + ';"> ' + v + ' </span>'; }); hints.innerhtml = 'tap/click then say a color to change the background color of the app. try ' + colorhtml + '.'; document.body.onclick = function() { recognition.start(); console.log('ready to receive a color command.'); } receiving and handling results once the speech recognition is started, there are many event handlers that can be ...
...the speechrecognitionevent.results property returns a speechrecognitionresultlist object containing speechrecognitionresult objects. it has a getter so it can be accessed like an array — so the first [0] returns the speechre...
WheelEvent - Web APIs
el event doesn't necessarily dispatch a scroll event. even when it does, that doesn't mean that the delta* values in the wheel event necessarily reflect the content's scrolling direction. therefore, do not rely on delta* properties to get the content's scrolling direction. instead, detect value changes to scrollleft and scrolltop of the target in the scroll event. ...
...lect the content's scrolling direction. therefore, do not rely on delta* properties to get the content's scrolling direction. instead, detect value changes to scrollleft and scrolltop of the target in the scroll event. ...
window.location - Web APIs
Web › API › Window › location
nullam ultrices dolor ac dolor imperdiet ullamcorper. suspendisse quam libero, luctus auctor mollis sed, malesuada condimentum magna. quisque in ante tellus, in placerat est. pellentesque habitant morbi tristique senectus e...
...top; document.documentelement.scrollleft = onode.offsetleft; } function showbookmark (sbookmark, busehash) { if (arguments.length === 1 || busehash) { location.hash = sbookmark; return; } var obookmark = document.queryselector(sbookmark); if (obookmark) { shownode(obookmark); } } </script> <style> span.intlink { cursor: pointer; color: #0000ff; text-decoration: underline; } </style> </head> <body> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. nullam ultrices dolor ac dolor imperdiet ullamcorper. suspendisse quam libero, luctus auctor mollis sed, malesuada condimentum magna. quisque in ante tellus, in placerat est. pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. donec a mi magna, quis mattis dolor. etiam sit amet l...
Window.screenLeft - Web APIs
Web › API › Window › screenLeft
on the screen, even if the window position is moved. ...
...dow.screenleft + canvaselem.offsetleft; initialtop = window.screentop + canvaselem.offsettop; function positionelem() { let newleft = window.screenleft + canvaselem.offsetleft; let newtop = window.screentop + canvaselem.offsettop; let leftupdate = initialleft - newleft; let topupdate = initialtop - newtop; ctx.fillstyle = 'rgb(0, 0, 0)'; ctx.fillrect(0, 0, width, height); ctx.fillstyle = 'rgb(0, 0, 255)'; ctx.beginpath(); ctx.arc(leftupdate + (width/2), topupdate + (height/2) + 35, 50, degtorad(0), degtorad(360), false); ctx.fill(); pelem.textcontent = 'window.screenleft: ' + window.screenleft + ', window.screentop: ' + window.screentop; window.requestanimationframe(positionelem); } window.requestanimationframe(positionelem); also in the code we include a snippet ...
Window.screenTop - Web APIs
Web › API › Window › screenTop
on the screen, even if the window position is moved. ...
...dow.screenleft + canvaselem.offsetleft; initialtop = window.screentop + canvaselem.offsettop; function positionelem() { let newleft = window.screenleft + canvaselem.offsetleft; let newtop = window.screentop + canvaselem.offsettop; let leftupdate = initialleft - newleft; let topupdate = initialtop - newtop; ctx.fillstyle = 'rgb(0, 0, 0)'; ctx.fillrect(0, 0, width, height); ctx.fillstyle = 'rgb(0, 0, 255)'; ctx.beginpath(); ctx.arc(leftupdate + (width/2), topupdate + (height/2) + 35, 50, degtorad(0), degtorad(360), false); ctx.fill(); pelem.textcontent = 'window.screenleft: ' + window.screenleft + ', window.screentop: ' + window.screentop; window.requestanimationframe(positionelem); } window.requestanimationframe(positionelem); also in the code we include a snippet ...
Window.screenX - Web APIs
Web › API › Window › screenX
on the screen, even if the window position is moved. ...
...dow.screenleft + canvaselem.offsetleft; initialtop = window.screentop + canvaselem.offsettop; function positionelem() { let newleft = window.screenleft + canvaselem.offsetleft; let newtop = window.screentop + canvaselem.offsettop; let leftupdate = initialleft - newleft; let topupdate = initialtop - newtop; ctx.fillstyle = 'rgb(0, 0, 0)'; ctx.fillrect(0, 0, width, height); ctx.fillstyle = 'rgb(0, 0, 255)'; ctx.beginpath(); ctx.arc(leftupdate + (width/2), topupdate + (height/2) + 35, 50, degtorad(0), degtorad(360), false); ctx.fill(); pelem.textcontent = 'window.screenleft: ' + window.screenleft + ', window.screentop: ' + window.screentop; window.requestanimationframe(positionelem); } window.requestanimationframe(positionelem); these work in exactly the same way as ...
Window.screenY - Web APIs
Web › API › Window › screenY
on the screen, even if the window position is moved. ...
...dow.screenleft + canvaselem.offsetleft; initialtop = window.screentop + canvaselem.offsettop; function positionelem() { let newleft = window.screenleft + canvaselem.offsetleft; let newtop = window.screentop + canvaselem.offsettop; let leftupdate = initialleft - newleft; let topupdate = initialtop - newtop; ctx.fillstyle = 'rgb(0, 0, 0)'; ctx.fillrect(0, 0, width, height); ctx.fillstyle = 'rgb(0, 0, 255)'; ctx.beginpath(); ctx.arc(leftupdate + (width/2), topupdate + (height/2) + 35, 50, degtorad(0), degtorad(360), false); ctx.fill(); pelem.textcontent = 'window.screenleft: ' + window.screenleft + ', window.screentop: ' + window.screentop; window.requestanimationframe(positionelem); } window.requestanimationframe(positionelem); these work in exactly the same way as ...
XMLDocument - Web APIs
the xmldocument interface represents an xml document. it inherits from the generic document and does not add any specific methods or properties to it: nevertheless, several algorithms behave differently with the two types of documents. ...
...interface represents an xml document. it inherits from the generic document and does not add any specific methods or properties to it: nevertheless, several algorithms behave differently with the two types of documents. ...
XMLHttpRequest - Web APIs
xmlhttprequest (xhr) objects are used to interact with servers. you can retrieve data from a url without having to do a full page refresh. this enables a web page to update just part of a page without disrupting what the user is doing. xmlhttprequest is used heavily in ajax programming. ...
...can retrieve data from a url without having to do a full page refresh. this enables a web page to update just part of a page without disrupting what the user is doing. xmlhttprequest is used heavily in ajax programming. ...
XMLHttpRequestEventTarget - Web APIs
xmlhttprequesteventtarget is the interface that describes the event handlers you can implement in an object that will handle events for an xmlhttprequest. ...
... xmlhttprequesteventtarget is the interface that describes the event handlers you can implement in an object that will handle events for an xmlhttprequest. ...
Introduction - Web APIs
introduction one noticeable trend in w3c standards has been the effort to separate content from style. this would allow the same style to be reused for multiple content, as well as simplify maintenance and allow a quick (only modify one file) way to change the look of content. css (cascade style sheets) was one of the first ways proposed by the w3c. css is a simple way to apply style rules to a web document. these style rules define how the document (the content) should be laid out. however, it has several limitations, such as lack of programming structures and ability to create complex layout models. css also has limited support for changing the position of an element. ...
... sheets) was one of the first ways proposed by the w3c. css is a simple way to apply style rules to a web document. these style rules define how the document (the content) should be laid out. however, it has several limitations, such as lack of programming structures and ability to create complex layout models. css also has limited support for changing the position of an element. xsl (extensible stylesheet language) transformations are composed of two parts: xsl elements, which allow the transformation of an xml tree into another markup tree and xpath, a selection language for trees. xslt takes an xml document (the content) and creates a brand new document based on the rules in the xsl stylesheet. this allows xslt to add, remove and reorganize elements from the original xml document and thus a...
msPutPropertyEnabled - Web APIs
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the msputpropertyenabled method sets whether a given property in the style object is enabled or disabled. this proprietary method is specific to internet explorer and microsoft edge. syntax var retval = style.msputpropertyenabled(propertyname, true); parameters name[in]: name of the property. (string) boolean[in]: true = enable the property. false = disable the property. return value type = hresult: if this method succeeds, it returns s_ok. otherwise, it returns an hresult error code. see...
...rietary method is specific to internet explorer and microsoft edge. syntax var retval = style.msputpropertyenabled(propertyname, true); parameters name[in]: name of the property. (string) boolean[in]: true = enable the property. false = disable the property. return value type = hresult: if this method succeeds, it returns s_ok. ...
ARIA: button role - Accessibility
a-pressed the value of aria-pressed defines the state of a toggle button. this attribute has one of four possible values: true, false, mixed, undefined examples basic button example in this example, a span element has been given the button role. because a <span> element is used, the tabindex attribute is required to make the button focusable and part of the page's tab order. the included css style is provided to make the <span> element look like a button, and to provide visual cues when the button has focus. the handlebtnclick and handlebtnkeydown event handlers perform the button's action when activated using a mouse click or the space or enter key. in this case, the action is to add a new name to the list of names. try the example by adding a name to the text box. the button will cause...
...our name: </label> <input type="text" id="newname"> <span role="button" tabindex="0" onclick="handlecommand()" onkeydown="handlecommand()">add name</span> css [role="button"] { padding: 2px; background-color: navy; color: white; cursor: default; } [role="button"]:hover, [role="button"]:focus, [role="button"]:active { background-color: white; color: navy; } ul { list-style: none; } javascript function handlecommand(event) { // handles both mouse clicks and keyboard // activate with enter or space // get the new name value from the input element let newnameinput = document.getelementbyid('newname'); let name = newnameinput.value; newnameinput.value = ''; // clear the text field newnameinput.focus(); // give the text field focus to ena...
Web applications and ARIA FAQ - Accessibility
kind of widget it is. progressbar.setattribute("role", "progressbar"); progressbar.setattribute("aria-valuemin", 0); progressbar.setattribute("aria-valuemax", 100); // create a function that can be called at any time to update the value of the progress bar. ...
... my page styles or behavior? no, aria is only made available to assistive technology apis, and doesn't affect native browser functionality with respect to the dom or styling. from the browser's point of view, the native html defines the semantic meaning and behavior of an element, with aria attributes acting as a layer on top to help support the at api. though on its own aria will not change any styles, as with any html attributes, css can take advantage of aria attributes as element selectors. this may provide a convenient mechanism to style aria-enabled widgets. .tab-panel[aria-hidden="true"] { display: none; } .tab-panel[aria-hidden="false"] { display: block; } what about validation? the new attributes introduced in aria, such as role and those prefixed with aria-, aren't offic...
An overview of accessible web applications and widgets - Accessibility
ab"> <a href="#ch1panel">chapter 1</a> </li> <li id="ch2tab"> <a href="#ch2panel">chapter 2</a> </li> <li id="quiztab"> <a href="#quizpanel">quiz</a> </li> </ol> <div> <div id="ch1panel">chapter 1 content goes here</div> <div id="ch2panel">chapter 2 content goes here</div> <div id="quizpanel">quiz content goes here</div> </div> example 2: how the tabs widget might be styled visually. users might recognize it visually, but there are no machine-readable semantics for an assistive technology. aria aria enables developers to describe their widgets in more detail by adding special attributes to the markup. designed to fill the gap between standard html tags and the desktop-style controls found in dynamic web applications, aria provides roles and states that describe...
...the web has been limited to the tab key. a user presses tab to focus each link, button, or form on the page in a linear order, using shift-tab to navigate backwards. it's a one-dimensional form of navigation—forward and back, one element at a time. on fairly dense pages, a keyboard-only user often has to press the tab key dozens of times before accessing the needed section. implementing desktop-style keyboard conventions on the web has the potential to significantly speed up navigation for many users. here's a summary of how keyboard navigation should work in an aria-enabled web application: the tab key should provide focus to the widget as a whole. for example, tabbing to a menu bar should not put focus on the menu's first element. the arrow keys should allow for selection or navigation...
Accessibility Information for Web Authors - Accessibility
contrast by lighthouse international). a study has established that about 8 percent of all men have some form of color deficiency. color contrast analyzer algorithm is based on the formula provided in techniques for accessibility evaluation and repair tools from w3c. the juicy studio css analyzer will also analyze and report the color contrast and color brightness differences involved in your stylesheets. the future: accessible dhtml dhtml accessibility roadmap: a peek into how dhtml will be made accessible in the future. this document gives a plan which is being developed by ibm, mozilla and wai protocols and formats working group (pfwg) to address the issue of accessible dhtml. dynamic web content is not accessible, because it uses vanilla <div>'s and <span>'s combined with javascri...
...th javascript rather than declarative markup to describe the behavior of custom widgets such as menus and tree views. these widgets are usually not even keyboard focusable. furthermore, assistive technologies do not understand what these widgets are supposed to be, or what state they are in or what they are capable of. this document tackles such difficulties and shows several interactive desktop-style widgets such as tree views, menu bars and spreadsheets which are accessible both with the keyboard and assistive technologies such as screen readers, screen magnifiers and alternative input devices. join the mozilla accessibility community live chat both end users and developers are invited for discussion on the live irc channel at irc.mozilla.org/#accessibility. since this is a worldwide effo...
Web Accessibility: Understanding Colors and Luminance - Accessibility
use color is as much about the physiology of the eye and human perception as it is about light emitting from a computer screen. environment matters. perception of color in a well-lit room will be different than perception of that same color on that same computer screen in a dark room. in terms of accessibility, the use of certain color-combinations have more impact than others. font size, font style (some fonts are so thin or fancy that they present accessibility problems on their own), background color, the size of the background space around the text, even pixel densities and more all affect how color is delivered from the screen. (see understanding success criterion 1.4.3: contrast) a viewer's distance from the screen, the ambient background, the health of his eyes, and more all affect h...
...) measuring color & luminance methods that measures color exploring the rgb color space further, as it is the color space used by the data type <color>, note that there are actually multiple "versions" of the rgb color space, such as srgb, scrgb, and rgba. there are also different ways to refrence rgb: rgb decimal reference: 153, 0, 0 and an rgb percent reference: 60, 0, 0. window.getcomputedstyle() returns values using rgb decimal reference scale. for example, calling window.getcomputedstyle() on a div with a background-color: #990000; set returns the computed background color as rgb(153, 0, 0) -- the rgb decimal reference. window.getcomputedstyle() measures color in terms of rgb. css color module level 3 added hsl color values, stating "css3 adds numerical hue-saturation-lightness (...
Perceivable - Accessibility
larly refer to good semantics, ui controls, and text alternatives. 1.3.2 meaningful content sequence (a) a sensible, logical reading order should be easy to determine for any content, even if it is visually presented in an unusual way. the order should be made obvious by use of correct semantic elements (e.g., headings, paragraphs), with css being used to create any unusual layout styles, irrespective of the markup. again, refer to html: a good basis for accessibility. 1.3.3 sensory characteristics (a) instructions for operating controls or understanding content do not rely on a single sense. this may prove inaccessible to people with a disability related to that sense, or a device that does not support that sense. so, for example: "click the round...
... two-dimensional layout for usage or meaning (like a large data table) understanding reflow 1.4.11 non-text contrast(aa) added in 2.1 minimum color contrast ratio of 3:1 for user interface components and graphical objects. ...
Understandable - Accessibility
l (aaa) if text is provided that requires a higher reading level that lower secondary education level (typically children around 11-14 years old), provide supplementary explainer material to help people who can't read it, or provide an alternative version that is written at lower secondary level. this doesn't mean that all subject matter should be understood by everyone, but that the style of writing should be accessible by everyone. it is better to just write all content at lower secondary level, even technical documentation like programming tutorials, unless there is a good reason not to (e.g. an alternative style for poetic effect), or they have to be written in a strict style (e.g. w3c specs). 3.1.6 pronunciation (aaa) a mechanism should be provided to ...
...rned/advised of the impending change before it occurs. again, sensible design should be implemented. for example, if pressing a button causes the application to exit the current view, the user should be asked to confirm this action, save their work if appropriate, etc. globaleventhandlers.oninput is useful here. 3.2.3 consistent navigation (aa) navigation menu/control style and positioning should be consistent between different pages or views of a web page, and the existing items should appear in the same order, even if for example new iteam are added. if the user has initiated a change, e.g. choosing a different color scheme or position for the navigation, their choice should be respected across all pages. again, sensible design — make the navigation control...
Writing Web Audio API code that works in every browser - Developer guides
st, get a copy of audiocontext-monkeypatch by chris wilson. this little library will "normalise" the interfaces for you and make it look as if your code is running in a standards compliant browser, by aliasing prefixed names to the unprefixed versions. and it won't do anything if the unprefixed versions are already present. once you include it in your page, you can write in "modern web audio api" style, and do things such as: var audiocontext = new audiocontext(); everywhere, including chrome/ium, opera, safari, and ---of course!--- firefox. also, if new methods such as start are not detected in some nodes, the library will also alias them to their old names. thus, start is mapped to noteon, stop to noteoff, and so on. if you're porting moderately "old" code (say, a year old) it's possible tha...
...and ---of course!--- firefox. also, if new methods such as start are not detected in some nodes, the library will also alias them to their old names. thus, start is mapped to noteon, stop to noteoff, and so on. if you're porting moderately "old" code (say, a year old) it's possible that it uses some methods that audiocontext-monkeypatch doesn't alias, because it helps you to write code in the new style. for example, the way to create instances of gainnode used to be var gain = audiocontext.creategainnode(); but nowadays it is just var gain = audiocontext.creategain(); since the old method names are not present in firefox, existing code may crash with something like creategainnode is not a function, and you now know why. there's a section in the spec that lists the old names and their updated ...
Using device orientation with 3D transforms - Developer guides
ue should be -gamma finally, the order of the three different rotations is very important to accurately convert an orientation to a 3d rotation: rotatez, then rotatex and then rotatey. here's a simple code snippet to sum it up: var elem = document.getelementbyid("view3d"); window.addeventlistener("deviceorientation", function(e) { // remember to use vendor-prefixed transform property elem.style.transform = "rotatez(" + ( e.alpha - 180 ) + "deg) " + "rotatex(" + e.beta + "deg) " + "rotatey(" + ( -e.gamma ) + "deg)"; }); orientation compensation compensating the orientation of the device can be useful to create parallax effects or augmented reality. this is achieved by inverting the previous order of rotations and negating the alpha value: var elem = document.getelementbyi...
...g)"; }); orientation compensation compensating the orientation of the device can be useful to create parallax effects or augmented reality. ...
Content categories - Developer guides
to read the relevant portions of the html specification. main content categories metadata content elements belonging to the metadata content category modify the presentation or the behavior of the rest of the document, set up links to other documents, or convey other out of band information. elements belonging to this category are <base>, <command>, <link>, <meta>, <noscript>, <script>, <style> and <title>. flow content elements belonging to the flow content category typically contain text or embedded content. they are: <a>, <abbr>, <address>, <article>, <aside>, <audio>, <b>,<bdo>, <bdi>, <blockquote>, <br>, <button>, <canvas>, <cite>, <code>, <command>, <data>, <datalist>, <del>, <details>, <dfn>, <div>, <dl>, <em>, <embed>, <fieldset>, <figure>, <footer>, <form>, <h1>, <h2>, <h3>...
..., <script>, <section>, <select>, <small>, <span>, <strong>, <sub>, <sup>, <svg>, <table>, <template>, <textarea>, <time>, <ul>, <var>, <video>, <wbr> and text. a few other elements belong to this category, but only if a specific condition is fulfilled: <area>, if it is a descendant of a <map> element <link>, if the itemprop attribute is present <meta>, if the itemprop attribute is present <style>, if the scoped attribute is present sectioning content elements belonging to the sectioning content model create a section in the current outline that defines the scope of <header> elements, <footer> elements, and heading content. elements belonging to this category are <article>, <aside>, <nav> and <section>. do not confuse this content model with the sectioning root category, which isol...
Making content editable - Developer guides
n edit. <div contenteditable="true"> this text can be edited by the user. </div> here's the above html in action: executing commands when an html element has contenteditable set to true, the document.execcommand() method is made available. this lets you run commands to manipulate the contents of the editable region. most commands affect the document's selection by, for example, applying a style to the text (bold, italics, etc), while others insert new elements (like adding a link) or affect an entire line (indenting). when using contenteditable, calling execcommand() will affect the currently active editable element. differences in markup generation use of contenteditable across different browsers has been painful for a long time because of the differences in generated markup between ...
...intdoc() { if (!validatemode()) { return; } var oprntwin = window.open("","_blank","width=450,height=470,left=400,top=100,menubar=yes,toolbar=no,location=no,scrollbars=yes"); oprntwin.document.open(); oprntwin.document.write("<!doctype html><html><head><title>print<\/title><\/head><body onload=\"print();\">" + odoc.innerhtml + "<\/body><\/html>"); oprntwin.document.close(); } </script> <style type="text/css"> .intlink { cursor: pointer; } img.intlink { border: 0; } #toolbar1 select { font-size:10px; } #textbox { width: 540px; height: 200px; border: 1px #000000 solid; padding: 12px; overflow: scroll; } #textbox #sourcetext { padding: 0; margin: 0; min-width: 498px; min-height: 200px; } #editmode label { cursor: pointer; } </style> </head> <body onload="initdoc();"> <f...
Constraint validation - Developer guides
.setcustomvalidity(""); } finally we hook the method with the correct event: window.onload = function () { document.getelementbyid("fs").onchange = checkfilesize; } you can see a live example of the file size constraint validation. visual styling of constraint validation apart from setting constraints, web developers want to control what messages are displayed to the users and how they are styled. controlling the look of elements the look of elements can be controlled via css pseudo-classes. :required and :optional css pseudo-classes the :required and :optional pseudo-classes allow writing selectors that match form elements that have the required attribute, or that don't have it. :placeholder-shown css pseudo-class see :placeholder-shown :valid :invalid css pseudo-classes the :va...
...g selectors that match form elements that have the required attribute, or that don't have it. :placeholder-shown css pseudo-class see :placeholder-shown :valid :invalid css pseudo-classes the :valid and :invalid pseudo-classes are used to represent <input> elements whose content validates and fails to validate respectively according to the input's type setting. these classes allow the user to style valid or invalid form elements to make it easier to identify elements that are either formatted correctly or incorrectly. controlling the text of constraint violation the following items can help with controlling the text of a constraint violation: element.setcustomvalidity(message) method on the following elements: <fieldset>. note: setting a custom validity message on fieldset eleme...
HTML5 - Developer guides
Web › Guide › HTML › HTML5
tation. this can be used as an input device (e.g., to make games that react to the position of the device) or to adapt the layout of a page to the orientation of the screen (portrait or landscape). pointer lock api allows locking the pointer to the content, so games and similar application don't lose focus when the pointer reaches the window limit. styling css has been extended to be able to style elements in a much more complex way. this is often referred as css3, though css is not a monolithic specification any more and the different modules are not all at level 3: some are at level 1 and others at level 4, with all the intermediate levels covered. new background styling features it is now possible to put shadows on elements using box-shadow, multiple backgrounds, and css filters. yo...
...the different modules are not all at level 3: some are at level 1 and others at level 4, with all the intermediate levels covered. new background styling features it is now possible to put shadows on elements using box-shadow, multiple backgrounds, and css filters. you can learn more about these by reading advanced box effects. more fancy borders not only it is now possible to use images to style borders, using border-image and its associated longhand properties, but rounded borders are supported via the border-radius property. animating your style using css transitions to animate between different states or using css animations to animate parts of the page without a triggering event, you can now control mobile elements on your page. typography improvement authors have better control ...
Using HTML sections and outlines - Developer guides
nt, the content would still make sense to a reader. <article> <h1>how to become an mdn contributor</h1> <p> do you want to help protect the web?.... </p> </article> nesting elements inside an article the <article> element can have other semantic elements such as headers, asides, and footers. this is often useful if you want to add css selectors to the class property of the element to style the document. <article> <header> <h1>how to become an mdn contributor</h1> </header> <p> do you want to help protect the web?.... </p> <aside> <blockquote> amazing quote from article </blockquote> </aside> <footer> <p> author info, publication date </p> </footer> </article> nesting articles and sections articles can be nested inside of sectio...
... particular target audience is using internet explorer 8 or older, then you can follow the below instructions to make them behave as expected. however, global usage of these browsers is now very small, so this is unlikely. html5 semantic elements don't need a special dom interface, but they will need a specific css styling in older browser that don't support them explicitly. unknown elements are styled as display: inline by default, so you'll want to set them to display: block: article, aside, footer, header, nav, section { display: block; } of course the web developer can style them differently, but keep in mind that in a non-html5 browser, the default styling is different from what is expected for such elements. also note that the <time> element has not been included, because the defaul...
Writing forward-compatible websites - Developer guides
at they follow these guidelines too. if they don't, you can't rely on that library not breaking in the future. unfortunately, libraries are common transgressors of these guidelines. sniffing sniff for specific features if you plan to use some feature, use object-detection to sniff for that exact feature, if possible. as a simple example, don't assume that any browser in which "filter" in body.style tests true must be microsoft internet explorer and therefore e.g. will have a window.event object available in event handlers. don't assume that browsers with support for a given dom feature must also have some other, especially nonstandard, dom feature. or, conversely, that they don't have support for some other feature (e.g., don't assume that a browser that supports onload on script elements w...
...ped a feature unprefixed, however, you can use the prefixed version to target old releases by making sure to always use the unprefixed version of the feature when available. a good example, for a browser vendor using the -vnd css prefix that has shipped an unprefixed implementation of the make-it-pretty property, with a behavior for the value "sometimes" that differs from the prefixed version: <style> .pretty-element { -vnd-make-it-pretty: sometimes; make-it-pretty: sometimes; } </style> the order of the declarations in the rule above is important: the unprefixed one needs to come last. don't use unprefixed versions of css properties or apis until at least one browser supports them until there's decently widespread support of the unprefixed version of something, its behavior c...
<abbr>: The Abbreviation element - HTML: Hypertext Markup Language
Web › HTML › Element › abbr
bbr> element. this is especially important in languages with more than two numbers, such as arabic, but is also relevant in english. default styling the purpose of this element is purely for the convenience of the author and all browsers display it inline (display: inline) by default, though its default styling varies from one browser to another: some browsers, like internet explorer, do not style it differently than a <span> element. opera, firefox, and some others add a dotted underline to the content of the element. a few browsers not only add a dotted underline, but also put it in small caps; to avoid this styling, adding something like font-variant: none in the css takes care of this case. examples marking up an abbreviation semantically to mark up an abbreviation without provid...
...tyling, adding something like font-variant: none in the css takes care of this case. examples marking up an abbreviation semantically to mark up an abbreviation without providing an expansion or description, simply use <abbr> without any attributes, as seen in this example. html <p>using <abbr>html</abbr> is fun and easy!</p> result styling abbreviations you can use css to set a custom style to be used for abbreviations, as seen in this simple example. html <p>using <abbr>css</abbr>, you can style your abbreviations!</p> css abbr { font-variant: all-small-caps; } result providing an expansion adding a title attribute lets you provide an expansion or definition for the abbreviation or acronym. html <p>ashok's joke made me <abbr title="laugh out loud">lol</abbr> big time.<...
<acronym> - HTML: Hypertext Markup Language
Web › HTML › Element › acronym
up to gecko 1.9.2 inclusive, firefox implements the htmlspanelement interface for this element. ...
... specifications specification status comment html 4.01 specificationthe definition of '<acronym>' in that specification. recommendation browser compatibility the compatibility table in this page is generated from structured data. ...
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
Web › HTML › Element › audio
h css the <audio> element has no intrinsic visual output of its own unless the controls attribute is specified, in which case the browser's default controls are shown. the default controls have a display value of inline by default, and it is often a good idea set the value to block to improve control over positioning and layout, unless you want it to sit within a text block or similar. you can style the default controls with properties that affect the block as a single unit, so for example you can give it a border and border-radius, padding, margin, etc. you can't however style the individual components inside the audio player (e.g. change the button size or icons, change the font, etc.), and the controls are different across the different browsers. to get a consistent look and feel across ...
... video player styling basics provides some useful styling techniques — it is written in the context of <video>, but much of it is equally applicable to <audio>. ...
<b>: The Bring Attention To element - HTML: Hypertext Markup Language
Web › HTML › Element › b
m>, or <mark> elements. the <strong> element represents text of certain importance, <em> puts some emphasis on the text and the <mark> element represents text of certain relevance. the <b> element doesn't convey such special semantic information; use it only when no others fit. similarly, do not mark titles and headings using the <b> element. for this purpose, use the <h1> to <h6> tags. further, stylesheets can change the default style of these elements, with the result that they are not necessarily displayed in bold. it is a good practice to use the class attribute on the <b> element in order to convey additional semantic information as needed (for example <b class="lead"> for the first sentence in a paragraph). this makes it easier to manage multiple use cases of <b> if your stylistic needs...
...b> element has been changed. if there is no semantic purpose to using the <b> element, you should use the css font-weight property with the value "bold" instead in order to make text bold. examples <p> this article describes several <b class="keywords">text-level</b> elements. it explains their usage in an <b class="keywords">html</b> document. </p> keywords are displayed with the default style of the <b>element, likely in bold.</b> result specifications specification status comment html living standardthe definition of '<b>' in that specification. living standard html5the definition of '<b>' in that specification. recommendation html 4.01 specificationthe definition of '<b>' in that specification. recommendation ...
<basefont> - HTML: Hypertext Markup Language
Web › HTML › Element › basefont
ont-size, and color to change the font configuration for an element and its contents. attributes like all other html elements, this element supports the global attributes. color this attribute sets the text color using either a named color or a color specified in the hexadecimal #rrggbb format. face this attribute contains a list of one or more font names. the document text in the default style is rendered in the first font face that the client's browser supports. if no font listed is installed on the local system, the browser typically defaults to the proportional or fixed-width font for that system. size this attribute specifies the font size as either a numeric or relative value. numeric values range from 1 to 7 with 1 being the smallest and 3 the default. usage notes do not use...
...asn't supported in all major browsers. further, browsers, and even successive versions of browsers, never implemented it in the same way: practically, using it has always brought indeterminate results. the <basefont> element was deprecated in the standard at the same time as all elements related to styling only. starting with html 4, html does not convey styling information anymore (outside the <style> element or the style attribute of each element). in html5, this element has been removed completely. for any new web development, styling should be written using css only. the former behavior of the <font> element can be achieved, and even better controlled using the css fonts properties. dom interface this element implements the htmlbasefontelement interface. example <basefont color="#ff00...
<canvas>: The Graphics Canvas element - HTML: Hypertext Markup Language
Web › HTML › Element › canvas
wsers with javascript disabled. providing a useful fallback text or sub dom helps to make the the canvas more accessible. required </canvas> tag unlike the <img> element, the <canvas> element requires the closing tag (</canvas>). sizing the canvas using css versus html the displayed size of the canvas can be changed using css, but if you do this the image is scaled during rendering to fit the styled size, which can make the final graphics rendering end up being distorted. it is better to specify your canvas dimensions by setting the width and height attributes directly on the <canvas> elements, either directly in the html or by using javascript. maximum canvas size the maximum size of a <canvas> element is very large, but the exact size depends on the browser. the following is some data ...
...r is unable to render the canvas, or if can't read a canvas. <canvas width="300" height="300"> an alternative text describing what your canvas displays. </canvas> javascript then in the javascript code, call htmlcanvaselement.getcontext() to get a drawing context and start drawing onto the canvas: const canvas = document.queryselector('canvas'); const ctx = canvas.getcontext('2d'); ctx.fillstyle = 'green'; ctx.fillrect(10, 10, 100, 100); result accessibility concerns alternative content the <canvas> element on its own is just a bitmap and does not provide information about any drawn objects. canvas content is not exposed to accessibility tools as semantic html is. in general, you should avoid using canvas in an accessible website or app. the following guides can help to make it mor...
<del>: The Deleted Text element - HTML: Hypertext Markup Language
Web › HTML › Element › del
can be used for the opposite purpose: to indicate text that has been added to the document. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. this element is often (but need not be) rendered by applying a strike-through style to the text. content categories phrasing content or flow content. permitted content transparent. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlmodel...
...t: " [deletion end] "; } some people who use screen readers deliberately disable announcing content that creates extra verbosity. because of this, it is important to not abuse this technique and only apply it in situations where not knowing content has been deleted would adversely affect understanding. short note on making your mark (more accessible) | the paciello group tweaking text level styles | adrian roselli specifications specification status comment html living standardthe definition of '<del>' in that specification. living standard html5the definition of '<del>' in that specification. recommendation html 4.01 specificationthe definition of '<del>' in that specification. recommendation ...
<dir>: The Directory element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › dir
the obsolete html directory element (<dir>) is used as a container for a directory of files and/or folders, potentially with styles and icons applied by the user agent. do not use this obsolete element; instead, you should use the <ul> element for lists, including lists of files. usage note: do not use this element. though present in early html specifications, it has been deprecated in html 4, and has since been removed entirely. no major browsers support this element. dom interface this element implements the htmldirectoryelement interface. attributes like all other html elements, this element supports the global attributes. compact this boolean attribute hints that the list should be rendered in a compact style. the interpretation of this attribute depends on the user agent and it...
...toryelement interface. attributes like all other html elements, this element supports the global attributes. compact this boolean attribute hints that the list should be rendered in a compact style. the interpretation of this attribute depends on the user agent and it doesn't work in all browsers. usage note: do not use this attribute, as it has been deprecated: the <dir> element should be styled using css. to give a similar effect as that achieved with the compact attribute, the css property line-height can be used with a value of 80%. ...
<div>: The Content Division element - HTML: Hypertext Markup Language
Web › HTML › Element › div
the html content division element (<div>) is the generic container for flow content. it has no effect on the content or layout until styled using css. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. as a "pure" container, the <div> element does not inherently represent anything. instead, it's used to group content so it can be easily styled using the class or id attributes, marking a section of a document as being written in a different language (using the lang attribute), and so on. content categories flow content, palpable content. permitted content flow content. or (in whatwg html): i...
...properties or techniques such as css grid or css flexbox to align and position <div> elements on the page. usage notes the <div> element should be used only when no other semantic element (such as <article> or <nav>) is appropriate. examples a simple example <div> <p>any kind of content here. such as &lt;p&gt;, &lt;table&gt;. you name it!</p> </div> the result looks like this: a styled example this example creates a shadowed box by applying a style to the <div> using css. note the use of the class attribute on the <div> to apply the style named "shadowbox" to the element. html <div class="shadowbox"> <p>here's a very interesting note displayed in a lovely shadowed box.</p> </div> css .shadowbox { width: 15em; border: 1px solid #333; box-shadow: 8px 8px 5px #444;...
<fieldset>: The Field Set element - HTML: Hypertext Markup Language
Web › HTML › Element › fieldset
ant the <fieldset> to be part of, even if it is not inside the form. name the name associated with the group. note: the caption for the fieldset is given by the first <legend> element nested inside it. styling with css there are several special styling considerations for <fieldset>. its display value is block by default, and it establishes a block formatting context. if the <fieldset> is styled with an inline-level display value, it will behave as inline-block, otherwise it will behave as block. by default there is a 2px groove border surrounding the contents, and a small amount of default padding. the element has min-inline-size: min-content by default. if a <legend> is present, it is placed over the block-start border. the <legend> shrink-wraps, and also establishes a formatting con...
...-size: min-content by default. if a <legend> is present, it is placed over the block-start border. the <legend> shrink-wraps, and also establishes a formatting context. the display value is blockified. (for example, display: inline behaves as block.) there will be an anonymous box holding the contents of the <fieldset>, which inherits certain properties from the <fieldset>. if the <fieldset> is styled with display: grid or display: inline-grid, then the anonymous box will be a grid formatting context. if the <fieldset> is styled with display: flex or display: inline-flex, then the anonymous box will be a flex formatting context. otherwise, it establishes a block formatting context. you can feel free to style the <fieldset> and <legend> in any way you want to suit your page design. examples ...
<font> - HTML: Hypertext Markup Language
Web › HTML › Element › font
summary the html font element (<font>) defines the font size, color and face for its content. usage note: do not use this element! though once normalized in html 3.2, it was deprecated in html 4.01, at the same time as all elements related to styling only, then made obsolete in html5. starting with html 4, html does not convey styling information anymore (outside the <style> element or the style attribute of each element). for any new web development, styling should be written using css only. the former behavior of the <font> element can be achieved, and even better controlled using the css fonts css properties. attributes like all other html elements, this element supports the global attributes. color this attribute sets the text color using either a named color or a color spe...
...eved, and even better controlled using the css fonts css properties. attributes like all other html elements, this element supports the global attributes. color this attribute sets the text color using either a named color or a color specified in the hexadecimal #rrggbb format. face this attribute contains a comma-separated list of one or more font names. the document text in the default style is rendered in the first font face that the client's browser supports. if no font listed is installed on the local system, the browser typically defaults to the proportional or fixed-width font for that system. size this attribute specifies the font size as either a numeric or relative value. numeric values range from 1 to 7 with 1 being the smallest and 3 the default. it can be defined using a...
<input type="range"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › range
/option> <option value="100" label="100%"></option> </datalist> screenshot live note: currently, no browser fully supports these features. firefox doesn't support hash marks and labels at all, for example, while chrome supports hash marks but doesn't support labels. version 66 (66.0.3359.181) of chrome supports labels but the <datalist> tag has to be styled with css as its display property is set to none by default, hiding the labels. change the orientation by default, if a browser renders a range input as a slider, it will render it so that the knob slides left and right. when supported, we will be able to make the range vertical, to slide up and down with css by declaring a height value greater than the width value. this is not actually imple...
...ed some css. first is the css for the wrapper itself; this specifies the display mode and size we want so that the page lays out correctly; in essence, it's reserving an area of the page for the slider so that the rotated slider fits into the reserved space without making a mess of things. .slider-wrapper { display: inline-block; width: 20px; height: 150px; padding: 0; } then comes the style information for the <input> element within the reserved space: .slider-wrapper input { width: 150px; height: 20px; margin: 0; transform-origin: 75px 75px; transform: rotate(-90deg); } the size of the control is set to be 150 pixels long by 20 pixels tall. the margins are set to 0 and the transform-origin is shifted to the middle of the space the slider rotates through; since the slide...
<input type="search"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › search
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. value a domstring representing the value contained in the search field. ...
...ueries. the value must be a non-negative decimal number. if not provided, or an invalid value is given, the browser's default maximum number of entries is used. using search inputs <input> elements of type search are very similar to those of type text, except that they are specifically intended for handling search terms. they are basically equivalent in behavior, but user agents may choose to style them differently by default (and, of course, sites may use stylesheets to apply custom styles to them). basic example <form> <div> <input type="search" id="mysearch" name="q"> <button>search</button> </div> </form> this renders like so: q is the most common name given to search inputs, although it's not mandatory. when submitted, the data name/value pair sent to the server will ...
<input type="tel"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › tel
element's pattern, placeholder, and aria-label to suit the format of telephone numbers in that country/territory. ...
...n = "[0-9]{3}"; inputelems[1].placeholder = "first part"; inputelems[1].pattern = "[0-9]{3}"; inputelems[1].setattribute("aria-label","first part of number"); inputelems[2].placeholder = "second part"; inputelems[2].pattern = "[0-9]{4}"; inputelems[2].setattribute("aria-label","second part of number"); } else if(selectelem.value === "uk") { inputelems[2].parentnode.style.display = "none"; inputelems[0].placeholder = "area code"; inputelems[0].pattern = "[0-9]{3,6}"; inputelems[1].placeholder = "local number"; inputelems[1].pattern = "[0-9]{4,8}"; inputelems[1].setattribute("aria-label","local number"); } else if(selectelem.value === "germany") { inputelems[2].parentnode.style.display = "inline"; inputelems[0].placeholder = "area c...
<meta>: The Document-level Metadata element - HTML: Hypertext Markup Language
Web › HTML › Element › meta
content categories metadata content. if the itemprop attribute is present: flow content, phrasing content. permitted content none, it is an empty element. tag omission as it is a void element, the start tag must be present and the end tag must not be present. permitted parents <meta charset>, <meta http-equiv>: a <head> element. if the http-equiv is not an encoding declaration, it can also be inside a <noscript> element, itself inside a <head> element. ...
...policy for the current page. content policies mostly specify allowed server origins and script endpoints which help guard against cross-site scripting attacks. content-type if specified, the content attribute must have the value "text/html; charset=utf-8". note: can only be used in documents served with a text/html mime type — not in documents served with an xml mime type. default-style sets the name of the default css style sheet set. x-ua-compatible if specified, the content attribute must have the value "ie=edge". user agents are required to ignore this pragma. refresh this instruction specifies: the number of seconds until the page should be reloaded - only if the content attribute contains a positive integer. the number of seconds until the p...
<s> - HTML: Hypertext Markup Language
Web › HTML › Element › s
cepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. implementation note: up to gecko 1.9.2 inclusive, firefox implements the htmlspanelement interface for this element. examples <s>today's special: salmon</s> sold out<br> <span style="text-decoration:line-through;">today's special: salmon</span> sold out accessibility concerns the presence of the s element is not announced by most screen reading technology in its default configuration. it can be made to be announced by using the css content property, along with the ::before and ::after pseudo-elements. s::before, s::after { clip-path: inset(100%); clip: rect(1px, 1...
...f stricken text] "; } some people who use screen readers deliberately disable announcing content that creates extra verbosity. because of this, it is important to not abuse this technique and only apply it in situations where not knowing content has been struck out would adversely affect understanding. short note on making your mark (more accessible) | the paciello group tweaking text level styles | adrian roselli specifications specification status comment html living standardthe definition of 's element' in that specification. living standard html5the definition of 's element' in that specification. recommendation ...
<slot> - HTML: Hypertext Markup Language
Web › HTML › Element › slot
rents any element that accepts phrasing content implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlslotelement attributes this element includes the global attributes. name the slot's name. a named slot is a <slot> element with a name attribute. ...
...{font-family: "open sans light", helvetica, arial, sans-serif } .name {font-weight: bold; color: #217ac0; font-size: 120% } h4 { margin: 10px 0 -8px 0; background: #217ac0; color: white; padding: 2px 6px; border: 1px solid #cee9f9; border-radius: 4px; } .attributes { margin-left: 22px; font-size: 90% } .attributes p { margin-left: 16px; font-style: italic } </style> <details> <summary> <code class="name">&lt;<slot name="element-name">need name</slot>&gt;</code> <i class="desc"><slot name="description">need description</slot></i> </summary> <div class="attributes"> <h4>attributes</h4> <slot name="attributes"><p>none</p></slot> </div> </details> <hr> </template> note: you can see this complet...
<small>: the side comment element - HTML: Hypertext Markup Language
Web › HTML › Element › small
by default, it renders text within it one font-size smaller, such as from small to x-small. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content permitted content phrasing content tag omission none, must have both a start tag and an end tag. ...
...hat accepts flow content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. examples basic usage <p>this is the first sentence. <small>this whole sentence is in small letters.</small> </p> css alternative <p>this is the first sentence. <span style="font-size:0.8em">this whole sentence is in small letters.</span> </p> specifications specification status comments html living standardthe definition of '<small>' in that specification. living standard html5the definition of '<small>' in that specification. recommendation html 4.01 specificationthe definition of '<small>' in that...
<table>: The Table element - HTML: Hypertext Markup Language
Web › HTML › Element › table
table and the last column and the bottom of the table and the last row. to achieve a similar effect, apply the border-spacing property to the <table> element. border-spacing does not have any effect if border-collapse is set to collapse. frame this enumerated attribute defines which side of the frame surrounding the table must be displayed. to achieve a similar effect, use the border-style and border-width properties. rules this enumerated attribute defines where rules, i.e. lines, should appear in a table. it can have the following values: none, which indicates that no rules will be displayed; it is the default value; groups, which will cause the rules to be displayed between row groups (defined by the <thead>, <tbody> and <tfoot> elements) and between column groups...
...olgroup> <tr> <th>countries</th> <th>capitals</th> <th>population</th> <th>language</th> </tr> <tr> <td>usa</td> <td>washington, d.c.</td> <td>309 million</td> <td>english</td> </tr> <tr> <td>sweden</td> <td>stockholm</td> <td>9 million</td> <td>swedish</td> </tr> </table> <p>table with colgroup and col</p> <table> <colgroup> <col style="background-color: #0f0"> <col span="2"> </colgroup> <tr> <th>lime</th> <th>lemon</th> <th>orange</th> </tr> <tr> <td>green</td> <td>yellow</td> <td>orange</td> </tr> </table> <p>simple table with caption</p> <table> <caption>awesome caption</caption> <tr> <td>awesome data</td> </tr> </table> table { border-collapse: collapse; border-spacing: 0p...
<textarea> - HTML: Hypertext Markup Language
Web › HTML › Element › textarea
arance to white-space: pre so line segments exceeding cols are not wrapped and the <textarea> becomes horizontally scrollable. if this attribute is not specified, soft is its default value. styling with css <textarea> is a replaced element — it has intrinsic dimensions, like a raster image. by default, its display value is block. compared to other form elements it is relatively easy to style, with its box model, fonts, color scheme, etc. being easily manipulable using regular css. styling html forms provides some useful tips on styling <textarea>s. baseline inconsistency the html specification doesn't define where the baseline of a <textarea> is, so different browsers set it to different positions. for gecko, the <textarea> baseline is set on the baseline of the first line of the ...
...t.notes a default background-image gradient is applied to all <textarea> elements, which can be disabled using background-image: none.opera android full support yessafari ios full support yesnotes full support yesnotes notes unlike other major browsers, a default style of opacity: 0.4 is applied to disabled <textarea> elements.samsung internet android full support yesautocapitalize non-standardchrome no support noedge no support nofirefox no support noie no support ...
contextmenu - HTML: Hypertext Markup Language
avascript function shareviatwitter() { window.open("https://twitter.com/intent/tweet?text=" + "hurray! ...
... recommendation snapshot of...
CSP: base-uri - HTTP
...
...ce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. see unsafe inline script for an example. in csp 2.0, this applie...
CSP: child-src - HTTP
the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. if you only need to allow inline event handlers and not inline <script> elements or javascript: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resourc...
...ce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. see unsafe inline script for an example. in csp 2.0 this applied...
CSP: connect-src - HTTP
...
...ce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. see unsafe inline script for an example. in csp 2.0, this applie...
CSP: form-action - HTTP
...
...ce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. see unsafe inline script for an example. in csp 2.0, this applie...
CSP: frame-src - HTTP
the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. if you only need to allow inline event handlers and not inline <script> elements or javascript: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resourc...
...ce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. see unsafe inline script for an example. in csp 2.0 this applied...
CSP: img-src - HTTP
...
...ce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. see unsafe inline script for an example. in csp 2.0, this applie...
CSP: manifest-src - HTTP
the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. if you only need to allow inline event handlers and not inline <script> elements or javascript: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resourc...
...ce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. see unsafe inline script for an example. in csp 2.0 this applied...
CSP: media-src - HTTP
the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. if you only need to allow inline event handlers and not inline <script> elements or javascript: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resourc...
...ce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. see unsafe inline script for an example. in csp 2.0 this applied...
CSP: navigate-to - HTTP
...
...ce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. see unsafe inline script for an example. in csp 2.0, this applie...
CSP: object-src - HTTP
the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. if you only need to allow inline event handlers and not inline <script> elements or javascript: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resourc...
...ce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. see unsafe inline script for an example. in csp 2.0 this applied...
CSP: prefetch-src - HTTP
...
...ce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. see unsafe inline script for an example. in csp 2.0, this applie...
CSP: script-src-attr - HTTP
...
...ce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. see unsafe inline script for an example. in csp 2.0, this applie...
CSP: script-src-elem - HTTP
...
...ce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. see unsafe inline script for an example. in csp 2.0, this applie...
CSP: worker-src - HTTP
the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. if you only need to allow inline event handlers and not inline <script> elements or javascript: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resourc...
...ce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value>' a sha256, sha384 or sha512 hash of scripts or styles. the use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. when generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. see unsafe inline script for an example. in csp 2.0 this applied...
Referrer-Policy - HTTP
examples policy document navigation to referrer ...
...ibute on <a>, <area>, <img>, <iframe>, <script>, or <link> elements: <a href="http://example.com" referrerpolicy="origin"> alternatively, a noreferrer link relation on an a, area, or link element can be set: <a href="http://example.com" rel="noreferrer"> integration with css css can fetch resources referenced from stylesheets. these resources follow a referrer policy as well: external css stylesheets use the default policy (no-referrer-when-downgrade), unless it's overwritten via a referrer-policy http header on the css stylesheet’s response. for <style> elements or style attributes, the owner document's referrer policy is used. examples policy document navigation to referrer no-referrer https://example.com/page anywhere (no referrer) ...
X-Content-Type-Options - HTTP
op-level documents if a content-type is provided. this can cause html web pages to be downloaded instead of being rendered when they are served with a mime type other than text/html. make sure to set both headers correctly. site security testers usually expect this header to be set. ...
...f for request destinations of "script" and "style". however, it also enables cross-origin read blocking (corb) protection for html, txt, json and xml files (excluding svg image/svg+xml). ...
CSS Houdini
ling and layout process of a browser’s rendering engine. houdini is a group of apis that give developers direct access to the css object model (cssom), enabling developers to write code the browser can parse as css, thereby creating new css features without waiting for them to be implemented natively in browsers. advantages of houdini houdini enables faster parse times than using javascript .style for style changes. browsers parse the cssom — including layout, paint, and composite processes — before applying any style updates found in scripts. in addition, layout, paint, and composite processes are repeated for javascript style updates. houdini code doesn't wait for that first rendering cycle to be complete. rather, it is included in that first cycle — creating renderable, understand...
...style changes. browsers parse the cssom — including layout, paint, and composite processes — before applying any style updates found in scripts. in addition, layout, paint, and composite processes are repeated for javascript style updates. houdini code doesn't wait for that first rendering cycle to be complete. rather, it is included in that first cycle — creating renderable, understandable styles. houdini provides an object-based api for working with css values in javascript. houdini's css typed om is a css object model with types and methods, exposing values as javascript objects making for more intuitive css manipulation than previous string based htmlelement.style manipulations. every element and style sheet rule has a style map which is accessible via its stylepropertymap. a featur...
Expressions and operators - JavaScript
statement assigns the value "adult" to the variable status if age is eighteen or more. otherwise, it assigns the value "minor" to status. comma operator the comma operator (,) simply evaluates both of its operands and returns the value of the last operand. this operator is primarily used inside a for loop, to allow multiple variables to be updated each time through the loop. it is regarded bad style to use it elsewhere, when it is not necessary. often two separate statements can and should be used instead. for example, if a is a 2-dimensional array with 10 elements on a side, the following code uses the comma operator to update two variables at once. the code prints the values of the diagonal elements in the array: var x = [0,1,2,3,4,5,6,7,8,9] var a = [x, x, x, x, x]; for (var i = 0, j =...
... "object" typeof option; // returns "function" typeof string; // returns "function" void the void operator is used in either of the following ways: void (expression) void expression the void operator specifies an expression to be evaluated without returning a value. expression is a javascript expression to evaluate. the parentheses surrounding the expression are optional, but it is good style to use them. relational operators a relational operator compares its operands and returns a boolean value based on whether the comparison is true. in the in operator returns true if the specified property is in the specified object. the syntax is: propnameornumber in objectname where propnameornumber is a string, numeric, or symbol expression representing a property name or array index, an...
Intl​.ListFormat.prototype​.format() - JavaScript
ded in the intl.listformat object. the locales and options parameters customize the behavior of format() and let applications specify the language conventions that should be used to format the list. examples using format the following example shows how to create a list formatter using the english language. ...
...pecify the language conventions that should be used to format the list. examples using format the following example shows how to create a list formatter using the english language. const list = ['motorcycle', 'bus', 'car']; console.log(new intl.listformat('en-gb', { style: 'long', type: 'conjunction' }).format(list)); // > motorcycle, bus and car console.log(new intl.listformat('en-gb', { style: 'short', type: 'disjunction' }).format(list)); // > motorcycle, bus or car console.log(new intl.listformat('en-gb', { style: 'narrow', type: 'unit' }).format(list)); // > motorcycle bus car specifications specification intl.listformatthe definition of 'format()' in that specification. ...
Intl.NumberFormat.prototype.resolvedOptions() - JavaScript
ation is set to "compact". signdisplay the value provided for this property in the options argument, or "auto" filled in as a default. usegrouping the values provided for these properties in the options argument or filled in as defaults. currency currencydisplay the values provided for these properties in the options argument or filled in as defaults. these properties are only present if style is "currency". only one of the following two groups of properties is included: minimumintegerdigits minimumfractiondigits maximumfractiondigits the values provided for these properties in the options argument or filled in as defaults. these properties are present only if neither minimumsignificantdigits nor maximumsignificantdigits was provided in the options argument. minimumsignificant...
... present only if at least one of them was provided in the options argument. examples using the resolvedoptions method var de = new intl.numberformat('de-de'); var usedoptions = de.resolvedoptions(); usedoptions.locale; // "de-de" usedoptions.numberingsystem; // "latn" usedoptions.notation; // "standard" usedoptions.signdisplay; // "auto" usedoption.style; // "decimal" usedoptions.minimumintegerdigits; // 1 usedoptions.minimumfractiondigits; // 0 usedoptions.maximumfractiondigits; // 3 usedoptions.usegrouping; // true specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.numberformat.prototype.resolvedoptions' in that specification. ...
Intl.RelativeTimeFormat() constructor - JavaScript
alematcher the locale matching algorithm to use. possible values are "lookup" and "best fit"; the default is "best fit". for information about this option, see intl. numeric the format of output message. possible values are: "always" (default, e.g., 1 day ago), or "auto" (e.g., yesterday). the "auto" value allows to not always have to use numeric values in the output. style the length of the internationalized message. possible values are: "long" (default, e.g., in 1 month) "short" (e.g., in 1 mo.), or "narrow" (e.g., in 1 mo.). the narrow style could be similar to the short style for some locales. examples basic format usage the following example shows how to create a relative time formatter using the english language. // create a ...
...ocales. examples basic format usage the following example shows how to create a relative time formatter using the english language. // create a relative time formatter in your locale // with default values explicitly passed in. const rtf = new intl.relativetimeformat("en", { localematcher: "best fit", // other values: "lookup" numeric: "always", // other values: "auto" style: "long", // other values: "short" or "narrow" }); // format relative time using negative value (-1). rtf.format(-1, "day"); // > "1 day ago" // format relative time using positive value (1). rtf.format(1, "day"); // > "in 1 day" using the auto option if numeric:auto option is passed, it will produce the string yesterday or tomorrow instead of 1 day ago or in 1 day. this allows to not always ...
Intl.RelativeTimeFormat.prototype.resolvedOptions() - JavaScript
during the initialization of the given relativetimeformat object. description the resulting object has the following properties: locale the bcp 47 language tag for the locale actually used. if any unicode extension values were requested in the input bcp 47 language tag that led to this locale, the key-value pairs that were requested and are supported for this locale are included in locale. style the length of the internationalized message. possible values are: "long" (default, e.g., in 1 month) "short" (e.g., in 1 mo.), or "narrow" (e.g., in 1 mo.). the narrow style could be similar to the short style for some locales. numeric the format of output message. possible values are: "always" (default, e.g., 1 day ago), or "auto" (e.g., yesterday). the "auto" value allows t...
...r "auto" (e.g., yesterday). the "auto" value allows to not always have to use numeric values in the output. numberingsystem the value requested using the unicode extension key "nu" or filled in as a default. examples using the resolvedoptions method var de = new intl.relativetimeformat('de-de'); var usedoptions = de.resolvedoptions(); usedoptions.locale; // "de-de" usedoptions.style; // "long" usedoptions.numeric; // "always" usedoptions.numberingsystem; // "latn" specifications specification status comment ecmascript internationalization api (ecma-402)the definition of 'relativetimeformat.resolvedoptions()' in that specification. stage 4 ...
Promise.prototype.then() - JavaScript
const nexttick = (() => { const noop = () => {}; // literally const nexttickpromise = () => promise.resolve().then(noop); const rfab = reflect.apply.bind; // (thisarg, fn, thisarg, [...args]) const nexttick = (fn, ...args) => ...
...l be rejected with 'error' after 1 second return new promise(rejectlater); }); p3.then(function(v) { // not called console.log('resolved', v); }, function(e) { console.error('rejected', e); // "rejected", 'error' }); window.setimmediate style promise-based polyfill using a function.prototype.bind() reflect.apply (reflect.apply()) method to create a (non-cancellable) window.setimmediate-style function. const nexttick = (() => { const noop = () => {}; // literally const nexttickpromise = () => promise.resolve().then(noop); const rfab = reflect.apply.bind; // (thisarg, fn, thisarg, [...args]) const nexttick = (fn, ...args) => ( fn !== undefined ? promise.resolve(args).then(rfab(null, fn, null)) : nexttickpromise(), undefined ); nexttick.ntp = nexttickpromis...
Lexical grammar - JavaScript
able code to prevent it from being executed; this can be a valuable debugging tool. javascript has two long-standing ways to add comments to code. the first way is the // comment; this makes all text following it on the same line into a comment. for example: function comment() { // this is a one line javascript comment console.log('hello world!'); } comment(); the second way is the /* */ style, which is much more flexible. for example, you can use it on a single line: function comment() { /* this is a one line javascript comment */ console.log('hello world!'); } comment(); you can also make multiple-line comments, like this: function comment() { /* this comment spans multiple lines. notice that we don't need to end the comment until we're done. */ console.log('hello wo...
...); note: hashbang comments in javascript mimic shebangs in unix used to run files with proper interpreter. although bom before hashbang comment will work in a browser it is not advised to use bom in a script with hasbang. bom will not work when you try to run the script in unix/linux. so use utf-8 without bom if you want to run scripts directly from shell. you must only use the #! comment style to specify a javascript interpreter. in all other cases just use a // comment (or mulitiline comment). keywords reserved keywords as of ecmascript 2015 break case catch class const continue debugger default delete do else export extends finally for function if import in instanceof new return super switch this throw try typeof var void while with yield future...
Transitioning to strict mode - JavaScript
his would silently fail, in contradiction with the user expectation. poisoned arguments and function properties accessing arguments.callee, arguments.caller, anyfunction.caller, or anyfunction.arguments throws an error in strict mode. ...
...n strict mode. the only legitimate use case would be to reuse a function as in: // example taken from vanillajs: http://vanilla-js.com/ var s = document.getelementbyid('thing').style; s.opacity = 1; (function() { if ((s.opacity-=.1) < 0) s.display = 'none'; else settimeout(arguments.callee, 40); })(); which can be rewritten as: 'use strict'; var s = document.getelementbyid('thing').style; s.opacity = 1; (function fadeout() { // name the function if((s.opacity-=.1) < 0) s.display = 'none'; else settimeout(fadeout, 40); // use the name of the function })(); semantic differences these differences are very subtle differences. it's possible that a test suite doesn't catch this kind of subtle difference. careful review of your code base will probably be necessary to be su...
background_color - Web app manifests
type string mandatory no the background_color member defines a placeholder background color for the application page to display before its stylesheet is loaded. this value is used by the user agent to draw the background color of a shortcut when the manifest is available before the stylesheet has loaded. therefore background_color should match the background-color css property in the site’s stylesheet for a smooth transition between launching the web application and loading the site's content. ...
...to draw the background color of a shortcut when the manifest is available before the stylesheet has loaded. therefore background_color should match the background-color css property in the site’s stylesheet for a smooth transition between launching the web application and loading the site's content. note: the background_color member is only meant to improve the user experience while the main stylesheet is loading from the network or the storage media; it is not used by the user agent as the background-color css property when the progressive web app stylesheet is available. examples "background_color": "red" specification specification status comment feedback web app manifestthe definition of 'background_color' in that specification. working draft i...
<mi> - MathML
Web › MathML › Element › mi
dir the text direction. possible values are either ltr (left to right) or rtl (right to left). href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. ...
...use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. mathsize the size of the content. see length for possible values. deprecated values are: small, normal and big. these will be removed in the future. mathvariant this logical class of the identifier, which varies in typography. that is, although the names suggest the typographic style for the class, semantically, items with the same class are treated "the same" within an expression, which might or might not involve displaying them with the named typography. the following values are allowed: normal (default value for more than one character) ; example bold ; example italic (default value for a single character) ; example bold-italic ; example double-struck ; ex...
<ms> - MathML
Web › MathML › Element › ms
als are displayed as enclosed by double quotes (&quot;); by using the lquote and rquote attributes, you can set custom characters to display. note that quotation marks should not be specified unless they are part of the string literal. the content of an <ms> element is not an ascii string per se, but rather a sequence of characters and <mglyph> and <malignmark> elements. attributes class, id, style provided for use with stylesheets. dir the text direction. possible values are either ltr (left to right) or rtl (right to left). lquote the opening quote character (depends on dir) to enclose the content. the default value is "&quot;". href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the tex...
...ml color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. mathsize the size of the content. see length for possible values. deprecated values are: small, normal and big. these will be removed in the future. mathvariant this attribute specifies the logical class of the identifier, which varies in typography. that is, although the names suggest the typographic style for the class, semantically, items with the same class are treated "the same" within an expression, which might or might not involve displaying them with the named typography. the following values are allowed: normal (default value) ; example bold ; example italic ; example bold-italic ; example double-struck ; example bold-fraktur ; example script ; example bold-script ; e...
<mtext> - MathML
Web › MathML › Element › mtext
dir the text direction. possible values are either ltr (left to right) or rtl (right to left). href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. ...
...ml color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. mathsize the size of the content. see length for possible values. deprecated values are: small, normal and big. these will be removed in the future. mathvariant this attribute specifies the logical class of the identifier, which varies in typography. that is, although the names suggest the typographic style for the class, semantically, items with the same class are treated "the same" within an expression, which might or might not involve displaying them with the named typography. the following values are allowed: normal (default value) ; example bold ; example italic ; example bold-italic ; example double-struck ; example bold-fraktur ; example script ; example bold-script ; e...
MathML element reference - MathML
> (grouped sub-expressions) s <ms> (string literal) <mscarries> (annotations such as carries) <mscarry> (single carry, child element of <mscarries>) <msgroup> (grouped rows of <mstack> and <mlongdiv> elements) <msline> (horizontal lines inside <mstack> elements) <mspace> (space) <msqrt> (square root without an index) <msrow> (rows in <mstack> elements) <mstack> (stacked alignment) <mstyle> (style change) <msub> (subscript) <msup> (superscript) <msubsup> (subscript-superscript pair) t <mtable> (table or matrix) <mtd> (cell in a table or a matrix) <mtext> (text) <mtr> (row in a table or a matrix) u <munder> (underscript) <munderover> (underscript-overscript pair) other elements <semantics> (container for semantic annotations) <annotation> (data annotations) <...
... other elements <semantics> (container for semantic annotations) <annotation> (data annotations) <annotation-xml> (xml annotations) mathml presentation elements by category top-level elements <math> token elements <mglyph> <mi> <mn> <mo> <ms> <mspace> <mtext> general layout <menclose> <merror> <mfenced> <mfrac> <mpadded> <mphantom> <mroot> <mrow> <msqrt> <mstyle> script and limit elements <mmultiscripts> <mover> <mprescripts> <msub> <msubsup> <msup> <munder> <munderover> <none> tabular math <maligngroup> <malignmark> <mlabeledtr> <mtable> <mtd> <mtr> elementary math <mlongdiv> <mscarries> <mscarry> <msgroup> <msline> <msrow> <mstack> uncategorized elements <maction> semantic annotations <annotation> <annotatio...
Performance fundamentals - Web Performance
r example when all the user's albums have been listed in a music player the key to fast startup is to keep two things in mind: upp is all that matters, and there's a "critical path" to each user-perceived event above. the critical path is exactly and only the code that must run to produce the event. for example, to paint an application's first frame that comprises visually some html and css to style that html: the html must be parsed the dom for that html must be constructed resources like images in that part of the dom have to be loaded and decoded the css styles must be applied to that dom the styled document has to be reflowed nowhere in that list is "load the js file needed for an uncommon menu"; "fetch and decode the image for the high scores list", etc. those work items are no...
...stcases and submitting bugs if the firefox and chrome developer tools don't help you find a problem, or if they seem to indicate that the web browser has caused the problem, try to provide a reduced test case that maximally isolates the problem. that often helps in diagnosing problems. see if you can reproduce the problem by saving and loading a static copy of an html page (including any images/stylesheets/scripts it embeds). if so, edit the static files to remove any private information, then send them to others for help (submit a bugzilla report, for example, or host it on a server and share the url). you should also share any profiling information you've collected using the tools listed above. ...
Web Performance
o web performance. here we'll introduce many of these features ad the basic level and provide links to deeper dives to improve performance for each topic. html performance features some attributes and the source order of your mark-up can impact the performance or your website. by minimizing the number of dom nodes, making sure the best order and attributes are used for including content such as styles, scripts, media, and third-party scripts, you can drastically improve the user experience. this article looks in detail at how html can be used to ensure maximum performance. multimedia: images and video the lowest hanging fruit of web performance is often media optimization. serving different media files based on each user agent's capability, size, and pixel density is possible. additional ti...
...impact video, audio, and image content has on performance, and the methods to ensure that impact is as minimal as possible. css performance features css may be a less important optimization focus for improved performance, but there are some css features that impact performance more than others. in this article we look at some css properties that impact performance and suggested ways of handling styles to ensure performance is not negatively impacted. javascript performance best practices javascript, when used properly, can allow for interactive and immersive web experiences — or it can significantly harm download time, render time, in-app performance, battery life, and user experience. this article outlines some javascript best practices that should be considered to ensure even complex co...
Mobile first - Progressive web apps (PWAs)
there is very little going on here, and anyone with a basic understanding of css should be able to understand most of it by just looking at the source code in app.css. particular bits of interest to point out are as follows. article { display: table; } nav { display: table-caption; caption-side: bottom; } this is ...
...there is very little going on here, and anyone with a basic understanding of css should be able to understand most of it by just looking at the source code in app.css. particular bits of interest to point out are as follows. article { display: table; } nav { display: table-caption; caption-side: bottom; } this is a rather nice hacky bit ...
SVG Presentation Attributes - SVG: Scalable Vector Graphics
that can be used as attributes on svg elements. ...
...cifies the size of the font. value: see css font-size; animatable: yes font-size-adjust it specifies that the font size should be chosen based on the height of lowercase letters rather than the height of capital letters. value: <number>|none|inherit; animatable: yes font-stretch it selects a normal, condensed, or expanded face from a font. value: see css font-stretch; animatable: yes font-style it specifies whether a font should be styled with a normal, italic, or oblique face from its font-family. value: normal|italic|oblique; animatable: yes font-variant it specifies whether a font should be used with some of their variation such as small caps or ligatures. value: see css font-variant; animatable: yes font-weight it specifies the weight (or boldness) of the font. value: normal...
alignment-baseline - SVG: Scalable Vector Graphics
specifications specification status comment css inline layoutthe definition of 'alignment-baseline' in that specification. working draft no change scalable vector graphics (s...
... specifications specification status comment css inline layoutthe definition of 'alignment-baseline' in that specification. working draft no change scalable vector graphics (svg) 2the definition of 'alignment-baseline' in that specification. candidate recommen...
baseFrequency - SVG: Scalable Vector Graphics
: <feturbulence> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <filter id="noise1" x="0" y="0" width="100%" height="100%"> <feturbulence basefrequency="0.025" /> </filter> <filter id="noise2" x="0" y="0" width="100%" height="100%"> <feturbulence basefrequency="0.05" /> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#noise1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#noise2); transform: translatex(220px);" /> </svg> usage notes value <number-optional-number> default value 0 animatable yes <number-optional-number> if two numbers are provided, the first one represents the base frequency in the horizontal direction and t...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'basefrequency' in that specification. recommendation initial definition ...
begin - SVG: Scalable Vector Graphics
Web › SVG › Attribute › begin
lns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- animated rectangle --> <rect x="10" y="35" height="15" width="0"> <animate attributetype="xml" attributename="width" from="0" to="100" begin="startbutton.click" dur="8s" fill="freeze" /> </rect> <!-- trigger --> <rect id="startbutton" style="cursor:pointer;" x="19.5" y="62.5" rx="5" height="25" width="80" fill="#efefef" stroke="black" stroke-width="1" /> <text x="60" y="80" text-anchor="middle" style="pointer-events:none;">click me.</text> <!-- grid --> <text x="10" y="20" text-anchor="middle">0s</text> <line x1="10" y1="25" x2="10" y2="55" stroke="grey" stroke-width=".5" /> <text ...
...000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- animated rectangles --> <rect x="10" y="35" height="15" width="0"> <animate attributetype="xml" attributename="width" from="0" to="100" begin="accesskey(s)" dur="8s" fill="freeze" /> </rect> <!-- trigger --> <text x="60" y="80" text-anchor="middle" style="pointer-events:none;">hit the "s" key</text> <!-- grid --> <text x="10" y="20" text-anchor="middle">0s</text> <line x1="10" y1="25" x2="10" y2="55" stroke="grey" stroke-width=".5" /> <text x="35" y="20" text-anchor="middle">2s</text> <line x1="35" y1="25" x2="35" y2="55" stroke="grey" stroke-width=".5" /> <text x="60" y="20" text-anchor="middle">4s</text> <line x1="6...
dominant-baseline - SVG: Scalable Vector Graphics
candidate recommendation refers to the specification in working draft and explicitly mentions the removal of the ...
... candidate recommendation refers to the specification in working draft and explicitly mentions the removal of the values use-script, no-change, and reset-size. css inline layoutthe definition of 'domi...
end - SVG: Scalable Vector Graphics
Web › SVG › Attribute › end
g" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- animated rectangle --> <rect x="10" y="35" height="15" width="0"> <animate attributetype="xml" attributename="width" from="0" to="100" begin="0s" end="endbutton.click" dur="8s" repeatcount="indefinite" fill="freeze" /> </rect> <!-- trigger --> <rect id="endbutton" style="cursor:pointer;" x="19.5" y="62.5" rx="5" height="25" width="80" fill="#efefef" stroke="black" stroke-width="1" /> <text x="60" y="80" text-anchor="middle" style="pointer-events:none;">click me.</text> <!-- grid --> <text x="10" y="20" text-anchor="middle">0s</text> <line x1="10" y1="25" x2="10" y2="55" stroke="grey" stroke-width=".5" /> <text ...
...xlink="http://www.w3.org/1999/xlink"> <!-- animated rectangles --> <rect x="10" y="35" height="15" width="0"> <animate attributetype="xml" attributename="width" from="0" to="100" begin="0s" end="accesskey(e)" dur="8s" repeatcount="indefinite" fill="freeze" /> </rect> <!-- trigger --> <text x="60" y="80" text-anchor="middle" style="pointer-events:none;">hit the "s" key</text> <!-- grid --> <text x="10" y="20" text-anchor="middle">0s</text> <line x1="10" y1="25" x2="10" y2="55" stroke="grey" stroke-width=".5" /> <text x="35" y="20" text-anchor="middle">2s</text> <line x1="35" y1="25" x2="35" y2="55" stroke="grey" stroke-width=".5" /> <text x="60" y="20" text-anchor="middle">4s</text> <line x1="6...
flood-opacity - SVG: Scalable Vector Graphics
a number of 0 or a per...
... a number of 0 or a percentage of 0% represents a fully transparent color, 1 or 100% represents a fu...
mode - SVG: Scalable Vector Graphics
Web › SVG › Attribute › mode
specifications ...
... specifications specification status comment filter effects module level 1the definition of 'mode' in that specification. working draft ...
order - SVG: Scalable Vector Graphics
Web › SVG › Attribute › order
the values provided mus...
...the values provided must be <integer>s greater than zero. values that are not integers will be trunca...
overflow - SVG: Scalable Vector Graphics
specified on an <svg> element, a scrollbar or panner is normally shown for the svg viewport whether or not any of its content is clipped. within svg content, the value auto implies that all rendered content for child elements must be visible, either through a scrolling mechanism, or by rendering with no clip. although the initial value for overflow is auto, it is overwritten in the user agent style sheet for the <svg> element when it is not the root element of a stand-alone document, the <pattern> element, and the <marker> element to be hidden by default. note: as a presentation attribute, overflow can be used as a css property. see the css opacity property for more information. as a presentation attribute, it can be applied to any element but it has effect only on the following eight ele...
...flow property. specifications specification status comment css level 2 (revision 1)the definition of 'overflow' in that specification. recommendation definition in css scalable vector graphics (svg) 2the definition of 'overflow' in that specification. candidate recommendation simplifies the definition and outlines the values within the user agent stylesheet. scalable vector graphics (svg) 1.1 (second edition)the definition of 'overflow' in that specification. recommendation initial definition ...
scale - SVG: Scalable Vector Graphics
Web › SVG › Attribute › scale
when the value of this attribute is 0, this operation has n...
... when the value of this attribute is 0, this operation has no effect on the source image. specifications specification stat...
seed - SVG: Scalable Vector Graphics
Web › SVG › Attribute › seed
tml, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <filter id="noise1" x="0" y="0" width="100%" height="100%"> <feturbulence basefrequency="0.025" seed="0" /> </filter> <filter id="noise2" x="0" y="0" width="100%" height="100%"> <feturbulence basefrequency="0.025" seed="100" /> </filter> <rect x="0" y="0" width="200" height="200" style="filter:url(#noise1);" /> <rect x="0" y="0" width="200" height="200" style="filter:url(#noise2); transform: translatex(220px);" /> </svg> usage notes value <number> default value 0 animatable yes example <svg width="200" height="200" viewbox="0 0 220 220" xmlns="http://www.w3.org/2000/svg"> <filter id="displacementfilter"> <feturbulenc...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'seed' in that specification. recommendation initial definition ...
specularExponent - SVG: Scalable Vector Graphics
value <number> default value 1 animatable yes fespotlight for <fespot...
... value <number> default value 1 animatable yes fespotlight for <fespotlight>, specularexponent defines the exponent value controlling the focus for the light source...
stitchTiles - SVG: Scalable Vector Graphics
t: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <filter id="noise1" x="0" y="0" width="100%" height="100%"> <feturbulence basefrequency="0.025" stitchtiles="nostitch" /> </filter> <filter id="noise2" x="0" y="0" width="100%" height="100%"> <feturbulence basefrequency="0.025" stitchtiles="stitch" /> </filter> <rect x="0" y="0" width="100" height="100" style="filter: url(#noise1);" /> <rect x="0" y="0" width="100" height="100" style="filter: url(#noise1); transform: translate(100px, 0);" /> <rect x="0" y="0" width="100" height="100" style="filter: url(#noise1); transform: translate(0, 100px);" /> <rect x="0" y="0" width="100" height="100" style="filter: url(#noise1); transform: translate(100px, 100px);" /> <rect x="0" y="0" width="100" heigh...
...: url(#noise1);" /> <rect x="0" y="0" width="100" height="100" style="filter: url(#noise1); transform: translate(100px, 0);" /> <rect x="0" y="0" width="100" height="100" style="filter: url(#noise1); transform: translate(0, 100px);" /> <rect x="0" y="0" width="100" height="100" style="filter: url(#noise1); transform: translate(100px, 100px);" /> <rect x="0" y="0" width="100" height="100" style="filter: url(#noise2); transform: translate(220px, 0);" /> <rect x="0" y="0" width="100" height="100" style="filter: url(#noise2); transform: translate(320px, 0);" /> <rect x="0" y="0" width="100" height="100" style="filter: url(#noise2); transform: translate(220px, 100px);" /> <rect x="0" y="0" width="100" height="100" style="filter: url(#noise2); transform: translate(320px, 100px);" /> </...
surfaceScale - SVG: Scalable Vector Graphics
value <number> default value 1 animatable yes fediffuselighting for <fediffuselighting>, surfa...
... value <number> default value 1 animatable yes fediffuselighting for <fediffuselighting>, surfacescale defines the height of the surface. value <number> default ...
text-anchor - SVG: Scalable Vector Graphics
for an element with a direction property value of...
...for an element with a direction property value of ltr (typical for most european languages), the left side of the text is rendered at the initia...
type - SVG: Scalable Vector Graphics
Web › SVG › Attribute › type
d. the other keywords represent convenience shortcuts to allow commonly used color operations to be performed without specifying a complete matrix. for the <fefuncr>, <fefuncg>, <fefuncb>, and <fefunca> elements, it indicates the type of component transfer function. for the <feturbulence> element, it indicates whether the filter primitive should perform a noise or turbulence function. for the <style> and <script> elements, it defines the content type of the element. usage context for the <animatetransform> elements categories none value translate | scale | rotate | skewx | skewy animatable no normative document svg 1.1 (2nd edition) for the <fecolormatrix> element categories none value matrix | saturate | hue...
...d <fefunca> elements categories none value identity | table | discrete | linear | gamma animatable yes normative document svg 1.1 (2nd edition) for the <feturbulence> element categories none value fractalnoise | turbulence animatable yes normative document svg 1.1 (2nd edition) for the <style> and <script> elements categories none value <content-type> animatable no normative document svg 1.1 (2nd edition) : script svg 1.1 (2nd edition) : style example elements the following elements can use the values attribute <animatetransform> <fecolormatrix> <fefunca> <fefuncb> <fefuncg> <fefuncr> <feturbulence> <script> <sty...
z - SVG: Scalable Vector Graphics
Web › SVG › Attribute › z
value <number> default...
... value <number> default value 1 animatable yes fespotlight for <fespotlight>, z defines ...
<defs> - SVG: Scalable Vector Graphics
Web › SVG › Element › defs
adient id="mygradient" gradienttransform="rotate(90)"> <stop offset="20%" stop-color="gold" /> <stop offset="90%" stop-color="red" /> </lineargradient> </defs> <!-- using my graphical objects --> <use x="5" y="5" xlink:href="#mycircle" fill="url('#mygradient')" /> </svg> attributes global attributes core attributes most notably: id lang styling attributes class, style event attributes global event attributes, document element event attributes, graphical event attributes presentation attributes most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, fill, fill-opacity, fill-rule, filter, mask, opacity, pointer-events, shape-rendering, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stro...
... candidate recommendation no change scalable vector graphics (svg) 1.1 (second edition)the definition of '<defs>' in that specification. recommendation initial definition ...
<feBlend> - SVG: Scalable Vector Graphics
Web › SVG › Element › feBlend
certain blending mode. this is similar to what is known from image editing software when blending two layers. the mode is defined by the mode attribute. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in in2 mode dom interface this element implements the svgfeblendelement interface. example svg <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <filter id="spotlight"> <feflood result="floodfill" x="0" y="0" width="100%" height="100%" flood-color="green" flood-opacity="1"/...
... working draft outsourced blend modes to compositing and blending level 1 scalable vector graphics (svg) 1.1 (second edition)the definition of '<feblend>' in that specification. rec...
<feConvolveMatrix> - SVG: Scalable Vector Graphics
example svg <svg width="200" height="200" viewbox="0 0 200 200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <filter id="emboss"> <...
... working draft scalable vector graphics (svg) 1.1 (second edition)the definition of '<feconvolvematrix>' in that specification. recommendation initial definition ...
<feDisplacementMap> - SVG: Scalable Vector Graphics
ge, in, and p'(x,y) is the destination. xc(x,y) and yc(x,y) are the component values of the channel designated by xchannelselector and ychannelselector. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in in2 scale xchannelselector ychannelselector dom interface this element implements the svgfedisplacementmapelement interface. example <svg width="200" height="200" viewbox="0 0 220 220" xmlns="http://www.w3.org/2000/svg"> <filter id="displacementfilter"> <feturbulence type="turbulence" basefrequency="0.05" numoctaves="2" result="turbulence"/>...
... working draft no changes scalable vector graphics (svg) 1.1 (second edition)the definition of '<fedisplacementmap>' in that specification. recommendation initial defi...
<feFlood> - SVG: Scalable Vector Graphics
Web › SVG › Element › feFlood
the <feflood> svg filter primitive fills the filter subregion with the color and opacity defined by flood-color and flood-opacity. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <animatecolor>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes flood-color flood-opacity dom interface this element implements the svgfefloodelement interface. example html content <svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"> <defs> <filter id="floodfilter" filterunits="userspaceonuse"> <feflood x="50" y="50" width="100" height="100" flood-color="green" flood-opacity="0.5"/> </filter> ...
... flood-color flood-opacity dom interface this element implements the svgfefloodelement interface. example html content <svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"> <defs> <filter id="floodfilter" filterunits="userspaceonuse"> <feflood x="50" y="50" width="100" height="100" flood-color="green" flood-opacity="0.5"/> </filter> </defs> <use style="filter: url(#floodfilter);"/> </svg> result specifications specification status comment filter effects module level 1the definition of '<feflood>' in that specification. working draft removed <icccolor> value from flood-color property and defined that the alpha channel of it gets multiplied with the computed value of the flood-opacity property. clarified va...
<feImage> - SVG: Scalable Vector Graphics
Web › SVG › Element › feImage
example svg <svg viewbox="0 0 200 200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <filter id="image"> <feimage xlink:href="/files/6457/mdn_logo_only_color.png"/> </filter> <...
...pectratio xlink:href dom interface this element implements the svgfeimageelement interface. example svg <svg viewbox="0 0 200 200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <filter id="image"> <feimage xlink:href="/files/6457/mdn_logo_only_color.png"/> </filter> </defs> <rect x="10%" y="10%" width="80%" height="80%" style="filter:url(#image);"/> </svg> result specifications specification status comment filter effects module level 1the definition of '<feimage>' in that specification. working draft added href attribute and deprecated xlink:href. added crossorigin attribute. scalable vector graphics (svg) 1.1 (second edition)the definition of '<feimage>' in that specifi...
<feMerge> - SVG: Scalable Vector Graphics
Web › SVG › Element › feMerge
specifications specification status comment filter effects module level ...
...r stddeviation="5" result="blur2" /> <femerge> <femergenode in="blur2" /> <femergenode in="sourcegraphic" /> </femerge> </filter> <rect x="40" y="40" width="100" height="100" style="stroke: #000000; fill: green; filter: url(#feoffset);" /> </svg> result attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes none dom interface this element implements the svgfemergeelement interface. specifications specification status comment filter effects module level 1the definition of '<femerge>' in that specification. working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of '<femerge>' in that specification.
<feMergeNode> - SVG: Scalable Vector Graphics
specifications specification status comment ...
... specifications specification status comment filter effects module level 1the definition of '<femergenode>' in that specification. working draft ...
<feSpecularLighting> - SVG: Scalable Vector Graphics
> method. multiple light sources can be simulated by adding several of these light maps before applying it to the texture image. usage context categoriesfilter primitive elementpermitted contentexactly one light source element first and any number of descriptive elements in any order. attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in surfacescale specularconstant specularexponent kernelunitlength dom interface this element implements the svgfespecularlightingelement interface. example <svg height="200" width="200" viewbox="0 0 220 220" xmlns="http://www.w3.org/2000/svg"> <filter id = "filter"> <fespecularlighting result="specout" specularexponent="20" lighting-color="#bbb...
... working draft removed limitation of specularexponent attribute. scalable vector graphics (svg) 1.1 (second edition)the definition of '<fespecularlighting>' in that specificatio...
<feTile> - SVG: Scalable Vector Graphics
Web › SVG › Element › feTile
vg filter primitive allows to fill a target rectangle with a repeated, tiled pattern of an input image. the effect is similar to the one of a <pattern>. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in dom interface this element implements the svgfetileelement interface. example svg <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <filter id="tile" x="0" y="0" width="100%" height="100%"> <fetile in="sourcegraphic" x="50" y="50" width="100" height="100" /> <fetile/...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of '<fetile>' in that specification. recommendation initial definition ...
<feTurbulence> - SVG: Scalable Vector Graphics
nce function. it allows the synthesis of artificial textures like clouds or marble. the resulting image will fill the entire filter primitive subregion. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes basefrequency numoctaves seed stitchtiles type dom interface this element implements the svgfeturbulenceelement interface. example <svg width="200" height="200" viewbox="0 0 220 220" xmlns="http://www.w3.org/2000/svg"> <filter id="displacementfilter"> <feturbulence type="turbulence" basefrequency="0.05" numoctaves="2" result="turbulence"/> ...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of '<feturbulence>' in that specification. recommendation initial definition ...
<g> - SVG: Scalable Vector Graphics
Web › SVG › Element › g
"0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <!-- using g to inherit presentation attributes --> <g fill="white" stroke="green" stroke-width="5"> <circle cx="40" cy="40" r="25" /> <circle cx="60" cy="60" r="25" /> </g> </svg> attributes this element only includes global attributes global attributes core attributes most notably: id, tabindex styling attributes class, style conditional processing attributes most notably: requiredextensions, systemlanguage event attributes global event attributes, graphical event attributes presentation attributes most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, fill, fill-opacity, fill-rule, filter, mask, opacity, pointer-events, shape-rendering, stroke, stroke-dasharray, stroke...
... candidate recommendation scalable vector graphics (svg) 1.1 (second edition)the definition of '<g>' in that specification. recommendation initial definition ...
<image> - SVG: Scalable Vector Graphics
Web › SVG › Element › image
to include dynamic svg elements, try <use> with an external url. ...
...behavior only apply inside svg documents or inline svg. usage context categoriesgraphics element, graphics referencing elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements attributes global attributes conditional processing attributes core attributes graphical event attributes presentation attributes xlink attributes class style externalresourcesrequired transform specific attributes x: positions the image horizontally from the origin. y: positions the image vertically from the origin. width: the width the image renders at. unlike html's <img>, this attribute is required. height: the height the image renders at. unlike html's <img>, this attribute is required. href and xlink:href: points at a url for the image...
<marker> - SVG: Scalable Vector Graphics
Web › SVG › Element › marker
fines the y coordinate for the reference point of the marker. value type: top|center|bottom|<coordinate> ; default value: 0; animatable: yes viewbox this attribute defines the bound of the svg viewport for the current svg fragment. ...
... working draft scalable vector graphics (svg) 2the definition of '<marker>' in that specification. candidate recommendation scalable vector graphics (svg) 1.1 (second edition)the definition of '<marker>...
<mask> - SVG: Scalable Vector Graphics
Web › SVG › Element › mask
ault value: -10%; animatable: yes y this attribute defines the y-axis coordinate of the top-left corner of the masking area. value type: <coordinate> ; default value: -10%; animatable: yes width this attribute defines the width of the masking area. ...
... candidate recommendation scalable vector graphics (svg) 1.1 (second edition)the definition of '<mask>' in that specification. recommendation initial definition ...
<pattern> - SVG: Scalable Vector Graphics
Web › SVG › Element › pattern
lue: none; animatable: yes note: for browsers implementing href, if both href and xlink:href are set, xlink:href will be ignored and only href will be used. y this attribute determines the y coordinate shift of the pattern tile. ...
... candidate recommendation scalable vector graphics (svg) 1.1 (second edition)the definition of '<pattern>' in that specification. recommendation initial definition ...
<script> - SVG: Scalable Vector Graphics
Web › SVG › Element › script
value type: <string>; default value: ?; animatable: yes href the url to the script to load. value type: <url> ; default value: none; animatable: no type this attribute defines type of the scri...
...pe: <url> ; default value: none; animatable: no type this attribute defines type of the script language to use. value type: <string>; default value: application/ecmascript; animatable: no xlink:href deprecated since svg 2 the url to the script to load. value type: <url> ; default value: none; animatable: no global attributes core attributes most notably: id styling attributes class, style event attributes global event attributes, document element event attributes usage notes categoriesnonepermitted contentany elements or character data specifications specification status comment scalable vector graphics (svg) 2the definition of '<script>' in that specification. candidate recommendation scalable vector graphics (svg) 1.1 (second ed...
<set> - SVG: Scalable Vector Graphics
Web › SVG › Element › set
nably be interpolated, such as string and boolean values. for attributes that can be reasonably be interpolated, the <animate> is usualy prefered. note: the <set> element is non-additive. the additive and accumulate attributes are not allowed, and will be ignored if specified. html,body,svg { height:100%; margin:0; padding:0; } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <style> rect { cursor: pointer } .round { rx: 5px; fill: green; } </style> <rect id="me" width="10" height="10"> <set attributename="class" to="round" begin="me.click" dur="2s" /> </rect> </svg> attributes to this attribute defines the value to be applied to the target attribute for the duration of the animation. the value must match the requirements of the target attribute. ...
...tribute. value type: <anything>; default value: none; animatable: no animation attributes animation timing attributes begin, dur, end, min, max, restart, repeatcount, repeatdur, fill other animation attributes most notably: attributename animation event attributes most notably: onbegin, onend, onrepeat global attributes core attributes most notably: id styling attributes class, style event attributes global event attributes, document element event attributes usage notes categoriesanimation elementpermitted contentany number of the following elements, in any order:descriptive elements specifications specification status comment svg animations level 2the definition of '<set>' in that specification. editor's draft scalable vecto...
<tspan> - SVG: Scalable Vector Graphics
Web › SVG › Element › tspan
the svg <tspan> element defines a subtext within a <text> element or another <tspan> element. it allows for adjustment of the style and/or position of that subtext as needed. html,body,svg { height:100% } <svg viewbox="0 0 240 40" xmlns="http://www.w3.org/2000/svg"> <style> text { font: italic 12px serif; } tspan { font: bold 10px sans-serif; fill: red; } </style> <text x="10" y="30" class="small"> you are <tspan>not</tspan> a banana! </text> </svg> attributes x the x coordinate of the starting point of the text baseline. value type: <length>|<percentage> ; default value: none; animatable: yes y the y coordinate of the starting point of the text baseline. value type: <length>|<percentage> ; default value: none; animatable: yes dx shifts the text...
...w the text is stretched or compressed to fit the width defined by the textlength attribute. value type: spacing|spacingandglyphs; default value: spacing; animatable: yes textlength a width that the text should be scaled to fit. ...
Example - SVG: Scalable Vector Graphics
ote position. combined, we get this very natural-looking behavior. this is done completely in w3c standards–xhtml, svg, and javascript–no flash or any vendor-specific extensions. this example should work in firefox 1.5 and above. ...
...le <?xml version='1.0'?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg"> <head> <title>a swarm of motes</title> <style type='text/css'> <![cdata[ label, input { width: 150px; display: block; float: left; margin-bottom: 10px; } label { text-align: right; width: 75px; padding-right: 20px; } br { clear: left; } ]]> </style> </head> <body onload='update()'> <svg:svg id='display' width='400' height='300'> <svg:circle id='cursor' cx='200' cy='150' r='7' fill='#0000ff' fill-opacity='0.5'/> </svg:svg> <p>a swarm of motes, governed by two simple principles. first, each mote tries to move towards the cursor, and second each mote tries to move away from the average mote position. combined, we get this ver...
SVG 1.1 Support in Firefox - SVG: Scalable Vector Graphics
ementation status a quick overview of the svg 1.1 elements and the current status of the native support. element notes structure module svg implemented. currentscale and currenttranslate dom attributes are implemented, but there is no pan and zoom user interface. svgsvgelement unimplemented attributes: contentscripttype, contentstyletype, viewport, currentview unimplemented bindings: getintersectionlist, getenclosurelist, checkintersection, checkenclosure g implemented. defs implemented. desc implemented. only stored in the dom, no user interface. title implemented. the ...
... implemented. use implemented. doesn't completely follow <svg:use> cascading rules (bug 265894). doesn't deliver events to a svgelementinstance tree (bug 265895). conditional processing module switch implemented. image module image implemented. style module style implemented. shape module path implemented. svgpathelement interface unimplemented attributes: normalizedpathseglist, animatednormalizedpathseglist rect implemented. circle implemented. line imp...
Scripting - SVG: Scalable Vector Graphics
Web › SVG › Scripting
note the existence of all three arguments setting properties. preventing default behavior in event code when writing drag and drop code, sometimes you'll find that text on the page gets accidently selected while dragging. ...
...according to the svg wiki the "parent" js variable is broken in adobe's svg version 6 preview plugin. the suggested workaround is to use "top" instead of "parent". since it is a beta version of their plugin, we can probably safely ignore this. more information and some examples can be found on the svg wiki inter-document scripting page. setproperty has three parameters the function svgelement.style.setproperty("fill-opacity", "0.0") throws a domexception - syntax err in mozilla. this behaviour is specified by the w3c in the dom level 2 style specification. the function setproperty is defined as a function with three parameters. the above can be replaced with 'svgelement.style.setproperty("fill-opacity", "0.0", "")', which is standards compliant. links svg wiki on scripting and programming...
Basic Transformations - SVG: Scalable Vector Graphics
</g> </svg> all following transformations are summed up in an element's transform attribute. transformations can be chained simply by concatenating them, separated by whitespace. translation it may be necessary to move an element around, even though you can position it with the according attributes. for this purpose, the translate() transformation stands ready. <svg width="40" height="50" style="background-color:#bff;"> <rect x="0" y="0" width="10" height="10" transform="translate(30,40)" /> </svg> the example will render a rectangle, translated to the point (30,40) instead of (0,0). if the second value is not given, it is assumed to be 0. rotation rotating an element is quite a common task. use the rotate() transformation for this: <svg width="31" height="31"> <rect x="...
..."> <rect x="12" y="-10" width="20" height="20" transform="rotate(45)" /> </svg> this example shows a square that is rotated by 45 degrees. the value for rotate() is given in degrees. multiple transformations transformations can be concatenated easily just by separating them with spaces. for example, translate() and rotate() are common used transformations. <svg width="40" height="50" style="background-color:#bff;"> <rect x="0" y="0" width="10" height="10" transform="translate(30,40) rotate(45)" /> </svg> this example shows again the small square shown above that this time is also rotated by 45 degrees. skewing to make a rhombus out of our rectangle, the skewx() and skewy() transformations are available. each one takes an angle that determines how far the element will be s...
Patterns - SVG: Scalable Vector Graphics
Web › SVG › Tutorial › Patterns
here, we've just drawn two rectangle elements inside the pattern (which overlap, and one of which is twice the size of the other and is used to fill in the entire pattern), and one circle. the confusing thing about patterns is defining a unit system and their size. in the example above, we've defined a width and hei...
...here, we've just drawn two rectangle elements inside the pattern (which overlap, and one of which is twice the size of the other and is used to fill in the entire pattern), and one circle. the confusing thing about patterns is defining a unit system and their size. in the example above, we've defined a width and height attribute on the pat...
Mixed content - Web security
webpage is public and has no sensitive data about the user, using mixed active content still provides the attacker with the opportunity to redirect the user to other http pages and steal http cookies from those sites. active content examples this section lists some types of http requests which are considered active content: <script> (src attribute) <link> (href attribute) (this includes css stylesheets) <iframe> (src attribute) xmlhttprequest requests fetch() requests all cases in css where a <url> value is used (@font-face, cursor, background-image, and so forth). <object> (data attribute) navigator.sendbeacon (url attribute) other resource types like web fonts and workers may be considered active mixed content, as they are in chrome. warnings in web console the firefox web con...
...ent can be blocked by setting a preference). to make it easier for web developers to find mixed content errors, all blocked mixed content requests are logged to the security pane of the web console, as seen below: to fix this type of error, all requests to http content should be removed and replaced with content served over https. some common examples of mixed content include javascript files, stylesheets, images, videos, and other media. note: since firefox 55, the loading of mixed content is allowed on http://127.0.0.1/ (see bug 903966). chrome allows mixed content on http://127.0.0.1/ and http://localhost/. safari does not allow any mixed content. ...
Loading Content Scripts - Archive of obsolete content
fter the document element for the page is inserted into the dom. at this point the dom content hasn't been loaded yet, so the script won't be able to interact with it. "ready" loads the scripts after the dom for the page has been loaded: that is, at the point the domcontentloaded event fires. at this point, content scripts are able to interact with the dom content, but externally-referenced stylesheets and images may not have finished loading. "end" loads the scripts after all content (dom, js, css, images) for the page has been loaded, at the time the window.onload event fires. the default value is "end". the contentscriptoptions is a json that is exposed to content scripts as a read only value under self.options property. any kind of jsonable value (object, array, string, et...
notifications - Archive of obsolete content
usage this api supports desktop notifications on windows, os x using growl (and notification center as of os x 10.9 mavericks), and linux using libnotify. here's a typical example. when the message is clicked, a string is logged to the console. var notifications = require("sdk/notifications"); notifications.notify({ title: "jabberwocky", text: "'twas brillig, and the slithy toves", data: "did gyre and gimble in the wabe", onclick: function (data) { console.log(data); // console.log(this.data) would produce the same result. } }); this one displays an icon that's stored in the add-on's data directory. see the self module documentation for more information. ...
High-Level APIs - Archive of obsolete content
thms. clipboard interact with the system clipboard, setting and getting its contents. context-menu adds items, submenus, and menu separators to the page's context menu. hotkeys assign hotkey combinations to functions in your add-on. indexed-db exposes the indexeddb api to add-ons. l10n localize strings appearing in the add-on's javascript code. notifications display transient, toaster-style desktop messages to the user. page-mod run scripts in the context of web pages whose url matches a given pattern. page-worker create a permanent, invisible page and access its dom. panel creates transient dialogs to implement part of an add-on's user interface. passwords interact with firefox's password manager to add, retrieve and remove stored credentials. private-browsing check wheth...
/loader - Archive of obsolete content
mponents.utils.import('resource://gre/modules/commonjs/toolkit/loader.js'); it can be required as a commonjs module from a module loaded in the loader itself: let { loader, require, unload } = require('toolkit/loader'); what is it good for ? create somewhat standardized js environments that people doing non-browser js are familiar with. provide an environment for loading commonjs style modules, which makes it possible to consume lots of interesting code that has already been developed. secure each module in an isolated js sandbox and makes any capability imports explicit via calls to the require() function. create task specific loaders with restricted module access. provide unload hooks that may be used to undo changes made by anything loaded into it. instantiation the lo...
ui/sidebar - Archive of obsolete content
code like this: var sidebar = require("sdk/ui/sidebar").sidebar({ id: 'my-sidebar', title: 'my sidebar', url: "./sidebar.html" }); you can include javascript and css from the html as you would with any web page, for example using <script> and <link> tags containing a path relative to the html file itself. <!doctype html> <html> <head> <link href="stuff.css" type="text/css" rel="stylesheet"> </head> <body> <script type="text/javascript" src="stuff.js"></script> </body> </html> you can update the sidebar's content by setting the sidebar's url property. this will change the sidebar's content across all windows. communicating with sidebar scripts you can't directly access your sidebar's content from your main add-on code, but you can send messages between your main ...
Low-Level APIs - Archive of obsolete content
rget listen to changes to the preferences system in firefox. preferences/service access the preferences system in firefox. remote/child enables an sdk module loaded into a child process to access web content in the child process and communicate with modules in the main process. remote/parent enables you to load modules, and privileged parts of your add-on in general, into child processes. stylesheet/style modify styles using stylesheet files or css rules. stylesheet/utils helper functions for working with stylesheets. system/child_process an implementation of the node.js child_process api. system/environment access, set and clear environment variables. system/events api for working with the application observer service. system/runtime access to information about firefox's run...
Creating annotations - Archive of obsolete content
e panel's context. so create a subdirectory under data called editor. this will contain two files: the html content, and the content script. annotation editor html the html is very simple: <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>annotation</title> <style type="text/css" media="all"> body { font: 100% arial, helvetica, sans-serif; background-color: #f5f5f5; } textarea { width: 180px; height: 180px; margin: 10px; padding: 0px; } </style> </head> <body> <textarea rows='10' cols='20' id='annotation-box'> </textarea> </body> </html> save this inside data/editor as annotation-editor.html. annotation editor conte...
Displaying annotations - Archive of obsolete content
le to use as a template a simple content script to build the panel's content these files will live in a new subdirectory of data which we'll call annotation. annotation panel html <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>annotation</title> <style media="all" type="text/css"> body { font: 100% arial, helvetica, sans-serif; background-color: #f5f5f5; } div { text-align:left; } </style> </head> <body> <div id="annotation"> </div> </body> </html> save this in data/annotation as annotation.html. annotation panel content script the annotation panel has a minimal content script that sets the text: self.
List Open Tabs - Archive of obsolete content
es a script to all open tabs. the script adds a red border to the tab's document: require("sdk/ui/button/action").actionbutton({ id: "list-tabs", label: "list tabs", icon: "./icon-16.png", onclick: listtabs }); function listtabs() { var tabs = require("sdk/tabs"); for (let tab of tabs) runscript(tab); } function runscript(tab) { tab.attach({ contentscript: "document.body.style.border = '5px solid red';" }); } learning more to learn more about working with tabs in the sdk, see the tabs api reference. to learn more about running scripts in tabs, see the tutorial on using tab.attach(). ...
Listen for Page Load - Archive of obsolete content
web console. you don't get direct access to any content hosted in the tab. to access tab content you need to attach a script to the tab using tab.attach(). this add-on attaches a script to all open tabs. the script adds a red border to the tab's document: require("sdk/tabs").on("ready", runscript); function runscript(tab) { tab.attach({ contentscript: "if (document.body) document.body.style.border = '5px solid red';" }); } (this example is only to show the idea: to implement something like this, you should instead use page-mod, and specify "*" as the match-pattern.) learning more to learn more about working with tabs in the sdk, see the tabs api reference. you can listen for a number of other tab events, including open, close, and activate. to learn more about running scripts...
Developing for Firefox Mobile - Archive of obsolete content
onal supported lang/type supported loader/cuddlefish supported loader/sandbox supported net/url supported net/xhr supported places/bookmarks not supported places/favicon not supported places/history not supported platform/xpcom supported preferences/service supported stylesheet/style supported stylesheet/utils supported system/environment supported system/events supported system/runtime supported system/unload supported system/xul-app supported tabs/utils supported test/assert supported test/harness supported test/httpd supported test/...
Open a Web Page - Archive of obsolete content
irect access to any content hosted in the tab. to access tab content you need to attach a script to the tab using tab.attach(). this add-on loads a page, then attaches a script to the page which adds a red border to it: var tabs = require("sdk/tabs"); tabs.open({ url: "http://www.example.com", onready: runscript }); function runscript(tab) { tab.attach({ contentscript: "document.body.style.border = '5px solid red';" }); } learning more to learn more about working with tabs in the sdk, see the tabs api reference. to learn more about running scripts in tabs, see the tutorial on using tab.attach(). ...
Embedding SVG - Archive of obsolete content
/www.w3.org/1999/xlink"> <body> <p>hello</p> <svg:svg version="1.1" baseprofile="full" width="150" height="150"> <svg:rect x="10" y="10" width="100" height="100" fill="red"/> <svg:circle cx="50" cy="50" r="30" fill="blue"/> </svg:svg> <p>world</p> </body> </html> embedding into xul make sure you use the right namespace when embedding <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- xul and svg go here --> </window> example: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window xmlns="http://www.moz...
Examples and demos from articles - Archive of obsolete content
sage when current document changes. do something if an external page has changed since last visit here is a possible example of how to show an alert message when an external page changes. import scripts here is a possible example of how to dynamically import scripts with javascript. css css tutorial aimed at complete beginners, this css tutorial for beginners introduces you to cascading style sheets (css). it guides you through the basic features of the language with practical examples that you can try for yourself on your own computer and illustrates the standard features of css that work in modern browsers. dropdown menus rules how to create pure-css dropdown menus. ...
Miscellaneous - Archive of obsolete content
the application. example for firefox: services.startup.quit(services.startup.eforcequit|services.startup.erestart); mouse and keyboard detecting mouse wheel events when scrolling the mouse wheel on an element, the dommousescroll event fires. event.detail contains the number of lines to scroll. this event is mozilla-only; other browsers may support window.onmousewheel. <div id="scrollarea" style="overflow: scroll; height: 6em; width: 10em;"> this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrollin...
QuerySelector - Archive of obsolete content
array.prototype.slice.call(el.queryselectorall(selector)); } alert($('#myid').id); (note that while using the firefox web console, the above functions are available automatically.) both xul and even xml can be easily made supportable (an alternative approach to the following would be to add chromewindow.prototype or window.prototype, accessing this.document.queryselector, or following the jquery style of chaining by returning 'this' within each prototype method of $()): htmldocument.prototype.$ = function (selector) { // only for html return this.queryselector(selector); }; example: <h1>test!</h1> <script> htmldocument.prototype.$ = function (selector) { return this.queryselector(selector); }; alert(document.$('h1')); // [object htmlheadingelement] </script> xuldocument.prototype.$ ...
Tabbox - Archive of obsolete content
ment.getelementbyid("tabpanels"); tabpanels.removechild(tabpanels.childnodes[currentindex]); tabs.removeitemat(currentindex); /*work around if last tab is removed, widget fails to advance to next tab*/ if(-1 == tabbox.selectedindex && tabs.childnodes.length>0){ tabbox.selectedindex=0; } } creating a close tab button to have a tab close button, you must configure the style. examples: .tabs-closebutton { list-style-image: url(http://mozilla.org/favicon.ico); } .tabs-closebutton { list-style-image: url("chrome://global/skin/icons/close.gif"); } ...
Code snippets - Archive of obsolete content
applies to scrollbars in browser and iframe as well. autocomplete code used to enable form autocomplete in a browser boxes tips and tricks when using boxes as containers tabbox removing and manipulating tabs in a tabbox windows-specific finding window handles (hwnd) (firefox) how to use windows api calls to find various kinds of mozilla window handles. window handles ca...
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
egrate third-party libraries that provide specialized functionality for database connectivity, image processing, networking and the like. if you want your extension to run on all firefox platforms, you will need to have the source code for the library in question, so i assume that this is available. the most convenient approach from the perspective of the development cycle is to create a mozilla-style makefile for the library. this works well for libraries that have a straightforward make process without extensive configuration. a good example of this is the sqlite library included in the mozilla build tree at db/sqlite. by adapting the makefile in this way, the library is created as part of the standard mozilla build process, which eliminates additional build steps. the downside is that you w...
Enhanced Extension Installation - Archive of obsolete content
upport for the -lock-item/-unlock-item flags, as well as the -list-global-items flag. messages that appear in the extensions ui in response to user-actions such as install, uninstall, enable and disable are now driven by the extensions datasource itself and are supplied by the em:displaydescription property, rather than being supplied by the front end and several different redundant xbl bindings/style rules. it is no longer possible to perform any operations on an item that has just been installed. bugs in the command controller in the extensions ui made this possible in firefox 1.0 which could leave the user in bogus states. the nsiextensionmanager interface now has a single, unified set of installation/enabling interfaces: void installitemfromfile(in nsifile file, in string locationkey)...
Extension Versioning, Update and Compatibility - Archive of obsolete content
r text i or em for italicized text formatting in firefox 4 and later from firefox 4 the restrictions are relaxed somewhat. the following tags are interpreted normally: h1, h2 and h3 for general headings p, div, pre and blockquote for block formatting ul, ol, li, dl, dt and dd for lists b, i, em, strong, u, q, sub, sup and code for text formatting br and hr for line breaking the head, style and script tags and any of their contents are completely stripped. other tags aren't included in the result but do have their contents displayed, so the following snippet: <span><q>text</q></span> would be rendered exactly the same as: <q>text</q> sample file <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html lang="en-us" di...
Inline options - Archive of obsolete content
o. the this value is the setting xul element. see mxr for what all this holds: http://mxr.mozilla.org/mozilla-release/source/toolkit/mozapps/extensions/content/setting.xml for example you can fire this.inputchanged() etc etc. <setting pref="extensions.throbberrestored.showtxtontoolbar" title="show text on toolbar button" type="bool" oninputchanged="alert('new value is = ' + this.value); this.style.backgroundcolor='red';"> if labels on other toolbar buttons are visible (like by using add-on "classic theme restorer") then show label on throbber toolbar button </setting> note in order for the oninputchanged to execute, the setting must have a pref attribute, otherwise the oninputchanged will not trigger. some discussion on the subject at stackoverflow: how to use addeventliste...
Install Manifests - Archive of obsolete content
locale property (ditto, but to register the locale) and a skin property (ditto, but to register the theme material). in extensions for firefox 1.5, this property is no longer necessary: the chrome.manifest at the top level of the xpi is used to locate chrome to register. if there is no chrome.manifest, this property is still read by the add-on manager and a chrome.manifest is generated from old-style contents.rdf. examples <em:file> <description about="urn:mozilla:extension:file:myext.jar"> <em:package>content/myext/</em:package> <em:locale>locale/myext/</em:locale> <em:skin>skin/classic/myext/<em:skin> </description> </em:file> an install manifest may specify multiple file properties, one for each jar file or subdirectory that contains chrome to register. hidden firefox...
Installing Extensions and Themes From Web Pages - Archive of obsolete content
.url; } }; this specifies the display name (foo) for use in the confirmation dialog, the url to the extension (which is the link href, recall), the icon url to display in the confirmation dialog, a hash of the xpi file contents (to protect against corrupted downloads), and a tostring function which will allow this code to work with versions of firefox 0.8 and earlier. you could also use the old style parameter block ({ "foo": aevent.target.href }) if you wanted - and didn't have an icon to use for the confirmation dialog. installtrigger.install is then called to install the item with the parameter block. return false; this last part is the most important - the install function must return false so that when the link is clicked, only the script is run, and the link href is not navigated to...
Multiple item extension packaging - Archive of obsolete content
packages are no longer supported and will not load. as a consequence, these packages are no longer accepted by amo. a multiple item package provides the ability to package multiple installable bundles which can then be downloaded and installed by a user, or provided pre-packaged with an application or by an external program. every multiple item package must provide an install.rdf file (not old-style install.js!) and has the same requirements as an extension except as noted below. there is currently no feature to prevent or warn the user when installing an older version of an extension. multiple item package file layout the multiple item package file layout is a simplified form of an installable bundle and requires a file extension of xpi. a multiple item package may contain both extension...
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
c:\\temp\\temp.txt'); if (file.exists()) file.remove(false); file.create(file.normal_file_type, 0666); the first parameter of the nsilocalfile.create() method gives the type of file to create. this is defined using constant properties—to create a normal file, use normal_file_type, to create a folder use directory_type. the second parameter gives the access privileges to that file using unix-style octal values. note: windows ignores the privileges parameter; other platforms may do so as well. the nsilocalfile object includes methods that return virtual state values for the current file, as shown in table 1. table 1: methods for checking file states method name description nsilocalfile.exists() determines whether or not the file exists. nsilocalfile.iswr...
Adding menus and submenus - Archive of obsolete content
on the menupopup to avoid code duplication, since now the 3 items call the same function. another example of a menu like this is the view > sidebars menu. only one sidebar is visible at any given moment, and you can pick from several. menus with images to add an icon to a menu or menuitem, set its class to "menu-iconic" or "menuitem-iconic" respectively, and set the image attribute or the list-style-image css property. menu icons are typically 16px by 16px. menus on mac os x as mentioned earlier, menus are very different on mac os x. this is because menus on mac are located in a single menu bar which is controlled by the operating system, as opposed to menus in other systems, which are entirely controlled by firefox. mac os x also has menu standards, such as the positioning of certain item...
Intercepting Page Loads - Archive of obsolete content
tion, and filtering by url. you can also use these in conjunction with nsitraceablechannel to get and modify the response text before it gets to the original requester. you won't be able to make dom modifications like with the load events, since these notifications are triggered before the response arrives and is parsed into dom tree, so this is not the best approach for the typical greasemonkey-style extensions. notes on usage: efficiency is very important when adding http observers. remember that your observe method will be called for every http request made by firefox, usually several dozen per page visit. in the previous example, one of the first things we do is check if the url is of interest to us, otherwise we let it go. avoid heavy, time-consuming operations, or the user's browsing e...
Extensions support in SeaMonkey 2 - Archive of obsolete content
the basics to support seamonkey 2 as a target application, you need to add it to the list of target applications in the extension's install.rdf file. the code for that will look something like this: <em:targetapplication> <!-- seamonkey --> <description> <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id> <em:minversion>2.0</em:minversion> <em:maxversion>2.*</em:maxversion> </description> </em:targetapplication> the install.js is not supported any more and should be removed. ...
Promises - Archive of obsolete content
promise apis for common asynchronous operations due to the performance and stability costs of synchronous io, many apis which rely on it have been deprecated. the following page contains examples of many promise-based replacement apis for common operations. these apis allow asynchronous operation to be achieved with a coding style similar to synchronous variants. the following examples make use of the task api, which harnesses generator functions to remove some of the syntactic clutter of raw promises, such that asynchronous promise code more closely resembles synchronous, procedural code. a task example like the following: components.utils.import("resource://gre/modules/task.jsm"); task.spawn(function* () { var response = yield request("login", { username: user, password: password });...
Add-ons - Archive of obsolete content
e packaged in a form of installable bundle which can be downloaded and installed by a user, or provided pre-packaged with an application or by an external program. extensions use a directory structure which can provide chrome, components, and other files to extend the functionality of an xul program. extensions support in seamonkey 2 starting with seamonkey 2 alpha 1 seamonkey supports toolkit/-style extensions. these type of extensions have many advantages for both users and developers compared to the old xpinstall/-style extensions. firefox addons developer guide the original document is in japanese and distributed via the xuldev.org website. so there may be still some reference to the xuldev website (we want to host source code on mdc, not on xuldev), and to japanese things (like some sp...
Adding preferences to an extension - Archive of obsolete content
shutdown() routines automatically when the browser window is loaded and unloaded. window.addeventlistener("load", function(e) { stockwatcher.startup(); }, false); window.addeventlistener("unload", function(e) { stockwatcher.shutdown(); }, false); design the preference dialog now that we've written all the code, we need to build the xul file for the options dialog. ...
Underscores in class and ID Names - Archive of obsolete content
ready complex landscape. support realities between mistakes in implementation and changes to the specification, browser behavior with regard to underscores is rather convoluted. netscape 6.x permits underscores and escaped underscores. navigator 4.x honored the restriction against underscores, and so any class or id name with an underscore will be ignored by navigator 4.x, so the associated styles will never be applied. it also ignored escaped underscores. internet explorer 4.x and 5.x for windows erroneously allowed underscores, and so were both non-conformant on this point until the errata was published. the same is true of ie4.x and 5.x for macintosh. internet explorer 6 for windows, published after the errata, permits underscores and escaped underscores. opera 3.x through 5.x does ...
DOMSubtreeModified - Archive of obsolete content
will display the time of last dom change on the title bar of the page. this event has been deprecated in favor of the mutation observer api this event can cause infinite loops if you decide to change the dom inside the event handler, hence it has been disabled in a number of browsers (see domattrmodified and domsubtreemodified events are no longer fired when style attribute is changed via cssom for example). document.body.addeventlistener('domsubtreemodified', function () { document.title = 'dom changed at ' + new date(); }, false); ...
Installing plugins to Gecko embedding browsers on Windows - Archive of obsolete content
this document presents the windows registry keys plugin installers can parse to determine where to install a given plugin (for mozilla browsers) on windows. since the prospect of embedded gecko browsers raises the scenario of more than one gecko-based browser that a netscape-style plugin can work with, it becomes important to let plugin developers know how to discover these browsers on a windows machine. this information applies to mozilla based browsers that pull the mozilla codebase after the mozilla 0.9.1 milestone release. none of the registry keys mentioned here are written by browsers before the mozilla 0.9.1 timeframe. for example, netscape 6.0 and 6.01 do not write any of these keys into the registry, and thus these keys are not available for plugin vendors to parse for these tw...
Source code directories overview - Archive of obsolete content
ing, parsing, interpretting and executing javascript scripts. this code originated in mozilla classic. l10n contains code for building localizations. layout contains the c interfaces and code for the layout engine. the layout engine decides how to divide up the "window real estate" among all the pieces of content. it resizes and aligns pieces of content according to the css1 and css2 (cascading style sheets), alignment styles and the content itself. it does not actually render the content; it just assigns different pieces of the window to various content items. this is known as "reflowing" the content. this code is also known by the names, "nglayout" and "gecko." lib contains c code used for reference by developers in programming the mac. it is not used. it shows how to embed the mozilla bro...
Using XML Data Islands in Mozilla - Archive of obsolete content
neitems[0].getelementsbytagnamens("http://example.mozilla.org/purchaseorderml", "price")[0].textcontent; document.getelementbyid("output-box").textcontent = "the purchase order contains " + lineitems.length + " line items. the price of the first line item is " + firstprice + "."; } </script> </head> <body onload="rundemo()";> <object id="purchase-order" data="purchase_order.xml" type="text/xml" style="display: none;"></object> <div id="output-box">demo did not run</div> </body> </html> ...
Visualizing an audio spectrum - Archive of obsolete content
vent does an fft of the samples and displays them in a canvas. note: you can use the audionode called analysernode to perform real-time fft analysis on an audio stream, rather than the code shown below. ...
Adding the structure - Archive of obsolete content
ages (f.e. the lock icon in mozilla that shows whether or not a loaded document was encrypted with ssl). status bars comprise a series of panels, each one defined by a statusbarpanel xul element. each status bar panel displays a different kind of status information. graphical panels (like the one we are creating here that displays an icon) are given the statusbarpanel-iconic class so they can be styled accordingly by the css stylesheet that defines these elements' appearance. the status attribute is not part of the xul definition for the statusbarpanel element, but is used by our extension to store the current tinderbox state. we'll update the value of that attribute each time we retrieve tinderbox's status from the server, and we'll define css rules that change the appearance of the icon dep...
Conclusion - Archive of obsolete content
f it works. if the version you created in this tutorial doesn't work, compare it to this working version to help figure out the problem. future directions for development of the tutorial and/or coursework: in addition to build status, tinderbox also tells you if the cvs tree is open or closed for check-ins. how would you use javascript to determine whether the tree is open or closed and css to style the icon accordingly? mozilla applications often store their css and image files in a separate skin subdirectory within the installation directory. how would you modify the xpi structure and installer script to install these files in that subdirectory? how could you modify the extension to load the tinderbox page when you click on the status icon? mozilla has a fourth ui layer--localized te...
Getting Started - Archive of obsolete content
cons for the bookmark manager and the preferences window. skin\classic\editor editor contains files of composer. skin\classic\global global contains almost all of the important css files that define the appearance of the suite. this is the most critical directory in a theme. skin\classic\help help contains all the files for theming the help dialog window. skin\classic\messenger messenger contains styles of the mail client. skin\classic\messenger-newsblog messenger-newsblog contains the only css file. skin\classic\mozapps mozapps contains all the styles and icons for the browser peripherals, such as the extension manager or update wizard. skin\classic\navigator navigator contains some icons and styles for all sm components. install your new theme before you can see the changes you make to a sea...
Creating a Microsummary - Archive of obsolete content
xslt is a powerful language for transforming documents into different representations of the same information. add the xslt transform sheet to the generator by including it within a <template> element: <?xml version="1.0" encoding="utf-8"?> <generator xmlns="http://www.mozilla.org/microsummaries/0.1" name="firefox downloa...
Getting Started - Archive of obsolete content
for the default packages that come with mozilla. the most important directory is \global. the default widgets are defined here, and anything that is modified will change throughout mozilla. if you want to modify how checkboxes, radio buttons, and scrollbars appear, this is the place. the next directory is the \communicator directory. this is a catchall directory which holds all of the images and styles for portions of mozilla that don't merit their own individual directory. you'll be able to change the bookmark manager and the profile migration window here. the three remaining directories are pretty self-explanatory. they contain the images/styles for the browser, email client, or html editor. css files the css files in these directories tell the browser how to display the buttons and other co...
toolbarBindings.xml - Archive of obsolete content
copy the following text and paste it into a text file, then save that file as "toolbarbindings.xml": <bindings id="toolbarbindings"> <binding id="toolbar-primary" extends="chrome://global/content/bindings/toolbar.xml#toolbar-primary"> <content> <xul:hbox class="toolbar-holder toolbar-primary-holder" flex="1" xbl:inherits="orient=tborient,buttonstyle"> <xul:hbox class="toolbar-button-box" flex="1"> <children/> </xul:hbox> <xul:image class="toolbar-primary-icon" xbl:inherits="buttonstyle"/> </xul:hbox> </content> </binding> </bindings> ...
Creating a Skin for Mozilla - Archive of obsolete content
what is a skin? a skin does not totally change the interface, it just defines how it looks. you cannot change what happens when the user right clicks on an image, but you can change the look of the right click menu (make it blue with pink polka dots, for example). ...
Creating a Skin for Firefox/Getting Started - Archive of obsolete content
w. skin\classic\communicator doesn't do a whole lot and can typically be forgotten about promptly. skin\classic\global global contains almost all of the important css files that define the appearance of the browser. this is the most critical directory in a theme. skin\classic\help help contains all the files for theming the help dialog window. skin\classic\mozapps mozapps contains all the styles and icons for the browser peripherals, such as the extension manager or update wizard. install your new theme before you can see the changes you make to a firefox theme (since live edits are restrictively difficult to set up) you must first learn how to repackage the classic theme to make it installable. for the sake of this discussion we will call your theme "my_theme", though you can replac...
Developing New Mozilla Features - Archive of obsolete content
your team as the liaison to mozilla.org for project management issues. review and super-review take time improving the code as requested by the reviewers takes time. poor quality code also takes time. we’ve opted to spend the time improving code consistency before check-in when the pain is limited to the developers and the reviewers rather than everyone in the tree. we’re committed to this style of development, but recognize that vigilance is necessary to make sure newcomers and their features don’t get lost. if you’re having a particularly bad experience or if you’ve got suggestions on how to improve our process, please let mozilla.org staff know. original document information author(s): mitchell baker last updated date: october 30, 2004 copyright information: portions of t...
Repackaging Firefox - Archive of obsolete content
o be in the properties file. mozilla.partner.id=<name> app.partner.<name>=<name> app.distributor=<name> app.distributor.channel=<name> other preferences some settings are commonly set in partner distributions. this is not meant to be a comprehensive list of preferences, however. if you find a preference you think is generally useful to most partner repacks, please add it below, using the same style: localizable preferences browser.startup.homepage=<string> browser.startup.homepage_reset=<string> url for the default homepage, and what the homepage gets reset to when the user hits "restore to default" in the preferences. these should both be the same url. startup.homepage_welcome_url=<string> url to the first-run page. this is loaded in addition to the homepage, the very first time tha...
GRE Registration - Archive of obsolete content
on at hklm/software/mozilla.org/gre/<version> and will try alternate keys <version>_1 _2 until an available key is found. mac on mac, the only gre is the libxul framework xul.framework. this framework is installed either in /library/frameworks/xul.framework/versions/<version> or in ~/library/frameworks/xul.framework/versions/<version>. linux on linux, registration information is kept in ini-style files of the following form: [1.7.10] gre_path=/usr/lib/mozilla-1.7.10 feature=value feature2=value2 these ini files can be in any of the following locations: /etc/gre.conf /etc/gre.d/*.conf ~/.gre.conf ~/.gre.d/*.conf mozilla has never officially shipped a linux gre based on the mozilla suite. however, some linux distributors including red hat/fedora core ship /etc/gre.d/*.conf files with the ...
UI - Archive of obsolete content
from it and the blog post announcing the first sdk release for what we're up to next! ...
Makefile.mozextension.2 - Archive of obsolete content
f $(project) # this may be a bit too old ?! keeping it anyway.. ...
Microsummary topics - Archive of obsolete content
n user-initiated and microsummary-related requests when firefox updates a microsummary generated by a microsummary generator add-on, it automatically downloads the html content of the page being summarized. it does not generally download related content like embedded images and javascript scripts referenced by the page. however, because of a technical limitation (bug 340746), it does download css stylesheets referenced by the page. firefox includes the x-moz request header with these requests. it sets the value of the header to the string microsummary. thus, to differentiate requests initiated manually by users for the purpose of viewing a web page from those initiated automatically by firefox for the purpose of summarizing that page, check for the presence and value of the x-moz request header...
Configuration - Archive of obsolete content
the profile can be used to launch the webapp in prism. the parameters also control some of the features of the prism host window. here is the list of parameters: id the unique name of this web application. remember that other people can create different webapps using the same uri and this webapp is only your particular instance or mashup. so make sure the identifier is not only unique to the web application, but also to you. ...
Styling - Archive of obsolete content
prism allows for some client-side web application styling. the web application bundle is allowed to hold a css file named webapp.css (called the webapp style). this file will be loaded into the web application content stylesheet and can override the web application's native styles. simply add the webapp.css to the bundle and it will be injected into the web application, regardless of the platform or os. it is also possible to create platform-specific styles. in this scenario, the css file is specific to an os. this allows prism webapps to take on an os-specific look. to use platform-specific styles, create a folder in the bundle archive for each supported os and place a webapp.css file in the folder. the folder names must match the following: windows - winnt mac os x - darwin linux...
Priority Content - Archive of obsolete content
e migrated. they are dependant on some code that cannot be integrated in the page. dependant on: updating dhtml web pages for next generation browsers on devedge the tune-up wizard (see below, in the wishlist section) mostly completed: popup window controls devedge article migrators: mathieu deaudelin there are inline examples on this page that cannot be migrated. they are dependant on some style instructions that can only be placed in the header of the page. started: scripting plugins: macromedia flash original: scripting plugins: macromedia flash wiki location: scripting plugins: macromedia flash migrators: dependant on (these parts need to be done, put your name down) completed: soap in netscape gecko-based browsers original: soap in netscape gecko-based browsers wiki locat...
Frequently Asked Questions - Archive of obsolete content
documents to help answer this question: a status page for svg in firefox 1.5+ and a status page for svg in the development trunk. why does mozilla show source code/gibberish instead of svg? there are two possible reasons for this: a simple mistake in the svg file, or a misconfigured server. if there's a grey area at the top of the source with the text "this xml file does not appear to have any style information associated with it" then the problem is with the svg file. to be valid the root <svg> tag in svg files must have at least the following two "namespace bindings". <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> actually the second binding isn't always required, but unless you understand namespaces, we'd strongly recommend you include it. for more ...
Same origin policy for XBL - Archive of obsolete content
rom the policy used for other content. this article provides a description of how the same origin policy for xbl works. when mozilla needs to decide whether or not xbl is allowed to be loaded, it looks at the nsiprincipal originating the load and the nsiuri to be loaded. determining the originating principal the principal originating the load is determined using the following steps: for external stylesheets (<link>, <?xml-stylesheet?>, user sheets, and ua sheets), it depends on where the sheet is loaded from, just like it would for an html document loaded from a similar source. for inline stylesheets (<style> and style attributes), the principal of the element node involved (meaning the <style> element or the element whose style attribute is being looked at). for the nsidomdocumentxbl interfac...
SpiderMonkey coding conventions - Archive of obsolete content
the spidermonkey project owners enforce coding conventions pretty strictly during code reviews. naming conventions public function names begin with js_ followed by capitalized "intercaps", e.g. js_newobject. extern but library-private function names use a js_ prefix and mixed case, e.g. js_searchscope. most static function names have unprefixed, mixed-case names: getchar. but static native methods of js objects have lowercase, underscore-separated or intercaps names, e.g., str_indexof. and library-private and static data use underscores, not intercaps (but library-private data do use a js_ prefix). ...
String Rosetta Stone - Archive of obsolete content
) ...
Running Tamarin performance tests - Archive of obsolete content
ttvmi (tamarin-tracing interp) -m --memory logs the high water memory mark --aotsdk location of the aot sdk u...
The life of an HTML HTTP request - Archive of obsolete content
the parser is temporarily blocked). (7) since the presentation shell (nspresshell) has registred as an documentobserver with the nsidocument it also gets notified of changes in the document/content tree. this is used to create and update the nsiframe hierarchy. this is done by the nscssframeconstructor, which creates frames for each content node according to the rules specified in the user agent stylesheet (ua.css) and the document specific style sheets. each content node corresponds to one or more nsiframe, except content with displaytype "none". if there are several frames created from a content node, then the first of these are called the "primary" node, and the following frames can be found by using the getnextinflow() method of nsiframe. the initial reflow is done by the nshtmlcontentsink...
The new nsString class implementation (1999) - Archive of obsolete content
narrow (1-byte) character strings no support for external memory management policy lack of xpcom interface notable features of the new nsstrimpl implementation are: intrinsic support for 1 and 2 byte character widths provides automatic conversion between strings with different character sizes inviolate base structure eliminates class fragility problem; safe across dll boundaries offers c-style function api to manipulate nsstrimpl offers simple memory allocator api for specialized memory policy shares binary format with bstring coming soon: a new xpcom (nsistring) interface non-templatized; this is a requirement for gecko very efficient buffer manipulation architecture the fundamental data type in the new architecture is struct nsstrimpl, given below: struct nsstrimpl { print32 ...
Learn XPI Installer Scripting by Example - Archive of obsolete content
is called as many times as there are different directories that contain content that needs to be registered with the chrome registry. note that in the first few lines of this process, new content from the xpi is being registered, and in the remainder, it is new skin information. in this most common form of the registerchrome function (it can also be used to support the now-deprecatedmanifest.rdf style of installation archive), the three parameters represent, in order, the chrome switch used to indicate what kind of software is being registered, the target destination of the software (e.g., the "chrome" folder in the example above), and the path within the xpi (or jar theme archive) where the contents.rdf file is located. see registerchrome in the xpinstall api reference for more information a...
align - Archive of obsolete content
the elements are aligned on their left edges. center the elements are centered horizontally. right the elements are aligned on their right edges. the pack attribute is related to the alignment but is used to specify the position in the opposite direction. you can also specify the value of align using the style property -moz-box-align. ...
alternatingbackground - Archive of obsolete content
...
class - Archive of obsolete content
« xul reference home class type: string the style class of the element. multiple classes may be specified by separating them with spaces. ...
first-tab - Archive of obsolete content
...
id - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › id
« xul reference home id type: unique id a unique identifier so that you can identify the element with. you can use this as a parameter to getelementbyid() and other dom functions and to reference the element in style sheets. example <button id="foo" label="click me" oncommand="dosomething()"/> <script> function dosomething(){ var mybutton = document.getelementbyid('foo'); mybutton.setattribute('label','the button was pressed'); } </script> a more abstract version of the above would be a <button id="foo" label="click me" oncommand="setwidgetlabel(this, 'i was pressed')"/> <script> function setwidgetlabel(idname, newcaption){ document.getelementbyid( idname.id ).setattribute('label',newcaption) } </script> not specifying the id attribute for a window or a prefwi...
image.onload - Archive of obsolete content
« xul reference home image.onload type: script code this event handler will be called on the image element when the image has finished loading. this applies whether the image is applied via the src attribute or the list-style-image style property. if you change the image, the event will fire again when the new image loads. this event will not bubble up the element tree. ...
last-tab - Archive of obsolete content
...
onchange - Archive of obsolete content
er key is pressed radio/check box when the state is changed select list when the selected item is changed what is accessible the script context at this point can only access the following things: global values/functions i.e. ...
orient - Archive of obsolete content
« xul reference home orient type: one of the values below used to specify whether the children of the element are oriented horizontally or vertically. the default value depends on the element. you can also use the -moz-box-orient style property. horizontal child elements of the element are placed next to each other in a row in the order that they appear in the xul source. vertical child elements of the element are placed under each other in a column in the order that they appear in the xul source. see also separator.orient ...
pack - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › pack
the box are placed when the box is larger that the size of the children. for boxes with horizontal orientation, it is used to indicate the position of children horizontally. for boxes with vertical orientation, it is used to indicate the position of children vertically. the align attribute is used to specify the position in the opposite direction. you can also specify the value of pack using the style property -moz-box-pack. start child elements are placed starting from the left or top edge of the box. if the box is larger than the total size of the children, the extra space is placed on the right or bottom side. center extra space is split equally along each side of the child elements, resulting the children being placed in the center of the box. end child elements are placed on...
properties - Archive of obsolete content
for more information, see styling a tree. ...
showpopup - Archive of obsolete content
the default value is true. ...
sizemode - Archive of obsolete content
reference home sizemode type: one of the values below the state of the window. it can have one of the following values: maximized the window is maximized, and occupies the full size of the screen. normal the window appears in a normal state at the desired size. this attribute is used to save and restore the state of a window (together with the persist attribute) and for css styles (e.g. to hide the resizer grippy on maximized windows). note: when a window is minimized, the sizemode attribute is not updated. this is done so that if a window is closed while minimized, its persisted sizemode attribute wouldn't be minimized. setting this attribute does not change the window state. use window.maximize(), window.restore(), or window.minimize() to change the window state. to ...
state - Archive of obsolete content
open the content either before or after the splitter, depending on the value of the collapsed attribute, is currently displayed. ...
Attribute (XUL) - Archive of obsolete content
ties querytype readonly ref rel removeelement resizeafter resizebefore rows screenx screeny searchbutton searchsessions searchlabel selected selectedindex seltype setfocus showcaret showcommentcolumn showpopup size sizemode sizetopopup smoothscroll sort sortactive sortdirection sortresource sortresource2 spellcheck src state statedatasource statusbar statustext style subject substate suppressonselect tabindex tabscrolling targets template timeout title toolbarname tooltip tooltiptext tooltiptextnew top type uri useraction validate value var visuallyselected wait-cursor width windowtype wrap wraparound ...
Deprecated and defunct markup - Archive of obsolete content
comes across them in old code or documentation. ...
Getting File Information - Archive of obsolete content
(!file.iswritable()) throw "file cannot be modified"; if you aren't sure whether a file can be modified, for example, you may wish to check using nsifile.iswritable() first. otherwise, an attempt to write to the file will generate an error. the four methods above are usually sufficient for most purposes. however, you can also use the permissions (nsifile.attributes) attribute to get the unix-style permission flags for a file. this attribute is also necessary if you need to modify the permissions. file.permissions = 0640; it is common to use an octal number (a number in base 8 beginning with 0) for permissions as it can make the value easier to read. in this case, the first digit is the permissions for the owner of the file, the second digit is the permissions for the group of the file a...
findbar - Archive of obsolete content
"match case" checkbox in the findbar. properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width browser type: browser element lets you set and get the browser in which the findbar is located. findmode type: integer read only. the find mode in use. possible values are: find_normal (0): normal find find_typeahead (1): typeahead find find_links (2): link find methods inherited methods addeventlistener(), appendchild(), blur, click, clo...
How to implement a custom XUL query processor component - Archive of obsolete content
nterface and follow some conventions for when registering the component. in this example, we will create a simple javascript xpcom component. the component will hold a small array of javascript objects as its datasource. in practice, you would use your own custom source of data. ...
Floating Panels - Archive of obsolete content
tribute is used to indicate that the panel is not temporary. when set to true, the popup will not close when the user clicks outside of it, nor when the user presses the escape key. the titlebar attribute creates a panel with a titlebar. currently, only the value normal is supported, which creates a default titlebar. in the future, a distinction will be available to support titlebars of differing styles. the floating panel can be placed and moved independently of the main window, however it will always appear above the main window. on mac, floating panels are invisible when another application is made active, and become visible again when the xul application is made active. a floating panel may contain any type of element. a label for the titlebar may be set using the label attribute, as in the...
Panels - Archive of obsolete content
hen supporting temporary popup displays for selecting or entering data. the panel element the panel element is used to create panels. the panel will display whatever elements are placed as children of the panel element. for example, the following panel displays a textbox for entering a name. note that the panel is not placed in a separate file and is instead placed inside another window. <?xml-stylesheet href="chrome://global/skin" type="text/css"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <button label="details" type="panel"> <panel id="search-panel"> <label control="name" value="name:"/> <textbox id="name"/> </panel> </button> </window> many panels will be associated with a button, as in this example. when the button is pressed, the pan...
Tooltips - Archive of obsolete content
p will apply when the mouse is moved over the close button, as well as when the mouse is over an empty part of the toolbar. note that the tooltip text 'file buttons' isn't a good tooltip to use either. it conveys no additional information to the user, so it shouldn't be used as in this example. the tooltip element tooltips are displayed using a tooltip element, which is a type of popup, but is styled to look different. elements that use the tooltiptext attribute display the tooltip in a default tooltip element, which typically looks like a small yellow box large enough to fit the text inside it. this default tooltip is created automatically, so you don't normally need to use a tooltip element. however, it is possible to use another tooltip element that looks differently, or which supports o...
Property - Archive of obsolete content
oup readonly readonly ref resource resultspopup scrollboxobject scrollincrement scrollheight scrollwidth searchbutton searchcount searchlabel searchparam searchsessions second secondleadingzero securityui selected selectedbrowser selectedcount selectedindex selecteditem selecteditems selectedpanel selectedtab selectionend selectionstart selstyle seltype sessioncount sessionhistory showcommentcolumn showpopup size smoothscroll spinbuttons src state statusbar statustext stringbundle strings style subject suppressonselect tabcontainer tabindex tabs tabscrolling tabpanels tag textlength textvalue timeout title toolbarname toolbarset tooltip tooltiptext top treeboxobject type...
Sorting and filtering a custom tree view - Archive of obsolete content
r sorting and filtering a custom tree view, that is, a tree whose values are loaded via javascript. this will not work for other types of trees, for example rdf-backed or ones created with dom methods. for the sake of simplicity, strings are not localized and the data loaded is hard coded. because of bug 340478, this code will only work from privileged script. ...
listcell-iconic - Archive of obsolete content
« xul reference home listcell-iconic use this class to have an image appear on the listcell. specify the image using the image attribute. note that both an image and a label are added when this style is set. the label will take up extra space even when no label text is set. if it is desired to center the image, use css to hide the label. ...
Attribute Substitution - Archive of obsolete content
?gender^?nationality"/> the caret is considered a separator between variables, however it will not appear in the output. it can also be used to separate a variable with normal text: <label value="?name" class="?gender^german"/> these last two examples have been setting the class attribute on a label. the effect will be that a label will have either the 'malegerman' or 'femalegerman' class. in a stylesheet, you could set properties for each of these classes such that different values appear differently without having to use multiple rules. although not common, you may also wish to insert a question mark or caret into an attribute value. to do this, just use two question marks or two carets in a row. for instance: <label value="what is my name?? my name is ?name"/> in this example, the label m...
Multiple Queries - Archive of obsolete content
nts/1.1/"> <template> <rule dc:title="canal"> <button uri="rdf:*" image="rdf:*" label="view" orient="vertical"/> </rule> <rule> <image uri="rdf:*" src="rdf:*"/> </rule> </template> </hbox> the result to the user in this example is the same as the previous example. you can also mix simple and extended queries in one template, although you may prefer to use the same style in all queries for consistency. however, if you are going to be using a number of queries, the template builder is more efficient when using multiple queries using the simple query syntax. this is because all simple queries will iterate over the same data, usually the children of an rdf container. so the builder only performs this step once and filters the data for each query. when using the exte...
Using Recursive Templates - Archive of obsolete content
x> note how similar content corresponding to the action body is created for both the groups as well as the people. the template builder has also added container and empty attributes to the groups. this is done with all nodes that have children to indicate that the node contains generated children as well as whether the node is empty. these hints are used for trees, but they can also be used in a stylesheet to provide a different appearance for containers with children, empty containers, as well as non-containers. in this example, both the parent groups and child people are displayed the same. you could use multiple rules as well, in order to generate different output for each level. in this next example, an assign element is used to assign the local name of the node is to the variable ?type. i...
textbox (Toolkit autocomplete) - Archive of obsolete content
er key is pressed radio/check box when the state is changed select list when the selected item is changed what is accessible the script context at this point can only access the following things: global values/functions i.e. ...
The Joy of XUL - Archive of obsolete content
any developers invest a significant amount of effort to achieve these results in their dhtml web applications but at the cost of complexity and performance and without any supporting standards. based on existing standards xul is an xml language based on w3c standard xml 1.0. applications written in xul are based on additional w3c standard technologies featuring html 4.0; cascading style sheets (css) 1 and 2; document object model (dom) levels 1 and 2; javascript 1.5, including ecma-262 edition 3 (ecmascript); xml 1.0. platform portability like html, xul is designed to be platform-neutral, making applications easily portable to all of the operating systems on which mozilla runs. considering the broad range of platforms that currently support mozilla, this may be one o...
Adding Event Handlers to XBL-defined Elements - Archive of obsolete content
</handlers> when the user clicks and releases the mouse button over the check box, the mouseup event is sent to it, and the handler defined here is called, causing the state of the checked property to be reversed. similarly, you may wish to change a property when the element is focused. you might have a need to change whether an element can have the focus or not. for this, you can use a special style property -moz-user-focus. this property controls whether an element can be focused. (see focus and selection) handling mouse events for mouse events, you can use the button attribute to have the handler only trap events that occur from a certain button. without this attribute, the handler traps all events regardless of the button that was pressed. the button attribute should be set to either 0 fo...
Adding HTML Elements - Archive of obsolete content
the outermost html element. xmlns:html="http://www.w3.org/1999/xhtml" this is a declaration of html much like the one we used to declare xul. this must be entered exactly as shown or it won't work correctly. note that mozilla does not actually download this url, but it does recognize it as being html. ...
Box Objects - Archive of obsolete content
ample, will have a xulelement type of content node. the layout objects that will be created are determined in a more complex manner. various pieces of information are used such as the tag name, the attributes on an element, various css properties, the elements and layout objects around the element, and the xbl associated with an element (xbl is described in a later section). unless you change the style for an element, most xul elements will usually use the box layout object or one of its subtypes. recall that all xul elements are types of boxes, that is the box is the base of all displayed xul elements. however, there are a number of subtypes, about 25 or so, for specific xul elements. some of these subtypes, such as the stack or listbox are needed for more complex layouts than the basic box, w...
Creating a Wizard - Archive of obsolete content
that are familiar to the user of a particular os. a typical layout will include a title across the top, a set of navigation buttons across the bottom and the page contents in between. the title across the top is created using the title attribute, much like one would use for regular windows. the navigation buttons are created automatically. ...
Cross Package Overlays - Archive of obsolete content
dows. it stores this information in the chrome/overlayinfo directory. you do not need to manually modify the files in this directory. it is automatically generated and modified when mozilla is first run or when new packages are installed. however, you can force the data to be rebuilt by deleting this directory and the chrome.rdf file. as a side note, you can use a similar technique to apply extra style sheets. the following example shows how: <rdf:seq about="urn:mozilla:stylesheets"> <rdf:li resource="chrome://messenger/content/messenger.xul"/> </rdf:seq> <rdf:seq about="chrome://messenger/content/messenger.xul"> <rdf:li>chrome://blueswayedshoes/skin/myskinfile.css</rdf:li> </rdf:seq> next, we'll see how to create an installer for a xul application. « previousnext » ...
Custom Tree Views - Archive of obsolete content
ared above. we can assign a value to this property at any time to set or change the view. function setview(){ document.getelementbyid('my-tree').view = treeview; } the following presents the example together. an inline script has been used here to simplify the example. normally, you would put the script in an external script file. ...
Document Object Model - Archive of obsolete content
ally hidden. also, we'll add an id attribute so that we can refer to it in a script to show and hide it. while we're at it, let's also hide the splitter and results tree as we only need to show them after a search is performed. <tree id="results" hidden="true" flex="1"> . . . <splitter id="splitbar" resizeafter="grow" hidden="true"/> <hbox> <progressmeter id="progmeter" value="50%" style="margin: 4px;" hidden="true"/> we've added the hidden attribute and set the value to true. this causes the element to be hidden when it first appears. next, let's add a function that is called when the find button is pressed. we'll put scripts in a separate file findfile.js. in the last section, we added the script element in the xul file. if you haven't done this, do that now, as shown below.
Input Controls - Archive of obsolete content
has an input element which can be used for text entry controls. xul has a similar element, textbox, used for text entry fields. without any attributes, the textbox element creates a box in which the user can enter text. textboxes accept many of the same attributes as html input controls. the following are some of them: id a unique identifier so that you can identify the textbox. class the style class of the textbox. value if you want the textbox to have default text, supply it with the value attribute. disabled set to true to have text entry disabled. textbox.type you can set this attribute to the special value password to create a textbox that hides what it types. this is usually used for password entry fields. maxlength the maximum number of characters that the textbox all...
Introduction - Archive of obsolete content
d have an understanding of html and at least a basic understanding of xml and css. here are some guidelines to keep in mind: xul elements and attributes should all be entered in lowercase as xml is case-sensitive (unlike html). attribute values in xul must be placed inside quotes, even if they are numbers. xul files are usually split into four files, one each for the layout and elements, for style declarations, for entity declarations (used for localization) and for scripts. in addition, you may have extra files for images or for platform specific data. xul is supported in mozilla and browsers that are also based upon on the gecko engine, such as netscape 6 or later and mozilla firefox. due to various changes in xul syntax over time, you will want to get the latest version for the exampl...
Introduction to RDF - Archive of obsolete content
sary for all records to have the same fields but it makes more sense to have them all the same. each of three fields have been given a namespace of animals, the url of which has been declared on the rdf tag. the name was selected because it has meaning in this case, but we could have selected something else. the namespace feature is useful because the class field might conflict with that used for styles. the seq and li elements are used to specify that the records are in a list. this is much like how html lists are declared. the seq element is used to indicate that the elements are ordered, or in sequence. instead of the seq element, you can also use bag to indicate unordered data, and alt to indicate data where each record specifies alternative values (such as mirror urls). the resources can b...
More Menu Features - Archive of obsolete content
<menuitem id="email" label="email administrator" type="checkbox" checked="true"/> </menupopup> </menu> </menubar> </toolbox> the type attribute has been added which is used to make the menu item checkable. by setting its value to checkbox, the menu item can be checked on and off by selecting the menu item. menu with radios in addition to standard checks, you can create the radio style of checks by setting the type to a value of radio. a radio check is used when you want a group of menu items where only one item can be checked at once. an example might be a font menu where only one font can be selected at a time. when another item is selected, the previously selected item is unchecked. in order to group a set of menu items together, you need to put a name attribute on each one ...
More Tree Features - Archive of obsolete content
columndrag. (note the mixed case.) if set to true, the user may drag the column headers around to rearrange the order of the columns. a user will also likely want to change the column widths. you can do this by placing a splitter element in between each treecol element. a small notch will appear in between each column header which the user may drag to change the width of a column. you can use the style class tree-splitter to hide the notch, although the column may still be resized. you can set a minimum or maximum width of a column using the minwidth or maxwidth attributes. you can set the hidden attribute on a column to true to have the column hidden by default. the user can choose to show the column by selecting it from the drop-down on the end of the header row. remembering state of columns ...
More Wizards - Archive of obsolete content
ntered. in the following example, the user must enter a secret code into a textbox on the first page of the wizard. the function checkcode() is called whenever the first page is shown as indicated by the onpageshow attribute. it is also called whenever a key is pressed in the textbox, to determine whether the next button should be enabled again. ...
Numeric Controls - Archive of obsolete content
dates are of the form yyyy/mm/dd and times are of the form hh:mm:ss (although the seconds and the accompanying colon may be omitted). these two elements ensure that the user enters a value date or time. this way, you do not have to check for valid dates, ensure that the day isn't greater than the number of days in the month, handle leap years, and so forth. while the timepicker only comes is one style, the datepicker has three different variations. the default style shows three fields for entering the year, month and date. the type attribute may be used to select the other two. using a value of grid uses a calendar grid, as shown in the image below. you can also use the value popup which creates a combination of the two types. this type has three fields for entering the year, month and date, ...
Persistent Data - Archive of obsolete content
« previousnext » ...
Popup Menus - Archive of obsolete content
is to use a tooltip element containing the content of a tooltip. this requires you to have a separate block of content for each tooltip or to have a script which sets the content. however, it does allow you to use any content besides text in a tooltip. example 2 : source view <button label="save" tooltiptext="click here to save your stuff"/> <popupset> <tooltip id="moretip" orient="vertical" style="background-color: #33dd00;"> <description value="click here to see more information"/> <description value="really!" style="color: red;"/> </tooltip> </popupset> <button label="more" tooltip="moretip"/> these two buttons each have a tooltip. the first uses the default tooltip style. the second uses a custom tooltip that has a different background color and styled text. the tooltip is...
Progress Meters - Archive of obsolete content
erminate progress meter as we don't know how many files we'll be searching or how long the search will take. however, we'll add a normal one for now as an animating one can be distracting during development. the progress meter would normally only appear while the search is taking place. we'll add a script later to turn it on and off. <textbox id="find-text"/> <html:progress value="50" max="100" style="margin: 4px;"/> <button id="find-button" label="find" default="true"/> the value has been set to 50% so that we can see the meter on the window. a margin has been set to 4 pixels so that it is separated from the edge of the window. as was stated earlier, we only want the progress bar to be displayed while the search was occurring. a script will show and hide it as necessary. to make this wor...
Simple Menu Bars - Archive of obsolete content
. this would be placed in a menupopup. menuseparator a separator bar on a menu. this would be placed in a menupopup. you can customize the menus on the menubar to have whatever you want on them on all platforms except the macintosh. this is because the macintosh has its own special menu along the top of the screen controlled by the system. although you can create custom menus, any special style rules or non-menu elements that you place on a menu may not be applied. you should keep this is mind when creating menus. example of a simple menu bar example 1 : source view <toolbox flex="1"> <menubar id="sample-menubar"> <menu id="file-menu" label="file"> <menupopup id="file-popup"> <menuitem label="new"/> <menuitem label="open"/> <menuitem label="save...
Splitters - Archive of obsolete content
mum size. this image shows the 4 panels with the splitter in a collapsed state. this image shows the 4 panels with the splitter resized to the right. notice how the middle two panels have not changed size. only panel 1 and panel 4 have changed size. you can just see part of the fourth panel. if you continue to drag the splitter to the right, the other two panels will shrink. you can use the style properties such as min-width, max-height on the iframes to specify minimum or maximum widths or heights in the box. if you do, the splitter will detect this and not allow the user to drag the splitter past the minimum and maximum sizes. for example, if you specified a minimum width of 30 pixels on panel 4 above, it would not shrink below that size. the other two panels would have to shrink. if y...
Stack Positioning - Archive of obsolete content
element, including boxes and other stacks. the size of a stack is determined by the positions of the child elements. it is always sized so that all of the child elements are visible (excluding any children with -moz-stack-sizing: ignore). so if you set a left attribute to 400, the stack will have a width around 400 pixels plus the width of the element. you can override this size with the various style properties such as width and max-width. you can use a script to adjust the value of the left and top attributes and thus make the elements move around. stacks have the advantage that when one absolutely positioned element changes its position, the position of the other elements is not affected. if you tried to move elements in a regular box, other elements might shuffle their positions around. ...
Templates - Archive of obsolete content
nerate the dom elements for the rows. instead, it gets the data directly from the rdf datasource whenever it needs it. since trees are often expected to display thousands of rows of data, this is much more efficient. creating an element for every cell would be too costly. however, the tradeoff is that trees may only display text, and, since no elements are created, you can't use css properties to style tree cells in the same way. the tree builder is only used for trees. other elements use only the content builder. this isn't a problem though, since other elements such as menus wouldn't be expected to display too many items. it's also possible to use the content builder for trees as well, and a treeitem element and related elements will be created for each row. rules in the image of the earli...
The Box Model - Archive of obsolete content
rt of xul element layout, it follows a few very simple rules. a box can lay out its children in one of two orientations, either horizontally or vertically. a horizontal box lines up its elements horizontally and a vertical box orients its elements vertically. you can think of a box as one row or one column from an html table. various attributes placed on the child elements in addition to some css style properties control the exact position and size of the children. box elements the basic syntax of a box is as follows: <hbox> <!-- horizontal elements --> </hbox> <vbox> <!-- vertical elements --> </vbox> the hbox element is used to create a horizontally oriented box. each element placed in the hbox will be placed horizontally in a row. the vbox element is used to create a vertically oriente...
XBL Example - Archive of obsolete content
uttons. the children of the element that the xbl is bound to will be placed inside the deck. the selectedindex is inherited by the deck, so we may set the initial page in the xul. the following xul file produces the result in the image. <box class="slideshow" previoustext="previous" nexttext="next" flex="1"> <button label="button 1"/> <checkbox label="checkbox 2"/> <textbox/> </box> the style sheet used here is: .slideshow { -moz-binding: url("slideshow.xml#slideshow"); } the first button, button 1 has been used as the first page of the deck. the label widget has not appeared as no value has been specified for it. we could set a value, but instead it will calculated later. page property next, a property that holds the current page will be added. when getting this custom prope...
XUL Tutorial - Archive of obsolete content
ent object model document object model modifying a xul interface manipulating lists box objects xpcom interfaces xpcom examples trees trees more tree features tree selection custom tree views tree view details tree box objects rdf and templates introduction to rdf templates trees and templates rdf datasources advanced rules persistent data skins and locales adding style sheets styling a tree modifying the default skin creating a skin skinning xul files by hand localization property files bindings introduction to xbl anonymous content xbl attribute inheritance adding properties adding methods adding event handlers xbl inheritance creating reusable content using css and xbl xbl example specialized window types features of a window creating...
Urlbar-icons - Archive of obsolete content
s. create new image or button child elements to add your own items. ...
XUL Parser in Python/source - Archive of obsolete content
)] = strip(val) def syntax_error(self, message): pass p = xulparser() cmd = 'dir /s /b *.xul' chrome_dir = 'c:\program files\netscape\netscape 6\chrome' os.chdir(chrome_dir) files = os.popen(cmd).readlines() for file in files: file = file.strip() print '** ' + file + ' **' data = open(file).read() p.feed(data) w.write('<html><h3>periodic table of xul elements</h3>') w.write('<table><style>.head {font-weight: bold; background-color: lightgrey;}</style>') elements = el_list.keys() elements.sort() for item in elements: w.write('<tr><td class="head">' + item + '</td></tr>\n') for a in el_list[item]: w.write('<tr><td class="at">' + a + '</td>') w.write('</table></html>\n') w.close() ...
XUL Reference - Archive of obsolete content
ction assign binding bindings conditions content member param query queryset rule template textnode triple where script commandset command broadcaster broadcasterset observes key keyset stringbundle stringbundleset arrowscrollbox dropmarker grippy scrollbar scrollcorner spinbuttons all attributes all properties all methods attributes defined for all xul elements style classes event handlers deprecated/defunct markup ...
XUL Template Primer - Bindings - Archive of obsolete content
e specified in a rule's <conditions>. this is different from the variables specified in the rule's conditions, where a value must be found for each variable for the rule to match. if a <binding> can't be matched, the rule will still fire. example to illustrate how <bindings> work, we'll examine this xul document, which builds a simple content model an rdf/xml file. ...
attribute.align - Archive of obsolete content
he total size of the children. for boxes that have horizontal orientation, it specifies how its children will be aligned vertically. for boxes that have vertical orientation, it is used to specify how its children are algined horizontally. the pack attribute is related to the alignment but is used to specify the position in the opposite direction. you can also specify the value of align using the style property -moz-box-align. parameters start child elements are aligned starting from the left or top edge of the box. if the box is larger than the total size of the children, the extra space is placed on the right or bottom side. center extra space is split equally along each side of the child elements, resulting the children being placed in the center of the box. end child elements are placed ...
button - Archive of obsolete content
menuitem. open type: boolean for the menu type buttons, the open attribute is set to true when the menu is open. the open attribute is not present if the menu is closed. orient type: one of the values below used to specify whether the children of the element are oriented horizontally or vertically. the default value depends on the element. you can also use the -moz-box-orient style property. horizontal child elements of the element are placed next to each other in a row in the order that they appear in the xul source. vertical child elements of the element are placed under each other in a column in the order that they appear in the xul source. tabindex type: integer the tab order of the element. the tab order is the order in which the focus is moved...
colorpicker - Archive of obsolete content
er key is pressed radio/check box when the state is changed select list when the selected item is changed what is accessible the script context at this point can only access the following things: global values/functions i.e. ...
command - Archive of obsolete content
see bug 1173061 for details. ...
commandset - Archive of obsolete content
s to one of the specified elements. ...
content - Archive of obsolete content
if set, the conditions will only match if the template builder is parsing content for an element directly inside this tag. for example, by using a value of treechildren, the condition will only match when placing elements directly inside a treechildren tag. thus,...
dialog - Archive of obsolete content
yhelp, buttonalign, buttondir, buttondisabledaccept, buttonlabelaccept, buttonlabelcancel, buttonlabeldisclosure, buttonlabelextra1, buttonlabelextra2, buttonlabelhelp, buttonorient, buttonpack, buttons, defaultbutton, title properties buttons, defaultbutton methods acceptdialog, canceldialog, centerwindowonscreen, getbutton, movetoalertposition examples <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?> <dialog id="donothing" title="dialog example" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" buttons="accept,cancel" buttonlabelcancel="cancel" buttonlabelaccept="save"> <dialogheader title="options" description="my preferences"/> <groupbox> <caption label="colour"/> <radiogroup> <radio...
iframe - Archive of obsolete content
contentdocument type: document this read-only property contains the document object in the element. contentwindow type: todo use the contentwindow.wrappedjsobject to obtain...
key - Archive of obsolete content
Archive › Mozilla › XUL › key
ut entirely for the bubbling phase. ...
menubar - Archive of obsolete content
ets and sets the value of the statusbar attribute. ...
notificationbox - Archive of obsolete content
this property is read-only. allnotifications type: nodelist nodelist of all notifications. this property is read-only. notificationshidden type: boolean indicating whether the notif...
param - Archive of obsolete content
Archive › Mozilla › XUL › param
ring literal, the default value properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
preference - Archive of obsolete content
er key is pressed radio/check box when the state is changed select list when the selected item is changed what is accessible the script context at this point can only access the following things: global values/functions i.e. ...
prefwindow - Archive of obsolete content
, buttons, defaultbutton, lastselected, onbeforeaccept, ondialogaccept, ondialogcancel, ondialogdisclosure, ondialoghelp, onload, onunload, title, type properties buttons, currentpane, defaultbutton, lastselected, preferencepanes, type methods acceptdialog, addpane, canceldialog, centerwindowonscreen, getbutton, opensubdialog, openwindow, showpane examples <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <prefwindow xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <prefpane id="saveoptions" label="backups"> <preferences> <preference id="pref-backup" name="myapp.mybackups" type="bool"/> <preference id="pref-backupduration" name="myapp.mybackups.duration" type="int"/> </preferences> <checkbox label="...
rule - Archive of obsolete content
Archive › Mozilla › XUL › rule
nodes with a parse type of integer. ...
scrollbar - Archive of obsolete content
e pressed. the default value is 10. ...
stringbundle - Archive of obsolete content
this is an object which implements nsilocale. src type: url gets and sets the value of the src attribute. stringbundle type: nsistringbundle returns the ...
tabpanels - Archive of obsolete content
selectedindex type: integer returns the index of the currently selected item. you may select an item by assigning its index to this property. by assigning -1 to this property, all items will...
toolbarbutton - Archive of obsolete content
the command. open type: boolean for the menu type buttons, the open attribute is set to true when the menu is open. the open attribute is not present if the menu is closed. orient type: one of the values below used to specify whether the children of the element are oriented horizontally or vertically. the default value depends on the element. you can also use the -moz-box-orient style property. horizontal child elements of the element are placed next to each other in a row in the order that they appear in the xul source. vertical child elements of the element are placed under each other in a column in the order that they appear in the xul source. tabindex type: integer the tab order of the element. the tab order is the order in which the focus is moved ...
treeitem - Archive of obsolete content
ents outside will appear only once. ...
wizard - Archive of obsolete content
will be shared among all pages. more information is available in the xul tutorial. ...
wizardpage - Archive of obsolete content
s first in the wizard child list. ...
Dialogs in XULRunner - Archive of obsolete content
"native" dialogs so users get a consistent experience across applications. custom dialogs building dialogs in xul is very similar to creating windows. each dialog is described in its own xul file. xul provides a dialog element to act as the container for the dialog. dialog xul files can have dtd, css, and javascript, just like windows. ...
XULRunner tips - Archive of obsolete content
spector.jar!/locale/inspector/ skin inspector modern/1.0 jar:inspector.jar!/skin/modern/inspector/ skin inspector classic/1.0 jar:inspector.jar!/skin/classic/inspector/ overlay chrome://inspector/content/popupoverlay.xul chrome://inspector/content/viewers/dom/popupoverlay.xul overlay chrome://inspector/content/commandoverlay.xul chrome://inspector/content/viewers/stylerules/commandoverlay.xul overlay chrome://inspector/content/keysetoverlay.xul chrome://inspector/content/viewers/dom/keysetoverlay.xul overlay chrome://inspector/content/popupoverlay.xul chrome://inspector/content/viewers/stylerules/popupoverlay.xul overlay chrome://inspector/content/commandoverlay.xul chrome://inspector/content/viewers/dom/commandoverlay.xul to launch dom inspector in you...
XUL Application Packaging - Archive of obsolete content
with a command line flag "--install-app" if xulrunner is registered on the system. see command line options for more details. note: for instructions on deploying your applications see deploying xulrunner. application.ini the application.ini manifest is located at the root of the extension and provides metadata that allows xulrunner to launch the application properly. it is parsed as a windows-style ini file with [headings] and key=value pairs. lines beginning with ; or # are treated as comments. a sample application.ini file can be found in the mozilla source tree. the [app] section the app section specifies metadata about the application name specifies the application name. required name example: name=testapplication version specifies the application version number. ...
Mozilla release FAQ - Archive of obsolete content
can use the mozilla news server. (some people receive the newsgroups via a mailing list. take this into consideration when posting things) ftp see the mozilla ftp mirror section for ftp sites under which license terms was mozilla released? mozilla is released under the npl/mpl (netscape/mozilla public licenses) which are in some ways similar to the gnu gpl, and in some ways similar to a bsd-style license. take a look at mozilla.org's npl area for details. what are all of the codenames given to various netscape/mozilla projects? gecko (formerly raptor) is the new html rendering engine in mozilla. it features speed improvements, a more modular nature, and significantly less platform-dependant code. it is more suitable for being embedded in other applications than the previous rendering engi...
2006-12-01 - Archive of obsolete content
when window.blur() is called. ff2 not responding to click on link concerns regarding ff 2.0 not responding to button or link clicks until the button or link is clicked a second time. dual screen browsing discussion regarding browsing across dual screens and simplifying the process. suggestion for status bar suggestion that a new status bar be implemented that would have a hover>appear style of operation similar to the mac "menu". meetings none this week. authors sara minchella (sara) dave manley (senemanley) back to summary list ...
2006-11-17 - Archive of obsolete content
ant memory leak. win2xul asks for any quick pointers, opinions, experience, suggestions or ideas on where xulrunner might leak memory bug 319654 was fixed on trunk recently. nickolay ponomarev lets us know that processing instructions are now added to xul document's dom this also means, you can no longer use document.firstchild in xul scripts to get the root element of a xul document and the xml-stylesheet and xul-overlay processing instructions outside the prolog no longer have any effect peter.sei...@gmail.com runs into some difficulties deploying xulrunner 1.8 on os x? please see mozilla.dev.platform faq for solution. peter naulls makes the suggestion in use and maintenance of xlib code that he become the nominal maintainer of the xlib code. meetings no meetings this week ...
2006-09-29 - Archive of obsolete content
prbool ashrinkwrap) = 0; details can be located at refactoring some of nshtmlreflowstate. discussion on how to determine whether there is pending layout changes or reflows when using a popup. it was concluded that a frame model change is utilized within a popup, not a layout change. on the reflow branch, check the dirty and dirty_children framestate flags. that won't help with pending style changes, but it'll work to detect cases when the popup or something in it needs to be reflown. details can be located at frame reflow issues related to the ongoing implementation of mathml-in-html into mozilla, which include: exposing the mathml implementation to tag soup. css matching rules. details can be located at mathml-in-html5 meetings no meetings for this week. ...
2006-12-24 - Archive of obsolete content
summary: mozilla.dev.tech.layout november 24 -december 1, 2006 announcements none this week. discussions [reset issue for overflow='hidden' in ie and opera there is a very modest horizontal shift of the document due to reflow associated with the removal of the vertical scroll bar (because the document content is using a horizontal centering style). but in firefox the document is reset (shifted both horizontally and vertically) to its 0,0 position before being centered horizontally. ...
2006-12- 02 - Archive of obsolete content
summary: mozilla.dev.tech.layout - november 24 2006 - december 2, 2006 announcements none this week. discussions [reset issue for overflow='hidden' in ie and opera there is a very modest horizontal shift of the document due to reflow associated with the removal of the vertical scroll bar (because the document content is using a horizontal centering style). but in firefox the document is reset (shifted both horizontally and vertically) to its 0,0 position before being centered horizontally. ...
NPN_PostURL - Archive of obsolete content
. the data to post can be contained either in a local temporary file or a new memory buffer. to post to a temporary file, set the flag file to true, the buffer buf to the path name string for a file, and len to the length of the path string. the file-type url prefix "file://" is optional. ms windows and os x if a file is posted with any protocol other than ftp, the file must be text with unix-style line breaks ('\n' separators only). to post data from a memory buffer, set the flag file to false, the buffer buf to the data to post, and len to the length of buffer. possible url types include http (similar to an html form submission), mail (sending mail), news (posting a news article), and ftp (upload a file). plug-ins can use this function to post form data to cgi scripts using http or up...
XEmbed Extension for Mozilla Plugins - Archive of obsolete content
embed protocol for hosting plugins. for backwards compatibility reasons if you don't tell mozilla that you support it it will try to hand you an xt widget as a parent. however, before you do so you should make sure that the browser also supports xembed when the plugin is first initialized. if you've built your plugin so that it will support either xt or xembed you can include a fallback for older style hosting. if you haven't you can return an error and the plugin will be ignored. it's good practice to do this in case people try to install your plugin for older versions of the browser that don't support xembed functionality. this is an incomplete example of what a piece of code might look like that tries to check for the proper mozilla version. this would be included in your np_initialize funct...
Proposal - Archive of obsolete content
s rss extension module used for iptv and ipradio/podcasting. spec exists newsgator feed extension created to make rss feeds work better with newsgator software. lets you specify an image, up to 277x78 pixels. and lets you specifies a specific rendering transform (xslt) to be used when rendering the feed in newsgator for outlook. the transform must already exist on the machine running newsgator; stylesheets will not be downloaded or installed automatically. spec exists rss disposition hinting a proposal to make it so iptv and ipradio/podcasting works better with rss. uses an http "content-type" parameter to hint at an rss feeds disposition type -- to hint at what is being syndicated. in development rsshints a module that adds elements to a feed that help an aggregator process them. draft e...
title - Archive of obsolete content
element</td> <td><item></td> <td>✔</td> <td>✔</td> <td>✔</td> <td>✔</td> <td>?</td> <td>?</td> <td>?</td> <td>?</td> <td>?</td> </tr> <tr> <td>rss text input element</td> <td><textinput></td> <td>✔</td> <td>✔</td> <td>✔</td> <td>✔</td> <td>?</td> <td>?</td> <td>?</td> <td>?</td> <td>?</td> </tr> </table> </center> see also none rss element</td> <th colspan="9" style="text-align:center">rss version ...
Creating a Skin for Firefox - Archive of obsolete content
what is a skin? a skin does not totally change the interface; instead, it just defines how the interface looks. you can't change what happens when the user right clicks on an image, but you can change the look of the right click menu (make it blue with pink polka dots, for example). ...
Making sure your theme works with RTL locales - Archive of obsolete content
ns are mirrored in rtl mode, so left becomes right and right becomes left. as a result, you almost never want to use left/right rules for paddings, borders, and margins. instead, you should use the following start/end rules instead to ensure rtl compatibility: -moz-padding-start -moz-padding-end -moz-margin-start -moz-margin-end -moz-border-start -moz-border-start-color -moz-border-start-style -moz-border-start-width -moz-border-end -moz-border-end-color -moz-border-end-style -moz-border-end-width #urlbar-search-splitter { min-width: 8px; -moz-margin-start: -4px; border: none; background: transparent; } testing your theme testing your theme for rtl compatibility is easy, and you do not even have to go through the hassle of downloading a rtl locale. the force rtl extens...
Theme changes in Firefox 3.5 - Archive of obsolete content
el. if you don't want the shadow, you can turn it off by setting the new -moz-window-shadow css property to none on the affected element. browser.xul bug 463189 added a new attribute on the xul window element of browser.xul named browsingmode. the value of this attribute is normal when the private browsing mode is inactive, and private when it's active. this attribute can be used to style different parts of the browser window inside the private browsing mode. see this blog post for an example. supporting 3.5 features video/audio player: controlbar has to be styled (chrome://global/skin/media/videocontrols.css) shadow effect for disabled text using text-shadow. greying menus of inactive windows: active windows get attribute 'active="true"'. to do this only for 3.5 use ...
Theme changes in Firefox 3 - Archive of obsolete content
emes/pinstripe/browser/browser.css .tabbrowser-tab[first-tab="true"] > .tab-image-left no longer has a margin-left. instead .tabs-left now displayed and given the same width as the former margin-left. it was already done this way in winstripe. changes in browser --- changes in global all platforms the yellow background for the location bar has been deprecated; instead, themes should style the new #identity-box element depending on its verifieddomain/verifiedidentity class. the go button is now located inside the location bar, so the image for it (chrome://browser/skin/go-arrow.png) needs to be smaller. the rule that's needed to show and hide the go button and other location bar icons is: #urlbar[pageproxystate="invalid"] > #urlbar-icons > :not(#go-button) , #urlbar[pageproxystat...
Theme changes in Firefox 4 - Archive of obsolete content
x element in the main browser window (#navigator-toolbox) still reflects the user preference in the toolbar customization palette. use of the iconsize attribute on toolbar elements add-ons use the iconsize attribute to determine which icon they should display when a button is placed in a specific toolbar. iconsize value actual add-on toolbar button icon dimensions (assuming correct stylesheet and images) small 16x16 pixels large 24x24 pixels note: for stock buttons, the theme is free to use icons of any size. however, the theme should be designed in such a way that the above add-on button icon sizes fit correctly. note: add-ons always use a 24x24 pixels icon when the button is displayed in the toolbar customization palette. default values of t...
Using SSH to connect to CVS - Archive of obsolete content
ng up cvs to use ssh in your system's environment, make sure thatcvs_rsh is set to whatever your ssh binary is called; a full path is not necessary if ssh is already in your path. replace pserver with ext in your cvsroot environment variable. if you wish to keep your previous pserver trees, you'll need to update the root files in each cvs subdirectory in your tree. this can be done using a unix-style find and perl: find . -name root -exec perl -p -i -e "s/pserver/ext/" {} \; dealing with firewalls do not attempt to perform the steps in this section unless you have first verified that you can access cvs.mozilla.org from outside of the firewall. only proceed with these steps once you are certain you can access cvs.mozilla.org from the open internet. if you are behind a firewall with an htt...
-moz-border-bottom-colors - Archive of obsolete content
s pixel, each line of pixels uses the next color specified in this property, from the outside in. this eliminates the need for nested boxes. if the border is wider than the number of specified colors, the remaining part of the border is the innermost color specified. initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete it does not apply if border-style is dashed or dotted. to tables with border-collapse: collapse. syntax values accepts a white-space separated list of color values. <color> specifies the color of a line of pixels of the bottom border. transparent is valid. see <color> values for possible units. none default, no colors are drawn or border-color is used, if specified. formal syntax <color>+ | nonewhere <color> = <rgb(...
-moz-border-left-colors - Archive of obsolete content
s pixel, each line of pixels uses the next color specified in this property, from the outside in. this eliminates the need for nested boxes. if the border is wider than the number of specified colors, the remaining part of the border is the innermost color specified. initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete it does not apply if border-style is dashed or dotted. to tables with border-collapse: collapse. syntax values accepts a white-space separated list of color values. <color> specifies the color of a line of pixels of the left border. transparent is valid. see <color> values for possible units. none default, no colors are drawn or border-color is used, if specified. formal syntax <color>+ | nonewhere <color> = <rgb()>...
-moz-border-right-colors - Archive of obsolete content
s pixel, each line of pixels uses the next color specified in this property, from the outside in. this eliminates the need for nested boxes. if the border is wider than the number of specified colors, the remaining part of the border is the innermost color specified. initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete it does not apply if border-style is dashed or dotted. to tables with border-collapse: collapse. syntax values accepts a white-space separated list of color values. <color> specifies the color of a line of pixels of the right border. transparent is valid. see <color> values for possible units. none default, no colors are drawn or border-color is used, if specified. formal syntax <color>+ | nonewhere <color> = <rgb()...
-moz-border-top-colors - Archive of obsolete content
s pixel, each line of pixels uses the next color specified in this property, from the outside in. this eliminates the need for nested boxes. if the border is wider than the number of specified colors, the remaining part of the border is the innermost color specified. initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete it does not apply if border-style is dashed or dotted. to tables with border-collapse: collapse. syntax values accepts a white-space separated list of color values. <color> specifies the color of a line of pixels of the top border. transparent is valid. see <color> values for possible units. none default, no colors are drawn or border-color is used, if specified. formal syntax <color>+ | nonewhere <color> = <rgb()> ...
-moz-window-shadow - Archive of obsolete content
-shadow css property to provide a way to turn off unwanted shadows. initial valuedefaultapplies toall elements that create native windows, e.g. <window>, <panel>inheritednocomputed valueas specifiedanimation typediscrete syntax the -moz-window-shadow property is specified as one of the keyword values listed below. values default the window will have a shadow with the default window shadow style. menu the window will have the shadow style that's appropriate for menus. tooltip the window will have the shadow style that's appropriate for tooltips. sheet the window will have the shadow style that's appropriate for sheet windows. none the window won't have a shadow. formal syntax default | menu | tooltip | sheet | none example .kui-panel { -moz-window-shadow: none; } ...
-ms-accelerator - Archive of obsolete content
ion to "hide keyboard navigation indicators until i use the alt key" is enabled in the user's display properties, the "n" is not underlined until the user presses the alt key. when alt + n is pressed, the <input> element that defines an accesskey attribute value of "n" receives the focus. <!doctype html> <html> <head> <title>accelerator</title> </head> <body> <label for="oname"><u style="-ms-accelerator: true; accelerator: true">n</u>ame: </label> <input type="text" id="oname" size="25" accesskey="n" value="your name here" /> </body> </html> specifications not part of any specification. remarks this property is supported by windows 2000 and later. it enables users to hide navigation indicators for menu items and controls until the alt key is pr...
-ms-scroll-chaining - Archive of obsolete content
able element will begin to scroll in the same direction. had the -ms-scroll-chaining property been set to none, the user would observe a bounce effect when the nested element reaches its boundary. for more information, see html scrolling, panning and zooming sample or internet explorer 10 scrolling, panning, and zooming with touch. .imagecontainer { -ms-scroll-chaining: chained; -ms-overflow-style: none; -ms-content-zooming: zoom; -ms-scroll-rails: none; -ms-content-zoom-limit-min: 100%; -ms-content-zoom-limit-max: 500%; -ms-scroll-snap-type: proximity; -ms-scroll-snap-points-x: snaplist(100%, 200%, 300%, 400%, 500%); -ms-overflow-style: none; width: 480px; height: 270px; overflow: auto; } specifications not part of any specification. remarks this property only app...
-ms-scroll-snap-points-x - Archive of obsolete content
...
-ms-scroll-snap-points-y - Archive of obsolete content
...
-ms-scrollbar-arrow-color - Archive of obsolete content
centage>, <percentage>, <alpha-value>? )where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples the following example shows how to use -ms-scrollbar-arrow-color and -ms-scrollbar-face-color to display a scroll bar with a blue scroll box and arrows, and a scroll bar with a green scroll box and arrows. ...
-ms-scrollbar-base-color - Archive of obsolete content
()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples this example uses -ms-scrollbar-base-color and -ms-scrollbar-arrow-color to create two <div> objects with different scroll bar color schemes. ...
-ms-scrollbar-face-color - Archive of obsolete content
) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples this example uses -ms-scrollbar-face-color and -ms-scrollbar-arrow-color to display a scroll bar with a blue scroll box and arrows, and a scroll bar with a green scroll box and arrows. ...
-ms-scrollbar-highlight-color - Archive of obsolete content
percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples this example uses -ms-scrollbar-highlight-color, -ms-scrollbar-face-color, and -ms-scrollbar-arrow-color to create two <div> objects with different scroll bar color schemes. ...
-ms-scrollbar-track-color - Archive of obsolete content
> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples this example uses -ms-scrollbar-track-color, -ms-scrollbar-face-color, and -ms-scrollbar-arrow-color to create two <div> elements with different scroll bar color schemes. ...
-moz-mac-graphite-theme - Archive of obsolete content
note: since firefox 58, this media feature is no longer available to web content — it is only available internally (e.g. to xul / chrome code). see bug 1396066 for more details. the -moz-mac-graphite-theme gecko-only css media feature can be used to apply styles based on whether the user has the mac os x "graphite" theme enabled. syntax <integer> if the user has configured their device to use the "graphite" appearance on mac os x, this is 1. if the user is using the standard blue appearance, or is not on mac os x, this is 0. media: media/visual accepts min/max prefixes: no ...
-moz-maemo-classic - Archive of obsolete content
syntax <integer> if the user agent is using maemo with the original theme, this is 1. ...
-moz-os-version - Archive of obsolete content
this can be useful for adapting application skins and other chrome code depending on the user's operating system version. ...
-moz-windows-accent-color-in-titlebar - Archive of obsolete content
note: since firefox 58, this media feature is no longer available to web content — it is only available internally (e.g. to xul / chrome code). see bug 1396066 for more details. the -moz-windows-accent-color-in-titlebar gecko-only css media feature can be used to apply styles based on whether accent colors are enabled in microsoft windows titlebars. syntax <integer> in recent windows versions (e.g., 10), if accent colors are enabled in window titlebars, this is 1. otherwise it's 0. media: media/visual accepts min/max prefixes: no example @media (-moz-windows-accent-color-in-titlebar: 1) { h1 { color: -moz-win-accentcolortext; } body { background-color: -moz-win-accentcolor; } } ...
Array comprehensions - Archive of obsolete content
map(i => i * 2); comprehensions can also be used to select items that match a particular expression. here is a comprehension which selects only even numbers: var numbers = [1, 2, 3, 21, 22, 30]; var evens = [for (i of numbers) if (i % 2 === 0) i]; console.log(evens); // logs 2,22,30 filter() can be used for the same purpose: var evens = numbers.filter(i => i % 2 === 0); map() and filter() style operations can be combined into a single array comprehension. here is one that filters just the even numbers, then creates an array containing their doubles: var numbers = [1, 2, 3, 21, 22, 30]; var doubledevens = [for (i of numbers) if (i % 2 === 0) i * 2]; console.log(doubledevens); // logs 4,44,60 the square brackets of an array comprehension introduce an implicit block for scoping purposes...
New in JavaScript 1.7 - Archive of obsolete content
cma-262 standard at the time. in more recent firefox versions, the implementation is updated to work with semantics as specified in ecmascript edition 6. please see the reference pages for differences. iterators and generators array comprehensions let statement (support for let expression was dropped in gecko 41, see bug 1023609). const statement destructuring assignment (support for js1.7 style destructuring for-in was dropped in gecko 40, see bug 1083498). ...
RDF: Resource Description Framework for metadata - Archive of obsolete content
Archive › Web › RDF
p or value of that trait. documentation directions of the mozilla rdf engine this presentation shows new developments in the mozilla rdf engine. these include plans to expose the rdf api to public web content, as well as performance and correctness improvements. what is rdf tim bray's introduction to the resource description framework, at xml.com. rdf datasource how-to a cookbook-style document describing how to create a native, client-side datasource that works with mozilla's rdf implementation. view all... community view mozilla forums... mailing list newsgroup rss feed rdf-dev mailing list tools rdf editors and tools rdf validator related topics xml categories interwiki language links ...
Standards-Compliant Authoring Tools - Archive of obsolete content
tor created from the remains of mozilla composer. currently the work done on nvu is being ported back to mozilla source code. html-kit is a full-featured, low priced editor designed to help html, xhtml and xml authors to edit, format, lookup help, validate, preview and publish web pages. validation is done with html tidy, so you can verify standards compliance. macromedia™ dreamweaver™ cs6 style master and layout master by western civilisation some caveats: it appears that tools currently available from namo generate ie-specific or netscape 4-specific code that may require extra debugging for compatibility with standards-based browsers. newer versions of microsoft frontpage™ have improved, however be sure not to rely on frontpage-specific extensions for critical website content or fu...
background-size - Archive of obsolete content
the main content. here's a slightly more complex example (screenshot), and the same page without the -moz-border-image image rule (screenshot). user:robertc 2009-08-09 this is only an issue with <body> and <html>. <body>'s background extends per css spec to <html>. since you have a 8px default margin on <body> and your <body>'s content is smaller than the viewport's height, you see what you see. styles like this should work: body { border:0; margin:0; padding:0.6em } /* or for less content, if body is small */ html, body { height:100%; } body { border:0; margin:0; padding:0.6em } furthermore, you may simplify things a bit if you apply the background and border-image styles to <html> rather than <body>. user:jürgen jeka 2009-08-12 ok, probably my understanding of css inheritance isn't all it...
XForms Custom Controls - Archive of obsolete content
a> <curimg></curimg> <img label="firefox">http://www.mozilla.com/images/firefox-logo-64x64.png</img> <img label="thunderbird">http://www.mozilla.com/images/thunderbird-logo-64x64.png</img> <img label="bugzilla">http://www.mozilla.org/images/p-bugz.gif</img> <img label="mozilla">http://www.mozilla.org/images/mozhead-80x64.gif</img> </data> </xf:instance> </xf:model> <style type="text/css"> @namespace xf url(http://www.w3.org/2002/xforms); xf|output[mediatype="image/*"] { -moz-binding: url('#output-image'); } </style> </head> <body> <h1>custom control sample</h1> <xf:select1 ref="curimg"> <xf:label>select image to display: </xf:label> <xf:itemset nodeset="../img"> <xf:label ref="@label"/> <xf:value ref="."/> ...
XForms Repeat Element - Archive of obsolete content
<xbl:content> <xf:repeat xbl:inherits="bind, model, nodeset" anonid="anonidgridrepeat"> <xf:trigger> <xf:label>r</xf:label> <xf:delete ev:event="domactivate" at="index('anonidgridrepeat')" xbl:inherits="model, bind, nodeset"/> </xf:trigger> </xf:repeat> </xbl:content> </xbl:binding> </xbl:bindings> <style> div.grid { -moz-binding: url('#grid'); } </style> <xf:model> <xf:instance> <data xmlns=""> <repeat> <item> <input>input1</input> </item> <item> <input>input2</input> </item> <item> <input>input3</input> </item> </repeat> </data> </xf:instance> ...
Using the Right Markup to Invoke Plugins - Archive of obsolete content
ecific flash architecture in mozilla-based browsers. the data attribute points to the swf file to play, and the configuration parameters (the param elements) are used in a consistent manner both for ie and for mozilla-based browsers such as netscape 7. in fact, the above usage will also work for ie, which understands mime type invocations for certain mime types such as flashin addition to activex-style classid invocations. since the use of mime type for flash will work for both ie and netscape 7, you can use the above markup to invoke the flash plugin for both ie and netscape 7. however, there are a few caveats that developers ought to bear in mind when using the object element with mozilla-based browsers such as netscape 7 and in ie: caveats if you use one single object element for both b...
Windows Media in Netscape - Archive of obsolete content
object element usage with clsid and script for="" event="" syntax. dhtml behaviors can be used in internet explorer to perform activex control detection. for example, the following uses dhtml behaviors to associate a set of behaviors with a span element, which is then interrogated for its version number (the script attempts to verify that the windows media player control is at version 9): <span style="behavior:url(#default#clientcaps)" id="cc"></span> <script language=javascript> var cv = cc.getcomponentversion( "{6bf52a52-394a-11d3-b153-00c04f79faa6}", "componentid" ); if (cv == null || cv == "") { top.location.href = "http://foo.bar.foo/checkref"; } </script> netscape 7.1 does not support ie's dhtml behaviors. in order to use the windows media player control in both netscape 7.1 and...
Archive of obsolete content
d here; instead, refer to the downloadable sample code or to the previous sample for further details. creating a status bar extension many of the concepts introduced here apply to any xul-based application; however, to keep from getting completely overwhelmed, we're going to focus specifically on firefox. css3 css3 is the latest evolution of the cascading style sheets language and aims at extending css2.1. it brings a lot of long-awaited novelties, like rounded corners, shadows, gradients, transitions or animations, as well as new layouts like multi-columns, flexible box or grid layouts. element events archived event pages firefox developer tools these are articles related to th...
Introduction to game development for the Web - Game development
velopers. here's a thorough list to give you a taste of what the web can do for you: full screen api this simple api lets your game take over the entire screen, thereby immersing the player in action. gamepad api if you want your users to be able to use gamepads or other game controllers to work your game, you'll need this api. html and css together, these two technologies let you build, style, and lay out your game's user interface. part of html is the <canvas> element, which provides one way to do 2d graphics. html audio the <audio> element lets you easily play simple sound effects and music. if your needs are more involved, check out the web audio api for real audio processing power! indexeddb a powerful data storage api for maintaining user data on their own computer or device.
Game monetization - Game development
n decent money on selling your games for a fixed price you have to invest your time and money in marketing. only the best games will break even or earn more than they cost to make, and you still need a lot of luck for that. how much you charge for your game depends on the market, quality of your game and a lot of other small factors. an arcade ios title can be sold for 0.99 usd, but a longer rpg-style desktop game on steam can cost 20 usd; both prices are ok. you have to follow the market and do your own research — learning from your mistakes quickly is important. in-app purchases instead of having people pay for your game up front, you can offer a free game with in-app purchases (iaps.) in this case the game can be acquired without spending a dime — give the game to the players, but off...
2D collision detection - Game development
; var dim1 = {x: 5, y: 5} var dim2 = {x: 20, y: 20} crafty.c("circle", { circle: function(radius, color) { this.radius = radius; this.w = this.h = radius * 2; this.color = color || "#000000"; this.bind("move", crafty.drawmanager.drawall) return this; }, draw: function() { var ctx = crafty.canvas.context; ctx.save(); ctx.fillstyle = this.color; ctx.beginpath(); ctx.arc( this.x + this.radius, this.y + this.radius, this.radius, 0, math.pi * 2 ); ctx.closepath(); ctx.fill(); ctx.restore(); } }); var circle1 = crafty.e("2d, canvas, circle").attr(dim1).circle(15, "red"); var circle2 = crafty.e("2d, canvas, circle, fourway").fo...
Bounding volume collision detection with THREE.js - Game development
he linked mesh rotates or changes its dimensions, and update its position. it takes into account the child meshes when computing the size of the bounding box, so the original mesh and all its children are wrapped. we can easily debug collisions by rendering the meshes that boxhelper creates. by default they are created with a linebasicmaterial material (a three.js material for drawing wireframe-style geometries). the main disadvantage is that it only creates box bounding volumes, so if you need spheres vs aabb tests you need to create your own sphere objects. to use it, we need to create a new boxhelper instance and supply the geometry and — optionally — a color that will be used for the wireframe material. we also need to add the newly created object to the three.js scene in order to ...
Audio for Web games - Game development
hiding the "loading" text and displaying the play button: trackels.foreach((el, i) => { // get children const anchor = el.queryselector('a'); const loadtext = el.queryselector('p'); const playbutton = el.queryselector('button'); // load file loadfile(anchor.href).then((track) => { // set loading to false el.dataset.loading = 'false'; // hide loading text loadtext.style.display = 'none'; // show button playbutton.style.display = 'inline-block'; // allow play on click playbutton.addeventlistener('click', function() { // check if context is in suspended state (autoplay policy) if (audioctx.state === 'suspended') { audioctx.resume(); } playtrack(track); playbutton.dataset.playing = true; }) }) }) n...
Efficient animation for web games - Game development
ns — that particular issue is now fixed). some of the third party code we were using was poorly optimised. a take-away to help combat poor animation performance, chris lord wrote animator.js, a simple, easy-to-use animation library, heavily influenced by various parts of clutter, but with a focus on avoiding scope-creep. it does one thing, and it does it well. animator.js is a fire-and-forget style animation library, designed to be used with games, or other situations where you need many, synchronised, custom animations. it includes a handful of built-in tweening functions, the facility to add your own, and helper functions for animating object properties. puzzowl uses it to drive all the drawing updates and transitions, by overriding its requestanimationframe function with a custom version...
Collision detection - Game development
if(bricks[c][r].status == 1) { var brickx = (c*(brickwidth+brickpadding))+brickoffsetleft; var bricky = (r*(brickheight+brickpadding))+brickoffsettop; bricks[c][r].x = brickx; bricks[c][r].y = bricky; ctx.beginpath(); ctx.rect(brickx, bricky, brickwidth, brickheight); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); } } } } tracking and updating the status in the collision detection function now we need to involve the brick status property in the collisiondetection() function: if the brick is active (its status is 1) we will check whether the collision happens; if a collision does occur we'll set the status of...
Finishing up - Game development
lives implementing lives is quite straightforward. let's first add a variable to store the number of lives in the same place where we declared our other variables: var lives = 3; drawing the life counter looks almost the same as drawing the score counter — add the following function to your code, below the drawscore() function: function drawlives() { ctx.font = "16px arial"; ctx.fillstyle = "#0095dd"; ctx.filltext("lives: "+lives, canvas.width-65, 20); } instead of ending the game immediately, we will decrease the number of lives until they are no longer available. we can also reset the ball and the paddle positions when the player begins with their next life. so, in the draw() function replace the following three lines: alert("game over"); document.location.reload(); cleari...
Paddle and keyboard controls - Game development
here we're defining the height and width of the paddle and its starting point on the x axis for use in calculations further on down the code. let's create a function that will draw the paddle on the screen. add the following just below your drawball() function: function drawpaddle() { ctx.beginpath(); ctx.rect(paddlex, canvas.height-paddleheight, paddlewidth, paddleheight); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); } allowing the user to control the paddle we can draw the paddle wherever we want, but it should respond to the user's actions. it's time to implement some keyboard controls. we will need the following: two variables for storing information on whether the left or right control button is pressed. two event listeners for keydown and keyup even...
Track the score and win - Game development
ore throughout the game, eventually you can impress your friends. you need a variable to record the score. add the following into your javascript, after the rest of your variables: var score = 0; you also need a drawscore() function, to create and update the score display. add the following after the collisiondetection() function: function drawscore() { ctx.font = "16px arial"; ctx.fillstyle = "#0095dd"; ctx.filltext("score: "+score, 8, 20); } drawing text on a canvas is similar to drawing a shape. the font definition looks exactly like the one in css — you can set the size and font type in the font() method. then use fillstyle() to set the color of the font and filltext() to set the actual text that will be placed on the canvas, and where it will be placed. the first paramete...
The score - Game development
fter the previously defined ones: // ... var scoretext; var score = 0; adding score text to the game display now add this line at the end of the create() function: scoretext = game.add.text(5, 5, 'points: 0', { font: '18px arial', fill: '#0095dd' }); the text() method can take four parameters: the x and y coordinates to draw the text at. the actual text that will be rendered. the font style to render the text with. the last parameter looks very similar to css styling. in our case the score text will be blue, sized at 18 pixels, and use the arial font. updating the score when bricks are destroyed we will increase the number of points every time the ball hits a brick and update the scoretext to display the current score. this can be done using the settext() method — add the two ...
Visual-js game engine - Game development
d : server_folder/node editor.js after starting on-page-editor open browser icon to open internet browser in editor mode . see video explanation : if you use editor.js to visual create game object method , you must start ***node build_from_editor_to_visual_js_file.js*** on the end of work. this tool will create visual.js in folder starter/ with all your game object was created in editor style . or you can use visual-js source editor. visual-js source editor (2d part only) is new and better way .in future visual staff will be better (real time simulator will be implemented).for now this place is good for coding . visual-js works direct with project files , no need for build . add->new game object (form dialog for define type of new game object ) add->quick code (make y...
CDN - MDN Web Docs Glossary: Definitions of Web-related terms
a cdn (content delivery network) is a group of servers spread out over many locations. these servers store duplicate copies of data so that servers can fulfill data requests based on which servers are closest to the respective end-users. cdns make for fast service less affected by high traffic. cdns are used widely for delivering stylesheets and javascript files (static assets) of libraries like bootstrap, jquery etc. using cdn for those library files is preferable for a number of reasons: serving libraries' static assets over cdn lowers the request burden on an organization's own servers. most cdns have servers all over the globe, so cdn servers may be geographically nearer to your users than your own servers. geographical distance affects latency proportionally. cdns are already...
CSS Object Model (CSSOM) - MDN Web Docs Glossary: Definitions of Web-related terms
of steps that must happen to properly render a website. the cssom, together with the dom, to build the render tree, which is in turn used by the browser to layout and paint the web page. cssom api the css object model is also a set of apis allowing the manipulation of css from javascript. it is much like the dom, but for the css rather than the html. it allows users to read and modify the css style dynamically. see also populating the page: how browsers work ...
Houdini - MDN Web Docs Glossary: Definitions of Web-related terms
for web standards specifications to define them and without waiting for every browser to fully implement the features. while many of the features houdini enables can be created with javascript, interacting directly with the cssom before javascript is enabled provides for faster parse times. browsers create the cssom — including layout, paint, and composite processes — before applying any style updates found in scripts: layout, paint, and composite processes are repeated for updated javascript styles to be implemented. houdini code doesn't wait for that first rendering cycle to be complete. rather, it is included in that first cycle, creating renderable, understandable styles. see also houdini houdini: an introduction cssom css paint api css typed om ...
Media - MDN Web Docs Glossary: Definitions of Web-related terms
lking about the web; it takes on different meanings depending on the context. media (audio-visual presentation) the term media (more accurately, multimedia) refers to audio, video, or combined audio-visual material such as music, recorded speech, movies, tv shows, or any other form of content that is presented over a period of time. media (css) in the context of css (cascading style sheets), the term media refers to the destination to which the document is to be drawn by the rendering engine. learn more media on wikipedia ...
Parse - MDN Web Docs Glossary: Definitions of Web-related terms
d input into the document, building up the document tree. when the html parser finds non-blocking resources, such as an image, the browser will request those resources and continue parsing. parsing can continue when a css file is encountered, but <script> tags—particularly those without an async or defer attribute—blocks rendering, and pauses parsing of html. when the browser encounters css styles, it parses the text into the css object model (or cssom), a data structure it then uses for styling layouts and painting. the browser then creates a render tree from both these structures to be able to paint the content to the screen. javascript is also downloaded, parsed, and then execute. javascript parsing is done during compile time or whenever the parser is invoked, such as during a call t...
Prefetch - MDN Web Docs Glossary: Definitions of Web-related terms
zation technique that works by assuming which links the user is likely to click, then downloading the content of those links. if the user decides to click on one of the links, then the page will be rendered instantly as the content has already been downloaded. the prefetch hints are sent in http headers: link: ; rel=dns-prefetch, ; as=script; rel=preload, ; rel=prerender, ; as=style; rel=preload prefetch attribute value browsers will prefetch content when the prefetch <link> tag directs it to, giving the developer control over what resources should be prefetched. <link rel="prefetch" href="https://www.example.com/solutions" /> ...
Prototype-based programming - MDN Web Docs Glossary: Definitions of Web-related terms
prototype-based programming is a style of object-oriented programming in which classes are not explicitly defined, but rather derived by adding properties and methods to an instance of another class or, less frequently, adding them to an empty object. in simple words: this type of style allows the creation of an object without first defining its class. learn more general knowledge prototype-based programming on wikipedia ...
Pseudo-class - MDN Web Docs Glossary: Definitions of Web-related terms
in css, a pseudo-class selector targets elements depending on their state rather than on information from the document tree. for example, the selector a:visited applies styles only to links that the user has already followed. learn more technical reference pseudo-class documentation ...
Pseudo-element - MDN Web Docs Glossary: Definitions of Web-related terms
in css, a pseudo-element selector applies styles to parts of your document content in scenarios where there isn't a specific html element to select. for example, rather than putting the first letter of each paragraph in its own element, you can style them all with p::first-letter. learn more technical reference pseudo-elements ...
Rendering engine - MDN Web Docs Glossary: Definitions of Web-related terms
examples of layout engines: blink, gecko, edgehtml, webkit. ...
SVG - MDN Web Docs Glossary: Definitions of Web-related terms
html5 now allows direct embedding of svg tags in an html document. ...
Serialization - MDN Web Docs Glossary: Definitions of Web-related terms
learn more general knowledge serialization on wikipedia ...
Web standards - MDN Web Docs Glossary: Definitions of Web-related terms
e. web standards also must evolve to improve the current status and adapt to new circumstances. ...
XSLT - MDN Web Docs Glossary: Definitions of Web-related terms
extensible stylesheet language transformations (xslt) is a declarative language used to convert xml documents into other xml documents, html, pdf, plain text, and so on. xslt has its own processor that accepts xml input, or any format convertible to an xquery and xpath data model. the xslt processor produces a new document based on the xml document and an xslt stylesheet, making no changes to the original files in the process. learn more technical reference xslt on wikipedia xslt documentation on mdn ...
Property (CSS) - MDN Web Docs Glossary: Definitions of Web-related terms
a css property is a characteristic (like color) whose associated value defines one aspect of how the browser should display the element. ...
Accessible multimedia - Learn web development
er, there are problems with these controls: they are not keyboard accessible in most browsers, i.e. you can't tab between the controls inside the native player. opera and chrome provide this to some degree, but it still isn't ideal. different browsers give the native controls differing styling and functionality, and they aren't stylable, meaning that they can't be easily made to follow a site style guide. to remedy this, we can create our own custom controls. let's look at how. creating custom audio and video controls html5 video and audio share an api — html media element — which allows you to map custom functionality to buttons and other controls — both of which you define yourself. let's take the video example from above and add custom controls to them. basic setup first, gr...
Advanced styling effects - Learn web development
-blend-mode now let's look at mix-blend-mode. ...
Pseudo-classes and pseudo-elements - Learn web development
ext is inaccessible to some screen readers and might be hard for someone to find and edit in the future. a more valid use of these pseudo-elements is to insert an icon, for example the little arrow added in the example below, which is a visual indicator that we wouldn't want read out by a screenreader: these pseudo-elements are also frequently used to insert an empty string, which can then be styled just like any element on the page. in this next example, we have added an empty string using the ::before pseudo-element. we have set this to display: block in order that we can style it with a width and height. we then use css to style it just like any element. you can play around with the css and change how it looks and behaves. the use of the ::before and ::after pseudo-elements along wit...
Test your skills: Selectors - Learn web development
. if the element with a class of alert also has a class of go, make the background green. try updating the live code below to recreate the finished example: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. selectors three in this example, try making the following changes without adding to the html. style links, making the link-state orange, visited links green, and remove the underline on hover. make the first element inside the container font-size: 150% and the first line of that element red. stripe every other row in the table by selecting these rows and giving them a background color of #333 and foreground of white. try updating the live code below to recreate the finished example: f...
Test your skills: tables - Learn web development
g of the skills you studied in the lesson on styling tables. note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. task in the lesson we styled up a table in a rather garish manner. in this task we are going to style the same table, but using some good practices for table design as outlined in the external article web typography: designing tables to be read not looked at. our finished table will look like the image below. there are a number of ways that you can achieve this, but i suggest following similar patterns as used in the tutor...
CSS values and units - Learn web development
ffects the color output. note: at some point modern browsers were updated so that rgba() and rgb(), and hsl() and hsla() (see below), became pure aliases of each other and started to behave exactly the same. so for example both rgba() and rgb() accept colors with and without alpha channel values. try changing the above example's rgba() functions to rgb() and see if the colors still work! which style you use is up to you, but separating out non-transparent and transparent color definitions to use the different functions gives (very) slightly better browser support and can act as a visual indicator of where transparent colors are being defined in your code. hsl and hsla values slightly less well-supported than rgb is the hsl color model (not supported on old versions of ie), which was imple...
Floats - Learn web development
ante semper consectetur eget aliquam lorem. vivamus tristique elit dolor, sed pretium metus suscipit vel. mauris ultricies lectus sed lobortis finibus. vivamus eu urna eget velit cursus viverra quis vestibulum sem. aliquam tincidunt eget purus in interdum. ...
Test Your Skills: Fundamental layout comprehension - Learn web development
if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. project brief you have been provided with some raw html, basic css, and images — now you need to create a layout for the design, which should look just like the image below. basic setup you can download the html, css, and a set of six images here. save the html document and stylesheet into a directory on your computer, and add the images into a folder named images. opening the index.html file in a browser should give you a page with basic styling but no layout, which should look something like the image seen below. this starting point has all of the content of your layout as displayed by the browser in normal flow. if you don't want to work locally then using a tool su...
Supporting older browsers - Learn web development
ble at a basic level for users of older browsers. a basic level of support comes from structuring your content well so that the normal flow of your page makes sense. a user with a very limited feature phone might not get much of your css, but the content will flow in a way that makes reading easy. therefore, a well-structured html document should always be your starting point. if you remove your stylesheet, does your content make sense? one option is to leave this plain view of the site as the fallback for people using very old or limited browsers. if you have a tiny number of people coming to the site in these browsers it may not make commercial sense to pour time into trying to give them a similar experience to people on modern browsers. it would be better to spend the time on things which ...
How can we design for all types of users? - Learn web development
. let's consider this html: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>font size experiment</title> </head> <body> <div class="container"> <h1>this is our main heading <span class="subheading">this is our subheading</span> </h1> <p>[lengthly text that spans many lines]</p> </div> </body> </html> we have a div with class container. we can style the div either to set its width (using the width property) or its maximum width so that it never gets too large (using the max-width property). if you want an elastic/responsive website, and you don't know what the browser's default width is, you can use the max-width property to allow up to 70 characters per line and no more: div.container { max-width:70em; } alternative content for images, au...
What is the difference between webpage, website, web server, and search engine? - Learn web development
ve learning available yet. deeper dive so, let's dig deeper into how those four terms are related and why they are sometimes confused with each other. web page a web page is a simple document displayable by a browser. such documents are written in the html language (which we look into in more detail in other articles). a web page can embed a variety of different types of resources such as: style information — controlling a page's look-and-feel scripts — which add interactivity to the page media — images, sounds, and videos. note: browsers can also display other documents such as pdf files or images, but the term web page specifically refers to html documents. otherwise, we only use the term document. all web pages available on the web are reachable through a unique address. ...
Basic native form controls - Learn web development
l form widgets to their default values. button buttons that have no automatic effect but can be customized using javascript code. then we also have the <button> element itself. this can take a type attribute of value submit, reset, or button to mimic the behevior of the three <input> types mentioned above. the main difference between the two is that actual <button> elements are much easier to style. note: the image input type also renders as a button. we'll cover that later too. note: you can find the examples from this section on github as button-examples.html (see it live also). below you can find examples of each button <input> type, along with the equivalent button type. submit <button type="submit"> this is a <strong>submit button</strong> </button> <input type="submit" v...
The HTML5 input types - Learn web development
he :invalid pseudo-class will match, and the validitystate.typemismatch property will return true. search field search fields are intended to be used to create search boxes on pages and apps. this type of field is set by using the value search for the type attribute: <input type="search" id="search" name="search"> the main difference between a text field and a search field is how the browser styles its appearance. often, search fields are rendered with rounded corners; they also sometimes display an "Ⓧ", which clears the field of any value when clicked). additionally, on devices with dynamic keyboards, the keyboard's enter key may read "search", or display a magnifying glass icon. the below screenshots show a non-empty search field in firefox 71, safari 13, and chrome 79 on macos, and e...
Example - Learn web development
an>expiration date:</span> <strong><abbr title="required">*</abbr></strong> <em>formatted as mm/dd/yyyy</em> </label> <input type="date" id="date" name="expiration"> </p> </section> <section> <p> <button type="submit">validate the payment</button> </p> </section> </form> css content h1 { margin-top: 0; } ul { margin: 0; padding: 0; list-style: none; } form { margin: 0 auto; width: 400px; padding: 1em; border: 1px solid #ccc; border-radius: 1em; } div+div { margin-top: 1em; } label span { display: inline-block; width: 120px; text-align: right; } input, textarea { font: 1em sans-serif; width: 250px; box-sizing: border-box; border: 1px solid #999; } input[type=checkbox], input[type...
Sending form data - Learn web development
plication can be tricky. just remember that a front-end developer is not the one who should define the security model of the data.it's possible to perform client-side form validation, but the server can't trust this validation because it has no way to truly know what has really happened on the client-side. if you've worked your way through these tutorials in order, you now know how to markup and style a form, do client-side validation, and have some idea about submitting a form. ...
Front-end web developer - Learn web development
existing ones) as you go along. each section includes exercises and assessments to test your understanding before you move forward. subjects covered the subjects covered are: basic setup and learning how to learn web standards and best practices (such as accessibility and cross-browser compatibility) html, the language that gives web content structure and meaning css, the language used to style web pages javascript, the scripting language used to create dynamic functionality on the web tooling that is used to facilitate modern client-side web development. you can work through sections in order, but each one is also self-contained. for example, if you already know html, you can skip ahead to the css section. prerequisites you don't need any previous knowledge to start this course. ...
JavaScript basics - Learn web development
riven apps, and much more! javascript itself is relatively compact, yet very flexible. developers have written a variety of tools on top of the core javascript language, unlocking a vast amount of functionality with minimum effort. these include: browser application programming interfaces (apis) built into web browsers, providing functionality such as dynamically creating html and setting css styles; collecting and manipulating a video stream from a user's webcam, or generating 3d graphics and audio samples. third-party apis that allow developers to incorporate functionality in sites from other content providers, such as twitter or facebook. third-party frameworks and libraries that you can apply to html to accelerate the work of building sites and applications. it's outside the scope o...
What will your website look like? - Learn web development
title and a few paragraphs and think of an image you'd like to show on your page. what does your website look like, in simple high-level terms? what's the background color? what kind of font is appropriate: formal, cartoony, bold and loud, subtle? note: complex projects need detailed guidelines that go into all the details of colors, fonts, spacing between items on a page, appropriate writing style, and so on. this is sometimes called a design guide, design system, or brand book, and you can see an example at the firefox photon design system. sketching out your design next, grab pen and paper and sketch out roughly how you want your site to look. for your first simple webpage, there's not much to sketch out, but you should get in the habit of doing this now. it really helps — you don't...
Add a hitmap on top of an image - Learn web development
e maps, and their drawbacks when you nest an image inside <a>, the entire image links to one webpage. an image map, on the other hand, contains several active regions (called "hotspots") that each link to a different resource. formerly, image maps were a popular navigation device, but it’s important to thoroughly consider their performance and accessibility ramifications. text links (perhaps styled with css) are preferable to image maps for several reasons: text links are lightweight, maintainable, often more seo-friendly, and support accessibility needs (e.g., screen readers, text-only browsers, translation services). how to insert an image map, properly step 1: the image not just any image is acceptable. the image must make it clear what happens when people follow image links. alt ...
Using data attributes - Learn web development
etting article.dataset.columns = 5 would change that attribute to "5". css access note that, as data attributes are plain html attributes, you can even access them from css. for example to show the parent data on the article you can use generated content in css with the attr() function: article::before { content: attr(data-parent); } you can also use the attribute selectors in css to change styles according to the data: article[data-columns='3'] { width: 400px; } article[data-columns='4'] { width: 600px; } you can see all this working together in this jsbin example. data attributes can also be stored to contain information that is constantly changing, like scores in a game. using the css selectors and javascript access here this allows you to build some nifty effects without having...
Creating hyperlinks - Learn web development
irefox.com/"> click here </a> to download firefox</p> other tips: don't repeat the url as part of the link text — urls look ugly, and sound even uglier when a screen reader reads them out letter by letter. don't say "link" or "links to" in the link text — it's just noise. screen readers tell people there's a link. visual users will also know there's a link, because links are generally styled in a different color and underlined (this convention generally shouldn't be broken, as users are used to it). keep your link label as short as possible — this is helpful because screen readers need to interpret the entire link text. minimize instances where multiple copies of the same text are linked to different places. this can cause problems for screen reader users, if there's a list of l...
Marking up a letter - Learn web development
g this assessment you should have already worked through getting started with html, what's in the head? metadata in html, html text fundamentals, creating hyperlinks, and advanced text formatting. objective: test basic and advanced html text formatting, use of hyperlinks, and use of html <head>. starting point to begin, get the raw text you need to mark up, and the the css to style the html. create a new .html file using your text editor or use an online tool such as codepen, jsfiddle, or glitch to complete the tasks. note: if you get stuck, then ask us for help. see the assessment or further help section at the bottom of this page. project brief for this project, your task is to mark up a letter that needs to be hosted on a university intranet. the letter is a respons...
Structuring a page of content - Learn web development
, with a particular emphasis on document and website structure. objective: to test knowledge of web page structures, and how to represent a prospective layout design in markup. starting point to get this assessment started, you should go and grab the zip file containing all the starting assets. the zip file contains: the html you need to add structural markup to. css to style your markup. images that are used on the page. create the example on your local computer, or alternatively use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. note: if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. project brief for this project, your task is to take the content for the homepage of a...
Introduction to HTML - Learn web development
ge is structured and how an html element is structured, and explain other important basic language features. along the way, we'll play with some html to get you interested! what’s in the head? metadata in html the head of an html document is the part that is not displayed in the web browser when the page is loaded. it contains information such as the page <title>, links to css (if you want to style your html content with css), links to custom favicons, and metadata (data about the html, such as who wrote it, and important keywords that describe the document). html text fundamentals one of html's main jobs is to give text meaning (also known as semantics), so that the browser knows how to display it correctly. this article looks at how to use html to break up a block of text into a structu...
Mozilla splash page - Learn web development
ow, as you'll need to manipulate (some of) them using a graphics editor before they're ready to be used. alternatively, you could use an online tool such as glitch to create your example. this would also be useful if you want to get it assessed, or ask for help — see the assessment or further help section at the bottom of this page. note: the example html file contains quite a lot of css, to style the page. you don't need to touch the css, just the html inside the <body> element — as long as you insert the correct markup, the styling will make it look correct. project brief in this assessment we are presenting you with a mostly-finished mozilla splash page, which aims to say something nice and interesting about what mozilla stands for, and provide some links to further resources. unfo...
Assessment: Structuring planet data - Learn web development
if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. note: alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html, css and javascript into one of these online editors. if the online editor you are using doesn't have separate javascript/css panels, feel free to put them inline <script>/<style> elements inside the html page. project brief you are working at a school; currently your students are studying the planets of our solar system, and you want to provide them with an easy-to-follow set of data to look up facts and figures about the planets. an html data table would be ideal — you need to take the raw data you have available and turn it into a table, following the steps below.
Structuring the web with HTML - Learn web development
module. it is recommended that you work through getting started with the web before attempting this topic, however, it isn't absolutely necessary; much of what is covered in the html basics article is also covered in our introduction to html module, albeit in a lot more detail. ...
General asynchronous programming concepts - Learn web development
ic that you might come across on a real page. we block user interactivity with the rendering of the ui. in this example, we have two buttons: a "fill canvas" button that when clicked fills the available <canvas> with 1 million blue circles. a "click me for alert" button that when clicked shows an alert message. ...
Functions — reusable blocks of code - Learn web development
inside the browser. anytime you saw a custom name with parentheses straight after it, you were using a custom function. in our random-canvas-circles.html example (see also the full source code) from our loops article, we included a custom draw() function that looked like this: function draw() { ctx.clearrect(0,0,width,height); for (let i = 0; i < 100; i++) { ctx.beginpath(); ctx.fillstyle = 'rgba(255,0,0,0.5)'; ctx.arc(random(width), random(height), random(50), 0, 2 * math.pi); ctx.fill(); } } this function draws 100 random circles inside a <canvas> element. every time we want to do that, we can just invoke the function with this: draw(); rather than having to write all that code out again every time we want to repeat it. and functions can contain whatever code you li...
Function return values - Learn web development
on. using return values in your own functions to return a value from a custom function, you need to use the return keyword. we saw this in action recently in our random-canvas-circles.html example. our draw() function draws 100 random circles somewhere on an html <canvas>: function draw() { ctx.clearrect(0, 0, width, height); for (let i = 0; i < 100; i++) { ctx.beginpath(); ctx.fillstyle = 'rgba(255,0,0,0.5)'; ctx.arc(random(width), random(height), random(50), 0, 2 * math.pi); ctx.fill(); } } inside each loop iteration, three calls are made to the random() function, to generate a random value for the current circle's x-coordinate, y-coordinate, and radius, respectively. the random() function takes one parameter — a whole number — and it returns a whole random numbe...
Fetching data from the server - Learn web development
so this works out pretty simple. it is also worth noting that you can directly chain multiple promise blocks (.then() blocks, but there are other types too) onto the end of one another, passing the result of each block to the next block as you travel down the chain. this makes promises very powerful. the following block does the same thing as our original example, but is written in a different style: fetch(url).then(function(response) { return response.text() }).then(function(text) { poemdisplay.textcontent = text; }); many developers like this style better, as it is flatter and arguably easier to read for longer promise chains — each subsequent promise comes after the previous one, rather than being inside the previous one (which can get unwieldy). the only other difference is that ...
Handling text — strings in JavaScript - Learn web development
e basics of strings in javascript. the power of words words are very important to humans — they are a large part of how we communicate. since the web is a largely text-based medium designed to allow humans to communicate and share information, it is useful for us to have control over the words that appear on it. html provides structure and meaning to our text, css allows us to precisely style it, and javascript contains a number of features for manipulating strings, creating custom welcome messages and prompts, showing the right text labels when needed, sorting terms into the desired order, and much more. pretty much all of the programs we've shown you so far in the course have involved some string manipulation. strings — the basics strings are dealt with similarly to numbers at ...
Solve common problems in your JavaScript code - Learn web development
re: correct wrong getelementsbytagname() getelementbytagname() getelementsbyname() getelementbyname() getelementsbyclassname() getelementbyclassname() getelementbyid() getelementsbyid() semi-colon position you need to make sure you don't place any semi-colons incorrectly. for example: correct wrong elem.style.color = 'red'; elem.style.color = 'red;' functions there are a number of things that can go wrong with functions. one of the most common errors is to declare the function, but not call it anywhere. for example: function myfunction() { alert('this is my function.'); }; this code won't do anything unless you call it with the following statement: myfunction(); function scope remem...
Inheritance in JavaScript - Learn web development
heritance to classes, to show you how it's done. note: this modern way of writing classes is supported in all modern browsers, but it is still worth knowing about the underlying prototypal inheritance in case you work on a project that requires supporting a browser that doesn't support this syntax (most notably internet explorer). let's look at a rewritten version of the person example, class-style: class person { constructor(first, last, age, gender, interests) { this.name = { first, last }; this.age = age; this.gender = gender; this.interests = interests; } greeting() { console.log(`hi! i'm ${this.name.first}`); }; farewell() { console.log(`${this.name.first} has left the building. bye for now!`); }; } the class statement indicates ...
Working with JSON - Learn web development
ingle string or number would be a valid json object. unlike in javascript code in which object properties may be unquoted, in json only quoted strings may be used as properties. active learning: working through a json example so, let's work through an example to show how we could make use of some json data on a website. getting started to begin with, make local copies of our heroes.html and style.css files. the latter contains some simple css to style our page, while the former contains some very simple body html: <header> </header> <section> </section> plus a <script> element to contain the javascript code we will be writing in this exercise. at the moment it only contains two lines, which grab references to the <header> and <section> elements and store them in variables: const heade...
Test your skills: Object basics - Learn web development
an object containing the following members: name: a string representing the name of the album. released: a number representing the year the album was released. include at least two albums in the albums array. once you've done this, you should then write a string to the variable bandinfo, which will contain a small biography detailing their name, nationality, years active, and style, and the title and release date of their first album. try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. object basics 3 finally for our object basics assessment, we want you to return to the cat object literal from task #1. we want you to rewrite the greeting() method so that it l...
Client-Server Overview - Learn web development
turn other types of files (text, pdf, csv, etc.) or even data (json, xml, etc.). the idea of returning data to a web browser so that it can dynamically update its own content (ajax) has been around for quite a while. more recently "single-page apps" have become popular, where the whole website is written with a single html file that is dynamically updated when needed. websites created using this style of application push a lot of computational cost from the server to the web browser, and can result in websites that appear to behave a lot more like native apps (highly responsive, etc.). web frameworks simplify server-side web programming server-side web frameworks make writing code to handle the operations described above much easier. one of the most important operations they perform is prov...
Routing in Ember - Learn web development
updating the todos display inside todolist one small final thing that we need to fix is that previously, inside todomvc/app/components/todo-list.hbs, we were accessing the todo-data service directly and looping over all todos, as shown here: {{#each this.todos.all as |todo| }} since we now want to have our todolist component show a filtered list, we'll want...
Ember app structure and componentization - Learn web development
a deeper understanding of modern javascript features (such as classes, modules, etc), will be extremely beneficial, as ember makes heavy use of them. objective: to learn how to structure an ember app, and then break that structure into components. planning out the layout of the todomvc app in the last article we set up a new ember project, then added and configured our css styles. at this point we add some html, planning out the structure and semantics of our todomvc app. the landing page html of our application is defined in app/templates/application.hbs. this already exists, and its contents currently look like so: {{!-- the following component displays ember's default welcome message. --}} <welcomepage /> {{!-- feel free to remove this! --}} {{outlet}} <welcomepa...
Introduction to client-side frameworks - Learn web development
none of this code actually handles user interactions, or addresses adding or deleting a task. if we add those features, we have to remember to upd...
Framework main features - Learn web development
turn ( <button onclick={() => setcount(count + 1)}>clicked {count} times</button> ); } in this version we are using additional usestate() functionality to create a special setcount() function, which we can invoke to update the value of count. we call this function on line 4, and set count to whatever its current value is, plus one. styling components each framework offers a way to define styles for your components — or for the application as a whole. although each framework’s approach to defining the styles of a component is slightly different, all of them give you multiple ways to do so. with the addition of some helper modules, you can style your framework apps in sass or less, or transpile your css stylesheets with postcss. handling dependencies all major frameworks provide me...
Getting started with React - Learn web development
p />, document.getelementbyid('root')); // if you want your app to work offline and load faster, you can change // unregister() to register() below. note this comes with some pitfalls. // learn more about service workers: https://bit.ly/cra-pwa serviceworker.unregister(); as with app.js, the file starts by importing all the js modules and other assets it needs to run. src/index.css holds global styles that are applied to our whole app. we can also see our app component imported here; it is made available for import thanks to the export statement at the bottom of app.js. line 7 calls react’s reactdom.render() function with two arguments: the component we want to render, <app /> in this case. the dom element inside which we want the component to be rendered, in this case the element with...
Componentizing our Svelte app - Learn web development
— the below line is all you need: <filterbutton {filter} /> note: remember that when the html attribute name and variable matches, they can be replaced with {variable}, that's why we could replace <filterbutton filter={filter} /> with <filterbutton {filter} />. so far so good! let's try out the app now. you'll notice that when you click on the filter buttons, they are selected and the style updates appropriately. but! we have a problem — the todos aren't filtered. that's because the filter variable flows down from the todos component to the filterbutton component through the prop, but changes occurring in the filterbutton component don't flow back up to its parent — the data binding is one-way by default. let's look at a way to solve this. sharing data between components: passi...
Deployment and next steps - Learn web development
directory (like https://your-user.gitlab.io/mdn-svelte-todo), we'll have to make the references to the javascript and css files in our public/index.html file relative. to do this, we just remove the leading slashes (/) from the /global.css, /build/bundle.css, and /build/bundle.js urls, like this: <title>svelte to-do list</title> <link rel='icon' type='image/png' href='favicon.png'> <link rel='stylesheet' href='global.css'> <link rel='stylesheet' href='build/bundle.css'> <script defer src='build/bundle.js'></script> do this now. now we just have to commit and push our changes to gitlab. do this by running the following commands: > git add public/index.html > git add .gitlab-ci.yml > git commit -m "added .gitlab-ci.yml file and fixed index.html absolute paths" > git push counting...
Adding a new todo form: Vue events, methods, and models - Learn web development
ded', this.label); this.label = ""; } now when you click the "add" button, the "new-todo-input" will clear itself. summary excellent. we can now add todo items to our form! our app is now starting to feel interactive, but one issue is that we've completely ignored its look and feel up to now. in the next article, we'll concentrate on fixing this, looking at the different ways vue provides to style components. previous overview: client-side javascript frameworks next in this module introduction to client-side frameworks framework main features react getting started with react beginning our react todo list componentizing our react app react interactivity: events and state react interactivity: editing, filtering, conditional rendering accessibility in react...
Understanding client-side JavaScript frameworks - Learn web development
he structure of the project, and see how to run it locally and build it for production. 2. starting our svelte todo list app now that we have a basic understanding of how things work in svelte, we can start building our example app: a todo list. in this article we will first have a look at the desired functionality of our app, then we'll create a todos.svelte component and put static markup and styles in place, leaving everything ready to start developing our to-do list app features, which we'll go on to in subsequent articles. 3. dynamic behavior in svelte: working with variables and props now that we have our markup and styles ready we can start developing the required features for our svelte to-do list app. in this article we'll be using variables and props to make our app dynamic, allow...
Strategies for carrying out testing - Learn web development
our users might use to view your site — there are just too many, and new ones appear all the time. instead, you should try to make sure your site works on the most important target browsers and devices, and then code defensively to give your site the widest support reach it can be expected to have. by coding defensively, we mean trying to build in intelligent fallbacks so that if a feature or style doesn't work in a browser, the site will be able to downgrade to something less exciting that still provides an acceptable user experience — the core information is still accessible, for example, even if it doesn't look quite as nice. the aim is to build up a chart of browsers/devices you can refer to as you test. you can make this as simple or as complex as you like — for example a common a...
Learn web development
cover in the mdn learning area. getting started with the web provides a practical introduction to web development for complete beginners. html — structuring the web html is the language that we use to structure the different parts of our content and define what their meaning or purpose is. this topic teaches html in detail. css — styling the web css is the language that we can use to style and layout our web content, as well as adding behavior like animation. this topic provides comprehensive coverage of css. javascript — dynamic client-side scripting javascript is the scripting language used to add dynamic functionality to web pages. this topic teaches all the essentials needed to become comfortable with writing and understanding javascript. web forms — working with user da...
Accessibility API cross-reference
fieldset>, <div> a heading for a section of the page. in aria, the heading level is expressed with the aria-level attribute. heading <h1> ... <h6> <h1> ... <h6>. <h> is also available but its use is not recommended because of lack of suitable tools - and the heading level is undefined click on this thing and then click on the item for tooltip style help helpballoon n/a n/a n/a editable field that allows user to assign a key combination hotkeyfield n/a n/a n/a graphic that indicates something, such as an arrow indicator n/a n/a n/a abstract role - a generic type of widget that allows user input. input n/a ...
Accessibility Information for Core Gecko Developers
html accessibility dynamic web content is not accessible because it uses vanilla <div>s and <span>s combined with javascript rather than declarative markup to describe the behavior of custom widgets such as menus and tree views. these widgets are often not even keyboard focusable, and assistive technologies do not understand these widgets. this document shows several interactive desktop-style widgets that are accessible by keyboards and assistive technologies, and outlines a plan being developed by ibm, mozilla, and the wai protocols and formats working group (pfwg) to address the issue of dhtml accessibility. mozilla accessibility architecture this document explains how we implement the cross-platform accessibility layer in mozilla. it contains a class hierararchy and an explana...
CSUN Firefox Materials
amples of accessible extensions, although there are hundreds more to try (thank you to the gw micro knowledge base for some of this information): adblock plus removes ads (and other objects, like banners) from web pages greasemonkey lets you add bits of javascript ("user scripts") to any web page to change its behavior. in much the same way that user css lets you take control of a web page's style, user scripts let you easily control any aspect of a web page's design or interaction. we expect enterprising script writers will eventually fix annoying accessibility issues in popular web pages, and (hopefully) share their tricks with everyone! ie tab allows you to embed internet explorer into firefox tabs. this extension is useful for making ie specific sites, or site that read better in ie,...
Mozilla's Section 508 Compliance
contain options for making animated images still. (i) color coding shall not be used as the only means of conveying information, indicating an action, prompting a response, or distinguishing a visual element. complete. caveat: normally mozilla uses a color change to indicate when a link has been visited. however, the visited link appearance can be altered via a user style sheet. (j) when a product permits a user to adjust color and contrast settings, a variety of color selections capable of producing a range of contrast levels shall be provided. complete. mozilla's appearance preferences panel contains a large number of color possibilities. (k) software shall not use flashing or blinking text, objects, or other e...
Frequently Asked Questions for Lightweight themes
what kind of computers and operating systems do lightweight themes work with? lightweight themes work with any type of computer that has firefox installed. ...
A bird's-eye view of the Mozilla framework
ace (gui) control. the various x toolkit implementations provide a set of widgets for ui controls such as menus, command buttons, dialog boxes and scroll bars. the mozilla xptoolkit module provides a similar set of facilities for building cross-platform ui controls implemented as xml user interface language (xul) packages. a xul package consists of a xul description of the ui widget cascading style sheets customizing appearance javascript services implementing the ui behavior a package (also known as chrome) is really just a bundling of a set of ui widgets and associated services implementing a particular application feature. chrome and extensions are examples of packages. content (dom) the mozilla document object model (dom) specifies a logical tree structure for storing ui and docume...
Browser chrome tests
support-files, and additionally, ensure that your browser.ini is referenced by a moz.build file somewhere, such as: browser_chrome_manifests += [ 'test/functional/mochitest/browser.ini' ] support-files once added to support-file section of browser.ini support files may be referenced as https://example.com/browser/[path_to_file] or chrome://mochitests/content/browser/[path_to_file]. <tmui style="top:1px; right:1px;"></tmui> ...
Debugging Frame Reflow
c,uc cnt=885 text 02d7c130 d=0,0 block 02d7b210 d=8940,390 area 02d7afe4 d=9180,630 canvas 00b97c6c d=9180,4470 scroll 00b97ee0 d=9180,4470 scroll 00b97ee0 d=9180,4470 vp 00b97c30 d=9180,4470 the first line shows the reflow of the viewport (vp). this viewport has the address 00b97c30. it is the initial reflow: r=0. other reflow reasons are: incremental reflow resize reflow style change reflow dirty reflow the available width is 9180 twips. the available height is 4470 twips (a=9180,4470). the computed width is 9180 twips. the computed height is 4470 twips (c=9180,4470). the line count is 856 (cnt=856). below this is a line that reads: tblo 02d7b5f0 r=0 a=8940,uc c=0,0 cnt=870 here the uc shows that on initial reflow the available height for the outer table frame is un...
HTTP logging
.app/contents/macos ./firefox-bin (the instructions assume that you've installed firefox directly into your startup disk's applications folder. if you've put it elsewhere, change the path used on the third line appropriately.) reproduce whatever problem you're trying to debug. quit firefox and look for the generated log.txt log files on your desktop. note: the generated log file uses unix-style line endings. older editors may have problems with this, but if you're using an even reasonably modern mac os x application to view the log, you won't have any problems. start logging using command line arguments since firefox 61 it's possible to start logging in a bit simpler way than setting environment variables: using command line arguments. here is an example for the windows platform, on...
How Mozilla's build system works
e_name = nslayoutmodule cppsrcs = \ nslayoutmodule.cpp \ $(null) shared_library_libs = \ $(dist)/lib/$(lib_prefix)gkhtmlbase_s.$(lib_suffix) \ $(dist)/lib/$(lib_prefix)gkhtmldoc_s.$(lib_suffix) \ $(dist)/lib/$(lib_prefix)gkhtmlforms_s.$(lib_suffix) \ $(dist)/lib/$(lib_prefix)gkhtmlstyle_s.$(lib_suffix) \ $(dist)/lib/$(lib_prefix)gkhtmltable_s.$(lib_suffix) \ $(dist)/lib/$(lib_prefix)gkxulbase_s.$(lib_suffix) \ $(dist)/lib/$(lib_prefix)gkbase_s.$(lib_suffix) \ $(dist)/lib/$(lib_prefix)gkconshared_s.$(lib_suffix) \ $(dist)/lib/$(lib_prefix)gkxultree_s.$(lib_suffix) \ $(dist)/lib/$...
Installing headers using EXPORTS
lib file is produced from the idl files. ...
ESLint
during code reviews, a set of eslint configuration files have been added to the code base so that javascript can be analyzed automatically. this automatic linting can happen either while coding, in a code editor, or when using the command line. it also runs on treeherder for every check-in. running eslint eslint comprises of a set of rules that are used to analyse the code for correctness and style consistency. meeting these rules before review will help reduce the amount of review time, and the revisions necessary to have a review granted. setting up eslint ./mach eslint --setup running eslint eslint can be run via: ./mach lint -l eslint you can limit running it to a specific directory with: ./mach lint -l eslint browser/components or work directory changes: ./mach lint -l eslint ...
Eclipse CDT Manual Setup
prevent eclipse giving you annoying "resource is out of sync" messages when files change from under it due to mercurial or other external activity. select "c/c++ > build > console" and set "limit console output (number of lines)" to something large, like "1000000". eclipse cdt will try to format c/c++ code that you add as you type. however, its default formats are not a good match to mozilla's style rules. download this first pass at an eclipse formatter configuration for mozilla c/c++ coding style, and install it by opening the workspace preferences, selecting "c/c++ > code style > formatter", and then using the "import" button to import that file. the "active profile" field should then automatically change to "mozilla". depending on the area of the code that you work on, you may need to tw...
Reviewer Checklist
ost functionality. it's quicker. make sure the patch doesn't create any unused code (e.g., remove strings when removing a feature) all caught exceptions should be logged at the appropriate level, bearing in mind personally identifiable information, but also considering the expense of computing and recording log output. [fennec: checking for log levels is expensive unless you're using logger.] style follow the style guide for the language and module in question. follow local style for the surrounding code, even if that local style isn't formally documented. new files have license declarations and modelines. new js files should use strict mode. trailing whitespace (git diff and splinter view both highlight this, as does hg with the color extension enabled). whitespace can be fixed easi...
Developer guide
hat you'll find useful to refer to even if you are already an experienced contributor. documentation topics getting started a step-by-step beginner's guide to getting involved with mozilla. for new mozilla developers a directory of articles which are particularly helpful for new mozilla developers. working with mozilla source code a code overview, how to get the code, and the coding style guide. build instructions how to build firefox, thunderbird, seamonkey, or other mozilla applications. development process overview an overview of the entire mozilla development process. managing multiple profiles when working with prerelease versions of firefox, it's often helpful to have multiple firefox profiles, such as one for each channel, or for different kinds of testing. getting d...
Error codes returned by Mozilla APIs
leted while the object is busy. implementations of nsichannel.asyncopen() will commonly return this error if the channel has already been opened (and has not yet been closed). ns_error_offline (0x804b0010) ns_error_no_content (0x804b0011) returned from nsichannel.asyncopen() to indicate that ondataavailable will not be called because there is no content available. this is used by helper app style protocols (for example, mailto). ns_error_unknown_protocol (0x804b0012) the uri scheme corresponds to an unknown protocol handler. ns_error_port_access_not_allowed (0x804b0013) ns_error_net_reset (0x804b0014) ns_error_ftp_login (0x804b0015) ns_error_ftp_cwd (0x804b0016) ns_error_ftp_pasv (0x804b0017) ns_error_ftp_pwd (0x804b0018) ns_error_not_resumable (0x804b0019) ...
Security best practices for Firefox front-end engineers
ode for firefox. existing security controls sanitizing all strings that enter the dom through apis such as innerhtml when running system-privileged chrome code, we sanitize all html fragments that are created for chrome-privileged documents. this policy includes all dom apis that take a string and parse it into a dom tree. we use our built-in sanitizer with the following flags: sanitizerallowstyle sanitizerallowcomments sanitizerdropforms sanitizerlogremovals the sanitizer removes all scripts (script tags, event handlers) and form elements (form, input, keygen, option, optgroup, select, button, datalist). the canonical truth for the list of whitelisted elements is the source code. the last flag ensures that developers will identify and avoid the problems early on in the development cycle...
mozbrowserloadend
te that has just loaded, to provide a more integrated experience. when the front page of https://developer.mozilla.org is loaded, for example, the e.detail.backgroundcolor value reported is rgb(0, 83, 159). ...
::-moz-tree-cell-text
activated by the properties attribute. ...
::-moz-tree-cell
activated by the properties attribute. ...
::-moz-tree-drop-feedback
activated by the properties attribute. ...
::-moz-tree-indentation
activated by the properties attribute. ...
::-moz-tree-line
activated by the properties attribute. ...
::-moz-tree-progressmeter
activated when the type attribute is set to progressmeter. associated elements <xul:treecell> style properties margin color ...
::-moz-tree-row
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the ::-moz-tree-row css pseudo-element is used to select rows and apply styles to tree rows. associated elements treerow syntax treechildren::-moz-tree-row { style properties } style properties background border margin outline padding display -moz-appearance examples treechildren::-moz-tree-row( foo bar ) { margin: 2%; } ...where... <treerow properties="foo">...</treerow> ...
::-moz-tree-separator
activated by the properties attribute. ...
overflow-clip-box-block
d values */ overflow-clip-box-block: padding-box; overflow-clip-box-block: content-box; /* global values */ overflow-clip-box-block: inherited; overflow-clip-box-block: initial; overflow-clip-box-block: unset; note: on gecko, by default, padding-box is used everywhere, but <input type="text"> and similar use the value content-box. note that this property is activated by default only in the ua stylesheet and chrome contexts. value not found in db! syntax values padding-box this keyword makes the clipping be related to the padding box. content-box this keyword makes the clipping be related to the content box. formal syntax syntax not found in db! examples padding-box html <div class="things"> <input value="abcdefghijklmnopqrstuvwxyzÅÄÖ" class="scroll padding-box"> <div...
overflow-clip-box-inline
ues */ overflow-clip-box-inline: padding-box; overflow-clip-box-inline: content-box; /* global values */ overflow-clip-box-inline: inherited; overflow-clip-box-inline: initial; overflow-clip-box-inline: unset; note: on gecko, by default, padding-box is used everywhere, but <input type="text"> and similar use the value content-box. note that this property is activated by default only in the ua stylesheet and chrome contexts. value not found in db! syntax values padding-box this keyword makes the clipping be related to the padding box. content-box this keyword makes the clipping be related to the content box. formal syntax syntax not found in db! examples padding-box html <div class="things"> <input value="abcdefghijklmnopqrstuvwxyzÅÄÖ" class="scroll padding-box"> <div...
overflow-clip-box
bal values */ overflow-clip-box: inherit; overflow-clip-box: initial; overflow-clip-box: unset; note: on gecko, by default, padding-box is used everywhere, but <input type="text"> and similar use the value content-box. prior to firefox 29, this behavior was hardcoded; since then it uses this property that can be used elsewhere too. note that this property is activated by default only in the ua stylesheet and chrome contexts. initial valuepadding-boxapplies toall elementsinheritednomediavisualcomputed valueas specifiedanimation typediscretecanonical orderthe unique non-ambiguous order defined by the formal grammar syntax values padding-box this keyword makes the clipping be related to the padding box. content-box this keyword makes the clipping be related to the content box. forma...
Gecko Chrome
this page contains information specific to chrome code running in gecko. chrome-only api referencethis page lists apis that only run in gecko chrome code (and sometimes in other privileged circumstances.)chrome-only css referencethis page lists css properties that are only available in gecko chrome code (and sometimes in other privileged circumstances, eg. ua stylesheets.) chrome-only events referencethis page lists events that are only available in gecko chrome code (and sometimes in other privileged circumstances, eg. ua widgets). ...
Embedding the editor
og js files assume that they can get at the one true editor via window.editorshell. this assumption was short-sighted, and must be fixed. editor assumes xul document structure there is c++ and js code in the editor that assumes that the editor is living in a xul document, and that there are xul document nodes out there whose attributes can be tweaked to change the state of the ui (e.g. the inline style buttons). this needs to be changed to allow embedders to provide their own, possibly native ui. editor needs to call through one or more interfaces when communicating with the ui. embedding objectives editor requires design changes such that the embedding applications above can be fulfilled, and these changes will need to address the current problems. briefly, the embedding objectives are: <ed...
Embedding Tips
d to step through the pages. when finished with preview mode, call nsiwebbrowserprint::exitprintpreview(). how do i get popup windows working? implement and register a nsiwindowcreator object with the window watcher service. the nsiwindowcreator::createchromewindow method will be called whenever gecko needs to open a new window. this method should create the new browser window in the specified style and hand back the nsiwebbrowserchrome interface to it. nscomptr<nsiwindowwatcher> wwatch(do_getservice(ns_windowwatcher_contractid)); if (wwatch) { wwatch->setwindowcreator(mywindowcreator); } i need the javascript inside the browser window to talk to my embedding client. how do i do it? at startup use the category manager to register properties of the global object in javascript like this:...
Roll your own browser: An embedding how-to
mplete control of the menus and "hotkeys". implemented with mozilla embedding apis. (screenshots) neoplanet browser: a gecko add-on for the neoplanet browser. activestate's komodo: development environment, based on mozilla's xul. (screenshot) macromedia homesite html editor: internal browser for the homesite studio application is implemented by embedding mozilla. (mozilla blurb) bradsoft's topstyle css builder: implements an internal browser using mozilla activex embedding control.obsolete since gecko 7.0 nxzilla: a set of libraries that allow mozilla to be used with a nanox server. activex control: an activex control allowing for embedding the gecko layout engine.obsolete since gecko 7.0 llmozlib & ubrowser: a static library that allows you to embed gecko and render pages to memory. inc...
Getting Started with Chat
if this happens, you can type this command to resolve this issue. /server server-name manually connect to a server /topic topic changes the topic of the channel. the topic is a message that displays first when you join a channel. /whois nickname display inf...
How Mozilla determines MIME Types
introduction all data handling in mozilla is based on the mime type of the content. this means that every time an uri is loaded, mozilla must find out its mime type. the several ways how this happens are described in this document. content-type "hints" mozilla has a concept of "content-type hints". this means that, for example, if mozilla encounters a <link type="text/css" rel="stylesheet" href="..."> element, a type of text/css will be assumed. this is, however, overridden by the actual mime type the server sends (if any). (for this specific example, the server override only happens in standards-compliant mode. see mozilla's quirks mode or web author faq). similar handling happens for <a href="..." type="foo/bar">, starting in mozilla 1.6alpha. http for http uris mozilla usually ...
Extending a Protocol
the tutorial is designed for beginners and will walk you through all the steps you need to get things working. the tutorial is designed for browser engineers who are implementing dom/web apis that need to, for example, send a message to the os or spin up something off the main thread - so it's biased towards supporting w3c/whatwg dom apis. what are we going to implement? tl:dr: you can see the final implementation of pecho.ipdl as a diff in phabricator. ...
IPDL Tutorial
ue itself (as a const reference); if the message returns multiple values (e.g. initasync above), the parameter is, for both resolve and success callbacks, a tuple of the return values (e.g. tuple<bool, bool>). on the other hand the reject/failure callbacks take a mozilla::ipc::responserejectreason&& and are called in case of a fatal error, such as an ipc error. therefore, besides callback/promise style response handling, these two overloads are functionally equivalent. the generated c++ will result in something containing: class pplugininstanceparent { public: typedef mozpromise<tuple<bool, bool> responserejectreason, true> asyncinitpromise; typedef mozpromise<bool, responserejectreason, true> otherfunctionpromise; void sendasyncinit(mozilla::ipc::resolvecallback<tuple<bool, bool>>&...
Addon
ext application restart. this method must be defined if an add-on has the permission perm_can_uninstall. void uninstall( ) canceluninstall() cancels uninstalling an add-on if it is pending uninstall. this method must be defined if an add-on has the pendingoperation pending_uninstall. void canceluninstall( ) hasresource() checks whether a file resource is available for this add-on. for xpi style add-ons, for example, it tests whether the named file was included in the package. boolean hasresource( in string path ) parameters path a "/" separated path for the resource. getresourceuri() gets an nsiuri to the file resource for this add-on. nsiuri getresourceuri( in string path ) parameters path a "/" separated path for the resource. getdatadirectory() requires ...
Log.jsm
this module is still under development. until stabilized, expect frequent updates, including different interfaces and behavior in different versions of the platform. progress is tracked in bugzilla using dependencies of bug 451283. the log.jsm javascript code module (formerly named log4moz.js) provides a log4j style api for logging log messages to various endpoints, such as the browser console or a file on disk. to use it, you first need to import the code module into your javascript scope: components.utils.import("resource://gre/modules/log.jsm"); basic usage components.utils.import("resource://gre/modules/log.jsm"); // get a logger, give it a name unique to this chunk of code. // use dots to create a hierarchy, this way you can later change // the log level of sets of loggers unde...
PopupNotifications.jsm
een dismissed (i.e. any time the popup is closed due to user interaction). removeondismissal notifications with this parameter set to true will be removed when they would have otherwise been dismissed (that is, any time the popup is closed due to user interaction). popupiconurl a string specifying the url of the image to be displayed in the popup. this is normally specified in css using list-style-image and the .popup-notification-icon[popupid=...] selector. learnmoreurl a string url. setting this property will make the prompt display a "learn more" link that, when clicked, opens the url in a new tab. notification events if you specify an event callback using the options parameter when calling show(), the callback function gets invoked when the state of the notification changes. the f...
source-editor.jsm
absize" an integer value that specifies the number of spaces per tab. editor mode constants these constants are used to set the syntax highlighting mode for the editor by calling its setmode() method, or in the configuration object when first initializing the editor using its init() method. constant value description sourceeditor.modes.css "css" cascading style sheet. sourceeditor.modes.html "html" html document. sourceeditor.modes.javascript "js" javascript source code. sourceeditor.modes.text "text" utf-8 text document. sourceeditor.modes.xml "xml" xml document. theme constants these constants are used to identify the available themes that can be used by the syntax highlighter. only o...
Translation phase
e are the mozilla application projects that are localized using the l10n tools above: firefox the award-winning firefox® web browser has security, speed and new features that will change the way you use the web. see the list of the most critical strings for localizing in firefox, as well as a guide to understanding how they're organized. thunderbird enjoy safe, fast and easy email, mozilla-style. the thunderbird® email client includes intelligent spam filters, powerful search and customizable views. seamonkey seamonkey® is the all-in-one application formerly known as the "mozilla application suite", containing a web browser, a mail and newsgroups client, an html editor, web development tools, and an irc chat client. firefox mobile by adding firefox® to your mobile phone, you can a...
Localization formats
g started</h1> and the localizer translates to <h1>débuter avec firefox</h1> the localizer then submits the translated html or php back to us by either checking in changes to svn or sending us a patch that pascal checks in. advantages to html good for small projects very simple for web developers gives localizers the exact context of translations a localizer who knows basic html can style translations to make sure translations display correctly...we can allow slight modifications (e.g. rtl or wider display) gives the possibility to customize content per locale simple workflow, just put the file on svn and it can appear on the staging server disadvantages to html very hard for qa if localizer changes something incorrectly (i.e. accidentally removes some html like </h1>...
Mozilla Framework Based on Templates (MFBT)
macros to annotate conditions with their expected truthiness. util.h implements various other bits of useful functionality. (this header will likely be further split up so that its functionality is less grab-bag.) debugging assertions.h provides assertion macros in implementing runtime assertions and compile-time assertions. guardobjects.h provides macros which can be used to annotate an raii-style guard class, so that any attempt to create an unnamed temporary for it will assert. (an unnamed temporary lives for a shorter period of time than the scope where it's found, so it usually isn't what was desired.) data structures linkedlist.h implements a type-safe doubly-linked list class. most new code should use this rather than prclist. rangedptr.h implements rangedptr, a smart pointer temp...
Fonts for Mozilla 2.0's MathML engine
and extract for example with the following command: wget https://addons.mozilla.org/firefox/downloads/latest/367848/addon-367848-latest.xpi -o mathml-fonts.zip; \ unzip mathml-fonts.zip -d mathml-fonts then copy the mathml-fonts/resource/ directory somewhere on your web site and ensure that the woff files are served with the correct mime type. finally, include the mathml-fonts/resource/mathml.css style sheet in your web pages, for example by adding the following rule to the default style sheet of your web site: @import url('/path/to/resource/mathml.css'); browsers have default font-families in their user agent stylesheets. if necessary, you might want to modify the font-family on the <math> elements and, for gecko, the on ::-moz-math-stretchy pseudo element too. for example to force the use of ...
Updates
w to the apc magazine where mitchell baker mentions roger sidje's work on mathml. june 5, 2002 mozilla 1.0 released "by virtue of embedding gecko, mozilla 1.0 and products based on mozilla code support more web standards, more deeply, more consistently across more platforms than any others. mozilla 1.0 features full support for html 4.0, xml 1.0, resource description framework (rdf), cascading style sheets level 1 (css1), and the w3c document object model level 1 (dom1) [...] as well as support for display of mathematical equations using mathml." december 7, 2001 status report october 2000 the first international mathml conference april 14, 2000 status report february 12, 2000 mathml-enabled m13 builds for win32 september 21, 1999 mathml has landed. september 18, 1999 status rep...
MathML Accessibility in Mozilla
cript z. subscript c. superscript d. torture test 28: y 3 ‴ __________ y with subscript 3 and with superscript triple prime end sub-superscript __________ y, subscript 3, superscript ‴ y. subscript 3. superscript triple prime. y base 3 subscript ‴ superscript scripted d t = φ = 1 + 5 2 , {\displaystyle {\frac {d}{t}}=\varphi ={\frac {1+{\sqrt {5}}}{2}}\ ,} d = t × φ = r 5 + 5 2 = 2 r cos ⁡ 18 ∘ = 2 r cos ⁡ π 10 ≈ 1.90211303259 r . ...
MathML Demo: <mspace> - space
:downheight();" title="decrease height">-</a> width <a class="control" href="javascript:upwidth();" title="increase width">+</a>/ <a class="control" href="javascript:downwidth();" title="decrease width">-</a> depth <a class="control" href="javascript:updepth();" title="increase depth">+</a>/ <a class="control" href="javascript:downdepth();" title="decrease depth">-</a> <math display="block"> <mstyle displaystyle="true"> <msqrt> <mrow> <mn>3</mn> <mspace style="background-color: yellow" id="thespace" height="0.1ex" depth="0.1ex" width="0.1em" /> <mi>x</mi> </mrow> </msqrt> </mstyle> </math> </p> javascript content var height=0; var width=0; var depth=0; function upheight() { height++; document.getelementbyid("thespace").setattribute("height",height+".1ex"); } function downheight() {...
MathML Demo: <mtable> - tables and matrices
a fenced matrix and the equivalent \begin{bmatrix} ---... [ a b ⁢ b c ⁢ c ⁢ c d ⁢ d ⁢ d ⁢ d ] ⁢ [ a b ⁢ b c ⁢ c ⁢ c d ⁢ d ⁢ d ⁢ d ] . a table with align="axis2" to anchor the table externally w.r.t. the axis of the second row ---... ab α β abx yab γ δ ab ...--- , but this is subject to variances due to style changes, e.g., from the scriptlevel. ---... ab α β abx yab γ δ ab ...--- . anyway, this is buggy in mozilla because what you see above is a fallback to the rendering code used for the baseline case (see below). a table with align="baseline -1" to anchor the table externally w.r.t. the baseline of the last row ---... d+p ( α β γ δ ) ...--- , neat isn't it? this woul...
Mozilla MathML Project
nst tex. demo of some mathml tags: mfrac, mo, mtable, mspace, mmultiscripts, msqrt-mroot. mathml extras - technology demonstration of some interesting upshots from building natively upon the browser environment. various mathml tests - these pages were imported from layout/mathml/tests/. blog with comments that include mathml. create mathml documents authoring mathml editors converters stylesheets original document information author(s): roger b. sidje other contributors: frédéric wang last updated date: april 4, 2010 copyright information: portions of this content are © 1999–2010 by individual mozilla.org contributors; content available under a creative commons license | details. ...
Mozilla DOM Hacking Guide
ed in section 1.3. the fourth and last argument, _flags, is a bitvector of nsixpcscriptable flags. the macros for those flags are defined nsdomclassinfo.cpp. the flags give special behavior through xpconnect. see also section 1.9. the nsdomclassinfodata objects are created in the sclassinfodata array by explicitly initializing it. here is the description of the structure: const char *mname: c-style string that is passed as second argument to the macro. it is the name of the javascript object that will be available in the browser through the dom. union { nsdomclassinfoconstructorfnc mconstructorfptr; nsdomclassinfoexternalconstructorfnc mexternalconstructorfptr; } u; this union is a pointer to a function typedef'ed: typedef nsiclassinfo* (*nsdomclassinfoconstructorfnc)(nsdomclassinf...
Investigating CSS Performance
http://people.mozilla.org/~jmuizelaar/css-perf.patch this patch instruments a bunch of key places and should give an estimate of the order of magnitude of the different parents. two counts are collected which allow for an estimation of the amount of work being done during restyle: resolvestyleforcount this is incremented everytime that we do style resolution on an element contentenumfunccount this is incremented roughly for every rule that we test against time during restyle can be spent in a bunch of places. for example, hasstatedependentstyle will compute a hint that determines how many elements we'll restyle. if we get a erestyle_subtree we will restyle more elements. this was developed while investigating bug 1110625 ...
Profiling with the Firefox Profiler
of which are spent in pvsync::msg_notify and all child functions that it calls. it is useful to scan down the "running time" column and look for when the time changes. while looking for performance problems, you're looking for the processes that are taking the most time; then you can figure out how to optimize them. common performance bugs in firefox inefficient code that is on the reflow or restyle paths is often to blame for jank. so is code that is run often in the parent process or in parts of the codebase that apply to many users. synchronous re-flow can be caused by js that, for example, makes changes to the page content in a loop and queries about the layout of the page in that same loop. a presshell:flush means that we are either recomputing styles or recomputing layout. these sort...
Profiling with the Gecko Profiler and Local Symbols on Windows
building firefox locally. you need to add the lines ac_add_options --target=x86_64-pc-mingw32 and ac_add_options --host=x86_64-pc-mingw32 to your mozconfig in order to build a 64 bit build of firefox. profiling local talos runs if you would like to use the gecko profiler with a local talos run of a local build of firefox for windows, you will need to point talos to a zipfile containing breakpad-style symbols for your build. follow the steps below: note: you only need to do this if you're on windows and you've built firefox yourself. for any official release of firefox (nightly, beta, etc), you do not need to use these steps. make sure you don't have ac_add_options --disable-crashreporter in your firefox .mozconfig file. if you're building a beta or release channel version, and you want p...
Performance
the telemetry performance-reporting system profiling javascript with shark (obsolete - replaced by instruments) how to use the mac os x shark profiler to profile javascript code in firefox 3.5 or later. profiling with shark (obsolete - replaced by instruments) how to use apple's shark tool to profile mozilla code. investigating css performance how to figure out why restyle is taking so long power profiling power profiling overview this page provides an overview of relevant information, including details about hardware, what can be measured, and recommended approaches. it should be the starting point for anybody new to power profiling. tools/power/rapl (mac, linux) tools/power/rapl is a command-line utility in the mozilla codebase...
ui.textSelectBackground
ui.textselectbackground saves the color in which the background of a text selection in the user interface or in content will be styled. type:string with rgb hex value as color code default value:#ef0fff (blue) [1] exists by default: no application support: before gecko 1.7 status: active; last updated 2015-09-21 introduction: pushed to trunk on 2000-04-13 bugs: bug 34704 [1]: nsxplookandfeel.cpp, line 628, retrieved 2015-09-21 ...
ui.textSelectForeground
ui.textselectforeground saves the color in which the text of a text selection in the user interface or the content will be styled. type:string with rgb hex value as color code default value:#ffffff (white) [1] exists by default: no application support: before gecko 1.7 status: active; last updated 2015-09-21 introduction: pushed to trunk on 2000-04-13 bugs: bug 34704 [1]: nsxplookandfeel.cpp, line 635, retrieved 2015-09-21 ...
AsyncTestUtils extended framework
2000 and adds an hour for every message. if you pass an object, it should be an object with one or more of the following attributes: minutes, hours, days, weeks. these attributes specify how old the message should be. for example, {weeks: 2, days: 3} would be a message sent exactly 17 days ago. if you pass age, you should also pass age_incr. age_incr: (no increment) takes an object of the same style taken by age. this specifies the time interval we should add to the date for each message. due to a bug, you should pass negative values. (we will probably auto-correct that in the future.) if your set definition was {count: 3, age: {days: 7}, age_incr: {days: -1}}, then you would generate messages from 7, 6, and 5 days ago. subject: (automatically generated random subject) force all the messag...
MailNews automated testing
ts (for example, access c++ code) and other testing options that don't test at the right level. testing frameworks the asynctestutils extended framework supports: asynchronous test operation: a reasonably convenient means of writing tests that involve asynchronous operations by using generators. in the long term we would like to lose this extra complexity in favor of the event-loop-spinning style of operation used by mozmill. message synthesis: create messages by specifying what properties the messages should have. message injection: inject synthesized messages via local or imap (using a fake server). message manipulation: mark messages as read, tag them, untag them, move them to other folders, trash them, etc. enhanced logging: supports generating rich json streams to disk or over th...
I/O Functions
hat operate on pathnames functions that act on file descriptors directory i/o functions socket manipulation functions converting between host and network addresses memory-mapped i/o functions anonymous pipe function polling functions pollable events manipulating layers functions that operate on pathnames a file or directory in a file system is specified by its pathname. nspr uses unix-style pathnames, which are null-terminated character strings. only the ascii character set is supported. the forward slash (/) separates the directories in a pathname. nspr converts the slashes in a pathname to the directory separator of the native os--for example, backslash (\) on windows and colon (:) on mac os--before passing it to the native system calls. some file systems also differentiate drive...
Logging
this chapter describes the global functions you use to perform logging. nspr provides a set of logging functions that conditionally write printf() style strings to the console or to a log file. nspr uses this facility itself for its own development debugging purposes. you can select events to be logged by module or level. a module is a user-defined class of log events. a level is a numeric value that indicates the seriousness of the event to be logged. you can combine module and level criteria to get highly selective logging. nspr also provides "assert"-style macros and functions to aid in application debugging. conditional compilation and execution log types and variables logging functions and macros use example conditional compilation and execution nspr's logging facility is condi...
PRIntervalTime
ut have special meaning for nspr. they indicate that the process should wait no time (return immediately) or wait forever (never time out), respectively. important note the counters used for interval times are allowed to overflow. since the sampling of the counter used to define an arbitrary epoch may have any 32-bit value, some care must be taken in the use of interval times. the proper coding style to test the expiration of an interval is as follows: if ((printervaltime)(now - epoch) > interval) <... interval has expired ...> as long as the interval and the elapsed time (now - epoch) do not exceed half the namespace allowed by a printervaltime (231-1), the expression shown above provides the expected result even if the signs of now and epoch differ. the resolution of a printervaltime ...
PR_OpenSemaphore
tax #include <pripcsem.h> #define pr_sem_create 0x1 /* create if not exist */ #define pr_sem_excl 0x2 /* fail if already exists */ nspr_api(prsem *) pr_opensemaphore( const char *name, printn flags, printn mode, pruintn value ); parameters the function has the following parameters: name the name to be given the semaphore. flags how to create or open the semaphore. mode unix style file mode to be used when creating the semaphore. value the initial value assigned to the semaphore. returns a pointer to a prsem structure or null/code> on error. description if the named semaphore doesn't exist and the pr_sem_create flag is specified, the named semaphore is created. the created semaphore needs to be removed from the system with a pr_deletesemaphore call. if pr_sem_crea...
NSS FAQ
Mozilla › Projects › NSS › FAQ
ors on the server and smart cards for two-factor authentication. how does nss compare to openssl? openssl is an open source project that implements server-side ssl, tls, and a general-purpose cryptography library. it does not support pkcs #11. it is based on the ssleay library developed by eric a. young and tim j. hudson. openssl is widely used in apache servers and is licensed under an apache-style licence. nss supports both server and client applications as well as pkcs #11 and s/mime. to permit its use in as many contexts as possible, nss is licensed under the mozilla public license, version 2. how does nss compare to sslref? sslref was an early reference implementation of the ssl protocol. it contains bugs that were never fixed, doesn't support tls or or the new 56-bit export cipher ...
NSS 3.12.4 release notes
whenever value exceeds 384 bytes bug 487736: libpkix passes wrong argument to der_decodetimechoice and crashes bug 487858: remove obsolet...
NSS 3.14.2 release notes
gnu as version 2.19 or newer. on red hat enterprise linux 5.x systems, install the binutils220 package and add /usr/libexec/binutils220 to the beginning of your path environment variable. initial manual pages for some nss command line tools have been added. they are still under review, and contributions are welcome. the documentation is in the docbook format and can be rendered as html and unix-style manual pages using an optional build target. new types: in certt.h cert_pi_useonlytrustanchors in secoidt.h sec_oid_ms_ext_key_usage_ctl_signing notable changes in nss 3.14.2 bug 805604 - support for aes-ni and avx accelerated aes-gcm was contributed by shay gueron of intel. if compiled on linux systems in 64-bit mode, nss will include runtime detec...
NSS 3.47 release notes
f-test on entropy source bug 1579290 - asan builds should disable lsan while building bug 1385061 - build nspr tests with nss make; add gyp parameters to build/run nspr tests bug 1577359 - build atob and btoa for thunderbird bug 1579036 - confusing error when trying to export non-existent cert with pk12util bug 1578626 - [cid 1453375] ub: decrement nullptr. bug 1578751 - ensure a consistent style for pk11_find_certs_unittest.cc bug 1570501 - add cmac to freebl and pkcs #11 libraries bug 657379 - nss uses the wrong oid for signaturealgorithm field of signerinfo in cms for dsa and ecdsa bug 1576664 - remove -mms-bitfields from mingw nss build. bug 1577038 - add pk11_getcertsfromprivatekey to return all certificates with public keys matching a particular private key this bugzilla query...
nss tech note1
subtemplate. size† . this field does not apply to all template types. it is only required for dynamically allocating memory for the structure if the template is being included from an asn.1 sequence or sequence of, or if dynamic allocation was requested from the parent template using the sec_asn1_pointer modifier here is a description of the various tags and modifiers that apply to the <tt style="color: rgb(0,0,0);">kind field. asn.1 tags asn.1 tags are specified in the lower byte of the kind field of the template, as noted above. the following is not an attempt to explain asn.1 tags or their purposes. rather, the goal here is to explain what type of tags the decoder supports and which macros should be used when defining tags in decoder templates. it should be noted that we only suppo...
Python binding for NSS
n paradigms and idoms in the python language and libraries. thus when deciding if the nss/nspr api should be rigidly followed or a more pythonic api provided the pythonic implementation wins because python programmers do not want to write c programs in python, rather they want their python code to feel like python code with the richness of full python. identifer names follow the preferred python style instead of the style in the nss/nspr c header files. classes are camel-case. class names always begin with a upper case letter and are then followed by a mix of lower and upper case letters, a upper case letter is used to separate words. acronyms always appear as a contiguous string of upper case letters. method, function and property names are always lower case with words seperated by u...
NSS environment variables
e pointed by nspr_log_file (default stderr). see nss tracing 3.12 nss_use_decoded_cka_ec_point boolean (any value to enable) tells nss to send ec key points across the pkcs#11 interface in the non-standard unencoded format that was used by default before nss 3.12.3. 3.12.3 nss_use_shexp_in_cert_name boolean (any value to enable) tells nss to allow shell-style wildcard patterns in certificates to match ssl server host names. this behavior was the default before nss 3.12.3. 3.12.3 pkix_object_leak_test_abort_on_leak string (any non-empty value) debug variable for pkix leak checking. note: the code must be built with pkix_object_leak_test defined to use this functionality. 3.12 sockettrace boolean (1 to enable) ...
NSS reference
if you are inclined to help with this migration, your help would be very much appreciated. the proposed chapters below are based on the chapters of the ssl reference and the categories of functions in nss public functions. should a particular page require the use of an underscore, please see the documentation for the title override extension. building and installing nss overview of an nss application based on "overview of an ssl application" in the ssl reference. getting started with nss based on "getting started with ssl" in the ssl reference. ...
OLD SSL Reference
if you are inclined to help with this migration, your help would be very much appreciated. upgraded documentation may be found in the current nss reference ssl reference newsgroup: mozilla.dev.tech.crypto writer: sean cotter manager: wan-teh chang chapter 1 overview of an ssl application ssl and related apis allow compliant applications to configure sockets for authenticated, tamper-proof, and encrypted communications. this chapter introduces some of the basic ssl functions. ...
gtstd.html
if you are inclined to help with this migration, your help would be very much appreciated. upgraded documentation may be found in the current nss reference getting started with ssl chapter 2 getting started with ssl this chapter describes how to set up your environment, including certificate and key databases. ...
pkfnc.html
if you are inclined to help with this migration, your help would be very much appreciated. upgraded documentation may be found in the current nss reference pkcs #11 functions chapter 7 pkcs #11 functions this chapter describes the core pkcs #11 functions that an application needs for communicating with cryptographic modules. in particular, these functions are used for obtaining certificates, keys, and passwords. ...
sslcrt.html
if you are inclined to help with this migration, your help would be very much appreciated. upgraded documentation may be found in the current nss reference certificate functions chapter 5 certificate functions this chapter describes the functions and related types used to work with a certificate database such as the cert7.db database provided with communicator. ...
sslerr.html
if you are inclined to help with this migration, your help would be very much appreciated. upgraded documentation may be found in the current nss reference nss and ssl error codes chapter 8 nss and ssl error codes nss error codes are retrieved using the nspr function pr_geterror. in addition to the error codes defined by nspr, pr_geterror retrieves the error codes described in this chapter. ...
sslfnc.html
if you are inclined to help with this migration, your help would be very much appreciated. upgraded documentation may be found in the current nss reference ssl functions chapter 4 ssl functions this chapter describes the core ssl functions. ...
sslintro.html
if you are inclined to help with this migration, your help would be very much appreciated. upgraded documentation may be found in the current nss reference overview of an ssl application chapter 1 overview of an ssl application ssl and related apis allow compliant applications to configure sockets for authenticated, tamper-proof, and encrypted communications. this chapter introduces some of the basic ssl functions. chapter 2, "getting started with ssl" illustrates their use in sample client and server applications. ...
sslkey.html
if you are inclined to help with this migration, your help would be very much appreciated. upgraded documentation may be found in the current nss reference key functions chapter 6 key functions this chapter describes two functions used to manipulate private keys and key databases such as the key3.db database provided with communicator. seckey_getdefaultkeydb seckey_destroyprivatekey seckey_getdefaultkeydb returns a handle to the default key database opened by nss_init. ...
ssltyp.html
if you are inclined to help with this migration, your help would be very much appreciated. upgraded documentation may be found in the current nss reference selected ssl types and structures chapter 3 selected ssl types and structures this chapter describes some of the most important types and structures used with the functions described in the rest of this document, and how to manage the memory used for them. additional types are described with the functions that use them or in the header files. ...
NSS_3.12.3_release_notes.html
(any non-empty value to enable) tells nss to send ec key points across the pkcs#11 interface in the non-standard unencoded format that was used by default before nss 3.12.3. the new key point format is a der encoded asn.1 octet string. nss_use_shexp_in_cert_name boolean (any non-empty value to enable) tells nss to allow shell-style wildcard patterns in certificates to match ssl server host names. this behavior was the default before nss 3.12.3. the new behavior conforms to rfc 2818. new korean seed cipher: new macros for seed support: in blapit.h: nss_seed nss_seed_cbc seed_block_size seed_key_length in pkc...
Network Security Services
notes links to nss technical notes, which provide latest information about new nss features and supplementary documentation for advanced topics in programming with nss. tools, testing, and other technical details build instructions for nss describe how to check out and build nss releases. nss developer tutorial how to make changes in nss. coding style, maintaining abi compatibility. nss tools tools for developing, debugging, and managing applications that use nss. sample code demonstrates how nss can be used for cryptographic operations, certificate handling, ssl, etc. third-party code a list of third-party code included in the nss library. nss 3.2 test suite archived version. describes how to...
Index
bsolete, spidermonkey unregisters a pointer to a gc thing so that it is no longer a member of the garbage collector's root set. this enables any pointed-at gc thing to be garbage collected as needed. 433 js_reporterror jsapi reference, spidermonkey js_reporterror is the simplest jsapi function for reporting errors. first it builds an error message from the given sprintf-style format string and any additional arguments passed after it. the resulting error message is passed to the context's jserrorreporter callback, if any. 434 js_reporterrornumber jsapi reference, needscontent, spidermonkey these functions create a jserrorreport, populate it with an error message obtained from the given jserrorcallback, and either report it to the current error rep...
Exact Stack Rooting
is a js::handlet with a set method. bool returnfoo(jscontext *cx, mutablehandlestring out) { out.set(js_newstringcopyz(cx, "foo")); return bool(out); } size_t getlengthfoo(jscontext *cx) { rootedstring s(cx); if (returnfoo(cx, &s)) return js_getstringlength(s); return size_t(-1); } all methods in the js-api that return gcpointers have been changed to this out-param style. this prevents an entire class of bugs where return values are not rooted properly before the next js-api call. js::nullptr null (or nullptr) does not implicitly convert to a js::handlet. for places where you want to pass a null value into a function taking a js::handlet, you can construct and pass a new nullptr instance. you are free to use these as temporaries. rootedobject obj(cx, js_newobj...
JSAPI User Guide
tions, but they are not the same thing. spidermonkey does not use c++ exceptions for anything. jsapi functions never throw c++ exceptions, and when spidermonkey calls an application callback, the callback must not throw a c++ exception. throwing and catching exceptions we have already seen one example of how to throw an exception from a jsnative function. simply call js_reporterror, with printf-style arguments, and return false. rc = system(cmd); if (rc != 0) { /* throw a javascript exception. */ js_reporterror(cx, "command failed with exit code %d", rc); return false; } this is very much like the javascript statement throw new error("command failed with exit code " + rc);. again, note that calling js_reporterror does not cause a c++ exception to be thro...
JSAutoByteString
ing. this could be null if no string is owned. bool operator!() const return true if no string is owned. size_t length() const return the length of the owned string. return 0 if no string is owned. description jsautobytestring takes the ownership of string and frees it in destructor. if jsautobytestring instance is initialized with jsautobytestring bytes(cx, str); style, it calls js_encodestring(cx, str) to get the string to take ownership. if jsautobytestring instance is initialized with jsautobytestring bytes; style, it does not own any string. you can call some methods to take ownership of other string. note that the js_encodestring call in constructor and some encode* methods may fail and get null. so ensure the string is returned by operator!() before usi...
JSObjectOps.enumerate
416 for details. the jsobjectops.enumerate callback implements iteration over object properties. the type of the callback is jsnewenumerateop. for native objects, the enumerate callback first checks the jsclass_new_enumerate flag of the object's class. if the flag is present, enumerate simply delegates the call to jsclass.enumerate. otherwise, it invokes the jsclass.enumerate hook as an old-style jsenumerateop to give the object an opportunity to define any remaining lazy properties. then it iterates over obj's defined properties, walking the internal data structure they're stored in. ...
JS_ReportError
a js_threadsafe build, the caller must be in a request on this jscontext. format const char * format string to convert into an error message using js_vsmprintf. ... ... error message variables to insert into the format string. description js_reporterror is the simplest jsapi function for reporting errors. first it builds an error message from the given sprintf-style format string and any additional arguments passed after it. the resulting error message is passed to the context's jserrorreporter callback, if any. if the caller is in a jsapi callback, js_reporterror also creates a new javascript error object and sets it to be the pending exception on cx. the callback must then return js_false to cause the exception to be propagated to the calling script. an ex...
Shell global objects
ed by ion, null is returned. dumpscopechain(obj) prints the scope chain of an interpreted function or a module. crash([message]) crashes the process with a moz_crash. setarmhwcapflags("flag1,flag2 flag3") on non-arm, no-op. on arm, set the hardware capabilities. the list of flags is available by calling this function with help as the flag's name wasmloop(filename, imports) performs an afl-style persistent loop reading data from the given file and passing it to thewasmeval function together with the specified imports object. testing functions testing functions are available also on firefox via components.utils.getjstestingfunctions() functions always available gc([obj] | 'zone' [, 'shrinking']) run the garbage collector. when obj is given, gc only its zone. if zone is given, gc a...
Gecko object attributes
. object attributes list aria attributes all aria attributes used on dom element (i.e., any attribute prefixed by 'aria-') are exposed as object attributes; name is preserved except the 'aria-' prefix is cut. common attributes class the class name for an element from html, xul, svg, etc. this is useful for retrieving microformat semantics for an element. display similar with display css style. applied to: any visible accessible id any value, defined by ui/content developers. used to indicate a persistent identifier for any object; useful for scripting. applied to: any role which related dom node has id attribute tag the actual markup tag used to create this element (also used in xul). applied to: any role xml-roles if a dynamic content accessibility role string is used, it is...
AT APIs Support
onscreen keyboards, magnification software and other assitive technologies can support gecko-based software. we provide for them the support of these products on windows, linux/unix and os x platforms. accessible gecko gecko is a rendering engine that firefox, seamonkey, netscape and yelp use. gecko can render a variety of content, not just html and supports key web standards such as cascading style sheets, javascript and the w3c dom. gecko also handles the users keystrokes and mouse clicks. gecko is the core architecture that we are adding accessibility to, in order to support basic accessibility in all applications that are based on it. gecko based applications gecko can be used in two ways to create application: embedded clients embedded clients use gecko only in the content window, a...
XForms Accessibility
t navindex. he wrote: navindex was in xforms - it was stripped out as it was believed the focus model was dependent on the content which used it. so, yes we don't care about navindex in xforms. if you use xhtml1.x use tabindex. if you use xhtml2 use nextfocus. therefore since mozilla xforms works in xhtml (1.x) or xul documents only then we use tabindex instead. note, we support -moz-user-focus style neither for xhtml or xul. at api accessible properties this section describes common rules how accessibility properties are formed for forms control elements. name it is formed from value of child xforms label element if the element doesn't have labelledby attribute. description it is formed from value of child xforms hint element if the element doesn't have describedby attribute. state ...
Mork
Mozilla › Tech › Mork
ons of name-value pairs, which can be organized into various tables. rows need not be in a table, nor need they be in only one table. values are merely an opaque sequence of bytes, so their actual content is dependent on the mork consumer. except when parsing values, whitespace ('\b', '\t', '\r', '\n', '\f', ' ', and '\x7f'), line continuations ('\\' followed by a newline), and comments (c++ or c style) can be ignored. in practice, only c++-style comments, and the standard whitespace characters ('\t', ' ', '\r', '\n') appear to be used. the grammar for mork is as follows: file = header ( dictionary | table | group | row )* header = '// <!-- <mdb:mork:z v="1.4"/> -->' dictionary = '<' ( metadictionary | alias )* '>' table = '{' '-'? mid ( metatable | row | '-' | rowreference)* '}' row = '[' '-'...
Places utilities for JavaScript
er from the insertion point as the initially selected item in the folder picker. [optional] ashowpicker see above [optional] aloadinsidebar if true, the dialog will default to load the new item in the sidebar (as a web panel). [optional] akeyword the default keyword for the new bookmark. the keyword field will be shown in the dialog if this is used. [optional] apostdata post data for post-style keywords. return type returns true if any transaction has been performed. note: the location, description and "load in sidebar" fields are visible only if there is no initial uri (auri is null). note: when adefaultinsertionpoint is not set, the dialog defaults to the bookmarks root folder. showminimaladdbookmarkui() showminimaladdbookmarkui(auri, atitle, ...
Using the Places history service
ed for bookmark titles.this function may be removed if the bookmark service is changed. nsinavhistoryservice.setpagedetails: used to set all of the global bits associated with a url. it is designed for synchronizing or backup services. basic querying of the history system nsiglobalhistory2.isvisited: called by gecko when rendering links. when isvisited returns true, the link gets the "visited" style. otherwise, the link is colored as unvisited. nsiglobalhistory3.getgeckoflags: retrieves information previously set using setgeckoflags. it is not yet implemented in the places history system. nsibrowserhistory.lastpagevisited: contains the uri of the last page visited. this is used when the preference is set that causes the last page in new windows. nsibrowserhistory.count: the number of page...
XML Extras
domparser creation not available new domparser() xmlserializer creation not available new xmlserializer() minimal documentation for the components listed above can be found using mozilla documentation generated by doxygen. file new bugs for additional documentation contributions, either specifically aimed at javascript developers or to complete & clarify the javadoc-style comments in the idl files. nsidomserializer (currently, the javascript constructor is xmlserializer()) nsidomparser (currently, the javascript constructor is domparser()) nsixmlhttprequest please see the xml linking and pointing section in xml in mozilla document for fixptr and xpointer documentation. how can i help? help with testing the components contained within the module. contri...
Aggregating the In-Memory Datasource
any old random garbage. similarly, i wanted to trap flush() so that i could write the bookmarks.html file back to disk. in short, the only case where this technique is useful is when you're implementing a datasource to get "read-only reflection". that is, you want to reflect the contents of something as an rdf graph (presumably so that it can be aggregated with other information or displayed as styled content). technical details as before, have an nscomptr as your delegate, but this time around,don't derive from nsirdfdatasource. also, instead of keeping an nscomptr<nsirdfdatasource>, you'll just want an nscomptr<nsisupports>: class myclass : public nsimyinterface { ... private: nscomptr<nsisupports> minner; }; construct the datasource delegate when your object is constructed (or...
An Overview of XPCOM
es that the component supports. in implementations of queryinterface, the iid argument is checked against the nsiid class. if there is a match, the object's this pointer is cast to void, the reference count is incremented, and the interface returned to the caller. if there isn't a match, the class returns an error and sets the out value to null. in the example above, it's easy enough to use a c-style cast. but casting can become more involved where you must first cast void then to the requested type, because you must return the interface pointer in the vtable corresponding to the requested interface. casting can become a problem when there is an ambiguous inheritance hierarchy. xpcom identifiers in addition to the iid interface identifier discussed in the previous section, xpcom uses two ot...
Starting WebLock
tween services and clients. the next section shows the interface of the weblock component, iweblock, in xpidl. once the interface has been described in the xpidl language, the interface file can be used to generate the header files needed for the implementation code, the binary type library files that let you use the interface of the weblock component from javascript, and even broken linkjavadoc style html documentation. defining the weblock interface in xpidl most interfaces in the xpcom world are described in xpidl. the xpidl file for the iweblock interface can be used to generate the c++ header file, which you'll need to implement the interface in the component and also a type library that makes the component accessible from javascript or other interpreted languages. in mozilla, javascrip...
Using XPCOM Utilities to Make Things Easier
d the developer. in xpcom, this tool is the nscomptr, orsmart pointer class, which can save you countless hours and simplify your code when you're dealing with interface pointers. using smart pointers, the code above can be simplified to: { nscomptr<nsisupports> value; object->method(getter_addrefs(value)); if (!value) return; // ... if (ns_failed(error)) return; // ... } the style or syntax may be unfamilar, but smart pointers are worth learning and using because they simplify the task of managing references. nscomptr is a c++ template class that acts almost exactly like raw pointers, that can be compared and tested, and so on. when you pass them to a getter, you must do something special, however: you must wrap the variable with the function getter_addrefs, as in the exam...
Mozilla internal string guide
ing (const char16_t* or const char*) into a class of type nsastring. note that you must null-terminate buffers used by to nsdependentstring. if you don't want to or can't null-terminate the buffer, use nsdependentsubstring. nsprintfcstring- derived from nscstring, this string behaves like an nsautocstring. the constructor takes parameters which allows it to construct a 8-bit string from a printf-style format string and parameter list. there are also a number of concrete classes that are created as a side-effect of helper routines, etc. you should avoid direct use of these classes. let the string library create the class for you. nssubstringtuple - created via string concatenation nsdependentsubstring - created through substring nspromiseflatstring - created through promiseflatstring() ...
Introduction to XPCOM for the DOM
the class definitions, we can see that nsgenerichtmlelement and nsgenerichtmlcontainerelement don't implement any interface directly. however nsgenericelement does: class nsgenericelement : public nsihtmlcontent this of course means that nsgenericelement implements the nsihtmlcontent interface. the interface inheritance chain for nsihtmlcontent looks like this: nsisupports -> nsicontent -> nsistyledcontent -> nsixmlcontent -> nsihtmlcontent nsgenericelement has to implement all of the above interfaces, and all the real classes inheriting from nsgenericelement will automatically implement all those interfaces. this is consistent with the rules we have defined earlier in this paragraph. see also the xpidl reference mapping dom objects to their c class modularization techniques ...
Observer Notifications
ers will be passed an nsisupportsprint64 through their subject parameters indicating the id of the folder. the subject is null otherwise. themes these topics indicate when actions related to themes occur. topic data description lightweight-theme-preview-requested json sent when the user requests to preview a lightweight theme, but before existing windows are styled with the new theme. lightweight-theme-change-requested json sent to indicate that the user has chosen a new theme in the add-ons manager, but before the change takes effect. lightweight-theme-changed - sent after the current theme is changed. lightweight-theme-styling-update json sent when the current theme being used is changed; this is sent even whe...
TakeFocus
mmary this method focuses this accessible node. void takefocus(); remarks the state state_focusable indicates whether this node is normally focusable. it is the callers responsibility to determine whether this node is focusable.acctakefocus on a node that is not normally focusable (such as a table), will still set focus on that node, although normally that will not be visually indicated in most style sheets. see also nsiaccessible.focusedchild ...
nsIAccessibleEditableText
parameters position the offset at which to insert the text from the system clipboard into the text represented by this object. exceptions thrown ns_error_failure indicates the text cannot be pasted from the clipboard. setattributes() sets the attributes for the text between the two given indices. the old attributes are replaced by the new list of attributes. for example, sets font styles, such as italic, bold, and so on. void setattributes( in long startpos, in long endpos, in nsisupports attributes ); parameters startpos the start index of the text whose attributes are modified. endpos the end index of the text whose attributes are modified. attributes the set of attributes that replaces the old list of attributes of the specified text portion. exceptions thr...
nsIAutoCompleteItem
xpfe/components/autocomplete/public/nsiautocompleteresults.idlscriptable please add a summary to this article. inherits from: nsisupports last changed in gecko 1.7 attributes attribute type description classname string class name used to define some style through css like the colors, an icon url, and so on. comment wstring an extra comment that will be displayed next to the value but that will not be part of the value itself. param nsisupports parameter use by the search engine. value astring the result value using astring to avoid excess allocations. ...
nsICookieManager2
nsisimpleenumerator getcookiesfromhost( in autf8string ahost ); parameters ahost the host string to look for, such as "google.com". this should consist only of the host portion of the uri and should not contain a leading dot, port number, or other information. return value an nsisimpleenumerator of nsicookie2 objects representing the matching cookies. importcookies() imports an old-style cookie file. the imported cookies will be added to the existing cookie database. if the database contains any cookies that are the same as those being imported (that is, they have the same domain, name, and path), they are replaced with the ones being imported. void importcookies( in nsifile acookiefile ); parameters acookiefile the file to import. this is usually cookies.txt. see also...
nsIDOMXULElement
sets the value of the element's pack attribute. persist domstring gets/sets the value of the element's persist attribute. ref domstring gets/sets the value of the element's ref attribute. resource nsirdfresource read only. returns the nsirdfresource corresponding to the element's ref or id attribute, if any. statustext domstring gets/sets the value of the element's statustext attribute. style nsidomcssstyledeclaration read only. obsolete since gecko 1.9 returns an object that may be used to read or write individual css style properties for the element. tooltip domstring gets/sets the value of the element's tooltip attribute. tooltiptext domstring gets/sets the value of the element's tooltiptext attribute. top domstring gets/sets the value of the element's top attribute. width ...
nsIFeedResult
bozo boolean the feed processor sets the bozo bit when a feed triggers a fatal error during xml parsing. there may still be feed metadata and entries that were parsed before the error occurred. doc nsifeedcontainer the parsed feed or entry. null if a non-feed was processed. headers nsiproperties the http response headers that accompanied the feed. stylesheet nsiuri an xslt stylesheet available to transform the source of the feed. some feeds include this information in a processing instruction. it's generally intended for use by clients designed to work with specific feeds. uri nsiuri the address from which the feed was fetched. version astring the version of the feed; null if a non-feed is processed. this valu...
nsIFileView
*.jpg" would only return jpg files. void setfilter( in astring filterstring ); parameters filterstring the filter to be applied to the file list. sort() set the method used for sorting. void sort( in short sorttype, in boolean reversesort ); parameters sorttype one of the sort* constants. reversesort true, results will be sorted in ascending order. ...
nsILocalFile
prior to each write. pr_truncate if the file exists, its length is truncated to 0. pr_sync if set, each write will wait for both the file data and file status to be physically updated. pr_excl with pr_create_file, if the file does not exist, the file is created. if the file already exists, no action and null is returned. delete_on_close file will be deleted when closed. mode a unix-style file permissions value. for example, the octal value 0600 may be used to limit read and write access to the current user of the system. this parameter may be ignored on systems that do not support file permissions. return value if the file is successfully opened, returns a pointer to the prfiledesc created for the newly opened file. returns a null pointer if the open failed. example #include...
nsIMarkupDocumentViewer
inherits from: nsisupports last changed in gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) method overview void scrolltonode(in nsidomnode node); void sizetocontent(); attributes attribute type description allowplugins boolean if true, plugins are allowed within the doc shell. default = true. obsolete since gecko 1.8 authorstyledisabled boolean disable entire author style level (including html presentation hints) bidicharacterset octet whether to force the user's character set 1 - use the document character set 2 - use the character set chosen by the user. obsolete since gecko 6.0 bidicontrolstextmode octet the order of bidirectional text in form controls. 1 - logical 2 - visual 3 - l...
nsITXTToHTMLConv
last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) implemented by "@mozilla.org/streamconv;1?from=text/plain&to=text/html". you should normally obtain an instance via the nsistreamconverterservice interface. method overview void preformathtml(in boolean value); void settitle(in wstring text); prior versions of the interface named the methods using the initialcaps style instead of the intercaps style. methods preformathtml() specifies whether or not to wrap the resulting html in an <pre> block. void preformathtml( in boolean value ); parameters value true to wrap the resulting html in a <pre> block. settitle() sets the title to use on the resulting html document. void settitle( in wstring text ); parameters text title to set for the html document. ...
nsITreeView
turn "dummy"; } obsolete since gecko 22 (firefox 22 / thunderbird 22 / seamonkey 2.19)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. ...
nsIWebBrowserChrome
esent special cases. chrome_window_lowered 67108864 represent special cases. chrome_center_screen 134217728 represent special cases. chrome_dependent 268435456 make the new window dependent on the parent. this flag is only meaningful if chrome_openas_chrome is set; content windows should not be dependent. chrome_modal 536870912 the modal style bit just affects the way the window looks and does not mean it's actually modal. chrome_openas_dialog 1073741824 represent special cases. chrome_openas_chrome 2147483648 represent special cases. chrome_all 4094 represent special cases. chrome_remote_window 1048576 whether this window should use remote (out-of-process) tabs. methods...
nsIWebProgressListener
e() event may indicate some combination of these flags). constant value description state_is_request 0x00010000 this flag indicates that the state transition is for a request, which includes but is not limited to document requests. (see below for a description of document requests.) other types of requests, such as requests for inline content (for example images and stylesheets) are considered normal requests. state_is_document 0x00020000 this flag indicates that the state transition is for a document request. this flag is set in addition to state_is_request. a document request supports the nsichannel interface and its loadflags attribute includes the nsichannel::load_document_uri flag. a document request does not complete until all request...
XPCOM Interface Reference
vicemanagernsisessionstartupnsisessionstorensisimpleenumeratornsismsdatabaseservicensismsrequestmanagernsismsservicensisocketprovidernsisocketproviderservicensisockettransportnsisockettransportservicensisoundnsispeculativeconnectnsistackframensistandardurlnsistreamconverternsistreamlistenernsistringbundlensistringbundleoverridensistringbundleservicensistringenumeratornsistructuredclonecontainernsistylesheetservicensisupportsnsisupports proxiesnsisupportsarraynsisupportscstringnsisupportscharnsisupportsdoublensisupportsfloatnsisupportsidnsisupportsinterfacepointernsisupportsprboolnsisupportsprint16nsisupportsprint32nsisupportsprint64nsisupportsprtimensisupportspruint8nsisupportspruint16nsisupportspruint32nsisupportspruint64nsisupportsprimitivensisupportsprioritynsisupportsstringnsisupportsvoidns...
XPCOM Interface Reference by grouping
provider nsiaccessibleretrieval nsiaccessiblerole nsiaccessiblescrolltype nsiaccessibleselectable nsiaccessiblestates nsiaccessibletable nsiaccessibletext nsiaccessibletreecache nsiaccessiblevalue nsiaccessnode nsisyncmessagesender script nsiscriptableunescapehtml nsiscriptableunicodeconverter nsiscripterror nsiscripterror2 stylesheet nsistylesheetservice url nsiuri nsiurl util nsidomserializer nsidomxpathevaluator nsidomxpathexception nsidomxpathexpression nsidomxpathresult xslt nsixsltexception nsixsltprocessor download nsidownload nsidownloadmanager nsidownloadprogresslistener element internal nsiworker nsiworkerglo...
Xptcall Porting Status
be maintaining this code. there is some doubt as to whether or not this is working for everyone - see bug #10061. mike shaver <shaver@mozilla.org> is the interim maintainer until someone more suitable can be found. <font color="white">done</font> beos x86 duncan wilcox <duncan@be.com> unix (yet another reuse of the linux 86 code!) duncan says this is all working. he did the code for old cfront style 'this' adjustment for others to use too! <font color="white">help!</font> beos ppc - - <font color="white">done</font> compaq tru64 unix (digital unix) steve streeter <streeter@zk3.dec.com> code passes the tests and is checked in. <font color="black">working</font> neutrio x86 jerry l. kirk <jerry.kirk@nexwarecorp.com> patches for xptc*_unixish_x86.cpp checked in. waiting for verification...
XPIDL Syntax
Mozilla › Tech › XPIDL › Syntax
34, although a few productions use prose for clarity of understanding. lexically, tokens are delimited by whitespace (defined here as spaces, tabs, vertical tabs, form feeds, line feeds, and carriage returns, or [ \t\v\f\r\n] in regular expression form). libidl only considers a single line feed as a newline, and not carriage returns (although xpidl begs to differ). additionally, the use of both c-style (/* ... */) and c++-style (// ... end-of-line) comments are permitted between any two tokens. some productions can only occur at the beginning of lines; to simplify the grammar, i will not mention them in the grammar, especially since they are handled as a preprocessing step before the idl source code is actually parsed. a `%{' that appears at the beginning of a line is the start of a raw code ...
DB Views (message lists)
values filed in nsidbfolderinfo to remember the view settings for the folder. view interaction with nsitreeview the nsitreeview methods in nsmsgdbview.cpp control the appearance of the thread pane. properties these nsmsgdbview methods set properties, nsitreeview.getrowproperties (implementation) nsitreeview.getcellpropreties (implementation) theming the theme uses these properties to style the thread pane. see the tutorial for information about styling trees using css, and the thunderbird source for some example css. text nsitreeview.getcelltext (implementation) tells the nsitreeview what text to display for a particular row and text column. ...
Mail and RDF
hopelessly confused. overview of mail rdf graph the root resource for all accounts, folders and messages is the rdf resource named msgaccounts:/. from this resource, you can follow a number of arcs to find servers, folders, and finally messages. eventually we'll probably hang mail filters, annotations, etc, off of nodes in the graph. here is an example of how this might be set up: in this tree-style representation of an rdf graph, i've made arcs italic and resources bold. msgaccounts:/ +-- http://home.netscape.com/nc-rdf#child --> | imap://alecf@imap.mywork.com | +-- http://home.netscape.com/nc-rdf#isserver --> "true" | +-- http://home.netscape.com/nc-rdf#child --> | imap://alecf@imap.mywork.com/inbox | +-- http://home.netscape.com/nc-rdf#total...
Add Toolbar Button
example xul overlay file: <?xml version="1.0"?> <?xml-stylesheet href="chrome://demo/skin/overlay.css" type="text/css" ?> <overlay id="messengerwindow" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="application/x-javascript" src="overlay.js" /> <toolbarpalette id="mailtoolbarpalette"> <toolbarbutton id="demo-button" class="demo-button toolbarbutton-1" label="demo" type="button" oncommand="demo.load();" /> </toolbarpalette> </overlay> add this to the css file you referenced in your xul file: #demo-button, [place="palette"] > #demo-button { list-style-image: url("chrome://demo/skin/icon.png") !important; } ...
Theme Packaging
this document describes only how themes are packaged in order to be shown in firefox's themes window. ...
Working with windows in chrome code
g nsiwindowwatcher.openwindow is a bit less trivial . ...
URLs - Plugins
posturl(npp instance, const char *url, const char *target, uint32 len, const char *buf, npbool file); the instance, url, and target parameters have the same definitions as those of npn_geturl. the buf parameter identifies a local temporary file or data buffer that contains the data to post. windows and mac if a file is posted with any protocol other than ftp, the file must be text with unix-style line breaks ('\n' separators only). npn_posturl works identically with buffers and files. to post data from a memory buffer, set the flag file to false, the buffer buf to the data to post, and len to the length of the buffer. possible url types include http (similar to an html form submission), mailto (sending mail), news (posting a news article), and ftp (uploading a file). for protocols in wh...
3D view - Firefox Developer Tools
ng of your content. by clicking and dragging the view, you can rotate and re-orient the 3d presentation of the dom hierarchy of your page to see it from different angles, to better examine its structure. off-screen elements become visible, so that you can see where your elements are located in relation to the visible content. you can click on elements to see their html in the html panel or the style panel. conversely, you can click on elements in the breadcrumb bar to change which element is selected in the 3d view. if you do not see the 3d button in the page inspector, it is possible that your graphics driver needs to be updated. see the blocklisted drivers page for more information. controlling the 3d view there are keyboard shortcuts and mouse controls available for the 3d view. ...
Accessibility Inspector - Firefox Developer Tools
ernal states, see gecko states. relations — a list of the accessiblity-relevant relationships between this item and other items. for example, in a form, an entry item could have a "labelled by" relation with a label item, which in turn has a "label for" relation to the entry item. attributes — a list of all the accessibility-relevant attributes that are applied to the item. this can include style-related attributes such as margin-left and text-indent, and other useful states for accessibility information, such as draggable and level (e.g., what heading level is it, in the case of headings). for a full list of possible attributes, see gecko object attributes. note: the exposed information is the same across all platforms — the inspector exposes gecko's accessibility tree, rather than ...
DOM Inspector FAQ - Firefox Developer Tools
de. from the dom nodes viewer, select the node and bring up the context menu. you should notice the set pseudo-classes menu item, which will allow you to set the content state for the aforementioned pseudo-classes. there is currently no way to inspect dynamically-applied rules for other pseudo-classes or any pseudo-elements from the dom inspector ui. you can, however, find any rule in its parent style sheet (e.g., to modify it) by using the style sheets viewer in the document pane, and locating it in the css rules viewer in the object pane. original document information author(s): christopher aillon last updated date: november 11, 2003 copyright information: portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under a creative commons lic...
DOM Inspector internals - Firefox Developer Tools
additionally, it defines the content in the main body of the dom inspector window, namely, the panel...
Browser Toolbox - Firefox Developer Tools
en in its own window: you'll be able to inspect the browser's chrome windows and see, and be able to debug, all the javascript files loaded by the browser itself and by any add-ons that are running. altogether you will have access to the following developer tools: debugger (note: if you want to debug a specific add-on that is restartless or sdk-based then try the add-on debugger.) console style editor performance network monitor page inspector accessibility inspector you can debug chrome: and about: pages using the normal debugger, just as if they were ordinary content pages. targeting a document in the normal toolbox, there's a button in the toolbar enabling you to target specific iframes in the document. the same button appears in the browser toolbox where it lists all the top...
Edit Shape Paths in CSS - Firefox Developer Tools
ing a circle basic shape. clicking on the shapes icon next to the value of circle() will highlight the shape, and also give you the option to resize the circle or move its center. if you move or resize the circle past the margin box, the edges become clipped by it. in the rules panel you can see the values for circle() change as you edit the shape. you can then copy these values back into your stylesheet to create the new, tweaked shape path. ellipse() if the value of shape-outside is ellipse() then you are using the ellipse basic shape. the ellipse() value works in much the same way as circle() in the shape path editor. an ellipse is a squashed circle and therefore has the option to resize horizontally and vertically when you click on the shapes icon. inset() if the value of shape-out...
Page inspector keyboard shortcuts - Firefox Developer Tools
+ down arrow alt + down arrow (ctrl + down arrow from firefox 60 onwards). show/hide more information about current property (computed view only, when a property is selected) enter or space return or space enter or space open mdn reference page about current property (computed view only, when a property is selected) f1 f1 f1 open current css file in style editor (computed view only, when more information is shown for a property and a css file reference is focused). enter return enter global shortcuts these shortcuts work in all tools that are hosted in the toolbox. command windows macos linux increase font size ctrl + + cmd + + ctrl + + decrease font size ctrl + - cmd + - ...
UI Tour - Firefox Developer Tools
the "computed view" tab, but had its own tab. to learn more about the css declarations listed in this view, see examine computed css. changes view when you are editing in the rules view, you can see the changes you have made in the changes view. computed view the computed view shows you the complete computed css for the selected element (the computed values are the same as what getcomputedstyle would return.): compatibility view starting with firefox developer edition version 77, the compatibility view shows css compability issues, if any, for properties applied to the selected element, and for the current page as a whole. it shows icons for the browsers that do support the properties, and notes properties that are experimental or deprecated. click the name of the property to o...
Tips - Firefox Developer Tools
t logs" in the settings to keep logged messages from before even after navigation. check "enable timestamps" in the settings to show timestamps besides the logged messages. debugger skip javascript libraries in debugging sessions via the black box icon (). press ctrl+alt+f to search in all scripts. press ctrl+d to search for a function definition. press ctrl+l to go to a specific line. style editor the black box icon () in the style sheet pane toggles the visibility of a style sheet. click an @media rule to apply it in responsive design mode. click the import button () to import a style sheet or the create button () to create a new one. click the options button in the style sheet pane and click "show original sources" to toggle the display of css preprocessor files. network m...
Toolbox - Firefox Developer Tools
ow. node picker on the far left there's a button to activate the node picker. this lets you select a page element for inspection. see "selecting elements". toolbox-hosted tools then there is an array of labeled buttons which enables you to switch between the different tools hosted by the toolbox. the array may include the following tools: web console javascript debugger page inspector style editor profiler network monitor note that not all the hosted tools are always listed here: only the tools actually available in this context are shown (for example, not all tools support remote debugging yet, so if the debugging target is not the firefox instance that launched the window, not all the hosted tools will be shown). extra tools next there's an array of buttons that can be added...
Rich output - Firefox Developer Tools
{…}, {…}, {…}, {…} ] debugger eval code:1:9 undefined if you expand objects, such as arrays, you get slightly different content. ...
Firefox Developer Tools
these developer tools are also built into firefox. unlike the "core tools" above, you might not use them every day. memory figure out which objects are keeping memory in use. storage inspector inspect cookies, local storage, indexeddb, and session storage present in a page. dom property viewer inspect the page's dom properties, functions, etc. eyedropper select a color from the page. style editor view and edit css styles for the current page. taking screenshots take a screenshot of the entire page or of a single element. measure a portion of the page measure a specific area of a web page. rulers overlay horizontal and vertical rulers on a web page for the latest developer tools and features, try firefox developer edition. download firefox developer edition conne...
Animation.onfinish - Web APIs
working draft editor's draft. ...
Animation.onremove - Web APIs
nt, or null if no remove event handler is set. examples in our simple replace indefinite animations demo, you can see the following code: const divelem = document.queryselector('div'); document.body.addeventlistener('mousemove', evt => { let anim = divelem.animate( { transform: `translate(${ evt.clientx}px, ${evt.clienty}px)` }, { duration: 500, fill: 'forwards' } ); anim.commitstyles(); //anim.persist() anim.onremove = function() { console.log('animation removed'); } console.log(anim.replacestate); }); here we have a <div> element, and an event listener that fires the event handler code whenever the mouse moves. the event handler sets up an animation that animates the <div> element to the position of the mouse pointer. this could result in a huge animations l...
Animation.persist() - Web APIs
Web › API › Animation › persist
); parameters none. return value none. examples in our simple replace indefinite animations demo, you can see the following code: const divelem = document.queryselector('div'); document.body.addeventlistener('mousemove', evt => { let anim = divelem.animate( { transform: `translate(${ evt.clientx}px, ${evt.clienty}px)` }, { duration: 500, fill: 'forwards' } ); anim.commitstyles(); //anim.persist() anim.onremove = function() { console.log('animation removed'); } console.log(anim.replacestate); }); here we have a <div> element, and an event listener that fires the event handler code whenever the mouse moves. the event handler sets up an animation that animates the <div> element to the position of the mouse pointer. this could result in a huge animations l...
Animation.replaceState - Web APIs
d: the animation has been explicitly removed. examples in our simple replace indefinite animations demo, you can see the following code: const divelem = document.queryselector('div'); document.body.addeventlistener('mousemove', evt => { let anim = divelem.animate( { transform: `translate(${ evt.clientx}px, ${evt.clienty}px)` }, { duration: 500, fill: 'forwards' } ); anim.commitstyles(); //anim.persist() anim.onremove = function() { console.log('animation removed'); } console.log(anim.replacestate); }); here we have a <div> element, and an event listener that fires the event handler code whenever the mouse moves. the event handler sets up an animation that animates the <div> element to the position of the mouse pointer. this could result in a huge animations l...
AnimationEffect.getComputedTiming() - Web APIs
the object returned by the animationeffect.gettiming() method, the values returned by this object differ in the following ways: duration returns the calculated value of the iteration duration. if effecttiming.duration is the string auto, this attribute will return 0. fill the auto value is replaced with the appropriate effecttiming.fill value. these values are comparable to the computed styles of an element returned using window.getcomputedstyle(elem). syntax var currenttimevalues = animation.getcomputedtiming(); parameters none. return value a computedeffecttiming dictionary object, which contains the following properties: endtime the end time of the animation in milliseconds from the animation's start (if the keyframeeffect is associated with an animation). (also includ...
CSS.registerProperty() - Web APIs
working draft initial definition. ...
CSSGroupingRule - Web APIs
from cssrule and inherits all properties of this class. it has one specific property: cssgroupingrule.cssrules read only returns a cssrulelist of the css rules in the media rule. methods common to all cssgroupingrule instances the cssgroupingrule derives from cssrule and inherits all methods of this class. it has two specific methods: cssgroupingrule.deleterule deletes a rule from the style sheet. cssgroupingrule.insertrule inserts a new style rule into the current style sheet. specification specification status comment css object model (cssom)the definition of 'cssgroupingrule' in that specification. working draft initial definition. ...
CSSKeyframeRule - Web APIs
the csskeyframerule interface describes an object representing a set of style for a given keyframe. it corresponds to the contains of a single keyframe of a @keyframes at-rule. it implements the cssrule interface with a type value of 8 (cssrule.keyframe_rule). properties as a cssrule, csskeyframerule also implements the properties of these interfaces. it has two specific properties: csskeyframe.keytext represents the key of the keyframe, like '10%', '75%'. the from keyword maps to '0%' and the to keyword maps to '100%'. csskeyframe.style read only returns a cssstyledeclaration of the css style associated with the keyframe. methods as a cssrule, csskeyframerule also implements the methods of that interface. it has no specific methods. specification specificatio...
CSSKeywordValue.value - Web APIs
the value property of the csskeywordvalue interface returns or sets the value of the csskeywordvalue. syntax var val = csskeywordvalue.value csskeywordvalue.value = val value a usvstring. examples the following example resets the css display property to its defaults. let indicator = document.getelementbyid('indicator'); indicator.attributestylemap.set('display', new csskeywordvalue('initial')); indicator.attributestylemap.get('display').value // 'initial' specifications specification status comment css typed om level 1the definition of 'undefined' in that specification. working draft initial definition. ...
CSSPositionValue.CSSPositionValue() - Web APIs
w csspositionvalue(x, y) parameters x a position along the web page's horizontal axis. ...
CSSPositionValue.x - Web APIs
erface returns returns the item's position along the web page's horizontal axis. ...
CSSPositionValue.y - Web APIs
sspositionvalue interface returns the item's position along the vertical axis. ...
CSSPrimitiveValue.getCounterValue() - Web APIs
the getcountervalue() method of the cssprimitivevalue interface is used to get the counter value. if this css value doesn't contain a counter value, a domexception is raised. modification to the corresponding style property can be achieved using the counter interface. syntax var countervalue = cssprimitivevalue.getcountervalue(); return value a counter object representing the counter value. exceptions type description domexception an invalid_access_err is raised if the css value doesn't contain a counter value (e.g. this is not css_counter). specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssprimitivevalue.getcountervalue' in that specification. obsolete ...
CSSPrimitiveValue.getFloatValue() - Web APIs
<angle> in radians. css_s the value is a <time> in seconds. return value a float value in the specified unit. exceptions type description domexception an invalid_access_err is raised if the css value doesn't contain a float value or if the float value can't be converted into the specified unit. example var cs = window.getcomputedstyle(document.body); var cssvalue = cs.getpropertycssvalue("margin-top"); console.log(cssvalue.getfloatvalue(cssprimitivevalue.css_cm)); specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssprimitivevalue.getfloatvalue' in that specification. obsolete initial definition ...
CSSPrimitiveValue.getStringValue() - Web APIs
ace is used to get a string value. if this css value doesn't contain a string value, a domexception is raised. syntax var stringvalue = cssprimitivevalue.getstringvalue(); return value a string value. exceptions type description domexception an invalid_access_err is raised if the css value doesn't contain a string value. example var cs = window.getcomputedstyle(document.body); var cssvalue = cs.getpropertycssvalue("display"); console.log(cssvalue.getstringvalue()); specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssprimitivevalue.getstringvalue' in that specification. obsolete initial definition ...
CSSPrimitiveValue.primitiveType - Web APIs
) method. css_string the value is a <string>. the value can be obtained by using the getstringvalue() method. css_unknown the value is not a recognized css2 value. the value can only be obtained by using the csstext attribute. css_uri the value is a <uri>. the value can be obtained by using the getstringvalue() method. example var cs = window.getcomputedstyle(document.body); var cssvalue = cs.getpropertycssvalue("color"); console.log(cssvalue.primitivetype); specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssprimitivevalue.primitivetype' in that specification. obsolete initial definition ...
CSSPrimitiveValue.setFloatValue() - Web APIs
obsolete initial definition ...
CSSPrimitiveValue.setStringValue() - Web APIs
obsolete initial definition ...
CSSPseudoElement - Web APIs
sters an event handler of a specific event type on the pseudo-element. eventtarget.dispatchevent() dispatches an event to this pseudo-element. eventtarget.removeeventlistener() removes an event listener from the pseudo-element. examples basic example using element.pseudo using pseudo-elements, most modern browsers will automatically add quotation marks around text inside a <q> element. (a style rule may be needed to add quotation marks in older browsers.) the example below demonstrates the basic properties of the csspseudoelement object representing the opening quotation mark. const element = document.queryselector('q'); const csspseudoelement = element.pseudo('::before'); console.log(csspseudoelement.element); // outputs [object htmlquoteelement] console.log(csspseudoelement.type); //...
CSSUnitValue - Web APIs
properties cssunitvalue.value returns a double indicating the number of units. cssunitvalue.unit returns a usvstring indicating the type of unit. event handlers none. methods none. examples the following shows a method of creating a csspositionvalue from individual cssunitvalue constructors. ...
CSSValue.cssText - Web APIs
Web › API › CSSValue › cssText
the csstext property of the cssvalue interface represents the current computed css property value. syntax csstext = cssvalue.csstext; value a domstring representing the current css property value. example var styledeclaration = document.stylesheets[0].cssrules[0].style; var cssvalue = styledeclaration.getpropertycssvalue("color"); console.log(cssvalue.csstext); specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssvalue.csstext' in that specification. obsolete initial definition ...
CSSValue.cssValueType - Web APIs
e is a primitive value and an instance of the cssprimitivevalue interface can be obtained by using binding-specific casting methods on this instance of the cssvalue interface. css_value_list the value is a cssvalue list and an instance of the cssvaluelist interface can be obtained by using binding-specific casting methods on this instance of the cssvalue interface. example var styledeclaration = document.stylesheets[0].cssrules[0].style; var cssvalue = styledeclaration.getpropertycssvalue("color"); console.log(cssvalue.cssvaluetype); specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssvalue.cssvaluetype' in that specification. obsolete initial definition ...
CSSValue - Web APIs
Web › API › CSSValue
ding-specific casting methods on this instance of the cssvalue interface. css_value_list the value is a cssvalue list and an instance of the cssvaluelist interface can be obtained by using binding-specific casting methods on this instance of the cssvalue interface. specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssvalue' in that specification. obsolete initial definition ...
CSSValueList.item() - Web APIs
Web › API › CSSValueList › item
the item() method of the cssvaluelist interface is used to retrieve a cssvalue by ordinal index. the order in this collection represents the order of the values in the css style property. if the index is greater than or equal to the number of values in the list, this method returns null. syntax var cssvalue = cssvaluelist.item(index); parameters index an unsigned long representing the index of the css value within the collection. return value a cssvalue object at the index position in the cssvaluelist, or null if that is not a valid index. specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssvaluelist.item' in that specification. obsolete initial definition ...
CSSValueList.length - Web APIs
the length read-only property of the cssvaluelist interface represents the number of cssvalues in the list. the range of valid values of the indices is 0 to length-1 inclusive. syntax var length = cssvaluelist.length; value an unsigned long representing the number of cssvalues. specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssvaluelist.length' in that specification. obsolete initial definition ...
Cache.addAll() - Web APIs
Web › API › Cache › addAll
, then runs waituntil() to handle the install process for the app. this consists of calling cachestorage.open to create a new cache, then using addall() to add a series of assets to it. ...
CacheStorage.open() - Web APIs
Web › API › CacheStorage › open
uns waituntil() to handle the install process for the app. this consists of calling cachestorage.open() to create a new cache, then using cache.addall() to add a series of assets to it. ...
CacheStorage - Web APIs
)).) if this fails (e.g. because the network is down), return a fallback response. finally, return whatever the custom response ended up being equal to, using fetchevent.respondwith. ...
CanvasGradient.addColorStop() - Web APIs
add stops to a linear canvasgradient object. the gradient is then used to fill a rectangle. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); let gradient = ctx.createlineargradient(0, 0, 200, 0); gradient.addcolorstop(0, 'green'); gradient.addcolorstop(.7, 'white'); gradient.addcolorstop(1, 'pink'); ctx.fillstyle = gradient; ctx.fillrect(10, 10, 200, 100); result specifications specification status comment html living standardthe definition of 'canvasgradient.addcolorstop' in that specification. living standard ...
CanvasImageSource - Web APIs
it’s just an internal helper type to simplify the specification. it’s not an interface and there are no objects implementing it. ...
CanvasRenderingContext2D.addHitRegion() - Web APIs
compatibility table to see if your current browser supports hit regions already; you might need to activate a preference.) playable code <canvas id="canvas" width="400" height="200" class="playable-canvas"></canvas> <div class="playable-buttons"> <input id="edit" type="button" value="edit" /> <input id="reset" type="button" value="reset" /> </div> <textarea id="code" class="playable-code" style="height:250px"> ctx.beginpath(); ctx.arc(100, 100, 75, 0, 2 * math.pi, false); ctx.linewidth = 5; ctx.stroke(); // eyes ctx.beginpath(); ctx.arc(70, 80, 10, 0, 2 * math.pi, false); ctx.arc(130, 80, 10, 0, 2 * math.pi, false); ctx.fill(); ctx.addhitregion({id: "eyes"}); // mouth ctx.beginpath(); ctx.arc(100, 110, 50, 0, math.pi, false); ctx.stroke();</textarea> var canvas = document.getelement...
CanvasRenderingContext2D.beginPath() - Web APIs
; examples creating distinct paths this example creates two paths, each of which contains a single line. html <canvas id="canvas"></canvas> javascript the beginpath() method is called before beginning each line, so that they may be drawn with different colors. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // first path ctx.beginpath(); ctx.strokestyle = 'blue'; ctx.moveto(20, 20); ctx.lineto(200, 20); ctx.stroke(); // second path ctx.beginpath(); ctx.strokestyle = 'green'; ctx.moveto(20, 20); ctx.lineto(120, 120); ctx.stroke(); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.beginpath' in that specification. living standard ...
CanvasRenderingContext2D.bezierCurveTo() - Web APIs
byid('canvas'); const ctx = canvas.getcontext('2d'); // define the points as {x, y} let start = { x: 50, y: 20 }; let cp1 = { x: 230, y: 30 }; let cp2 = { x: 150, y: 80 }; let end = { x: 250, y: 100 }; // cubic bézier curve ctx.beginpath(); ctx.moveto(start.x, start.y); ctx.beziercurveto(cp1.x, cp1.y, cp2.x, cp2.y, end.x, end.y); ctx.stroke(); // start and end points ctx.fillstyle = 'blue'; ctx.beginpath(); ctx.arc(start.x, start.y, 5, 0, 2 * math.pi); // start point ctx.arc(end.x, end.y, 5, 0, 2 * math.pi); // end point ctx.fill(); // control points ctx.fillstyle = 'red'; ctx.beginpath(); ctx.arc(cp1.x, cp1.y, 5, 0, 2 * math.pi); // control point one ctx.arc(cp2.x, cp2.y, 5, 0, 2 * math.pi); // control point two ctx.fill(); result in this example, the control p...
CanvasRenderingContext2D.drawImage() - Web APIs
zero. invalid_state_err the image has no image data. type_mismatch_err the specified source element isn't supported. ns_error_not_available the image is not loaded yet. use .complete === true and .onload to determine when it is ready. examples drawing an image to the canvas this example draws an image to the canvas using the drawimage() method. html <canvas id="canvas"></canvas> <div style="display:none;"> <img id="source" src="https://udn.realityripple.com/samples/db/f374e9c6fc.jpg" width="300" height="227"> </div> javascript the source image is taken from the coordinates (33, 71), with a width of 104 and a height of 124. it is drawn to the canvas at (21, 20), where it is given a width of 87 and a height of 104. const canvas = document.getelementbyid('canvas');...
CanvasRenderingContext2D.drawWindow() - Web APIs
uld be drawn with a transparent background (which would be slower). it is usually a bad idea to use any background other than pure white "rgb(255,255,255)" or transparent, as this is what all browsers do, and many websites expect that transparent parts of their interface will be drawn on white background. with this method, it is possible to fill a hidden iframe with arbitrary content (e.g., css-styled html text, or svg) and draw it into a canvas. it will be scaled, rotated and so on according to the current transformation. ted mielczarek's tab preview extension uses this technique in chrome to provide thumbnails of web pages, and the source is available for reference. specifications not part of any current specification or draft. this is a non-standard and internal only api. ...
CanvasRenderingContext2D.fillText() - Web APIs
an optional parameter allows specifying a maximum width for the rendered text, which the user agent will achieve by condensing the text or by using a lower font size. this method draws directly to the canvas without modifying the current path, so any subsequent fill() or stroke() calls will have no effect on it. ...
CanvasRenderingContext2D.filter - Web APIs
script const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.filter = 'blur(4px)'; ctx.font = '48px serif'; ctx.filltext('hello world', 50, 100); result applying multiple filters you can combine as many filters as you like. this example applies the contrast, sepia, and drop-shadow filters to a photo of a gecko. ...
CanvasRenderingContext2D.font - Web APIs
this string uses the same syntax as the css font specifier. syntax ctx.font = value; options value a domstring parsed as css font value. the default font is 10px sans-serif. examples using a custom font in this example we use the font property to specify a custom font weight, size, and family. ...
CanvasRenderingContext2D.globalCompositeOperation - Web APIs
or blending mode operations to use. types examples changing the composite operation this example uses the globalcompositeoperation property to draw two rectangles that exclude themselves where they overlap. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.globalcompositeoperation = 'xor'; ctx.fillstyle = 'blue'; ctx.fillrect(10, 10, 100, 100); ctx.fillstyle = 'red'; ctx.fillrect(50, 50, 100, 100); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.globalcompositeoperation' in that specification. living standard compositing and blending level 1 candidate recommendation ...
CanvasRenderingContext2D.lineDashOffset - Web APIs
lines. the first has no dash offset. the second has a dash offset of 4. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.setlinedash([4, 16]); // dashed line with no offset ctx.beginpath(); ctx.moveto(0, 50); ctx.lineto(300, 50); ctx.stroke(); // dashed line with offset of 4 ctx.beginpath(); ctx.strokestyle = 'red'; ctx.linedashoffset = 4; ctx.moveto(0, 100); ctx.lineto(300, 100); ctx.stroke(); result the line with a dash offset is drawn in red. marching ants the marching ants effect is an animation technique often found in selection tools of computer graphics programs. it helps the user to distinguish the selection border from the image background by animating the border. html <canvas id=...
CanvasRenderingContext2D.lineWidth - Web APIs
a rectangle, using a line width of 15 units. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.linewidth = 15; ctx.beginpath(); ctx.moveto(20, 20); ctx.lineto(130, 130); ctx.rect(40, 40, 70, 70); ctx.stroke(); result more examples for more examples and explanation about this property, see applying styles and color in the canvas tutorial. specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.linewidth' in that specification. living standard ...
CanvasRenderingContext2D.miterLimit - Web APIs
the canvasrenderingcontext2d.miterlimit property of the canvas 2d api sets the miter limit ratio. for more info about miters, see applying styles and color in the canvas tutorial. syntax ctx.miterlimit = value; options value a number specifying the miter limit ratio, in coordinate space units. zero, negative, infinity, and nan values are ignored. the default value is 10.0. examples using the miterlimit property see the chapter applying styles and color in the canvas tutorial for more information. playable code <canvas id="canvas" width="400" height="200" class="playable-canvas"></canvas> <div class="playable-buttons"> <input id="edit" type="button" value="edit" /> <input id="reset" type="button" value="reset" /> </div> <textarea id="code" class="playable-code"> ctx.beginpa...
CanvasRenderingContext2D.putImageData() - Web APIs
idth; dirtyx = dirtyx || 0; dirtyy = dirtyy || 0; dirtywidth = dirtywidth !== undefined? dirtywidth: width; dirtyheight = dirtyheight !== undefined? ...
CanvasRenderingContext2D.quadraticCurveTo() - Web APIs
end point. examples how quadraticcurveto works this example shows how a quadratic bézier curve is drawn. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // quadratic bézier curve ctx.beginpath(); ctx.moveto(50, 20); ctx.quadraticcurveto(230, 30, 50, 100); ctx.stroke(); // start and end points ctx.fillstyle = 'blue'; ctx.beginpath(); ctx.arc(50, 20, 5, 0, 2 * math.pi); // start point ctx.arc(50, 100, 5, 0, 2 * math.pi); // end point ctx.fill(); // control point ctx.fillstyle = 'red'; ctx.beginpath(); ctx.arc(230, 30, 5, 0, 2 * math.pi); ctx.fill(); result in this example, the control point is red and the start and end points are blue. a simple quadratic curve this example draws a simple q...
CanvasRenderingContext2D.resetTransform() - Web APIs
resettransform() before rendering anything else. in this example, the first two shapes are drawn with a skew transformation, and the last two are drawn with the identity (regular) transformation. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // skewed rectangles ctx.transform(1, 0, 1.7, 1, 0, 0); ctx.fillstyle = 'gray'; ctx.fillrect(40, 40, 50, 20); ctx.fillrect(40, 90, 50, 20); // non-skewed rectangles ctx.resettransform(); ctx.fillstyle = 'red'; ctx.fillrect(40, 40, 50, 20); ctx.fillrect(40, 90, 50, 20); result the skewed rectangles are gray, and the non-skewed rectangles are red. polyfill you can also use the settransform() method to reset the current transform to the identity matrix, like so...
CanvasRenderingContext2D.restore() - Web APIs
ctx.restore(); examples restoring a saved state this example uses the save() method to save the default state and restore() to restore it later, so that you are able to draw a rect with the default state later. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // save the default state ctx.save(); ctx.fillstyle = 'green'; ctx.fillrect(10, 10, 100, 100); // restore the default state ctx.restore(); ctx.fillrect(150, 40, 100, 100); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.restore' in that specification. living standard ...
CanvasRenderingContext2D.scale() - Web APIs
he transformation matrix scales it by 9x horizontally and by 3x vertically. thus, its final size is a width of 72 and a height of 60. notice that its position on the canvas also changes. since its specified corner is (10, 10), its rendered corner becomes (90, 30). const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // scaled rectangle ctx.scale(9, 3); ctx.fillstyle = 'red'; ctx.fillrect(10, 10, 8, 20); // reset current transformation matrix to the identity matrix ctx.settransform(1, 0, 0, 1, 0, 0); // non-scaled rectangle ctx.fillstyle = 'gray'; ctx.fillrect(10, 10, 8, 20); result the scaled rectangle is red, and the non-scaled rectangle is gray. flipping things horizontally or vertically you can use scale(-1, 1) to flip the context horizontally an...
CanvasRenderingContext2D.shadowBlur - Web APIs
nored. examples adding a shadow to a shape this example adds a blurred shadow to a rectangle. the shadowcolor property sets its color, and shadowblur sets its level of bluriness. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // shadow ctx.shadowcolor = 'red'; ctx.shadowblur = 15; // rectangle ctx.fillstyle = 'blue'; ctx.fillrect(20, 20, 150, 100); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.shadowblur' in that specification. living standard ...
CanvasRenderingContext2D.shadowOffsetX - Web APIs
adow to a rectangle. the shadowcolor property sets its color, shadowoffsetx sets its offset 25 units to the right, and shadowblur gives it a blur level of 10. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // shadow ctx.shadowcolor = 'red'; ctx.shadowoffsetx = 25; ctx.shadowblur = 10; // rectangle ctx.fillstyle = 'blue'; ctx.fillrect(20, 20, 150, 100); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.shadowoffsetx' in that specification. living standard ...
CanvasRenderingContext2D.shadowOffsetY - Web APIs
o a rectangle. the shadowcolor property sets its color, shadowoffsety sets its offset 25 units towards the bottom, and shadowblur gives it a blur level of 10. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // shadow ctx.shadowcolor = 'red'; ctx.shadowoffsety = 25; ctx.shadowblur = 10; // rectangle ctx.fillstyle = 'blue'; ctx.fillrect(20, 20, 150, 80); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.shadowoffsety' in that specification. living standard ...
CanvasRenderingContext2D.textBaseline - Web APIs
c". examples comparison of property values this example demonstrates the various textbaseline property values. ...
CanvasRenderingContext2D.translate() - Web APIs
square of the same size is then drawn for comparison. html <canvas id="canvas"></canvas> javascript the translate() method translates the context by 110 horizontally and 30 vertically. the first square is shifted by those amounts from its default position. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // moved square ctx.translate(110, 30); ctx.fillstyle = 'red'; ctx.fillrect(0, 0, 80, 80); // reset current transformation matrix to the identity matrix ctx.settransform(1, 0, 0, 1, 0, 0); // unmoved square ctx.fillstyle = 'gray'; ctx.fillrect(0, 0, 80, 80); result the moved square is red, and the unmoved square is gray. specifications specification status comment html living standardthe definition of 'canvasrenderin...
Compositing and clipping - Web APIs
var ctx = document.getelementbyid('canvas').getcontext('2d'); ctx.fillrect(0, 0, 150, 150); ctx.translate(75, 75); // create a circular clipping path ctx.beginpath(); ctx.arc(0, 0, 60, 0, math.pi * 2, true); ctx.clip(); // draw background var lingrad = ctx.createlineargradient(0, -75, 0, 75); lingrad.addcolorstop(0, '#232256'); lingrad.addcolorstop(1, '#143778'); ctx.fillstyle = lingrad; ctx.fillrect(-75, -75, 150, 150); // draw stars for (var j = 1; j < 50; j++) { ctx.save(); ctx.fillstyle = '#fff'; ctx.translate(75 - math.floor(math.random() * 150), 75 - math.floor(math.random() * 150)); drawstar(ctx, math.floor(math.random() * 4) + 2); ctx.restore(); } } function drawstar(ctx, r) { ctx.save(); ctx.beginpath(); c...
Canvas tutorial - Web APIs
me older browsers, but is supported in recent versions of all major browsers. the default size of the canvas is 300 pixels × 150 pixels (width × height). ...
DOMException - Web APIs
constructor domexception() returns a domexception object with a specified message and name. ...
DataTransfer.setData() - Web APIs
ype of the drag data to add to the drag object. data a domstring representing the data to add to the drag object. return value void example this example shows the use of the datatransfer object's getdata(), setdata() and cleardata() methods. <!doctype html> <html lang=en> <title>examples of datatransfer's setdata(), getdata() and cleardata()</title> <meta content="width=device-width"> <style> div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> <script> function dragstart_handler(ev) { console.log("dragstart"); // change the source element's background color to signify drag has started ev.currenttarget.style.border = "dashed"; // set the drag's format and data. use the ev...
DataTransfer.setDragImage() - Web APIs
this example shows how to use the setdragimage() method. note the example refers to an image file named example.gif. if that file is present, it will be used as the drag image and if that file is not present, the browser will use its default drag image. demo <!doctype html> <html lang=en> <title>example of datatransfer.setdragimage()</title> <meta name="viewport" content="width=device-width"> <style> div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> <script> function dragstart_handler(ev) { console.log("dragstart"); // set the drag's format and data. use the event target's id for the data ev.datatransfer.setdata("text/plain", ev.target.id); // create an image and use it for th...
DataTransferItem.webkitGetAsEntry() - Web APIs
g a hierarchical directory listing. html content the html establishes the drop zone itself, which is a <div> element with the id "dropzone", and an unordered list element with the id "listing". <p>drag files and/or directories to the box below!</p> <div id="dropzone"> <div id="boxtitle"> drop files here </div> </div> <h2>directory tree:</h2> <ul id="listing"> </ul> css content the styles used by the example are shown here. #dropzone { text-align: center; width: 300px; height: 100px; margin: 10px; padding: 10px; border: 4px dashed red; border-radius: 10px; } #boxtitle { display: table-cell; vertical-align: middle; text-align: center; color: black; font: bold 2em "arial", sans-serif; width: 300px; height: 100px; } body { font: 14px "arial", sans-se...
DataTransferItemList.DataTransferItem() - Web APIs
syntax dataitem = datatransferitem[index]; parameters index the zero-based index of the item in the drag data list to return. return value the datatransferitem object at the specified index in the item list. if the index is less than zero or greater than or equal to the number of items in the list (as indicated by the list's length property, undefined is returned. the returned value is never null. example this example shows how to use drag and drop. ...
Using light sensors - Web APIs
treated as shown below. 10 ~ 50 lux : dim environment 100 ~ 1000 lux : normal > 10000 lux : bright it uses the addeventlistener method of the window object. window.addeventlistener("devicelight", function (event) { // read out the lux value var luminosity = event.value; alert(luminosity); }); example: window.addeventlistener('devicelight', function(event) { var bodybg= document.body.style; //event.value is the lux value returned by the sensor on the device if (event.value < 100) { alert('hey, you! you are working in a dark environment'); bodybg.backgroundcolor="lightgrey"; } else { bodybg.backgroundcolor="#fff"; } }); this example shows how the api can actually be used in the wild. if your app contains a lot of white in the ui, it is usually beneficial to the user to chang...
Document.bgColor - Web APIs
Web › API › Document › bgColor
lor = document.bgcolor document.bgcolor =color parameters color is a string representing the color as a word (e.g., "red") or hexadecimal value (e.g., "#ff0000"). example document.bgcolor = "darkblue"; notes the default value for this property in firefox is white (#ffffff in hexadecimal). document.bgcolor is deprecated in dom level 2 html. the recommended alternative is use of the css style background-color which can be accessed through the dom with document.body.style.backgroundcolor. another alternative is document.body.bgcolor, although this is also deprecated in html 4.01 in favor of the css alternative. ...
Document.fgColor - Web APIs
Web › API › Document › fgColor
lor is a string representing the color as a word (e.g., "red") or hexadecimal value (e.g., "#ff0000"). example document.fgcolor = "white"; document.bgcolor = "darkblue"; notes the default value for this property in mozilla firefox is black (#000000 in hexadecimal). document.fgcolor is deprecated in dom level 2 html. the recommended alternative is the css property color (e.g., document.body.style.color = "red"). another alternative is document.body.text, although this is deprecated in html 4.01 in favor of the css alternative above. ...
Document.getElementById() - Web APIs
or null if no matching element was found in the document. example html <html> <head> <title>getelementbyid example</title> </head> <body> <p id="para">some text here</p> <button onclick="changecolor('blue');">blue</button> <button onclick="changecolor('red');">red</button> </body> </html> javascript function changecolor(newcolor) { var elem = document.getelementbyid('para'); elem.style.color = newcolor; } result usage notes the capitalization of "id" in the name of this method must be correct for the code to function; getelementbyid() is not valid and will not work, however natural it may seem. unlike some other element-lookup methods such as document.queryselector() and document.queryselectorall(), getelementbyid() is only available as a method of the global document obj...
Document.getElementsByClassName() - Web APIs
ample document.getelementsbyclassname works very similarly to document.queryselector and document.queryselectorall. only elements with all of the classnames specified are selected. ...
Document.getElementsByTagName() - Web APIs
div1paras = div1.getelementsbytagname('p'); var num = div1paras.length; alert('there are ' + num + ' paragraph in #div1'); } function div2paraelems() { var div2 = document.getelementbyid('div2'); var div2paras = div2.getelementsbytagname('p'); var num = div2paras.length; alert('there are ' + num + ' paragraph in #div2'); } </script> </head> <body style="border: solid green 3px"> <p>some outer text</p> <p>some outer text</p> <div id="div1" style="border: solid blue 3px"> <p>some div1 text</p> <p>some div1 text</p> <p>some div1 text</p> <div id="div2" style="border: solid red 3px"> <p>some div2 text</p> <p>some div2 text</p> </div> </div> <p>some outer text</p> <p>some outer text</p> <button oncli...
Document.getElementsByTagNameNS() - Web APIs
l", "p"); var num = div1paras.length; alert("there are " + num + " &lt;p&gt; elements in div1 element"); } function div2paraelems() { var div2 = document.getelementbyid("div2") var div2paras = div2.getelementsbytagnamens("http://www.w3.org/1999/xhtml", "p"); var num = div2paras.length; alert("there are " + num + " &lt;p&gt; elements in div2 element"); } </script> </head> <body style="border: solid green 3px"> <p>some outer text</p> <p>some outer text</p> <div id="div1" style="border: solid blue 3px"> <p>some div1 text</p> <p>some div1 text</p> <p>some div1 text</p> <div id="div2" style="border: solid red 3px"> <p>some div2 text</p> <p>some div2 text</p> </div> </div> <p>some outer text</p> <p>some outer text</p> <button onclick="getallpara...
Document: wheel event - Web APIs
wor...
DocumentOrShadowRoot.elementFromPoint() - Web APIs
vertical coordinate of a point, relative to the top edge of the current viewport. return value the topmost element object located at the specified coordinates. example this example creates two buttons which let you set the current color of the paragraph element located under the coordinates (2, 2). javascript function changecolor(newcolor) { elem = document.elementfrompoint(2, 2); elem.style.color = newcolor; } the changecolor() method simply obtains the element located at the specified point, then sets that element's current foreground color property to the color specified by the newcolor parameter. html <p id="para1">some text here</p> <button onclick="changecolor('blue');">blue</button> <button onclick="changecolor('red');">red</button> the html provides the paragraph whose c...
DocumentOrShadowRoot.elementsFromPoint() - Web APIs
obsolete css object model (cssom) view modulethe definition of 'elementsfrompoint()' in that specification. working draft ...
DocumentOrShadowRoot.nodeFromPoint() - Web APIs
the vertical coordinate of a point. returns a node object. examples html content <div> <p>some text</p> </div> <p>top node at point 30, 20:</p> <div id="output"></div> javascript content var output = document.getelementbyid("output"); if (document.nodefrompoint) { var node = document.nodefrompoint(30, 20); output.textcontent += node.localname; } else { output.innerhtml = "<span style=\"color: red;\">" + "browser does not support <code>document.nodefrompoint()</code>" + "</span>"; } specifications not part of any specification at present. ...
DocumentOrShadowRoot.nodesFromPoint() - Web APIs
...
DocumentOrShadowRoot - Web APIs
has focus. documentorshadowroot.fullscreenelementread only returns the element that's currently in full screen mode for this document. documentorshadowroot.pointerlockelement read only returns the element set as the target for mouse events while the pointer is locked. it returns null if lock is pending, the pointer is unlocked, or if the target is in another document. documentorshadowroot.stylesheetsread only returns a stylesheetlist of cssstylesheet objects for stylesheets explicitly linked into, or embedded in a document. methods documentorshadowroot.caretpositionfrompoint() returns a caretposition object containing the dom node containing the caret, and caret's character offset within that node. documentorshadowroot.elementfrompoint() returns the topmost element at the spec...
Element.attributes - Web APIs
living standard...
Element.classList - Web APIs
Web › API › Element › classList
}, configurable: 0, set: function(val){this.classname = val} }); } catch(e) { // less performant fallback for older browsers (ie 6-8): window[" ucl"] = polyfillclasslist; // the below code ensures polyfillclasslist is applied to all current and future elements in the doc. document.documentelement.firstchild.appendchild(document.createelement('style')).stylesheet.csstext=( '_*{x-uclp:expression(!this.hasownproperty("classlist")&&window[" ucl"](this))}' + // ie6 '[class]{x-uclp/**/:expression(!this.hasownproperty("classlist")&&window[" ucl"](this))}' //ie7-8 ); } })(window); // 3. patch in unsupported methods in domtokenlist (function(domtokenlistproto, testclass){ if (!domtokenlistproto.item) domtoken...
Element.clientTop - Web APIs
Web › API › Element › clientTop
of element. as it happens, all that lies between the two locations (offsettop and client area top) is the element's border. this is because the offsettop indicates the location of the top of the border (not the margin) while the client area starts immediately below the border, (client area includes padding.) therefore, the clienttop value will always equal the integer portion of the .getcomputedstyle() value for "border-top-width". (actually might be math.round(parsefloat()).) for example, if the computed "border-top-width" is zero, then clienttop is also zero. note: this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). gecko-based applications support clienttop starting with gecko 1.9 (firefox 3, implemented in bug 111207).
Element.innerHTML - Web APIs
Web › API › Element › innerHTML
xelem.addeventlistener("mouseleave", logevent); html the html is quite simple for our example. <div class="box"> <div><strong>log:</strong></div> <div class="log"></div> </div> the <div> with the class "box" is just a container for layout purposes, presenting the contents with a box around it. the <div> whose class is "log" is the container for the log text itself. css the following css styles our example content. .box { width: 600px; height: 300px; border: 1px solid black; padding: 2px 4px; overflow-y: scroll; overflow-x: auto; } .log { margin-top: 8px; font-family: monospace; } result the resulting content looks like this. you can see output into the log by moving the mouse in and out of the box, clicking in it, and so forth. specification specificat...
Element.localName - Web APIs
Web › API › Element › localName
qualified names are typically used in xml as part of the namespace(s) of the particular xml documents. for example, in the qualified name ecomm:partners, partners is the local name and ecomm is the...
Element: mousedown event - Web APIs
working draft document object model (dom) level 3 events specificationthe definition of 'mousedown' in that specificati...
Element: mousemove event - Web APIs
working draft document object model (dom) level 3 events specificationthe definition of 'mousemove' in that specificati...
Element: mouseup event - Web APIs
working draft document object model (dom) level 3 events specificationthe definition of 'mouseup' in that specification. ...
Element.part - Web APIs
Web › API › Element › part
syntax let elementpartlist = element.part examples the following excerpt is from our shadow-part example. here the part attribute is used to find the shadow parts, and the part property is then used to change the part identifiers of each tab so the correct styling is applied to the active tab when tabs are clicked. ...
Element.releasePointerCapture() - Web APIs
recommendation non-stable version. pointe...
Element.scrollHeight - Web APIs
border-bottom problems and solutions determine if an element has been totally scrolled the following equivalence returns true if an element is at the end of its scroll, false if it isn't. element.scrollheight - element.scrolltop === element.clientheight when the container does not scroll, but has overflowing children, these checks determine if the container can scroll: window.getcomputedstyle(element).overflowy === 'visible' window.getcomputedstyle(element).overflowy !== 'hidden' scrollheight demo associated with the onscroll event, this equivalence can be useful to determine whether a user has read a text or not (see also the element.scrolltop and element.clientheight properties). for example: html <form name="registration"> <p> <textarea id="rules">lorem ipsum dolor sit a...
Element.setPointerCapture() - Web APIs
recommendation non-stable version. pointe...
Element: wheel event - Web APIs
working dra...
Event.currentTarget - Web APIs
the element to which the event handler has been attached, as opposed to event.target, which identifies the element on which the event occurred and which may be its descendant. syntax var currenteventtarget = event.currenttarget; value eventtarget examples event.currenttarget is interesting to use when attaching the same event handler to several elements. ...
Event.target - Web APIs
Web › API › Event › target
n. // make a list const ul = document.createelement('ul'); document.body.appendchild(ul); const li1 = document.createelement('li'); const li2 = document.createelement('li'); ul.appendchild(li1); ul.appendchild(li2); function hide(evt) { // e.target refers to the clicked <li> element // this is different than e.currenttarget, which would refer to the parent <ul> in this context evt.target.style.visibility = 'hidden'; } // attach the listener to the list // it will fire when each <li> is clicked ul.addeventlistener('click', hide, false); specifications specification status comment domthe definition of 'event.target' in that specification. living standard dom4the definition of 'event.target' in that specification. obsolete do...
ExtendableEvent.waitUntil() - Web APIs
was fixed in firefox 43 (see bug 1180274). syntax extendableevent.waituntil(promise); parameters a promise. return value undefined. example using waituntil() within a service worker's install event: addeventlistener('install', event => { const precache = async () => { const cache = await caches.open('static-v1'); return cache.addall([ '/', '/about/', '/static/styles.css' ]); }; event.waituntil(precache()); }); specifications specification status comment service workersthe definition of 'waituntil()' in that specification. working draft initial definition ...
File.mozFullPath - Web APIs
Web › API › File › mozFullPath
it is not available to web content. ...
FileReader.readAsBinaryString() - Web APIs
re-introduced for backward compatibility. using filereader.readasarraybuffer() is recommended. syntax instanceoffilereader.readasbinarystring(blob); parameters blob the blob or file from which to read. ...
FileSystemDirectoryReader.readEntries() - Web APIs
g a hierarchical directory listing. html content the html establishes the drop zone itself, which is a <div> element with the id "dropzone", and an unordered list element with the id "listing". <p>drag files and/or directories to the box below!</p> <div id="dropzone"> <div id="boxtitle"> drop files here </div> </div> <h2>directory tree:</h2> <ul id="listing"> </ul> css content the styles used by the example are shown here. #dropzone { text-align: center; width: 300px; height: 100px; margin: 10px; padding: 10px; border: 4px dashed red; border-radius: 10px; } #boxtitle { display: table-cell; vertical-align: middle; text-align: center; color: black; font: bold 2em "arial", sans-serif; width: 300px; height: 100px; } body { font: 14px "arial", sans-se...
FontFace.stretch - Web APIs
Web › API › FontFace › stretch
the stretch property of the fontface interface retrieves or sets how the font stretches. it is equivalent to the font-stretch descriptor. syntax var stretchdescriptor = fontface.stretch; fontface.stretch = stretchdescriptor; value a cssomstring containing a descriptor as it would be defined in a style sheet's @font-face rule. specifications specification status comment css font loading module level 3the definition of 'stretch' in that specification. working draft initial definition. ...
FontFace.unicodeRange - Web APIs
the unicoderange property of the fontface interface retrieves or sets the range of unicode codepoints encompassing the font. it is equivalent to the unicode-range descriptor. syntax var unicoderangedescriptor = fontface.unicoderange; fontface.unicoderange = unicoderangedescriptor; value a cssomstring containing a descriptor as it would appear in a style sheet's @font-face rule. specifications specification status comment css font loading module level 3the definition of 'unicoderange' in that specification. working draft initial definition. ...
FontFace.variant - Web APIs
Web › API › FontFace › variant
the variant property of the fontface interface programatically retrieves or sets font variant values. it is equivalent to the font-variant descriptor. syntax var variantsubproperty = fontface.variant; fontface.variant = variantsubproperty; value a cssomstring containing a descriptor as it would be defined in a style sheet's @font-face rule. specifications specification status comment css font loading module level 3the definition of 'variant' in that specification. working draft initial definition. ...
FontFace.weight - Web APIs
Web › API › FontFace › weight
the weight property of the fontface interface retrieves or sets the weight of the font. it is equivalent to the font-weight descriptor. syntax var weightdescriptor = fontface.weight; fontface.weight = weightdescriptor; value a cssomstring containing a descriptor as it would be defined in a style sheet's @font-face rule. specifications specification status comment css font loading module level 3the definition of 'weight' in that specification. working draft initial definition. ...
FontFace - Web APIs
Web › API › FontFace
fontface object when the font specified in the object's constructor is done loading or rejects with a syntaxerror. fontface.status read only returns an enumerated value indicating the status of the font, one of "unloaded", "loading", "loaded", or "error". fontface.stretch a cssomstring that retrieves or sets how the font stretches. it is equivalent to the font-stretch descriptor. fontface.style a cssomstring that retrieves or sets the style of the font. it is equivalent to the font-style descriptor. fontface.unicoderange a cssomstring that retrieves or sets the range of unicode codepoints encompassing the font. it is equivalent to the unicode-range descriptor. fontface.variant a cssomstring that retrieves or sets the variant of the font. it is equivalent to the font-variant descrip...
GlobalEventHandlers.onauxclick - Web APIs
s in action by trying the demo out with a multi-button mouse (see it live on github; also see the source code). var button = document.queryselector('button'); var html = document.queryselector('html'); function random(number) { return math.floor(math.random() * number); } button.onclick = function() { var rndcol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')'; button.style.backgroundcolor = rndcol; }; button.onauxclick = function() { var rndcol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')'; button.style.color = rndcol; } note: if you are using a three-button mouse, you'll notice that the onauxclick handler is run when either of the non-left mouse buttons are clicked. specifications specification status comment ...
GlobalEventHandlers.onclick - Web APIs
se the eventtarget.addeventlistener() method instead, since it's more flexible. examples detecting clicks this example simply changes the color of an element when it's clicked upon. html <div id="demo">click here</div> javascript document.getelementbyid('demo').onclick = function changecontent() { document.getelementbyid('demo').innerhtml = "help me"; document.getelementbyid('demo').style = "color: red"; } result getting the coordinates of clicks this example displays the coordinates at which the most recent mouse button click occurred. html <p>click anywhere in this example.</p> <p id="log"></p> javascript let log = document.getelementbyid('log'); document.onclick = inputchange; function inputchange(e) { log.textcontent = `position: (${e.clientx}, ${e.clienty})`; } ...
GlobalEventHandlers.onmousedown - Web APIs
s="view" hidden></div> <img src="https://udn.realityripple.com/samples/90/a34a525ace.jpg"> </div> css .container { width: 320px; height: 213px; background: black; } .view { position: absolute; width: 100px; height: 100px; background: white; border-radius: 50%; } img { mix-blend-mode: darken; } javascript function showview(event) { view.removeattribute('hidden'); view.style.left = event.clientx - 50 + 'px'; view.style.top = event.clienty - 50 + 'px'; event.preventdefault(); } function moveview(event) { view.style.left = event.clientx - 50 + 'px'; view.style.top = event.clienty - 50 + 'px'; } function hideview(event) { view.setattribute('hidden', ''); } const container = document.queryselector('.container'); const view = document.queryselector('.view'); ...
GlobalEventHandlers.onmousemove - Web APIs
ip; or here!</a></p> css .tooltip { position: absolute; z-index: 9999; padding: 6px; background: #ffd; border: 1px #886 solid; border-radius: 5px; } javascript const tooltip = new (function() { const node = document.createelement('div'); node.classname = 'tooltip'; node.setattribute('hidden', ''); document.body.appendchild(node); this.follow = function(event) { node.style.left = event.clientx + 20 + 'px'; node.style.top = event.clienty + 10 + 'px'; }; this.show = function(event) { node.textcontent = event.target.dataset.tooltip; node.removeattribute('hidden'); }; this.hide = function() { node.setattribute('hidden', ''); }; })(); const links = document.queryselectorall('a'); links.foreach(link => { link.onmouseover = tooltip.show; ...
GlobalEventHandlers.onwheel - Web APIs
living standard ...
HTMLBaseFontElement - Web APIs
ements htmlunknownelement rather than htmlbasefontelement. properties inherits properties from its parent, htmlelement. htmlbasefontelement.color is a domstring representing the text color using either a named color or a color specified in the hexadecimal #rrggbb format. htmlbasefontelement.face is a domstring representing a list of one or more font names. the document text in the default style is rendered in the first font face that the client's browser supports. if no font listed is installed on the local system, the browser typically defaults to the proportional or fixed-width font for that system. htmlbasefontelement.size is a domstring representing the font size as either a numeric or relative value. numeric values range from 1 to 7 with 1 being the smallest and 3 the default. re...
HTMLCanvasElement.mozFetchAsStream() - Web APIs
t only) this technique also converts it to ico, however it will not work in windows xp as winxp cannot convert from png to ico. it saves to the desktop it uses fileutils.jsm. ...
HTMLCollection - Web APIs
). this is mostly useful for non-javascript dom implementations. usage in javascript htmlcollection also exposes its members directly as properties by both name and index. html ids may contain : and . as valid characters, which would necessitate using bracket notation for property access. currently htmlcollections does not recognize purely numeric ids, which would cause conflict with the array-style access, though html5 does permit these. for example, assuming there is one <form> element in the document and its id is myform: var elem1, elem2; // document.forms is an htmlcollection elem1 = document.forms[0]; elem2 = document.forms.item(0); alert(elem1 === elem2); // shows: "true" elem1 = document.forms.myform; elem2 = document.forms.nameditem("myform"); alert(elem1 === elem2); // shows...
HTMLElement.hidden - Web APIs
elcome panel, the javascript code swaps the two panels by changing their respective values for hidden. the follow-up panel looks like this in html: <div id="awesome" class="panel" hidden> <h1>thanks!</h1> <p>thank you <strong>so</strong> much for agreeing to be awesome today! now get out there and do awesome things awesomely to make the world more awesome!</p> </div> css the content is styled using the css below. .panel { font: 16px "open sans", helvetica, arial, sans-serif; border: 1px solid #22d; padding: 12px; width: 500px; text-align: center; } .button { font: 22px "open sans", helvetica, arial, sans-serif; padding: 5px 36px; } h1 { margin-top: 0; font-size: 175%; } result specifications specification status comment html living st...
HTMLElement.offsetHeight - Web APIs
s height, including any borders, padding, and horizontal scrollbars (if rendered). it does not include the height of pseudo-elements such as ::before or ::after. for the document body object, the measurement includes total linear content height instead of the element's css height. floated elements extending below other linear content are ignored. if the element is hidden (for example, by setting style.display on the element or one of its ancestors to "none"), then 0 is returned. this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). syntax var intelemoffsetheight = element.offsetheight; intelemoffsetheight is a variable storing an integer corresponding to the offsetheight pixel value of the element. the offsetheight property...
HTMLElement.offsetWidth - Web APIs
the htmlelement.offsetwidth read-only property returns the layout width of an element as an integer. typically, offsetwidth is a measurement in pixels of the element's css width, including any borders, padding, and vertical scrollbars (if rendered). it does not include the width of pseudo-elements such as ::before or ::after. if the element is hidden (for example, by setting style.display on the element or one of its ancestors to "none"), then 0 is returned. syntax var intelemoffsetwidth = element.offsetwidth; intelemoffsetwidth is a variable storing an integer corresponding to the offsetwidth pixel value of the element. the offsetwidth property is a read-only. this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). examp...
HTMLElement: transitioncancel event - Web APIs
; transition.addeventlistener('transitioncancel', () => { console.log('transition canceled'); }); the same, but using the ontransitioncancel property instead of addeventlistener(): const transition = document.queryselector('.transition'); transition.ontransitioncancel = () => { console.log('transition canceled'); }; live example in the following example, we have a simple <div> element, styled with a transition that includes a delay: <div class="transition"></div> <div class="message"></div> .transition { width: 100px; height: 100px; background: rgba(255,0,0,1); transition-property: transform background; transition-duration: 2s; transition-delay: 2s; } .transition:hover { transform: rotate(90deg); background: rgba(255,0,0,0); } to this, we'll add some javascript to...
HTMLElement: transitionend event - Web APIs
onst transition = document.queryselector('.transition'); transition.addeventlistener('transitionend', () => { console.log('transition ended'); }); the same, but using the ontransitionend: const transition = document.queryselector('.transition'); transition.ontransitionend = () => { console.log('transition ended'); }; live example in the following example, we have a simple <div> element, styled with a transition that includes a delay: <div class="transition">hover over me</div> <div class="message"></div> .transition { width: 100px; height: 100px; background: rgba(255,0,0,1); transition-property: transform background; transition-duration: 2s; transition-delay: 1s; } .transition:hover { transform: rotate(90deg); background: rgba(255,0,0,0); } to this, we'll add some ...
HTMLElement: transitionrun event - Web APIs
=> { console.log('transition is running but hasn\'t necessarily started transitioning yet'); }); the same, but using the ontransitionrun property instead of addeventlistener(): el.ontransitionrun = () => { console.log('transition started running, and will start transitioning when the transition delay has expired'); }; live example in the following example, we have a simple <div> element, styled with a transition that includes a delay: <div class="transition">hover over me</div> <div class="message"></div> .transition { width: 100px; height: 100px; background: rgba(255,0,0,1); transition-property: transform, background; transition-duration: 2s; transition-delay: 1s; } .transition:hover { transform: rotate(90deg); background: rgba(255,0,0,0); } to this, we'll add some...
HTMLElement: transitionstart event - Web APIs
examples this code adds a listener to the transitionstart event: element.addeventlistener('transitionstart', () => { console.log('started transitioning'); }); the same, but using the ontransitionstart property instead of addeventlistener(): element.ontransitionrun = () => { console.log('started transitioning'); }; live example in the following example, we have a simple <div> element, styled with a transition that includes a delay: <div class="transition">hover over me</div> <div class="message"></div> .transition { width: 100px; height: 100px; background: rgba(255,0,0,1); transition-property: transform, background; transition-duration: 2s; transition-delay: 1s; } .transition:hover { transform: rotate(90deg); background: rgba(255,0,0,0); } to this, we'll add some...
HTMLFontElement.face - Web APIs
if no font listed is installed on the local system, the browser typically defaults to the proportional or fixed-width font for that system. ...
contentDocument - Web APIs
if the iframe and the iframe's parent document are same origin, returns a document (that is, the active document in the inline frame's nested browsing context), else returns null. example of contentdocument var iframedocument = document.getelementsbytagname("iframe")[0].contentdocument; iframedocument.body.style.backgroundcolor = "blue"; // this would turn the iframe blue. specifications specification status comment html living standardthe definition of 'htmliframeelement: contentdocument' in that specification. living standard ...
HTMLIFrameElement.contentWindow - Web APIs
erty returns the window object of an htmliframeelement. you can use this window object to access the iframe's document and its internal dom. this attribute is read-only, but its properties can be manipulated like the global window object. example of contentwindow var x = document.getelementsbytagname("iframe")[0].contentwindow; //x = window.frames[0]; x.document.getelementsbytagname("body")[0].style.backgroundcolor = "blue"; // this would turn the 1st iframe in document blue. specifications specification status comment html living standardthe definition of 'htmliframeelement: contentwindow' in that specification. living standard ...
HTMLImageElement.alt - Web APIs
lit. in ac neque libero. vivamus consectetur rhoncus elit eget porta. etiam pulvinar ex id sapien laoreet, quis aliquet odio lobortis. nam ac mauris at risus laoreet cursus vitae et sapien. etiam molestie auctor eros, ac porta risus scelerisque sit amet. ut nunc neque, porta eu auctor at, tempor et arcu.</p> </div> </div> css the css for this example simply sets up the styles for the layout as shown in the result below. they're not crucial to the concept shown in the html above, but you may expand the view below if you wish to read the css used. view the css editors: if you change the css below, please be sure to close the details box using the toggle at the top of the css view before saving. otherwise, readers will find it open by default, which is not the intent ...
HTMLImageElement.complete - Web APIs
lightboxelem = document.queryselector("#lightbox"); let lightboximgelem = lightboxelem.queryselector("img"); let lightboxcontrolselem = lightboxelem.queryselector(".toolbar"); async function loadimage(url, elem) { return new promise((resolve, reject) => { elem.onload = () => resolve(elem); elem.onerror = reject; elem.src = url; }); } async function lightbox(url) { lightboxelem.style.display = "block"; await loadimage("https://somesite.net/huge-image.jpg", lightboximgelem); lightboxcontrolselem.disabled = false; } /* ... */ function fixredeyecommand() { if (lightboxelem.style.display === "block" && lightboximgelem.complete) { fixredeye(lightboximgelem); } else { /* can't start doing this until the image is fully loaded */ } } specifications spe...
HTMLImageElement.loading - Web APIs
fect the timing of the load event. that means that when load fires, it's possible that any lazy-loaded images located in the visual viewport may not yet be visible. preventing element shift during image lazy loads when an image whose loading has been delayed by the loading attribute being set to lazy is finally loaded, the browser will determine the final size of the <img> element based on the style and intrinsic size of the image, then reflow the document as needed to update the positions of elements based on any size change made to the element to fit the image. to prevent this reflow from occurring, you should explicitly specify the size of the image's presentation using the image element's width and height attributes. by establishing the intrinsic aspect ratio in this manner, you prevent...
HTMLImageElement.naturalHeight - Web APIs
ltered by the page's css and other factors. html <div class="box"> <img src="/files/16797/clock-demo-400px.png" class="image"> </div> <div class="output"> </div> the html features a 400x398 pixel image which is placed inside a <div>. css .box { width: 200px; height: 200px; } .image { width: 100%; } .output { padding-top: 2em; } the main thing of note in the css above is that the style used for the container the image will be drawn in is 200px wide, and the image will be drawn to fill its width (100%). javascript let output = document.queryselector(".output"); let image = document.queryselector("img"); window.addeventlistener("load", event => { output.innerhtml += `natural size: ${image.naturalwidth} x ` + `${image.naturalheight} pixels<br>`; output...
HTMLImageElement.naturalWidth - Web APIs
ltered by the page's css and other factors. html <div class="box"> <img src="/files/16797/clock-demo-400px.png" class="image"> </div> <div class="output"> </div> the html features a 400x398 pixel image which is placed inside a <div>. css .box { width: 200px; height: 200px; } .image { width: 100%; } .output { padding-top: 2em; } the main thing of note in the css above is that the style used for the container the image will be drawn in is 200px wide, and the image will be drawn to fill its width (100%). javascript let output = document.queryselector(".output"); let image = document.queryselector("img"); window.addeventlistener("load", event => { output.innerhtml += `natural size: ${image.naturalwidth} x ` + `${image.naturalheight} pixels<br>`; output...
HTMLLinkElement.as - Web APIs
syntax var as = htmllinkelement.as htmllinkelement.as = as value a domstring. specifications specification status comment preloadthe definition of 'as' in that specification. candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. ...
HTMLLinkElement.rel - Web APIs
the htmllinkelement.rel property reflects the rel attribute. it is a domstring containing a space-separated list of link types indicating the relationship between the resource represented by the <link> element and the current document. the most common use of this attribute is to specify a link to an external style sheet: the property is set to stylesheet, and the href attribute is set to the url of an external style sheet to format the page. syntax var relstr = linkelt.rel; linkelt.rel = relstr; example var links = document.getelementsbytagname('link'); var length = links.length; for (var i = 0; i < length; i++) { alert(links[i]); } specifications specification status comment html living standardthe definition of 'rel' in that specification. living sta...
HTMLSelectElement.form - Web APIs
all form elements, "type" returns the type of the calling form element. for select, the two possible values are "select-one" or "select-multiple", depending on the type of selection list. the below code gives all select elements in a particular form a css class of "selectclass": <script type="text/javascript"> var form_element = document.getelementbyid('subscribe_form'); var vist = form_element.style; if (vist.display=='' || vist.display=='none') { vist.display = 'block'; } else { vist.display = 'none'; } </script> specifications specification status comment html living standardthe definition of 'form' in that specification. living standard html5the definition of 'htmlselectelement' in that specification. recommendation initial definition,...
HTMLVideoElement.msIsLayoutOptimalForPlayback - Web APIs
internet explorer and microsoft edge. syntax htmlvideoelement.msislayoutoptimalforplayback: domstring; value boolean value set to true indicates that video is being rendered optimally (better performance and using less battery power). if false, improvements can be made to optimize performance. for msislayoutoptimalforplayback to be true, avoid the following: video elements with cascading style sheets (css) outlines set. rendering a video element through a canvas element. embedding video elements in a scalable vector graphics (svg). you can listen to the onmsvideooptimallayoutchanged event to be notified when the msislayoutoptimalforplayback property changes. *to enable stereo 3d playback, msislayoutoptimalforplayback must be true. see also htmlvideoelement microsoft api exten...
HTMLVideoElement.videoHeight - Web APIs
from displaying the poster frame to displaying video content, or when the displayed video track changes. example this example creates a handler for the resize event that resizes the <video> element to match the intrinsic size of its contents. let v = document.getelementbyid("myvideo"); v.addeventlistener("resize", ev => { let w = v.videowidth; let h = v.videoheight; if (w && h) { v.style.width = w; v.style.height = h; } }, false); note that this only applies the change if both the videowidth and the videoheight are non-zero. this avoids applying invalid changes when there's no true information available yet for dimensions. specifications specification status comment html living standardthe definition of 'htmlvideoelement.videoheight' in that spec...
HTMLVideoElement.videoWidth - Web APIs
from displaying the poster frame to displaying video content, or when the displayed video track changes. example this example creates a handler for the resize event that resizes the <video> element to match the intrinsic size of its contents. let v = document.getelementbyid("myvideo"); v.addeventlistener("resize", ev => { let w = v.videowidth; let h = v.videoheight; if (w && h) { v.style.width = w; v.style.height = h; } }, false); note that this only applies the change if both the videowidth and the videoheight are non-zero. this avoids applying invalid changes when there's no true information available yet for dimensions. specifications specification status comment html living standardthe definition of 'htmlvideoelement.videowidth' in that speci...
The HTML DOM API - Web APIs
lement htmlmediaelement htmlmenuelement htmlmetaelement htmlmeterelement htmlmodelement htmlolistelement htmlobjectelement htmloptgroupelement htmloptionelement htmloutputelement htmlparagraphelement htmlparamelement htmlpictureelement htmlpreelement htmlprogresselement htmlquoteelement htmlscriptelement htmlselectelement htmlslotelement htmlsourceelement htmlspanelement htmlstyleelement htmltablecaptionelement htmltablecellelement htmltablecolelement htmltableelement htmltablerowelement htmltablesectionelement htmltemplateelement htmltextareaelement htmltimeelement htmltitleelement htmltrackelement htmlulistelement htmlunknownelement htmlvideoelement deprecated html element interfaces htmlmarqueeelement obsolete html element interfaces htmlba...
File drag and drop - Web APIs
tion will include a dragover event handler on the drop target element and that handler will turn off the browser's default drag behavior. to add this handler, you need to include a ondragover global event handler: <div id="drop_zone" ondrop="drophandler(event);" ondragover="dragoverhandler(event);"> <p>drag one or more files to this drop zone ...</p> </div> lastly, an application may want to style the drop target element to visually indicate the element is a drop zone. in this example, the drop target element uses the following styling: #drop_zone { border: 5px solid blue; width: 200px; height: 100px; } note that dragstart and dragend events are not fired when dragging a file into the browser from the os. process the drop the drop event is fired when the user drops the file(s...
Dragging and Dropping Multiple Items - Web APIs
++) { output(" " + types[t] + ": "); try { var data = dt.mozgetdataat(types[t], i); output("(" + (typeof data) + ") : <" + data + " >\n"); } catch (ex) { output("<<error>>\n"); dump(ex); } } } } function output(text) { document.getelementbyid("output").textcontent += text; dump(text); } </script> </head> <body> <div id="output" style="min-height: 100px; white-space: pre; border: 1px solid black;" ondragenter="document.getelementbyid('output').textcontent = ''; event.stoppropagation(); event.preventdefault();" ondragover="event.stoppropagation(); event.preventdefault();" ondrop="event.stoppropagation(); event.preventdefault(); dodrop(event);"> <div> fix</div> </div> </body> </html> this example cancels both...
ImageCapture - Web APIs
}) .catch(error => console.log(error)); } function ontakephotobuttonclick() { imagecapture.takephoto() .then(blob => createimagebitmap(blob)) .then(imagebitmap => { const canvas = document.queryselector('#takephotocanvas'); drawcanvas(canvas, imagebitmap); }) .catch(error => console.log(error)); } /* utils */ function drawcanvas(canvas, img) { canvas.width = getcomputedstyle(canvas).width.split('px')[0]; canvas.height = getcomputedstyle(canvas).height.split('px')[0]; let ratio = math.min(canvas.width / img.width, canvas.height / img.height); let x = (canvas.width - img.width * ratio) / 2; let y = (canvas.height - img.height * ratio) / 2; canvas.getcontext('2d').clearrect(0, 0, canvas.width, canvas.height); canvas.getcontext('2d').drawimage(img, 0, 0, img...
InputDeviceCapabilities API - Web APIs
gered that the user's device has a touch interface. what about when the mousedown event is triggered? it would be useful to know if a touchstart event were also triggered so that we don't take the same action twice. we can do this by checking the sourcecapabilities property of the uievent. mybutton.addeventlistener('mousedown', function(e) { // touch event case handled above, don't change the style again on tap. if (!e.sourcecapabilities.firestouchevents) mybutton.classlist.add("pressed"); }); interfaces inputdevicecapabilities provides logical information about an input device. specifications specification status comment inputdevicecapabilities draft initial definition. ...
InputEvent.inputType - Web APIs
g the type of input that was made. there are many possible values, such as inserttext, deletecontentbackward, insertfrompaste, and formatbold. for a complete list of the available input types, see the attributes section of the input events level 1 spec. examples this example logs the inputtype for input events on an editable <div>. html <p id="log">input type: </p> <div contenteditable="true" style="margin: 20px;padding: 20px;border:2px dashed red;"> <p>some sample text. try inserting line breaks, or deleting text in different ways, or pasting different content in.</p> <hr> <ul> <li>a sample</li> <li>bulleted</li> <li>list.</li> </ul> <p>another paragraph.</p> </div> javascript const log = document.getelementbyid('log'); const editable = document.queryselector('div[c...
IntersectionObserver.root - Web APIs
object which overlaps the target element, is considered to be the visible area of the target element. if root is null, then the owning document is used as the root, and the bounds its viewport (that is, the visible area of the document) are used as the root bounds. example this example sets the border of the intersection observer's root element to be a 2-pixel medium green line. observer.root.style.border = "2px solid #44aa44"; specifications specification status comment intersection observerthe definition of 'intersectionobserver' in that specification. working draft initial definition ...
IntersectionObserverEntry.intersectionRatio - Web APIs
nds rectangle (boundingclientrect). if the area of the target's bounds rectangle is zero, the returned value is 1 if isintersecting is true or 0 if not. example in this simple example, an intersection callback sets each target element's opacity to the intersection ratio of that element with the root. function intersectioncallback(entries) { entries.foreach(function(entry) { entry.target.style.opacity = entry.intersectionratio; }); } to see a more concrete example, take a look at handling intersection changes in timing element visibility with the intersection observer api. specifications specification status comment intersection observerthe definition of 'intersectionobserverentry.intersectionratio' in that specification. working draft initial definit...
Intersection Observer API - Web APIs
on changes when the browser detects that the target element (in our case, the one with the id "box") has been unveiled or obscured such that its visibility ratio crosses one of the thresholds in our list, it calls our handler function, handleintersect(): function handleintersect(entries, observer) { entries.foreach((entry) => { if (entry.intersectionratio > prevratio) { entry.target.style.backgroundcolor = increasingcolor.replace("ratio", entry.intersectionratio); } else { entry.target.style.backgroundcolor = decreasingcolor.replace("ratio", entry.intersectionratio); } prevratio = entry.intersectionratio; }); } for each intersectionobserverentry in the list entries, we look to see if the entry's intersectionratio is going up; if it is, we set the target's bac...
KeyframeEffect.getKeyframes() - Web APIs
ffect.getkeyframes(); parameters none. return value returns a sequence of objects with the following format: property value pairs as many property value pairs as are contained in each keyframe of the animation. offset the offset of the keyframe specified as a number between 0.0 and 1.0 inclusive or null. this is equivalent to specifying start and end states in percentages in css stylesheets using @keyframes. this will be null if the keyframe is automatically spaced using keyframeeffect.spacing. computedoffset the computed offset for this keyframe, calculated when the list of computed keyframes was produced according to keyframeeffect.spacing. unlike offset, above, the computedoffset is never null. easing the timing function used from this keyframe until the next ke...
KeyframeEffect.setKeyframes() - Web APIs
ation since "float" is not an animatable css property. offset, which must be written as cssoffset since "offset" represents the keyframe offset as described below. the following special attributes may also be specified: offset the offset of the keyframe specified as a number between 0.0 and 1.0 inclusive or null. this is equivalent to specifying start and end states in percentages in css stylesheets using @keyframes. if this value is null or missing, the keyframe will be evenly spaced between adjacent keyframes. easing the timing function used from this keyframe until the next keyframe in the series. composite the keyframeeffect.composite operation used to combine the values specified in this keyframe with the underlying value. this will be auto if the composite operation s...
MediaDevices.ondevicechange - Web APIs
let videoelement = document.getelementbyid("video"); let logelement = document.getelementbyid("log"); function log(msg) { logelement.innerhtml += msg + "<br>"; } document...
MediaQueryList - Web APIs
tect when the media query status changes, running a custom function when it does to change the appearence of the page. var para = document.queryselector('p'); var mql = window.matchmedia('(max-width: 600px)'); function screentest(e) { if (e.matches) { /* the viewport is 600 pixels wide or less */ para.textcontent = 'this is a narrow screen — less than 600px wide.'; document.body.style.backgroundcolor = 'red'; } else { /* the viewport is more than than 600 pixels wide */ para.textcontent = 'this is a wide screen — more than 600px wide.'; document.body.style.backgroundcolor = 'blue'; } } mql.addeventlistener('change', screentest); note: you can find this example on github (see the source code, and also see it running live). you can find other examples on t...
MediaRecorder - Web APIs
log('getusermedia supported.'); var constraints = { audio: true }; var chunks = []; navigator.mediadevices.getusermedia(constraints) .then(function(stream) { var mediarecorder = new mediarecorder(stream); visualize(stream); record.onclick = function() { mediarecorder.start(); console.log(mediarecorder.state); console.log("recorder started"); record.style.background = "red"; record.style.color = "black"; } stop.onclick = function() { mediarecorder.stop(); console.log(mediarecorder.state); console.log("recorder stopped"); record.style.background = ""; record.style.color = ""; } mediarecorder.onstop = function(e) { console.log("data available after mediarecorder.stop() called."); var...
MediaStream Recording API - Web APIs
available(event) { console.log("data-available"); if (event.data.size > 0) { recordedchunks.push(event.data); console.log(recordedchunks); download(); } else { // ... ...
MouseEvent.initMouseEvent() - Web APIs
y whether or not shift key was depressed during the event. sets the value of mouseevent.shiftkey. metakey whether or not meta key was depressed during the event. sets the value of mouseevent.metakey. button the event's mouse button. relatedtarget the event's related eventtarget. only used with some event types (e.g., mouseover and mouseout). in other cases, pass null. ...
Node.getRootNode() - Web APIs
Web › API › Node › getRootNode
41+ var parent = document.queryselector('.js-parent'), child = document.queryselector('.js-child'), shadowhost = document.queryselector('.js-shadowhost'); console.log(parent.getrootnode().nodename); // #document console.log(child.getrootnode().nodename); // #document // create a shadowroot var shadowroot = shadowhost.attachshadow({mode:'open'}); shadowroot.innerhtml = '<style>div{background:#2bb8aa;}</style>' + '<div class="js-shadowchild">content</div>'; var shadowchild = shadowroot.queryselector('.js-shadowchild'); // the default value of composed is false console.log(shadowchild.getrootnode() === shadowroot); // true console.log(shadowchild.getrootnode({composed:false}) === shadowroot); // true console.log(shadowchild.getrootnode({composed:true}).n...
Node.localName - Web APIs
Web › API › Node › localName
qualified names are typically used in xml as part of the namespace(s) of the particular xml documents. for example, in the qualified name ecomm:partners, partners is the local name and ecomm is the...
Node.nodeType - Web APIs
Web › API › Node › nodeType
type constants constant value description node.element_node 1 an element node like <p> or <div>. node.text_node 3 the actual text inside an element or attr. node.cdata_section_node 4 a cdatasection, such as <!cdata[[ … ]]>. node.processing_instruction_node 7 a processinginstruction of an xml document, such as <?xml-stylesheet … ?>. node.comment_node 8 a comment node, such as <!-- … -->. node.document_node 9 a document node. node.document_type_node 10 a documenttype node, such as <!doctype html>. node.document_fragment_node 11 a documentfragment node. deprecated node type constants the following constants have been deprecated and should not...
Node.parentElement - Web APIs
the node.parentelement read-only property returns the dom node's parent element, or null if the node either has no parent, or its parent isn't a dom element. syntax parentelement = node.parentelement parentelement is the parent element of the current node. this is always a dom element object, or null. example if (node.parentelement) { node.parentelement.style.color = "red"; } specifications specification status comment domthe definition of 'parentelement' in that specification. living standard initial definition. ...
Node.textContent - Web APIs
Web › API › Node › textContent
n.) setting textcontent on a node removes all of the node's children and replaces them with a single text node with the given string value. differences from innertext don't get confused by the differences between node.textcontent and htmlelement.innertext. although the names seem similar, there are important differences: textcontent gets the content of all elements, including <script> and <style> elements. in contrast, innertext only shows “human-readable” elements. textcontent returns every element in the node. in contrast, innertext is aware of styling and won’t return the text of “hidden” elements. moreover, since innertext takes css styles into account, reading the value of innertext triggers a reflow to ensure up-to-date computed styles. (reflows can be computationa...
Using the Notifications API - Web APIs
function handlepermission(permission) { // whatever the user answers, we make sure chrome stores the information if(!('permission' in notification)) { notification.permission = permission; } // set the button to shown or hidden, depending on what the user answers if(notification.permission === 'denied' || notification.permission === 'default') { notificationbtn.style.display = 'block'; } else { notificationbtn.style.display = 'none'; } } // let's check if the browser supports notifications if (!('notification' in window)) { console.log("this browser does not support notifications."); } else { if(checknotificationpromise()) { notification.requestpermission() .then((permission) => { handlepermission(permission)...
PaintWorklet.registerPaint - Web APIs
e(). /* checkboardworklet.js */ class checkerboardpainter { paint(ctx, geom, properties) { // use `ctx` as if it was a normal canvas const colors = ['red', 'green', 'blue']; const size = 32; for(let y = 0; y < geom.height/size; y++) { for(let x = 0; x < geom.width/size; x++) { const color = colors[(x + y) % colors.length]; ctx.beginpath(); ctx.fillstyle = color; ctx.rect(x * size, y * size, size, size); ctx.fill(); } } } } // register our class under a specific name registerpaint('checkerboard', checkerboardpainter); the first step in using a paintworket is defining the paint worklet using the registerpaint() function, as done above. to use it, you register it with the css.paintworklet.addmodule() method: <script> ...
ParentNode.children - Web APIs
returns a live htmlcollection which contains all of the child elements of the node upon which it was called. syntax let children = node.children; value an htmlcollection which is a live, ordered collection of the dom elements which are children of node. you can access the individual child nodes in the collection by using either the item() method on the collection, or by using javascript array-style notation. if the node has no element children, then children is an empty list with a length of 0. example const foo = document.getelementbyid('foo'); for (let i = 0; i < foo.children.length; i++) { console.log(foo.children[i].tagname); } polyfill // overwrites native 'children' prototype. // adds document & documentfragment support for ie9 & safari. // returns array instead of htmlcollect...
Pointer events - Web APIs
e region. the values pan-x and pan-y, mean that touches that begin on the specified region are only for horizontal and vertical scrolling, respectively. the value manipulation means the browser may consider touches that begin on the element are only for scrolling and zooming. in the following example, the browser's default touch behavior is disabled for the div element. <html> <body> <div style="touch-action:none;">can't touch this ... </div> </body> </html> in the following example, default touch behavior is disabled for some button elements. button#tiny { touch-action: none; } in the following example, when the target element is touched, it will only pan in the horizontal direction. #target { touch-action: pan-x; } compatibility with mouse events although the pointer ev...
RTCRemoteOutboundRtpStreamStats.localId - Web APIs
ord.framesdecoded. finally, the frame rate over the elapsed time span is calculated by dividing framesdecoded by elapsedtime. the remainder of the networkteststop() function constructs the html used to display the output of the collected and computed results to the user, then append it to the element statsbox, which we're using to show the status updates to the user. the output log, given the styles used by the example, looks like this: in the screenshot, we see a heading followed by the scrollable <div> we refer to as statsbox. the box contains a number of log entries, the last handful of which are visible. each one represents approximately one second of time (since that's much time we're waiting between calling networkteststart() and networkteststop()). try it and fork it this exampl...
RequestDestination - Web APIs
"embed" the target is embedded content. "font" the target is a font. "image" the target is an image. "manifest" the target is a manifest. "object" the target is an object. "paintworklet" the target is a paint worklet. "report" the target is a report. "script" the target is a script. "serviceworker" the target is a service worker. "sharedworker" the target is a shared worker. "style" the target is a style "track" the target is an html <track>. "video" the target is video data. "worker" the target is a worker. "xslt" the target is an xlst transform. specifications specification status comment fetchthe definition of 'requestdestination' in that specification. living standard initial definition ...
ResizeObserver() - Web APIs
lines of: function(entries, observer) { for (let entry of entries) { // do something to each entry // and possibly something to the observer itself } } examples the following snippet is taken from the resize-observer-text.html (see source) example: const resizeobserver = new resizeobserver(entries => { for (let entry of entries) { if(entry.contentboxsize) { h1elem.style.fontsize = math.max(1.5, entry.contentboxsize.inlinesize/200) + 'rem'; pelem.style.fontsize = math.max(1, entry.contentboxsize.inlinesize/600) + 'rem'; } else { h1elem.style.fontsize = math.max(1.5, entry.contentrect.width/200) + 'rem'; pelem.style.fontsize = math.max(1, entry.contentrect.width/600) + 'rem'; } } }); resizeobserver.observe(divelem); specifications ...
SVGStylable - Web APIs
svg stylable interface the svgstylable interface is implemented on all objects corresponding to svg elements that can have style, class and presentation attributes specified on them. interface overview also implement none methods cssvalue getpresentationattribute(in domstring name) properties readonly svganimatedstring classname readonly cssstyledeclaration style normative document svg 1.1 (2nd edition) properties name type description classname svganimatedstring corresponds to attribute class on the given element. style cssstyledeclaration corresponds to attribute style on the given element. methods name & arguments return...
Screen.pixelDepth - Web APIs
Web › API › Screen › pixelDepth
returns the bit depth of the screen. per the cssom, some implementations return 24 for compatibility reasons. see the browser compatibility section for those that don't. syntax let depth = window.screen.pixeldepth example // if there is not adequate bit depth // choose a simpler color if ( window.screen.pixeldepth > 8 ) { document.style.color = "#faebd7"; } else { document.style.color = "#ffffff"; } specifications specification status comment css object model (cssom) view modulethe definition of 'screen.pixeldepth' in that specification. working draft initial definition. ...
SecurityPolicyViolationEvent.sample - Web APIs
le read-only property of the securitypolicyviolationevent interface is a domstring representing a sample of the resource that caused the violation. syntax let sample = violationeventinstance.sample; value a domstring containing a sample of the resource that caused the violation, usually the first 40 characters. this will only be populated if the resource is an inline script, event handler, or style — external resources causing a violation will not generate a sample. example document.addeventlistener("securitypolicyviolation", (e) => { console.log(e.sample); }); specifications specification status comment content security policy level 3the definition of 'sample' in that specification. working draft initial definition ...
SecurityPolicyViolationEvent - Web APIs
securitypolicyviolationevent.referrerread only a usvstring representing the referrer of the resources whose policy was violated. this will be a url or null. securitypolicyviolationevent.sampleread only a domstring representing a sample of the resource that caused the violation, usually the first 40 characters. this will only be populated if the resource is an inline script, event handler, or style — external resources causing a violation will not generate a sample. securitypolicyviolationevent.sourcefileread only a usvstring representing the uri of the document or worker in which the violation was found. securitypolicyviolationevent.statuscoderead only a number representing the http status code of the document or worker in which the violation occurred. securitypolicyviolationevent...
Selection.containsNode() - Web APIs
e check for selection this snippet checks whether anything inside the body element is selected. console.log(window.getselection().containsnode(document.body, true)); find the hidden word in this example, a message appears when you select the secret word. it uses addeventlistener() to check for selectionchange events. ...
ServiceWorkerGlobalScope: install event - Web APIs
amples the following snippet shows how an install event handler can be used to populate a cache with a number of responses, which the service worker can then use to serve assets offline: this.addeventlistener('install', function(event) { event.waituntil( caches.open('v1').then(function(cache) { return cache.add( '/sw-test/', '/sw-test/index.html', '/sw-test/style.css', '/sw-test/app.js', '/sw-test/image-list.js', '/sw-test/star-wars-logo.jpg', '/sw-test/gallery/', '/sw-test/gallery/bountyhunters.jpg', '/sw-test/gallery/mylittlevader.jpg', '/sw-test/gallery/snowtroopers.jpg' ); }) ); }); you can also set up the event handler using the serviceworkerglobalscope.oninstall property: globalsco...
ServiceWorkerGlobalScope.oninstall - Web APIs
amples the following snippet shows how an install event handler can be used to populate a cache with a number of responses, which the service worker can then use to serve assets offline: this.addeventlistener('install', function(event) { event.waituntil( caches.open('v1').then(function(cache) { return cache.add( '/sw-test/', '/sw-test/index.html', '/sw-test/style.css', '/sw-test/app.js', '/sw-test/image-list.js', '/sw-test/star-wars-logo.jpg', '/sw-test/gallery/', '/sw-test/gallery/bountyhunters.jpg', '/sw-test/gallery/mylittlevader.jpg', '/sw-test/gallery/snowtroopers.jpg' ); }) ); }); specifications specification status comment service workersthe definition of '...
SpeechRecognition.onresult - Web APIs
itionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalternative at position 0. // we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; } specifications specification status comment web speech apithe definition of 'onresult' in that specification. draft ...
SpeechRecognition - Web APIs
draft ...
SpeechRecognitionAlternative.confidence - Web APIs
itionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalternative at position 0. // we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; console.log('confidence: ' + event.results[0][0].confidence); } specifications specification status comment web speech apithe definition of 'confidence' in that specification. draft ...
SpeechRecognitionAlternative.transcript - Web APIs
itionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalternative at position 0. // we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; } specifications specification status comment web speech apithe definition of 'transcript' in that specification. draft ...
SpeechRecognitionAlternative - Web APIs
itionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalternative at position 0. // we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; } specifications specification status comment web speech apithe definition of 'speechrecognitionalternative' in that specification. draft ...
SpeechRecognitionEvent.emma - Web APIs
user agents and recognition engines, but all supporting implementations will expose a valid xml document complete with an emma namespace. if the speech recognition system does not supply emma data then the user agent will return null. examples recognition.onresult = function(event) { var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; console.log(event.emma); } ...
SpeechRecognitionEvent.interpretation - Web APIs
specification and examples.) syntax var myinterpretation = event.interpretation; value the returned value can be of any type. if no semantic interpretation has been returned by the speec recognition system, null will be returned. examples recognition.onresult = function(event) { var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; console.log(event.interpretation); } ...
SpeechRecognitionEvent.resultIndex - Web APIs
sultlist "array" that has actually changed. the speechrecognitionresultlist object is not an array, but it has a getter that allows it to be accessed by array syntax. syntax var myresultindex = event.resultindex; value a number. examples recognition.onresult = function(event) { var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; console.log(event.resultindex); // returns 0 if there is only one result } specifications specification status comment web speech apithe definition of 'resultindex' in that specification. draft ...
SpeechRecognitionEvent.results - Web APIs
itionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalternative at position 0. // we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; } specifications specification status comment web speech apithe definition of 'results' in that specification. draft ...
SpeechRecognitionEvent - Web APIs
itionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalternative at position 0. // we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; } specifications specification status comment web speech apithe definition of 'speechrecognitionevent' in that specification. draft ...
SpeechRecognitionResult.isFinal - Web APIs
itionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalternative at position 0. // we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; console.log(event.results[0].isfinal); } specifications specification status comment web speech apithe definition of 'isfinal' in that specification. draft ...
SpeechRecognitionResult.item() - Web APIs
itionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalternative at position 0. // we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; } specifications specification status comment web speech apithe definition of 'item()' in that specification. draft ...
SpeechRecognitionResult.length - Web APIs
itionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalternative at position 0. // we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; console.log(event.results[0].length); } specifications specification status comment web speech apithe definition of 'length' in that specification. draft ...
SpeechRecognitionResult - Web APIs
itionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalternative at position 0. // we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; } specifications specification status comment web speech apithe definition of 'speechrecognitionresult' in that specification. draft ...
SpeechRecognitionResultList.item() - Web APIs
itionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalternative at position 0. // we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; } specifications specification status comment web speech apithe definition of 'item()' in that specification. draft ...
SpeechRecognitionResultList.length - Web APIs
itionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalternative at position 0. // we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; console.log(event.results.length); } specifications specification status comment web speech apithe definition of 'length' in that specification. draft ...
SpeechRecognitionResultList - Web APIs
itionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalternative at position 0. // we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; } specifications specification status comment web speech apithe definition of 'speechrecognitionresultlist' in that specification. draft ...
Storage Access API - Web APIs
cessfully, all other iframes from tracker.example on foo.example top-level origins will immediately gain storage access as well, without needing to call requeststorageaccess() separately. if an embedded page from tracker.example has previously successfully obtained storage access on top-level origin foo.example, all embedded subresources from tracker.example on foo.example (e.g. scripts, images, stylesheets, etc.) will load with access to their first-party storage, which means they may send cookie headers and honor incoming set-cookie headers. in firefox, when the promise returned from requeststorageaccess() is resolved, the embedded page will gain access to its entire first-party storage, not just cookies. this includes access to apis such as web storage, indexeddb, dom cache, and so on. i...
TextEncoder.prototype.encodeInto() - Web APIs
u are working with c++ std::string, even though the logical length is shown to you, you need to take the extra terminator byte into account when computing rounding up to allocator bucket size. see the next section about c strings. no zero-termination if the input string contains the character u+0000 in the input, encodeinto() will write a 0x00 byte in the output. encodeinto() does not write a c-style 0x00 sentinel byte after the logical output. if your wasm program uses c strings, it's your responsibility to write the 0x00 sentinel and you can't prevent your wasm program from seeing a logically truncated string if the javascript string contained u+0000. observe: var encoder = new textencoder; function encodeintowithsentinel(string, u8array, position) { var stats = encoder.encodeinto(str...
TextMetrics - Web APIs
baselinesabovealphabetic = ['fontboundingboxascent', 'actualboundingboxascent', 'emheightascent', 'hangingbaseline']; const baselinesbelowalphabetic = ['ideographicbaseline', 'emheightdescent', 'actualboundingboxdescent', 'fontboundingboxdescent']; const baselines = [...baselinesabovealphabetic, ...baselinesbelowalphabetic]; ctx.font = '25px serif'; ctx.strokestyle = 'red'; baselines.foreach(function (baseline, index) { let text = 'abcdefghijklmnop (' + baseline + ')'; let textmetrics = ctx.measuretext(text); let y = 50 + index * 50; ctx.beginpath(); ctx.filltext(text, 0, y); let liney = y - math.abs(textmetrics[baseline]); if (baselinesbelowalphabetic.includes(baseline)) { liney = y + math.abs(textmetrics[baseline]); } ctx.moveto(0, ...
Touch.radiusX - Web APIs
Web › API › Touch › radiusX
ed using the touch point's rotationangle. <div id="src"> ... </div> var src = document.getelementbyid("src"); src.addeventlistener('touchstart', rotate); src.addeventlistener('touchmove', rotate); src.addeventlistener('touchend', rotate); function rotate (e) { var touch = e.changedtouches.item(0); // turn off default event handling e.preventdefault(); // rotate element 'src'. src.style.width = touch.radiusx * 2 + 'px'; src.style.height = touch.radiusy * 2 + 'px'; src.style.transform = "rotate(" + touch.rotationangle + "deg)"; }; specifications specification status comment touch events – level 2 draft non-stable version. ...
UIEvent.layerX - Web APIs
Web › API › UIEvent › layerX
title>pagex\pagey & layerx\layery example</title> <script type="text/javascript"> function showcoords(evt){ var form = document.forms.form_coords; var parent_id = evt.target.parentnode.id; form.parentid.value = parent_id; form.pagexcoords.value = evt.pagex; form.pageycoords.value = evt.pagey; form.layerxcoords.value = evt.layerx; form.layerycoords.value = evt.layery; } </script> <style type="text/css"> #d1 { border: solid blue 1px; padding: 20px; } #d2 { position: absolute; top: 180px; left: 80%; right:auto; width: 40%; border: solid blue 1px; padding: 20px; } #d3 { position: absolute; top: 240px; left: 20%; width: 50%; border: solid blue 1px; padding: 10px; } </style> </head> <body onmousedown="showcoords(event)"> <p>to display the mou...
UIEvent.layerY - Web APIs
Web › API › UIEvent › layerY
title>pagex\pagey & layerx\layery example</title> <script type="text/javascript"> function showcoords(evt){ var form = document.forms.form_coords; var parent_id = evt.target.parentnode.id; form.parentid.value = parent_id; form.pagexcoords.value = evt.pagex; form.pageycoords.value = evt.pagey; form.layerxcoords.value = evt.layerx; form.layerycoords.value = evt.layery; } </script> <style type="text/css"> #d1 { border: solid blue 1px; padding: 20px; } #d2 { position: absolute; top: 180px; left: 80%; right:auto; width: 40%; border: solid blue 1px; padding: 20px; } #d3 { position: absolute; top: 240px; left: 20%; width: 50%; border: solid blue 1px; padding: 10px; } </style> </head> <body onmousedown="showcoords(event)"> <p>to display the mou...
UIEvent.pageY - Web APIs
Web › API › UIEvent › pageY
itle>pagex\pagey & layerx\layery example</title> <script type="text/javascript"> function showcoords(evt){ var form = document.forms.form_coords; var parent_id = evt.target.parentnode.id; form.parentid.value = parent_id; form.pagexcoords.value = evt.pagex; form.pageycoords.value = evt.pagey; form.layerxcoords.value = evt.layerx; form.layerycoords.value = evt.layery; } </script> <style type="text/css"> #d1 { border: solid blue 1px; padding: 20px; } #d2 { position: absolute; top: 180px; left: 80%; right:auto; width: 40%; border: solid blue 1px; padding: 20px; } #d3 { position: absolute; top: 240px; left: 20%; width: 50%; border: solid blue 1px; padding: 10px; } </style> </head> <body onmousedown="showcoords(event)"> <p>to display the mou...
WebGLRenderingContext - Web APIs
que to webgl. this is also done in other graphics {̣{glossary("api")}}, such as the canvas 2d rendering context. however, the properties and variables you can tweak are different for each api. effect of canvas size on rendering with webgl with scissor() and clear() we can demonstrate how the webgl drawing buffer is affected by the size of the canvas. the size of the first canvas is set to the styled element size, determined by css. this is done by assigning the width and height properties of the canvas to the values of the clientwidth and clientheight properties, respectively. in contrast, no such assignment is done for the second canvas. the internal width and height properties of the canvas remain at default values, which are different than the actual size of the canvas element in the br...
Canvas size and WebGL - Web APIs
« previousnext » this webgl example explores the effect of setting (or not setting) the canvas size to its element size in css pixels, as it appears in the browser window. effect of canvas size on rendering with webgl with scissor() and clear() we can demonstrate how the webgl drawing buffer is affected by the size of the canvas. the size of the first canvas is set to the styled element size, determined by css. this is done by assigning the width and height properties of the canvas to the values of the clientwidth and clientheight properties, respectively. in contrast, no such assignment is done for the second canvas. the internal width and height properties of the canvas remain at default values, which are different than the actual size of the canvas element in the browser...
Clearing with colors - Web APIs
nt is displayed only if canvas is not supported. --> <canvas>your browser does not seem to support html5 canvas.</canvas> body { text-align : center; } canvas { display : block; width : 280px; height : 210px; margin : auto; padding : 0; border : none; background-color : black; } // run everything inside window load event handler, to make sure // dom is fully loaded and styled before trying to manipulate it, // and to not mess up the global scope. we are giving the event // handler a name (setupwebgl) so that we can refer to the // function object within the function itself. window.addeventlistener("load", function setupwebgl (evt) { "use strict" // cleaning after ourselves. the event handler removes // itself, because it only needs to run once. window.remove...
Detect WebGL - Web APIs
and variables you can tweak are different for each api. <p>[ here would go the result of webgl feature detection ]</p> <button>press here to detect webglrenderingcontext</button> body { text-align : center; } button { display : block; font-size : inherit; margin : auto; padding : 0.6em; } // run everything inside window load event handler, to make sure // dom is fully loaded and styled before trying to manipulate it. window.addeventlistener("load", function() { var paragraph = document.queryselector("p"), button = document.queryselector("button"); // adding click event handler to button. button.addeventlistener("click", detectwebglcontext, false); function detectwebglcontext () { // create canvas element. the canvas is not added to the // document itself, s...
WebGL best practices - Web APIs
lder resources above the limit must be purged. keeping the application's vram usage under this cap will help to avoid out-of-memory errors and associated instability. consider rendering to a smaller backbuffer size a common (and easy) way to trade off quality for speed is rendering into a smaller backbuffer, and upscaling the result. consider reducing canvas.width and height and keeping canvas.style.width and height at a constant size. batch draw calls (prefer fewer-but-larger draw calls) fewer, larger draw operations will generally improve performance. if you have 1000 sprites to paint, try to do it as a single drawarrays() or drawelements() call. it's common to use "degenerate triangles" if you need to draw discontinuous objects as a single drawarrays(triangle_strip) call. degenerate tr...
Improving compatibility using WebRTC adapter.js - Web APIs
h lets your code to be written to the specification so that it will "just work" in all browsers with webrtc support. there's no need to conditionally use prefixed apis or implement other workarounds. note: since there is ongoing fluidity in functionality and naming of api terms in webrtc and supporting browsers, use of this adapter is generally recommended. the adapter is provided under a bsd-style license. what adapter.js does for each version of each browser that supports webrtc, adapter.js implements the needed polyfills, establishes the non-prefixed names of apis, and applies any other changes needed to make the browser run code written to the webrtc specification. for example, on firefox versions older than 38, the adapter adds the rtcpeerconnection.urls property; firefox doesn't na...
Writing a WebSocket server in C# - Web APIs
i < msglen; ++i) decoded[i] = (byte)(bytes[offset + i] ^ masks[i % 4]); string text = encoding.utf8.getstring(decoded); console.writeline("{0}", text); } else console.writeline("mask bit not set"); console.writeline(); } } } } client.html <!doctype html> <style> textarea { vertical-align: bottom; } #output { overflow: auto; } #output > p { overflow-wrap: break-word; } #output span { color: blue; } #output span.error { color: red; } </style> <h2>websocket test</h2> <textarea cols=60 rows=6></textarea> <button>send</button> <div id=output></div> <script> // http://www.websocket.org/echo.html var button = document.queryselector...
The WebSocket API (WebSockets) - Web APIs
the websocket api is an advanced technology that makes it possible to open a two-way interactive communication session between the user's browser and a server. with this api, you can send messages to a server and receive event-driven responses without having to poll the server for a reply. note: while a websocket connection is functionally somewhat similar to standard unix-style sockets, they are not related. interfaces websocket the primary interface for connecting to a websocket server and then sending and receiving data on the connection. closeevent the event sent by the websocket object when the connection closes. messageevent the event sent by the websocket object when a message is received from the server. guides writing websocket client applications writing websocket s...
Keyframe Formats - Web APIs
ation since "float" is not an animatable css property. offset, which must be written as cssoffset since "offset" represents the keyframe offset as described below. the following special attributes may also be specified: offset the offset of the keyframe specified as a number between 0.0 and 1.0 inclusive or null. this is equivalent to specifying start and end states in percentages in css stylesheets using @keyframes. if this value is null or missing, the keyframe will be evenly spaced between adjacent keyframes. easing the timing function used from this keyframe until the next keyframe in the series. composite the keyframeeffect.composite operation used to combine the values specified in this keyframe with the underlying value. this will be auto if the composite operation s...
Using the Web Animations API - Web APIs
ipt. this api was designed to underlie implementations of both css animations and css transitions, and leaves the door open to future animation effects. it is one of the most performant ways to animate on the web, letting the browser make its own internal optimizations without hacks, coercion, or window.requestanimationframe(). with the web animations api, we can move interactive animations from stylesheets to javascript, separating presentation from behavior. we no longer need to rely on dom-heavy techniques such as writing css properties and scoping classes onto elements to control playback direction. and unlike pure, declarative css, javascript also lets us dynamically set values from properties to durations. for building custom animation libraries and creating interactive animations, the w...
Web Audio API best practices - Web APIs
in this article, we'll share a number of best practices — guidelines, tips, and tricks for working with the web audio api. loading sounds/files there are four main ways to load sound with the web audio api and it can be a little confusing as to which one you should use. when working with files, you are looking at either the grabbing the file from an htmlmediaelement (i.e. an <audio> or <video> element), or you're looking to fetch the file and decode it into a buffer. ...
Migrating from webkitAudioContext - Web APIs
argetattime(). for example, if we have code that looks like this: var gainnode = context.creategain(); gainnode.gain.settargetvalueattime(0.0, 10.0, 1.0); you can rename the method, and be compliant with the standard, like so: var gainnode = context.creategain(); gainnode.gain.settargetattime(0.0, 10.0, 1.0); enumerated values that changed the original webkitaudiocontext api used c-style number based enumerated values in the api. those values have since been changed to use the web idl based enumerated values, which should be familiar because they are similar to things like the the htmlinputelement property type. oscillatornode.type oscillatornode's type property has been changed to use web idl enums. old code using webkitaudiocontext can be ported to standards based audiocont...
Example and tutorial: Simple synth keyboard - Web APIs
pace. the keys themselves will be inserted into the block of class "keyboard". the settings bar beneath the keyboard, we'll put some controls for configuring the layer. for now, we will have two controls: one to set the master volume and another to select what periodic waveform to use when generating notes. the volume control first we create the <div> to contain the settings bar, so it can be styled as needed. then we establish a box that will be presented on the left side of the bar and place a label and an <input> element of type "range". the range element will typically be presented as a slider control; we configure it to allow any value between 0.0 and 1.0, stepping by 0.01 each position. <div class="settingsbar"> <div class="left"> <span>volume: </span> <input type="range" m...
Web audio spatialization basics - Web APIs
ement z = panner.orientationz.value*math.cos(q) - panner.orientationy.value*math.sin(q); y = panner.orientationz.value*math.sin(q) + panner.orientationy.value*math.cos(q); x = panner.orientationx.value; panner.orientationx.value = x; panner.orientationy.value = y; panner.orientationz.value = z; break; } boombox.style.transform = 'translatex('+transform.xaxis+'px) translatey('+transform.yaxis+'px) scale('+transform.zaxis+') rotatey('+transform.rotatey+'deg) rotatex('+transform.rotatex+'deg)'; const move = prevmove || {}; move.frameid = requestanimationframe(() => moveboombox(direction, move)); return move; } wiring up our controls wiring up out control buttons is comparatively simple — now we can...
Web Audio API - Web APIs
us a fairly basic working audio graph.visualizations with web audio apito extract data from your audio source, you need an analysernode, which is created using the audiocontext.createanalyser() method, for example:web audio api best practicesthere's no strict right or wrong way when writing creative code. as long as you consider security, performance, and accessibility, you can adapt to your own style. in this article, we'll share a number of best practices — guidelines, tips, and tricks for working with the web audio api.web audio spatialization basicshopefully, this article has given you an insight into how web audio spatialization works, and what each of the pannernode properties do (there are quite a few of them). the values can be hard to manipulate sometimes and depending on your use c...
Window: DOMContentLoaded event - Web APIs
bubbles yes cancelable yes (although specified as a simple event that isn't cancelable) interface event event handler property none the original target for this event is the document that has loaded. you can listen for this event on the window interface to handle it in the capture or bubbling phases. for full details on this event please see the page on the document: domcontentloaded event. ...
window.cancelAnimationFrame() - Web APIs
ionframe || window.webkitrequestanimationframe || window.msrequestanimationframe; var cancelanimationframe = window.cancelanimationframe || window.mozcancelanimationframe; var start = window.mozanimationstarttime; // only supported in ff. other browsers can use something like date.now(). ...
Window.content - Web APIs
Web › API › Window › content
ontent. the former has been deprecated for a long time, and you should use content in any new code. syntax var windowobject = window.content; example executing the following code in a chrome xul window with a <browser type="content-primary"/> element in it draws a red border around the first div on the page currently displayed in the browser: content.document.getelementsbytagname("div")[0].style.border = "solid red 1px"; specification none. see also working with windows in chrome code when accessing content documents from privileged code, be aware of xpcnativewrappers. ...
Window.frames - Web APIs
Web › API › Window › frames
ment (i.e., window.frames[0] is the same thing as document.getelementsbytagname("iframe")[0].contentwindow). for more details about the returned value, refer to this thread on mozilla.dev.platform. example var frames = window.frames; // or // var frames = window.parent.frames; for (var i = 0; i < frames.length; i++) { // do something with each subframe as frames[i] frames[i].document.body.style.background = "red"; } specifications specification status comment html living standardthe definition of 'window.frames' in that specification. living standard html5the definition of 'window.frames' in that specification. recommendation ...
Window: load event - Web APIs
Web › API › Window › load event
this is in contrast to domcontentloaded, which is fired as soon as the page dom has been loaded, without waiting for resources to finish loading. ...
Window.requestAnimationFrame() - Web APIs
* elapsed. the element's final position is 200px (0.1 * 2000) to the right of its initial position. const element = document.getelementbyid('some-element-you-want-to-animate'); let start; function step(timestamp) { if (start === undefined) start = timestamp; const elapsed = timestamp - start; // `math.min()` is used here to make sure that the element stops at exactly 200px. element.style.transform = 'translatex(' + math.min(0.1 * elapsed, 200) + 'px)'; if (elapsed < 2000) { // stop the animation after 2 seconds window.requestanimationframe(step); } } window.requestanimationframe(step); notes edge versions below 17 and internet explorer do not reliably fire requestanimationframe before the paint cycle. specification specification status comment ...
WindowOrWorkerGlobalScope.caches - Web APIs
storage = self.caches; // or just caches value a cachestorage object. example the following example shows how you'd use a cache in a service worker context to store assets offline. ...
XRTargetRayMode - Web APIs
targeting may be done by looking at the target using a gaze-tracking system, pointing at the target with a hand controller, glove, or motion-tracking system, or by tapping or clicking on the target using a finger on a screen or with a mouse. typically a target ray is drawn from the source of the targeting system along the target ray in the direction in which the user is looking or pointing. the style of the ray is generally up to you, as is the method for indicating the endpoint of the ray. the targeted point or object might be indicated by drawing a shape or highlighting the targeted surface or object. a target ray emitted by a hand controller. the target ray can be anything from a simple line (ideally fading over distance) to an animated effect, such as the science-fiction "phaser" st...
Browser Differences - Web APIs
netscape 6.x only partially supported xslt 1.0. ...
msGetPropertyEnabled - Web APIs
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the msgetpropertyenabled returns whether a given property in the style object is enabled. this proprietary method is specific to internet explorer browser. syntax var retval = style.msgetpropertyenabled(name); parameters name [in] type: string the name of the property to enable. return value type: boolean if false, the property is not enabled. if true, the property is enabled. see also microsoft api extensions ...
Using the aria-label attribute - Accessibility
ical html element; it is not limited to elements that have an aria role assigned. value string possible effects on user agents and assistive technology note: opinions may differ on how assistive technology should handle this technique. the information provided above is one of those opinions and therefore not normative. examples example 1: multiple labels in the example below, a button is styled to look like a typical "close" button, with an x in the middle. since there is nothing indicating that the purpose of the button is to close the dialog, the aria-label attribute is used to provide the label to any assistive technologies. <button aria-label="close" onclick="mydialog.close()">x</button> notes the most common accessibility api mapping for a label is the accessible name prop...
Using the link role - Accessibility
assistive technology. this is a huge amount of work just to recreate something you've get for free using the <a> element, so you should really use that if possible. but this shows that it can be done. you should however note that there are still problems with this approach: it is very difficult to detect whether the target of the fake link has been visited before, and therefore use :visited styles (e.g. the default purple color for visited links). opening a page using the open() method counts as being a popup, and certain browsers may issue a warning when you try to activate it, or make you explicitly agree to allowing popups form the domain it exists on. html <h1>role="link" example</h1> <span data-href="https://mozilla.org" tabindex="0" id="link1" role="link" class="link"> fake a...
ARIA: alert role - Accessibility
age loads with multiple visible alerts scattered throughout, none would be read because they are not dynamically triggered. examples the most basic way to trigger an alert is by adding role="alert" to an element that has display: none; by default. when the display value is changed with css or javascript, it would automatically trigger the screen reader to read out the content. <p role="alert" style="display: none;">the alert will trigger when the element becomes visible.</p> while triggering an alert via css alone is possible, it is better to rely on javascript because it has more browser/screen reader support and is often more appropriate as part of a larger user interaction such as inside an event handler or form validation. with javascript, developers control the adding and removing of ...
ARIA: switch role - Accessibility
vate the switch. there are varying opinions on how assistive technologies should handle this role; the above is a suggested practice and may differ from other sources. examples the following examples should help you understand how to apply and use the switch role. adding the switch role in aria this simple example just creates a widget and assigns the aria switch role to it. the button is styled with an appearance reminiscent of an on/off power switch. html the html is fairly simple here. the switch is implemented as a <button> element which is initially checked courtesy of its aria-checked attribute being set to "true". the switch has two child elements containing the "off" and "on" labels and is followed by a <label> identifying the switch. <button role="switch" aria-checked="true"...
ARIA: tab role - Accessibility
ssistive technology. each tab is a button with the attributes previously mentioned. the first tab has tabindex=0 on it, which we will later change to whatever tab has aria-selected=true. all of the tabpanel elements have tabindex=0 to make them tabbable, and all but the currently active one have the hidden attribute, which we will change with javascript. there is some basic styling applied that restyles the buttons and changes the z-index to of tab elements to give the illusion of it connecting to the tabpanel for active elements, and the illusion that inactive elements are behind the active tabpanel. <div class="tabs"> <div role="tablist" aria-label="sample tabs"> <button role="tab" aria-selected="true" aria-controls="panel-1" id="tab-1" tabindex="0"> first tab </butto...
WAI-ARIA Roles - Accessibility
f elements on a page that provide equivalent functionality to an html form.aria: grid rolethe grid role is for a widget that contains one or more rows of cells. the position of each cell is significant and can be focused using keyboard input.aria: gridcell rolethe gridcell role is used to make a cell in a grid or treegrid. it is intended to mimic the functionality of the html td element for table-style grouping of information.aria: heading rolethe heading role defines this element as a heading to a page or section. to give the page more structure, a level should also be provided to indicate relationships between sections.aria: img rolethe aria img role can be used to identify multiple elements inside page content that should be considered as a single image. these elements could be images, code ...
overview - Accessibility
warning: needs updating introduction here's a look at working examples and best practices in building accessible javascript widgets. ...
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
cts in the differing uses of msaa (yet). however, be on guard. if a vendors asks you to do something different from the spec, it's better to check with the other vendors before moving forward. check to see what applications from microsoft do in a similar situation. undocumented window class usage problem: for common controls, msaa is actually less direct than simply getting the window class and style bits for a window, so at products only look for it only when necessary. in fact, when a control has its own window, it's easy for a 3rd party application to know whether the object is disabled, focused, hidden, checked, etc. some assistive technologies will look for msaa if it doesn't already know that the given window class is used for something common. common examples are button, listbox, comb...
Accessibility documentation index - Accessibility
. 64 aria: grid role aria, html the grid role is for a widget that contains one or more rows of cells. the position of each cell is significant and can be focused using keyboard input. 65 aria: gridcell role aria, html the gridcell role is used to make a cell in a grid or treegrid. it is intended to mimic the functionality of the html td element for table-style grouping of information. 66 aria: heading role aria, aria role, aria heading, reference the heading role defines this element as a heading to a page or section. to give the page more structure, a level should also be provided to indicate relationships between sections. 67 aria: img role aria, aria img, aria role, accessibility, reference, rôle, figure th...
Mobile accessibility checklist - Accessibility
other means too (underlined text for links, etc.) visibility content hiding techniques such as zero opacity, z-index order and off-screen placement must not be used exclusively to handle visibility. everything other than the currently visible screen must be truly invisible (especially relevant for single page apps with multiple cards): use the hidden attribute or visibility or display style properties. unless absolutely unavoidable, aria-hidden attribute should not be used. focus all activatable elements must be focusable: standard controls such as links, buttons, and form fields are focusable by default. non-standard controls must have an appropriate aria role assigned to them, such as button, link, or checkbox. focus should be handled in a logical orde...
Color contrast - Accessibility
areas as readily as those without such conditions, and therefore have trouble seeing edges, borders, and other details. it is good to have a cool design on your website, but the design is worthless if your users can't read your content. examples let's have a look at some simple html and css code: <div class="good">good contrast</div> <div class="bad">bad contrast</div> div { /* general div styles here */ } .good { background-color: #fae6fa; } .bad { background-color: #400064; } both pieces of text have their default black color. the "good" <div> has a light purple background, which makes the text easy to read: example1 <div class="good"> good contrast </div> div { font-family: sans-serif; text-align: center; font-size: 2rem; font-weight: bold; width: 25...
Accessibility
anding the web content accessibility guidelines this set of articles provides quick explanations to help you understand the steps that need to be taken to conform to the recommendations outlined in the w3c web content accessibility guidelines 2.0 (wcag 2.0 or just wcag, for the purposes of this writing). keyboard-navigable javascript widgets until now, web developers who want to make their styled <div> and <span> based widgets accessible have lacked the proper techniques. keyboard accessibility is part of the minimum accessibility requirements which a developer should be aware of. aria a collection of articles to learn how to use aria to make your html documents more accessible. assistive technology (at) development a collection of articles intended for at developers mobile accessib...
regexp:match() - EXSLT
Web › EXSLT › regexp › match
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes regexp:match() performs regular expression matching on a string, returning the submatches found as a result. syntax regexp:match(targetstring, regexpstring[, flagsstring]) parameters targetstring the string to perform regular expression matching upon. regexpstring the javascript style regular expression to evaluate. flagsstringoptional an optional string containing character flags. the character flags are: g global match the submatches from every match in the string are returned. if this flag isn't specified, only the submatches from the first match are returned. i case insensitive match if this flag is specified, the match is performed in a case insensitive fashion. returns ...
regexp:replace() - EXSLT
Web › EXSLT › regexp › replace
reference: xslt elements, exslt functions, xpath functions, xpath axes regexp:replace() replaces the portions of a string that match a given regular expression with the contents of another string. syntax regexp:replace(originalstring, regexpstring, flagsstring, replacestring) parameters originalstring the string perform a search-and-replace operation upon. regexpstring the javascript style regular expression to evaluate. flagsstring the string containing character flags. replacestring the string with which the matched substrings are to be replaced. the character flags are: g - global replace if this flag is specified, all occurrences of the regular expression within the originalstring are replaced. otherwise only the first occurrence is replaced. i - case insensitive mat...
regexp:test() - EXSLT
Web › EXSLT › regexp › test
flagsstringoptional an optional string containing character flags. ...
Regular expressions (regexp) - EXSLT
Web › EXSLT › regexp
the namespace for the regular expressions package is http://exslt.org/regular-expressions. ...
Guide to Web APIs - Developer guides
Web › Guide › API
from javascript to build increasingly more powerful and capable applications, running either on the web, locally, or through technology such as node.js, on a server. on this page you'll find a complete list of all of the apis provided by the full web technology stack. ...
Setting up adaptive streaming media sources - Developer guides
index files (playlists) the hls index file (much like mpeg-dash's .mpd file) contains the information on where all the media segments reside, as well as other meta data such as bandwidth application. apple uses the .m3u8 format (an extension of its .m3u playlist format) for index files — see below for an example: #ext-x-version:3 #extm3u #ext-x-targetduration:10 #ext-x-media-sequence:1 # old-style integer duration; avoid for newer clients. #extinf:10, http://media.example.com/segment0.ts # new-style floating-point duration; use for modern clients. #extinf:10.0, http://media.example.com/segment1.ts #extinf:9.5, http://media.example.com/segment2.ts #ext-x-endlist note: comprehensive information on how to encode media for apple's hls format can be found on apple's developer pages. see al...
Audio and video manipulation - Developer guides
he data from the intermediary <canvas> element and manipulate it. write the manipulated data to your "display" <canvas>. pause and repeat. for example, let's process a video to display it in greyscale. in this case, we'll show both the source video and the output greyscale frames. ordinarily, if you were implementing a "play video in greyscale" feature, you'd probably add display: none to the style for the <video> element, to keep the source video from being drawn to the screen while showing only the canvas showing the altered frames. html we can set up our video player and <canvas> element like this: <video id="my-video" controls="true" width="480" height="270" crossorigin="anonymous"> <source src="https://udn.realityripple.com/samples/5b/8cd6da9c65.webm" type="video/webm"> <source ...
Event developer guide - Developer guides
Web › Guide › Events
ritten. our hope is that everything you need to know about events will go under here. docs creating and triggering eventsthis article demonstrates how to create and dispatch dom events. such events are commonly called synthetic events, as opposed to the events fired by the browser itself.dom on-event handlersthe web platform provides several ways to get notified of dom events. ...
HTML5 Parser - Developer guides
Web › Guide › HTML › HTML5 › HTML5 Parser
urity vulnerability. if an attacker could force a premature end-of-file, the parser might change which parts of the document it considered to be executable scripts. in addition, supporting reparsing led to unnecessarily complex parsing code. with html5, parsers no longer reparse documents. this change has the following consequences for web developers: if you omit the closing tag for <title>, <style>, <textarea>, or <xmp>, the page will fail to be parsed. ie already fails to parse documents with a missing </title> tag, so if you test with ie, you probably don't have that problem. if you forget to close a comment, the page will most likely fail to be parsed. however, unclosed comments often already break in existing browsers for one reason or another, so it's unlikely that you have this issu...
Separate sites for mobile and desktop - Developer guides
logic to solve all three goals of mobile web development at once — if the user’s browser looks like it’s on a phone, you serve them mobile content, formatted for their phone and optimized for speed. conceptually simple, this is the easiest option to add to an existing site, especially if you are using a cms or web application that supports templates. since only the mobile-specific content, styles, and scripts are sent to mobile users, this method also provides for the best performance out of any of the other options presented here. finally, it also allows for completely different user experiences on desktop and mobile — they’re two different sites, after all! the bad unfortunately, this approach is not without its drawbacks. for starters, you are now maintaining two different pages f...
Developer guides
these articles provide how-to information to help make use of specific web technologies and apis. html learning area hypertext markup language (html) is the core language of nearly all web content. most of what you see on screen in your browser is described, fundamentally, using html. css learning area cascading style sheets (css) is a stylesheet language used to define the presentation of a document written in html. audio and video delivery we can deliver audio and video on the web in several ways, ranging from 'static' media files to adaptive live streams. this article is intended as a starting point for exploring the various delivery mechanisms of web-based media and compatibility with popular browsers. audio and video manipulation the beauty of the web is that you can co...
HTML attribute: minlength - HTML: Hypertext Markup Language
e user. once submission fails, some browsers will display an error message indicating the minimum length required and the current length. examples by adding minlength="5", the value must either be empty or five characters or longer to be valid. <label for="fruit">enter a fruit name that is at least 5 letters long</label> <input type="text" minlength="5" id="fruit"> we can use pseudoclasses to style the element based on whether the value is valid. the value will be valid as long as it is either null (empty) or five or more characters long. lime is invalid, lemon is valid. input { border: 2px solid currentcolor; } input:invalid { border: 2px dashed red; } input:invalid:focus { background-image: linear-gradient(pink, lightgreen); } specifications specification status ...
<a>: The Anchor element - HTML: Hypertext Markup Language
Web › HTML › Element › a
it. ...
<body>: The Document Body element - HTML: Hypertext Markup Language
Web › HTML › Element › body
the html <body> element represents the content of an html document. there can be only one <body> element in a document. content categories sectioning root. permitted content flow content. tag omission the start tag may be omitted if the first thing inside it is not a space character, comment, <script> element or <style> element. the end tag may be omitted if the <body> element has contents or has a start tag, and is not immediately followed by a comment. permitted parents it must be the second element of an <html> element. implicit aria role document permitted aria roles no role permitted dom interface htmlbodyelement the <body> element exposes the htmlbodyelement interface. you can access the <...
<br>: The Line Break element - HTML: Hypertext Markup Language
Web › HTML › Element › br
to control their size. attributes this element's attributes include the global attributes. deprecated attributes clear indicates where to begin the next line after the break. styling with css the <br> element has a single, well-defined purpose — to create a line break in a block of text. as such, it has no dimensions or visual output of its own, and there is very little you can do to style it. you can set a margin on <br> elements themselves to increase the spacing between the lines of text in the block, but this is a bad practice — you should use the line-height property that was designed for that purpose. examples simple br in the following example we use <br> elements to create line breaks between the different lines of a postal address: mozilla<br> 331 e. evelyn avenue<b...
<caption>: The Table Caption element - HTML: Hypertext Markup Language
Web › HTML › Element › caption
ed with respect to the table. it may have one of the following values: left the caption is displayed to the left of the table. top the caption is displayed above the table. right the caption is displayed to the right of the table. bottom the caption is displayed below the table. usage note: do not use this attribute, as it has been deprecated. the <caption> element should be styled using the css properties caption-side and text-align. usage notes the <caption> element should be the first child of its parent <table> element. when the <table> element that contains the <caption> is the only descendant of a <figure> element, you should use the <figcaption> element instead of <caption>. example this simple example presents a table that includes a caption. <table> <ca...
<center>: The Centered Text element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › center
erties like margin-left and margin-right and set them to auto (or set margin to 0 auto). dom interface this element implements the htmlelement interface. implementation note: up to gecko 1.9.2 inclusive, firefox implements the htmlspanelement interface for this element. example 1 <center>this text will be centered. <p>so will this paragraph.</p></center> example 2 (css alternative) <div style="text-align:center">this text will be centered. <p>so will this paragraph.</p></div> example 3 (css alternative) <p style="text-align:center">this line will be centered.<br> and so will this line.</p> note applying text-align:center to a <div> or <p> element centers the contents of those elements while leaving their overall dimensions unchanged. ...
<cite>: The Citation element - HTML: Hypertext Markup Language
Web › HTML › Element › cite
e work, as included within a <cite> element, may include the name of the work’s author. however, the whatwg specification for <cite> says the opposite: that a person’s name must never be included, under any circumstances. to include a reference to the source of quoted material which is contained within a <blockquote> or <q> element, use the cite attribute on the element. typically, browsers style the contents of a <cite> element in italics by default. to avoid this, apply the css font-style property to the <cite> element. example <p>more information can be found in <cite>[iso-0000]</cite>.</p> the html above outputs: specifications specification status comment html living standardthe definition of '<cite>' in that specification. living standard ...
<code>: The Inline Code element - HTML: Hypertext Markup Language
Web › HTML › Element › code
by default, the content text is displayed using the user agent's default monospace font. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. ...
<dialog>: The Dialog element - HTML: Hypertext Markup Language
Web › HTML › Element › dialog
ve and can be interacted with. when the open attribute is not set, the dialog shouldn't be shown to the user. usage notes <form> elements can close a dialog if they have the attribute method="dialog". when such a form is submitted, the dialog closes with its returnvalue property set to the value of the button that was used to submit the form. the ::backdrop css pseudo-element can be used to style behind a <dialog> element when the dialog is displayed with htmldialogelement.showmodal(). for example, to dim unreachable content behind the modal dialog. examples simple example <dialog open> <p>greetings, one and all!</p> </dialog> advanced example this example opens a pop-up dialog box that contains a form, when the "update details" button is clicked. html <!-- simple pop-up dialog...
<em>: The Emphasis element - HTML: Hypertext Markup Language
Web › HTML › Element › em
ributes this element only includes the global attributes. usage notes the <em> element is for words that have a stressed emphasis compared to surrounding text, which is often limited to a word or words of a sentence and affects the meaning of the sentence itself. typically this element is displayed in italic type. however, it should not be used simply to apply italic styling; use the css font-style property for that purpose. use the <cite> element to mark the title of a work (book, play, song, etc.). use the <i> element to mark text that is in an alternate tone or mood, which covers many common situations for italics such as scientific names or words in other languages. use the <strong> element to mark text that has greater importance than surrounding text. <i> vs. <em> new developers are...
<figure>: The Figure with Optional Caption element - HTML: Hypertext Markup Language
Web › HTML › Element › figure
or.platform + "; "; txt+= "user-agent header: " + navigator.useragent + "; "; console.log("navigatorexample", txt); } </pre> </figure> quotations <figure> <figcaption><cite>edsger dijkstra:</cite></figcaption> <blockquote>if debugging is the process of removing software bugs, then programming must be the process of putting them in.</blockquote> </figure> poems <figure> <p style="white-space:pre"> bid me discourse, i will enchant thine ear, or like a fairy trip upon the green, or, like a nymph, with long dishevell'd hair, dance on the sands, and yet no footing seen: love is a spirit all compact of fire, not gross to sink, but light, and will aspire.</p> <figcaption><cite>venus and adonis</cite>, by william shakespeare</figcaption> </figure> specifications ...
<form> - HTML: Hypertext Markup Language
Web › HTML › Element › form
orm> element represents a document section containing interactive controls for submitting information. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. it is possible to use the :valid and :invalid css pseudo-classes to style a <form> element based on whether or not the elements inside the form are valid. content categories flow content, palpable content permitted content flow content, but not containing <form> elements tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content implicit aria role ...
<head>: The Document Metadata (Header) element - HTML: Hypertext Markup Language
Web › HTML › Element › head
note: <head> primarily holds information for machine processing, not human-readability. for human-visible information, like top-level headings and listed authors, see the <header> element. content categories none. permitted content if the document is an <iframe> srcdoc document, or if title information is available from a higher level protocol (like the subject line in html email), zero or more elements of metadata content. ...
<i>: The Idiomatic Text element - HTML: Hypertext Markup Language
Web › HTML › Element › i
used to display text in italics, much like the <b> element was used to display text in bold letters. this is no longer true, as these tags now define semantics rather than typographic appearance. a browser will typically still display the contents of the <i> element in italic type, but is, by definition, no longer required to do so. to display text in italic type, authors should use the css font-style property. be sure the text in question is not actually more appropriately marked up with another element. use <em> to indicate stress emphasis. use <strong> to indicate importance, seriousness, or urgency. use <mark> to indicate relevance. use <cite> to mark up the name of a work, such as a book, play, or song. use <dfn> to mark up the defining instance of a term. exampl...
<input type="email"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › email
d into the input box. browsers that implement the specification should be using an algorithm equivalent to the following regular expression: /^[a-za-z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-za-z0-9](?:[a-za-z0-9-]{0,61} [a-za-z0-9])?(?:\.[a-za-z0-9](?:[a-za-z0-9-]{0,61}[a-za-z0-9])?)*$/ to learn more about how form validation works and how to take advantage of the :valid and :invalid css properties to style the input based on whether or not the current value is valid, see form data validation. note: there are known specification issues related to international domain names and the validation of e-mail addresses in html. see w3c bug 15489 for details. pattern validation if you need the entered e-mail address to be restricted further than just "any string that looks like an e-mail address," you c...
<ins> - HTML: Hypertext Markup Language
Web › HTML › Element › ins
" [insertion end] "; } some people who use screen readers deliberately disable announcing content that creates extra verbosity. because of this, it is important to not abuse this technique and only apply it in situations where not knowing content has been inserted would adversely affect understanding. short note on making your mark (more accessible) | the paciello group tweaking text level styles | adrian roselli specifications specification status comment html living standardthe definition of '<ins>' in that specification. living standard html5the definition of '<ins>' in that specification. recommendation html 4.01 specificationthe definition of '<ins>' in that specification. recommendation ...
<label> - HTML: Hypertext Markup Language
Web › HTML › Element › label
er elements which also match the id value, later in the document, they are not considered. note: a <label> element can have both a for attribute and a contained control element, as long as the for attribute points to the contained control element. styling with css there are no special styling considerations for <label> elements — structurally they are simple inline elements, and so can be styled in much the same way as a <span> or <a> element. you can apply styling to them in any way you want, as long as you don't cause the text to become difficult to read. examples simple label example <label>click me <input type="text"></label> using the "for" attribute <label for="username">click me</label> <input type="text" id="username"> accessibility concerns interactive content don't...
<li> - HTML: Hypertext Markup Language
Web › HTML › Element › li
nu>). note: this attribute was deprecated in html4, but reintroduced in html5. type this character attribute indicates the numbering type: a: lowercase letters a: uppercase letters i: lowercase roman numerals i: uppercase roman numerals 1: numbers this type overrides the one used by its parent <ol> element, if any. note: this attribute has been deprecated; use the css list-style-type property instead. examples for more detailed examples, see the <ol> and <ul> pages. ordered list <ol> <li>first item</li> <li>second item</li> <li>third item</li> </ol> ordered list with a custom value <ol type="i"> <li value="3">third item</li> <li>fourth item</li> <li>fifth item</li> </ol> unordered list <ul> <li>first item</li> <li>second ...
<listing> - HTML: Hypertext Markup Language
Web › HTML › Element › listing
way. even more it is obsoleted in html5 and may be rendered by conforming user-agents as the <pre> element, which will interpret the internal html! instead use the <pre> element or if semantically adequate the <code> element, eventually escaping the html '<' and '>' so that they don't get interpreted. a monospaced font can also be obtained on a simple <div> element, by applying an adequate css style using monospace as the generic-font value in a font-family property. attributes this element has no other attributes than the global attributes, common to all elements. dom interface this element implements the htmlelement interface. implementation note: up to gecko 1.9.2 inclusive, firefox implements the htmlspanelement interface for this element. browser compatibility the compatibili...
<mark>: The Mark Text element - HTML: Hypertext Markup Language
Web › HTML › Element › mark
[highlight end] "; } some people who use screen readers deliberately disable announcing content that creates extra verbosity. because of this, it is important to not abuse this technique and only apply it in situations where not knowing content has been highlighted would adversely affect understanding. short note on making your mark (more accessible) | the paciello group tweaking text level styles | adrian roselli specifications specification status comment html living standardthe definition of '<mark>' in that specification. living standard html5the definition of '<mark>' in that specification. recommendation ...
<marquee>: The Marquee element (Obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › marquee
number that is greater than 0. onstart fires when the marquee starts scrolling. methods start() starts scrolling of the marquee. stop() stops scrolling of the marquee. examples <marquee>this text will scroll from right to left</marquee> <marquee direction="up">this text will scroll from bottom to top</marquee> <marquee direction="down" width="250" height="200" behavior="alternate" style="border:solid"> <marquee behavior="alternate"> this text will bounce </marquee> </marquee> specifications specification status comment html living standardthe definition of '<marquee>' in that specification. living standard make it obsolete in favor of css but define its expected behavior, for backward compatibility. however, the development of the ma...
Standard metadata names - HTML: Hypertext Markup Language
Web › HTML › Element › meta › name
or browsers default to light mode if not otherwise configured. for example, to indicate that a document prefers dark mode but does render functionally in light mode as well: <meta name="color-scheme" content="dark light"> this works at the document level in the same way that the css color-scheme property lets individual elements specify their preferred and accepted color schemes. your styles can adapt to the current color scheme using the prefers-color-scheme css media feature. the css device adaptation specification defines the following metadata name: viewport: gives hints about the size of the initial size of the viewport. used by mobile devices only. values for the content of <meta name="viewport"> value possible subvalues description ...
<nobr>: The Non-Breaking Text element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › nobr
the non-standard, obsolete html <nobr> element prevents the text it contains from automatically wrapping across multiple lines, potentially resulting in the user having to scroll horizontally to see the entire width of the text. this element was never standard html and was not widely implemented, so you shouldn't use it. instead, use the css property white-space like this: <span style="white-space: nowrap;">long line with no breaks</span> ...
<noscript> - HTML: Hypertext Markup Language
Web › HTML › Element › noscript
t> element defines a section of html to be inserted if a script type on the page is unsupported or if scripting is currently turned off in the browser. content categories metadata content, flow content, phrasing content. permitted content when scripting is disabled and when it is a descendant of the <head> element: in any order, zero or more <link> elements, zero or more <style> elements, and zero or more <meta> elements. when scripting is disabled and when it isn't a descendant of the <head> element: any transparent content, but no <noscript> element must be among its descendants. otherwise: flow content or phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phra...
<ol>: The Ordered List element - HTML: Hypertext Markup Language
Web › HTML › Element › ol
rs a for uppercase letters i for lowercase roman numerals i for uppercase roman numerals 1 for numbers (default) the specified type is used for the entire list unless a different type attribute is used on an enclosed <li> element. note: unless the type of the list number matters (like legal or technical documents where items are referenced by their number/letter), use the css list-style-type property instead. usage notes typically, ordered list items display with a preceding marker, such as a number or letter. the <ol> and <ul> elements may nest as deeply as desired, alternating between <ol> and <ul> however you like. the <ol> and <ul> elements both represent a list of items. the difference is with the <ol> element, the order is meaningful. for example: steps in a re...
<plaintext>: The Plain Text element (Deprecated) - HTML: Hypertext Markup Language
ead>), do not use html at all. instead serve a text file with the text/plain mime-type. instead of <plaintext>, use the <pre> element or, if semantically accurate (such as for inline text), the <code> element. escape any <, > and & characters, to prevent browsers inadvertently parsing content the element content as html. a monospaced font can be applied to any html element via a css font-family style with the monospace generic value. attributes this element has no other attributes than the global attributes common to all elements. dom interface this element implements the htmlelement interface. implementation note: in gecko 1.9.2 and before, firefox implements the interface htmlspanelement for this element. ...
<q>: The Inline Quotation element - HTML: Hypertext Markup Language
Web › HTML › Element › q
tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlquoteelement usage note: most modern browsers will automatically add quotation marks around text inside a <q> element. a style rule may be needed to add quotation marks in older browsers. attributes this element includes the global attributes. cite the value of this attribute is a url that designates a source document or message for the information quoted. this attribute is intended to point to information explaining the context or the reference for the quote. example <p>according to mozilla's website, <q c...
<select>: The HTML Select element - HTML: Hypertext Markup Language
Web › HTML › Element › select
ding down the ctrl key then using the up and down cursor keys to change the "focused" select option, i.e. the one that will be selected if you choose to do so. the "focused" select option is highlighted with a dotted outline, in the same way as a keyboard-focused link. pressing space to select/deselect "focused" select options. styling with css the <select> element is notoriously difficult to style productively with css. you can affect certain aspects like any element — for example, manipulating the box model, the displayed font, etc., and you can use the appearance property to remove the default system appearance. however, these properties don't produce a consistent result across browsers, and it is hard to do things like line different types of form element up with one another in a col...
<sub>: The Subscript element - HTML: Hypertext Markup Language
Web › HTML › Element › sub
mitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. usage notes the <sub> element should be used only for typographical reasons—that is, to change the position of the text to comply with typographical conventions or standards, rather than solely for presentation or appearance purposes. for example, using <sub> to style the name of a company which uses altered baselines in their wordmark would not be appropriate; instead, css should be used (likely the vertical-align property, such as vertical-align: sub or, to more precisely control the baseline shift, vertical-align: -25%. appropriate use cases for <sub> include (but aren't necessarily limited to): marking up footnote numbers. see footnote numbers for an e...
<summary>: The Disclosure Summary element - HTML: Hypertext Markup Language
Web › HTML › Element › summary
er clicks on the summary, the parent <details> element is toggled open or closed, and then a toggle event is sent to the <details> element, which can be used to let you know when this state change occurs. default label text if a <details> element's first child is not a <summary> element, the user agent will use a default string (typically "details") as the label for the disclosure box. default style per the html specification, the default style for <summary> elements includes display: list-item. this makes it possible to change or remove the icon displayed as the disclosure widget next to the label from the default, which is typically a triangle. you can also change the style to display: block to remove the disclosure triangle. see the browser compatibility section for details, as not all...
<sup>: The Superscript element - HTML: Hypertext Markup Language
Web › HTML › Element › sup
permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. usage notes the <sup> element should only be used for typographical reasons—that is, to change the position of the text to comply with typographical conventions or standards, rather than solely for presentation or appearance purposes. for example, to style the wordmark of a business or product which uses a raised baseline should be done using css (most likely vertical-align) rather than <sup>. this would be done using, for example, vertical-align: super or, to shift the baseline up 50%, vertical-align: 50%. appropriate use cases for <sup> include (but aren't necessarily limited to): displaying exponents, such as "x3." it may be worth considerin...
<tfoot>: The Table Foot element - HTML: Hypertext Markup Language
Web › HTML › Element › tfoot
to give a similar effect to the bgcolor attribute, use the css property background-color, on the relevant <td> or <th> elements. char deprecated since html4obsolete since html5 this attribute is used to set the character to align the cells in a column on. typical values for this include a period (.) when attempting to align numbers or monetary values. if align is not set to cha...
<th> - HTML: Hypertext Markup Language
Web › HTML › Element › th
to create a similar effect use the background-color property in css instead. char obsolete since html5 the content in the cell element is aligned to a character. typical values include a period (.) to align numbers or monetary values. if align is not set to char, this attribute is ignored. note: do not use this attribute as it is obsolete in the latest standard. to achieve the...
<thead>: The Table Head element - HTML: Hypertext Markup Language
Web › HTML › Element › thead
to give a similar effect to the bgcolor attribute, use the css property background-color, on the relevant <td> or <th> elements. char in html 4, in html5 this attribute is used to set the character to align the cells in a column on. typical values for this include a period (.) when attempting to align numbers or monetary values. if align is not set to char, this attribute i...
<title>: The Document Title element - HTML: Hypertext Markup Language
Web › HTML › Element › title
of the components used by search engine algorithms to decide the order in which to list pages in search results. also, the title is the initial "hook" by which you grab the attention of readers glancing at the search results page. a few guidelines and tips for composing good titles: avoid one- or two-word titles. use a descriptive phrase, or a term-definition pairing for glossary or reference-style pages. search engines typically display about the first 55–60 characters of a page title. text beyond that may be lost, so try not to have titles longer than that. if you must use a longer title, make sure the important parts come earlier and that nothing critical is in the part of the title that is likely to be dropped. don't use "keyword blobs." if your title is just a list of words, algori...
<wbr> - HTML: Hypertext Markup Language
Web › HTML › Element › wbr
456</div> displays, when not broken on two lines, 123,456 and not 456,123. for the same reason, the <wbr> element does not introduce a hyphen at the line break point. to make a hyphen appear only at the end of a line, use the soft hyphen character entity (&shy;) instead. this element was first implemented in internet explorer 5.5 and was officially defined in html5. example the yahoo style guide recommends breaking a url before punctuation, to avoid leaving a punctuation mark at the end of the line, which the reader might mistake for the end of the url. <p>http://this<wbr>.is<wbr>.a<wbr>.really<wbr>.long<wbr>.example<wbr>.com/with<wbr>/deeper<wbr>/level<wbr>/pages<wbr>/deeper<wbr>/level<wbr>/pages<wbr>/deeper<wbr>/level<wbr>/pages<wbr>/deeper<wbr>/level<wbr>/pages<wbr>/deeper<wbr>...
<xmp> - HTML: Hypertext Markup Language
Web › HTML › Element › xmp
en deprecated since html3.2 and was not implemented in a consistent way. it was completely removed from the language in html5. use the <pre> element or, if semantically adequate, the <code> element instead. note that you will need to escape the '<' character as '&lt;' to make sure it is not interpreted as markup. a monospaced font can also be obtained on any element, by applying an adequate css style using monospace as the generic-font value for the font-family property. attributes this element has no other attributes than the global attributes, common to all elements. dom interface this element implements the htmlelement interface. implementation note: up to gecko 1.9.2 inclusive, firefox implements the htmlspanelement interface for this element. ...
class - HTML: Hypertext Markup Language
...
hidden - HTML: Hypertext Markup Language
ing referenced from the element that they describe. similarly, a canvas element with the hidden attribute could be used by a scripted graphics engine as an off-screen buffer, and a form control could refer to a hidden form element using its form attribute. note: changing the value of the css display property on an element with the hidden attribute overrides the behavior. for instance, elements styled display: flex will be displayed despite the hidden attribute's presence. specifications specification status comment html living standardthe definition of 'hidden' in that specification. living standard no change from latest snapshot, html 5.1 html living standardthe definition of 'hidden elements' in that specification. living standard defines the...
id - HTML: Hypertext Markup Language
...
part - HTML: Hypertext Markup Language
see our shadow part example for a usage example. ...
Using the application cache - HTML: Hypertext Markup Language
be used. the cache, network, and fallback sections can be listed in any order in a cache manifest file, and each section can appear more than once in a single manifest. example 2: a more complete cache manifest file the following is a more complete cache manifest file for the imaginary web site at www.example.com: cache manifest # v1 2011-08-14 # this is another comment index.html cache.html style.css image1.png # use from network if available network: network.html # fallback content fallback: . fallback.html this example uses network and fallback sections to specify that the network.html page must always be retrieved from the network, and that the fallback.html page should be served as a fallback resource (e.g., in case a connection to the server cannot be established). structure of ...
Common MIME types - HTTP
/x-msvideo .azw amazon kindle ebook format application/vnd.amazon.ebook .bin any kind of binary data application/octet-stream .bmp windows os/2 bitmap graphics image/bmp .bz bzip archive application/x-bzip .bz2 bzip2 archive application/x-bzip2 .csh c-shell script application/x-csh .css cascading style sheets (css) text/css .csv comma-separated values (csv) text/csv .doc microsoft word application/msword .docx microsoft word (openxml) application/vnd.openxmlformats-officedocument.wordprocessingml.document .eot ms embedded opentype fonts application/vnd.ms-fontobject .epub electronic publication (epub) application/epub...
MIME types (IANA media types) - HTTP
it. note that text/plain does not mean "any kind of textual data." if they expect a specific kind of textual data, they will likely not consider it a match. specifically if they download a text/plain file from a <link> element declaring a css file, they will not recognize it as a valid css file if presented with text/plain. the css mime type text/css must be used. text/css css files used to style a web page must be sent with text/css. if a server doesn't recognize the .css suffix for css files, it may send them with text/plain or application/octet-stream mime types. if so, they won't be recognized as css by most browsers and will be ignored. text/html all html content should be served with this type. alternative mime types for xhtml (like application/xhtml+xml) are mostly useless nowada...
Browser detection using the user agent - HTTP
what you want to do for screen size is not slash off information on smaller screens. that will only annoy people because it will force them to use the desktop version. rather, try to have fewer columns of information in a longer page...
Reason: CORS request not HTTP - HTTP
st not http what went wrong? cors requests may only use the https url scheme, but the url specified by the request is of a different type. this often occurs if the url specifies a local file, using a file:/// url. to fix this problem, simply make sure you use https urls when issuing requests involving cors, such as xmlhttprequest, fetch apis, web fonts (@font-face), and webgl textures, and xsl stylesheets. local file security in firefox 68 when a user opened a page using a file:/// uri in firefox 67 and earlier, the origin of the page was defined as the directory from which the page was opened. resources in the same directory and its subdirectories were treated as having the same origin for purposes of the cors same-origin rule. in response to cve-2019-11730, firefox 68 and later define t...
HTTP caching - HTTP
Web › HTTP › Caching
y induce an additional change to often variable resources. when these are read, the new versions of the others are also read. this technique has an additional benefit: updating two cached resources at the same time will not lead to the situation where the out-dated version of one resource is used in combination with the new version of the other one. this is very important when web sites have css stylesheets or js scripts that have mutual dependencies, i.e., they depend on each other because they refer to the same html elements. the revision version added to revved resources doesn't need to be a classical revision string like 1.1.3, or even a monotonously growing suite of number. it can be anything that prevent collisions, like a hash or a date. cache validation when a cached document's ex...
List of default Accept values - HTTP
alues. user agent value comment firefox */* see bug 170789 safari, chrome */* source internet explorer 8 or earlier */* see ie and the accept header (ieinternals' msdn blog) internet explorer 9 application/javascript, */*;q=0.8 see fiddler is better with internet explorer 9 (ieinternals' msdn blog) values for a css stylesheet when a css stylesheet is requested, via the <link rel="stylesheet"> html element, most browsers use specific values. user agent value comment firefox 4 text/css,*/*;q=0.1 see bug 170789 source internet explorer 8 or earlier */* see ie and the accept header (ieinternals' msdn blog) internet explorer 9 text/css see fiddler is better...
Accept - HTTP
Web › HTTP › Headers › Accept
the accept request http header advertises which content types, expressed as mime types, the client is able to understand. using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice with the content-type response header. browsers set adequate values for this header depending on the context where the request is done: when fetching a css stylesheet a different value is set for the request than when fetching an image, video or a script. header type request header forbidden header name no cors-safelisted request header yes, with the additional restriction that values can't contain a cors-unsafe request header byte: 0x00-0x1f (except 0x09 (ht)), "():<>?@[\]{}, and 0x7f (del). syntax accept: <mime_...
CSP: require-sri-for - HTTP
the http content-security-policy require-sri-for directive instructs the client to require the use of subresource integrity for scripts or styles on the page. syntax content-security-policy: require-sri-for script; content-security-policy: require-sri-for style; content-security-policy: require-sri-for script style; script requires sri for scripts. style requires sri for style sheets. script style requires sri for both, scripts and style sheets. examples if you set your site to require sri for script and styles using this directive: content-security-policy: require-sri-for script style <script> elements like the following will be loaded as they use a valid integrity attribute. <script src="https://code.jquery.com/jquery-3.1.1.slim.js" integrity="sha256-5i/mq300m779n2...
Cookie2 - HTTP
Web › HTTP › Headers › Cookie2
the obsolete cookie2 http request header used to advise the server that the user agent understands "new-style" cookies, but nowadays user agents will use the cookie header instead, not this one. header type request header forbidden header name yes examples cookie2: $version="1" specifications specification title rfc 2965: cookie2 historic specification of http state management mechanism, obsoleted by rfc 6265 ...
Sec-Fetch-Dest - HTTP
yntax sec-fetch-dest: audio sec-fetch-dest: audioworklet sec-fetch-dest: document sec-fetch-dest: embed sec-fetch-dest: empty sec-fetch-dest: font sec-fetch-dest: image sec-fetch-dest: manifest sec-fetch-dest: nested-document sec-fetch-dest: object sec-fetch-dest: paintworklet sec-fetch-dest: report sec-fetch-dest: script sec-fetch-dest: serviceworker sec-fetch-dest: sharedworker sec-fetch-dest: style sec-fetch-dest: track sec-fetch-dest: video sec-fetch-dest: worker sec-fetch-dest: xslt sec-fetch-dest: audioworklet sec-fetch-dest: audioworklet values audio audioworklet document embed empty font image manifest object paintworklet report script serviceworker sharedworker style track video worker xslt nested-document examples to...
HTTP headers - HTTP
Web › HTTP › Headers
is a structured header whose value is a boolean so possible values are ?0 for false and ?1 for true. sec-fetch-dest it is a request header that indicates the request's destination to a server. it is a structured header whose value is a token with possible values audio, audioworklet, document, embed, empty, font, image, manifest, object, paintworklet, report, script, serviceworker, sharedworker, style, track, video, worker, xslt, and nested-document. server-sent events last-event-id ... nel defines a mechanism that enables developers to declare a network error reporting policy. ping-from ... ping-to ... report-to used to specify a server endpoint for the browser to send warning and error reports to. transfer coding transfer-encoding specifies the form of encoding used to ...
Link prefetching FAQ - HTTP
ormat for the link: header is described in rfc 5988 section 5. the browser observes all of these hints and queues up each unique request to be prefetched when the browser is idle. there can be multiple hints per page, as it might make sense to prefetch multiple documents. for example, the next document might contain several large images. some more examples follow: <link rel="prefetch alternate stylesheet" title="designed for mozilla" href="mozspecific.css"> <link rel="next" href="2.html"> are anchor (<a>) tags prefetched? no, only <link> tags with a relation type of next or prefetch are prefetched. however, if there is sufficient interest, we may expand link prefetching support to include prefetching <a> tags, which include a relation type of next or prefetch in the future. doing so would...
HTTP
Web › HTTP
oss-origin resource sharing (cors) cross-site http requests are http requests for resources from a different domain than the domain of the resource making the request. for instance, an html page from domain a (http://domaina.example/) makes a request for an image on domain b (http://domainb.foo/image.jpg) via the img element. web pages today very commonly load cross-site resources, including css stylesheets, images, scripts, and other resources. cors allows web developers to control how their site reacts to cross-site requests. evolution of http a brief description of the changes between the early versions of http, to the modern http/2, the emergent http/3 and beyond. mozilla web security guidelines a collection of tips to help operational teams with creating secure web applications. ...
About JavaScript - JavaScript
at is javascript? javascript® (often shortened to js) is a lightweight, interpreted, object-oriented language with first-class functions, and is best known as the scripting language for web pages, but it's used in many non-browser environments as well. it is a prototype-based, multi-paradigm scripting language that is dynamic, and supports object-oriented, imperative, and functional programming styles. javascript runs on the client side of the web, which can be used to design / program how the web pages behave on the occurrence of an event. javascript is an easy to learn and also powerful scripting language, widely used for controlling web page behavior. contrary to popular misconception, javascript is not "interpreted java". in a nutshell, javascript is a dynamic scripting language support...
Closures - JavaScript
font-family: helvetica, arial, sans-serif; font-size: 12px; } h1 { font-size: 1.5em; } h2 { font-size: 1.2em; } such interactive text size buttons can change the font-size property of the body element, and the adjustments are picked up by other elements on the page thanks to the relative units. here's the javascript: function makesizer(size) { return function() { document.body.style.fontsize = size + 'px'; }; } var size12 = makesizer(12); var size14 = makesizer(14); var size16 = makesizer(16); size12, size14, and size16 are now functions that resize the body text to 12, 14, and 16 pixels, respectively. you can attach them to buttons (in this case hyperlinks) as demonstrated in the following code example. document.getelementbyid('size-12').onclick = size12; document.get...
Functions - JavaScript
2); // logs [8, 6, 7, 9] var a3 = a.map(s => s.length); console.log(a3); // logs [8, 6, 7, 9] no separate this until arrow functions, every new function defined its own this value (a new object in the case of a constructor, undefined in strict mode function calls, the base object if the function is called as an "object method", etc.). this proved to be less than ideal with an object-oriented style of programming. function person() { // the person() constructor defines `this` as itself. this.age = 0; setinterval(function growup() { // in nonstrict mode, the growup() function defines `this` // as the global object, which is different from the `this` // defined by the person() constructor. this.age++; }, 1000); } var p = new person(); in ecmascript 3/5, this issue ...
Using Promises - JavaScript
e created from scratch using its constructor. this should be needed only to wrap old apis. in an ideal world, all asynchronous functions would already return promises. unfortunately, some apis still expect success and/or failure callbacks to be passed in the old way. the most obvious example is the settimeout() function: settimeout(() => saysomething("10 seconds passed"), 10*1000); mixing old-style callbacks and promises is problematic. if saysomething() fails or contains a programming error, nothing catches it. settimeout is to blame for this. luckily we can wrap settimeout in a promise. best practice is to wrap problematic functions at the lowest possible level, and then never call them directly again: const wait = ms => new promise(resolve => settimeout(resolve, ms)); wait(10*1000).th...
Working with objects - JavaScript
if you already go for the object initializer when defining a prototype you will probably most of the time choose the first form. this form is more compact and natural. however, if you need to add getters and setters later — because you did not write the prototype or particular object — then the second form is the only possible form. the second form probably best represents t...
Memory Management - JavaScript
var d = new date(); // allocates a date object var e = document.createelement('div'); // allocates a dom element some methods allocate new values or objects: var s = 'azerty'; var s2 = s.substr(0, 3); // s2 is a new string // since strings are immutable values, // javascript ...
Arrow function expressions - JavaScript
ments.map(({ length }) => length); // [8, 6, 7, 9] no separate this before arrow functions, every new function defined its own this value based on how the function was called: a new object in the case of a constructor. undefined in strict mode function calls. the base object if the function was called as an "object method". etc. this proved to be less than ideal with an object-oriented style of programming. function person() { // the person() constructor defines `this` as an instance of itself. this.age = 0; setinterval(function growup() { // in non-strict mode, the growup() function defines `this` // as the global object (because it's where growup() is executed.), // which is different from the `this` // defined by the person() constructor. this.age++; ...
Array.prototype.toLocaleString() - JavaScript
amples using locales and options the elements of the array are converted to strings using their tolocalestring methods. object: object.prototype.tolocalestring() number: number.prototype.tolocalestring() date: date.prototype.tolocalestring() always display the currency for the strings and numbers in the prices array: var prices = ['¥7', 500, 8123, 12]; prices.tolocalestring('ja-jp', { style: 'currency', currency: 'jpy' }); // "¥7,¥500,¥8,123,¥12" for more examples, see also the intl, numberformat, and datetimeformat pages. specifications specification ecmascript (ecma-262)the definition of 'array.prototype.tolocalestring' in that specification. ecmascript internationalization api (ecma-402)the definition of 'array.prototype.tolocalestring' in ...
BigInt.prototype.toLocaleString() - JavaScript
uage that may not be supported, such as // balinese, include a fallback language, in this case indonesian console.log(bigint.tolocalestring(['ban', 'id'])); // → 123.456.789.123.456.789 using options the results provided by tolocalestring can be customized using the options argument: var bigint = 123456789123456789n; // request a currency format console.log(bigint.tolocalestring('de-de', { style: 'currency', currency: 'eur' })); // → 123.456.789.123.456.789,00 € // the japanese yen doesn't use a minor unit console.log(bigint.tolocalestring('ja-jp', { style: 'currency', currency: 'jpy' })) // → ¥123,456,789,123,456,789 // limit to three significant digits console.log(bigint.tolocalestring('en-in', { maximumsignificantdigits: 3 })); // → 1,23,00,00,00,00,00,00,000 specificat...
Intl.DisplayNames() constructor - JavaScript
ujr", "guru", "hanidec", "khmr", "knda", "laoo", "latn", "limb", "mlym", "mong", "mymr", "orya", "tamldec", "telu", "thai", "tibt". options optional an object with some or all of the following properties: localematcher the locale matching algorithm to use. possible values are "lookup" and "best fit"; the default is "best fit". for information about this option, see the intl page. style the formatting style to use, the default is "long". "narrow" "short" "long" type the type to use, the default is "language". "language" "region" "script" "currency" fallback the fallback to use, the default is "code". "code" "none" examples basic usage in basic use without specifying a locale, a formatted string in the defaul...
Intl.NumberFormat.prototype.format() - JavaScript
es and send us a pull request. syntax numberformat.format(number) parameters number a number or bigint to format. description the format getter function formats a number into a string according to the locale and formatting options of this numberformat object. examples using format use the format getter function for formatting a single currency value, here for russia: var options = { style: 'currency', currency: 'rub' }; var numberformat = new intl.numberformat('ru-ru', options); console.log(numberformat.format(654321.987)); // → "654 321,99 руб." using format with map use the format getter function for formatting all numbers in an array. note that the function is bound to the numberformat from which it was obtained, so it can be passed directly to array.prototype.map. this...
Intl.NumberFormat.prototype.formatToParts() - JavaScript
r whitespace in the formatted number. minussign the minus sign string ("-"). nan the nan string ("nan"). plussign the plus sign string ("+"). percentsign the percent sign string ("%"). examples comparing format and formattoparts numberformat outputs localized, opaque strings that cannot be manipulated directly: var number = 3500; var formatter = new intl.numberformat('de-de', { style: 'currency', currency: 'eur' }); formatter.format(number); // "3.500,00 €" however, in many user interfaces there is a desire to customize the formatting of this string. the formattoparts method enables locale-aware formatting of strings produced by numberformat formatters by providing you the string in parts: formatter.formattoparts(number); // return value: [ { type: "integer", valu...
Intl.RelativeTimeFormat.prototype.format() - JavaScript
etimeformat object. examples basic format usage the following example shows how to create a relative time formatter using the english language. // create a relative time formatter in your locale // with default values explicitly passed in. const rtf = new intl.relativetimeformat("en", { localematcher: "best fit", // other values: "lookup" numeric: "always", // other values: "auto" style: "long", // other values: "short" or "narrow" }); // format relative time using negative value (-1). rtf.format(-1, "day"); // > "1 day ago" // format relative time using positive value (1). rtf.format(1, "day"); // > "in 1 day" using the auto option if numeric:auto option is passed, it will produce the string yesterday or tomorrow instead of 1 day ago or in 1 day. this allows to not always ...
Intl.RelativeTimeFormat - JavaScript
lization of the object. examples basic format usage the following example shows how to use a relative time formatter for the english language. // create a relative time formatter in your locale // with default values explicitly passed in. const rtf = new intl.relativetimeformat("en", { localematcher: "best fit", // other values: "lookup" numeric: "always", // other values: "auto" style: "long", // other values: "short" or "narrow" }); // format relative time using negative value (-1). rtf.format(-1, "day"); // > "1 day ago" // format relative time using positive value (1). rtf.format(1, "day"); // > "in 1 day" using formattoparts the following example shows how to create a relative time formatter returning formatted parts const rtf = new intl.relativetimeformat("en", { nu...
Number.prototype.toLocaleString() - JavaScript
hen requesting a language that may not be supported, such as // balinese, include a fallback language, in this case indonesian console.log(number.tolocalestring(['ban', 'id'])); // → 123.456,789 using options the results provided by tolocalestring can be customized using the options argument: var number = 123456.789; // request a currency format console.log(number.tolocalestring('de-de', { style: 'currency', currency: 'eur' })); // → 123.456,79 € // the japanese yen doesn't use a minor unit console.log(number.tolocalestring('ja-jp', { style: 'currency', currency: 'jpy' })) // → ¥123,457 // limit to three significant digits console.log(number.tolocalestring('en-in', { maximumsignificantdigits: 3 })); // → 1,23,000 // use the host default language with options for number forma...
Object.prototype.toLocaleString() - JavaScript
array: typedarray.prototype.tolocalestring() bigint: bigint.prototype.tolocalestring() examples array tolocalestring() override on array objects, tolocalestring() can be used to print array values as a string, optionally with locale-specific identifiers (such as currency symbols) appended to them: for example: const testarray = [4, 7, 10]; let europrices = testarray.tolocalestring('fr', { style: 'currency', currency: 'eur'}); // "4,00 €,7,00 €,10,00 €" date tolocalestring() override on date objects, tolocalestring() is used to print out date displays more suitable for specific locales: for example: const testdate = new date(date.now()); // "date fri may 29 2020 18:04:24 gmt+0100 (british summer time)" let dedate = testdate.tolocalestring('de'); // "29.5.2020, 18:04:24" var f...
SharedArrayBuffer() constructor - JavaScript
the sharedarraybuffer() constructor is used to create a sharedarraybuffer object representing a generic, fixed-length raw binary data buffer, similar to the arraybuffer object. the source for this interactive example is stored in a github repository. ...
String.prototype.big() - JavaScript
g in a <big> tag: "<big>str</big>". examples using big() the following example uses string methods to change the size of a string: var worldstring = 'hello, world'; console.log(worldstring.small()); // <small>hello, world</small> console.log(worldstring.big()); // <big>hello, world</big> console.log(worldstring.fontsize(7)); // <fontsize=7>hello, world</fontsize> with the element.style object you can get the element's style attribute and manipulate it more generically, for example: document.getelementbyid('yourelemid').style.fontsize = '2em'; specifications specification ecmascript (ecma-262)the definition of 'string.prototype.big' in that specification. ...
String.prototype.fontcolor() - JavaScript
by producing a string with the html <font> tag. var worldstring = 'hello, world'; console.log(worldstring.fontcolor('red') + ' is red in this line'); // '<font color="red">hello, world</font> is red in this line' console.log(worldstring.fontcolor('ff00') + ' is red in hexadecimal in this line'); // '<font color="ff00">hello, world</font> is red in hexadecimal in this line' with the element.style object you can get the element's style attribute and manipulate it more generically, for example: document.getelementbyid('yourelemid').style.color = 'red'; specifications specification ecmascript (ecma-262)the definition of 'string.prototype.fontcolor' in that specification. ...
String.prototype.fontsize() - JavaScript
set in the <basefont> tag. examples using fontsize() the following example uses string methods to change the size of a string: var worldstring = 'hello, world'; console.log(worldstring.small()); // <small>hello, world</small> console.log(worldstring.big()); // <big>hello, world</big> console.log(worldstring.fontsize(7)); // <font size="7">hello, world</fontsize> with the element.style object you can get the element's style attribute and manipulate it more generically, for example: document.getelementbyid('yourelemid').style.fontsize = '0.7em'; specifications specification ecmascript (ecma-262)the definition of 'string.prototype.fontsize' in that specification. ...
String.prototype.replace() - JavaScript
al letters in the string are converted to lower case, and a hyphen is inserted just before the match location. the important thing here is that additional operations are needed on the matched item before it is given back as a replacement. the replacement function accepts the matched snippet as its parameter, and uses it to transform the case and concatenate the hyphen before returning. function stylehyphenformat(propertyname) { function uppertohyphenlower(match, offset, string) { return (offset > 0 ? '-' : '') + match.tolowercase(); } return propertyname.replace(/[a-z]/g, uppertohyphenlower); } given stylehyphenformat('bordertop'), this returns 'border-top'. because we want to further transform the result of the match before the final substitution is made, we must use a function.
String.prototype.small() - JavaScript
ll> tag: "<small>str</small>". examples using small() the following example uses string methods to change the size of a string: var worldstring = 'hello, world'; console.log(worldstring.small()); // <small>hello, world</small> console.log(worldstring.big()); // <big>hello, world</big> console.log(worldstring.fontsize(7)); // <font size="7">hello, world</fontsize> with the element.style object you can get the element's style attribute and manipulate it more generically, for example: document.getelementbyid('yourelemid').style.fontsize = '0.7em'; specifications specification ecmascript (ecma-262)the definition of 'string.prototype.small' in that specification. ...
TypedArray.prototype.toLocaleString() - JavaScript
onstructor for details on these parameters and how to use them. return value a string representing the elements of the typed array. examples using tolocalestring var uint = new uint32array([2000, 500, 8123, 12, 4212]); uint.tolocalestring(); // if run in a de-de locale // "2.000,500,8.123,12,4.212" uint.tolocalestring('en-us'); // "2,000,500,8,123,12,4,212" uint.tolocalestring('ja-jp', { style: 'currency', currency: 'jpy' }); // "¥2,000,¥500,¥8,123,¥12,¥4,212" specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.tolocalestring' in that specification. ...
WebAssembly.Global - JavaScript
ted this object's instance. by default this is the webassembly.global() constructor. global.prototype[@@tostringtag] the initial value of the @@tostringtag property is the string value "webassembly.global". global.prototype.value the value contained inside the global variable — this can be used to directly set and get the global's value. instance methods global.prototype.valueof() old-style method that returns the value contained inside the global variable. examples creating a new global instance the following example shows a new global instance being created using the webassembly.global() constructor. it is being defined as a mutable i32 type, with a value of 0. the value of the global is then changed, first to 42 using the global.value property, and then to 43 using the incgl...
this - JavaScript
ent on which the listener is placed (some browsers do not follow this convention for listeners added dynamically with methods other than addeventlistener()). ...
void operator - JavaScript
lt in an uncaught syntaxerror. javascript uris when a browser follows a javascript: uri, it evaluates the code in the uri and then replaces the contents of the page with the returned value, unless the returned value is undefined. the void operator can be used to return undefined. for example: <a href="javascript:void(0);"> click here to do nothing </a> <a href="javascript:void(document.body.style.backgroundcolor='green');"> click here for green background </a> note: javascript: pseudo protocol is discouraged over other alternatives, such as unobtrusive event handlers. non-leaking arrow functions arrow functions introduce a short-hand braceless syntax that returns an expression. this can cause unintended side effects by returning the result of a function call that previously return...
async function - JavaScript
async functions may also be defined as expressions. the source for this interactive demo is stored in a github repository. ...
JavaScript
-in-time compiled programming language with first-class functions. while it is most well-known as the scripting language for web pages, many non-browser environments also use it, such as node.js, apache couchdb and adobe acrobat. javascript is a prototype-based, multi-paradigm, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles. read more about javascript. this section is dedicated to the javascript language itself, and not the parts that are specific to web pages or other host environments. for information about api specifics to web pages, please see web apis and dom. the standard for javascript is ecmascript. as of 2012, all modern browsers fully support ecmascript 5.1. older browsers support at least ecmascript 3.
Web app manifests
to the user similarly to a native app (e.g., be installed on the homescreen of a device, providing users with quicker access and a richer experience). pwa manifests include its name, author, icon(s), version, description, and list of all the necessary resources (among other things). can pwa manifest contain comments? it is a json-formatted file, with one exception: it is allowed to contain "//"-style comments. members web manifests can contain the following keys. click each one for more information about it: background_colorcategoriesdescriptiondirdisplayiarc_rating_idiconslangnameorientationprefer_related_applicationsrelated_applicationsscopescreenshotsserviceworkershort_nameshortcutsstart_urltheme_color example manifest { "name": "hackerweb", "short_name": "hackerweb", "start_ur...
<maction> - MathML
essions. therefore each click increments the selection value. the syntax is: <maction actiontype="toggle" selection="positive-integer" > expression1 expression2 expressionn </maction>. tooltip: when the pointer moves over the expression, a tooltip box with a message is displayed near the expression. the syntax is: <maction actiontype="tooltip"> expression message </maction>. class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color and also the fraction line color. you can use #rgb, #rrggbb and html color names. selection the child element which is addressed by the action. the default value is 1, which is the first child ele...
<menclose> - MathML
href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. notation a list of notations, separated by white space, to apply to the child elements. the symbols are each drawn as if the others are not present, and therefore may overlap. ...
<merror> - MathML
Web › MathML › Element › merror
the mathml <merror> element is used to display contents as error messages. in firefox this error message is rendered similar to the typical xml error message. note that this error is not thrown when your mathml markup is wrong or not well-formed xml. you will still get an xml parsing error (in case of the xhtml notation of mathml), which has nothing to do with <merror>. attributes class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color and also the fraction line color. you can use #rgb, #rrggbb and html color names. examples <math> <merror> <mrow> <mtext> division by zero: </mtext> <mfrac> <mn> 1 </mn> <m...
<mfenced> - MathML
the deprecated mathml <mfenced> element used to provide the possibility to add custom opening and closing parentheses (such as brackets) and separators (such as commas or semicolons) to an expression. it has been removed from the latest mathml standard and modern browsers no longer support it. use the <mrow> and <mo> elements instead. attributes class, id, style provided for use with stylesheets. close a string for the closing delimiter. the default value is ")" and any white space is trimmed. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color and also the fraction line color. you can use #rgb, #rrggbb and html color names. open a string for the opening delimiter. the defa...
<mfrac> - MathML
Web › MathML › Element › mfrac
s the way the fraction is displayed. if true, the fraction line is bevelled, which means that numerator and denominator are displayed side by side and separated by a slash (/). otherwise, if set to false (which is the default value), numerator and denominator are on top of each other. this attribute is deprecated and will be removed in the future. use u+2044 (fraction slash) instead. class, id, style provided for use with stylesheets. denomalign the alignment of the denominator under the fraction. possible values are: left, center (default), and right. this attribute is deprecated and will be removed in the future. use css text-align instead. href used to set a hyperlink to a specified uri. linethickness the thickness of the horizontal fraction line. this attributes accepts any leng...
<mglyph> - MathML
Web › MathML › Element › mglyph
the mathml <mglyph> element is used to display non-standard symbols where existing unicode characters are not available. it may be used within token elements. attributes alt this attribute defines the alternative text describing the image. users will see this displayed if the image url is wrong, the image is not in one of the supported formats, or until the image is downloaded. class, id, style provided for use with stylesheets. height the height of the image. href used to set a hyperlink to a specified uri. mathbackground the background color (if the image has transparency). you can use #rgb, #rrggbb and html color names. src the image url. valign specifies the vertical alignment with respect to the current baseline. width the width of the image. examples <math> <mi><m...
<mlabeledtr> - MathML
the mathml <mlabeledtr> element is used to represent a label in a row either on the left or on the right side (determined using the side attribute on the <mtable> element). child elements of <mlabeledtr> must be <mtd> elements. the first child is the label whereas all other children are representing row contents and are treated identically to children of <mtr> elements. attributes class, id, style provided for use with stylesheets. columnalign overrides the horizontal alignment of cells specified by <mtable> for this row. possible values are: left, center and right. groupalign href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color name...
<mmultiscripts> - MathML
escripts are optional and are separated by the empty tag <mprescripts/> (only one <mprescripts /> element is allowed, otherwise you will get an duplicatemprescripts error in the error console and "invalid-markup" in your rendering). in addition you are able to use <none/> as a placeholder for empty scripts (not for the base). see the examples section for a correct usage. attributes class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. subscriptshift the minimum space by which to shift the subscript below the baseline of the expression, as a css length. this property is depreca...
<mover> - MathML
Web › MathML › Element › mover
verscript </mover> attributes accent if true the over-script is an accent, which is drawn closer to the base expression. if false (default value) the over-script is a limit over the base expression. align the alignment of the over-script. possible values are: left, center, and right. this attribute is deprecated and will be removed in the future. use css text-align instead. class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. examples sample rendering: rendering in your browser: x + y + z ⏞ <math> <mover accent="true"> <mrow> <mi> x </mi> ...
<mpadded> - MathML
depth sets or increments the depth. possible values: any length or an increment/decrement (a length prefixed with "+" or "-") . height sets or increments the height. possible values: any length or an increment/decrement (a length prefixed with "+" or "-") . href used to set a hyperlink to a specified uri. lspace sets or increments the horizontal position. ...
<mphantom> - MathML
mathbackground the background color. you can use #rgb, #rrggbb and html color names. examples sample rendering: rendering in your browser: x + y + z <math> <mrow> <mi> x </mi> <mo> + </mo> <mphantom> <mi> y </mi> <mo> + </mo> </mphantom> <mi> z </mi> </mrow> </math> specifications specification status comment mathml 3.0the definition of 'mphantom' in that specification. ...
<mroot> - MathML
Web › MathML › Element › mroot
href used to set a hyperlink to a specified url. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color and also the color of the root symbol itself. you can use #rgb, #rrggbb and html color names. ...
<mrow> - MathML
Web › MathML › Element › mrow
the mathematical interpretation of the expression. proper grouping helps the rendering of the expression in several ways: it can improve the display by possibly affecting spacing. it allows for more intelligent line-breaking and indentation. it simplifies the interpretation of the expression by automated systems such as computer algebra systems and audio renderers. attributes class, id, style provided for use with stylesheets. dir overall directionality of formulas. possible values are either ltr (left to right) or rtl (right to left). href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. examples <math> <mrow> <m...
<mspace> - MathML
Web › MathML › Element › mspace
depth the desired depth (below the baseline) of the space (see length for values and units). height the desired height (above the baseline) of the space (see length for values and units). linebreak indicates a line-break at the space. possible values: auto (default value), newline, nobreak, goodbreak, badbreak. starting with mathml 3, it is preferred to use <mo> to control linebreaking. mathbackground the background color. you can use #rgb, #rrggbb and html color names. ...
<msqrt> - MathML
Web › MathML › Element › msqrt
href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color and also the color of the root symbol itself. you can use #rgb, #rrggbb and html color names. ...
<msub> - MathML
Web › MathML › Element › msub
href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. subscriptshift the minimum space by which to shift the subscript below the baseline of the expression, as a length value. this attribute is deprecated and will be removed in the future. ...
<msup> - MathML
Web › MathML › Element › msup
href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. superscriptshift the minimum space by which to shift the superscript up from the baseline of the expression, as a length value. this attribute is deprecated and will be removed in the future. ...
<mtd> - MathML
Web › MathML › Element › mtd
columnalign specifies the horizontal alignment of this cell and overrides values specified by <mtable> or <mtr>. possible values are: left, center and right. columnspan a non-negative integer value that indicates on how many columns does the cell extend. groupalign unimplemented href used to set a hyperlink to a specified uri. mathbackground the background color. ...
<mtr> - MathML
Web › MathML › Element › mtr
columnalign overrides the horizontal alignment of cells specified by <mtable> for this row. possible values are: left, center and right. groupalign unimplemented href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. ...
<munder> - MathML
Web › MathML › Element › munder
erscript </munder> attributes accentunder if true, the element is an accent, which is drawn closer to the base expression. if false (default value), the element is a limit under the base expression. align the alignment of the underscript. possible values are: left, center, and right. this attribute is deprecated and will be removed in the future. use css text-align instead. class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. examples sample rendering: rendering in your browser: x + y + z ⏟ <math> <munder accentunder="true"> <mrow> <mi> x <...
MathML documentation index - MathML
Web › MathML › Index
hml <mspace> element is used to display a blank space, whose size is set by its attributes. 29 <msqrt> mathml, mathml reference, mathml:element, mathml:general layout schemata the mathml <msqrt> element is used to display square roots (no index is displayed). the square root accepts only one argument, which leads to the following syntax: <msqrt> base </msqrt>. 30 <mstyle> mathml, mathml reference, mathml:element, mathml:general layout schemata the mathml <mstyle> element is used change the style of its children. it accepts all attributes of all mathml presentation elements with some exceptions and additional attributes listed below. 31 <msub> mathml, mathml reference, mathml:element, mathml:script and limit schemata the mathml <msub...
Mapping the width and height attributes of media container elements to their aspect-ratio - Web media technologies
til representatives from chrome were onboard with the idea. due to this work, browsers are working on adding a new mechanism for sizing images before the actual image is loaded. firefox has added an internal aspect-ratio property (in version 69 onwards) that applies to replaced elements, and other related elements that accept width and height attributes. this appears in the browser's internal ua stylesheet, similar to the following: img, input[type="image"], video, embed, iframe, marquee, object, table { aspect-ratio: attr(width) / attr(height); } this actually affects any element that acts as a container for complex or mixed visual media — <embed>, <iframe>, <marquee>, <object>, <table>, and <video>, in addition to actual images (<img> and <input type="image">). when such an element ha...
Lazy loading - Web Performance
t type module any script tag with type="module" is treated like a javascript module and is deferred by default. css by default, css is treated as a render blocking resource, so the browser won't render any processed content until the cssom is constructed. css must be thin, delivered as quickly as possible, and the usage media types and queries are advised to unblock rendering. <link href="style.css" rel="stylesheet" media="all"> <link href="portrait.css" rel="stylesheet" media="orientation:portrait"> <link href="print.css" rel="stylesheet" media="print"> it is possible to perform some css optimizations to achieve that. fonts by default, font requests are delayed until the render tree is constructed, which can result in delayed text rendering. it is possible to override the d...
Optimizing startup performance - Web Performance
her than rolling your own or using one from the original codebase. the provided one is almost certainly significantly faster, and will reduce your app size to boot. in addition, the browser may automatically parallelize these decoders. any data processing that can be done in parallel should be. don't do one chunk of data after another; do them all at once when possible! don't include scripts or stylesheets that don't participate in the critical path in your startup html file. load them only when needed. reduce the side of your javascript files. try to send the minify version of the file to the browser and use compression like gzip or brotli. utilize resource hints (like preconnect or preload) whenever possible to indicate to the browser which files are more critical for your application. ...
Making PWAs work offline with Service workers - Progressive web apps (PWAs)
istener, we can initialize the cache and add files to it for offline use. our js13kpwa app does exactly that. first, a variable for storing the cache name is created, and the app shell files are listed in one array. ...
Graphic design for responsive sites - Progressive web apps (PWAs)
the downsides here are that css3 properties and svg don't work on old browsers such as ie6-8 (although polyfills are available, and you could build in fallbacks), and svg isn't suitable for high detail images, such as photographs. using fonts for icons another technique to consider is using web fonts for icons. text is infinitely scalable on the web, and you can also use css text properties to style your web font icons, such as text-shadow and color. making your own font file can be a bit fiddly, but there are a number of good icon font services available such as font awesome. interactive images if your images need to feature some level of interactivity, such as links, other clickable areas, or animation, there are a number of options available. css as well as adding programmatic grap...
Web technology reference
, written using angle brackets. some introduce content into the page directly, others provide information about document text and may include other tags as sub-elements. obviously, browsers do not display them, since they are used to interpret the content of the page. introduction to html | learn html | html5 | developer guide | element reference | reference css — styling the web cascading style sheets are used to describe the appearance of web content. introduction to css | getting started with css | learn css | common css questions | reference javascript — dynamic client-side scripting the javascript programming language is used to add interactivity and other dynamic features to web sites. learn javascript | developer guide | reference ...
azimuth - SVG: Scalable Vector Graphics
Web › SVG › Attribute › azimuth
> html, body, svg { height: 100%; } <svg viewbox="0 0 440 200" xmlns="http://www.w3.org/2000/svg"> <filter id="distantlight1"> <fediffuselighting> <fedistantlight azimuth="0" /> </fediffuselighting> </filter> <filter id="distantlight2"> <fediffuselighting> <fedistantlight azimuth="240" /> </fediffuselighting> </filter> <circle cx="100" cy="100" r="80" style="filter: url(#distantlight1);" /> <circle cx="100" cy="100" r="80" style="filter: url(#distantlight2); transform: translatex(240px);" /> </svg> usage notes value <number> default value 0 animatable yes specifications specification status comment filter effects module level 1the definition of 'azimuth' in that specifica...
clip-rule - SVG: Scalable Vector Graphics
of code will not cause an evenodd clipping rule to be applied because the clip-rule is specified on the referencing element, not on the object defining the clipping shape: <g> <clippath id="myclip"> <path d="..." /> </clippath> <rect clip-path="url(#myclip)" clip-rule="evenodd" ... /> </g> as a presentation attribute, it also can be used as a property directly inside a css stylesheet usage context categories presentation attribute value nonzero | evenodd | inherit animatable yes normative document svg 1.1 (2nd edition) nonzero see description of fill-rule property. evenodd see description of fill-rule property. example <svg width="100" viewbox="0 0 100 90" xmlns="http://www.w3.org/2000/svg" version="1.1"> ...
color-rendering - SVG: Scalable Vector Graphics
<stop offset="0%" stop-color="white"/> <stop offset="100%" stop-color="darkseagreen"/> </radialgradient> </defs> <circle cx="100" cy="100" r="100" fill="url(#gradient)" color-rendering="optimizequality" /> <text x="45" y="50%" color-rendering="optimizequality">quality-optimized</text> <circle cx="100" cy="100" r="100" color-rendering="optimizespeed" fill="url(#gradient)" style="transform: translatex(240px);" /> <text x="290" y="50%" color-rendering="optimizespeed">speed-optimized</text> </svg> usage notes value auto | optimizespeed | optimizequality default value auto animatable yes auto indicates that the user agent shall make appropriate tradeoffs to balance speed and quality, but quality shall be given more import...
cursor - SVG: Scalable Vector Graphics
Web › SVG › Attribute › cursor
« svg attribute reference home the cursor attribute specifies the mouse cursor displayed when the mouse pointer is over an element. this attribute behaves exactly like the css cursor property except that if the browser supports the <cursor> element, you should be able to use it with the <funciri> notation. as a presentation attribute, it also can be used as a property directly inside a css stylesheet, see css cursor for further information. usage context categories presentation attribute value [[<funciri>,]* [ auto | crosshair | default | pointer | move | e-resize | ne-resize | nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize| text | wait | help ]] | inherit animatable yes normative document svg 1.1 (2nd edition) ...
diffuseConstant - SVG: Scalable Vector Graphics
ediffuselighting in="sourcegraphic" diffuseconstant="1"> <fepointlight x="60" y="60" z="20" /> </fediffuselighting> </filter> <filter id="diffuselighting2" x="0" y="0" width="100%" height="100%"> <fediffuselighting in="sourcegraphic" diffuseconstant="2"> <fepointlight x="60" y="60" z="20" /> </fediffuselighting> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#diffuselighting1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#diffuselighting2); transform: translatex(220px);" /> </svg> usage notes value <number> default value 1 animatable yes specifications specification status comment filter effects module level 1the definition of 'diffusecon...
divisor - SVG: Scalable Vector Graphics
Web › SVG › Attribute › divisor
lvematrix1" x="0" y="0" width="100%" height="100%"> <feconvolvematrix kernelmatrix="1 2 0 0 0 0 0 0 -1" divisor="1"/> </filter> <filter id="convolvematrix2" x="0" y="0" width="100%" height="100%"> <feconvolvematrix kernelmatrix="1 2 0 0 0 0 0 0 -1" divisor="8"/> </filter> <image xlink:href="//developer.mozilla.org/files/6457/mdn_logo_only_color.png" width="200" height="200" style="filter:url(#convolvematrix1);"/> <image xlink:href="//developer.mozilla.org/files/6457/mdn_logo_only_color.png" width="200" height="200" style="filter:url(#convolvematrix2); transform:translatex(220px);"/> </svg> usage notes value <number> default value sum of all values in kernelmatrix or 1 if sum is 0 animatable yes <number> this value...
elevation - SVG: Scalable Vector Graphics
html, body, svg { height: 100%; } <svg viewbox="0 0 440 200" xmlns="http://www.w3.org/2000/svg"> <filter id="distantlight1"> <fediffuselighting> <fedistantlight elevation="0" /> </fediffuselighting> </filter> <filter id="distantlight2"> <fediffuselighting> <fedistantlight elevation="45" /> </fediffuselighting> </filter> <circle cx="100" cy="100" r="80" style="filter: url(#distantlight1);" /> <circle cx="100" cy="100" r="80" style="filter: url(#distantlight2); transform: translatex(240px);" /> </svg> usage notes value <number> default value 0 animatable yes specifications specification status comment filter effects module level 1the definition of 'elevation' in that specifi...
exponent - SVG: Scalable Vector Graphics
ma" exponent="1"/> </fecomponenttransfer> </filter> <filter id="componenttransfer2" x="0" y="0" width="100%" height="100%"> <fecomponenttransfer> <fefuncr type="gamma" exponent="5"/> <fefuncg type="gamma" exponent="5"/> <fefuncb type="gamma" exponent="5"/> </fecomponenttransfer> </filter> <rect x="0" y="0" width="200" height="200" fill="url(#gradient)" style="filter: url(#componenttransfer1);" /> <rect x="0" y="0" width="200" height="200" fill="url(#gradient)" style="filter: url(#componenttransfer2); transform: translatex(220px);" /> </svg> usage notes value <number> default value 1 animatable yes <number> if the type attribute of the component element is set to gamma, this value specifies th...
externalResourcesRequired - SVG: Scalable Vector Graphics
the externalresourcesrequired attribute specifies whether referenced resources that are not part of the current document are required for proper rendering of the given container or graphics element. this attribute applies to all types of resource references, including style sheets, color profiles and fonts specified by a reference using a <font-face> element or a css @font-face specification. in particular, if an element sets externalresourcesrequired="true", then all style sheets must be available since any style sheet might affect the rendering of that element. the externalresourcesrequired attribute is not inheritable (from a sense of attribute value inheritance), but if set on a container element, its value will apply to all elements within the container. because setting externalresour...
fill-opacity - SVG: Scalable Vector Graphics
browser compatibility the com...
flood-color - SVG: Scalable Vector Graphics
: <feflood> and <fedropshadow> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <filter id="flood1"> <feflood flood-color="skyblue" x="0" y="0" width="200" height="200"/> </filter> <filter id="flood2"> <feflood flood-color="seagreen" x="0" y="0" width="200" height="200"/> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#flood1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#flood2); transform: translatex(220px);" /> </svg> usage notes value color initial value black animatable yes specifications specification status comment filter effects module level 1the definition of 'flood-color' in that specific...
font-variant - SVG: Scalable Vector Graphics
50 30" xmlns="http://www.w3.org/2000/svg"> <text y="20" font-variant="normal">normal text</text> <text x="100" y="20" font-variant="small-caps">small-caps text</text> </svg> usage notes value normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> || stylistic( <feature-value-name> ) || historical-forms || styleset( <feature-value-name># ) || character-variant( <feature-value-name># ) || swash( <feature-value-name> ) || ornaments( <feature-value-name> ) || annotation( <feature-value-name> ) || [ small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps ] || <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero || <east-asian...
fr - SVG: Scalable Vector Graphics
Web › SVG › Attribute › fr
op-color="darkseagreen"/> </radialgradient> <radialgradient id="gradient2" cx="0.5" cy="0.5" r="0.5" fx="0.35" fy="0.35" fr="25%"> <stop offset="0%" stop-color="white"/> <stop offset="100%" stop-color="darkseagreen"/> </radialgradient> </defs> <circle cx="100" cy="100" r="100" fill="url(#gradient1)" /> <circle cx="100" cy="100" r="100" fill="url(#gradient2)" style="transform: translatex(240px);" /> </svg> usage notes value <length> default value 0 animatable none example <svg viewbox="0 0 120 120" width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <defs> <radialgradient id="gradient" cx="0.5" cy="0.5" r="0.5" fx="0.35" fy="0.35" fr="5%"> <stop offset="0%" stop-color="red"/> ...
fx - SVG: Scalable Vector Graphics
Web › SVG › Attribute › fx
animatable none example <svg viewbox="0 0 120 120" width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <defs> <radialgradient id="gradient" cx=...
fy - SVG: Scalable Vector Graphics
Web › SVG › Attribute › fy
animatable none example <svg viewbox="0 0 120 120" width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <defs> <radialgradient id="gradient" cx=...
gradientTransform - SVG: Scalable Vector Graphics
specifications specification status comm...
id - SVG: Scalable Vector Graphics
Web › SVG › Attribute › id
the id attribute assigns a unique name to an element. all elements are using this attribute. <svg width="120" height="120" viewbox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"> <style type="text/css"> <![cdata[ #smallrect { stroke: #000066; fill: #00cc00; } ]]> </style> <rect id="smallrect" x="10" y="10" width="100" height="100" /> </svg> usage notes value <id> default value none animatable no <id> specifies the element's id. the id must be unique within the node tree, must not be an empty string, and must not contain any whitespace characters. note: you should avoid the use of id values that would be parsed as an svg view specification (e.g., mydrawing.svg#svgview(viewbox(0,200,1000,100...
intercept - SVG: Scalable Vector Graphics
="0"/> </fecomponenttransfer> </filter> <filter id="componenttransfer2" x="0" y="0" width="100%" height="100%"> <fecomponenttransfer> <fefuncr type="linear" intercept="0.3"/> <fefuncg type="linear" intercept="0.1"/> <fefuncb type="linear" intercept="0.8"/> </fecomponenttransfer> </filter> <rect x="0" y="0" width="200" height="200" fill="url(#gradient)" style="filter: url(#componenttransfer1);" /> <rect x="0" y="0" width="200" height="200" fill="url(#gradient)" style="filter: url(#componenttransfer2); transform: translatex(220px);" /> </svg> usage notes value <number> default value 0 animatable yes specifications specification status comment filter effects module leve...
k1 - SVG: Scalable Vector Graphics
Web › SVG › Attribute › k1
00%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="1" k2="0" k3="0" k4="0" /> </filter> <filter id="composite2" x="0" y="0" width="100%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="10" k2="0" k3="0" k4="0" /> </filter> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="0" y="0" width="200" height="200" style="filter: url(#composite1);" /> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="0" y="0" width="200" height="200" style="filter: url(#composite2); transform: translatex(220px);" /> </svg> usage notes value <number> default value 0 animatable yes specifications specification status comment filter ...
k2 - SVG: Scalable Vector Graphics
Web › SVG › Attribute › k2
00%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="1" k2="1" k3="0" k4="0" /> </filter> <filter id="composite2" x="0" y="0" width="100%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="1" k2="10" k3="0" k4="0" /> </filter> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="0" y="0" width="200" height="200" style="filter: url(#composite1);" /> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="0" y="0" width="200" height="200" style="filter: url(#composite2); transform: translatex(220px);" /> </svg> usage notes value <number> default value 0 animatable yes specifications specification status comment filter ...
k3 - SVG: Scalable Vector Graphics
Web › SVG › Attribute › k3
00%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="1" k2="0" k3="1" k4="0" /> </filter> <filter id="composite2" x="0" y="0" width="100%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="1" k2="0" k3="10" k4="0" /> </filter> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="0" y="0" width="200" height="200" style="filter: url(#composite1);" /> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="0" y="0" width="200" height="200" style="filter: url(#composite2); transform: translatex(220px);" /> </svg> usage notes value <number> default value 0 animatable yes specifications specification status comment filter ...
k4 - SVG: Scalable Vector Graphics
Web › SVG › Attribute › k4
%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="1" k2="0" k3="0" k4="0" /> </filter> <filter id="composite2" x="0" y="0" width="100%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="10" k2="0" k3="0" k4="0.3" /> </filter> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="0" y="0" width="200" height="200" style="filter: url(#composite1);" /> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="0" y="0" width="200" height="200" style="filter: url(#composite2); transform: translatex(220px);" /> </svg> usage notes value <number> default value 0 animatable yes specifications specification status comment filter ...
kernelMatrix - SVG: Scalable Vector Graphics
vg"> <filter id="convolvematrix1" x="0" y="0" width="100%" height="100%"> <feconvolvematrix kernelmatrix="1 1 0 0 0 0 0 0 -1"/> </filter> <filter id="convolvematrix2" x="0" y="0" width="100%" height="100%"> <feconvolvematrix kernelmatrix="-1 0 0 0 0 0 0 0 1"/> </filter> <image xlink:href="//developer.mozilla.org/files/6457/mdn_logo_only_color.png" width="200" height="200" style="filter:url(#convolvematrix1);"/> <image xlink:href="//developer.mozilla.org/files/6457/mdn_logo_only_color.png" width="200" height="200" style="filter:url(#convolvematrix2); transform:translatex(220px);"/> </svg> usage notes value <list of numbers> default value none animatable yes <list of numbers> the list of <number>s that make up t...
lighting-color - SVG: Scalable Vector Graphics
uselighting in="sourcegraphic" lighting-color="white"> <fepointlight x="60" y="60" z="20" /> </fediffuselighting> </filter> <filter id="diffuselighting2" x="0" y="0" width="100%" height="100%"> <fediffuselighting in="sourcegraphic" lighting-color="blue"> <fepointlight x="60" y="60" z="20" /> </fediffuselighting> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#diffuselighting1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#diffuselighting2); transform: translatex(220px);" /> </svg> usage notes value color default value white animatable yes specifications specification status comment filter effects module level 1the definition of 'lighting-...
limitingConeAngle - SVG: Scalable Vector Graphics
y="10" z="50" pointsatx="100" pointsaty="100" limitingconeangle="10" /> </fediffuselighting> </filter> <filter id="spotlight2" x="0" y="0" width="100%" height="100%"> <fediffuselighting diffuseconstant="2"> <fespotlight x="10" y="10" z="50" pointsatx="100" pointsaty="100" limitingconeangle="40" /> </fediffuselighting> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#spotlight1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#spotlight2); transform: translatex(220px);" /> </svg> usage notes value <number> default value 0 animatable yes specifications specification status comment filter effects module level 1the definition of 'limitingconeangle' in ...
media - SVG: Scalable Vector Graphics
Web › SVG › Attribute › media
the media attribute specifies a media query that must be matched for a style sheet to apply. only one element is using this attribute: <style> html, body, svg { height: 100%; } <svg viewbox="0 0 240 220" xmlns="http://www.w3.org/2000/svg"> <style> rect { fill: black; } </style> <style media="all and (min-width: 600px)"> rect { fill: seagreen; } </style> <text y="15">resize the window to see the effect</text> <rect y="20" width="200" height="200" /> </svg> usage notes value <media-query-list> default value all animatable yes <media-query-list> this value holds a media query that needs to match in order for the style sheet to be applied. if not specified, the style sheet is applied unconditionally. specificat...
onclick - SVG: Scalable Vector Graphics
Web › SVG › Attribute › onclick
bute specifies some script to run when the element is clicked. ...
opacity - SVG: Scalable Vector Graphics
Web › SVG › Attribute › opacity
<ellipse>, <foreignobject>, <g>, <iframe>, <image>, <line>, <marker>, <path>, <polygon>, <polyline>, <rect>, <svg>, <switch>, <symbol>, <text>, <textpath>, <tspan>, <use>, <unknown>, and <video> html, body, svg { height: 100%; } <svg viewbox="0 0 200 100" xmlns="http://www.w3.org/2000/svg"> <defs> <lineargradient id="gradient" x1="0%" y1="0%" x2="0" y2="100%"> <stop offset="0%" style="stop-color:skyblue;" /> <stop offset="100%" style="stop-color:seagreen;" /> </lineargradient> </defs> <rect x="0" y="0" width="100%" height="100%" fill="url(#gradient)" /> <circle cx="50" cy="50" r="40" fill="black" /> <circle cx="150" cy="50" r="40" fill="black" opacity="0.3" /> </svg> usage notes default value 1 value <alpha-value> animat...
pathLength - SVG: Scalable Vector Graphics
omputations that require the length of the path. stroke-dasharray, for example, will assume the start of the path being 0 and the end point the value defined in the pathlength attribute. seven elements are using this attribute: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, and <rect> html,body,svg { height:100% } <svg viewbox="0 0 100 60" xmlns="http://www.w3.org/2000/svg"> <style> path { fill: none; stroke: black; stroke-width: 2; stroke-dasharray: 10; } </style> <!-- no pathlength, the real length of the path is used. in that case, 100 user units --> <path d="m 0,10 h100"/> <!-- compute everything like if the path length was 90 user units long --> <path d="m 0,20 h100" pathlength="90"/> <!-- compute everything like if the path length ...
pointer-events - SVG: Scalable Vector Graphics
l="white" pointer-events="none" /> </svg> window.addeventlistener('mouseup', (e) => { // let's pick a random color between #000000 and #ffffff const color = math.round(math.random() * 0xffffff) // let's format the color to fit css requirements const fill = '#' + color.tostring(16).padstart(6,'0') // let's apply our color in the // element we actually clicked on e.target.style.fill = fill }) as a presentation attribute, it can be applied to any element but it is mostly relevant only on the following twenty-three elements: <a>, <circle>, <clippath>, <defs>, <ellipse>, <foreignobject>, <g>, <image>, <line>, <marker>, <mask>, <path>, <pattern>, <polygon>, <polyline>, <rect>, <svg>, <switch>, <symbol>, <text>, <textpath>, <tspan>, <use> usage notes value ...
pointsAtX - SVG: Scalable Vector Graphics
ight="100%"> <fediffuselighting in="sourcegraphic"> <fespotlight x="60" y="60" z="50" pointsatx="0" /> </fediffuselighting> </filter> <filter id="lighting2" x="0" y="0" width="100%" height="100%"> <fediffuselighting in="sourcegraphic"> <fespotlight x="60" y="60" z="50" pointsatx="400" /> </fediffuselighting> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#lighting1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#lighting2); transform: translatex(220px);" /> </svg> usage notes default value 0 value <number> animatable yes specifications specification status comment filter effects module level 1the definition of 'pointsatx' in that speci...
pointsAtY - SVG: Scalable Vector Graphics
ight="100%"> <fediffuselighting in="sourcegraphic"> <fespotlight x="60" y="60" z="50" pointsaty="0" /> </fediffuselighting> </filter> <filter id="lighting2" x="0" y="0" width="100%" height="100%"> <fediffuselighting in="sourcegraphic"> <fespotlight x="60" y="60" z="50" pointsaty="400" /> </fediffuselighting> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#lighting1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#lighting2); transform: translatex(220px);" /> </svg> usage notes default value 0 value <number> animatable yes specifications specification status comment filter effects module level 1the definition of 'pointsaty' in that speci...
pointsAtZ - SVG: Scalable Vector Graphics
t="100%"> <fediffuselighting in="sourcegraphic"> <fespotlight x="100" y="100" z="50" pointsatz="0" /> </fediffuselighting> </filter> <filter id="lighting2" x="0" y="0" width="100%" height="100%"> <fediffuselighting in="sourcegraphic"> <fespotlight x="100" y="100" z="50" pointsatz="80" /> </fediffuselighting> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#lighting1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#lighting2); transform: translatex(220px);" /> </svg> usage notes default value 0 value <number> animatable yes specifications specification status comment filter effects module level 1the definition of 'pointsatz' in that speci...
preserveAlpha - SVG: Scalable Vector Graphics
0" width="100%" height="100%"> <feconvolvematrix kernelmatrix="1 -1 2 0 0 0 0 0 -2" preservealpha="true"/> </filter> <filter id="convolvematrix2" x="0" y="0" width="100%" height="100%"> <feconvolvematrix kernelmatrix="1 -1 2 0 0 0 0 0 -2" preservealpha="false"/> </filter> <image xlink:href="//developer.mozilla.org/files/6457/mdn_logo_only_color.png" width="200" height="200" style="filter:url(#convolvematrix1);"/> <image xlink:href="//developer.mozilla.org/files/6457/mdn_logo_only_color.png" width="200" height="200" style="filter:url(#convolvematrix2); transform:translatex(220px);"/> </svg> usage notes default value false value true | false animatable yes true this value indicates that the convolution will only app...
result - SVG: Scalable Vector Graphics
Web › SVG › Attribute › result
it is only meaningful within a given <filter> element and thus has only local scope. it is legal for the same <filte...
specularConstant - SVG: Scalable Vector Graphics
ghting in="sourcegraphic" specularconstant="1.2"> <fepointlight x="60" y="60" z="20" /> </fespecularlighting> </filter> <filter id="specularlighting2" x="0" y="0" width="100%" height="100%"> <fespecularlighting in="sourcegraphic" specularconstant="0.8"> <fepointlight x="60" y="60" z="20" /> </fespecularlighting> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#specularlighting1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#specularlighting2); transform: translatex(220px);" /> </svg> usage notes value <number> default value 1 animatable yes specifications specification status comment filter effects module level 1the definition of 'sp...
stdDeviation - SVG: Scalable Vector Graphics
00%; } <svg viewbox="0 0 480 200" xmlns="http://www.w3.org/2000/svg"> <filter id="gaussianblur1"> <fegaussianblur stddeviation="1" /> </filter> <filter id="gaussianblur2"> <fegaussianblur stddeviation="5" /> </filter> <filter id="gaussianblur3" x="-30%" y="-30%" width="160%" height="160%"> <fegaussianblur stddeviation="10" /> </filter> <circle cx="100" cy="100" r="50" style="filter: url(#gaussianblur1);" /> <circle cx="100" cy="100" r="50" style="filter: url(#gaussianblur2); transform: translatex(140px);" /> <circle cx="100" cy="100" r="50" style="filter: url(#gaussianblur3); transform: translatex(280px);" /> </svg> usage notes value <number-optional-number> default value 0 animatable yes <number-optional-number>...
stroke-opacity - SVG: Scalable Vector Graphics
it's important to know that...
tableValues - SVG: Scalable Vector Graphics
"/> </fecomponenttransfer> </filter> <filter id="componenttransfer2" x="0" y="0" width="100%" height="100%"> <fecomponenttransfer> <fefuncr type="table" tablevalues="1 0"/> <fefuncg type="table" tablevalues="1 0"/> <fefuncb type="table" tablevalues="1 0"/> </fecomponenttransfer> </filter> <rect x="0" y="0" width="200" height="200" fill="url(#gradient)" style="filter: url(#componenttransfer1);" /> <rect x="0" y="0" width="200" height="200" fill="url(#gradient)" style="filter: url(#componenttransfer2); transform: translatex(220px);" /> </svg> usage notes value <list-of-numbers> default value empty list resulting in identity transfer animatable yes <list-of-numbers> this value holds a comma- and...
transform-origin - SVG: Scalable Vector Graphics
see the css transform-origin property for more information. ...
zoomAndPan - SVG: Scalable Vector Graphics
recommendation initial definition ...
<altGlyph> - SVG: Scalable Vector Graphics
Web › SVG › Element › altGlyph
ference is to an <altglyphdef> element, then if an appropriate set of alternate glyphs is located from processing the <altglyphdef> element, then those alternate glyphs are rendered instead of the character(s) that are inside of the <altglyph> element. ...
<animate> - SVG: Scalable Vector Graphics
Web › SVG › Element › animate
accessibility concerns blinking and flashing animation can be problematic for people with cognitive concerns such as attention deficit hyperactivity disorder (adhd). additionally, certain kinds of motion can be a trigger for vestibular disorders, ...
<animateMotion> - SVG: Scalable Vector Graphics
specifications specification status comment svg animations level 2the definition of '<animatemotion>' in that specification. editor's draft no change scalable vector graphics (svg) 1.1 (second editi...
<circle> - SVG: Scalable Vector Graphics
Web › SVG › Element › circle
: 0; animatable: yes pathlength the total length for the circle's circumference, in user units. value type: <number> ; default value: none; animatable: yes note: starting with svg2, cx, cy, and r are geometry properties, meaning those attributes can also be used as css properties for that element. ...
<clipPath> - SVG: Scalable Vector Graphics
Web › SVG › Element › clipPath
s of 10 which is clipped to a circle with a radius of 5 will not receive "click" events outside the smaller radius. attributes clippathunits defines the coordinate system for the contents of the <clippath> element. ...
<desc> - SVG: Scalable Vector Graphics
Web › SVG › Element › desc
candidate recommendation scalable vector graphics (svg) ...
<ellipse> - SVG: Scalable Vector Graphics
Web › SVG › Element › ellipse
le: yes pathlength this attribute lets specify the total length for the path, in user units. value type: <number> ; default value: none; animatable: yes note: starting with svg2 cx, cy, rx and ry are geometry properties, meaning those attributes can also be used as css properties for that element. ...
<feColorMatrix> - SVG: Scalable Vector Graphics
1 0 | in it, every new value is exactly 1 times its old value, with nothing else added. it is recommended to start manipulating the matrix from here. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in type values dom interface this element implements the svgfecolormatrixelement interface. example svg <svg width="100%" height="100%" viewbox="0 0 150 500" preserveaspectratio="xmidymid meet" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- ref --> <defs> <g id="circles"> <circle cx="30" cy="30" r="20...
<feComposite> - SVG: Scalable Vector Graphics
example svg <svg width="330" height="195" viewbox="0 0 1100 650" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>example fecomposite - examples of fecomposite operations</title> <desc>four rows of s...
<feDiffuseLighting> - SVG: Scalable Vector Graphics
tive. multiple light sources can be simulated by adding several of these light maps together before applying it to the texture image. usage context categoriesfilter primitive elementpermitted contentany number of descriptive elements and exactly one light source element, in any order. attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in surfacescale diffuseconstant kernelunitlength dom interface this element implements the svgfediffuselightingelement interface. example the following example show the effect of the <fediffuselighting> element on a circle with each light source available. each time, the light comes from the upper left corner. <svg width="440" height="140" xmlns="http://www.w3.or...
<feGaussianBlur> - SVG: Scalable Vector Graphics
the <fegaussianblur> svg filter primitive blurs the input image by the amount specified in stddeviation, which defines the bell-curve. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in stddeviation edgemode dom interface this element implements the svgfegaussianblurelement interface. example simple example svg <svg width="230" height="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <filter id="blurme"> <fegaussianblur in="sourcegraphic" stddeviation="5" /> </filter> <circle cx="60" cy="60" r="50" fill="green...
<feMorphology> - SVG: Scalable Vector Graphics
the <femorphology> svg filter primitive is used to erode or dilate the input image. its usefulness lies especially in fattening or thinning effects. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in operator radius dom interface this element implements the svgfemorphologyelement interface. examples filtering svg content svg <svg xmlns="http://www.w3.org/2000/svg" width="300" height="180"> <filter id="erode"> <femorphology operator="erode" radius="1"/> </filter> <filter id="dilate"> <femorphology operator="dilate" radius="2"/> </filter> <tex...
<feOffset> - SVG: Scalable Vector Graphics
Web › SVG › Element › feOffset
offset> svg filter primitive allows to offset the input image. the input image as a whole is offset by the values specified in the dx and dy attributes. usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in dx dy dom interface this element implements the svgfeoffsetelement interface. example svg <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <defs> <filter id="offset" width="180" height="180"> <feoffset in="sourcegraphic" dx="60" dy="60" /> </filter> </defs> <rect x="0" y="0" width="100" height="100" stroke="black" fill="gre...
<fePointLight> - SVG: Scalable Vector Graphics
working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of '<fepointlight>' in that specification. recommendation initial definition ...
<feSpotLight> - SVG: Scalable Vector Graphics
working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of '<fespotlight>' in that specification. recommendation initial definition ...
<filter> - SVG: Scalable Vector Graphics
Web › SVG › Element › filter
. it is never rendered itself, but must be used by the filter attribute on svg elements, or the filter css property for svg/html elements. usage context categoriesnonepermitted contentany number of the following elements, in any order:descriptive elementsfilter primitive elements<animate>, <set> attributes global attributes core attributes presentation attributes xlink attributes class style externalresourcesrequired specific attributes x y width height filterres filterunits primitiveunits xlink:href dom interface this element implements the svgfilterelement interface. example svg <svg width="230" height="120" xmlns="http://www.w3.org/2000/svg"> <filter id="blurme"> <fegaussianblur stddeviation="5"/> </filter> <circle cx="60" cy="60" r="50" fill="green" /> ...
<font-face> - SVG: Scalable Vector Graphics
Web › SVG › Element › font-face
the <font-face> svg element corresponds to the css @font-face rule. it defines a font's outer properties. usage context categoriesfont elementpermitted contentany number of descriptive elements » and at most one <font-face> element, in any order. ...
<font> - SVG: Scalable Vector Graphics
Web › SVG › Element › font
the <font> svg element defines a font to be used for text layout. usage context categoriesfont elementpermitted contentany number of the following elements, in any order:descriptive elements<font-face>, <glyph>, <hkern>, <missing-glyph>, <vkern> attributes global attributes core attributes presentation attributes class style externalresourcesrequired specific attributes horiz-origin-x horiz-origin-y horiz-adv-x vert-origin-x vert-origin-y vert-adv-y dom interface this element implements the svgfontelement interface. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of '<font>' in that specification. recommendation initial definition ...
<glyphRef> - SVG: Scalable Vector Graphics
Web › SVG › Element › glyphRef
the glyphref element provides a single possible glyph to the referencing <altglyph> substitution. usage context categoriestext content elementpermitted contentempty attributes global attributes core attributes » presentation attributes » xlink attributes » class style specific attributes x y dx dy glyphref format xlink:href dom interface this element implements the svgglyphrefelement interface. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of '<glyphref>' in that specification. recommendation initial definition ...
<hatch> - SVG: Scalable Vector Graphics
Web › SVG › Element › hatch
n referenced by the fill and stroke css properties on a given graphics element to indicate that the given element shall be filled or stroked with the hatch. paths are defined by <hatchpath> elements. usage context categoriesnever-rendered element, paint server elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements<hatchpath>, <script>, <style> attributes global attributes core attributes global event attributes presentation attributes style attributes specific attributes x y pitch rotate hatchunits hatchcontentunits transform href dom interface this element implements the svghatchelement interface. example svg <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <defs> <hatch id="hatch" hat...
<hatchpath> - SVG: Scalable Vector Graphics
Web › SVG › Element › hatchpath
the <hatchpath> svg element defines a hatch path used by the <hatch> element. usage context categoriesnonepermitted contentany number of the following elements, in any order:animation elementsdescriptive elements<script>, <style> attributes global attributes core attributes global event attributes presentation attributes style attributes specific attributes d offset dom interface this element implements the svghatchpathelement interface. example svg <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <defs> <hatch id="hatch" hatchunits="userspaceonuse" pitch="5" rotate="135"> <hatchpath stroke="#a080ff" stroke-width="2"/> </hatch> </defs> <rect fill="url(#hatch)" stroke="black" stroke-width="2" x="10%" y="10%" widt...
<line> - SVG: Scalable Vector Graphics
Web › SVG › Element › line
<number> ; default value: 0; animatable: yes y2 defines the y-axis coordinate of the line ending point. value type: <length>|<percentage>|<number> ; default value: 0; animatable: yes pathlength defines the total path length in user units. ...
<linearGradient> - SVG: Scalable Vector Graphics
t of the vector gradient along which the linear gradient is drawn. value type: <length> ; default value: 0%; animatable: yes y2 this attribute defines the y coordinate of the ending point of the vector gradient along which the linear gradient is drawn. ...
<missing-glyph> - SVG: Scalable Vector Graphics
character the font doesn't define an appropriate <glyph>. usage context categoriesnonepermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> attributes global attributes core attributes presentation attributes class style specific attributes d horiz-adv-x vert-origin-x vert-origin-y vert-adv-y dom interface this element implements the svgmissingglyphelement interface. specifications specification status comment scalable vector graphics (svg) 1.1 (second editi...
<path> - SVG: Scalable Vector Graphics
Web › SVG › Element › path
0,60 10,30 z"/> </svg> attributes d this attribute defines the shape of the path. value type: <string> ; default value: ''; animatable: yes pathlength this attribute lets authors specify the total length for the path, in user units. ...
<polygon> - SVG: Scalable Vector Graphics
Web › SVG › Element › polygon
ute defines the list of points (pairs of x,y absolute coordinates) required to draw the polygon. value type: <number>+ ; default value: ""; animatable: yes pathlength this attribute lets specify the total length for the path, in user units. ...
<polyline> - SVG: Scalable Vector Graphics
Web › SVG › Element › polyline
ute defines the list of points (pairs of x,y absolute coordinates) required to draw the polyline value type: <number>+ ; default value: ""; animatable: yes pathlength this attribute lets specify the total length for the path, in user units. ...
<radialGradient> - SVG: Scalable Vector Graphics
behaves if it starts or ends inside the bounds of the shape containing the gradient. value type: pad|reflect|repeat ; default value: pad; animatable: yes xlink:href an <iri> reference to another <lineargradient> element that will be used as a template. ...
<rect> - SVG: Scalable Vector Graphics
Web › SVG › Element › rect
: yes pathlength the total length of the rectangle's perimeter, in user units. value type: <number> ; default value: none; animatable: yes note: starting with svg2, x, y, width, height, rx and ry are geometry properties, meaning those attributes can also be used as css properties for that element. ...
<solidcolor> - SVG: Scalable Vector Graphics
imating a palette colors. note: this is an experimental technology, and not yet implemented in browsers. a workaround is to use a <lineargradient> with only one color stop. this is less elegant, and unlike <solidcolor>, cannot itself be used in the definition of gradients. usage context missing attributes global attributes core attributes global event attributes presentation attributes style attributes specific attributes none. dom interface this element implements the svgsolidcolorelement interface. example svg <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 300 200" height="150"> <defs> <!-- solidcolor is experimental. --> <solidcolor id="mycolor" solid-color="gold" solid-opacity="0.8"/> <!-- lineargradient with a single color stop is a less elegant way ...
<stop> - SVG: Scalable Vector Graphics
Web › SVG › Element › stop
the color of the gradient stop. it can be used as a css property. value type: currentcolor|<color>|<icccolor>; default value: black; animatable: yes stop-opacity this attribute defines the opacity of the gradient stop. it can be used as a css property. ...
<switch> - SVG: Scalable Vector Graphics
Web › SVG › Element › switch
r <switch> processing. usage context categoriescontainer elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elements<a>, <foreignobject>, <g>, <image>, <svg>, <switch>, <text>, <use> attributes global attributes conditional processing attributes core attributes graphical event attributes presentation attributes class style externalresourcesrequired transform dom interface this element implements the svgswitchelement interface. svg <switch> example this example demonstrates showing different text content depending on the browser's language settings. the switch element will display the first of its child elements whose systemlanguage attribute matches the user's language, or the fallback element with no system...
<textPath> - SVG: Scalable Vector Graphics
Web › SVG › Element › textPath
e beginning of the text should be offset from the beginning of the path. value type: <length>|<percentage>|<number> ; default value: 0; animatable: yes textlength the width of the space into which the text will render. ...
<title> — the SVG accessible name element - SVG: Scalable Vector Graphics
Web › SVG › Element › title
candidate recommendation scalable vector graphics (svg)...
<tref> - SVG: Scalable Vector Graphics
Web › SVG › Element › tref
cing is specified with a <tref> element. usage context categoriestext content element, text content child elementpermitted contentany number of the following elements, in any order:descriptive elements<animate>, <animatecolor>, <set> attributes global attributes conditional processing attributes core attributes graphical event attributes presentation attributes xlink attributes class style externalresourcesrequired specific attributes xlink:href dom interface this element implements the svgtrefelement interface. example <svg width="100%" height="100%" viewbox="0 0 1000 300" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <text id="referencedtext"> referenced character data </text> </defs> <text x="100" ...
<view> - SVG: Scalable Vector Graphics
Web › SVG › Element › view
aspectratio zoomandpan viewtarget example svg <svg width="600" height="200" viewbox="0 0 600 200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <radialgradient id="gradient"> <stop offset="0%" stop-color="#8cffa0" /> <stop offset="100%" stop-color="#8ca0ff" /> </radialgradient> </defs> <circle r="50" cx="180" cy="50" style="fill:url(#gradient)"/> <view id="halfsizeview" viewbox="0 0 1200 400"/> <view id="normalsizeview" viewbox="0 0 600 200"/> <view id="doublesizeview" viewbox="0 0 300 100"/> <a xlink:href="#halfsizeview"> <text x="5" y="20" font-size="20">half size</text> </a> <a xlink:href="#normalsizeview"> <text x="5" y="40" font-size="20">normal size</text> </a> <a xlink:href="#double...
SVG as an Image - SVG: Scalable Vector Graphics
svg images can be used as an image format, in a number of contexts. many browsers support svg images in: html <img> or <svg> elements css background-image gecko-specific contexts additionally, gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) introduced support for using svg in these contexts: css list-style-image css content svg <image> element svg <feimage> element canvas drawimage function restrictions for security purposes, gecko places some restrictions on svg content when it's being used as an image: javascript is disabled. external resources (e.g. images, stylesheets) cannot be loaded, though they can be used if inlined through data: uris. :visited-link styles aren't rendered. platform-native widget styling (based on os theme) is disabled. note that...
Gradients in SVG - SVG: Scalable Vector Graphics
<stop class="stop1" offset="0%"/> <stop class="stop2" offset="50%"/> <stop class="stop3" offset="100%"/> </lineargradient> <lineargradient id="gradient2" x1="0" x2="0" y1="0" y2="1"> <stop offset="0%" stop-color="red"/> <stop offset="50%" stop-color="black" stop-opacity="0"/> <stop offset="100%" stop-color="blue"/> </lineargradient> <style type="text/css"><![cdata[ #rect1 { fill: url(#gradient1); } .stop1 { stop-color: red; } .stop2 { stop-color: black; stop-opacity: 0; } .stop3 { stop-color: blue; } ]]></style> </defs> <rect id="rect1" x="10" y="10" rx="15" ry="15" width="100" height="100"/> <rect x="10" y="120" rx="15" ry="15" width="100" height="100" fill="url(#gradient2)"/> </svg> ...
SVG Filters Tutorial - SVG: Scalable Vector Graphics
low us to implement the desired effect. one of these primitives is the fegaussianblur. the keyword sourcealpha identifies the input for this primitive, is in this case input 'in'. the amount of blur to be applied is done using the stddeviation attribute. svg filter example <defs> <filter id="drop-shadow"> <fegaussianblur in="sourcealpha" stddeviation="3"/> </filter> </defs> <g id="ghost" style="filter: url(#drop-shadow);"/> <!--ghost drawing in here--> </g> this above example will not produced the desired output. instead we need to add more filter primitives which will produce the desire rendering. by adding feoffset and result, the effect layer is defined <result> attribute is a reference that can be use later. it is quite different to an xml id and only can be referenced within t...
Same-origin policy - Web security
is often leaked by embedding. for example, you can read the dimensions of an embedded image, the actions of an embedded script, or the availability of an embedded resource. here are some examples of resources which may be embedded cross-origin: javascript with <script src="…"></script>. error details for syntax errors are only available for same-origin scripts. css applied with <link rel="stylesheet" href="…">. due to the relaxed syntax rules of css, cross-origin css requires a correct content-type header. restrictions vary by browser: internet explorer, firefox, chrome, safari (scroll down to cve-2010-0051) and opera. images displayed by <img>. media played by <video> and <audio>. external resources embedded with <object> and <embed>. fonts applied with @font-face. some browsers ...
Securing your site - Web security
ill be fully secure. user information security how to turn off form autocompletion form fields support autocompletion in gecko; that is, their values can be remembered and automatically brought back the next time the user visits your site. for certain types of data, you may wish to disable this feature. privacy and the :visited selector this article discusses changes made to the getcomputedstyle() method that eliminates the ability for malicious sites to figure out the user's browsing history. hash passwords using a secure algorithm (owasp) storing passwords in plain text can lead to attackers knowing and leaking the exact password of your site's users, potentially putting the users at risk. the same issues can arise if you use an old or insecure algorithm for hashing (such as md5). yo...