Search completed in 1.48 seconds.
2876 results for "css":
Your results are loading. Please wait...
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. ...
... 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. ...
...And 46 more matches
CSS Grid Layout and Progressive Enhancement - CSS: Cascading Style Sheets
In Spring of 2017, we saw for the first time a major specification like Grid being shipped into browsers almost simultaneously, and we now have CSS Grid Layout support in the public versions of Firefox, Chrome, Opera, Safari and Edge. However, while evergreen browsers mean that many of us are going to see the majority of users having Grid Layout support very quickly, there are also old or non-supporting browsers to contend with. In this guide we will walk through a variety of strategies for support. The supporting browsers Other than in Internet Explorer, CSS Grid Layout is unprefixed in Safari, Chrome, Opera, Firefox and Edge. Support for all the properties and values detailed in these guides is interoperable across browsers. This means that if you write some Grid Layout code in F...
...Support for all the properties and values detailed in these guides is interoperable across browsers. This means that if you write some Grid Layout code in Firefox, it should work in the same way in Chrome. This is no longer an experimental specification, and you are safe to use it in production. The Internet Explorer and Edge situation It should be remembered that the original implementation of CSS Grid Layout happened in Internet Explorer 10. This early specification did not contain all of the properties and values that the up-to-date specification has. There are also substantial differences between what shipped in IE10 and the current specification, even where the properties and values appear the same. This early implementation is also the version of Grid Layout implemented in Edge up to ...
...ser supporting the up to date and unprefixed specification. Autoprefixer grid layout support The popular tool Autoprefixer has been updated to support the -ms- grid version. By default, grid prefixes are disabled, but you can enable it with grid: true option. autoprefixer({ grid: 'autoplace' }) Grid prefixes are disabled by default because some properties can't be prefixed. Is it safe to use CSS grids for my layout? As with any front-end technology choice, the decision to use CSS Grid Layout will come down to the browsers your site visitors are typically using. If they tend to use up-to-date versions of Firefox, Chrome, Opera, and Safari, then it would make sense to start using CSS grids once those browsers update. If your site serves a market sector that is tied to older browsers, howe...
...And 17 more matches
Introducing the CSS Cascade - CSS: Cascading Style Sheets
Web › CSS › 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. ...
...This means that at-rules containing entities other than declarations, such as a @font-face rule containing descriptors, don't 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. ...
...And 13 more matches
Using CSS custom properties (variables) - CSS: Cascading Style Sheets
For example, the same color might be used in hundreds of different places, requiring global search and replace if that color needs to change. Custom properties allow a value to be stored in one place, then referenced in multiple other places. An additional benefit is semantic identifiers. ...
...For example, the same color might be used in hundreds of different places, requiring global search and replace if that color needs to change. Custom properties allow a value to be stored in one place, then referenced in multiple other places. An additional benefit is semantic identifiers. ...
...antic identifiers. For example, --main-text-color is easier to understand than #00ff00, especially if this same color is also used in other contexts. Custom properties are subject to the cascade and inherit their value from their parent. Basic usage Declaring a custom property is done using a custom property name that begins with a double hyphen (--), and a property value that can be any valid CSS value. Like any other property, this is written inside a ruleset, like so: element { --main-bg-color: brown; } Note that the selector given to the ruleset defines the scope that the custom property can be used in. A common best practice is to define custom properties on the :root pseudo-class, so that it can be applied globally across your HTML document: :root { --main-bg-color: brown; } ...
...And 12 more matches
CSS Grid Layout and Accessibility - CSS: Cascading Style Sheets
The biggest downside however was that it tied our design to the mark-up, often creating accessibility issues as it did so. ...
...The biggest downside however was that it tied our design to the mark-up, often creating accessibility issues as it did so. ...
...terwards, in that we could take advantage of the alignment and full height columns offered by table display. The biggest downside however was that it tied our design to the mark-up, often creating accessibility issues as it did so. In order to lay the design out in the table we often broke up the content in ways that made no sense at all when read out by a screen reader for example. ...
...And 11 more matches
CSS values and units - CSS: Cascading Style Sheets
Every CSS declaration includes a property / value pair. Depending on the property, the value can include a single integer or keyword, to a series of keywords and values with or without units. There are a common set of data types -- values and units -- that CSS properties accept. Below is an overview of most of these data types. Refer to the page for each value type for more detailed information. Textual data types <custom-ident> Pre-defined keywords as an <ident> <string> <url> Text data types are either <string>, a quoted series of characters, or an <ident>, a "CSS Identifier" which is an unquoted string. A <string> must be quoted with either single or double quotes. CSS Identifiers, listed in the specifications as <ident> or <custom-ident>, must be unquoted. ...
...formation. Textual data types <custom-ident> Pre-defined keywords as an <ident> <string> <url> Text data types are either <string>, a quoted series of characters, or an <ident>, a "CSS Identifier" which is an unquoted string. A <string> must be quoted with either single or double quotes. CSS Identifiers, listed in the specifications as <ident> or <custom-ident>, must be unquoted. In the CSS specifications, values that can be defined by the web developer, like keyframe animations, font-family names, or grid areas are listed as a <custom-ident>, <string>, or both. When both quoted and unquoted user defined text values are permitted, the specification will list <custom-ident> | <string>, meaning quotes are optional, such as is the case with animation names: @keyframe validIdent { ...
...t; } In comparison, a data type that is a <string>, such as a string value of the content property, must be quoted: .item::after { content: "This is my content."; } While you can generally create any name you want, including using emojis, the identifier can't be none, unset, initial, or inherit, start with a digit or two dashes, and generally you don't want it to be any other pre-defined CSS keyword. See the <custom-ident> and <string> reference pages for more details. Pre-defined keyword values Pre-defined keywords are text values defined by the specification for that property. These keywords are also CSS Identifiers and are therefore used without quotes. When viewing CSS property value syntax in a CSS specification or the MDN property page, allowable keywords will be listed in t...
...And 11 more matches
Using CSS transitions - CSS: Cascading Style Sheets
CSS transitions provide a way to control animation speed when changing CSS properties. Instead of having property changes take effect immediately, you can cause the changes in a property to take place over a period of time. For example, if you change the color of an element from white to black, usually the change is instantaneous. With CSS transitions enabled, changes occur at time intervals that follow an acceleration curve, all of which can be customized. Animations that involve transitioning between two states are often called implicit transitions as the states in between the start and final states are implicitly defined by the browser. ...
...he color of an element from white to black, usually the change is instantaneous. With CSS transitions enabled, changes occur at time intervals that follow an acceleration curve, all of which can be customized. Animations that involve transitioning between two states are often called implicit transitions as the states in between the start and final states are implicitly defined by the browser. CSS transitions let you decide which properties to animate (by listing them explicitly), when the animation will start (by setting a delay), how long the transition will last (by setting a duration), and how the transition will run (by defining a timing function, e.g. ...
...This allows the creation of complex transitions. As it doesn't make sense to animate some properties, the list of animatable properties is limited to a finite set. ...
...And 10 more matches
CSS Tutorials - CSS: Cascading Style Sheets
Web › CSS › Tutorials
It explains the fundamental concepts of the language and guides you in writing basic stylesheets. ...
...It explains the fundamental concepts of the language and guides you in writing basic stylesheets. ...
...beginners, while others present complex features to be used by more experienced users. This page lists them all, with a short description. They are grouped by complexity so that you can choose the most appropriate for your level. 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 intera...
...And 9 more matches
CSSMathProduct.CSSMathProduct() - Web APIs
Working Draft Initial definition. ...
... Working Draft Initial definition. ...
... Working Draft Initial definition. ...
...And 6 more matches
CSSMathSum.CSSMathSum() - Web APIs
Working Draft Initial definition. ...
... Working Draft Initial definition. ...
... Working Draft Initial definition. ...
...And 6 more matches
Detecting CSS animation support - CSS: Cascading Style Sheets
CSS animations make it possible to do creative animations of content using nothing but CSS. However, there are likely to be times when this feature isn't available, and you may wish to handle that case by using JavaScript code to simulate a similar effect. This article, based on this blog post by Chris Heilmann, demonstrates a technique for doing this. ...
... CSS animations make it possible to do creative animations of content using nothing but CSS. However, there are likely to be times when this feature isn't available, and you may wish to handle that case by using JavaScript code to simulate a similar effect. This article, based on this blog post by Chris Heilmann, demonstrates a technique for doing this. ...
... possible to do creative animations of content using nothing but CSS. However, there are likely to be times when this feature isn't available, and you may wish to handle that case by using JavaScript code to simulate a similar effect. This article, based on this blog post by Chris Heilmann, demonstrates a technique for doing this. ...
...And 5 more matches
Using CSS animations - CSS: Cascading Style Sheets
The animations run well, even under moderate system load. Simple animations can often perform poorly in JavaScript (unless they're well made). The rendering engine can use frame-skipping and other techniques to keep the performance as smooth as possible. ...
... The animations run well, even under moderate system load. Simple animations can often perform poorly in JavaScript (unless they're well made). The rendering engine can use frame-skipping and other techniques to keep the performance as smooth as possible. ...
...cript (unless they're well made). 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 belo...
...And 5 more matches
CSS Box Alignment - CSS: Cascading Style Sheets
The CSS Box Alignment module specifies CSS features that relate to the alignment of boxes in the various CSS box layout models: block layout, table layout, flex layout, and grid layout. The module aims to create a consistent method of alignment across all of CSS. This document details the general concepts found in the specification. Note: The documentation for each layout method will detail how Box Alignment is applied there. Older alignment methods CSS traditionally had very limited alignment capabilities. We were able to align text using text-align, center blocks using auto margins, and in table or inline-block layouts using the vertical-align property. ...
...cation. Note: The documentation for each layout method will detail how Box Alignment is applied there. Older alignment methods CSS traditionally had very limited alignment capabilities. We were able to align text using text-align, center blocks using auto margins, and in table or inline-block layouts using the vertical-align property. Alignment of text is now covered by the Inline Layout and CSS Text modules, and for the first time in Box Alignment we have full horizontal and vertical alignment capabilities. If you initially learned Flexbox then you may consider these properties to be part of the Flexbox specification, and some of the properties are indeed listed in Level 1 of Flexbox. However the specification notes that the Box Alignment specification should be referred to as it may a...
...to be part of the Flexbox specification, and some of the properties are indeed listed in Level 1 of Flexbox. However the specification notes that the Box Alignment specification should be referred to as it may add additional capabilities over what is currently in Flexbox. Basic examples The following examples demonstrate how some of the Box Alignment Properties are applied in Grid and Flexbox. CSS grid layout alignment example In this example using Grid Layout, there is extra space in the grid container after laying out the fixed width tracks on the inline (main) axis. This space is distributed using justify-content. On the block (cross) axis the alignment of the items inside their grid areas is controlled with align-items. The first item overrides the align-items value set on the group b...
...And 5 more matches
CSS grids, logical values, and writing modes - CSS: Cascading Style Sheets
In these guides, I have already touched on an important feature of grid layout: the support for different writing modes that is built into the specification. For this guide, we will look at this feature of grid and other modern layout methods, learning a little about writing modes and logical vs. physical properties as we do so. Logical and physical properties and values CSS is full of physical positioning keywords - left and right, top and bottom. If we position an item using absolute positioning, we use these physical keywords as offset values to push the item around. In the code snippet below, the item is placed 20 pixels from the top, and 30 pixels from the left of the container: .container { position: relative; } .item { position: absolute; top: 20px; left: 30px; } <...
...item is placed 20 pixels from the top, and 30 pixels from the left of the container: .container { position: relative; } .item { position: absolute; top: 20px; left: 30px; } <div class="container"> <div class="item">Item</div> </div> Another place you might see physical keywords in use, is when using text-align: right to align text to the right. There are also physical properties in CSS. We add margins, padding, and borders using these physical properties of margin-left, padding-left, and so on. We call these keywords and properties physical because they relate to the screen you are looking at. Left is always left, no matter what direction your text is running. This can become an issue when developing a site that has to work in multiple languages, including languages that have...
...d dir="rtl" to the html element, which switches the writing mode from the default for an English language document of ltr. You can see that the first paragraph remains left to right, due to the text-align value being left . The second however, switches direction and the text runs from right to left . This is a very simple example of the problem with physical values and properties being used in CSS. They prevent the browser being able to do the work to switch writing mode, as they make the assumption that the text is flowing left to right and top to bottom. Logical properties and values Logical properties and values do not make an assumption about text direction. Which is why in Grid Layout we use the keyword start when aligning something to the start of the container. For me, working in ...
...And 5 more matches
Using CSS counters - CSS: Cascading Style Sheets
The same property can also be used to change its value to any specific number. Once 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. ...
...The same property can also be used to change its value to any specific number. Once 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. ...
...(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 outermost to innermost, separated by the specified string. The counters are rendered in the specified style (decimal by default). 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. */ } h3::before { counter-increment: section; /* Increment the value of section counter by 1 */ content: "Section " counter(section) ": "; /* Display the word 'Section ', the value of section counter, and...
...And 5 more matches
CSS Grid Layout - CSS: Cascading Style Sheets
Basic example The example below shows a three-column track grid with new rows created at a minimum of 100 pixels and a maximum of auto. Items have been placed onto the grid using line-based placement. ...
... Basic example The example below shows a three-column track grid with new rows created at a minimum of 100 pixels and a maximum of auto. Items have been placed onto the grid using line-based placement. ...
...p in terms of size, position, and layer, between parts of a control built from HTML primitives. Like tables, grid layout enables an author to align elements into columns and rows. However, many more layouts are either possible or easier with CSS grid than they were with tables. For example, a grid container's child elements could position themselves so they actually overlap and layer, similar to CSS positioned elements. Basic example The example below shows a three-column track grid with new rows created at a minimum of 100 pixels and a maximum of auto. Items have been placed onto the grid using line-based placement. * {box-sizing: border-box;} .wrapper { max-width: 940px; margin: 0 auto; } .wrapper > div { border: 2px solid rgb(233,171,88); border-radius: 5px; background-colo...
...And 4 more matches
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. ...
... 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. ...
... 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 interactive tool lets you visually create border images (the border-image property). Border-radius generator This interactive tool lets you visually create rounded corners (the border-radius property). Box-shadow generator This interactive tool lets you visually create shadows behind elemen...
...And 3 more matches
CSS Containment - CSS: Cascading Style Sheets
This document describes the basic aims of the specification. Basic example Many webpages contain a number of sections which are independent of each other. For example a listing of article headlines and content, as in the mark-up below. ...
...This document describes the basic aims of the specification. Basic example Many webpages contain a number of sections which are independent of each other. For example a listing of article headlines and content, as in the mark-up below. ...
... sections which are independent of each other. For example a listing of article headlines and content, as in the mark-up below. <h1>My blog</h1> <article> <h2>Heading of a nice article</h2> <p>Content here.</p> </article> <article> <h2>Another heading of another article</h2> <p>More content here.</p> </article> Each article has the contain property with a value of content applied in the CSS. article { contain: content; } Each article is independent of the other articles on the page, and so they have been given contain: content in order to indicate to the browser that this is the case. The browser can then use 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>...
...And 3 more matches
CSS Display - CSS: Cascading Style Sheets
CSS Display is a module of CSS that defines how the CSS formatting box tree is generated from the document element tree and defines properties controlling it. ...
... CSS Display is a module of CSS that defines how the CSS formatting box tree is generated from the document element tree and defines properties controlling it. ...
... CSS Display is a module of CSS that defines how the CSS formatting box tree is generated from the document element tree and defines properties controlling it. ...
...And 3 more matches
CSS Fonts - CSS: Cascading Style Sheets
Web › CSS › CSS Fonts
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. ...
... or 'ffl'), kerning (adjustments to the spacing between specific letterform pairings), fractions, numeral styles, and a number of others. 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. Variable fonts guide Variable fonts are an evolution of the OpenType font specification that enables many different variations of a typeface to be incorporated into a single file, rather than having a separate font file for every width, weight, or style. This article will give you all you need to know to get you started using variable fonts. Specifications Specification Status ...
... Variable fonts are an evolution of the OpenType font specification that enables many different variations of a typeface to be incorporated into a single file, rather than having a separate font file for every width, weight, or style. This article will give you all you need to know to get you started using variable fonts. ...
...And 3 more matches
CSS Overflow - CSS: Cascading Style Sheets
This is the content appearing outside of the box for which scrolling mechanisms need to be provided. ...
...This is the content appearing outside of the box for which scrolling mechanisms need to be provided. ...
...This is the content appearing outside of the box for which scrolling mechanisms need to be provided. ...
...And 3 more matches
CSS Scrollbars - CSS: Cascading Style Sheets
CSS Scrollbars standardizes the obsolete scrollbar color properties introduced in 2000 by Windows IE 5.5. Basic Example In this example we have chosen to use a thin scrollbar, with a green track and purple thumb. .scroller { width: 300px; height: 100px; overflow-y: scroll; scrollbar-color: rebeccapurple green; scrollbar-width: thin; } HTML <div class="scroller"> Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo melon azuki bean garlic. Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini. ...
... } HTML <div class="scroller"> Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo melon azuki bean garlic. Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini. </div> Result Reference CSS Properties scrollbar-width scrollbar-color Specifications Specification Status Comment CSS Scrollbars Level 1 Working Draft Initial definition. Accessibility concerns When you customize scrollbars, consider they have enough contrast and that their hit area is large enough for people who use touch input. Baseline Rules for Scrollbar Usability |...
...To change preferences in Firefox, visit about:config.IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android ...
...And 3 more matches
CSS reference - CSS: Cascading Style Sheets
Web › CSS › Reference
Basic rule syntax Style rule syntax style-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. ...
...ist ::= [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 (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. K...
...d by the browser. Note that CSS rule definitions are entirely (ASCII) text-based, 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. --webkit-line-clampA:activeadditive-symbols (@counter-style)::after (:after)align-contentalign-itemsalign-selfall<an-plus-b><angle><angle-percentage>animationanimation-delayanimation-directionanimation-durationanimation-fill-modeanimation-iteration-countanimation-nameanimation-play-stateanimation-timing-function@annotationannotation()attr()B::backdropbackdrop-filterbackface...
...And 3 more matches
CSS Color - CSS: Cascading Style Sheets
Web › CSS › CSS Color
CSS Color is a CSS module that deals with colors, color types, color blending, opacity, and how you can apply these colors and effects to HTML content. Not all CSS properties that take a <color> as a value are part of this module, but they do depend upon it. Reference Properties color color-adjust opacity Data types <color> Guides Applying color to HTML elements using CSS A guide to using CSS to apply color to a variety of types of content. All color-related CSS properties are touched upon. Tools Color picker tool This tool makes it easy to create, adjust, and experiment with custom colors. ...
...just opacity Data types <color> Guides Applying color to HTML elements using CSS A guide to using CSS to apply color to a variety of types of content. All color-related CSS properties are touched upon. Tools Color picker tool This tool makes it easy to create, adjust, and experiment with custom colors. ...
...plying color to HTML elements using CSS A guide to using CSS to apply color to a variety of types of content. All color-related CSS properties are touched upon. Tools Color picker tool This tool makes it easy to create, adjust, and experiment with custom colors. ...
...And 2 more matches
Realizing common layouts using CSS Grid Layout - CSS: Cascading Style Sheets
We will look at an example using grid-template-areas, a typical 12-column flexible grid system, and also a product listing using auto-placement. As you can see from this set of examples, there is often more than one way to achieve the result you want with grid layout. Choose the method you find most helpful for the problems that you are solving and the designs that you need to implement. ...
...ation of elements. You could always begin to use grid in this way for prototyping, even if you can't rely on it fully in production due to the browsers that visit your site. A flexible 12-column layout If you have been working with one of the many frameworks or grid systems you may be accustomed to laying out your site on a 12- or 16-column flexible grid. We can create this type of system using CSS Grid Layout. As a simple example, I am creating a 12-column flexible grid that has 12 1fr-unit column tracks, they all have a start line named col-start. This means that we will have twelve grid lines named col-start. .wrapper { max-width: 1024px; margin: 0 auto; font: 1.2em Helvetica, arial, sans-serif; } .wrapper > * { border: 2px solid #f08c00; background-color: #ffec99; border-...
... To see how the blocks align themselves to the tracks, use the Firefox Grid Inspector. It clearly demonstrates how our items are placed. There are some key differences with how a grid layout works over the grid systems you may have used previously. As you can see, we do not need to add any markup to create a row, grid systems need to do this to stop elements popping up into the row above. With CSS Grid Layout, we can place things into rows, with no danger of them rising up into the row above if it is left empty. Due to this strict column and row placement we can also easily leave white space in our layout. We also don't need special classes to pull or push things, to indent them into the grid. All we need to do is specify the start and end line for the item. Building a layout using the 12...
...And 2 more matches
CSS Paged Media - CSS: Cascading Style Sheets
Web › CSS › CSS Pages
CSS Paged Media is a module of CSS that defines how page switches are handled. ...
... CSS Paged Media is a module of CSS that defines how page switches are handled. ...
... CSS Paged Media is a module of CSS that defines how page switches are handled. ...
...And 2 more matches
Using CSS transforms - CSS: Cascading Style Sheets
By modifying the coordinate space, CSS transforms change the shape and position of the affected content without disrupting the normal document flow. This guide provides an introduction to using transforms. CSS transforms are implemented using a set of CSS properties that let you apply affine linear transformations to HTML elements. These transformations include rotation, skewing, scaling, and translation both in the plane and in the 3D space. Only elements positioned by the box model can be transformed. As a rule of thumb, an element is positioned by the box model if it has display: block. CSS transforms properties Two major properties are used to define CSS transforms: transform and transform-origin transform-origin Specifies the position of the origin. By default, it is at the c...
...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 space. Perspective The first element to set is the perspective. The perspective is what gives us the 3D impression. The farther from the viewer the elements are, the smaller the...
...It also includes classes for the container box and the cube itself, as well as each of its faces. /* Shorthand classes for different perspective values */ .pers250 { perspective: 250px; } .pers350 { perspective: 350px; } .pers500 { perspective: 500px; } .pers650 { perspective: 650px; } /* Def...
...And 2 more matches
CSSPositionValue.CSSPositionValue() - Web APIs
The CSSPositionValue constructor creates a new CSSPositionValue object which represents values for properties that take a position, for example object-position. Syntax cvar cssPositionValue = new CSSPositionValue(x, y) Parameters x A position along the web page's horizontal axis. y A position along the web page's vertical axix. Examples The following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. ...
...xample object-position. Syntax cvar cssPositionValue = new CSSPositionValue(x, y) Parameters x A position along the web page's horizontal axis. y A position along the web page's vertical axix. Examples The following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. ...
...ition. Syntax cvar cssPositionValue = new CSSPositionValue(x, y) Parameters x A position along the web page's horizontal axis. y A position along the web page's vertical axix. Examples The following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. ...
...tax cvar cssPositionValue = new CSSPositionValue(x, y) Parameters x A position along the web page's horizontal axis. y A position along the web page's vertical axix. Examples The following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. ...
CSSValue.cssValueType - Web APIs
CSS_PRIMITIVE_VALUE The value 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. ...
... The cssValueType read-only property of the CSSValue interface represents the type of the current computed CSS property value. Syntax cssValueType = cssValue.cssValueType; Value An unsigned short representing a code defining the type of the value. Possible values are: Constant Description CSS_CUSTOM The value is a custom value. CSS_INHERIT The value is inherited and the cssText contains "inherit". CSS_PRIMITIVE_VALUE The value 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. ...
... are: Constant Description CSS_CUSTOM The value is a custom value. CSS_INHERIT The value is inherited and the cssText contains "inherit". CSS_PRIMITIVE_VALUE The value 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. ...
...he 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 ...
CSS Animations tips and tricks - CSS: Cascading Style Sheets
There's no magic resetAnimation() method on elements, and you can't even just set the element's animation-play-state to "running" again. Instead, you have to use clever tricks to get a stopped animation to replay. Here's one way to do it that we feel is stable and reliable enough to suggest to you. ...
...t possible to do incredible things with the elements that make up your documents and apps. However, there are things you might want to do that aren't obvious, or clever ways to do things that you might not come up with right away. This article is a collection of tips and tricks we've found that may make your work easier, including how to run a stopped animation again. Run an animation again The CSS Animations specification doesn't offer a way to run an animation again. There's no magic resetAnimation() method on elements, and you can't even just set the element's animation-play-state to "running" again. Instead, you have to use clever tricks to get a stopped animation to replay. Here's one way to do it that we feel is stable and reliable enough to suggest to you. HTML content First, let'...
...o "running" again. Instead, you have to use clever tricks to get a stopped animation to replay. 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 ...
...= "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, 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 th...
CSS Basic Box Model - CSS: Cascading Style Sheets
CSS Basic Box Model is a module of CSS that defines the rectangular boxes--including their padding and margin--that are generated for elements and laid out according to the visual formatting model. ...
... Mastering margin collapsing Sometimes, two adjacent margins are collapsed into one. This article describes the rules that govern when and why this happens, and how to control it. Visual formatting model Explains the...
...width min-height min-width Properties controlling the margins of a box margin margin-bottom margin-left margin-right margin-top margin-trim Properties controlling the paddings of a box padding padding-bottom padding-left padding-right padding-top Other properties visibility Guides Introduction to the CSS box model Explains one of the fundamental concept of CSS: the box model. This model defines how CSS lays out elements, including their content, padding, border, and margin areas. Mastering margin collapsing Sometimes, two adjacent margins are collapsed into one. This article describes the rules that govern when and why this happens, and how to control it. Visual formatting model Explains the visual formatting model. Specifications Speci...
... lays out elements, including their content, padding, border, and margin areas. Mastering margin collapsing Sometimes, two adjacent margins are collapsed into one. This article describes the rules that govern when and why this happens, and how to control it. Visual formatting model Explains the visual formatting model. Specifications Specification Status Comment CSS Basic Box Model Working Draft Added margin-trim CSS Level 2 (Revision 1) Recommendation CSS Level 1 Recommendation Initial definition. ...
CSS Multi-column Layout - CSS: Cascading Style Sheets
CSS Multi-column Layout is a module of CSS that adds support for multi-column layouts. Support is included for establishing the number of columns in a layout, as well as how content should flow from column to column, gap sizes between columns, and column dividing lines (known as column rules) along with their appearance. Basic example In the following example the column-count property has been applied to the element with a class of container. As the value of column-count is 3, the content is arranged into 3 columns of equal size. Relationship to Fragmentation Multiple-column Layout is closely related to Paged Media, in that each column box becomes a fragment, much like a printed page becomes a fragment of an overall document. ...
...rty has been applied to the element with a class of container. As the value of column-count is 3, the content is arranged into 3 columns of equal size. Relationship to Fragmentation Multiple-column Layout is closely related to Paged Media, in that each column box becomes a fragment, much like a printed page becomes a fragment of an overall document. ...
... 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 columns and controlling the way columns are filled. Handling Overflow i...
...olling the way columns are filled. ...
CSS Flexible Box Layout - CSS: Cascading Style Sheets
In the flex layout model, the children of a flex container can be laid out in any direction, and can "flex" their sizes, either growing to fill unused space or shrinking to avoid overflowing the parent. Both horizontal and vertical alignment of the children can be easily manipulated. Basic Example In the following example a container has been set to display: flex, which means that the three child items become flex items. The value of justify-content has been set to space-between in order to space the items out evenly on the main axis. ...
...venly on the main axis. An equal amount of space is placed between each item with the left and right items being flush with the edges of the flex container. You can also see that the items are stretching on the cross axis, due to the default value of align-items being stretch. The items stretch to the height of the flex container, making them each appear as tall as the tallest item. Reference CSS Properties flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap order Alignment Properties The properties align-content, align-self, align-items and justify-content initially appeared in the Flexbox specification, but are now defined in Box Alignment. The Flexbox spec now refers to the Box Alignment specification for up to date definitions. Also additional align...
...ox Alignment. justify-content align-content align-items align-self place-content place-items row-gap column-gap gap Glossary entries Flexbox Flex Container Flex Item Main Axis Cross Axis Flex Guides Basic Concepts of Flexbox An overview of the features of Flexbox Relationship of Flexbox to other layout methods How Flexbox relates to other layout methods, and other CSS specifications Aligning items in a flex container How the Box Alignment properties work with Flexbox. Ordering flex items Explaining the different ways to change the order and direction of items, and covering the potential issues in doing so. Controlling Ratios of flex items along the main axis Explaining the flex-grow, flex-shrink and flex-basis properties. Mastering wrapping of flex item...
... ...
Box alignment in CSS Grid Layout - CSS: Cascading Style Sheets
This guide presents demonstrations of how box alignment in grid layout works. You will see many similarities in how these properties and values work in flexbox. ...
... specification details how alignment should work in all the different layout methods. Layout methods will conform to the specification where possible and implement individual behavior based on their differences (features and constraints). While the specification currently specifies alignment details for all layout methods, browsers have not fully implemented all of the specification; however, the CSS Grid Layout method has been widely adopted. This guide presents demonstrations of how box alignment in grid layout works. You will see many similarities in how these properties and values work in flexbox. Due to grid being two-dimensional and flexbox one-dimensional there are some small differences that you should watch out for. So we will start by looking at the two axes that we deal with when ...
..."item2">Item 2</div> <div class="item3">Item 3</div> <div class="item4">Item 4</div> </div> You can see how the item is aligned by using the Firefox Grid Highlighter: Alignment and Writing Modes In all of these examples I have been working in English, which is a left-to-right language. This means that our start lines are top and left of our grid when thinking in physical directions. CSS Grid Layout, and the Box Alignment specification are designed to work with writing modes in CSS. This means that if you are working in a right to left language, such as Arabic, the start of the grid would be the top and right, so the default of justify-content: start would be for grid tracks to start on the right hand side of the grid. Setting auto margins, using margin-right or margin-left howe...
...art of the grid would be the top and right, so the default of justify-content: start would be for grid tracks to start on the right hand side of the grid. Setting auto margins, using margin-right or margin-left however, or absolutely positioning items using the top, right, bottom and left offsets would not honor writing modes. In the next guide, we will look further into this interaction between CSS grid layout, box alignment and writing modes. This will be important to understand, if you develop sites that are then displayed in multiple languages, or if you want to mix languages or writing modes in a design. ...
Using CSS gradients - CSS: Cascading Style Sheets
You can choose between three types of gradients: linear (created with the linear-gradient() function), radial (created with radial-gradient()), and conic (created with the conic-gradient() function). You can also create repeating gradients with the repeating-linear-gradient(), repeating-radial-gradient(), and repeating-conic-gradient() functions. Gradients can be used anywhere you would use an <image>, such as in backgrounds. Because gradients are dynamically generated, they can negate the need for the raster image files that traditionally were used to achieve similar effects. ...
..."></div> div { width: 120px; height: 120px; } .angled-gradient { background: linear-gradient(70deg, blue, pink); } When using an angle, 0deg creates a vertical gradient running bottom to top, 90deg creates a horizontal gradient running left to right, and so on in a clockwise direction. Negative angles run in the counterclockwise direction. Declaring colors & creating effects All CSS gradient types are a range of position-dependent colors. The colors produced by CSS gradients can vary continuously with position, producing smooth color transitions. It is also possible to create bands of solid colors, and hard transitions between two colors. The following are valid for all gradient functions: Using more than two colors You don't have to limit yourself to two colors--you may ...
...ient, reach solid red at the 30% mark, and staying solid red up until 45% through the gradient, where it fades to cyan, being fully cyan for 15% of the gradient, and so on. In the second example, the second color stop for each color is at the same location as the first color stop for the adjacent color, creating a striped effect. In both examples, the gradient is written twice: the first is the CSS Images Level 3 method of repeating the color for each stop and the second example is the CSS Images Level 4 multiple color stop method of including two color-stop-lengths in a linear-color-stop declaration. Controlling the progression of a gradient By default, a gradient evenly progresses between the colors of two adjacent color stops, with the midpoint between those two color stops being the...
...Example conic gradients include pie charts and color wheels, but they can also be used for creating checker boards and other intersting effects. The conic-gradient syntax is similar to the radial-gradient syntax, but the color-stops are placed around a ...
CSS Images - CSS: Cascading Style Sheets
CSS Images is a module of CSS that defines what types of images can be used (the <image> type, containing URLs, gradients and other types of images), how to resize them and how they, and other replaced content, interact with the different layout models. Reference Properties image-orientation image-rendering image-resolution object-fit object-position Functions linear-gradient() radial-gradient() repeating-linear-gradient() repeating-radial-gradient() conic-gradient() repeating-conic-gradient() url() element() image() cross-fade() Data types <gradient> <image> Guides Using CSS gradients Presents a specific type of CSS images, gradients, and how to create and use these. ...
...ject-position Functions linear-gradient() radial-gradient() repeating-linear-gradient() repeating-radial-gradient() conic-gradient() repeating-conic-gradient() url() element() image() cross-fade() Data types <gradient> <image> Guides Using CSS gradients Presents a specific type of CSS images, gradients, and how to create and use these. ...
...s <gradient> <image> Guides Using CSS gradients Presents a specific type of CSS images, gradients, and how to create and use these. Implementing image sprites in CSS Describes the common technique grouping several images in one single document to save download requests and speed up the availability of a page. Specifications Specification Status Comment CSS Images Module Level 4 Working Draft Added image-resolution, conic-gradient(), and image() CSS Images Module Level 3 Candidate Recommendation Added image-orientation, image-rendering, object-fit and object-position Compatibility StandardThe definition of 'CSS Gradients' in that specification. Living Standard Standardizes the -webkit prefixed gradient value funct...
... Level 4 Working Draft Added image-resolution, conic-gradient(), and image() CSS Images Module Level 3 Candidate Recommendation Added image-orientation, image-rendering, object-fit and object-position Compatibility StandardThe definition of 'CSS Gradients' in that specification. Living Standard Standardizes the -webkit prefixed gradient value functions CSS Values and Units Module Level 3The definition of '<url>' in that specification. Candidate Recommendation CSS Level 2 (Revision 1)The definition of '<uri>' in that specification. Recommendation CSS Level 1The definition of '<url>' in that specification. Recommendation Initial definition ...
Understanding CSS z-index - CSS: Cascading Style Sheets
In the most basic cases, HTML pages can be considered two-dimensional, because text, images, and other elements are arranged on the page without overlapping. In this case, there is a single rendering flow, and all elements are aware of the space taken by others. The z-index attribute lets you 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...
...levant 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, with an easy-to-understand behaviour. However, when z-index is applied to complex hierarchies of HTML elements, its behaviour can be hard to understand or predict. This is due to complex stacking rules. ...
... This article will try to explain those rules, with some simplification and several examples. Stacking without the z-index property: The stacking rules that apply when z-index is not used. Stacking with floated blocks: How floating elements are handled with stacking. ...
... This article will try to explain those rules, with some simplification and several examples. Stacking without the z-index property: The stacking rules that apply when z-index is not used. Stacking with floated blocks: How floating elements are handled with stacking. Using z-index: How to use z-index to change default stacking. ...
CSS Scroll Snap - CSS: Cascading Style Sheets
CSS Scroll Snap is a module of CSS that introduces scroll snap positions, which enforce the scroll positions that a scroll container's scrollport may end at after a scrolling operation has completed. Note: The previous version of this module was called Scroll Snap Points and has been deprecated. CSS Scroll Snap is the current implementation. ...
... CSS Scroll Snap is a module of CSS that introduces scroll snap positions, which enforce the scroll positions that a scroll container's scrollport may end at after a scrolling operation has completed. Note: The previous version of this module was called Scroll Snap Points and has been deprecated. CSS Scroll Snap is the current implementation. ...
...n deprecated. CSS Scroll Snap is the current implementation. ...
...croll-padding-block scroll-padding-block-start scroll-padding-block-end CSS Properties on Children scroll-snap-align scroll-margin scroll-margin-top scroll-margin-right scroll-margin-bottom scroll-margin-left scroll-margin-inline scroll-margin-inline-start scroll-margin-inline-end scroll-margin-block scroll-margin-block-start scroll-margin-block-end Guides Basic concepts of CSS Scroll Snap Browser Compatibility and Scroll Snap Specification Specification Status Comment CSS Scroll Snap Module Level 1 Candidate Recommendation Initial definition ...
Overview of CSS Shapes - CSS: Cascading Style Sheets
The CSS Shapes Level 1 Specification describes geometric shapes in CSS. They are, in Level 1 of the specification, designed to be applied to floated items. This article provides an overview of what you can do with shapes. You could for example float an item left, which would cause the text to wrap round the right and bottom of the item in a rectangular fashion. If you then apply a circle shape, the text would then wrap round the line of the circle. There are a number of ways to create these Shapes and in these guides we will find out how CSS Shapes work, and consider some ways you might like to use them. What does the specification define? The specification defines three new properties: shape-outside -- allows definition of basic shapes shape-image-threshold -- Sets an opacity thresh...
... you might simply want to cause some text to flow along a non-rectangular invisible line. You can do this with Shapes, however you will still need a floated item, which you can then make invisible. That could be a redundant element inserted into the document, an empty <div> or <span> perhaps, but our preference is to use generated content. This means we can keep things used for styling inside the CSS. In this next example, we use generated content to insert an element with height and width of 150px. We can then use Basic Shapes, Box Values or even the Alpha Channel of an image to create a shape for the text to wrap around. Relationship to clip-path The Basic Shapes and Box values used to create Shapes are the same as those used as values for clip-path. Therefore if you want to create a s...
...h. Therefore if you want to create a shape using an image, and also clip away part of that image, you can use the same values. The image below is a square image with a blue background. We have defined a shape using shape-outside: ellipse(40% 50%); and also used clip-path: ellipse(40% 50%); to clip away the same area that we have used to define the shape. Developer Tools for Shapes Along with CSS Shapes support in the browser, Firefox are shipping a Shape Path Editor in the Firefox DevTools. This tool means that you can inspect any shapes on your page, and even change the values in the live page. If your polygon isn't quite right you can use the Shapes Editor to tweak it, then copy the new value back into your CSS. The Shape Path Editor will be enabled by default in Firefox 60 for shapes...
...t any shapes on your page, and even change the values in the live page. If your polygon isn't quite right you can use the Shapes Editor to tweak it, then copy the new value back into your CSS. The Shape Path Editor will be enabled by default in Firefox 60 for shapes generated via clip-path. You can also use it to edit shapes generated via shape-outside, but only when you enable it via the layout.css.shape-outside.enabled pref. Future CSS Shapes Features The initial Shapes specification included a property shape-inside for creating shapes inside an element. This property, along with the possibility of creating shapes on non-floated elements, has been moved to level 2 of the specification. As the shape-inside property was initially in Level 1 of the specification, you may find tutorials on t...
CSS Writing Modes - CSS: Cascading Style Sheets
CSS Writing Modes is a CSS module that defines various international writing modes, such as left-to-right (e.g. used by Latin and Indic scripts), right-to-left (e.g. used by Hebrew or Arabic scripts), bidirectional (used when mixing left-to-right and right-to-left scripts) and vertical (e.g. used by some Asian scripts). ...
...ic scripts), right-to-left (e.g. used by Hebrew or Arabic scripts), bidirectional (used when mixing left-to-right and right-to-left scripts) and vertical (e.g. used by some Asian scripts). ...
...ectional (used when mixing left-to-right and right-to-left scripts) and vertical (e.g. used by some Asian scripts). ...
...ft scripts) and vertical (e.g. used by some Asian scripts). ...
CSS Layout cookbook - CSS: Cascading Style Sheets
The CSS layout cookbook aims to bring together recipes for common layout patterns, things you might need to implement in your own sites. In addition to providing code you 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. Note: If you are new to CSS layout then you might first like to take a look at our CSS layout learning module, as this will give you the basic grounding you need to make use of the recipes here. The Recipes Recipe Description Layout Methods Media objects A two-column box with an image on one side and descriptive text on the other, e.g. a facebook post or tweet. ...
...ote: If you are new to CSS layout then you might first like to take a look at our CSS layout learning module, as this will give you the basic grounding you need to make use of the recipes here. The Recipes Recipe Description Layout Methods Media objects A two-column box with an image on one side and descriptive text on the other, e.g. a facebook post or tweet. CSS Grid, float fallback, fit-content() sizing Columns When to choose multi-column layout, flexbox or grid for your columns. CSS Grid, Multicol, Flexbox Center an element How to center an item horizontally and vertically. Flexbox, Box Alignment Sticky footers Creating a footer which sits at the bottom of the container or viewport when the content is shorter. ...
... Flexbox, margin Breadcrumb navigation Creating a list of links to allow the visitor to navigate back up through the page hierarchy. ...
...oup with badges A list of items with a badge to display a count. Flexbox, Box Alignment Pagination Links to pages of content (such as search results). Flexbox, Box Alignment Card A card component, which displays in a grid of cards. Grid Layout Grid wrapper For aligning grid content within a central wrapper, while also allowing items to break out. CSS Grid Contribute a Recipe As with all of MDN we would love you to contribute a recipe in the same format as the ones shown above. See this page for a template and guidelines for writing your own example. ...
CSS Animations - CSS: Cascading Style Sheets
CSS Animations is a module of CSS that lets you animate the values of CSS properties over time, using keyframes. The behavior of these keyframe animations can be controlled by specifying their timing function, duration, their number of repetitions, and other attributes. Reference CSS Properties animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function CSS At-rules @keyframes Guides Detecting CSS animation support Describes a technique for detecting if a browser supports CSS animations. Using CSS animations Step-by-step tutorial about how to create animations using CSS. ...
...on-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function CSS At-rules @keyframes Guides Detecting CSS animation support Describes a technique for detecting if a browser supports CSS animations. Using CSS animations Step-by-step tutorial about how to create animations using CSS. This article describes each relevant CSS property and at-rule and explains how they interact with each other. CSS animations tips and tricks Tips and tricks to help you get the most out of CSS animations. ...
...ch relevant CSS property and at-rule and explains how they interact with each other. CSS animations tips and tricks Tips and tricks to help you get the most out of CSS animations. Currently offers a technique for replaying an animation which has already run through to completion, which the API doesn't support inherently. Specifications Specification Status Comment CSS Animations Working Draft Initial definition. ...
Auto-placement in CSS Grid Layout - CSS: Cascading Style Sheets
You can see auto-placement in action in the simplest of ways by creating a grid on a set of items. If you give the items no placement information they will position themselves on the grid, one in each grid cell. ...
...e</div> <div>Four</div> <div>Five</div> <div>Six</div> <div>Seven</div> <div>Eight</div> </div> The order of auto placed items A grid can contain a mixture of items. Some of the items may have a position on the grid, but others may be auto-placed. This can be helpful, if you have a document order that reflects the order in which items sit on the grid you may not need to write CSS rules to place absolutely everything. The specification contains a long section detailing the Grid item placement algorithm, however for most of us we just need to remember a few simple rules for our items. Order modified document order Grid places items that have not been given a grid position in what is described in the specification as "order modified document order". This means that if you ...
...gs that often come up as questions. Currently we can't do things like target every other cell of the grid with our items. A related issue may have already come to mind if you followed the last guide about named lines on the grid. It would be to define a rule that said "auto-place items against the next line named "n", and grid would then skip other lines.There is an issue raised about this on the CSSWG GitHub repository, and you would be welcome to add your own use cases to this. It may be that you come up with your own use cases for auto-placement or any other part of grid layout. If you do, raise them as issues or add to an existing issue that could solve your use case. This will help to make future versions of the specification better. ...
CSS Lists - CSS: Cascading Style Sheets
CSS Lists is a module of CSS that defines how lists can be laid out and styled. Reference Properties list-style-image list-style-type list-style-position list-style Guides Consistent list indentation Explains how to achieve consistent list indentation across different browsers. Using CSS Counters Explains how to use the CSS counter properties to control list counters. ...
...out and styled. Reference Properties list-style-image list-style-type list-style-position list-style Guides Consistent list indentation Explains how to achieve consistent list indentation across different browsers. ...
...mage list-style-type list-style-position list-style Guides Consistent list indentation Explains how to achieve consistent list indentation across different browsers. Using CSS Counters Explains how to use the CSS counter properties to control list counters. ...
CSS Logical Properties and Values - CSS: Cascading Style Sheets
Logical properties define direction-relative equivalents of their corresponding physical properties. Block vs. inline Logical properties and values use the abstract terms block and inline to describe the direction in which they flow. The physical meaning of these terms depends on the writing mode. ...
...Logical properties define direction-relative equivalents of their corresponding physical properties. Block vs. inline Logical properties and values use the abstract terms block and inline to describe the direction in which they flow. The physical meaning of these terms depends on the writing mode. ...
... ...
CSS Positioned Layout - CSS: Cascading Style Sheets
CSS Positioned Layout is a module of CSS that defines how to position elements on the page. Reference CSS properties bottom clear float left position right top z-index Guides Understanding CSS z-index Presents the notion of stacking context and explains how z-ordering works, with several examples. ...
... CSS Positioned Layout is a module of CSS that defines how to position elements on the page. Reference CSS properties bottom clear float left position right top z-index Guides Understanding CSS z-index Presents the notion of stacking context and explains how z-ordering works, with several examples. ...
...position elements on the page. Reference CSS properties bottom clear float left position right top z-index Guides Understanding CSS z-index Presents the notion of stacking context and explains how z-ordering works, with several examples. ...
CSS Properties Reference - CSS: Cascading Style Sheets
Common CSS Properties Reference The following is a basic list of the most common CSS properties with the equivalent of the DOM notation which is usually accessed from JavaScript: Note: This list is incomplete. For more CSS properties see The main CSS reference and Mozilla CSS Extensions. The reference articles also include examples on how to use all the properties. ...
... Common CSS Properties Reference The following is a basic list of the most common CSS properties with the equivalent of the DOM notation which is usually accessed from JavaScript: Note: This list is incomplete. For more CSS properties see The main CSS reference and Mozilla CSS Extensions. The reference articles also include examples on how to use all the properties. ...
... 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 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 l...
CSS Shapes - CSS: Cascading Style Sheets
CSS Shapes describe geometric shapes for use in CSS. For the Level 1 specification, CSS Shapes can be applied to floating elements. The specification defines a number of different ways to define a shape on a floated element, causing wrapping lines to wrap round the shape rather than following the rectangle of the element's box. Basic example The example below shows an image that has been floated left, and the shape-outside property applied with a value of circle(50%). This creates a circle shape, and the content wrapping the float now wraps around that shape. This changes the length of the wrapping text's line boxes. ...
...shows an image that has been floated left, and the shape-outside property applied with a value of circle(50%). This creates a circle shape, and the content wrapping the float now wraps around that shape. This changes the length of the wrapping text's line boxes. Reference Properties shape-image-threshold shape-margin shape-outside Data types <basic-shape> Guides Overview of CSS Shapes Shapes from Box Values Basic Shapes Shapes from Images Edit Shape Paths in CSS -- Firefox Developer Tools External Resources A list of CSS Shapes resources CSS Shapes 101 Creating non-rectangular layouts with CSS Shapes How To Use CSS Shapes In Your Web Design How To Get Started With CSS Shapes What I Learned In One Weekend With CSS Shapes CSS vs. SVG: Shapes and Arbitrarily...
...efox Developer Tools External Resources A list of CSS Shapes resources CSS Shapes 101 Creating non-rectangular layouts with CSS Shapes How To Use CSS Shapes In Your Web Design How To Get Started With CSS Shapes What I Learned In One Weekend With CSS Shapes CSS vs. ...
CSS data types - CSS: Cascading Style Sheets
Web › CSS › CSS Types
CSS data types define typical values (including keywords and units) accepted by CSS properties and functions. They are a special kind of component value type. In formal syntax, data types are denoted by a keyword placed between the inequality signs "<" and ">". ...
... CSS data types define typical values (including keywords and units) accepted by CSS properties and functions. They are a special kind of component value type. In formal syntax, data types are denoted by a keyword placed between the inequality signs "<" and ">". ...
...ent> <ident> <image> <integer> <length> <length-percentage> <number> <number-percentage> <percentage> <position> <quote> <ratio> <resolution> <shape-box> <shape-radius> <string> <time> <time-percentage> <timing-function> <toggle-value> <transform-function> <type-or-unit> <url> <url-modifier> <zero> Specifications Specification Status Comment CSS Values and Units Module Level 4 Editor's Draft CSS Values and Units Module Level 3 Candidate Recommendation Initial definition. See Also CSS Units and Values Introduction to CSS: Values and Units ...
CSS Custom Properties for Cascading Variables - CSS: Cascading Style Sheets
CSS Custom Properties for Cascading Variables is a CSS module that allows for the creation of custom properties that can be used over and over. ...
... CSS Custom Properties for Cascading Variables is a CSS module that allows for the creation of custom properties that can be used over and over. ...
... CSS Custom Properties for Cascading Variables is a CSS module that allows for the creation of custom properties that can be used over and over. ...
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. ...
...n 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. 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'...
... ...
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. 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. ...
...f 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. #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...
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. ...
...cified 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. 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...
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. ...
...leDeclaration.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. 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. ...
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. 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...
...le 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 Specification Status Comment CSS Object Model (CSSOM)The definition of 'CSSStyleSheet.cssRules' in that specification. Working Draft ...
Custom properties (--*): CSS variables - CSS: Cascading Style Sheets
Web › CSS › --*
d as a separate custom property to --My-color. ...
... Candidate Recommendation Initial definition. ...
Introduction to the CSS basic box model - CSS: Cascading Style Sheets
Every box is composed of four parts (or areas), defined by their respective edges: the content edge, padding edge, border edge, and margin edge. The content area, bounded by the content edge, contains the "real" content of the element, such as text, an image, or a video player. Its dimensions are the content width (or content-box width) and the content height (or content-box height). ...
...operty is set to border-box, the border area's size can be explicitly defined with the width, min-width, max-width, height, min-height, and max-height properties. When there is a background (background-color or background-image) set on a box, it extends to the outer edge of the border (i.e. extends underneath the border in z-ordering). This default behavior can be altered with the background-clip css property. The margin area, bounded by the margin edge, extends the border area to include an empty area used to separate the element from its neighbors. Its dimensions are the margin-box width and the margin-box height. The size of the margin area is determined by the margin-top, margin-right, margin-bottom, margin-left, and shorthand margin properties. When margin collapsing occurs, the margin...
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. ...
... 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. ...
CSS Device Adaptation - CSS: Cascading Style Sheets
CSS Device Adaptation is a module of CSS that lets you define the size, zoom factor, and orientation of the viewport. ...
... CSS Device Adaptation is a module of CSS that lets you define the size, zoom factor, and orientation of the viewport. ...
CSS Generated Content - CSS: Cascading Style Sheets
CSS Generated Content is a module of CSS that defines how to add content to an element. Generated content can be used to add content to anonymous replaced elements or replace the content of a DOM node in very limited circumstances with a generated value. See the how to guide for generated content to learn more, and the content and quotes properties for implementation information. ...
...nt can be used to add content to anonymous replaced elements or replace the content of a DOM node in very limited circumstances with a generated value. See the how to guide for generated content to learn more, and the content and quotes properties for implementation information. Reference Properties content quotes Specifications Specification Status Comment CSS Generated Content Module Level 3 Working Draft CSS Level 2 (Revision 1) Recommendation Initial definition ...
Line-based placement with CSS Grid - CSS: Cascading Style Sheets
/ 1 / 4 / 2; } .box2 { grid-area: 1 / 3 / 3 / 4; } .box3 { grid-area: 1 / 2 / 2 / 3; } .box4 { grid-area: 3 / 2 / 4 / 4; } This order of values for grid-area can seem a little strange, it is the opposite of the direction in which we specify margins and padding as a shorthand for example. It may help to realize that this is due to grid using the flow-relative directions defined in the CSS Writing Modes specification. We will explore how grids work with writing modes in a later article however we have the concept of four flow-relative directions: block-start block-end inline-start inline-end We are working in English, a left-to-right language. Our block-start is the top row line of the grid container, block-end the final row line of the container. Our inline-start is the le...
...These specify a gap that acts much like the column-gap property in multi-column layout. Note: When grid first shipped in browsers the column-gap, row-gap and gap properties were prefixed with the grid- prefix as grid-column-gap, grid-row-gap and grid-gap res...
CSS Namespaces - CSS: Cascading Style Sheets
CSS Namespaces is a CSS module that allows authors to specify XML namespaces in CSS. ...
... CSS Namespaces is a CSS module that allows authors to specify XML namespaces in CSS. ...
CSS Ruby Layout - CSS: Cascading Style Sheets
Web › CSS › CSS Ruby
CSS Ruby Layout is a module of CSS that provides the rendering model and formatting controls related to the display of ruby annotation. Ruby annotation is a form of interlinear annotation, consisting of short runs of text alongside the base text. They are typically used in East Asian documents to indicate pronunciation or to provide a short annotation. ...
...controls related to the display of ruby annotation. ...
CSS selectors - CSS: Cascading Style Sheets
Note: There are no selectors or combinators to select parent items, siblings of parents, or children of parent siblings. Basic selectors Universal selector Selects all elements. Optionally, it may be restricted to a specific namespace or to all namespaces. Syntax: * ns|* *|* Example: * will match all the elements of the document. Type selector Selects all elements that have the given node name. Syntax: elementname Example: input will match any <input> element. Class selector Selects all elements that have the given class attribute. Syntax: .classname Example: .index will match any element that has a class of "index". ID selector Selects an element based on the value of its id attribute. ...
... logical combinators, location, time-demensional, resource state, linguistic and UI pseudo-classes, modifier for ASCII case-sensitive and case-insensitive attribute value selection. Selectors Level 3 Recommendation Added the ~ general sibling combinator and tree-structural pseudo-classes. Made pseudo-elements use a :: double-colon prefix. Additional attribute selectors CSS Level 2 (Revision 1) Recommendation Added the > child and + adjacent sibling combinators. Added the universal and attribute selectors. CSS Level 1 Recommendation Initial definition. See the pseudo-class and pseudo-element specification tables for details on those. ...
CSS Table - CSS: Cascading Style Sheets
Web › CSS › CSS Table
CSS Table is a CSS module that defines how to lay out table data. ...
... CSS Table is a CSS module that defines how to lay out table data. ...
CSS Text - CSS: Cascading Style Sheets
Web › CSS › CSS Text
CSS Text is a module of CSS that defines how to perform text manipulation, like line breaking, justification and alignment, white space handling, and text transformation. Reference Properties hanging-punctuation hyphens letter-spacing line-break overflow-wrap tab-size text-align text-align-last text-indent text-justify text-size-adjust text-transform white-space word-break word-spacing Specifications Specification Status Comment CSS Logical Properties and Values Level 1 Editor's Draft Updates some properties to be independent of the directionality of the text. ...
...-spacing line-break overflow-wrap tab-size text-align text-align-last text-indent text-justify text-size-adjust text-transform white-space word-break word-spacing Specifications Specification Status Comment CSS Logical Properties and Values Level 1 Editor's Draft Updates some properties to be independent of the directionality of the text. CSS Text Module Level 3 Working Draft CSS Level 2 (Revision 1) Recommendation CSS Level 1 Recommendation Initial definition ...
CSS Text Decoration - CSS: Cascading Style Sheets
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. ...
...e users often depend on the underline to denote hyperlinks.</p> <p class="underover">This text has lines above <em>and</em> below it.</p> <p class="thick">This text has a really thick purple underline in supporting browsers.</p> <p class="blink">This text might blink for you, depending on the browser you use.</p> Specifications Specification Status Comment CSS Text Decoration Module Level 4 Working Draft CSS Text Decoration Module Level 3 Candidate Recommendation CSS Level 2 (Revision 1) Recommendation CSS Level 1 Recommendation Initial definition ...
Microsoft CSS extensions - CSS: Cascading Style Sheets
These extensions are prefixed with -ms-. Microsoft-only properties (avoid using on websites) Note: These properties will only work in Microsoft applications, and are not on a standards track. ...
...-snap-y -ms-scroll-translation -ms-text-autospace -ms-touch-select -ms-wrap-flow -ms-wrap-margin -ms-wrap-through zoom Pseudo-elements ::-ms-browse ::-ms-check ::-ms-clear ::-ms-expand ::-ms-fill ::-ms-fill-lower ::-ms-fill-upper ::-ms-reveal ::-ms-thumb ::-ms-ticks-after ::-ms-ticks-before ::-ms-tooltip ::-ms-track ::-ms-value Media features -ms-high-contrast CSS-related DOM APIs msContentZoomFactor msGetPropertyEnabled msGetRegionContent MSRangeCollection msRegionOverflow ...
Mozilla CSS extensions - CSS: Cascading Style Sheets
These extensions are prefixed with -moz-. Mozilla-only properties and pseudo-classes (avoid using on websites) Note: These properties and pseudo-classes will only work in Mozilla applications such as Firefox, and are not on a standards track. Some of them apply only to XUL elements. ...
...Once a given property is standardized and implemented without the prefix, the prefixed version is typically dropped after a while. A -moz-animation [Prefixed version still accepted] -moz-animation-delay [Prefixed version still accepted] -moz-animation-direction [Prefixed version still ...
WebKit CSS extensions - CSS: Cascading Style Sheets
These extensions are generally prefixed with -webkit-. Most -webkit- prefixed properties also work with 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. ...
...ks to the new synax. Old prefixed syntax is still supported in some browsers. WebKit-prefixed properties on the standards track -webkit-appearance -webkit-font-size-delta -webkit-mask-composite -webkit-mask-position-x -webkit-mask-position-y -webkit-mask-repeat-x -webkit-mask-repeat-y Formerly proprietary properties that are now standard Note: To maximize the compatibility of your CSS, you should use the unprefixed standard properties instead of the prefixed ones listed below. A -webkit-align-content -webkit-align-items -webkit-align-self -webkit-animation -webkit-animation-delay -webkit-animation-direction -webkit-animation-duration -webkit-animation-fill-mode -webkit-animation-iteration-count -webkit-animation-name -webkit-animation-play-state -webkit-animat...
CSS Object Model (CSSOM) - MDN Web Docs Glossary: Definitions of Web-related terms
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 the Document Object Model (DOM). Both of them are part of the critical rendering path which is a series 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 wor...
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 ...
CSSUnitValue.CSSUnitValue() - Web APIs
The CSSUnitValue() constructor creates a new CSSUnitValue object which returns a new CSSUnitValue object which represents values that contain a single unit type. For example, "42px" would be represented by a CSSNumericValue. Syntax var CSSUnitValue = new CSSUnitValue() Parameters value Returns a double indicating the number of units. unit Returns a USVString indicating the type of unit. Examples The following shows a method of creating a CSSPositionValue from individual CSSUnitValue constructors. let pos = new CSSPositionValue( new CSSUnitValue(5, "px"), new CSSUnitValue(10, "px")); Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'CSSUnitValue' in that specification. Working Draft Initial definition. ...
CSSUnparsedValue.CSSUnparsedValue() - Web APIs
The CSSUnparsedValue() constructor creates a new CSSUnparsedValue object which represents property values that reference custom properties. Syntax var CSSUnparsedValue = new CSSUnparsedValue(members) Parameters members An array whose values must be either a USVString or a CSSVariableReferenceValue. Examples let value = new CSSUnparsedValue( ['4deg'] ), values = new CSSUnparsedValue( ['1em', '#445566', '-45px'] ); console.log( value ); // CSSUnparsedValue {0: "4deg", length: 1} console.log( values ); // CSSUnparsedValue {0: "1em", 1: "#445566", 2: "-45px", length: 3} Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'CSSUnparsedValue' in that specification. Working Draft Initial definition. ...
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 ...
CSSOM View - CSS: Cascading Style Sheets
CSSOM View is a module of CSS that lets you manipulate the visual view of a document, in particular its scrolling behavior. Reference Properties scroll-behavior Guides Coordinate systems A guide to the coordinate systems used to specify the position of a location in a display context, whether that context is a window on a monitor, a viewport on a mobile device, or a position on a sheet of paper when printing. Specifications Specification Status Comment CSS Object Model (CSSOM) View Module Working Draft Initial definition. ...
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 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. ...
CSS Flow Layout - CSS: Cascading Style Sheets
er are Block Level, displaying one under the other. The first sentence also includes a span element with a blue background. This is inline level and therefore displays in place in the sentence. Guides Block and Inline Layout in Normal Flow In Flow and Out of Flow Formatting Contexts Explained Flow Layout and Writing Modes Flow Layout and Overflow Reference Glossary Entries Block (CSS) ...
CSS Fragmentation - CSS: Cascading Style Sheets
CSS Fragmentation is a module of CSS that defines how content is displayed when it is broken (fragmented) across multiple pages, regions, or columns. Fragmentation occurs when an inline box wraps onto multiple lines. It also occurs when a block spans more than one column inside a column layout container, or spans a page break when printed. Each piece of the rendering for the element is called a fragment. Reference box-decoration-break break-after break-before break-inside orphans widows Specifications Specification Status Comment CSS Fragmentation Module Level 3 Candidate Recommendation Initial definition. ...
CSS Masking - CSS: Cascading Style Sheets
CSS Masking is a CSS module that defines means, including masking and clipping, for partially or fully hiding portions of visual elements. Reference Properties clip clip-path clip-rule mask mask-border mask-border-mode mask-border-outset mask-border-repeat mask-border-slice mask-border-source mask-border-width mask-clip mask-composite mask-image mask-mode mask-origin mask-position mask-repeat mask-size mask-type Specifications Specification Status Comment CSS Masking Module Level 1 Candidate Recommendation Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'mask' in that specification. Recommendation Initial definition ...
CSS Miscellaneous - CSS: Cascading Style Sheets
Reference Properties all text-rendering Guides None. Specifications These properties are mostly unrelated to each other. ...
CSS Motion Path - CSS: Cascading Style Sheets
The idea is that when you want to animate an element moving along a path, you previously only had animating translation, position, etc. at your disposal, which wasn't ideal and only allowed for simple movements. With offset-path you can define a specific path of any shape you want. You then animate it along that path by animating offset-distance, and can choose to rotate it at any point using offset-rotate. ...
Basic concepts of CSS Scroll Snap - CSS: Cascading Style Sheets
This can be helpful in creating a more app-like experience on mobile or even on the desktop for some types of applications. Basics of Scroll Snap The key properties of the Scroll Snap specification are scroll-snap-type and scroll-snap-align. The scroll-snap-type property is used on the scroll container to state the type and direction of scrolling. The scroll-snap-align property must be used on child elements in order to set the position that scrolling will snap to. The below example demonstrates scroll snapping along the y axis, with scroll-snap-align used on the section element to dictate the point the scrolling should stop. ...
CSS Transforms - CSS: Cascading Style Sheets
CSS Transforms is a module of CSS that defines how elements styled with CSS can be transformed in two-dimensional or three-dimensional space. Reference Properties backface-visibility perspective perspective-origin rotate scale transform transform-box transform-origin transform-style translate Data types <transform-function> Guides Using CSS transforms Step-by-step tutorial about how to transform elements styled with CSS. Specifications Specification Status Comment CSS Transforms Level 1 Working Draft Initial definition. CSS Transforms Level 2 Editor's Draft Adds individual transforms. ...
CSS Transitions - CSS: Cascading Style Sheets
CSS Transitions is a module of CSS that lets you create gradual transitions between the values of specific CSS properties. The behavior of these transitions can be controlled by specifying their timing function, duration, and other attributes. Reference Properties transition transition-delay transition-duration transition-property transition-timing-function Guides Using CSS transitions Step-by-step tutorial about how to create transitions using CSS. This article describes each relevant CSS property and explains how they interact with each other. Specifications Specification Status Comment CSS Transitions Working Draft Initial definition. ...
Animatable CSS properties - CSS: Cascading Style Sheets
Animation means that their values can be made to change gradually over a given amount of time. ...
CSS3 - Archive of obsolete content
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. 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. ...
...Each of these modules is now an independent part of the language and moves towards standardization at its own pace. ...
...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. In order to accelerate the standardization of non-problematic features, the CSS Working Group of the W3C, in a decision referred as the Beijing doctrine, divided CSS in smaller components called modules . Each of these modules is now an independent part of the language and moves towards standardization at its own pace. While some modules are already W3C Recommendations, other still are early Working Drafts. New modules are also added when new needs are identified. Formally, there is no CSS3 standard per se . Each module being standardized independently, th...
...And 78 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...
...oduction 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 element const myElement = document.querySelector('a'); // get the <dl> we'll be populating const stylesList = document...
....querySelector('a'); // get the <dl> we'll be populating const stylesList = document.querySelector('#regurgitation'); // Retrieve all computed styles with computedStyleMap() const defaultComputedStyles = myElement.computedStyleMap(); // iterate thru the map of all the properties and values, adding a <dt> and <dd> for each for (const [prop, val] of defaultComputedStyles) { // properties const cssProperty = document.createElement('dt'); cssProperty.appendChild(document.createTextNode(prop)); stylesList.appendChild(cssProperty); // values const cssValue = document.createElement('dd'); cssValue.appendChild(document.createTextNode(val)); stylesList.appendChild(cssValue); } The computedStyleMap() method returns a StylePropertyMapReadOnly object containing the size property, which indic...
...And 56 more matches
How CSS is structured - Learn web development
Previous Overview: First steps Next Now that you are beginning to understanding the purpose and use of CSS, let's examine the 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. 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. ...
...rking 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. ...
...line 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 44 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. ...
...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. 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 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...
...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 get to set the rules for the project or are working alone, then the most important thing to do is to keep things consistent. ...
...And 38 more matches
Handling common HTML and CSS problems - Learn web development
Previous Overview: Cross browser testing Next With the scene set, we'll now look specifically at the common cross-browser problems you will come across in HTML and CSS code, and what tools can be used to prevent problems from happening, or fix problems that occur. This includes linting code, handling CSS prefixes, using browser dev tools to track down problems, using polyfills to add support into browsers, tackling responsive design problems, and more. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages; an idea of the high level principles of cross browser testing. ...
...ludes linting code, handling CSS prefixes, using browser dev tools to track down problems, using polyfills to add support into browsers, tackling responsive design problems, and more. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages; an idea of the high level principles of cross browser testing. Objective: To be able to diagnose common HTML and CSS cross browser problems, and use appropriate tools and techniques to fix 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 wor...
...ch 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 the content is too small to read, or perhaps the site is slow because of expensive animations. Let's go forth and look at how we can reduce cross browser errors that result from HTML/CSS. ...
...And 35 more matches
CSS - Archive of obsolete content
Archive › Web › CSS
Normally,...
...Normally,...
...Normally,...
...And 34 more matches
The Firefox codebase: CSS Guidelines
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 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. ...
...mbers; 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. ...
...And 26 more matches
CSS numeric factory functions - Web APIs
The CSS numeric factory functions, such as CSS.em() and CSS.turn() are methods that return CSSUnitValues with the value being the numeric argument and the unit being the name of the method used. These functions create new numeric values less verbosely than using the CSSUnitValue.CSSUnitValue() constructor. ...
... The CSS numeric factory functions, such as CSS.em() and CSS.turn() are methods that return CSSUnitValues with the value being the numeric argument and the unit being the name of the method used. These functions create new numeric values less verbosely than using the CSSUnitValue.CSSUnitValue() constructor. ...
... The CSS numeric factory functions, such as CSS.em() and CSS.turn() are methods that return CSSUnitValues with the value being the numeric argument and the unit being the name of the method used. These functions create new numeric values less verbosely than using the CSSUnitValue.CSSUnitValue() constructor. ...
...And 24 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 second parameter is the class that does all the magic, defining the context options and what to paint to the two-dimensional canvas that will be our image. ...
...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 from the top of the content box. We can use the CSS background-size and background-position properties to re-size or relocate this background image, but this is the default size and placement of the yellow box we created in our paint worklet. We tried to keep the example simple. For more options, look at the canvas documentation. We also add a little bit of complexity later in this tutorial. Using the paint worklet To use the paint worklet, we ...
...And 24 more matches
CSSPrimitiveValue - Web APIs
Conversions are allowed between absolute values (from millimeters to centimeters, from degrees to radians, and so on) but not between relative values. ...
... Conversions are allowed between absolute values (from millimeters to centimeters, from degrees to radians, and so on) but not between relative values. ...
... Conversions are allowed between absolute values (from millimeters to centimeters, from degrees to radians, and so on) but not between relative values. ...
...And 21 more matches
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. ...
...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. ...
...nt's originating element is returned. /* Simple usage */ attr(data-count); attr(title); /* With type */ attr(src url); attr(data-count number); attr(data-width px); /* With fallback */ attr(data-count number, 0); attr(src url, ""); attr(data-width px, inherit); attr(data-something, "default"); Syntax Values attribute-name Is the name of an attribute on the HTML element referenced in the CSS. <type-or-unit> Is a keyword representing either the type of the attribute's value, or its unit, as in HTML some attributes have implicit units. If the use of <type-or-unit> as a value for the given attribute is invalid, the attr() expression will be invalid too. If omitted, it defaults to string. The list of valid values are: Keyword Associated type Comment Default v...
...And 21 more matches
font - CSS: Cascading Style Sheets
Web › CSS › font
The font CSS shorthand property sets all the different properties of an element's font. Alternatively, it sets an element's font to a system 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. As with any shorthand property, any individual value 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. ...
...equest. As with any shorthand property, any individual value 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...
... <'font-stretch...
...And 21 more matches
Debugging CSS - Learn web development
Previous Overview: Building blocks Next Sometimes when writing CSS you will encounter an issue where your CSS doesn't seem to be doing what you expect. Perhaps you believe that a certain selector should match an element, but nothing happens, or a box is a different size than you expected. 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 to find out what is going on. ...
...a different size than you expected. 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 to find out what is going 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 the basics of what browser DevTools are, and how to do simple inspection and editing of CSS. How to access browser DevTools The article What are browser developer tools is an up-to-date guide explaining how to access the tools in various browsers and platforms. While you may choose to mostly develop in a particular browser, an...
... therefore will become most familiar with the tools included in that browser, it is worth knowing how to access them in other browsers. This will help if you are seeing different rendering between multiple browsers. You will also find that browsers have chosen to focus on different areas when creating their DevTools. For example in Firefox there are some excellent tools for working visually with CSS Layout, allowing you to inspect and edit Grid Layouts, Flexbox, and Shapes. However, all of the different browsers have similar fundamental tools, e.g. for inspecting the properties and values applied to elements on your page, and making changes to them from the editor. In this lesson we will look at some useful features of the Firefox DevTools for working with CSS. In order to do so I'll be usi...
...And 20 more matches
Box-shadow generator - CSS: Cascading Style Sheets
This tool lets you construct CSS box-shadow effects, to add box shadow effects to your CSS objects. box-shadow generator HTML Content <div id="container"> <div class="group section"> <div id="layer_manager"> <div class="group section"> <div class="button" data-type="add"> </div> <div class="button" data-type="move-up"> </div> <div class="button" data-type="move-down"> </div> </div> <div id="stack_container"></div> </div> <div id="preview_zone"> <div id="layer_menu" class="col span_12"> <div class="button" id="element" data-type="subject" data-title="element"> element </div> <div class="button" id="before" data-type="subject" d...
... <div class="ui-slider-btn-set" 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" ...
...m"> </div> <div class="output" data-topic="after" data-name="element:after" data-prop="content=[&quot;&quot;] position=[absolute] width height top left z-index background-color box-shadow transform -webkit-transform -ms-transform"> </div> </div> </div> </div> </div> </div> CSS Content /* GRID OF TWELVE * ========================================================================== */ .span_12 { width: 100%; } .span_11 { width: 91.46%; } .span_10 { width: 83%; } .span_9 { width: 74.54%; } .span_8 { width: 66.08%; } .span_7 { width: 57.62%; } .span_6 { width: 49.16%; } .span_5 { width: 40.7%; } .span_4 { width: 32.24%; } .span_3 { width: 23.78%; } .s...
...And 19 more matches
CSS values and units - Learn web development
Previous Overview: Building blocks Next Every property used in CSS has a value or set of values that are allowed for that property, and taking a look at any property page on MDN will help you understand the values that are valid for any particular property. In this lesson we will take a look at some of the most common values and units in use. 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 different types of values and units used in CSS properties. ...
...ll take a look at some of the most common values and units in use. 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 different types of values and units used in CSS properties. ...
...at some of the most common values and units in use. 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 different types of values and units used in CSS properties. What is a CSS value? In CSS specifications and on the property pages here on MDN you will be able to spot values as they will be surrounded by angle brackets, such as <color> or <length>. When you see the value <color> as valid for a particular property, that means you can use any valid color as a value for that property, as listed on the <color> reference page. Note: You'll also see CSS values referred to as data types. ...
...And 17 more matches
Getting started with CSS - Learn web development
Previous Overview: First steps Next 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. 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 linking a CSS document to an HTML file, and be able to do simple text formatting with CSS. Starting with some HTML Our starting point is an HTML document. You can copy the code from below if you want to work on your own computer. ...
...In the text is a <span>span element</span> and also a <a href="http://example.com">link</a>.</p> <p>This is the second paragraph. ...
...It contains an <em>emphasized</em> element.</p> <ul> <li>Item one</li> <li>Item two</li> <li>Item <em>three</em></li> </ul> </body> </html> Note: If you are reading this on a device or an environment where you can't easily create files, then don't worry -- live code editors are provided below to allow you to write example code right here in the page. Adding CSS to our document The 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 doc...
...And 17 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. ...
... 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, 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 constan...
...entRule 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's type property to discern the rule type (and therefore, which specialized interface it implements). ...
...And 17 more matches
Variable fonts guide - CSS: Cascading Style Sheets
This article will give you all you need to know to get you started using variable fonts. ...
...(off or on). As defined in the specification, there are two kinds of axes: registered and custom: Registered axes are simply those that are most frequently encountered, and common enough that the authors of the specification felt it was worth standardizing. The five currently registered axes are weight, width, slant, italic, and optical size. ...
...Where possible, both the standard and lower-level syntax are included. ...
...And 17 more matches
<color> - CSS: Cascading Style Sheets
Syntax The <color> data type is specified using one of the options listed below. ...
...: Using a keyword (such as blue or transparent) Using the RGB cubic-coordinate system (via the #-hexadecimal or the rgb() and rgba() functional notations) Using the HSL cylindrical-coordinate system (via the hsl() and hsla() functional notations) Note: This article describes the <color> data type in detail. To learn more about using color in HTML, see Applying color to HTML elements using CSS. Syntax The <color> data type is specified using one of the options listed below. Note: Although <color> values are precisely defined, their actual appearance may vary (sometimes significantly) from device to device. This is because most devices are not calibrated, and some browsers do not support output devices' color profiles. Color keywords Color keywords are case-insensitive identifie...
...Color keywords are case-insensitive identifiers that represent a specific color, such as red, blue, black, or lightseagreen. Although the names more or less describes their respective colors, they are essentially artificial, without a strict rationale behind the names used. There are a few caveats to consider when using color keywords: HTML only recognizes the 16 basic color keywords found in CSS1, using a specific algorithm to convert unrecognized values (often to completely different colors). The other color keywords should only be used in CSS and SVG. Unlike HTML, CSS will completely ignore unknown keywords. The color keywords all represent plain, solid colors, without transparency. Several keywords are aliases for each other: aqua / cyan fuchsia / magenta darkgray / dar...
...And 17 more matches
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
The use of color is a fundamental form of human expression. Children experiment with color before they even have the manual dexterity to draw. Maybe that's why color is one of the first things people often want to experiment with when learning to develop websites. 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. ...
...We'll also take a look at how to let the user pick a color. ...
...f 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 terms of the kinds of things that are drawn in the elements, such as text and borders and so forth. For each, we'll see a list of the CSS properties that apply color to them. At a fundamental level, the color property defines the foreground color of an HTML element's content and the background-color property defines the element's background color. These can be used on just about any element. Text Whenever an element is rendered, these properties are used to determine the color of the text, its background, and any decorations on ...
...And 17 more matches
Linear-gradient Generator - CSS: Cascading Style Sheets
kground </div> <div id="canvas-bg"></div> <div id="add-axis" class="button"> add line </div> </div> <div id="order"> <div id="gradient-axes"></div> <div id="gradient-order"></div> </div> </div> </div> <div id="output"> <div class="css-property"> <span class="property">background:</span> <span class="value"></span> </div> </div> </div> CSS Content /* * COLOR PICKER TOOL */ .ui-color-picker { width: 420px; margin: 0; border: 1px solid #DDD; background-color: #FFF; display: table; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-s...
...'images/arrow.svg'); background-size: 24px 24px; position: absolute; right: -10px; top: -9.5px; } /** * Output */ #output { width: 100%; padding: 10px 0; margin: 20px 0 50px 0; border: 2px dashed #CCC; border-radius: 5px; display: table; font-size: 13px; overflow: hidden; -moz-user-select: text; -webkit-user-select: text; -ms-user-select: text; user-select: text; } #output .css-property { width: 90%; margin: 5px 5%; color: #777; position: relative; float: left; } #output .property { height: 100%; width: 12%; position: absolute; left: 0; } #output .value { width: 88%; position: absolute; white-space: pre; word-wrap: break-word; display: block; right: 0; } JavaScript Content var UIColorPicker = (function UIColorPicker() { 'use strict'; function g...
...ener('mousedown', resizeStart); elem.appendChild(handle); }; return { makeResizable : makeResizable }; })(); /** * Gradient Point */ var GradientPoint = function GradientPoint(Axis) { var point = document.createElement('div'); point.className = 'gradient-point'; this.position = 0; this.node = point; this.Axis = Axis; this.color = new HSVColor(0, 0, 100); this.CSScolor = this.color.getColor(); this.CSSposition = 0; this.PrevPoint = null; this.NextPoint = null; this.Axis.num_points++; point.addEventListener('click', this.activate.bind(this)); trackMouse(point, this.updatePositionM.bind(this), this.startMove.bind(this), this.endMove.bind(this)); Axis.line.appendChild(point); return this; }; GradientPoint.prototype.deletePoint = funct...
...And 16 more matches
What is CSS? - Learn web development
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. ...
... 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. ...
...pace 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/default styles, check out the following video: What is CSS for? As we have mentioned before, CSS is a language for specifying how documents are presented to users -- how they are styled, laid out, etc. A document is usually a text file structured using a ...
...And 15 more matches
CSS Typed Object Model API - Web APIs
This is easier for authors (for example, numeric values are reflected with actual JS numbers, and have unit-aware mathematical operations defined for them). ...
...This is easier for authors (for example, numeric values are reflected with actual JS numbers, and have unit-aware mathematical operations defined for them). ...
...This is easier for authors (for example, numeric values are reflected with actual JS numbers, and have unit-aware mathematical operations defined for them). ...
...And 15 more matches
@font-feature-values - CSS: Cascading Style Sheets
Syntax Feature value blocks @swash Specifies a feature name that will work with the swash() functional notation of font-variant-alternates. A swash feature value definition allows only one value: ident1: 2 is valid, but ident2: 2 4 isn't. @annotation Specifies a feature name that will work with the annotation() functional notation of font-variant-alternates. ...
..." 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); } Specifications Specification Status Comment CSS Fonts Module Level 4The definition of '@font-feature-values' in that specification. Working Draft 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://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet Exp...
...To change preferences in Firefox, visit about:config.IE No support NoOpera No support NoSafari Full support 9.1WebView Android No support NoChrome Android ...
...And 15 more matches
Cross-browser Flexbox mixins - CSS: Cascading Style Sheets
with flexbox using the native support of current browsers. This set uses: Fallbacks using 2009 'box' syntax (FF and Older WebKit) and prefixed syntaxes (IE10, WebKit browsers without flex wrapping) Final standards syntax (FF, Safari, Chrome, IE11+, Edge, Opera) This was inspired by: http://dev.opera.com/articles/view/advanced-cross-browser-flexbox/ With help from: http://w3.org/tr/css3-flexbox/ http://the-echoplex.net/flexyboxes/ http://msdn.microsoft.com/en-us/library/ie/hh772069(v=vs.85).aspx http://css-tricks.com/using-flexbox/ A Complete Guide to Flexbox | CSS-Tricks Visual Guide to CSS3 Flexbox: Flexbox Playground | Note: Mixins are not currently supported natively in browsers. Instead, you will need to use a CSS pre-processor to make the most of the following. How...
...box/ http://the-echoplex.net/flexyboxes/ http://msdn.microsoft.com/en-us/library/ie/hh772069(v=vs.85).aspx http://css-tricks.com/using-flexbox/ A Complete Guide to Flexbox | CSS-Tricks Visual Guide to CSS3 Flexbox: Flexbox Playground | Note: Mixins are not currently supported natively in browsers. Instead, you will need to use a CSS pre-processor to make the most of the following. However, CSS pre-processors simply generate valid CSS, so the techniques used below can be written in pure CSS instead, if preferred. Flexbox containers Using the display property's flex value causes an element to generate a block-level flex container box. The inline-flex value causes an element to generate an inline-level flex container box. Values: flex | inline-flex Spec: https://drafts.csswg.org/css...
...ne-flexbox; display: inline-flex; } %inline-flex { @include inline-flex; } Flexbox direction The flex-direction property specifies how flex items are placed in the flex container, by setting the direction of the flex container's main axis. This determines the direction in which flex items are laid out in. ...
...And 15 more matches
CSS: Cascading Style Sheets
Web › CSS
Cascading Style Sheets (CSS) is a stylesheet language used to describe the presentation of a document written in HTML or XML (including XML dialects such as SVG, MathML or XHTML). 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. ...
...r, 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. From CSS3, the scope of the specification increased significantly and the progress on different CSS modules started to differ so much, that it became more effective to develop and release recommendations separately per module. Instead of versioning the CSS specification, W3C now periodically takes a snapshot of the latest stable state of the CSS specification. ...
...ver become an official version. From CSS3, the scope of the specification increased significantly and the progress on different CSS modules started to differ so much, that it became more effective to develop and release recommendations separately per module. Instead of versioning the CSS specification, W3C now periodically takes a snapshot of the latest stable state of the CSS specification. CSS Introduction If you're new to web development, be sure to read our CSS basics article to learn what CSS is and how to use it. CSS Tutorials Our CSS learning area contains a wealth of tutorials to take you from beginner level to proficiency, covering all the fundamentals. ...
...And 13 more matches
Use CSS to solve common problems - Learn web development
Learn › CSS › Howto
The following links provide solutions to common problems you may face when working with CSS. ...
... The following links provide solutions to common problems you may face when working with CSS. ...
... The following links provide solutions to common problems you may face when working with CSS. ...
...And 12 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? 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 style...
...Otherwise, the styling won't change the appearance of the HTML. (If you haven't been following our project, pause here to read Dealing with files and HTML basics.) Open your index.html file. ...
... named styles. To make the code work, we still need to apply this CSS (above) to your HTML document. Otherwise, the styling won't change the appearance of the HTML. (If you haven't been following our project, pause here to read Dealing with files and HTML basics.) Open your index.html file. Paste the following line in the head (between the <head> and </head> tags): <link href="styles/style.css" rel="stylesheet"> Save index.html and load it in your browser. 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. (The term ruleset is often referred to as just rule.) Note the names of the...
...And 12 more matches
@supports - CSS: Cascading Style Sheets
Web › CSS › @supports
Syntax The @supports at-rule associates a block of statements with a supports condition. The supports condition consists of one or more name-value pairs combined by conjunctions (and), disjunctions (or), and/or negations (not). Precedence of operators can be defined with parentheses. ...
... Syntax The @supports at-rule associates a block of statements with a supports condition. The supports condition consists of one or more name-value pairs combined by conjunctions (and), disjunctions (or), and/or negations (not). Precedence of operators can be defined with parentheses. ...
... Syntax The @supports at-rule associates a block of statements with a supports condition. The supports condition consists of one or more name-value pairs combined by conjunctions (and), disjunctions (or), and/or negations (not). Precedence of operators can be defined with parentheses. ...
...And 12 more matches
Using feature queries - CSS: Cascading Style Sheets
Feature queries are created using the CSS at-rule @supports, and are useful as they give web developers a way to test to see if a browser has support for a certain feature, and then provide CSS that will only run based on the result of that test. In this guide you will learn how to implement progressive enhancement using feature queries. Syntax CSS feature queries are part of the CSS Conditional Rules module, which also contains the media query @media rule; when you use feature queries, you will find they behave in a similar way to media queries. The difference is that with a media query you are testing something about the environment in which the web page is running, whereas with feature queries you are testing browser support for CSS features. A feature query consists of the @supports r...
...omething about the environment in which the web page is running, whereas with feature queries you are testing browser support for CSS features. A feature query consists of the @supports rule, followed by the property name and value you would like to test for. You may not test for a bare property name such as display; the rule requires a property name and a value: @supports (property: value) { CSS rules to apply } If you want to check if a browser supports the row-gap property, for example, you would write the following feature query. It doesn't matter which value you use in a lot of cases: if all you want is to check that the browser supports this property, then any valid value will do. The value part of the property value pair matters more if you are testing for new values of a parti...
...ng feature query. It doesn't matter which value you use in a lot of cases: if all you want is to check that the browser supports this property, then any valid value will do. The value part of the property value pair matters more if you are testing for new values of a particular property. A good example would be the display property. All browsers support display, as display: block dates back to CSS1. However the values display: flex and display: grid are newer. There are often additional values added to properties in CSS, and so the fact that you have to test for property and value means that you can detect support for these values. Testing for lack of support In addition to asking the browser if it supports a feature, you can test for the opposite by adding in the not keyword: @supports...
...And 12 more matches
Relationship of flexbox to other layout methods - CSS: Cascading Style Sheets
These modules relate to each other, and are at different stages of development. ...
...These modules relate to each other, and are at different stages of development. ...
...These modules relate to each other, and are at different stages of development. ...
...And 12 more matches
CSS building blocks - Learn web development
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. ...
... first steps left off -- now you've gained familiarity with the language and its syntax, and got some basic experience with using it, its time to dive a bit deeper. This module looks at the cascade and inheritance, all the selector types we have available, units, sizing, styling backgrounds and borders, debugging, and lots more. The aim here is to provide you with a toolkit for writing competent CSS and help you understand all the essential theory, before moving on to more specific disciplines like text styling and CSS layout. 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 co...
... Basic familiarity with using computers, and using the Web passively (i.e. just looking at it, consuming the content.) A basic work environment set up as detailed in Installing basic software, and an understanding of how to create and manage files, as detailed in Dealing with files. Basic familiarity with HTML, as discussed in the Introduction to HTML module. An understanding of the basics of CSS, as discussed in the CSS first steps module. Note: If you are working on a computer/tablet/another 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 cover the most essential parts of the CSS language. Along the way you'l...
...And 11 more matches
Introduction to CSS layout - Learn web development
Overview: CSS layout Next This article will recap some of the CSS layout features we've already touched upon in previous modules -- such as different display values -- and introduce some of the concepts we'll be covering throughout this module. Prerequisites: The basics of HTML (study Introduction to HTML), and an idea of How CSS works (study Introduction to CSS.) Objective: To give you an overview of CSS page layout techniques. Each technique can be learned in greater detail in subsequent tutorials. ...
...s different display values -- and introduce some of the concepts we'll be covering throughout this module. Prerequisites: The basics of HTML (study Introduction to HTML), and an idea of How CSS works (study Introduction to CSS.) Objective: To give you an overview of CSS page layout techniques. Each technique can be learned in greater detail in subsequent tutorials. CSS page layout techniques allow us to take elements contained in a web page and control where they are positioned relative to their default position in normal layout flow, the other elements around them, their parent container, or the main viewport/window. The page layout techniques we'll be covering in more detail in this module are Normal flow The display property Flexbox Grid Floats Posi...
...ontally in any language with a Vertical Writing Mode, such as Japanese. The corresponding Inline Direction is the direction in which inline contents (such as a sentence) would run. For many of the elements on your page the normal flow will create exactly the layout you need, however for more complex layouts you will need to alter this default behavior using some of the tools available to you in CSS. ...
...And 11 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 th...
... what happens. The browser loads the HTML (e.g. receives it from the network). It converts the HTML into a DOM (Document Object Model). The DOM represents the document in the computer's memory. The DOM is explained in a bit more detail in the next section. The browser then fetches most of the resources that are linked to by the HTML document, such as embedded images and videos ... 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 req...
...o offers a simple view of the process. About the DOM A DOM has a tree-like structure. Each element, attribute, and piece of text in the markup language becomes a DOM node in the tree structure. The nodes are defined by their relationship to other DOM nodes. Some elements are parents of child nodes, and child nodes have siblings. Understanding the DOM helps you design, debug and maintain your CSS because the DOM is where your CSS 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. Take the following HTML code: <p> Let's use: ...
...And 11 more matches
CSS FAQ - Learn web development
Learn › CSS › Howto › CSS FAQ
Using a correct and modern DOCTYPE declaration at the start of your HTML will improve browser standards compliance. ...
...Using a correct and modern DOCTYPE declaration at the start of your HTML will improve browser standards compliance. ...
...CTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 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 elemen...
...And 11 more matches
Learn to style HTML using CSS - Learn web development
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 your content, split it into multiple columns, or add animations and other decorative features. Looking to become a front-end web developer? ...
...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? ...
...ns and other decorative features. Looking to become a front-end web developer? ...
...And 11 more matches
CSS property compatibility table for form controls - Learn web development
However, they will give you good insight into what can and can't be done, which will help you learn how to do things. How to read the tables Values For each property, there are four possible values: Yes There's reasonably consistent support for the property across browsers. You may still face strange side effects in certain edge cases. Partial While the property works, you may frequently face strange side effects or inconsistencies. You should probably avoid these properties unless you master those side effects first. ...
... and you should avoid it. text-decoration This property is not supported by Opera on form widgets. text-overflow Opera, Safari, and IE9 do not support this property on form widgets. text-shadow Opera does not support text-shadow on form widgets and IE9 does not support it at all. Text fields See the text, search, and password input types. Property N T Note CSS box model width Yes Yes height Partial[1][2] Yes WebKit browsers (mostly on Mac OSX and iOS) use the native look & feel for the search fields. Therefore, it's required to use -webkit-appearance:none to be able to apply this property to search fields. On Windows 7, Internet Explorer 9 does not apply the border unless background:none is applied. ...
...er 9 does not apply the border unless background:none is applied. 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. Buttons See the button, submit, and reset input types and the <button> element. Property N T Note CSS box model width Yes Yes height Partial[1] Yes This property is not applied on WebKit based browsers on Mac OSX or iOS. border Partial Yes margin Yes Yes padding Partial[1] Yes This property is not applied on WebKit based browsers on Mac OSX or iOS. Text...
...And 11 more matches
display - CSS: Cascading Style Sheets
Web › CSS › display
The display CSS property sets whether an element is treated as a block or inline element and the layout used for its children, such as flow layout, grid or flex. Formally, the display property sets an element's inner and outer display types. The outer type sets an element's participation in flow layout; the inner type sets the layout of children. Some values of display are fully defined in their own individual specifications; for example the detail of what happens when display: flex is declared is defined in the CSS Flexible Box Model specification. See the table at the end of this document for all of the individual specifications. Syntax The CSS display property is specified using keyword values. Keyword values are grouped into six value categories: .container { display: [ <display...
...c> HTML elements generated as anonymous boxes. ruby-text-container These elements behave like <rtc> HTML elements. Box <display-box> These values define whether an element generates display boxes at all. Valid <display-box> values: contents These elements don't produce a specific box by themselves. They are replaced by their pseudo-box and their child boxes. Please note that the CSS Display Level 3 spec defines how the contents value should affect "unusual elements" -- elements that aren't rendered purely by CSS box concepts such as replaced elements. See Appendix B: Effects of display: contents on Unusual Elements for more details. Due to a bug in browsers this will currently remove the element from the accessibility tree -- screen readers will not look at what's inside.
...elow for more details. none Turns off the display of an element so that it has no effect on layout (the document is rendered as though the element did not exist). All descendant elements also have their display turned off. To have an element take up the space that it would normally take, but without actually rendering anything, use the visibility property instead. Legacy <display-legacy> CSS 2 used a single-keyword syntax for the display property, requiring separate keywords for block-level and inline-level variants of the same layout mode. Valid <display-legacy> values: inline-block The element generates a block element box that will be flowed with surrounding content as if it were a single inline box (behaving much like a replaced element would). It is equivalent to inline...
...And 11 more matches
CSS and JavaScript accessibility best practices - Learn web development
Previous Overview: Accessibility Next CSS and JavaScript, when used properly, also have the potential to allow for accessible web experiences ... or they can significantly harm accessibility if misused. This article outlines some CSS and JavaScript best practices that should be considered to ensure even complex content is as accessible as possible. Prerequisites: Basic computer literacy, a basic understanding of HTML, CSS, and JavaScript, and understanding of what accessibility is. Objective: To gain familiarity with using CSS and JavaScript appropriately in your web documents to maximise accessibility and not detract from it. ...
...t should be considered to ensure even complex content is as accessible as possible. Prerequisites: Basic computer literacy, a basic understanding of HTML, CSS, and JavaScript, and understanding of what accessibility is. Objective: To gain familiarity with using CSS and JavaScript appropriately in your web documents to maximise accessibility and not detract from it. CSS and JavaScript are accessible? ...
...n complex content is as accessible as possible. Prerequisites: Basic computer literacy, a basic understanding of HTML, CSS, and JavaScript, and understanding of what accessibility is. Objective: To gain familiarity with using CSS and JavaScript appropriately in your web documents to maximise accessibility and not detract from it. CSS and JavaScript are accessible? CSS and JavaScript don't have the same immediate importance for accessibility as HTML, but they are still able to help or damage accessibility, depending on how they are used. To put it another way, it is important that you consider some best practice advice to make sure that your use of CSS and JavaScript doesn't ruin the accessibility of your documents. CSS Let's start off by looking at CSS. Cor...
...And 10 more matches
Styling Vue components with CSS - Learn web development
Previous Overview: Client-side JavaScript frameworks Next The time has finally come to make our app look a bit nicer. In this article we'll explore the different ways of styling Vue components with CSS. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Vue components are written as a combination of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to the underlying DOM structure. ...
... of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to the underlying DOM structure. For installation, and to use some of the more advanced features of Vue (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...
...vanced 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 the src/assets directory. Files in this folder get processed by Webpack. This means we can use CSS pre-processors (like SCSS) or post-processors (like PostCSS). While this tutorial will not be using such tools, it's good to know that whe...
...And 10 more matches
Adding a new CSS property
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. 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. ...
...ly contain only properties set/reset by a particular common shorthand property; this improves the effectiveness of some of the performance and memory optimizations done with the rule tree, and thus we should avoid adding a property not reset by that shorthand to such a struct. ...
... you're going to use (or that the property is a shorthand), you can add appropriate entry to nsCSSPropList.h. Again, see the documentation at the top of the file and the other entries for examples, and also see the next section for details about parsing. Parsing To start implementing the parsing, first read the Syntax line in the property's specification (whose syntax is in turn defined in the CSS Values and Units specification) and any prose in the specification that adds additional restrictions to that syntax. Every property in nsCSSPropList.h must have in its flags field exactly one of the four CSS_PROPERTY_PARSE_* flags defined in nsCSSProps.h. Given the syntax for the property, you can determine which one to use. If the property's values can be expressed as a single value, or as a ...
...And 10 more matches
CSSMathValue - Web APIs
Event handlers No Methods None. Examples We create an element with a width determined using a calc() function, then console.log() the operator. ...
... Event handlers No Methods None. Examples We create an element with a width determined using a calc() function, then console.log() the operator. ...
... Event handlers No Methods None. Examples We create an element with a width determined using a calc() function, then console.log() the operator. ...
...And 10 more matches
Border-image generator - CSS: Cascading Style Sheets
This tool can be used to generate CSS3 border-image values. Border Image Generator HTML Content <div id="container"> <div id="gallery"> <div id="image-gallery"> <img class="image" src="https://udn.realityripple.com/samples/2c/fa0192d18e.png" data-stateID="border1"/> <img class="image" src="https://udn.realityripple.com/samples/b8/dacdd63e77.png" data-stateID="border2"/> <img class="image" src="https://udn.realityripple.com/samples/07/1fcc357205.png" data-stateID="border3"/> <img class="image" src="https://udn.realityripple.com/samples/7b/dd37c1d691.png" data-stateID="border4"/> <img class="image" src="https://udn.realityripple.com/samples/a9/b9fff72dab.png" data-stateID="border...
... </div> <div class="property"> <div class="ui-input-slider" data-topic="preview-height" data-info="height" data-unit=" px" data-min="10" data-max="10000" data-sensivity="3"> </div> </div> </div> <div id="output" class="category"> <div class="title"> CSS Code </div> <div class="css-property"> <span class="name"> border-image-slice: </span> <span id="out-border-slice" class="value"> </span> </div> <div class="css-property"> <span class="name"> border-image-width: </span> <span id="out-border-width" class="value"> </span> ...
...ty"> <span class="name"> border-image-slice: </span> <span id="out-border-slice" class="value"> </span> </div> <div class="css-property"> <span class="name"> border-image-width: </span> <span id="out-border-width" class="value"> </span> </div> <div class="css-property"> <span class="name"> border-image-outset: </span> <span id="out-border-outset" class="value"> </span> </div> <div class="css-property"> <span class="name"> border-image-repeat: </span> <span id="out-border-repeat" class="value"> </span> </div> <...
...And 10 more matches
Specificity - CSS: Cascading Style Sheets
Specificity is the means by which browsers decide which CSS property values are the most relevant to an element and, therefore, will be applied. Specificity is based on the matching rules which are composed of different sorts of CSS selectors. How is specificity calculated? Specificity is a weight that is applied to a given CSS declaration, determined by the number of each selector type in the matching selector. When multiple declarations have equal specificity, the last declaration found in the CSS is applied to the element. Specificity only applies when the same element is targeted by multiple declarations. As per CSS rules, directly targeted elements will always take precedence over rules which an element inherits from its ancestor. Note: Proximity of elements in the document tree has...
... be avoided because it makes debugging more difficult by breaking the natural cascading in your stylesheets. When two conflicting declarations with the !important rule are applied to the same element, the declaration with a greater specificity will be applied. Some rules of thumb: Always look for a way to use specificity before even considering !important Only use !important on page-specific CSS that overrides foreign CSS (from external libraries, like Bootstrap or normalize.css). Never use !important when you're writing a plugin/mashup. Never use !important on site-wide CSS. Instead of using !important, consider: Make better use of the CSS cascade Use more specific rules. By indicating one or more elements before the element you're selecting, the rule becomes more specific an...
...t 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. #myId#myId span { color: yellow; } .myClass.myClass span { color: orange; } How !important can be used: A) Overriding inline styles Your global CSS file that sets visual aspects of your site globally may be overwritten by inline styles defined directly on individual elements. Both inline styles and !important are considered very bad practice, but sometimes you need the latter to override the former. In this case, you could set certain styles in your global CSS file as !important, thus overriding inline styles set directly on elements. <div...
...And 10 more matches
Viewport concepts - CSS: Cascading Style Sheets
What is a viewport? A viewport represents the area in computer graphics being currently viewed. In web browser terms, it is generally the same as the browser window, excluding the UI, menu bar, etc. That is, the part of the document you are viewing. Documents like this article may be very long. Your viewport is everything that is currently visible, notably, the "what is a viewport section", and perhaps some of the navigation menu. ...
... The Window.outerWidth is the width of the outside of the browser window including all the window chrome. In an experiment with these, the innerWidt...
...dow.innerHeight /* 800 */ window.outerHeight /* 900 */ There are several DOM properties that can help you query viewport size, and other similar lengths: The document element's Element.clientWidth is the inner width of a document in CSS pixels, including padding (but not borders, margins, or vertical scrollbars, if present). This is the viewport width. The Window.innerWidth is the width, in CSS pixels, of the browser window viewport including, if rendered, the vertical scrollbar. The Window.outerWidth is the width of the outside of the browser window including all the window chrome. In an experiment with these, the innerWidth and outerWidth was seen to be the same, but the outerHeight was 100px taller than the innerHeight. This is because the outerHeight includes the browser chrome: ...
...And 10 more matches
Examine and edit CSS - Firefox Developer Tools
You can examine and edit CSS in the Inspector's CSS pane. Examine CSS rules The Rules view lists all the rules that apply to the selected element, ordered from most-specific to least-specific: The four buttons on the right top of the rules view allow you to change the display of certain CSS and rules view features. You can: toggle pseudo-classes; toggle classes; add 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 app...
... this property: next to overridden declarations is an icon you can click to filter the rules list to show only those rules that include that property. See overridden declarations. Enable/disable: if you hover over a declaration, a checkbox appears next to it: you 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. 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...
..."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 properties assigned to the element via its style attribute. This also gets the target icon: , giving you a convenient way to highlight the currently selected element in the page. Filtering rules There's a box at the top of the Rules view labeled "Filter Styles": As you type: any rules which don't contain the typed string at all are hidden any declarations whi...
...And 9 more matches
CSSMathSum - Web APIs
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. ...
... 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. ...
... 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 9 more matches
CSSStyleDeclaration.setProperty() - Web APIs
If not specified, treated as the empty string. ...
...If not specified, treated as the empty string. ...
...If not specified, treated as the empty string. ...
...And 9 more matches
CSSUnitValue.value - Web APIs
Working Draft Initial definition. ...
... Working Draft Initial definition. ...
... Examples The following creates a CSSPositionValue from individual CSSUnitValue constructors, then queries the CSSUnitValue.value. ...
...And 9 more matches
Using multi-column layouts - CSS: Cascading Style Sheets
The CSS Multi-column Layout Module extends the block layout mode to allow the easy definition of multiple columns of text. People have trouble reading text if lines are too long; if it takes too long for the eyes to move from the end of the one line to the beginning of the next, they lose track of which line they were on. Therefore, to make maximum use of a large screen, authors should have limited-width columns of text placed side by side, just as newspapers do. Unfortunately this is impossible to do with CSS and HTML without forcing column breaks at fixed positions, or severely restricting the markup allowed in the text, or using heroic scripting. This limitation is solved by adding new CSS properties to extend the traditional block layout mode. Using columns Column count and width Two...
... The column-count property sets the number of columns to a particular number. ...
... </p> <p> Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p> <p> Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. </p> <p> Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p> </div> CSS #col { column-count: 2; } Result Will display the content in two columns (if you're using a multi-column compliant browser): The column-width property sets the minimum desired column width. If column-count is not also set, then the browser will automatically make as many columns as fit in the available width. Example 2 HTML <div id="wid"> Lorem ipsum dolor sit amet, consectetur ad...
...And 9 more matches
background-size - CSS: Cascading Style Sheets
The image can be left to its natural size, stretched, or constrained to fit the available space. 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. Spaces not covered by a background image are filled with the background-color property, and the background color will be visible behind background images that have transparency/translucency. ...
...ns (width-to-height ratio). These attributes are as follows: A bitmap image (such as JPG) always has intrinsic dimensions and proportions. A vector image (such as SVG) does not necessarily have intrinsic dimensions. If it has both horizontal and vertical intrinsic dimensions, it also has intrinsic proportions. If it has no dimensions or only one dimension, it may or may not have proportions. CSS <gradient>s have no intrinsic dimensions or intrinsic proportions. Background images created with the element() function use the intrinsic dimensions and proportions of the generating element. Note: The behavior of <gradient>s changed in Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5). Before this, they were treated as images with no intrinsic dimensions, but with intrinsic proporti...
...adient> as the background and specify a background-size to go with it, it's best not to specify a size that uses a single auto component, or is specified using only a width value (for example, background-size: 50%). Rendering of <gradient>s in such cases changed in Firefox 8, and at present is generally inconsistent across browsers, which do not all implement rendering in full accordance with the CSS3 background-size specification and with the CSS3 Image Values gradient specification. .gradient-example { width: 50px; height: 100px; background-image: linear-gradient(blue, red); /* Not safe to use */ background-size: 25px; background-size: 50%; background-size: auto 50px; background-size: auto 50%; /* Safe to use */ background-size: 25px 50px; background-size: 50% 50%; ...
...And 9 more matches
position - CSS: Cascading Style Sheets
Web › CSS › position
The top, right, bottom, and left properties determine the final location of positioned elements. 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 The position property is specified as a single keyword chosen from the list of values below. Values static The element is positioned according to the normal flow of the document. The top, right, bottom, left, and z-index properties have no effect. This is the default value. ...
...of absolutely positioned boxes do not collapse with other margins. fixed The element is removed from the normal document flow, and no space is created for the element in the page layout. It is positioned relative to the initial containing block established by the viewport, except when one of its ancestors has a transform, perspective, or filter property set to something other than none (see the CSS Transforms Spec), in which case that ancestor behaves as the containing block. (Note that there are browser inconsistencies with perspective and filter contributing to containing block formation.) Its final position is determined by the values of top, right, bottom, and left. This value always creates a new stacking context. In printed documents, the element is placed in the same position on eve...
...s not affect the position of any other elements. This value always creates a new stacking context. Note that a sticky element "sticks" to its nearest ancestor that has a "scrolling mechanism" (created when overflow is hidden, scroll, auto, or overlay), even if that ancestor isn't the nearest actually scrolling ancestor. This effectively inhibits any "sticky" behavior (see the GitHub issue on W3C CSSWG). Description Types of positioning A positioned element is an element whose computed position value is either relative, absolute, fixed, or sticky. (In other words, it's anything except static.) A relatively positioned element is an element whose computed position value is relative. The top and bottom properties specify the vertical offset from its normal position; the left and right pro...
...And 9 more matches
Properly Using CSS and JavaScript in XHTML Documents - Archive of obsolete content
</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. Use of Comments Inside Inline style and script Authors who are familiar with HTML commonly enclose the contents of inline style and script tags in comments in order to hide the contents of the tags from browsers which do not understand them. <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> This example illustrates that a conformant browser can ignore content inside of comments. In addition, this example shows how the differences between browsers in handli...
...r i = 0; var sum = 0; for (i = 0; i < 10; ++i) { sum += i; } alert('sum = ' + sum); // --> </script> This example illustrates that a conformant browser can ignore content inside of comments. In addition, this example shows how the differences between browsers in handling inline content in text/xml or application/xhtml+xml can be problematic. Mozilla 1.1+/Opera 7 Do not apply CSS or execute the JavaScript. Netscape 7.0x/Mozilla 1.0.x Do not apply CSS but does execute the JavaScript. Internet Explorer 5.5+ Can not display the document. (See Talk:Properly_Using_CSS_and_JavaScript_in_XHTML_Documents of this ascertation. - XmlGuru) Inline style and script Containing Double Dashes Another problem with using comments to surround JavaScript in XHTML is related to the prob...
...TA Instead of Comments Properly enclosing script contents inside of CDATA sections can cause problems in downlevel browsers which do not understand XML. However, it is possible to combine JavaScript Comments with CDATA sections to allow for backward compatibility. <script type="text/javascript"> //<![CDATA[ var i = 0; while (++i < 10) { // ... } //]]> </script> Examples Using CSS rules in inline style within comments Example 1 - XHTML 1.0 Strict as text/html This example illustrates the behavior of XHTML served as text/html when CSS rules are contained inline and surrounded by comments. This example is supported by Netscape 7.x, Mozilla, Opera 7 and Internet Explorer 5.5+ which all apply the CSS rules as expected. Example 2 - XHTML 1.0 Strict as text/xml This exa...
...And 8 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. ...
...Media queries are important for a responsive web design and help us optimize a critical rendering path. ...
...Media queries are important for a responsive web design and help us optimize a critical rendering path. ...
...And 8 more matches
CSSPageRule - Web APIs
It has no specific methods. ...
...It has no specific methods. ...
...It has no specific methods. ...
...And 8 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. ...
...hich 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 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...
... Methods Inherits methods from its parent, StyleSheet. deleteRule() Deletes the rule at the specified index into the stylesheet's rule list. ...
...And 8 more matches
CSS and JavaScript animation performance - Web Performance
Animations are critical for a pleasurable user experience on many applications. There are many ways to implement web animations, such as CSS transitions/animations 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...
...s 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 rather than between two states. ...
...esting 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 rather than between two states. CSS animations consist of two components: a style describing the CSS animation, and a set of key frames that indicate the start and end states of the animation's style, as well as possible intermediate points. See Using CSS animations for more details. In terms of performance, there is no difference between implementing an animation with CSS transitions or animations. Both of them are classified un...
...And 8 more matches
Fundamental CSS comprehension - Learn web development
on is to attempt the assessment for the module -- this involves a number of related exercises that must be completed in order to create the final design -- a business card/gamer card/social media profile. Prerequisites: Before attempting this assessment you should have already worked through all the articles in this module. ...
... comprehension of fundamental CSS theory, syntax and mechanics. Starting point To get this assessment started, you should: Go and grab the HTML file for the exercise, and the associated image file, and save them in a new directory on your local computer. If you want to use your own image file and fill your own name in, you are welcome to -- just make sure the image is square. Grab the CSS resources text file -- this contains a set of raw selectors and rulesets 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 ...
...ontains a set of raw selectors and rulesets 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. ...
...And 7 more matches
CSS selectors - Learn web development
Previous Overview: Building blocks Next 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. 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 CSS selectors work in detail. What is a selector? You have met selectors already. A CSS selector is the first part of a CSS Rule. It is a pattern of element...
... with files, HTML basics (study Introduction to HTML), and an idea of how CSS works (study CSS first steps.) Objective: To learn how CSS selectors work in detail. What is a selector? ...
...The majority of selectors that you will come across are defined in the Level 3 Selectors specification, which is a mature specification, therefore you will find excellent browser support for these selectors. ...
...And 7 more matches
CSSCounterStyleRule - Web APIs
The CSSCounterStyleRule interface represents an @counter-style at-rule. ...
... 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/CSSRule" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">CSSRule</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" ...
..." height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">CSSRule</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/CSSCounterStyleRule" target="_top"><rect x="116" y="1" width="190" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="211" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">CSSCounterStyleRule</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties ...
...And 7 more matches
CSSMathProduct - Web APIs
Working Draft Initial definition. ...
... Working Draft Initial definition. ...
... Working Draft Initial definition. ...
...And 7 more matches
CSSNumericValue.equals() - Web APIs
The equals() method of the CSSNumericValue interface returns a boolean indicating whether the passed value are strictly equal. To return a value of true, all passed values must be of the same type and value and must be in the same order. This allows structural equality to be tested quickly. Syntax var boolean = CSSNumericValue.equals(number); Parameters number Either a Number or a CSSNumericValue. Return value A Boolean. Exceptions None. Examples As stated earlier, all passed values must be of the same type and value and must be in the same order. Some of the following examples illustrate what happens when they are not. ...
...ws structural equality to be tested quickly. Syntax var boolean = CSSNumericValue.equals(number); Parameters number Either a Number or a CSSNumericValue. Return value A Boolean. Exceptions None. Examples As stated earlier, all passed values must be of the same type and value and must be in the same order. Some of the following examples illustrate what happens when they are not. ...
...ality to be tested quickly. Syntax var boolean = CSSNumericValue.equals(number); Parameters number Either a Number or a CSSNumericValue. Return value A Boolean. Exceptions None. Examples As stated earlier, all passed values must be of the same type and value and must be in the same order. Some of the following examples illustrate what happens when they are not. ...
...And 7 more matches
CSSUnitValue.unit - Web APIs
Web › API › CSSUnitValue › unit
Working Draft Initial definition. ...
... Working Draft Initial definition. ...
... Working Draft Initial definition. ...
...And 7 more matches
::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. In these cases, both letters of the digraph should be matched by the ::first-letter pseudo-element. ...
...tch. In these cases, both letters of the digraph should be matched by the ::first-letter pseudo-element. (This is poorly supported by browsers; see the browser compatibility table below.) A combination of the ::before pseudo-element and the content property may inject some text at the beginning of the element. In that case, ::first-letter will match the first letter of this generated content. ...
...atibility table below.) A combination of the ::before pseudo-element and the content property may inject some text at the beginning of the element. In that 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. ...
...And 7 more matches
Shorthand properties - CSS: Cascading Style Sheets
Similarly, the most common font-related properties can be defined using the shorthand font, and the different margins around a box can be defined using the margin shorthand. ...
...Similarly, the most common font-related properties can be defined using the shorthand font, and the different margins around a box can be defined using the margin shorthand. ...
...Similarly, the most common font-related properties can be defined using the shorthand font, and the different margins around a box can be defined using the margin shorthand. ...
...And 7 more matches
Syntax - CSS: Cascading Style Sheets
Web › CSS › Syntax
The basic goal of the Cascading Stylesheet (CSS) language is to allow a browser engine to paint elements of the page with specific features, like colors, positioning, or decorations. 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. ...
...hich 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. 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 ...
...ates 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 property defines what are the valid values. ...
...And 7 more matches
Visual formatting model - CSS: Cascading Style Sheets
This includes continuous media such as a computer screen and paged media such as a book or document printed by browser print functions. Most of the information applies equally to continuous and paged media. In the visual formatting model, each element in the document tree generates zero or more boxes according to the box model. The layout of these boxes is governed by: Box dimensions and type. Positioning scheme (normal flow, float, and absolute positioning). Relationships between elements in the document tree. External information (e.g., viewport size, intrinsic dimensions of images, etc.). ...
...tes zero or more boxes according to the box model. The layout of these boxes is governed by: Box dimensions and type. Positioning scheme (normal flow, float, and absolute positioning). Relationships between elements in the document tree. External information (e.g., viewport size, intrinsic dimensions of images, etc.). Much of the information about the visual formatting model is defined in CSS2, however, various level 3 specifications have added to this information. When reading specifications you will often find references to the model as defined in CSS2, so an understanding of the model and the terms used to describe it in CSS2 is valuable when reading other layout specifications. In this document we define the model and introduce some of the related terms and concepts, linking to m...
... is smaller than the size of the document then the user agent needs to offer a way to scroll to the parts of the document that are not displayed. We most often see this as scrolling in the block dimension -- vertically in a horizontal, top-to-bottom language. However, you might design something that requires scrolling in the inline dimension too. Box generation Box generation is the part of the CSS visual formatting model that creates boxes from the document's elements. Generated boxes are of different types, which affect their visual formatting. The type of the box generated depends on the value of the CSS display property. Initially defined in CSS2, the display property is extended in the CSS Display Module Level 3. In addition, some of the terminologies around the display have been upda...
...And 7 more matches
content - CSS: Cascading Style Sheets
Web › CSS › content
Objects inserted using the content property are anonymous replaced elements. ...
...s the "alt text" for the element. This value can be any number of text characters. Non-Latin characters must be encoded using their Unicode escape sequences: for example, \000A9 represents 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 fo...
...bute 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. no-open-quote | no-close-quote Introduces no content, but increments (decrements) the level of nesting for quotes. ...
...And 7 more matches
CSS Houdini
Houdini is a set of low-level APIs that exposes parts of the CSS engine, giving developers the power to extend CSS by hooking into the styling 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...
..., 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 feature of CSS Houdini is the Worklet. With worklets, you can crea...
...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 feature of CSS Houdini is the Worklet. With worklets, you can create modular CSS, requiring a single line of JavaScript to import configureable components: no pre-processors, post-processors or JavaScript frameworks needed. <script> CSS.paintWorklet.addModule('csscomponent.js'); </script> This added module contains registerPaint() functions, which register completely configurable worklets. ...
...And 7 more matches
Writing Skinnable XUL and CSS - Archive of obsolete content
The following document outlines rules that one must abide by when writing a skin. Mozilla can have any number of installed UI packages, from Navigator to Sidebar to Editor. Each package has its own skin, CSS files and images that determine the appearance of that package. In our particular Mozilla skin, there is a special package calledglobal. This package contains a special skin called theglobal skin. ...
...our particular Mozilla skin, there is a special package calledglobal. This package contains a special skin called theglobal skin. If you wish for your package to blend in with the other packages, then the skin for your package should inherit information from the global skin in order to reduce the amount of duplication across packages and in order to make the UI as a whole easier to skin. Writing CSS files for a Package Learn CSS! This may seem obvious, but many of the nastiest problems we're seeing are being caused by people writing buggy or syntactically incorrect CSS. Read the spec! Study a book! Know it! Love it! Make it a part of you! Each skin has a master skin file. The skin for a package should always have a master skin file whose name corresponds to the name of the package. For e...
... problems we're seeing are being caused by people writing buggy or syntactically incorrect CSS. Read the spec! Study a book! Know it! Love it! Make it a part of you! Each skin has a master skin file. The skin for a package should always have a master skin file whose name corresponds to the name of the package. For example, the skin for the Navigator package should contain a file called navigator.css that determines the default look of all XUL windows posed from this package. If inheriting the global skin, a skin file must import the global skin explicitly. If your skin file wishes to inherit the global skin, then it should import the global skin explicitly. This is done using an @import directive placed at the top of the file. @import url(chrome://global/skin/) ... rest of skin file ... ...
...And 6 more matches
@import - CSS: Cascading Style Sheets
Web › CSS › @import
The @import CSS at-rule is used to import style rules from other style sheets. 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. If the browser does not support any these queries, it d...
...ue> ) ] | ( <ident> <any-value> )where <mf-plain> = <mf-name> : <mf-value><mf-boolean> = <mf-name><mf-range> = <mf-name> [ '<' | '>' ]? '='? <mf-value> | <mf-value> [ '<' | '>' ]? '='? <mf-name> | <mf-value> '<' '='? <mf-name> '<' '='? <mf-value> | <mf-value> '>' '='? <mf-name> '>' '='? ...
...lue> )where <mf-plain> = <mf-name> : <mf-value><mf-boolean> = <mf-name><mf-range> = <mf-name> [ '<' | '>' ]? '='? <mf-value> | <mf-value> [ '<' | '>' ]? '='? <mf-name> | <mf-value> '<' '='? <mf-name> '<' '='? <mf-value> | <mf-value> '>' '='? <mf-name> '>' '='? ...
...And 6 more matches
min-width - CSS: Cascading Style Sheets
Web › CSS › min-width
It prevents the used value of the width property from becoming smaller than the value specified for min-width. 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 element's width is set to the value of min-width whenever min-width is larger than max-width or width. ...
... Candidate Recommendation Adds the...
...tage> | min-content | max-content | fit-content(<length-percentage>)where <length-percentage> = <length> | <percentage> Examples Setting minimum element width table { min-width: 75%; } form { min-width: 0; } Specifications Specification Status Comment CSS Box Sizing Module Level 4The definition of 'min-width' in that specification. Editor's Draft CSS Box Sizing Module Level 3The definition of 'min-width' in that specification. ...
...And 6 more matches
url() - CSS: Cascading Style Sheets
Web › CSS › url()
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. ...
...} @import url("https://www.exampl...
... 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/") { ... } @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/symbo...
...And 6 more matches
Sizing items in CSS - Learn web development
Previous Overview: Building blocks Next In the various lessons so far you have come across a number of ways to size items on a web page using CSS. Understanding how big the different features in your 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. 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 different ways we can size things in CSS. The natural or intrinsic size of things HTML Elements have a natural size, set before they are affe...
...uisites: 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 different ways we can size things in CSS. The natural or intrinsic size of things HTML Elements have a natural size, set before they are affected by any CSS. A straightforward example is an image. An image has a width and a height defined in the image file it is embedding into the page. This size is described as the intrinsic size -- which comes from the image itself. If you place an image on a page and do not change its height and width, either using attributes on the <img> tag or CSS, it will be displayed using that intrinsic size. We have given t...
...the value is calculated from the inline size -- therefore the width when working in a horizontal language. In our example, all of the margins and padding are 10% of the width. This means you can have equal-sized margins and padding all around the box. This is a fact worth remembering if you do use percentages in this way. min- and max- sizes In addition to giving things a fixed size, we can ask CSS to give an element a minimum or a maximum size. If you have a box that might contain a variable amount of content, and you always want it to be at least a certain height, you could set the min-height property on it. The box will always be at least this height, but will then grow taller if there is more content than the box has space for at its minimum height. In the example below you can see two...
...And 5 more matches
CSS layout - Learn web development
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. ...
... 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. ...
... 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. ...
...And 5 more matches
CSSPrimitiveValue.primitiveType - Web APIs
The primitiveType read-only property of the CSSPrimitiveValue interface represents the type of a CSS value. Syntax type = cssPrimitiveValue.primitiveType; Value An unsigned short representing the type of the value. Possible values are: Constant Description CSS_ATTR The value is an attr() function. The value can be obtained by using the getStringValue() method. CSS_CM The value is a <length> in centimeters. The value can be obtained by using the getFloatValue() method. CSS_COUNTER The value is a counter or counters function. The value can be obtained by using the getCounterValue() method. CSS_DEG The value is an <angle> in degrees. ...
...Value() method. CSS_CM The value is a <length> in centimeters. The value can be obtained by using the getFloatValue() method. CSS_COUNTER The value is a counter or counters function. The value can be obtained by using the getCounterValue() method. CSS_DEG The value is an <angle> in degrees. The value can be obtained by using the getFloatValue() method. CSS_DIMENSION The value is a <number> with an unknown dimension. The value can be obtained by using the getFloatValue() method. CSS_EMS The value is a <length> in em units. The value can be obtained by using the getFloatValue() method. CSS_EXS The value is a <length> in ex units. The value can be obtained by using the getFloatValue() method. ...
...() method. CSS_DIMENSION The value is a <number> with an unknown dimension. The value can be obtained by using the getFloatValue() method. CSS_EMS The value is a <length> in em units. The value can be obtained by using the getFloatValue() method. CSS_EXS The value is a <length> in ex units. The value can be obtained by using the getFloatValue() method. CSS_GRAD The value is an <angle> in grads. The value can be obtained by using the getFloatValue() method. CSS_HZ The value is a <frequency> in Hertz. The value can be obtained by using the getFloatValue method. CSS_IDENT The value is an identifier. The value can be obtained by using the getStringValue() method. CSS_IN The value is a <length> in inches. The value...
...And 5 more matches
CSSStyleSheet.insertRule() - Web APIs
The default is 0. (In older implementations, this was required. ...
...The default is 0. (In older implementations, this was required. ...
...The default is 0. (In older implementations, this was required. ...
...And 5 more matches
::after (:after) - CSS: Cascading Style Sheets
Web › CSS › ::after
Examples Simple usage Let's create two classes: one for boring paragraphs and one for exciting ones. ...
...child of the selected element. It is often used to add cosmetic content to an element with the content property. It is inline by default. /* Add an arrow after links */ a::after { content: "->"; } Note: The pseudo-elements generated by ::before and ::after are contained by the element's formatting box, and thus don't apply to replaced elements such as <img>, or to <br> elements. Syntax /* CSS3 syntax */ ::after /* CSS2 syntax */ :after Note: CSS3 introduced the ::after notation (with two colons) to distinguish pseudo-classes from pseudo-elements. Browsers also accept :after, introduced in CSS2. Examples Simple usage Let's create two classes: one for boring paragraphs and one for exciting ones. We can use these classes to add pseudo-elements to the end of paragraphs. HTML <p c...
...duced in CSS2. Examples Simple usage Let's create two classes: one for boring paragraphs and one for exciting ones. We can use these classes to add pseudo-elements to the end of paragraphs. HTML <p class="boring-text">Here is some plain old boring text.</p> <p>Here is some normal text that is neither boring nor exciting.</p> <p class="exciting-text">Contributing to MDN is easy and fun.</p> CSS .exciting-text::after { content: " <- EXCITING!"; color: green; } .boring-text::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. ...
...And 5 more matches
::before (:before) - CSS: Cascading Style Sheets
Web › CSS › ::before
Examples Adding quotation marks One simple example of using ::before pseudo-elements is to provide quotation marks. ...
...hild of the selected element. It is often used to add cosmetic content to an element with the content property. It is inline by default. /* Add a heart before links */ a::before { content: "<3"; } Note: The pseudo-elements generated by ::before and ::after are contained by the element's formatting box, and thus don't apply to replaced elements such as <img>, or to <br> elements. Syntax /* CSS3 syntax */ ::before /* CSS2 syntax */ :before Note: CSS3 introduced the ::before notation (with two colons) to distinguish pseudo-classes from pseudo-elements. Browsers also accept :before, introduced 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 characte...
...d the ::before notation (with two colons) to distinguish pseudo-classes from pseudo-elements. Browsers also accept :before, introduced 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. HTML <q>Some quotes,</q> he said, <q>are better than none.</q> CSS q::before { content: "<<"; 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. ...
...And 5 more matches
system - CSS: Cascading Style Sheets
al style. ...
...One b. Two c. Three aa. Four bb. Five cc. Six aaa. Seven b...
...li>One</li> <li>Two</li> <li>Three</li> <li>Four</li> <li>Five</li> </ul> @counter-style circled-digits { system: fixed; symbols: ? ? ?; suffix: ' '; } ul { list-style: circled-digits; } Result Symbolic counter If your browser supports it, this example will render a list like this: a. One b. Two c. Three aa. Four bb. Five cc. Six aaa. Seven bbb. Eight CSS <ul> <li>One</li> <li>Two</li> <li>Three</li> <li>Four</li> <li>Five</li> <li>Six</li> <li>Seven</li> <li>Eight</li> </ul> @counter-style abc { system: symbolic; symbols: a b c; suffix: ". "; } ul { list-style: abc; } Result Alphabetic counter If your browser supports it, this example will render a list like this: a. One b. Two c. Three aa. Four ab. F...
...And 5 more matches
Replaced elements - CSS: Cascading Style Sheets
See Controlling object position within the content box for further information. ...
...See Controlling object position within the content box for further information. ...
...See Controlling object position within the content box for further information. ...
...And 5 more matches
<custom-ident> - CSS: Cascading Style Sheets
The <custom-ident> CSS data type denotes an arbitrary user-defined string used as an identifier. It is case-sensitive, and certain values are forbidden in various contexts to prevent ambiguity. Syntax The syntax of <custom-ident> is similar to CSS identifiers (such as property names), except that it is case-sensitive. It consists of one or more characters, where characters can be any of the following: any alphabetical character (A to Z, or a to z), any decimal digit (0 to 9), a hyphen (-), an underscore (_), an escaped character (preceded by a backslash, \), a Unicode character (in the format of a backslash, \, followed by one to six hexadecimal digits, representing its Unicode code point) Note that id1, Id1, iD1 and ID1 are all different identifiers as they are case-sensitive. O...
...dentifiers. Forbidden values A <custom-ident> must not be placed between single or double quotes as this would be identical to a <string>. Moreover, the first character must not be 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, ci...
...nja-formal, korean-hanja-informal, lao, lower-armenian, malayalam, mongolian, myanmar, oriya, persian, simp-chinese-formal, simp-chinese-informal, tamil, telugu, thai, tibetan, trad-chinese-formal, trad-chinese-informal, upper-armenian, disclosure-open, and disclosure-close. grid-row-start grid-row-end grid-column-start grid-column-end Forbids the span value. will-change Forbids the global CSS values (unset, initial, and inherit), as well as the values will-change, auto, scroll-position, and contents. Examples Valid identifiers nono79 A mix of alphanumeric characters and numbers ground-level A mix of alphanumeric characters and a dash -test A dash followed by alphanumeric characters _internal An underscore followed by alphanumeric characters \22 ...
...And 5 more matches
max-width - CSS: Cascading Style Sheets
Web › CSS › max-width
It prevents the used value of the width property from becoming larger than the value specified by max-width. 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. max-width overrides width, but min-width overrides max-width. ...
...tage> | min-content | max-content | fit-content(<length-percentage>)where <length-percentage> = <length> | <percentage> Examples Setting max width in pixels In this example, the "child" will be either 150 pixels wide or the width of the "parent," whichever is smaller. HTML <div id="parent"> <div id="child"> Fusce pulvinar vestibulum eros, sed luctus ex lobortis quis. ...
...els wide or the width of the "parent," whichever is smaller. HTML <div id="parent"> <div id="child"> Fusce pulvinar vestibulum eros, sed luctus ex lobortis quis. </div> </div> CSS #parent { background: lightblue; width: 300px; } #child { background: gold; width: 100%; max-width: 150px; } Result Specifications Specification Status Comment CSS Box Sizing Module Level 4The definition of 'max-width' in that specification. Editor's Draft CSS Box Sizing Module Level 3The definition of 'max-width' in that specification. Working Draft Adds the max-content, min-content, fit-content keywords. CSS Level 2 (Revision 1)The definition of 'max-width' in that specification. Recommendation Initial definition. ...
...And 5 more matches
text-transform - CSS: Cascading Style Sheets
It can be used to make text appear in all-uppercase or all-lowercase, or with each word capitalized. It also can help improve legibility for ruby. 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-transform property takes into account language-specific case mapping rules such as the following: In Turkic languages, like Turkish (tr), Azerbaijani (az), Crimean Tatar (crh), Volga Tatar (tt), and Bashkir (ba), there are two kinds of i, with and without the dot, and two case pairings: i/I and i/I. ...
... case as written in the element's text). A letter is defined as a character that is part of Unicode's Letter or Number general categories ; thus, any punctuation marks or symbols at the beginning of a word are ignored. Authors should not expect capitalize to follow language-specific title casing conventions (such as skipping articles in English). ...
...ritten in the element's text). A letter is defined as a character that is part of Unicode's Letter or Number general categories ; thus, any punctuation marks or symbols at the beginning of a word are ignored. Authors should not expect capitalize to follow language-specific title casing conventions (such as skipping articles in English). The capitalize keyword was under-specified in CSS 1 and CSS 2.1. ...
...And 5 more matches
Used value - CSS: Cascading Style Sheets
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. ...
...putes 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-width">..</p> <div id="width-inherit"> <p>Explicit width: inherit.</p> <p class="show-used-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 w...
...The follo...
...And 5 more matches
writing-mode - CSS: Cascading Style Sheets
When set for an entire document, it should be set on the root element (html element for HTML documents). 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 property specifies the block flow direction, which is the direction in which block-level containers are stacked, and the direction in which inline-level content flows within a block container. Thus, it also determines the ordering of block-level content. ...
... content flows vertically from top to bottom. All the glyphs, even those in vertical scripts, are set sideways toward the right. sideways-lr For ltr scripts, content flows vertically from top to bottom. For rtl scripts, content flows vertically from bottom to top. All the glyphs, even those in vertical scripts, are set sideways toward the left. lr Deprecated except for SVG1 documents. For CSS, use horizontal-tb instead. lr-tb Deprecated except for SVG1 documents. For CSS, use horizontal-tb instead. rl Deprecated except for SVG1 documents. For CSS, use horizontal-tb instead. tb Deprecated except for SVG1 documents. For CSS, use vertical-lr instead. tb-lr Deprecated except for SVG1 documents. For CSS, use vertical-lr instead. tb-rl Deprecated except for SVG1 document...
...orizontal-tb instead. lr-tb Deprecated except for SVG1 documents. For CSS, use horizontal-tb instead. rl Deprecated except for SVG1 documents. For CSS, use horizontal-tb instead. tb Deprecated except for SVG1 documents. For CSS, use vertical-lr instead. tb-lr Deprecated except for SVG1 documents. For CSS, use vertical-lr instead. tb-rl Deprecated except for SVG1 documents. For CSS, use vertical-rl instead. Formal definition Initial valuehorizontal-tbApplies toall elements except table row groups, table column groups, table rows, and table columnsInheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr Examples Using multiple writing modes This example demonstrates all of the wri...
...And 5 more matches
SVG and CSS - SVG: Scalable Vector Graphics
This page illustrates the application of CSS to the specialized language for creating graphics: SVG. Below you'll create a simple demonstration that runs in your SVG-enabled browser. Note: Elements referenced by <use> elements inherit the styles from that element. So to apply different styles to them you should use CSS custom properties. Example Make a new SVG document as a plain text file, doc8.svg. ...
...yles to them you should use CSS custom properties. 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...
...And 5 more matches
Chrome-only CSS reference
Mozilla › Gecko › Chrome › CSS
This page lists CSS properties that are only available in Gecko Chrome code (and sometimes in other privileged circumstances, eg. UA stylesheets.) Note: Most of the CSS properties exposed to the Web in general are also usable in Chrome stylesheets: see the CSS documentation for a list of these. -moz-window-draggingThe -moz-window-dragging CSS property specifies whether a window is draggable or not. It only works in Chrome code, and only on Mac OS X.:-moz-lwthemeThe :-moz-lwtheme pseudo-class matches in chrome documents when the root element's lightweightthemes attribute is true and a theme is selected.:-moz-lwtheme-brighttextThe :-moz-lwtheme-brighttext pseudo-class matches in chrome documents when :-moz-lwtheme is true and a lightweight theme with a bright text color is selected.:-...
...tweight theme with a bright text color is selected.:-moz-lwtheme-darktextThe :-moz-lwtheme-darktext pseudo-class matches in chrome documents when :-moz-lwtheme is true and a lightweight theme with a dark text color is selected.::-moz-tree-cellActivated by the properties attribute.::-moz-tree-cell-textActivated by the properties attribute.::-moz-tree-cell-text(hover)The :-moz-tree-cell-text(hover) CSS pseudo-class will match an element if the mouse cursor is presently hovering over text in a tree cell.::-moz-tree-columnActivated by the properties attribute.::-moz-tree-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-t...
...columnActivated by the properties attribute.::-moz-tree-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. ...
...And 4 more matches
CSS.escape() - Web APIs
Web › API › CSS › escape
The CSS.escape() static method returns a CSSOMString containing the escaped string passed as parameter, mostly for use as part of a CSS selector. Syntax escapedStr = CSS.escape(str); Parameters str The CSSOMString to be escaped. ...
... The CSS.escape() static method returns a CSSOMString containing the escaped string passed as parameter, mostly for use as part of a CSS selector. Syntax escapedStr = CSS.escape(str); Parameters str The CSSOMString to be escaped. ...
... The CSS.escape() static method returns a CSSOMString containing the escaped string passed as parameter, mostly for use as part of a CSS selector. Syntax escapedStr = CSS.escape(str); Parameters str The CSSOMString to be escaped. ...
...And 4 more matches
CSSKeyframeRule - Web APIs
It has no specific methods. ...
...It has no specific methods. ...
...It has no specific methods. ...
...And 4 more matches
CSSPrimitiveValue.getFloatValue() - Web APIs
The getFloatValue() method of the CSSPrimitiveValue interface is used to get a float value in a specified unit. If this CSS value doesn't contain a float value or can't be converted into the specified unit, a DOMException is raised. Syntax var floatValue = cssPrimitiveValue.getFloatValue(unit); Parameters unitType An unsigned short representing the code for the unit type, in which the value should be returned. Valid values are: Constant Description CSS_CM The value is a <length> in centimeters. CSS_DEG The value is an <angle> in degrees. CSS_DIMENSION The value is a <number> with an unknown dimension. CSS_EMS The value is a <length> in em units. ...
...the code for the unit type, in which the value should be returned. Valid values are: Constant Description CSS_CM The value is a <length> in centimeters. CSS_DEG The value is an <angle> in degrees. CSS_DIMENSION The value is a <number> with an unknown dimension. CSS_EMS The value is a <length> in em units. CSS_EXS The value is a <length> in ex units. CSS_GRAD The value is an <angle> in grads. CSS_HZ The value is a <frequency> in Hertz. The value can be obtained by using the getFloatValue method. ...
...ees. CSS_DIMENSION The value is a <number> with an unknown dimension. CSS_EMS The value is a <length> in em units. CSS_EXS The value is a <length> in ex units. CSS_GRAD The value is an <angle> in grads. CSS_HZ The value is a <frequency> in Hertz. The value can be obtained by using the getFloatValue method. CSS_IN The value is a <length> in inches. CSS_KHZ The value is a <frequency> in Kilohertz. CSS_MM The value is a <length> in millimeters. CSS_MS The value is a <time> in milliseconds. CSS_NUMBER The value is a simple <number>. CSS_PC The value is a <length> in picas. ...
...And 4 more matches
CSSPrimitiveValue.setFloatValue() - Web APIs
The setFloatValue() method of the CSSPrimitiveValue interface is used to set a float value. If the property attached to this value can't accept the specified unit or the float value, the value will be unchanged and a DOMException will be raised. Syntax cssPrimitiveValue.setFloatValue(unitType, floatValue); Parameters unitType An unsigned short representing the code for the unit type, in which the value should be returned. Valid values are: Constant Description CSS_CM The value is a <length> in centimeters. CSS_DEG The value is an <angle> in degrees. CSS_DIMENSION The value is a <number> with an unknown dimension. CSS_EMS The value is a <length> in em units. ...
...the code for the unit type, in which the value should be returned. Valid values are: Constant Description CSS_CM The value is a <length> in centimeters. CSS_DEG The value is an <angle> in degrees. CSS_DIMENSION The value is a <number> with an unknown dimension. CSS_EMS The value is a <length> in em units. CSS_EXS The value is a <length> in ex units. CSS_GRAD The value is an <angle> in grads. CSS_HZ The value is a <frequency> in Hertz. The value can be obtained by using the getFloatValue method. ...
...ees. CSS_DIMENSION The value is a <number> with an unknown dimension. CSS_EMS The value is a <length> in em units. CSS_EXS The value is a <length> in ex units. CSS_GRAD The value is an <angle> in grads. CSS_HZ The value is a <frequency> in Hertz. The value can be obtained by using the getFloatValue method. CSS_IN The value is a <length> in inches. CSS_KHZ The value is a <frequency> in Kilohertz. CSS_MM The value is a <length> in millimeters. CSS_MS The value is a <time> in milliseconds. CSS_NUMBER The value is a simple <number>. CSS_PC The value is a <length> in picas. ...
...And 4 more matches
CSSPseudoElement - Web APIs
EventTarget.dispatchEvent() Dispatches an event to this pseudo-element. EventTarget.removeEventListener() Removes an event listener from the pseudo-element. ...
... EventTarget.dispatchEvent() Dispatches an event to this pseudo-element. EventTarget.removeEventListener() Removes an event listener from the pseudo-element. ...
... EventTarget.dispatchEvent() Dispatches an event to this pseudo-element. EventTarget.removeEventListener() Removes an event listener from the pseudo-element. ...
...And 4 more matches
::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. ...
...ds 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. ...
...color, background-clip, background-image, background-origin, background-position, 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. ...
...And 4 more matches
@media - CSS: Cascading Style Sheets
Web › CSS › @media
Syntax The @media at-rule may be placed at the top level of your code or nested inside any other conditional group at-rule. ...
... Syntax The @media at-rule may be placed at the top level of your code or nested inside any other conditional group at-rule. ...
... Syntax The @media at-rule may be placed at the top level of your code or nested inside any other conditional group at-rule. ...
...And 4 more matches
Block and inline layout in normal flow - CSS: Cascading Style Sheets
They can be either block or inline, but not both at once. We describe block-level boxes as participating in a block formatting context, and inline-level boxes as participating in an inline formatting context. The behaviour of elements which have a block or inline formatting context is also defined in this specification. ...
...ly, one after the other, beginning at the top of a containing block. Horizontal margins, borders, and padding are respected between these boxes. The boxes may be aligned vertically in different ways: their bottoms or tops may be aligned, or the baselines of text within them may be aligned. The rectangular area that contains the boxes that form a line is called a line box." - 9.4.2 Note that the CSS 2.1 specification describes documents as being in a horizontal, top to bottom writing mode. For example, by describing vertical distance between block boxes. The behavior on block and inline elements is the same when working in a vertical writing mode, and we will explore this in a future guide on Flow Layout and Writing Modes. Elements participating in a block formatting context Block elements...
...x Model values in your browser DevTools. This will give you the actual size of the margin which can help you to identify what is happening. Elements participating in an inline formatting context Inline elements display one after the other in the direction that sentences run in that particular writing mode. While we don't tend to think of inline elements as having a box, as with everything in CSS they do. These inline boxes are arranged one after the other. If there is not enough space in the containing block for all of the boxes a box can break onto a new line. The lines created are known as line boxes. In the following example, we have three inline boxes created by a paragraph with a <strong> element inside it. The boxes around the words before the <strong> element and after the <st...
...And 4 more matches
Basic Concepts of grid layout - CSS: Cascading Style Sheets
This sets the grid to the specified pixel which fits to the layout you desire. ...
...This sets the grid to the specified pixel which fits to the layout you desire. ...
...This sets the grid to the specified pixel which fits to the layout you desire. ...
...And 4 more matches
Relationship of grid layout to other layout methods - CSS: Cascading Style Sheets
Grid was designed for two-dimensional layout - rows, and columns at the same time. The two specifications share some common features, however, and if you have already learned how to use flexbox, the similarities should help you get to grips with Grid. One-dimensional vs. two-dimensional layout A simple example can demonstrate the difference between one- and two-dimensional layouts. ...
...items above. This is because when you wrap flex items, each new row (or column when working by column) becomes a new flex container. Space distribution happens across the row. A common question then is how to make those items line up. This is where you want a two-dimensional layout method: You want to control the alignment by row and column, and this is where grid comes in. The same layout with CSS grids In this next example, I create the same layout using Grid. This time we have three 1fr column tracks. We do not need to set anything on the items themselves; they will lay themselves out one into each cell of the created grid. As you can see they stay in a strict grid, lining up in rows and columns. With five items, we get a gap on the end of row two. * {box-sizing: border-box;} .wrapp...
...box works from the content out. An ideal use case for flexbox is when you have a set of items and want to space them out evenly in a container. You let the size of the content decide how much individual space each item takes up. If the items wrap onto a new line, they will work out their spacing based on their size and the available space on that line. Grid works from the layout in. When you use CSS Grid Layout you create a layout and then you place items into it, or you allow the auto-placement rules to place the items into the grid cells according to that strict grid. It is possible to create tracks that respond to the size of the content, however, they will also change the entire track. If you are using flexbox and find yourself disabling some of the flexibility, you probably need to use...
...And 4 more matches
Scaling of SVG backgrounds - CSS: Cascading Style Sheets
pecifying fixed lengths for both dimensions If you use background-size to specify fixed lengths for both dimensions, those lengths are always used, per rule 1 above. In other words, the image will always get stretched to the dimensions you specify, regardless of whether or not the source image has specified its dimensions and/or aspect ratio. ...
... will always get stretched to the dimensions you specify, regardless of whether or not the source image has specified its dimensions and/or aspect ratio. ...
...en this CSS: background: url(no-dimensions-or-ratio.svg); background-size: 125px 175px; The rendered output would look like this: Source: One specified dimension, no intrinsic ratio Given this CSS: background: url(100px-wide-no-height-or-ratio.svg); background-size: 250px 150px; The rendered output would look like this: Source: One specified dimension with intrinsic ratio Given this CSS: background: url(100px-height-3x4-ratio.svg); background-size: 275px 125px; The rendered output would look like this: Source: No specified width or height with intrinsic ratio Given this CSS: background: url(no-dimensions-1x1-ratio.svg); background-size: 250px 100px; The rendered output would look like this: Using contain or cover Specifying cover for background-size makes the pictu...
...And 4 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. ...
... Each individual animati...
... function () { toggleButton(BUTTON[index], 'restart'); }); }); BUTTON.forEach(function (btn, index) { btn.addEventListener('click', function () { playPause(index); }); }); }) A description of which properties are animatable is available; it's worth noting that this description is also valid for CSS transitions. Constituent properties This property is a shorthand for the following CSS properties: animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function Syntax The animation property is specified as one or more single animations, separated by commas. Each individual animation is specified as: zero or one occurrences of the following values: <single-tra...
...And 4 more matches
<easing-function> - CSS: Cascading Style Sheets
This lets you vary the animation's speed over the course of its duration. The easing functions in the cubic-bezier subset of easing functions are often called "smooth" easing functions, because they can be used to smooth down the start and end of the animation. They correlate a time ratio to an output ratio, both expressed as <number>s. For these values, 0.0 represents the initial state, and 1.0 represents the final state. Depending on the specific function used, the calculated output can sometimes grow to be greater than 1.0 or smaller than 0.0 during the course of an animation. ...
...a color component greater than 255 or smaller than 0 will be clipped to the closest allowed value (255 and 0, respectively). Some cubic-bezier() curves exhibit this property. Syntax There are three types of easing function: linear, cubic Bezier curves, and staircase functions. The value of an <easing-function> type describes the easing function using one of those three types. Easing functions CSS supports three kinds of easing functions: linear, the subset of the cubic Bezier curves that are functions, and staircase functions. The most useful of these functions are given a keyword that allows them to be easily referenced. The linear class of easing functions linear The animation moves from beginning to end at a constant rate. This keyword represents the easing function cubic-bezier(0...
.... The cubic-bezier() class of easing functions The cubic-bezier() functional notation defines a cubic Bezier curve. As these curves are continuous, they are often used to smooth down the start and end of the animation and are therefore sometimes called easing functions. A cubic Bezier curve is defined by four points P0, P1, P2, and P3. P0 and P3 are the start and the end of the curve and, in CSS these points are fixed as the coordinates are ratios (the abscissa the ratio of time, the ordinate the ratio of the output range). P0 is (0, 0) and represents the initial time and the initial state, P3 is (1, 1) and represents the final time and the final state. Not all cubic Bezier curves are suitable as easing functions as not all are mathematical functions; i.e., curves that for a given absci...
...And 4 more matches
font-size - CSS: Cascading Style Sheets
Web › CSS › font-size
Changing the font size also updates the sizes of the font size-relative <length> units, such as em, ex, and so forth. 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. ...
...his formula: em = desired element pixel value / parent element font-size in pixels For example, suppose the font-size of the body of the page is set to 16px. If the font-size you want is 12px, then you should specify 0.75em (because 12/16 = 0.75). Similarly, if you want a font size of 10px, then specify 0.625em (10/16 = 0.625); for 22px, specify 1.375em (22/16). The em is a very useful unit in CSS, since it automatically adapts its length relative to the font that the reader chooses to use. em and ex units on the font-size property are relative to the parent element's font size (unlike all other properties, where they're relative to the font size on the element). This means em units and percentages do the same thing for font-size. One important fact to keep in mind: em values compound. T...
...apts its length relative to the font that the reader chooses to use. em and ex units on the font-size property are relative to the parent element's font size (unlike all other properties, where they're relative to the font size on the element). This means em units and percentages do the same thing for font-size. One important fact to keep in mind: em values compound. Take the following HTML and CSS: html { font-size: 62.5%; /* font-size 1em = 10px on default browser settings */ } span { font-size: 1.6em; } <div> <span>Outer <span>inner</span> outer</span> </div> The result is: Assuming that the browser's default font-size is 16px, the words "outer" would be rendered at 16px, but the word "inner" would be rendered at 25.6px. This is because the inner <span>'s font-size is 1.6em wh...
...And 4 more matches
font-variant - CSS: Cascading Style Sheets
The font-variant CSS shorthand property allows you to set all the font variants for a font. You can also set the CSS Level 2 (Revision 1) values of font-variant, (that is, normal or small-caps), by using the font shorthand. 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. ...
...2 (Revision 1) values of font-variant, (that is, normal or small-caps), by using the font shorthand. 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. ...
...-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">Firefox rocks!</p> CSS p.normal { font-variant: normal; } p.small { font-variant: small-caps; } Result Specifications Specification Status Comment CSS Fonts Module Level 3The definition of 'font-variant' in that specification. Candidate Recommendation Made it a shorthand of the new font-variant-* properties. CSS Level 2 (Revision 1)The definition of 'font-variant' i...
...And 4 more matches
font-weight - CSS: Cascading Style Sheets
The weights available depend on the font-family that is currently set. 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. ...
...e mapping section below. In earlier versions of the font-weight specification, the property accepts only keyword values and the numeric values 100, 200, 300, 400, 500, 600, 700, 800, and 900; non-variable fonts can only really make use of these set values, although fine-grained values (e.g. 451) will be translated to one of these values for non-variable fonts using the Fallback weights system. CSS Fonts Level 4 extends the syntax to accept any number between 1 and 1000 and introduces Variable fonts, which can make use of this much finer-grained range of font weights. Fallback weights If the exact weight given is unavailable, then the following rule is used to determine the weight actually rendered: If the target weight given is between 400 and 500 inclusive: Look for available ...
... Common weight name mapping. However some fonts, called variable fonts, can support a range of weights with a more or less fine granularity, and this can give the designer a much closer degree of control over the chosen weight. For TrueType or OpenType variable fonts, the "wght" variation is used to implement varying widths. For the example below to work, you'll need a browser that supports the CSS Fonts Level 4 syntax in which font-weight can be any number between 1 and 1000. HTML <header> <input type="range" id="weight" name="weight" min="1" max="1000" /> <label for="weight">Weight</label> </header> <div class="container"> <p class="sample">...it would not be wonderful to meet a Megalosaurus, forty feet long or so, waddling like an elephantine lizard up Holborn Hill.</p> ...
...And 4 more matches
<image> - CSS: Cascading Style Sheets
Web › CSS › image
Images with multiple intrinsic dimensions, existing in multiple versions inside a single file, like some .ico formats. ...
...of the following: An image denoted by the <url> data type A <gradient> data type A part of the webpage, defined by the element() function An image, image fragment or solid patch of color, defined by the image() function A blending of two or more images defined by the cross-fade() function. A selection of images chosed based on resolution defined by the image-set() function. Description CSS can handle the following kinds of images: Images with intrinsic dimensions (a natural size), like a JPEG, PNG, or other raster format. Images with multiple intrinsic dimensions, existing in multiple versions inside a single file, like some .ico formats. (In this case, the intrinsic dimensions will be those of the image largest in area and the aspect ratio most similar to the containing box.) ...
... a single file, like some .ico formats. (In this case, the intrinsic dimensions will be those of the image largest in area and the aspect ratio most similar to the containing box.) Images with no intrinsic dimensions but with an intrinsic aspect ratio between its width and height, like an SVG or other vector format. ...
...And 4 more matches
<length> - CSS: Cascading Style Sheets
Web › CSS › length
The length unit is optional after the number 0. Note: Some properties allow negative <length>s, while others do not. ...
...The length unit is optional after the number 0. Note: Some properties allow negative <length>s, while others do not. ...
...The length unit is optional after the number 0. Note: Some properties allow negative <length>s, while others do not. ...
...And 4 more matches
max-height - CSS: Cascading Style Sheets
It prevents the used value of the height property from becoming larger than the value specified for max-height. 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. max-height overrides height, but min-height overrides max-height. ...
... Recommendation Initial definition. ...
...t | fit-content(<length-percentage>)where <length-percentage> = <length> | <percentage> Examples Setting max-height using percentage and keyword values table { max-height: 75%; } form { max-height: none; } Specifications Specification Status Comment CSS Box Sizing Module Level 4The definition of 'max-height' in that specification. Editor's Draft CSS Box Sizing Module Level 3The definition of 'max-height' in that specification. Working Draft Adds the max-content, min-content, fit-content keywords. CSS Level 2 (Revision 1)The definition of 'max-height' in that specification. Recommendation Initial definition. Browser compatibility The compatibility table on this page is generated from structured data. If you'd like...
...And 4 more matches
text-align - CSS: Cascading Style Sheets
This means it works like vertical-align but in the horizontal direction. 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. ...
...left or rightAnimation typediscrete Formal syntax start | end | left | right | center | justify | match-parent Examples Left alignment HTML <p class="example"> Integer elementum massa at nulla placerat varius. Suspendisse in libero risus, in interdum massa. Vestibulum ac leo vitae metus faucibus gravida ac in neque. Nullam est eros, suscipit sed dictum quis, accumsan a ligula. ...
...t eros, suscipit sed dictum quis, accumsan a ligula. </p> CSS .example { text-align: left; border: solid; } Result Centered text HTML <p class="example"> Integer elementum massa at nulla placerat varius. Suspendisse in libero risus, in interdum massa. Vestibulum ac leo vitae metus faucibus gravida ac in neque. Nullam est eros, suscipit sed dictum quis, accumsan a ligula. </p> CSS .example { text-align: center; border: solid; } Result Justify HTML <p class="example"> Integer elementum massa at nulla placerat varius. Suspendisse in libero risus, in interdum massa. Vestibulum ac leo vitae metus faucibus gravida ac in neque. Nullam est eros, suscipit sed dictum quis, accumsan a ligula. ...
...And 4 more matches
<url> - CSS: Cascading Style Sheets
Web › CSS › url
The <url> CSS data type denotes a pointer to a resource, such as an image or a font. URLs can be used in numerous CSS properties, such as background-image, cursor, and list-style. URI or URL? ...
...<url> CSS data type denotes a pointer to a resource, such as an image or a font. URLs can be used in numerous CSS properties, such as background-image, cursor, and list-style. URI or URL? ...
... a font. URLs can be used in numerous CSS properties, such as background-image, cursor, and list-style. 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. Confusingly, this meant that url() could be used to create a <uri> CSS data type. This change was not only awkward but, debatably, unnecessary, 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 <...
...And 4 more matches
Creating reusable content with CSS and XBL - Archive of obsolete content
This page illustrates how you can use CSS in Mozilla to improve the structure of complex applications, making code and resources more 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. ...
...Mozilla provides a mechanism that overcomes these limitations: XBL (XML Bindings Language). ...
...king 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: <!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"); } ...
...And 3 more matches
CSS - MDN Web Docs Glossary: Definitions of Web-related terms
CSS (Cascading Style Sheets) is a declarative language that controls how webpages look in the browser. The browser applies CSS style declarations to selected elements to display them properly. A style declaration contains the properties and their values, which determine how a webpage looks. CSS is one of the three core Web technologies, along with HTML and JavaScript. CSS usually styles HTML elements, but can be also used with other markup languages like SVG or XML. A CSS rule is a set of properties associated with a selector. Here is an example that makes every HTML paragraph yellow against a black background: /* The selector "p" indicates that all paragraphs in the document will be affected by that rule */ p { /* The "color" property defines the text color, in this case yellow.
...p { /* The "color" property defines the text color, in this case yellow. */ color: yellow; /* The "background-color" property defines the background color, in this case black. ...
...r, in this case yellow. */ color: yellow; /* The "background-color" property defines the background color, in this case black. ...
...And 3 more matches
CSS first steps - Learn web development
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. ...
... familiarity with HTML, as discussed in the Introduction to HTML module. 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. ...
... 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 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...
...And 3 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. ...
...heet 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. ...
...nterface. 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. Methods CSSStyleDeclaration.getPropertyPriority() Returns the optional priority, "important". CSSStyleDeclaration.getPropertyValue() Returns the property value given a property name. ...
...And 3 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. Instead, styles can be set by ass...
...= "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 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.colo...
... 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 3 more matches
@document - CSS: Cascading Style Sheets
Web › CSS › @document
It is designed primarily for user-defined style sheets, though it can be used on author-defined style sheets, too. @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). media-document(), with the parameter of video, image, plugin or all. ...
...URL is matched by the regular expression provided. The expression must match the entire URL. The values provided to the url(), url-prefix(), domain(), and media-document() functions can be optionally enclosed by single or double quotes. The values provided to the regexp() function must be enclosed in quotes. Escaped values provided to the regexp() function must additionally be escaped from the CSS. For example, a . (period) matches any character in regular expressions. To match a literal period, you would first need to escape it using regular expression rules (to \.), then escape that string using CSS rules (to \\.). @document is currently only supported in Firefox; if you wanted to replicate using such functionality in your own non-Firefox browser, you could try using this polyfill by @A...
... functionality in your own non-Firefox browser, you could try using this polyfill by @An-Error94, which uses a combination of a user script, data-* attributes, and attribute selectors. Note: There is a -moz-prefixed version of this property -- @-moz-document. ...
...And 3 more matches
-webkit-transform-2d - CSS: Cascading Style Sheets
Examples Basic example @media (-webkit-transform-2d) { div { -webkit-transform: translate(100px, 100px); } } This media feature is only supported by WebKit. ...
... Examples Basic example @media (-webkit-transform-2d) { div { -webkit-transform: translate(100px, 100px); } } This media feature is only supported by WebKit. ...
... Examples Basic example @media (-webkit-transform-2d) { div { -webkit-transform: translate(100px, 100px); } } This media feature is only supported by WebKit. ...
...And 3 more matches
Using URL values for the cursor property - CSS: Cascading Style Sheets
For example, the following value would be allowed: cursor: url(foo.cur), url(http://www.example.com/bar.gif), auto; This will first try loading foo.cur. ...
... For example, the following value would be allowed: cursor: url(foo.cur), url(http://www.example.com/bar.gif), auto; This will first try loading foo.cur. ...
... on Windows and Linux. Mac support was added in Gecko 2 (Firefox 4). This allows specifying arbitrary images as mouse cursors -- any image format supported by Gecko can be used. Syntax The basic (CSS 2.1) syntax for this property is: cursor: [ <url> , ]* <keyword> This means that zero or more URLs may be specified (comma-separated), which must be followed by one of the keywords defined in the CSS specification, such as auto or pointer. For example, the following value would be allowed: cursor: url(foo.cur), url(http://www.example.com/bar.gif), auto; This will first try loading foo.cur. ...
...And 3 more matches
OpenType font features guide - CSS: Cascading Style Sheets
or 'ffl'), kerning (adjustments to the spacing between specific letterform pairings), fractions, numeral styles, and a number of others. 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. 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...
...e 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 the language, so they go beyond the more stylistic preference of most other OpenType features. Caution: There are many CSS attributes defined to leverage font features, but unfortunately many are not fully implemented. They are all defined and shown here, but many will only work using the lower-level font-feature-settings property. It's possible to write CSS to work both ways but this can become cumbersome. The issue with simply using font-feature-settings for everything is that every time you want to change one of t...
...at every time you want to change one of the individual features, you have to redefine the entire string (similar to manipulating variable fonts with font-variation-settings). Discovering availability of features in fonts This is sometimes the trickiest thing to work out if you don't have any documentation that came with the fonts (many type designers and foundries will provide sample pages and CSS just for this very reason). But there are some sites that make it easier to figure out. You can visit wakamaifondue.com, drop your font file on the circle where instructed and in a few moments you'll have a full report on all the capabilities and features of your font. Axis-praxis.org also offers a similar capability, with the ability to click on the features to turn them on or off in a given tex...
...And 3 more matches
all - CSS: Cascading Style Sheets
Web › CSS › all
Note that none of these values affect the unicode-bidi and direction properties. ...
...Note that none of these values affect the unicode-bidi and direction properties. ...
...ties to their initial or inherited values, or to the values specified in another stylesheet origin. 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 /* Global values */ all: initial; all: inherit; all: unset; /* CSS Cascading and Inheritance Level 4 */ all: revert; The all property is specified as one of the CSS global keyword values. Note that none of these values affect the unicode-bidi and direction properties. Values initial 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 inherit...
...And 3 more matches
background-position - CSS: Cascading Style Sheets
The position is relative to the position layer set by background-origin. 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. ...
...es uses the background property to create a yellow, rectangular element containing a star image. In each example, the star is in a different position. The third example illustrates how to specify positions for two different background images within one element. ...
...g position, from first specified to last. */ .examplethree { background-image: url("https://mdn.mozillademos.org/files/11987/startransparent.gif"), url("https://mdn.mozillademos.org/files/7693/catfront.png"); background-position: 0px 0px, right 3em bottom 2em; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'background-position' in that specification. Candidate Recommendation Adds support for multiple backgrounds and the four-value syntax. Modifies the percentage definition to match implementations. CSS Level 2 (Revision 1)The definition of 'background-position' in that specification. Recommendation Allows for keyword value...
...And 3 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. ...
...operty 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. 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...
... Cand...
...And 3 more matches
box-sizing - CSS: Cascading Style Sheets
If the element has any border or padding, this is then added to the width and height to arrive at the size of the box that's rendered on the screen. This means that when you set width and height, you have to adjust the value you give to allow for any border or padding that may be added. ...
...If the element has any border or padding, this is then added to the width and height to arrive at the size of the box that's rendered on the screen. This means that when you set width and height, you have to adjust the value you give to allow for any border or padding that may be added. ...
...ight, you have to adjust the value you give to allow for any border or padding that may be added. For example, if you have four boxes with width: 25%;, if any has left or right padding or a left or right border, they will not by default fit on one line within the constraints of the parent container. The box-sizing property can be used to adjust this behavior: content-box gives you the default CSS box-sizing behavior. If you set an element's width to 100 pixels, then the element's content box will be 100 pixels wide, and the width of any border or padding will be added to the final rendered width, making the element wider than 100px. border-box tells the browser to account for any border and padding in the values you specify for an element's width and height. If you set an element's width...
...And 3 more matches
caption-side - CSS: Cascading Style Sheets
The values are relative to the writing-mode of the table. 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 /* Directional values */ caption-side: top; caption-side: bottom; /* Warning: non-standard values */ caption-side: left; caption-side: right; caption-side: top-outside; caption-side: bottom-outside; /* Global values */ caption-side: inherit; caption-side: initial; caption-side: unset; The caption-side property is specified as one of the keyword values listed below. ...
...lues */ caption-side: inherit; caption-side: initial; caption-side: unset; The caption-side property is specified as one of the keyword values listed below. Values top The caption box should be positioned above the table. bottom The caption box should be positioned below the table. left The caption box should be positioned on the left side of the table. This value was proposed for CSS 2, but removed from the final CSS 2.1 specification. It is non-standard. right The caption box should be positioned on the right side of the table. This value was proposed for CSS 2, but removed from the final CSS 2.1 specification. It is non-standard. top-outside The caption box should be positioned above the table, while the width and horizontal alignment behavior are not bound t...
...pecification. It is non-standard. right The caption box should be positioned on the right side of the table. This value was proposed for CSS 2, but removed from the final CSS 2.1 specification. It is non-standard. top-outside The caption box should be positioned above the table, while the width and horizontal alignment behavior are not bound to the table's horizontal layout. The CSS 2.1 specification notes that the CSS 2 specification described a different behavior for the top value, which will be reintroduced by this value in a future specification. ...
...And 3 more matches
clear - CSS: Cascading Style Sheets
Web › CSS › clear
The clear property applies to floating and non-floating elements. 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 applied to non-floating blocks, it moves the border edge of the element down until it is below the margin edge of all relevant floats. The non-floated block's top margin collapses. Vertical margins between two floated elements on the other hand will not collapse. ...
... none | left | right | both | inline-start | inline-end Examples clear: left HTML <div class="wrapper"> <p class="black">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus sit amet diam. Duis mattis varius dui. ...
... background-color: pink; width:20%; } p { width: 50%; } clear: right HTML <div class="wrapper"> <p class="black">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus sit amet diam. Duis mattis varius dui. ...
...And 3 more matches
column-gap (grid-column-gap) - CSS: Cascading Style Sheets
This prefixed property is being replaced by column-gap. ...
...d 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. Initially a part of Multi-column Layout, the definition of column-gap has been broadened to include multiple layout methods. Now specified in Box Alignment, it may be used in Multi-column, Flexible Box, and Grid layouts. CSS Grid Layout initially defined the grid-column-gap property. This prefixed property is being replaced by column-gap. However, in order to support browsers that implemented grid-column-gap and not column-gap for grid, you will need to use the prefixed property. Syntax /* Keyword value */ column-gap: normal; /* <length> values */ column-gap: 3px; column-gap: 2.5em; /* <percentage> value */ colu...
...responding dimension of the content areaComputed valueas specified, with <length>s made absolute, and normal computing to zero except on multi-column elementsAnimation typea length, percentage or calc(); Formal syntax normal | <length-percentage>where <length-percentage> = <length> | <percentage> Examples Flex layout HTML <div id="flexbox"> <div></div> <div></div> <div></div> </div> CSS #flexbox { display: flex; height: 100px; column-gap: 20px; } #flexbox > div { border: 1px solid green; background-color: lime; flex: auto; } Result Grid layout HTML <div id="grid"> <div></div> <div></div> <div></div> </div> CSS #grid { grid-column-gap: 20px; } #grid { display: grid; height: 100px; grid-template-columns: repeat(3, 1fr); grid-template-rows:...
...And 3 more matches
counters() - CSS: Cascading Style Sheets
Web › CSS › counters
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. ...
...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 counters() function (and counter() function) is what makes it useful by returning developer defined content. Note: The counters() function can be used with any CSS property, but support for properties other than content is experimental, 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 d...
...-style-name> = <custom-ident> Examples default value compared to upper Roman HTML <ol> <li> <ol> <li></li> <li></li> <li></li> </ol> </li> <li></li> <li></li> <li> <ol> <li></li> <li> <ol> <li></li> <li></li> <li></li> </ol> </li> </ol> </li> </ol> CSS ol { counter-reset: listCounter; } li { counter-increment: listCounter; } li::marker { content: counters(listCounter, '.', upper-roman) ') '; } li::before { content: counters(listCounter, ".") " == " counters(listCounter, ".", lower-roman) ; } Result decimal-leading-zero compared to lower-alpha HTML <ol> <li> <ol> <li></li> <li></li> <li></li> ...
...And 3 more matches
padding - CSS: Cascading Style Sheets
Web › CSS › padding
The padding CSS shorthand property sets the padding area on all four sides of an element 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. An element's padding area is the space between its content and its border. Note: Padding creates extra space within an element. In contrast, margin creates extra space around an element. ...
... to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. An element's padding area is the space between its content and its border. Note: Padding creates extra space within an element. In contrast, margin creates extra space around an element. ...
...dding-left: the percentage as specified or the absolute lengthpadding-right: the percentage as specified or the absolute lengthpadding-top: the percentage as specified or the absolute lengthAnimation typea length Formal syntax [ <length> | <percentage> ]{1,4} Examples Setting padding with pixels HTML <h4>This element has moderate padding.</h4> <h3>The padding is huge in this element!</h3> CSS h4 { background-color: lime; padding: 20px 50px; } h3 { background-color: cyan; padding: 110px 50px 50px 110px; } Result Setting padding with pixels and percentages padding: 5%; /* All sides: 5% padding */ padding: 10px; /* All sides: 10px padding */ padding: 10px 20px; /* top and bottom: 10px padding */ /* left and...
...And 3 more matches
white-space - 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. Note: To make words break within themselves, use overflow-wrap, word-break, or hyphens instead. Syntax /* Keyword values */ white-space: normal; white-space: nowrap; white-space: pre; white-space: pre-wrap; white-space: pre-line; white-space: break-spaces; /* Global values */ white-space: inherit; white-space: initial; white-space: unset; The white-space property is specified as a single keyword chosen from the list of values below. ...
...nitial valuenormalApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax normal | pre | nowrap | pre-wrap | pre-line | break-spaces Examples Basic example code { white-space: pre; } Line breaks inside <pre> elements pre { word-wrap: break-word; /* IE 5.5-7 */ white-space: pre-wrap; /* Modern browsers */ } In action HTML <div id="css-code" class="box"> p { white-space: <select> <option>normal</option> <option>nowrap</option> <option>pre</option> <option>pre-wrap</option> <option>pre-line</option> <option>break-spaces</option> </select> } </div> <div id="results" class="box"> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magn...
...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. ...
...And 3 more matches
Test your skills: CSS and JavaScript accessibility - Learn web development
However, their accessibility is pretty bad -- there is no way to really tell that they are links, or to tell which one the user is focussed on. ...
...However, their accessibility is pretty bad -- there is no way to really tell that they are links, or to tell which one the user is focussed on. ...
...ruleset with the a selector is supplied by some CMS, and that you can't change it -- instead, you need to create new rules to make the links look and behave like links, and for the user to be able to tell where they are in the list. 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. CSS accessibility 2 In this next task you are presented with a simple bit of content -- just headings and paragraphs. There are accessibility issues with the colors and sizing of the text; we'd like you to: 1. Explain what the problems are, and what the guidelines are that state the acceptable values for color and sizing. 2. Select new values for the color and font-size that fix the problem. 3. ...
...And 2 more matches
Using CSS generated content - Learn web development
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. ...
...at share a stylesheet. If you specify content in your stylesheet that requires translation, you have to put those parts of your stylesheet in different files and arrange for them to be linked with the appropriate language versions of your doucment. This issue does not arise if the content you specify consists of symbols or images that apply in all languages and cultures. ...
... content you specify consists of symbols or images that apply in all languages and cultures. Examples Text content 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...
...And 2 more matches
Animating CSS properties - Firefox Developer Tools
The performance cost of animating a CSS property can vary from one property to another, and animating expensive CSS properties can result in jank as the browser struggles to hit a smooth frame rate. The Frame rate and Waterfall can give you insight into the work the browser's doing in a CSS animation, to help diagnose performance problems. With CSS animations you specify a number of keyframes, each of which uses CSS to define the appearance of the element at a particular stage of the animation. The browser creates the animation as a transition from each keyframe to the next. Compared with animating elements using JavaScript, CSS animations can be easier to create. They can also give better performance, as they give the browser more control over when to render frames, and to drop frames ...
...t at a particular stage of the animation. The browser creates the animation as a transition from each keyframe to the next. Compared with animating elements using JavaScript, CSS animations can be easier to create. They can also give better 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. Animating expensive CSS properties can result in jank as the browser struggles to hit a smooth frame rate. ...
...JavaScript, CSS animations can be easier to create. They can also give better 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. 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. T...
...And 2 more matches
CSS.supports() - Web APIs
Web › API › CSS › supports
The CSS.supports() method returns a Boolean value indicating if the browser supports a given CSS feature, or not. Syntax CSS.supports(propertyName, value); CSS.supports(supportCondition); Parameters There are two distinct sets of parameters. The first one allows to test the support of a pair property-value: propertyName 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. ...
...perty-value: propertyName 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. ...
...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. ...
...And 2 more matches
CSSMathProduct.values - Web APIs
Working Draft Initial definition. ...
... Working Draft Initial definition. ...
... Working Draft Initial definition. ...
...And 2 more matches
CSSMathSum.values - Web APIs
Web › API › CSSMathSum › values
Working Draft Initial definition. ...
... Working Draft Initial definition. ...
... Working Draft Initial definition. ...
...And 2 more matches
CSSNamespaceRule - Web APIs
The CSSNamespaceRule interface describes an object representing a single CSS @namespace at-rule. It implements the CSSRule interface, with a type value of 10 (CSSRule.NAMESPACE_RULE). Syntax The syntax is described using the WebIDL format. interface CSSNamespaceRule : CSSRule { readonly attribute DOMString namespaceURI; readonly attribute DOMString? ...
... The CSSNamespaceRule interface describes an object representing a single CSS @namespace at-rule. It implements the CSSRule interface, with a type value of 10 (CSSRule.NAMESPACE_RULE). Syntax The syntax is described using the WebIDL format. interface CSSNamespaceRule : CSSRule { readonly attribute DOMString namespaceURI; readonly attribute DOMString? ...
...e CSSNamespaceRule interface describes an object representing a single CSS @namespace at-rule. It implements the CSSRule interface, with a type value of 10 (CSSRule.NAMESPACE_RULE). Syntax The syntax is described using the WebIDL format. interface CSSNamespaceRule : CSSRule { readonly attribute DOMString namespaceURI; readonly attribute DOMString? ...
...And 2 more matches
CSSPseudoElement.element - Web APIs
The element read-only property of the CSSPseudoElement interface returns a reference to the originating element of the pseudo-element, in other words its parent element. Syntax var originatingElement = cssPseudoElement.element; Value An Element representing the pseudo-element's originating element. ...
... The element read-only property of the CSSPseudoElement interface returns a reference to the originating element of the pseudo-element, in other words its parent element. Syntax var originatingElement = cssPseudoElement.element; Value An Element representing the pseudo-element's originating element. ...
...a reference to the originating element of the pseudo-element, in other words its parent element. Syntax var originatingElement = cssPseudoElement.element; Value An Element representing the pseudo-element's originating element. ...
...And 2 more matches
CSSPseudoElement.type - Web APIs
The type read-only property of the CSSPseudoElement interface returns the type of the pseudo-element as a string, represented in the form of a CSS selector. ...
... The type read-only property of the CSSPseudoElement interface returns the type of the pseudo-element as a string, represented in the form of a CSS selector. ...
... The type read-only property of the CSSPseudoElement interface returns the type of the pseudo-element as a string, represented in the form of a CSS selector. ...
...And 2 more matches
CSSValueList - Web APIs
The CSSValueList interface 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. ...
...alueList are accessible via an integral index, starting from 0. ...
...ock; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/CSSValue" target="_top"><rect x="1" y="1" width="80" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="41" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">CSSValue</text></a><polyline points="81,25 91,20 91,30 81,25" stroke="#D4DDE4" fill="none"/><line x1="91" y1="25" x2="121" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/CSSValueList" target="_top"><rect x="121" y="1" width="120" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="181" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="...
...And 2 more matches
CSS Painting API - Web APIs
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 content. Concepts and usage Essentially, the CSS Painting API contains functionality 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...
...et 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 has an output bitmap that is the size of the object it is rendering to. PaintSize Returns the read-only values of the output bitmap's width and height. Dict...
... of the CanvasRenderingContext2D API. It has an output bitmap that is the size of the object it is rendering to. PaintSize Returns the read-only values of the output bitmap's width and height. Dictionaries PaintRenderingContext2DSettings A dictionary providing a subset of CanvasRenderingContext2D settings. Examples To draw directly into an element's background using JavaScript in our CSS, we define a paint worklet using the registerPaint() function, tell the document to include the worklet using the paintWorklet addModule() method, then include the image we created using the CSS paint() function. We create our PaintWorklet called 'hollowHighlights' using the registerPaint() function: registerPaint('hollowHighlights', class { static get inputProperties() { return ['--boxColo...
...And 2 more matches
CSS Properties and Values API - Web APIs
The CSS Properties and Values API -- part of the CSS Houdini umbrella of APIs -- allows developers to explicitly define their css custom properties, allowing for property type checking, default values, and properties that do or do not inherit their value. Interfaces CSS.registerProperty Defines how a browser should parse a css custom properties. Access this interface through CSS.registerProperty in JavaScript. @property Defines how a browser should parse a css custom properties. Access this interface through @property in CSS. ...
...pe checking, default values, and properties that do or do not inherit their value. Interfaces CSS.registerProperty Defines how a browser should parse a css custom properties. Access this interface through CSS.registerProperty in JavaScript. @property Defines how a browser should parse a css custom properties. Access this interface through @property in CSS. ...
...at do or do not inherit their value. Interfaces CSS.registerProperty Defines how a browser should parse a css custom properties. Access this interface through CSS.registerProperty in JavaScript. @property Defines how a browser should parse a css custom properties. Access this interface through @property in CSS. ...
...And 2 more matches
:active - CSS: Cascading Style Sheets
Web › CSS › :active
When using a mouse, "activation" 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. ...
...h 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. ...
...ith multi-button mice, CSS3 specifies that the :active pseudo-class must only apply to the primary button; on right-handed mice, this is typically the leftmost button. Syntax :active Examples Active links HTML <p>This paragraph contains a link: <a href="#">This link will turn red while you click on it.</a> The paragraph will get a gray background while you click on it or the link. ...
...And 2 more matches
:host() - CSS: Cascading Style Sheets
Web › CSS › :host()
The most obvious use of this is to put a class name only on certain custom element instances, and then include the relevant class selector as the function argument. You can't use this with a descendant selector expression to select only instances of the custom element that are inside a particular ancestor. That's the job of :host-context(). Note: This has no effect when used outside a shadow DOM. ...
...e taken from our host-selectors example (see it live also). ...
...st { background: rgba(0,0,0,0.1); padding: 2px 5px; }'; The :host(.footer) { color : red; } rule styles all instances of the <context-span> element (the shadow host in this instance) in the document that have the footer class set on them -- we've used it to give instances of the element inside the <footer> a special color. Specifications Specification Status Comment CSS Scoping Module Level 1The definition of ':host()' in that specification. Working Draft Initial definition. Browser compatibility DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet:host()Chrome Full support 54Edge Full ...
...And 2 more matches
: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. ...
...: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. Styling restrictions For privacy reasons, browsers strictly 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, ...
...d with :visited. Of the properties that can be set with this pseudo-class, your browser probably 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. ...
...And 2 more matches
font-weight - CSS: Cascading Style Sheets
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. ...
...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 /* Single values */ font-weight: normal; font-weight: bold; font-weight: 400; /...
...described in the Common weight name mapping section below. In earlier versions of the font-weight specification, the property accepts only keyword values and the numeric values 100, 200, 300, 400, 500, 600, 700, 800, and 900; non-variable fonts can only really make use of these set values, although fine-grained values (e.g. 451) will be translated to one of these values for non-variable fonts. CSS Fonts Level 4 extends the syntax to accept any number between 1 and 1000, inclusive, and introduces Variable fonts, which can make use of this much finer-grained range of font weights. Common weight name mapping The numerical values 100 to 900 roughly correspond to the following common weight names: Value Common weight name 100 Thin (Hairline) 200 Extra ...
...And 2 more matches
@font-face - CSS: Cascading Style Sheets
Syntax @font-face { font-family: "Open Sans"; src: url("/fonts/OpenSans-Regular-webfont.woff2") format("woff2"), url("/fonts/OpenSans-Regular-webfont.woff") format("woff"); } Descriptors font-display Determines 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. ...
...ossible to customize the font beyond the basics while making it possible to do so without relying on an Internet connection. It's common to use both url() and local() together, so that the user's installed copy of the font is used if available, falling back to downloading a copy of the font if it's not found on the user's device. The @font-face at-rule may be used not only at the top level of a CSS, but also inside any CSS conditional-group at-rule. Font MIME Types Format MIME type TrueType font/ttf OpenType font/otf Web Open Font Format font/woff Web Open Font Format 2 font/woff2 Notes Web fonts are subject to the same domain restriction (font files must be on the same domain as the page using them), unless HTTP ac...
...MIME type TrueType font/ttf OpenType font/otf Web Open Font Format font/woff Web Open Font Format 2 font/woff2 Notes Web fonts are subject to the same domain restriction (font files must be on the same domain as the page using them), unless HTTP access controls are used to relax this restriction. @font-face cannot be declared within a CSS selector. For example, the following will not work: .className { @font-face { font-family: MyHelvetica; src: local("Helvetica Neue Bold"), local("HelveticaNeue-Bold"), url(MgOpenModernaBold.ttf); font-weight: bold; } } Formal syntax @font-face { [ font-family: <family-name>; ] | [ src: <src>; ] | [ unicode-range: <unicode-range>; ] | [ font-variant...
...And 2 more matches
@page - CSS: Cascading Style Sheets
Web › CSS › @page
The @page CSS at-rule is used to modify some CSS properties when printing a document. Syntax @page { margin: 1cm; } @page :first { margin: 2cm; } Descriptors size Specifies the target size and orientation of the page box's containing block. In the general case, where one page box is rendered onto one page sheet, it also indicates the size of the destination page sheet. marks Adds crop and/or registration marks to the document. bleed Specifies the extent beyond the page box at which the page rendering is clipped. Description You can't change all CSS properties with @page. You can only change the margins, orphans, widows, and page breaks of the document. Attempts to change any other CSS properties will be ignored. ...
... Note: The W3C is discussing how to handle viewport-related <length> units, vh, vw, vmin, and vmax. Meanwhile do not use them within a @page at-rule. ...
... Note: The W3C is discussing how to handle viewport-related <length> units, vh, vw, vmin, and vmax. Meanwhile do not use them within a @page at-rule. ...
...And 2 more matches
Alternative style sheets - CSS: Cascading Style Sheets
cessed 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. ...
...rome 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. For example: <link href="reset.css" rel="stylesheet" type="text/css"> <link href="default.css" rel="stylesheet" type="text/css" title="Default Style"> <link href="fancy.css" rel="alternate stylesheet" type="text/css" title="Fancy"> <link href="basic.css" rel="alternate stylesheet" type="text/css" title="Basic"> In this example, the styles "Default Style", "Fancy", and "Basic" will be listed in the Page Style submenu, with "Default Style" pre-selected. When the...
... Try it out Click here for a working example you can try out. Details Any stylesheet in a document falls into one of the following categories: Persistent (no rel="alternate", no title=""): always applies to the document. ...
...And 2 more matches
Attribute selectors - CSS: Cascading Style Sheets
/* <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. ...
... at least one occurrence of value within the string. [attr operator value i] Adding an i (or I) before the closing bracket causes the value to be compared case-insensitively (for characters within the ASCII range). [attr operator value s] Adding an s (or S) before the closing bracket causes the value to be compared case-sensitively (for characters within the ASCII range). ...
...*/ 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-...
...And 2 more matches
Resizing background images with background-size - CSS: Cascading Style Sheets
The background-size CSS property lets you resize the background image of an element, overriding the default behavior of tiling the image at its full size by specifying the width and/or height of the image. By doing so, you can scale the image upward or downward as desired. Tiling a large image Let's consider a large image, a 2982x2808 Firefox logo image. We want (for some reason likely involving horrifyingly bad site design) to tile four copies of this image into a 300x300-pixel element. To do this, we can use a fixed background-size value of 150 pixels. ...
... doing so, you can scale the image upward or downward as desired. Tiling a large image Let's consider a large image, a 2982x2808 Firefox logo image. We want (for some reason likely involving horrifyingly bad site design) to tile four copies of this image into a 300x300-pixel element. To do this, we can use a fixed background-size value of 150 pixels. ...
...x; The result looks like this: Scaling an image up On the other end of the spectrum, you can scale an image up in the background. Here we scale a 32x32 pixel favicon to 300x300 pixels: .square2 { background-image: url(favicon.png); background-size: 300px; width: 300px; height: 300px; border: 2px solid; text-shadow: white 0px 0px 2px; font-size: 16px; } As you can see, the CSS is actually essentially identical, save the name of the image file. Special values: "contain" and "cover" Besides <length> values, the background-size CSS property offers two special size values, contain and cover. Let's take a look at these. contain The contain value specifies that, regardless of the size of the containing box, the background image should be scaled so that each side is as la...
...And 2 more matches
Backwards Compatibility of Flexbox - CSS: Cascading Style Sheets
Flexbox is very well supported across modern browsers, however there are a few issues that you might run into. In this guide we will look at how well flexbox is supported in browsers, and look at some potential issues, resources and methods for creating workarounds and fallbacks. The history of flexbox As with all CSS specifications the Flexbox specification went through a large number of changes before it became the Candidate Recommendation that we have today. As a Candidate Recommendation we should not see large changes at this point to the spec, however this has not been the case with past flexbox iterations. Flexbox was implemented in an experimental way in several web browsers. At the time the method of creating experimental implementations was to use a vendor prefix. The idea of the...
...versions of browsers, and in particular IE10 and 11, the Flexbugs site is a helpful resource. You will see that many of the listed bugs apply to old browser versions and are fixed in current browsers. Each of the bugs has a workaround listed -- which can save you many hours of puzzling. If you want to include very old browsers with flexbox support then you can include the vendor prefixes in your CSS in addition to the unprefixed version. This is becoming less and less of a requirement today as support is widespread. .wrapper { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; } Autoprefixer Online is a useful way to see which prefixes are recommended, depending on how many versions you wish to go back with browser support. You can also check Can I U...
...ck Once an inline-block item becomes a flex item, it is blockified and so behavior of display: inline-block like preserving white space between items no longer applies. Remove display: flex to see the fallback behavior. You'll see white space added between the items, which is what happens when using display: inine-block as it prefers white space like other inline items. ...
...And 2 more matches
Basic concepts of flexbox - CSS: Cascading Style Sheets
and powerful alignment capabilities. This article gives an outline of the main features of flexbox, which we will be exploring in more detail in the rest of these guides. When we describe flexbox as being one dimensional we are describing the fact that flexbox deals with layout in one dimension at a time -- either as a row or as a column. This can be contrasted with the two-dimensional model of CSS Grid Layout, which controls columns and rows together. The two axes of flexbox When working with flexbox you need to think in terms of two axes -- the main axis and the cross axis. The main axis is defined by the flex-direction property, and the cross axis runs perpendicular to it. Everything we do with flexbox refers back to these axes, so it is worth understanding how they work from the outse...
...olumn-reverse then the cross axis runs along the rows. Understanding which axis is which is important when we start to look at aligning and justifying flex items; flexbox features properties that align and justify content along one axis or the other. Start and end lines Another vital area of understanding is how flexbox makes no assumption about the writing mode of the document. In the past, CSS was heavily weighted towards horizontal and left-to-right writing modes. Modern layout methods encompass the range of writing modes and so we no longer assume that a line of text will start at the top left of a document and run towards the right hand side, with new lines appearing one under the other. You can read more about the relationship between flexbox and the Writing Modes specification in...
...e of my main axis would be on the right and the end edge on the left. In both cases the start edge of the cross axis is at the top of the flex container and the end edge at the bottom, as both languages have a horizontal writing mode. ...
...And 2 more matches
Flow Layout and Writing Modes - CSS: Cascading Style Sheets
The CSS 2.1 specification, which details how normal flow behaves, assumes a horizontal writing mode. Layout properties should work in the same way in vertical writing modes. In this guide, we look at how flow layout behaves when used with different document writing modes. This is not a comprehensive guide to the use of writing modes in CSS, the aim here is to document the areas where flow layout interacts with writing modes in possibly unanticipated ways. The external resources and see also sections of this document link to more writing modes resources. The Writing Modes Specification The CSS Writing Modes Level 3 Specification defines the impact a change the document writing mode has on flow layout. In the writing modes introduction, the specification says, "A writing mode in CS...
...e specification defines the inline base direction as the direction in which content is ordered on a line. This defines the start and end of the inline direction. The start is where sentences start and the end is where a line of text ends before it would begin to wrap onto a new line. The block flow direction is the direction in which boxes, for example paragraphs, stack in that writing mode. The CSS writing-mode property controls the block flow direction. If you want to change your page, or part of your page, to vertical-lr then you can set writing-mode: vertical-lr on the element and this will change the direction of the blocks and therefore the inline direction as well. While certain languages will use a particular writing mode or text direction, we can also use these properties for creat...
...rol the size in the inline direction. In vertical-lr it controls the size in the block direction because it does not rotate with the text. Therefore, we have new properties of block-size and inline-size. If we give our block an inline-size of 100px, it doesn't matter whether we are in a horizontal or a vertical writing mode, inline-size will always mean the size in the inline direction. The CSS Logical Properties and Values specification includes logical versions of the properties that control margins, padding and borders as well as other mappings for things that we have typically used physical directions to specify. Summary In most cases, flow layout works as you would expect it to when changing the writing mode of the document or parts of the document. This can be used to properly t...
...And 2 more matches
Basic concepts of Logical Properties and Values - CSS: Cascading Style Sheets
Therefore we describe boxes as having a width and height, position items from the top and left, float things left, assign borders, margin, and padding to the top, right, bottom, left, etc. ...
...Therefore we describe boxes as having a width and height, position items from the top and left, float things left, assign borders, margin, and padding to the top, right, bottom, left, etc. ...
...op and left, float things left, assign borders, margin, and padding to the top, right, bottom, left, etc. The Logical Properties and Values specification defines mappings for these physical values to their logical, or flow relative, counterparts -- e.g. start and end as opposed to left and right/top and bottom. An example of why these mappings might be needed is as follows. I have a Layout using CSS Grid, the grid container has a width applied and I am using the align-self and justify-self properties to align the items. These properties are flow relative -- justify-self: start aligns the item to the start on the inline dimension, align-self: start does the same on the block dimension. If I now change the writing mode of this component to vertical-rl using the writing-mode property, the al...
...And 2 more matches
Shapes from box values - CSS: Cascading Style Sheets
By using Box Values for Shapes we can wrap our content around the edges defined by these values. ...
... By using Box Values for Shapes we can wrap our content around the edges defined by these values. ...
... By using Box Values for Shapes we can wrap our content around the edges defined by these values. In all of the examples below I am using an element which has padding, a border, and a margin defined in order that you can see the different ways in which content will flow. ...
...And 2 more matches
Tools - CSS: Cascading Style Sheets
Web › CSS › Tools
CSS offers a number of powerful features that can be tricky to use, or have a number of parameters, so that it's helpful to be able to visualize them while you work on them. This page offers links to a number of useful tools that will help you build the CSS to style your content using these features. 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. ...
...ork on them. This page offers links to a number of useful tools that will help you build the CSS to style your content using these features. 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. ...
...tent using these features. 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. ...
...And 2 more matches
Value definition syntax - CSS: Cascading Style Sheets
CSS value definition syntax, a formal grammar, is used for defining the set of valid values for a CSS property or function. In addition to this syntax, the set of valid values can be further restricted by semantic constraints (for example, for a number to be strictly positive). The definition syntax describes which values are allowed and the interactions between them. A component can be a keyword, some characters considered as a literal, or a value of a given CSS data type or of another CSS property. Component value types Keywords Generic keywords A keyword with a predefined meaning appears literally, without quotation marks. For example: auto, smaller or ease-in. ...
...owed and the interactions between them. A component can be a keyword, some characters considered as a literal, or a value of a given CSS data type or of another CSS property. Component value types Keywords Generic keywords A keyword with a predefined meaning appears literally, without quotation marks. For example: auto, smaller or ease-in. The specific case of inherit, initial and unset All CSS properties accept the keywords inherit, initial and unset, that are defined throughout CSS. They are not shown in the value definition, and are implicitly defined. Literals In CSS, a few characters can appear on their own, like the slash ('/') or the comma (','), and are used in a property definition to separate its parts. The comma is often used to separate values in enumerations, or parameter...
...s in mathematical-like functions; the slash often separates parts of the value that are semantically different, but have a common syntax. Typically, the slash is used in shorthand properties; to separate component that are of the same type, but belong to different properties. Both symbols appear literally in a value definition. Data types Basic data types Some kind of data are used throughout CSS, and are defined once for all values in the specification. Called basic data types, they are represented with their name surrounded by the symbol '<' and '>': <angle>, <string>, ... Non-terminal data types Less common data types, called non-terminal data types, are also surrounded by '<' and '>'. Non-terminal data types are of two kinds: data types sharing the same name of a property, put ...
...And 2 more matches
background-attachment - 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. Syntax /* Keyword values */ background-attachment: scroll; background-attachment: fixed; background-attachment: local; /* Global values */ background-attachment: inherit; background-attachment: initial; background-attachment: unset; The background-attachment property is specified as one of the keyword values from the list below. ...
...mputed valueas specifiedAnimation typediscrete Formal syntax <attachment>#where <attachment> = scroll | fixed | local Examples Simple example HTML <p> There were doors all round the hall, but they were all locked; and when Alice had been all the way down one side and up the other, trying every door, she walked sadly down the middle, wondering how she was ever to get out again. </p> CSS p { background-image: url("https://mdn.mozillademos.org/files/12057/starsolid.gif"); background-attachment: fixed; } Result Multiple background images This property supports multiple background images. You can specify a different <attachment> for each background, separated by commas. Each image is matched with the corresponding attachment type, from first specified to last. HTML <p> ...
...ng to one of the doors of the hall; but, alas! either the locks were too large, or the key was too small, but at any rate it would not open any of them. ...
...And 2 more matches
background-repeat - CSS: Cascading Style Sheets
A background image can be repeated along the horizontal and vertical axes, or not repeated at 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. 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). ...
... original width of 260px, repeated three times, might stretch until each repetition is 300px wide, and then another image will be added. They will then compress to 225px. no-repeat The image is not repeated (and hence the background image painting area will not 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. It also applies to ::first-letter and ::first-line.InheritednoComputed valuea list, each item consisting of two keywords, one per dimensionAnimation typediscrete Formal syntax <repeat-style>#where <repeat-style> = repeat-x | repeat-y | [ repeat | space | round | no-repeat ]{1,2} Examples Setting background-re...
...ML <ol> <li>no-repeat <div class="one"></div> </li> <li>repeat <div class="two"></div> </li> <li>repeat-x <div class="three"></div> </li> <li>repeat-y <div class="four"></div> </li> <li>space <div class="five"></div> </li> <li>round <div class="six"></div> </li> <li>repeat-x, repeat-y (multiple images) <div class="seven"></div> </li> </ol> CSS /* Shared for all DIVS in example */ ol, li { margin: 0; padding: 0; } li { margin-bottom: 12px; } div { background-image: url(https://mdn.mozillademos.org/files/12005/starsolid.gif); width: 160px; height: 70px; } /* Background repeats */ .one { background-repeat: no-repeat; } .two { background-repeat: repeat; } .three { background-repeat: repeat-x; } .four { backgroun...
...And 2 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. ...
...ts 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. ...
... Candidate Recommendation The shorthand property has been extended...
...And 2 more matches
border-bottom-width - 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. Syntax /* Keyword values */ border-bottom-width: thin; border-bottom-width: medium; border-bottom-width: thick; /* <length> values */ border-bottom-width: 10em; border-bottom-width: 3vmax; border-bottom-width: 6px; /* Global keywords */ border-bottom-width: inherit; border-bottom-width: initial; border-bottom-width: unset; Values <line-width> Defines the width of the border, either as an explicit nonnegative <length> or a keyword. ...
... document. Formal definition Initial valuemediumApplies toall elements. It also applies to ::first-letter.InheritednoComputed valuethe absolute length or 0 if border-bottom-style is none or hiddenAnimation typea length Formal syntax <line-width>where <line-width> = <length> | thin | medium | thick Examples Comparing bottom border widths HTML <div>Element 1</div> <div>Element 2</div> CSS div { border: 1px solid red; margin: 1em 0; } div:nth-child(1) { border-bottom-width: thick; } div:nth-child(2) { border-bottom-width: 2em; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-bottom-width' in that specification. Candidate Recommendation No significant change. ...
... { border: 1px solid red; margin: 1em 0; } div:nth-child(1) { border-bottom-width: thick; } div:nth-child(2) { border-bottom-width: 2em; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-bottom-width' in that specification. Candidate Recommendation No significant change. CSS Level 2 (Revision 1)The definition of 'border-bottom-width' in that specification. Recommendation No significant change. CSS Level 1The definition of 'border-bottom-width' in that specification. Recommendation Initial definition. Browser compatibility The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, pleas...
...And 2 more matches
border-color - CSS: Cascading Style Sheets
The border-color shorthand CSS property sets the color 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. Each side can be set individually using border-top-color, border-right-color, border-bottom-color, and border-left-color; or using the writing mode-aware border-block-start-color, border-block-end-color, border-inline-start-color, and border-inline-end-color. You can find more information about border colors in Borders in Applying color to HTML elements using CSS. ...
...border-top-color, border-right-color, border-bottom-color, and border-left-color; or using the writing mode-aware border-block-start-color, border-block-end-color, border-inline-start-color, and border-inline-end-color. You can find more information about border colors in Borders in Applying color to HTML elements using CSS. ...
... gold;</code></li> <li><code>border-left-color: cyan;</code></li> </ul> </div> <div id="trbl"> <p><code>border-color: red cyan black gold;</code> is equivalent to</p> <ul><li><code>border-top-color: red;</code></li> <li><code>border-right-color: cyan;</code></li> <li><code>border-bottom-color: black;</code></li> <li><code>border-left-color: gold;</code></li> </ul> </div> CSS #justone { border-color: red; } #horzvert { border-color: gold red; } #topvertbott { border-color: red cyan gold; } #trbl { border-color: red cyan black gold; } /* Set width and style for all divs */ div { border: solid 0.3em; width: auto; margin: 0.5em; padding: 0.5em; } ul { margin: 0; list-style: none; } Result Specifications Specification Status ...
...And 2 more matches
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. ...
...te 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. ...
...idth'> | / <'border-image-width'>? / <'border-image-outset'> ]? | <'border-image-repeat'> Examples Bitmap In this example, we will apply a diamond pattern to an element's borders. The source for the border image is a ".png" file of 81 by 81 pixels, with three diamonds going vertically and horizontally: HTML <div id="bitmap">This element is surrounded by a bitmap-based border image!</div> CSS To match the size of a single diamond, we will use a value of 81 divided by 3, or 27, for slicing the image into corner and edge regions. To center the border image on the edge of the element's background, we will make the outset values equal to half of the width values. Finally, a repeat value of round will make the border slices fit evenly, i.e., without clipping or gaps. #bitmap { width: 2...
...And 2 more matches
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. ...
...e 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. ...
...ll the property values. ...
...And 2 more matches
border-width - CSS: Cascading Style Sheets
The border-width shorthand CSS property sets the width 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. ...
... The border-width shorthand CSS property sets the width 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 lengths HTML <p id="sval"> one value: 6px wide border on all 4 sides</p> <p id="bival"> two different values: 2px wide top and bottom border, 10px wide right and left border</p> <p id="treval"> three different values: 0.3em top, 9px bottom, and zero width right and left</p> <p id="fourval"> four different values: "thin" top, "medium" right, "thick" bottom, and 1em left</p> CSS #sval { border: ridge #ccc; border-width: 6px; } #bival { border: solid red; border-width: 2px 10px; } #treval { border: dotted orange; border-width: 0.3em 0 9px; } #fourval { border: solid lightgreen; border-width: thin medium thick 1em; } p { width: auto; margin: 0.25em; padding: 0.25em; } Result Specifications Specification Status Comment ...
...And 2 more matches
box-direction - CSS: Cascading Style Sheets
/* Keyword values */ box-direction: normal; box-direction: reverse; /* Global values */ box-direction: inherit; box-direction: initial; box-direction: unset; Syntax The box-direction property is specified as one of the keyword values listed below. ...
... /* Keyword values */ box-direction: normal; box-direction: reverse; /* Global values */ box-direction: inherit; box-direction: initial; box-direction: unset; Syntax The box-direction property is specified as one of the keyword values listed below. ...
... (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. ...
...And 2 more matches
box-orient - CSS: Cascading Style Sheets
/* Keyword values */ box-orient: horizontal; box-orient: vertical; box-orient: inline-axis; box-orient: block-axis; /* Global values */ box-orient: inherit; box-orient: initial; box-orient: unset; Syntax The box-orient property is specified as one of the keyword values listed below. Values horizontal The box lays out its contents horizontally. vertical The box lays out its contents vertically. ...
...ut its contents vertically. inline-axis (HTML) The box displays its children along the inline axis. block-axis (HTML) The box displays its children along the block axis. The inline and block axes are the writing-mode dependent keywords which, in English, map to horizontal and vertical respectively. Description HTML DOM elements lay out their contents along the inline-axis by default. ...
...box displays its children along the inline axis. block-axis (HTML) The box displays its children along the block axis. The inline and block axes are the writing-mode dependent keywords which, in English, map to horizontal and vertical respectively. Description HTML DOM elements lay out their contents along the inline-axis by default. This CSS property will only apply to HTML elements with a CSS display value of box or inline-box. ...
...And 2 more matches
break-inside - CSS: Cascading Style Sheets
If there is no generated box, the property is ignored. /* Keyword values */ break-inside: auto; break-inside: avoid; break-inside: avoid-page; break-inside: avoid-column; break-inside: avoid-region; /* Global values */ break-inside: inherit; break-inside: initial; break-inside: unset; Each possible break point (in other words, each element boundary) is affected by three properties: the break-after value of the previous element, the break-before value of the next element, and the break-inside value of the containing element. ...
...lum gravida. Morbi metus libero, pharetra non porttitor a, molestie nec nisi.</p> <p>In finibus viverra enim vel suscipit. Quisque consequat velit eu orci malesuada, ut interdum tortor molestie. Proin sed pellentesque augue. Nam risus justo, faucibus non porta a, congue vel massa. Cras luctus lacus nisl, sed tincidunt velit pharetra ac. ...
... Working Draft I...
...And 2 more matches
calc() - CSS: Cascading Style Sheets
Web › CSS › calc
It can be used anywhere a <length>, <frequency>, <angle>, <time>, <percentage>, <number>, or <integer> is allowed. 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 /* property: calc(expression) */ width: calc(100% - 80px); The calc() function takes a single expression as its parameter, with the expression's result used as the value. The expression can be any simple expression combining the following operators, using standard operator precedence rules: + Addition. - Subtraction. * Multiplication. ...
...ive .modal a final z-index value of 2. Note: The Chrome browser currently won't accept some values returned by calc() when an integer is expected. This includes any division, even if it results in an integer. ie. z-index: calc(4 / 2); will not be accepted. Examples Positioning an object on screen with a margin calc() makes it easy to position an object with a set margin. ...
...ckground-color: yellow; padding: 6px; text-align: center; box-sizing: border-box; } <div class="banner">This is a banner!</div> Automatically sizing form fields to fit their container Another use case for calc() is to help ensure that form fields fit in the available space, without extruding past the edge of their container, while maintaining an appropriate margin. Let's look at some CSS: input { padding: 2px; display: block; width: calc(100% - 1em); } #formbox { width: calc(100% / 6); border: 1px solid black; padding: 4px; } Here, the form itself is established to use 1/6 of the available window width. Then, to ensure that input fields retain an appropriate size, we use calc() again to establish that they should be the width of their container minus 1em. Then, th...
...And 2 more matches
columns - CSS: Cascading Style Sheets
Web › CSS › columns
The columns CSS shorthand property sets the number of columns to use when drawing an element's contents, as well as those columns' widths. 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. ...
...s the number of columns to use when drawing an element's contents, as well as those columns' widths. 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: column-count column-width Syntax /* Column width */ columns: 18em; /* Column count */ columns: auto; columns: 2; /* Both column width and count */ columns: 2 auto; columns: auto 12em; columns: auto auto; /* Global values */ columns: inherit; columns: initial; columns: unset; The columns property may be specified as one or two of the values listed below, in any order. Value...
... Working Draft Initial definition. ...
...And 2 more matches
conic-gradient() - CSS: Cascading Style Sheets
Example conic gradients include pie charts and color wheels. The result of the conic-gradient() function is an object of the <gradient> data type, which is a special kind of <image>. 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. ...
... circumference axis). <color-hint> Th color-hint is an interpolation hint defining how the gradient progresses between adjacent color stops. The length defines at which point between two color stops the gradient color should reach the midpoint of the color transition. If omitted, the midpoint of the color transition is the midpoint between two color stops. Note: Rendering of color stops in CSS gradients follows the same rules as color stops in SVG gradients. Description As with any gradient, a conic gradient has no intrinsic dimensions; i.e., it has no natural or preferred size, nor a preferred ratio. Its concrete size will match the size of the element it applies to, or size of the <image> is set to something other than the element size. To create a conic gradient that repeats...
...ts, but don't. The above is hard to read. Accessibility concerns Browsers do not provide any special information on background images to assistive technology. This is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. While it is possible to create pie charts, checkerboards, and other effects with conic gradients, CSS images provide no native way to assign alternative text, and therefore the image represented by the conic gradient will not be accessible to screen reader users. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. MDN Understanding WCAG, Guideline 1.1 explanations Understanding Success Criterion 1.1.
...And 2 more matches
counter() - CSS: Cascading Style Sheets
Web › CSS › counter
Check the Browser compatibility table carefully before using this in production. ...
...an be used, theoretically, anywhere a <string> value is supported. /* Simple usage */ counter(countername); /* changing the counter display */ counter(countername, upper-roman) A counter has no visible effect by itself. The counter() function (and counters() function) is what makes it useful by returning developer defined strings (or images). Note: The counter() function can be used with any CSS property, but support for properties other than content is experimental, 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 da...
...d east Asian or Ethiopic predefined counter style, or other predefined counter style. ...
...And 2 more matches
<display-box> - CSS: Cascading Style Sheets
See Appendix B: Effects of display: contents on Unusual Elements for more details. ...
...See Appendix B: Effects of display: contents on Unusual Elements for more details. ...
...y rendering anything, use the visibility property instead. Accessibility concerns Current implementations in most browsers will remove from the accessibility tree any element with a display value of contents. This will cause the element -- and in some browser versions, its descendant elements -- to no longer be announced by screen reading technology. ...
...And 2 more matches
float - CSS: Cascading Style Sheets
Web › CSS › float
The element is removed from the normal flow of the page, though still remaining a part of the flow (in contrast to absolute positioning). 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 floating element is one where the computed value of float is not none. ...
...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: r...
... 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; /* Global values */ float: inherit; float: initial; float: unset; The float property is specified as a single keyword, cho...
...And 2 more matches
font-stretch - CSS: Cascading Style Sheets
/* Keyword values */ font-stretch: ultra-condensed; font-stretch: extra-condensed; font-stretch: condensed; font-stretch: semi-condensed; font-stretch: normal; font-stretch: semi-expanded; font-stretch: expanded; font-stretch: extra-expanded; font-stretch: ultra-expanded; /* Percentage values */ font-stretch: 50%; font-stretch: 100%; font-stretch: 200%; /* Global values */ font-stretch: inherit; font-stretch: initial; font-stretch: unset; Syntax This property may be specified as a single keyword value or a single <percentage> value. Values normal Specifies a normal font face. ...
...s the most condensed. semi-expanded, expanded, extra-expanded, ultra-expanded Specifies a more expanded font face than normal, with ultra-expanded as the most expanded. <percentage> A <percentage> value between 50% and 200% (inclusive). Negative values are not allowed for this property. In earlier versions of the font-stretch specification, the property accepts only the nine keyword values. CSS Fonts Level 4 extends the syntax to accept a <percentage> value as well. This enables variable fonts to offer something more like a continuum of character widths. For TrueType or OpenType variable fonts, the "wdth" variation is used to implement varying widths. However, note that the <percentage> syntax is not yet supported by all browsers: check the Browser compatibility table for details. Key...
...ensed | semi-expanded | expanded | extra-expanded | ultra-expanded | <percentage> Examples Setting font stretch percentages Note that this example will only work in browsers that support <percentage> values. ...
...And 2 more matches
gap (grid-gap) - CSS: Cascading Style Sheets
Web › CSS › gap
This prefixed property is being replaced by gap. However, in order to support browsers that implemented grid-gap and not gap for grid, you will need to use the prefixed property as in the interactive example above. ...
...This prefixed property is being replaced by gap. However, in order to support browsers that implemented grid-gap and not gap for grid, you will need to use the prefixed property as in the interactive example above. ...
...de absolute, and normal computing to zero except on multi-column elementsAnimation typeas each of the properties of the shorthand:row-gap: a length, percentage or calc();column-gap: a length, percentage or calc(); Formal syntax <'row-gap'> <'column-gap'>? ...
...And 2 more matches
image-orientation - CSS: Cascading Style Sheets
It should not be used for any other orientation adjustments; instead, the transform property should be used with the rotate <transform-function>. Warning: This property is deprecated in the specification. Its functionality may be moved into properties on the <img> and/or <picture> elements, with the possible exception of from-image. The flip and <angle> values were made obsolete in Firefox 63. /* keyword values */ image-orientation: none; image-orientation: from-image; /* Use EXIF data from the image */ /* Global values */ image-orientation: inherit; image-orientation: initial; image-orientation: unset; /* Obsolete Values. ...
...ntation: unset; /* Obsolete Values. Obsolete since Gecko 63 */ image-orientation: 90deg; /* Rotate 90deg */ image-orientation: 90deg flip; /* Rotate 90deg, and flip it horizontally */ image-orientation: flip; /* No rotation, only applies a horizontal flip */ Syntax Values none Default initial value. Will not apply any additional image rotation; the image is oriented as encoded or as other CSS property values dictate. from-image The EXIF information contained in the image will be used to rotate the image appropriately. <angle> Obsolete since Gecko 63 The <angle> of rotation to apply to the image. It is rounded to the nearest 90deg (0.25turn). flip Obsolete since Gecko 63 The image is flipped horizontally (i.e., reflected) after the rotation given by the <angle> value is applied...
...ed. It should not be used for arbitrary rotations. For any purpose other than correcting an image's orientation due to how it was shot or scanned, use a transform property with the rotate keyword to specify rotation. This includes any user-directed changes to the orientation of the image, or changes required for printing in portrait versus landscape orientation. If used in conjunction with other CSS properties, such as a <transform-function>, any image-orientation rotation is applied before any other transformations. Formal definition Initial value0degApplies toall elementsInheritedyesComputed valuean <angle>, rounded to the next quarter turn from 0deg and normalized, that is moduloing the value by 1turnAnimation typediscrete Formal syntax from-image | <angle> | [ <angle>? flip ] Exampl...
...And 2 more matches
list-style-type - 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 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. 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. ...
... Extends the syntax to support @count...
... Extends the syntax to support @counter-style rules. ...
...And 2 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. ...
...tive-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. ...
... Recommendation Initial definition. ...
...And 2 more matches
object-fit - CSS: Cascading Style Sheets
You can alter the alignment of the replaced element's content object within the element's box using the object-position 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. Syntax The object-fit property is specified as a single keyword chosen from the list of values below. Values contain The replaced content is scaled to maintain its aspect ratio while fitting within the element's content box. ...
...48a9938d9.png" alt="MDN Logo"> <img class="none narrow" src="https://udn.realityripple.com/samples/ae/248a9938d9.png" alt="MDN Logo"> <h2>object-fit: scale-down</h2> <img class="scale-down" src="https://udn.realityripple.com/samples/ae/248a9938d9.png" alt="MDN Logo"> <img class="scale-down narrow" src="https://udn.realityripple.com/samples/ae/248a9938d9.png" alt="MDN Logo"> </section> CSS h2 { font-family: Courier New, monospace; font-size: 1em; margin: 1em 0 0.3em; } div { display: flex; flex-direction: column; flex-wrap: wrap; align-items: flex-start; height: 940px; } img { width: 150px; height: 100px; border: 1px solid #000; } .narrow { width: 100px; height: 150px; margin-top: 10px; } .fill { object-fit: fill; } .contain { object-fit: conta...
... 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...
...And 2 more matches
offset-path - CSS: Cascading Style Sheets
The offset-path CSS property specifies a motion path for an element to follow and defines the element's positioning within the parent container or SVG coordinate system. Syntax /* Default */ offset-path: none; /* Function values */ offset-path: ray(45deg closest-side contain); /* URL */ offset-path: url(#path); /* Shapes */ offset-path: circle(50% at 25% 25%); offset-path: inset(50% 50% 50% 50%); offset-path: polygon(30% 0%, 70% 0%, 100% 50%, 30% 100%, 0% 70%, 0% 30%); offset-path: path('M 0,200 Q 200,200 260,80 Q 290,20 400,0 Q 300,100 400,200'); /* Geometry Boxes */ offset-path: margin-box; offset-path: stroke-box; /* Global values */ offset-path: inherit; offset-path: initial; offset-path: unset; Values ray() Taking up to three values, defines a path that is a line segment ...
... url() References the ID of an SVG shape -- circle, ellipse, line, path, polygon, polyline, or rect -- using the shape's geometry as the path. <basic-shape> Specifies ...
...offset-path: inherit; offset-path: initial; offset-path: unset; Values ray() Taking up to three values, defines a path that is a line segment starting from the position of the box and proceeds in the direction defined by the specified angle similar to the CSS gradient angle where 0deg is up, with positive angles increasing in the clockwise direction, with the size value being similar to the CSS radial gradient size values from closest-side to farthest-corner, and the keyterm contain. url() References the ID of an SVG shape -- circle, ellipse, line, path, polygon, polyline, or rect -- using the shape's geometry 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.
...And 2 more matches
outline-style - CSS: Cascading Style Sheets
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. ...
... Formal definition Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax auto | <'border-style'> Examples Setting outline style to auto The auto value indicates a custom outline style -- typically a style [that] is either a user interface default for the platform, or perhaps a style that is richer than can be described in detail in CSS, e.g. a rounded edge outline with semi-translucent outer pixels that appears to glow. HTML <div> <p class="auto">Outline Demo</p> </div> CSS .auto { outline-style: auto; /* same result as "outline: auto" */ } /* To make the Demo clearer */ * { outline-width: 10px; padding: 15px; } Result Setting outline style to dashed and dotted HTML <div> <div class="dotted"> <p class="da...
...ranslucent outer pixels that appears to glow. ...
...And 2 more matches
perspective - 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. Syntax /* Keyword value */ perspective: none; /* <length> values */ perspective: 20px; perspective: 3.5em; /* Global values */ perspective: inherit; perspective: initial; perspective: unset; Values none Indicates that no perspective transform is to be applied. <length> A <length> giving the distance from the user to the z=0 plane. ...
...t and its content. If the value is 0 or a negative number, no perspective transform is applied. Description Each 3D element with z>0 becomes larger; each 3D-element with z<0 becomes smaller. The strength of the effect is determined by the value of this property. The parts of the 3D elements that are behind the user -- i.e. their z-axis coordinates are greater than the value of the perspective CSS property -- are not drawn. The vanishing point is by default placed at the center of the element, but its position can be changed using the perspective-origin property. Using this property with a value different than 0 and none creates a new stacking context. Also, in that case, the object will act as a containing block for position: fixed elements that it contains. Formal definition Initial ...
...It also includes classes for the container box and the cube itself, as well as each of its faces. /* Shorthand classes for different perspective values */ .pers250 { perspective: 250px; } .pers350 { perspective: 350px; } .pers500 { perspective: 500px; } .pers650 { perspective: 650px; } /* Def...
...And 2 more matches
repeating-conic-gradient() - CSS: Cascading Style Sheets
{{EmbedInteractiveExample("pages/css/function-repeating-conic-gradient.html")}} 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. ...
...e repeating gradient. <color-hint> Th color-hint is an interpolation hint defining how the gradient progresses between adjacent color stops. The length defines at which point between two color stops the gradient color should reach the midpoint of the color transition. If omitted, the midpoint of the color transition is the midpoint between two color stops. Note: Rendering of color stops in CSS gradients follows the same rules as color stops in SVG gradients. Description Example repeating conic gradients include starbursts. The result of the repeating-conic-gradient() function is an object of the <gradient> data type, which is a special kind of <image>. If neither the first nor the last color stops include include a a color stop angle greater than 0deg or less than 360 degrees r...
...r transition. You can move this color transition midpoint to any point between two color stops by adding a color hint, indicating where the middle of the color transition should be. If two or more color stops are at the same location, the transition will be a hard line between the first and last colors declared at that location. While you can mix and match different angle units, don't. ...
...And 2 more matches
resize - CSS: Cascading Style Sheets
Web › CSS › resize
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 /* Keyword values */ resize: none; resize: both; resize: horizontal; resize: vertical; resize: block; resize: inline; /* Global values */ resize: inherit; resize: initial; resize: unset; The resize property is specified as a single keyword value from the list below. Values none The element offers no user-controllable method for resizing it. ...
... elements representing images or videos, and iframesInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax none | both | horizontal | vertical | block | inline Examples Disabling resizability of textareas In many browsers, <textarea> elements are resizable by default. You may override this behavior with the resize property. ...
...re.</textarea> CSS textarea { resize: none; /* Disables resizability */ } Result Using resize with arbitrary elements You can use the resize property to make any element resizable. In the example below, a resizable <div> contains a resizable paragraph (<p> element). HTML <div class="resizable"> <p class="resizable"> This paragraph is resizable in all directions, because the CSS `resize` property is set to `both` on this element. ...
...And 2 more matches
right - CSS: Cascading Style Sheets
Web › CSS › right
It has no effect on non-positioned elements. 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 /* <length> values */ right: 3px; right: 2.4em; /* <percentage>s of the width of the containing block */ right: 10%; /* Keyword value */ right: auto; /* Global values */ right: inherit; right: initial; right: unset; Values <length> A negative, null, or positive <length> that represents: for absolutely positioned elements, the distance to the right edge of the containing block. ...
...g blockComputed valueif specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, autoAnimation typea length, percentage or calc(); Formal syntax <length> | <percentage> | auto Examples Absolute and relative positioning using right HTML <div id="relative">Relatively positioned</div> <div id="absolute">Absolutely positioned</div> CSS #relative { width: 100px; height: 100px; background-color: #FFC7E4; position: relative; top: 20px; left: 20px; } #absolute { width: 100px; height: 100px; background-color: #FFD7C2; position: absolute; bottom: 10px; right: 20px; } Result Declaring both left and right When both left and right are declared, the element will stretch to meet both, unless other constr...
...shrink to meet meet both. When the position of the element is overspecified, the precende is based on the container's direction: The left will take precendence if the container's direction is left-to-right. The right will take precedence if the container's direction is right-to-left. ...
...And 2 more matches
shape-outside - CSS: Cascading Style Sheets
By default, inline content wraps around its margin box; shape-outside provides a way to customize this wrapping, making it possible to wrap text around complex objects rather than simple boxes. 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. ...
...ied using the values from the list below, which define the float area for float elements. The float area determines the shape around which inline content (float elements) wrap. Values none The float area is unaffected. Inline content wraps around the element's margin box, like usual. <shape-box> The float area is computed according to the shape of a float element's edges (as defined by the CSS box model). This can be margin-box, border-box, padding-box, or content-box. The shape includes any curvature created by the border-radius property (behavior which is similar to background-clip). margin-box Defines the shape enclosed by the outside margin edge. The corner radii of this shape are determined by the corresponding border-radius and margin values. If the border-radius / margin...
...or-stop-angle> = <angle-percentage>{1,2}<angle-percentage> = <angle> | <percentage> Examples Funneling text HTML <div class="main"> <div class="left"></div> <div class="right"></div> <p> Sometimes a web page's text content appears to be funneling your attention towards a spot on the page to drive you to follow a particular link. Sometimes you don't notice. ...
...And 2 more matches
Specified value - CSS: Cascading Style Sheets
The specified value of a CSS property is the value it receives from the document's style sheet. The specified value for a given property is determined according to the following rules: If the document's style sheet explicitly specifies a value for the property, the given value will be used. If the document's style sheet doesn't specify a value but it is an inherited property, the value will be taken from the parent element. If none of the above pertain, the element's initial value will be used. ...
...owing rules: If the document's style sheet explicitly specifies a value for the property, the given value will be used. If the document's style sheet doesn't specify a value but it is an inherited property, the value will be taken from the parent element. If none of the above pertain, the element's initial value will be used. ...
...ocument's style sheet doesn't specify a value but it is an inherited property, the value will be taken from the parent element. If none of the above pertain, the element's initial value will be used. ...
...And 2 more matches
text-decoration - CSS: Cascading Style Sheets
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. ...
...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 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 col...
... Candidate Recommendation Transformed into a shorthand property. Added support for the value of text-decoration-style. ...
...And 2 more matches
text-indent - 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. Horizontal spacing is with respect to the left (or right, for right-to-left layout) edge of the containing block-level element's content box. ...
...e?where <length-percentage> = <length> | <percentage> Examples Simple indent HTML <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p> CSS p { text-indent: 5em; background: powderblue; } Result Percentage indent HTML <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p...
... Recommendation The behavior with di...
...And 2 more matches
<transform-function> - CSS: Cascading Style Sheets
Transformation functions can rotate, resize, distort, or move an element in 2D or 3D space. It is used in the transform property. Syntax The <transform-function> data type is specified using one of the transformation functions listed below. Each function applies a geometric operation in either 2D or 3D. Matrix transformation matrix() Describes a homogeneous 2D transformation matrix. matrix3d() Describes a 3D transformation as a 4x4 homogeneous matrix. Perspective perspective() Sets the distance between the user and the z=0 plane. Rotation rotate() Rotates an element around a fixed point on the 2D plane. ...
...ze and shape, as well as any transformations applied to it. The most common is the Cartesian coordinate system, although homogeneous coordinates are also sometimes used. Cartesian coordinates In the Cartesian coordinate system, a two-dimensional point is described using two values: an x coordinate (abscissa) and a y coordinate (ordinate). This is represented by the vector notation (x, y). In CSS (and most computer graphics), the origin (0, 0) represents the top-left corner of any element. Positive coordinates are down and to the right of the origin, while negative ones are up and to the left. Thus, a point that's 2 units to the right and 5 units down would be (2, 5), while a point 3 units to the left and 12 units up would be (-3, -12). Transformation functions Transformation functions ...
...slate(100px, 100px)</option> <option>translateX(100px)</option> <option>translateY(100px)</option> <option>translateZ(100px)</option> <option>translate3d(50px, 50px, 50px)</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:...
...And 2 more matches
transform - CSS: Cascading Style Sheets
Web › CSS › transform
The transform CSS property lets you rotate, scale, skew, or translate an element. It modifies the coordinate space of the CSS visual formatting model. 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 property has a value different than none, a stacking context will be created. In that case, the element will act as a containing block for any position: fixed; or position: absolute; elements that it contains. Only transformable elements can be transformed. ...
...clone https://github.com/mdn/interactive-examples and send us a pull request. If the property has a value different than none, a stacking context will be created. In that case, the element will act as a containing block for any position: fixed; or position: absolute; elements that it contains. Only transformable elements can be transformed. That is, all elements whose layout is governed by the CSS box model except for: non-replaced inline boxes, table-column boxes, and table-column-group boxes. Syntax /* Keyword values */ transform: none; /* Function values */ transform: matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0); transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: perspective(17px); transform: rotate(0.5turn); transform: rotate3d(1, 2.0, 3.0, 10deg); transform: r...
...ansform: perspective(500px) translate(10px, 0, 20px) rotateY(3deg); /* Global values */ transform: inherit; transform: initial; transform: unset; The transform property may be specified as either the keyword value none or as one or more <transform-function> values. If perspective() is one of multiple function values, it must be listed first. Values <transform-function> One or more of the CSS transform functions to be applied. The transform functions are multiplied in order from left to right, meaning that composite transforms are effectively applied in order from right to left. none Specifies that no transform should be applied. Accessibility concerns Scaling/zooming animations are problematic for accessibility, as they are a common trigger for certain types of migraine. If you ...
...And 2 more matches
transition-timing-function - 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. This, in essence, lets you establish an acceleration curve so that the speed of the transition can vary over its duration. This acceleration curve is defined using one <timing-function> for each property to be transitioned. ...
...ed by the transition-property property, which acts as a transition-property list. If there are fewer timing functions specified than in the transition-property list, the user agent must calculate which value is used by repeating the list of values until there is one for each transition property. If there are more timing functions, the list is simply truncated to the right size. In both cases, the CSS declaration stays valid. Syntax /* Keyword values */ transition-timing-function: ease; transition-timing-function: ease-in; transition-timing-function: ease-out; transition-timing-function: ease-in-out; transition-timing-function: linear; transition-timing-function: step-start; transition-timing-function: step-end; /* Function values */ transition-timing-function: steps(4, jump-end); transitio...
.... ...
...And 2 more matches
transition - CSS: Cascading Style Sheets
The transition CSS property is a shorthand property for transition-property, transition-duration, transition-timing-function, and transition-delay. 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. Transitions enable you to define the transition between two states of an element. Different states may be defined using pseudo-classes like :hover or :active or dynamically set using JavaScript. ...
...ontribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Transitions enable you to define the transition between two states of an element. Different states may be defined using pseudo-classes like :hover or :active or dynamically set using JavaScript. ...
...d as one or more single-property transitions, separated by commas. Each single-property transition describes the transition that should be applied to a single property (or the special values all and none). It includes: zero or one value representing the property to which the transition should apply. This may be any one of: the keyword none the keyword all a <custom-ident> naming a CSS property. zero or one <single-transition-timing-function> value representing the timing function to use zero, one, or two <time> values. The first value that can be parsed as a time is assigned to the transition-duration, and the second value that can be parsed as a time is assigned to transition-delay. See how things are handled when lists of property values aren't the same length. In s...
...And 2 more matches
CSS Flexbox Inspector: Examine Flexbox layouts - Firefox Developer Tools
Discovering Flex Containers When an HTML element on your page has display: flex applied to it, a number of features are made available in the DevTools to provide easy access to Flexbox layout features. In the HTML pane In the HTML Pane, an element laid out with Flexbox has the word flex next to it as shown in the following image: Click the word flex in the HTML pane to keep the overlay visible when you move the mouse away from the container. ...
... over an element in the HTML pane, you will see a tooltip that gives you more information about the element. When you hover over a flex container or flex item, the tooltip includes the appropriate information. This header is a flex container: Each navbar link is a flex item: The nav element within the header is both a flex item and a flex container which holds the navigation links: In the CSS pane In the CSS pane's Rules view, any instance of a display: flex declaration gets a small Flexbox icon next to the word flex. Clicking the icon toggles the display of an overlay on the page, which appears over the selected flex container that displays an outline around each flex item: The overlay will still be shown when you select other elements from the Inspector panel, so you can edi...
...If you expand the section without selecting a flexbox container, it will only display the message, "Select a Flex container or item to continue". ...
...rd flex. Clicking the icon toggles the display of an overlay on the page, which appears over the selected flex container that displays an outline around each flex item: The overlay will still be shown when you select other elements from the Inspector panel, so you can edit related CSS properties and see how the flex items are affected by your changes. The Layout Flex Container section The CSS pane's Layout view includes a collapsible "Flex Container" section. If you expand the section without selecting a flexbox container, it will only display the message, "Select a Flex container or item to continue". Once you select an element whose display is defined as flex, the panel will include a number of options for viewing details about the flex container and flex items within it. You can fi...
CSS Grid Inspector: Examine grid layouts - Firefox Developer Tools
The Grid Inspector allows you to examine CSS Grid Layouts using the Firefox DevTools, discovering grids present on a page, examining and modifying them, debugging layout issues, and more. Note: The examples shown in the screenshots appearing in this article are Jen Simmons' Futurismo and Variations on a grid experiments, and a live named grid area example from Rachel Andrew. Discovering CSS grids When an HTML element on your page has display: grid applied to it, a number of features are made available in the DevTools to provide easy access to grid features. In the HTML pane In the HTML Pane, elements laid out using a grid have a "grid" marker beside them. ...
...rismo and Variations on a grid experiments, and a live named grid area example from Rachel Andrew. Discovering CSS grids When an HTML element on your page has display: grid applied to it, a number of features are made available in the DevTools to provide easy access to grid features. In the HTML pane In the HTML Pane, elements laid out using a grid have a "grid" marker beside them. In the CSS pane In the CSS pane's Rules view, any instance of a display: grid declaration gets a grid icon included within it: . ...
...You can find out more about those in the section below. Note: The Layout view can be found underneath the Layout tab on the right-hand pane of the Page Inspector. ...
...luded within it: . Clicking the icon toggles the display of a grid overlay on the page, which appears over the element, laid out like a grid to show the position of its grid lines and tracks: The overlay is still shown when you select other elements, so you can edit related CSS properties and see how the grid is affected. The Layout view Grid section When grids are included on a page, the CSS pane's Layout view includes a "Grid" section containing a number of options for viewing those Grids. You can find out more about those in the section below. Note: The Layout view can be found underneath the Layout tab on the right-hand pane of the Page Inspector. The above and below screenshots should give you further hints on how to get to this. Grid options The Grid section of the Layout v...
CSS.registerProperty() - Web APIs
syntax Optional A DOMString representing the expected syntax of the defined property. Defaults to "*". ...
...S.registerProperty() method registers custom properties, allowing for property type checking, default values, and properties that do or do not inherit their value. Registering a custom property allows you to tell the browser how the custom property should behave; what are allowed types, whether the custom property inherits its value, and what the default value of the custom property is. Syntax CSS.registerProperty(PropertyDefinition); Parameters A PropertyDefinition dictionary object, which can contain the following members: name A DOMString indicating the name of the property being defined. syntax Optional A DOMString representing the expected syntax of the defined property. Defaults to "*". inherits A boolean value defining whether the defined property should be inherited (true...
...en name has already been registered. SyntaxError The given name isn't a valid custom property name (starts with two dashes, e.g. --foo). TypeError The required name and/or inherits dictionary members were not provided. Examples The following will register a custom property, --my-color, using registerProperty(), as a color, give it a default value, and have it not inherit its value: window.CSS.registerProperty({ name: '--my-color', syntax: '<color>', inherits: false, initialValue: '#c0ffee', }); In this example, the custom property --my-color has been registered using the syntax <color> . We can now use that property to transition a gradient on hover or focus. Notice that with the registered property the transition works, but that it doesn't with the unregistered property! .
... Working Draft Initial definition. ...
CSS - Web APIs
Web › API › CSS
The CSS interface holds useful CSS-related methods. No objects with this interface are implemented: it contains only static methods and is therefore a utilitarian interface. Properties The CSS interface is a utility interface and no object of this type can be created: only static properties are defined on it. Static properties CSS.paintWorklet Secure context Provides access to the Worklet responsible for all the classes related to painting. Methods The CSS interface is a utility interface and no object of this type can be created: only static methods are defined on it. Static methods No inherited static methods. CSS.registerProperty() Registers custom properties, allowing for property type checking, default values, and properties that do or do not inherit their value. ...
...et responsible for all the classes related to painting. Methods The CSS interface is a utility interface and no object of this type can be created: only static methods are defined on it. Static methods No inherited static methods. CSS.registerProperty() Registers custom properties, allowing for property type checking, default values, and properties that do or do not inherit their value. CSS.supports() Returns a Boolean indicating if the pair property-value, or the condition, given in parameter is supported. CSS.escape() Can be used to escape a string mostly for use as part of a CSS selector. ...
...erited static methods. CSS.registerProperty() Registers custom properties, allowing for property type checking, default values, and properties that do or do not inherit their value. CSS.supports() Returns a Boolean indicating if the pair property-value, or the condition, given in parameter is supported. CSS.escape() Can be used to escape a string mostly for use as part of a CSS selector. CSS factory functions Can be used to return a new CSSUnitValue with a value of the parameter number of the units of the name of the factory function method used. CSS.em(3) // CSSUnitValue {value: 3, unit: "em"} Specifications Specification Status Comment CSS Painting API Level 1The definition of 'paintWorklet' in that specification. Working Draft Adds the pa...
...turn a new CSSUnitValue with a value of the parameter number of the units of the name of the factory function method used. CSS.em(3) // CSSUnitValue {value: 3, unit: "em"} Specifications Specification Status Comment CSS Painting API Level 1The definition of 'paintWorklet' in that specification. Working Draft Adds the paintWorklet static property. CSS Object Model (CSSOM)The definition of 'CSS' in that specification. Working Draft Adds the escape() static method. CSS Conditional Rules Module Level 3The definition of 'CSS' in that specification. Candidate Recommendation Initial definition ...
CSSKeyframesRule - Web APIs
The CSSKeyframesRule interface describes an object representing a complete set of keyframes for a CSS animation. It corresponds to the contents of a whole @keyframes at-rule. It implements the CSSRule interface with a type value of 7 (CSSRule.KEYFRAMES_RULE). Properties As a CSSRule, CSSKeyframesRule also implements the properties of these interfaces. It has two properties : CSSKeyframesRule.name Represents the name of the animation, used by the animation-name property. CSSKeyframesRule.cssRules Read only Returns a CSSRuleList of the CSS rules in the media rule. Methods As a CSSRule, CSSKeyframesRule also implements the methods of that interface. ...
...le also implements the properties of these interfaces. It has two properties : CSSKeyframesRule.name Represents the name of the animation, used by the animation-name property. CSSKeyframesRule.cssRules Read only Returns a CSSRuleList of the CSS rules in the media rule. Methods As a CSSRule, CSSKeyframesRule also implements the methods of that interface. It has three specific methods: CSSKeyframesRule.appendRule() Inserts a new keyframe rule into the current CSSKeyframesRule. The parameter is a DOMString containing a keyframe in the same format as an entry of a @keyframes at-rule. If it contains more than one keyframe rule, a DOMException with a SYNTAX_ERR is thrown. CSSKeyframesRule.deleteRule() Deletes a keyframe rule from the current CSSKeyframesRule. The parameter is the in...
... is a DOMString containing a keyframe in the same format as an entry of a @keyframes at-rule. If it contains more than one keyframe rule, a DOMException with a SYNTAX_ERR is thrown. CSSKeyframesRule.deleteRule() Deletes a keyframe rule from the current CSSKeyframesRule. The parameter is the index of the keyframe to be deleted, expressed as a DOMString resolving as a number between 0% and 100%. CSSKeyframesRule.findRule() Returns a keyframe rule corresponding to the given key. The key is a DOMString containing an index of the keyframe to be returned, resolving to a percentage between 0% and 100%. ...
...xpressed as a DOMString resolving as a number between 0% and 100%. CSSKeyframesRule.findRule() Returns a keyframe rule corresponding to the given key. The key is a DOMString containing an index of the keyframe to be returned, resolving to a percentage between 0% and 100%. If no such keyframe exists, findRule returns null. Specification Specification Status Comment CSS AnimationsThe definition of 'CSSKeyframesRule' in that specification. Working Draft Initial definition ...
CSSMathValue.operator - Web APIs
The CSSMathValue.operator read-only property of the CSSMathValue interface indicates the operator that the current subtype represents. For example, if the current CSSMathValue subtype is CSSMathSum, this property will return the string "sum". Syntax var aString = CSSMathValue.operator; Value A String. Interface Value CSSMathSum "sum" CSSMathProduct "product" CSSMathMin "min" CSSMathMax "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. <div>My width has a <code>calc()</code> function</div> We assign a width with a calculation div { width: c...
... Examples We create an element with a width determined using a calc() function, then console.log() the operator. ...
...ate an element with a width determined using a 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. Speci...
...).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 Comment CSS Typed OM Level 1The definition of 'CSSMathValue.operator' in that specification. Working Draft Initial definition. ...
CSSNamespaceRule.namespaceURI - Web APIs
Working Draft Initial definition. ...
... Working Draft Initial definition. ...
... Working Draft Initial definition. ...
... Working Draft Initial definition. ...
CSSNamespaceRule.prefix - Web APIs
Working Draft Initial definition. ...
... Working Draft Initial definition. ...
... Working Draft Initial definition. ...
... Working Draft Initial definition. ...
CSSPositionValue.x - Web APIs
The x property of the CSSPositionValue interface returns returns the item's position along the web page's horizontal axis. Syntax var x = CSSPositionValue.x Value A CSSNumericValue. Example The following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. ...
... The x property of the CSSPositionValue interface returns returns the item's position along the web page's horizontal axis. Syntax var x = CSSPositionValue.x Value A CSSNumericValue. Example The following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. ...
...The x property of the CSSPositionValue interface returns returns the item's position along the web page's horizontal axis. Syntax var x = CSSPositionValue.x Value A CSSNumericValue. Example The following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. ...
...rty of the CSSPositionValue interface returns returns the item's position along the web page's horizontal axis. Syntax var x = CSSPositionValue.x Value A CSSNumericValue. Example The following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. ...
CSSPositionValue.y - Web APIs
The y property of the CSSPositionValue interface returns the item's position along the vertical axis. Syntax var y = CSSPositionValue.y Value A CSSNumericValue. Example The following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. ...
... The y property of the CSSPositionValue interface returns the item's position along the vertical axis. Syntax var y = CSSPositionValue.y Value A CSSNumericValue. Example The following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. ...
... The y property of the CSSPositionValue interface returns the item's position along the vertical axis. Syntax var y = CSSPositionValue.y Value A CSSNumericValue. Example The following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. ...
... The y property of the CSSPositionValue interface returns the item's position along the vertical axis. Syntax var y = CSSPositionValue.y Value A CSSNumericValue. Example The following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. ...
CSSPrimitiveValue.setStringValue() - Web APIs
stringValue A DOMString representing the new string value. Return value Void. ...
...Possible values are: Constant Description CSS_ATTR The value is an attr() function. ...
...d to set a string value. If the property attached to this value can't accept the specified unit or the string value, the value will be unchanged and a DOMException will be raised. Syntax cssPrimitiveValue.setStringValue(stringType, stringValue); Parameters stringType An unsigned short representing the type of the value. Possible values are: Constant Description CSS_ATTR The value is an attr() function. CSS_IDENT The value is an identifier. CSS_STRING The value is a <string>. CSS_URI The value is a <uri>. stringValue A DOMString representing the new string value. Return value Void. Exceptions Type Description DOMException An INVALID_ACCESS_ERR is raised if the C...
... DOMException An INVALID_ACCESS_ERR is raised if the CSS value doesn't contain a string value or if the string value can't be converted into the specified unit. An NO_MODIFICATION_ALLOWED_ERR is raised if this property is read-only. Specifications Specification Status Comment Document Object Model (DOM) Level 2 Style SpecificationThe definition of 'CSSPrimitiveValue.setStringValue' in that specification. Obsolete Initial definition ...
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 n...
...ead here, only via its parent stylesheet. In fact, .insertRule() and .deleteRule() are not even methods of CSSRuleList, but only of CSSStyleSheet. ...
...f 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. Example // get the first style sheet's first rule var first_rule = document.styleSheets[0].cssRules[0]; See also CSSRule CSSRuleList implementations There are multiple properties in the CSSOM that will return a CSSRuleList. ...
...ly), 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. Example // get the first style sheet's first rule var first_rule = document.styleSheets[0].cssRules[0]; See also CSSRule CSSRuleList implementations There are multiple properties in the CSSOM that will return a CSSRuleList. They are: CSSStyleSheet property cssRules CSSMediaRule property cssRules CSSKeyframesRule property cssRules CSSMozDocumentRule property cssRules Specifications Specification Status Comment CSS Object Model (CSSOM)The definition of 'CSSRuleList' in that specification. Working Draft ...
CSSStyleSheet.ownerRule - Web APIs
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. ...
... 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. ...
... 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. ...
...his 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 Draft ...
CSSUnparsedValue.entries() - Web APIs
Working Draft Initial definition. ...
... Working Draft Initial definition. ...
... Working Draft Initial definition. ...
...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). Syntax CSSUnparsedValue.entries(obj) Parameters obj The CSSUnparsedValue whose enumerable own property [key, value] pairs are to be returned. Return value An array of the given CSSUnparsedValue object's own enumerable property [key, value] pairs. Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'entries()' in that specification. Working Draft Initial definition. ...
CSSUnparsedValue.values() - Web APIs
Working Draft Initial definition. ...
... Working Draft Initial definition. ...
... Working Draft Initial definition. ...
... Working Draft Initial definition. ...
CSSUnparsedValue - Web APIs
The CSSUnparsedValue interface of the CSS Typed Object Model API represents property values that reference custom properties. It consists of a list of string fragments and variable references. Custom properties are represented by CSSUnparsedValue and var() references are represented using CSSVariableReferenceValue. Constructor CSSUnparsedValue.CSSUnparsedValue() Creates a new CSSUnparsedValue object. Properties CSSUnparsedValue.length Returns the number of items in the CSSUnparsedValue object. ...
.... It consists of a list of string fragments and variable references. Custom properties are represented by CSSUnparsedValue and var() references are represented using CSSVariableReferenceValue. Constructor CSSUnparsedValue.CSSUnparsedValue() Creates a new CSSUnparsedValue object. Properties CSSUnparsedValue.length Returns the number of items in the CSSUnparsedValue object. Methods CSSUnparsedValue.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). ...
...w CSSUnparsedValue object. Properties CSSUnparsedValue.length Returns the number of items in the CSSUnparsedValue object. Methods CSSUnparsedValue.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). CSSUnparsedValue.forEach() Executes a provided function once for each element of the CSSUnparsedValue object. CSSUnparsedValue.keys() Returns a new Array Iterator object that contains the keys for each index in the CSSUnparsedValue object. CSSUnparsedValue.values() Returns a new Array Iterator object that contains the values for each index in the CSSUnparsedValue object. Specifications ...
...nction once for each element of the CSSUnparsedValue object. CSSUnparsedValue.keys() Returns a new Array Iterator object that contains the keys for each index in the CSSUnparsedValue object. CSSUnparsedValue.values() Returns a new Array Iterator object that contains the values for each index in the CSSUnparsedValue object. Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'CSSUnparsedValue' in that specification. Working Draft Initial definition. ...
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
urce code contains a couple of line feeds after the DOCTYPE and a bunch of space characters before, after, and inside the <h1> element, but the browser doesn't seem to care at all and just shows the words "Hello World!" as if these characters didn't exist at all: This is so that whitespace characters don't impact the layout of your page. Creating space around and inside elements is the job of CSS. What does happen to whitespace? They don't just disappear, however. Any whitespace characters that are outside of HTML elements in the original document are represented in the DOM. This is needed internally so that the editor can preserve formatting of documents. This means that: There will be some text nodes that contain only whitespace, and Some text nodes will have whitespace at the be...
...1>Header</h1> <p> Paragraph </p> </body> </html> The DOM tree for this looks like so: Conserving whitespace characters in the DOM is useful in many ways, but there are certain places where this makes certain layouts more difficult to implement, and causes problems for developers who want to iterate through nodes in the DOM. We'll look at these, and some solutions, later on. ...
... Let's take another really simple example. ...
...pace? Most whitespace characters are ignored, not all of them are. In the earlier example one of the spaces between "Hello" and "World!" still exists when the page is rendered in a browser. There are rules in the browser engine that decide which whitespace characters are useful and which aren't -- these are specified at least in part in CSS Text Module Level 3, and especially the parts about the CSS white-space property and whitespace processing details, but we also offer an easier explanation below. Let's take another really simple example. To make it easier, we've illustrated all spaces with o, all tabs with ? , and all line breaks with ?: This example: <h1>oooHelloo? ????<span>oWorld!</span>?oo</h1> is rendered in the browser like so: Hidden example <h1> Hello <span> World!</...
-moz-outline-radius-bottomleft - CSS: Cascading Style Sheets
<percentage> The radius of the circle defining the rounding of the bottom-left corner of the element, specified as the percentages of the bottom and left sides of the border box. ...
... <percentage> The radius of the circle defining the rounding of the bottom-left corner of the element, specified as the percentages of the bottom and left sides of the border box. ...
... <percentage> The radius of the circle defining the rounding of the bottom-left corner of the element, specified as the percentages of the bottom and left sides of the border box. ...
... ...
-moz-outline-radius-bottomright - CSS: Cascading Style Sheets
<percentage> The radius of the circle defining the rounding of the bottom-right corner of the element, specified as the percentages of the bottom and right sides of the border box. ...
... <percentage> The radius of the circle defining the rounding of the bottom-right corner of the element, specified as the percentages of the bottom and right sides of the border box. ...
... <percentage> The radius of the circle defining the rounding of the bottom-right corner of the element, specified as the percentages of the bottom and right sides of the border box. ...
... bottom and right sides of the border box. Formal definition Initial value0Applies toall elementsInheritednoPercentagesrefer to the corresponding dimension of the border boxComputed valueas specifiedAnimation typea length, percentage or calc(); Formal syntax <outline-radius>where <outline-radius> = <length> | <percentage> Examples HTML <p>Look at this paragraph's bottom-right corner.</p> CSS p { margin: 5px; border: solid cyan; outline: dotted red; -moz-outline-radius-bottomright: 2em; } Result The example above will not display the desired effect if you are viewing this in a browser other than Firefox. Specifications Not part of any standard. ...
-moz-outline-radius-topleft - CSS: Cascading Style Sheets
<percentage> The radius of the circle defining the rounding of the top-left corner of the element, specified as the percentages of the top and left sides of the border box. ...
... <percentage> The radius of the circle defining the rounding of the top-left corner of the element, specified as the percentages of the top and left sides of the border box. ...
... <percentage> The radius of the circle defining the rounding of the top-left corner of the element, specified as the percentages of the top and left sides of the border box. ...
... ...
-moz-outline-radius-topright - CSS: Cascading Style Sheets
<percentage> The radius of the circle defining the rounding of the top-right corner of the element, specified as the percentages of the top and right sides of the border box. ...
... <percentage> The radius of the circle defining the rounding of the top-right corner of the element, specified as the percentages of the top and right sides of the border box. ...
... <percentage> The radius of the circle defining the rounding of the top-right corner of the element, specified as the percentages of the top and right sides of the border box. ...
...of the top and right sides of the border box. Formal definition Initial value0Applies toall elementsInheritednoPercentagesrefer to the corresponding dimension of the border boxComputed valueas specifiedAnimation typea length, percentage or calc(); Formal syntax <outline-radius>where <outline-radius> = <length> | <percentage> Examples HTML <p>Look at this paragraph's top-right corner.</p> CSS p { margin: 5px; border: solid cyan; outline: dotted red; -moz-outline-radius-topright: 2em; } Result The example above will not display the desired effect if you are viewing this in a browser other than Firefox. Specifications Not part of any standard. ...
-webkit-box-reflect - CSS: Cascading Style Sheets
Syntax Values above, below, right, left Are keywords indicating in which direction the reflection is to happen. ...
...webkit-box-reflect: right; /* Offset value */ -webkit-box-reflect: below 10px; /* Mask value */ -webkit-box-reflect: below 0 linear-gradient(transparent, white); /* Global values */ -webkit-box-reflect: inherit; -webkit-box-reflect: initial; -webkit-box-reflect: unset; Note: This feature is not intended to be used by Web sites. To achieve reflection on the Web, the standard way is to use the CSS element() function. Syntax Values above, below, right, left Are keywords indicating in which direction the reflection is to happen. <length> Indicates the size of the reflection. <image> Describes the mask to be applied to the reflection. Formal definition Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax [ above | belo...
... ...
... ...
-webkit-text-stroke - CSS: Cascading Style Sheets
<color> The color of the stroke. ...
...nd properties -webkit-text-stroke-width and -webkit-text-stroke-color. /* Width and color values */ -webkit-text-stroke: 4px navy; text-stroke: 4px navy; /* Global values */ -webkit-text-stroke: inherit; -webkit-text-stroke: initial; -webkit-text-stroke: unset; text-stroke: inherit; text-stroke: initial; text-stroke: unset; Constituent properties This property is a shorthand for the following CSS properties: -webkit-stroke-color -webkit-stroke-width Syntax Values <length> The width of the stroke. <color> The color of the stroke. Formal definition Initial valueas each of the properties of the shorthand:-webkit-text-stroke-width: 0-webkit-text-stroke-color: currentcolorApplies toall elementsInheritedyesComputed valueas each of the properties of the shorthand:-webkit-text-str...
... Non-standard unofficial documen...
...s Adding a red text stroke HTML <p id="example">The stroke of this text is red.</p> CSS #example { font-size: 3em; margin: 0; -webkit-text-stroke: 2px red; } Result Specifications Specification Status Comment Compatibility StandardThe definition of '-webkit-text-stroke' in that specification. Living Standard Initial standardization Safari CSS Reference '-webkit-text-stroke' in that document. Non-standard unofficial documentation Initial definition ...
:first-child - CSS: Cascading Style Sheets
The :first-child CSS pseudo-class represents the first element among a group of sibling elements. /* Selects any <p> that is the first element among its siblings */ p:first-child { color: lime; } Note: As originally defined, the selected element had to have a parent. Beginning with Selectors Level 4, this is no longer required. ...
...hild { color: lime; } Note: As originally defined, the selected element had to have a parent. Beginning with Selectors Level 4, this is no longer required. ...
...selected.</p> </div> <div> <h2>This text isn't selected: it's not a `p`.</h2> <p>This text isn't selected.</p> </div> CSS p:first-child { color: lime; background-color: black; padding: 5px; } Result Styling a list HTML <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3 <ul> <li>Item 3.1</li> <li>Item 3.2</li> <li>Item 3.3</li> </ul> </li> </ul> CSS ul li { color: blue; } ul li:first-child { color: red; font-weight: bold; } Result Specifications Specification Status Comment Selectors Level 4The definition of ':first-child' in that specification. Working Draft Matching elements are not required to have a parent. Selectors Level 3The definition of ':first-child' in that specification. ...
... Recommendation Initial definition. ...
:focus - CSS: Cascading Style Sheets
Web › CSS › :focus
The :focus CSS pseudo-class represents an element (such as a form input) that has received focus. It is generally triggered when the user clicks or taps on an element or selects it with the keyboard's Tab key. /* Selects any <input> when focused */ input:focus { color: red; } Note: This pseudo-class applies only to the focused element itself. Use :focus-within if you want to select an element that contains a focused element. ...
...ard's Tab key. /* Selects any <input> when focused */ input:focus { color: red; } Note: This pseudo-class applies only to the focused element itself. Use :focus-within if you want to select an element that contains a focused element. Syntax :focus Examples HTML <input class="red-input" value="I'll be red when focused."><br> <input class="blue-input" value="I'll be blue when focused."> CSS .red-input:focus { background: yellow; color: red; } .blue-input:focus { background: yellow; color: blue; } Result Accessibility concerns Make sure the visual focus indicator can be seen by people with low vision. This will also benefit anyone use a screen in a brightly lit space (like outside in the sun). WCAG 2.1 SC 1.4.11 Non-Text Contrast requires that the visual focus indicat...
...trast requires that the visual focus indicator be at least 3 to 1. Accessible Visual Focus Indicators: Give Your Site Some Focus! Tips for Designing Useful and Usable Focus Indicators :focus { outline: none; } Never just remove the focus outline (visible focus indicator) without replacing it with a focus outline that will pass WCAG 2.1 SC 1.4.11 Non-Text Contrast. Quick Tip: Never remove CSS outlines Specifications Specification Status Comment HTML Living StandardThe definition of ':focus' in that specification. Living Standard Defines HTML-specific semantics. Selectors Level 4The definition of ':focus' in that specification. Working Draft No change. Selectors Level 3The definition of ':focus' in that specification. Reco...
... Specification Status Comment HTML Living StandardThe definition of ':focus' in that specification. Living Standard Defines HTML-specific semantics. Selectors Level 4The definition of ':focus' in that specification. Working Draft No change. Selectors Level 3The definition of ':focus' in that specification. Recommendation No change. CSS Level 2 (Revision 1)The definition of ':focus' in that specification. Recommendation Initial definition. ...
:placeholder-shown - CSS: Cascading Style Sheets
You can use the text-overflow property to alter the way overflowing text is displayed. ...
...S 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" placeholder="Name, Rank, ...
...or: 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" 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" pl...
... Working Draft Initial definition. ...
:target - CSS: Cascading Style Sheets
Web › CSS › :target
/* Selects an element with an ID matching the current URL's fragment */ :target { border: 2px solid black; } For example, the following URL has a fragment (denoted by the # sign) that points to an element called section2: http://www.example.com/index.html#section2 The following element would be selected by a :target selector when the current URL is equal to the above: <section id="section2">Example</section> Syntax :target Examples A table of contents The :target pseudo-class can be used to highlight the portion of a page that has been linked to from a table of contents. ...
...ref="#p2">Jump to the second paragraph!</a></li> <li><a href="#nowhere">This link goes nowhere, because the target doesn't exist.</a></li> </ol> <h3>My Fun Article</h3> <p id="p1">You can target <i>this 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. ...
...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 pure-CSS lightbox based on the :target pseudo-class is available on GitHub (demo). HTML <ul> ...
...ing elit. Donec felis enim, placerat id eleifend eu, semper vel sem.</figcaption> </figure> </div> <div class="lightbox" id="example2"> <figure> <a href="#" class="close"></a> <figcaption>Cras risus odio, pharetra nec ultricies et, mollis ac augue. Nunc et diam quis sapien dignissim auctor. ...
@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. 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 Unicod...
...o 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 defined by the referring document: the charset attribute of the <link> element. This method is obsoleted in HTML5 and must not be used. Assume that the document is UTF-8 Syntax @charset "UTF-8"; @charset "iso-8859-15"; where: charset Is a <string> denoting the character encoding to be used. It must be the name of a web-safe character encoding defined...
... 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://github.com/mdn/browser-compa...
...eet 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. 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://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSaf...
speak-as - CSS: Cascading Style Sheets
he 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 convey information critical to understanding the page's purpose. ...
...nter 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 convey information critical to understanding the page's purpose. ...
... Candidate Recommendation Initial definition. ...
... Candidate Recommendation Initial definition. ...
@keyframes - CSS: Cascading Style Sheets
The @keyframes CSS at-rule controls the intermediate steps in a CSS animation sequence by defining styles for keyframes (or waypoints) along the animation sequence. 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. Description JavaScript can access the @keyframes at-rule with the CSS object model interface CSSKeyframesRule. To ...
... Working Draft ...
... Working Draft ...
... Working Draft ...
-webkit-device-pixel-ratio - CSS: Cascading Style Sheets
Although the value is a <number>, and thus doesn't syntactically allow units, its implicit unit is dppx. ...
...ble, use the resolution media feature query instead. Syntax The -webkit-device-pixel-ratio feature is specified as a <number> value. It is a range feature, meaning that you can also use the prefixed -webkit-min-device-pixel-ratio and -webkit-max-device-pixel-ratio variants to query minimum and maximum values, respectively. Values <number> The number of device pixels used to represent each CSS px. Although the value is a <number>, and thus doesn't syntactically allow units, its implicit unit is dppx. Implementation /* A unit of "dppx" is implied: */ @media (-webkit-min-device-pixel-ratio: 2) { ... } /* ... is equivalent to: */ @media (min-resolution: 2dppx) { ... } /* Similarly: */ @media (-webkit-max-device-pixel-ratio: 2) { ... } /* ... is equivalent to: */ @media (max-resolution...
...icit unit is dppx. Implementation /* A unit of "dppx" is implied: */ @media (-webkit-min-device-pixel-ratio: 2) { ... } /* ... is equivalent to: */ @media (min-resolution: 2dppx) { ... } /* Similarly: */ @media (-webkit-max-device-pixel-ratio: 2) { ... } /* ... is equivalent to: */ @media (max-resolution: 2dppx) { ... ...
... Non-standard unofficial documentation Initial documentation ...
color - CSS: Cascading Style Sheets
Web › CSS › @media › color
Syntax The color feature is specified as an <integer> value that represents the number of bits per color component (red, green, blue) of the output device. If the device is not a color device, the value is zero. It is a range feature, meaning that you can also use the prefixed min-color and max-color variants to query minimum and maximum values, respectively. Note: If the various color components are represented by different numbers of bits, the smallest number is used. For example, if a display uses 5 bits for blue and red and 6 bits for green, then the device is considered to use 5 bits per color component. ...
...the various color components are represented by different numbers of bits, the smallest number is used. For example, if a display uses 5 bits for blue and red and 6 bits for green, then the device is considered to use 5 bits per color component. If the device uses indexed colors, the minimum number of bits per color component in the color table is used. ...
...re represented by different numbers of bits, the smallest number is used. For example, if a display uses 5 bits for blue and red and 6 bits for green, then the device is considered to use 5 bits per color component. If the device uses indexed colors, the minimum number of bits per color component in the color table is used. See Applying color to HTML elements using CSS to learn more about using CSS to apply color to HTML. ...
...olor component. If the device uses indexed colors, the minimum number of bits per color component in the color table is used. See Applying color to HTML elements using CSS to learn more about using CSS to apply color to HTML. Examples HTML <p>This text should be black on non-color devices, red on devices with a low number of colors, and greenish on devices with a high number of colors.</p> CSS p { color: black; } /* Any color device */ @media (color) { p { color: red; } } /* Any color device with at least 8 bits per color component */ @media (min-color: 8) { p { color: #24ba13; } } Result Specifications Specification Status Comment Media Queries Level 4The definition of 'color' in that specification. Candidate Recommendation T...
At-rules - CSS: Cascading Style Sheets
Web › CSS › At-rule
At-rules are CSS statements that instructs CSS how to behave. They begin with an at sign, '@' (U+0040 COMMERCIAL AT), followed by an identifier and includes everything up to the next semicolon, ';' (U+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. @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...
...ent 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 content if the document in which the style sheet is applied meets the criteria of the given condition. (deferred to Level 4 of CSS Spec) @page -- Describes the aspect of layout changes that will be applied when printing the document. @font-face -- Describes the aspect of an external font to be downloaded. @keyframes -- Describes the aspect of intermediate steps in a CSS animation sequence. @viewport -- Describes the aspects of the viewport for small screen devices. (currently at the Working Draft stage) @cou...
...tatements share a common syntax and each of them can include nested statements--either rulesets or nested at-rules. Furthermore, they all convey a common semantic meaning--they all link some type of condition, which at any time evaluates to either true or false. If the condition evaluates to true, then all of the statements within the group will be applied. ...
...ts or nested at-rules. Furthermore, they all convey a common semantic meaning--they all link some type of condition, which at any time evaluates to either true or false. If the condition evaluates to true, then all of the statements within the group will be applied. Conditional group rules are defined in CSS Conditionals Level 3 and are: @media, @supports, @document. (deferred to Level 4 of CSS Spec) Since each conditional group may also contain nested statements, there may be an unspecified amount of nesting. Specifications Specification Status Comment CSS Conditional Rules Module Level 3 Candidate Recommendation Initial definition Compatibility StandardThe definition of 'CSS At-rules' in that specification. Living Standard Standardizes...
Coordinate systems - CSS: Cascading Style Sheets
en specifying the location of a pixel in a graphics context (just like when specifying coordinate systems in algebra), its position is defined relative to a fixed point in the context. This fixed point is called the origin. The position is specified as the number of pixels offset from the origin along each dimension of the context. This guide describes the standard coordinate systems used by the CSS object model. These are generally only different in terms of where their origin is located. Dimensions In the coordinate systems used by web technologies, convention dictates that the horizontal offset is called the x-coordinate, where a negative value indicates a position to the left of the origin and a positive value is to the right of the origin. The y-coordinate specifies the vertical offse...
...e bottom-left corner, with positive y-coordinate values being above the origin. When drawing 3D graphics, or using a third dimension to layer objects from front to back, the z-coordinate is also used. This specifies the distance away from the viewer if positive and toward the viewer if negative. It's actually possible to change the definitions and orientations of these coordinate systems using CSS properties such as transform. However, we'll only talk about the standard coordinate system for now. Standard CSSOM coordinate systems There are four standard coordinate systems used by the CSS object model, as described below. Offset Coordinates specified using the "offset" model use the top-left corner of the element being examined, or on which an event has occurred. For example, when a m...
...The class "outer" is used for the containing box, which is intentionally too wide to show in the MDN window, to allow you to scroll it horizontally. The "inner" box is the one that we track events in and in which we show the mouse coordinates. .outer { width: 1000px; height: 200px; background-color: red; } .inner { position: relative; ...
...The class "outer" is used for the containing box, which is intentionally too wide to show in the MDN window, to allow you to scroll it horizontally. The "inner" box is the one that we track events in and in which we show the mouse coordinates. .outer { width: 1000px; height: 200px; background-color: red; } .inner { position: relative; width: 5...
Box alignment in grid layout - CSS: Cascading Style Sheets
Basic Example In this example using grid layout, there is extra space in the grid container after laying out the fixed width tracks on the inline (main) axis. This space is distributed using justify-content. ...
... Basic Example In this example using grid layout, there is extra space in the grid container after laying out the fixed width tracks on the inline (main) axis. This space is distributed using justify-content. ...
... them to be used for other layout methods where a gap between items makes sense. The updated properties have not yet been implemented in all browsers. Therefore, to use the gap properties in grid layout, you should use the grid-row-gap, grid-column-gap and grid-gap versions to ensure full compatibility. You could double up the properties and use both as you would for vendor prefixes. ...
.... You could double up the properties and use both as you would for vendor prefixes. ...
Color picker tool - CSS: Cascading Style Sheets
ColorPicker tool HTML <div id="container"> <div id="palette" class="block"> <div id="color-palette"></div> <div id="color-info"> <div class="title"> CSS Color </div> </div> </div> <div id="picker" class="block"> <div class="ui-color-picker" data-topic="picker" data-mode="HSL"></div> <div id="picker-samples" sample-id="master"></div> <div id="controls"> <div id="delete"> <div id="trash-can"></div> </div> <div id="void-sample" class="icon"></div> </div> </div> <div id="canvas" data-tutorial="drop"> <div id="zindex" class="ui-input-slider" data-topic="z-index" da...
..."delete"> <div id="trash-can"></div> </div> <div id="void-sample" class="icon"></div> </div> </div> <div id="canvas" data-tutorial="drop"> <div id="zindex" class="ui-input-slider" data-topic="z-index" data-info="z-index" data-max="20" data-sensivity="10"></div> </div> </div> CSS /* * COLOR PICKER TOOL */ .ui-color-picker { width: 420px; margin: 0; border: 1px solid #DDD; background-color: #FFF; display: table; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none; } .ui-color-picker .picking-area { width: 198px; height: 198px; margin: 5px; border: 1px solid #DDD; position: relative; float: left; display: table; ...
...init = function init() { UIColorPicker.init(); InputSliderManager.init(); ColorInfo.init(); ColorPalette.init(); ColorPickerSamples.init(); CanvasSamples.init(); Tool.init(); }; return { init : init }; })(); This tool makes it easy to create, adjust, and experiment with custom colors for the web. It also makes it easy to convert between various color formats supported by CSS, including: HEXA colors, RGB (Red/Green/Blue) and HSL (Hue/Saturation/Lightness). Control over the alpha channel is also supported on RGB (rgba) and HSL (hsla) formats. As you adjust the parameters that define the color, it gets displayed in all three standard Web CSS formats. In addition, based on the currently-selected color, a palette for HSL and HSV, as well as alpha, is generated. The "eyed...
... and HSV, as well as alpha, is generated. The "eyedropper" style color picker box can be toggled between HSL or HSV format. You can also test colors and how they overlap one another by dragging them into the box at the bottom of the tool and moving them over one another. Adjust their relative Z index values to move them forward and behind one another. This tool will help you identify the perfect CSS colors to apply to your HTML. The generated colors you create above can be used anywhere color is used in CSS and HTML, unless otherwise noted. ...
Mastering Wrapping of Flex Items - CSS: Cascading Style Sheets
exbox was designed as a single dimensional layout, meaning that it deals with laying out items as a row or as a column -- but not both at once. There is however the ability to wrap flex items onto new lines, creating new rows if flex-direction is row and new columns if flex-direction is column. In this guide I will explain how this works, what it is designed for and what situations really require CSS Grid Layout rather than flexbox. Making things wrap The initial value of the flex-wrap property is nowrap. This means that if you have a set of flex items that are too wide for their container, they will overflow it. If you want to cause them to wrap once they become too wide you must add the flex-wrap property with a value of wrap, or use the shorthand flex-flow with values of row wrap or colu...
...ine up with items in the row above -- each flex line acts like a new flex container. It deals with space distribution across the main axis. If there is only one item, and that item is allowed to grow, it will fill the axis just as if you had a single item flex container. If you want layout in two dimensions then you probably want Grid Layout. We can compare our wrapped row example above with the CSS Grid version of that layout to see the difference. The following live sample uses CSS Grid Layout to create a layout that has as many columns of at least 160 pixels as will fit, distributing the extra space between all columns. However, in this case the items stay in their grid and don't stretch out when there are fewer of them on the final row. This is the difference between one and two-dimen...
...u would probably be better served by switching to grid layout for that component. Creating gutters between items When wrapping flex items, the need to space them out is likely to arise. At the current time we do not have any implementations of the gap properties from the Box Alignment module for Flexbox. In the future we will be able to simply use row-gap and column-gap for flexbox as we do for CSS Grid. At the current time you will need to use margins to achieve this. You can see from the live example below that in order to create gaps that do not also create a gap at the edges of the container, we need to use negative margins on the flex container itself. Any border on the flex container is then moved to a second wrapper in order that the negative margin can pull the items up to that wra...
...ipt to show and hide content for example. The example in the specification demonstrates one such pattern. In the following live example I have a non-wrapped flex container. The third item has more content than the others yet is set to visibility: collapse and therefore the flex container is retaining a strut of the height required to display this item. If you remove visibility: collapse from the CSS or change the value to visible, you will see the item disappear and the space redistribute between non-collapsed items; the height of the flex container should not change. Note: Use Firefox for the below two examples as Chrome and Safari treat collapse as hidden. When dealing with multiple-line flex containers however you need to understand that the wrapping is re-done after collapsing. So ...
Grid template areas - CSS: Cascading Style Sheets
However, there is an alternate method to use for positioning items on the grid which you can use alone or in combination with line-based placement. This method involves placing our items using named template areas, and we will find out exactly how this method works. You will see very quickly why we sometimes call this the ascii-art method of grid layout! Naming a grid area You have already encountered the grid-area property. ...
...Sidebar</div> <div class="content">Content</div> <div class="footer">Footer</div> </div> In order to make the layout neater I can use multiple . characters. As long as there is no white space between the full stops it will be counted as one cell. For a complex layout there is a benefit to having the rows and columns neatly aligned. It means that you can actually see, right there in the CSS, what this layout looks like. Spanning multiple cells In our example each of the areas spans multiple grid cells and we achieve this by repeating the name of that grid area multiple times with white space between. You can add extra white space in order to keep your columns neatly lined up in the value of grid-template-areas. You can see that I have done this in order that the hd and ft line up ...
...must show a complete grid, otherwise it is invalid (and the property is ignored). This means that you must have the same number of cells for each row, if empty with a full stop character demonstrating that the cell is to be left empty. You will also create an invalid grid if your areas are not rectangular. Redefining the grid using media queries As our layout is now contained in one part of the CSS, this makes it very easy to make changes at different breakpoints. You can do this by redefining the grid, the position of items on the grid, or both at once. When doing this, define the names for your areas outside of any media queries. That way the content area would always be called main no matter where on the grid it is placed. For our layout above, we might like to have a very simple layou...
... We can use grid-template-areas to switch around the image and text part of the media object. </div> </div> Grid definition shorthands Having looked at various ways of placing items on our grids and many of the properties used to define grid, this is a good time to take a look at a couple of shorthands that are available for defining the grid and many things about it all in one line of CSS. These can quickly become difficult to read for other developers, or even your future self. However they are part of the specification and it is likely you will come across them in examples or in use by other developers, even if you choose not to use them. Before using any shorthand it is worth remembering that shorthands not only enable the setting of many properties in one go, they also act t...
Subgrid - CSS: Cascading Style Sheets
This guide details what subgrid does, and gives some use cases and design patterns that are solved by the feature. Important: This feature is shipped in Firefox 71, which is currently the only browser to implement subgrid. Introduction to subgrid When you add display: grid to a grid container, only the direct children become grid items and can then be placed on the grid that you have created. The children of these items display in normal flow. You can "nest" grids by making a grid item a grid container. These grids however are independent of the parent grid and of each other, meaning that they do not take their track sizing from the parent grid. ...
...grid has a gap of 20px for rows and columns. The subgrid has row-gap set to 0. If you inspect this in the Firefox Grid Inspector you can see how the line of the grid is in the correct place down the center of the gap, so when we set the gap to 0, it acts in a similar way to applying a negative margin to an element, giving the space from the gap back to the item. Named grid lines When using CSS Grid you can name lines on your grid and then position items based on those names rather than the line number. The line names on the parent grid are passed into the subgrid, and you can place items using them. In the below example I have named lines on the parent col-start and col-end and then used those to place the subitem. You can also specify line names on the subgrid. This is achieved by ...
...grid value acts in much the same way as a regular nested grid, it is easy to switch between the two. ...
...uto-rows to control the implicit track sizing. Specification Specification Status Comment CSS Grid Layout Module Level 2 Working Draft Initial definition of subgrids. ...
Basic Shapes - CSS: Cascading Style Sheets
They range from simple circles to complex polygons. Before looking at the shapes, it is worth understanding two pieces of information that go together to make these shapes possible: The <basic-shape> type The reference box The <basic-shape> type The <basic-shape> type is used as the value for all of our Basic Shapes. This type uses Functional Notation: the type of shape is followed by brackets, inside of which are additional values used to describe the shape. The arguments which are accepted vary depending on the shape that you are creating. We will cover these in the examples below. ...
...asic-shape> type is used as the value for all of our Basic Shapes. This type uses Functional Notation: the type of shape is followed by brackets, inside of which are additional values used to describe the shape. The arguments which are accepted vary depending on the shape that you are creating. We will cover these in the examples below. The reference box Understanding the reference box used by CSS Shapes is important when using Basic Shapes, as it defines each shape's coordinate system. You have already met the reference box in the guide on creating shapes from Box Values, which directly uses the reference box to create the shape. The Firefox Shapes Inspector helpfully shows the reference box in use when you inspect a shape. In the screenshot below I have created a circle, using shape-out...
...to use the border. .shape { shape-outside: circle(50%) border-box; } What is worth noting is that the margin-box will clip the shape, therefore shapes created in reference to other shapes which extend past the margin box will have the shape clipped to the margin box. We will see this in the following examples of basic shapes. For an excellent description of references boxes as they apply to CSS Shapes see Understanding Reference Boxes for CSS Shapes. inset() The inset() type defines a rectangle, which may not seem very useful as simply floating an item will give you a rectangular shape around it. However the inset() types enables the definition of offsets, thus pulling the content in over the shape. Therefore inset() takes four values for the top, right, bottom and left values plus a...
... .shape { float: left; shape-outside: inset(20px 10px 20px 10px round 10px); } Using the same rules as we use for the margin shorthand, you can set more than one offset at once. ...
Class selectors - CSS: Cascading Style Sheets
The CSS class selector matches elements based on the contents of their class attribute. ...
...ents 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 paragraph.</p> Result Specifi...
... Recommendation Initial definition ...
...ions Specification Status Comment Selectors Level 4The definition of 'class selectors' in that specification. Working Draft No changes Selectors Level 3The definition of 'class selectors' in that specification. Recommendation CSS Level 2 (Revision 1)The definition of 'child selectors' in that specification. Recommendation CSS Level 1The definition of 'child selectors' in that specification. Recommendation Initial definition ...
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 o...
..., the media type is optional and the all type will be implied. all Suitable for all devices. print Intended for paged material and documents viewed on a screen in print preview mode. (Please see paged media for information about formatting issues that are specific to these formats.) screen Intended primarily for screens. speech Intended for speech synthesizers. Deprecated media types: CSS2.1 and Media Queries 3 defined several additional media types (tty, tv, projection, handheld, braille, embossed, and aural), but they were deprecated in Media Queries 4 and shouldn't be used. The aural type has been replaced by speech, which is similar. Media features Media features describe specific characteristics of the user agent, output device, or environment. Media feature expressions tes...
... the queries in a list is true, the entire media statement returns true. In other words, lists behave like a logical or operator. Targeting media types Media types describe the general category of a given device. Although websites are commonly designed with screens in mind, you may want to create styles that target special devices such as printers or audio-based screenreaders. For example, this CSS targets printers: @media print { ... } You can also target multiple devices. For instance, this @media rule uses two media queries to target both screen and print devices: @media screen, print { ... } See Media types for a list of all media types. Because they describe devices in only very broad terms, just a few are available; to target more specific attributes, use media features instead. ...
...rs that use mice, or to devices that are being used in low-light conditions. This example applies styles when the user's primary input mechanism (such as a mouse) can hover over elements: @media (hover: hover) { ... } Many media features are range features, which means they can be prefixed with "min-" or "max-" to express "minimum condition" or "maximum condition" constraints. For example, this CSS will apply styles only if your browser's viewport width is equal to or narrower than 12450px: @media (max-width: 12450px) { ... } If you create a media feature query without specifying a value, the nested styles will be used as long as the feature's value is not zero (or none, in Level 4). For example, this CSS will apply to any device with a color screen: @media (color) { ... } If a feature ...
align-content - CSS: Cascading Style Sheets
The interactive example below use Grid Layout to demonstrate some of the values of this 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. This property has no effect on single line flex containers (i.e. ones with flex-wrap: nowrap). ...
...uted valueas specifiedAnimation typediscrete Formal syntax normal | <baseline-position> | <content-distribution> | <overflow-position>? <content-position>where <baseline-position> = [ first | last ]? ...
... Candidate Recommendation Initial definition Initial valuenormalApplies tomulti-line flex containersIn...
...t.value; }); display.addEventListener('change', function (evt) { container.className = evt.target.value; }); Result Specifications Specification Status Comment CSS Box Alignment Module Level 3The definition of 'align-content' in that specification. Working Draft Adds the [ first | last ]? baseline, start, end, left, right, unsafe | safe values. CSS Flexible Box Layout ModuleThe definition of 'align-content' in that specification. Candidate Recommendation Initial definition Initial valuenormalApplies tomulti-line flex containersInheritednoComputed valueas specifiedAnimation typediscrete ...
align-items - CSS: Cascading Style Sheets
In Flexbox, it controls the alignment of items on the Cross Axis. In Grid Layout, it controls the alignment of items on the Block Axis within their grid area. The interactive example below demonstrates some of the values for align-items using grid 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. ...
...l definition Initial valuenormalApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax normal | stretch | <baseline-position> | [ <overflow-position>? <self-position> ]where <baseline-position> = [ first | last ]? ...
... Candidate Recommendation Initial definition ...
... Candidate Recommendation Initial definition ...
<alpha-value> - CSS: Cascading Style Sheets
The <alpha-value> CSS data type represents a value that can be either a <number> or a <percentage>, specifying the alpha channel or transparency of a color. Syntax The value of an <alpha-value> is given as either a <number> or a <percentage>. If given as a number, the useful range is 0 (fully transparent) to 1.0 (fully opaque), with decimal values in between; that is, 0.5 indicates that half of the foreground color is used and half of the background color is used. Values outside the range of 0 to 1 are permitted, but are clamped to like within the range 0 to 1. If the alpha value is given as a percentage, 0% corresponds to fully transparent while 100% indicates fully opaque. ...
...alues in between; that is, 0.5 indicates that half of the foreground color is used and half of the background color is used. Values outside the range of 0 to 1 are permitted, but are clamped to like within the range 0 to 1. If the alpha value is given as a percentage, 0% corresponds to fully transparent while 100% indicates fully opaque. Interpolation When animated, values of the <alpha-value> CSS data type are interpolated as real, floating-point numbers. The speed of the interpolation is determined by the timing function associated with the animation. Examples Setting text color opacity Here an alpha value is used to set partially transparent text: /* <rgba()> */ color: rgba(34, 12, 64, 0.6); color: rgba(34.0 12 64 / 60%); Setting shape image threshold Here an alpha value is used ...
... Recommendation Introduces <alpha-value> along with rgba() and hsla() functional notations. ...
... Recommendation Introduces <alpha-value> along with rgba() and hsla() functional notations. ...
animation-delay - CSS: Cascading Style Sheets
The animation can start later, immediately from its beginning, or immediately and partway through the animation. 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. ...
...y, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are. For more information, see Setting multiple animation property values. Formal definition Initial value0sApplies toall elements, ::before and ::after pseudo-elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <time># Examples See CSS animations for examples. Specifications Specification Status Comment CSS AnimationsThe definition of 'animation-delay' in that specification. Working Draft 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://github.com/mdn/brow...
...nto the viewport with a delay. This bug affects only some platforms, such as Windows. Full support 49Prefixed Prefixed Implemented with the vendor prefix: -webkit- Full support 44Prefixed Disabled Prefixed Implemented with the vendor prefix: -webkit-Disabled From version 44: this feature is behind the layout.css.prefixes.webkit preference (needs to be set to true). To change preferences in Firefox, visit about:config. Full support 5Prefixed Prefixed Implemented with the vendor prefix: -moz-IE Full support 10Opera Full support 30 Full support ...
...To change preferences in Firefox, visit about:config. Full support 5Prefixed Prefixed Implemented with the vendor prefix: -moz-Opera Android Full support 30 Full support 30 Full support ...
animation-direction - 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. It is often convenient to use the shorthand property animation to set all animation properties at once. ...
... on how many there are. For more information, see Setting multiple animation property values. Formal definition Initial valuenormalApplies toall elements, ::before and ::after pseudo-elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <single-animation-direction>#where <single-animation-direction> = normal | reverse | alternate | alternate-reverse Examples See CSS animations for examples. Specifications Specification Status Comment CSS AnimationsThe definition of 'animation-direction' in that specification. Working Draft 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://github.com/mdn...
...To change preferences in Firefox, visit about:config. Full support 5Prefixed Prefixed Implemented with the vendor prefix: -moz-IE Full support 10Opera Full support 30 Full support ...
...To change preferences in Firefox, visit about:config. Full support 5Prefixed Prefixed Implemented with the vendor prefix: -moz-Opera Android Full support 30 Full support 30 Full support ...
animation-fill-mode - 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. It is often convenient to use the shorthand property animation to set all animation properties at once. ...
... /* 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-iteration-count last keyframe encountered normal even or odd 100% or to ...
...fill-mode in the following example. It demonstrates how, for an animation that runs for an infinite time, you can cause it to remain in its final state rather than reverting to the original state (which is the default). HTML <p>Move your mouse over the gray box!</p> <div class="demo"> <div class="growsandstays">This grows and stays big.</div> <div class="grows">This just grows.</div> </div> CSS .demo { border-top: 100px solid #ccc; height: 300px; } @keyframes grow { 0% { font-size: 0; } 100% { font-size: 40px; } } .demo:hover .grows { animation-name: grow; animation-duration: 3s; } .demo:hover .growsandstays { animation-name: grow; animation-duration: 3s; animation-fill-mode: forwards; } See CSS animations for more examples. Specifications Specificati...
... Working Draft Initial definition. ...
aspect-ratio - CSS: Cascading Style Sheets
This property is not yet implemented in browsers, however some browsers are implementing this internally in order to provide the aspect ratio mapping described below. Syntax aspect-ratio: 1 / 1; /* Global values */ aspect-ratio: inherit; aspect-ratio: initial; aspect-ratio: unset; Values <auto> Replaced elements with an intrinsic aspect ratio use that aspect ratio, otherwise the box has no preferred aspect ratio. Size calculations involving intrinsic aspect ratio always work with the content box dimensions. <ratio> The box's preferred aspect ratio is the specified ratio of width / height. ...
...ted 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 Draft 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://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet Explore...
...To change preferences in Firefox, visit about:config.IE No support NoOpera No support NoSafari No support NoWebView Android Partial support 79Notes ...
...To change preferences in Firefox, visit about:config.IE No support NoOpera No support NoSafari No support NoWebView Android Full support ...
background-clip - 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 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. ...
...rmal syntax <box>#where <box> = border-box | 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: te...
... Editor's Draft Add text value. ...
... Editor's Draft Add text value. ...
background-image - CSS: Cascading Style Sheets
The background-image CSS property sets one or more background images on an 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 background images are drawn on stacking context layers on top of each other. The first layer specified is drawn as if it is closest to the user. The borders of the element are then drawn on top of them, and the background-color is drawn beneath them. How the images are drawn relative to the box and its borders is defined by the background-clip and background-origin CSS properties. If a specified image cannot be drawn (for example, when the file denoted by the specified URI cannot...
...tage> = <angle> | <percentage> Examples Layering background images Note that the star image is partially transparent and is layered over the cat image. HTML <div> <p class="catsandstars"> This paragraph is full of cats<br />and stars. ...
... background-image: url("https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png"); } .catsandstars { background-image: url("https://mdn.mozillademos.org/files/11991/startransparent.gif"), url("https://mdn.mozillademos.org/files/7693/catfront.png"); background-color: transparent; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'background-image' in that specification. Candidate Recommendation From CSS2 Revision 1, the property has been extended to support multiple backgrounds and any <image> CSS data type. CSS Level 2 (Revision 1)The definition of 'background-image' in that specification. Recommendation From CSS1, the way images with and witho...
...round-image' in that specification. Candidate Recommendation From CSS2 Revision 1, the property has been extended to support multiple backgrounds and any <image> CSS data type. CSS Level 2 (Revision 1)The definition of 'background-image' in that specification. Recommendation From CSS1, the way images with and without intrinsic dimensions are handled is now described. CSS Level 1The definition of 'background-image' in that specification. Recommendation Initial definition. ...
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. ...
...etting 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. 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 wri...
... Editor's Draft Initial definition ...
... Editor's Draft Initial definition ...
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. ...
...ting 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. 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 ...
... Editor's Draft Initial definition ...
... Editor's Draft Initial definition ...
border-block - CSS: Cascading Style Sheets
border-block: 1px; border-block: 2px dotted; border-block: medium dashed blue; border-block can be used to set the values for one or more of border-block-width, border-block-style, and border-block-color setting both the start and end in the block dimension at once. The physical borders to which it 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. ...
...lity, 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. 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 t...
... Editor's Draft Initial definition ...
... Editor's Draft Initial definition ...
border-bottom-left-radius - 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 rounding can be a circle or an ellipse, or if one of the value is 0 no rounding is done and the corner is square. A background, being an image or a color, is clipped at the border, even a rounded one; the exact location of the clipping is defined by the value of the background-clip property. ...
... of the value is 0 no rounding is done and the corner is square. A background, being an image or a color, is clipped at the border, even a rounded one; the exact location of the clipping is defined by the value of the background-clip property. Note: If the value of this property is not set in a border-radius shorthand property that is applied to the element after the border-bottom-left-radius CSS property, the value of this property is then reset to its initial value by the shorthand property. Syntax /* the corner is a circle */ /* border-bottom-left-radius: radius */ border-bottom-left-radius: 3px; /* Percentage values */ /* circle if box is a square or ellipse if box is a rectangle */ border-bottom-left-radius: 20%; /* same as above: 20% of horizontal(width) and vertical(height) */...
...emi-major axis of the ellipse to use for the border in that corner. the second value is a <length> or a <percentage> denoting the vertical semi-major axis of the ellipse to use for the border in that corner. Values <length-percentage> Denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipse. As absolute length it can be expressed in any unit allowed by the CSS <length> data type. Percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. Negative values are invalid. Formal definition Initial value0Applies toall elements; but User Agents are not required to apply to table and inline-table elements when border-collapse is collapse. The behavior on internal table elements is unde...
...rc 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 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 rounding can be a circle or an ellipse, or if one of the value is 0 no rounding is done and the corner is square. A background, being an image or a color, is clipped at the border, even a rounded one; the exact location of the clipping is defined by the value of the background-clip property. ...
...of the value is 0 no rounding is done and the corner is square. A background, being an image or a color, is clipped at the border, even a rounded one; the exact location of the clipping is defined by the value of the background-clip property. Note: If the value of this property is not set in a border-radius shorthand property that is applied to the element after the border-bottom-right-radius CSS property, the value of this property is then reset to its initial value by the shorthand property. Syntax /* The corner is a circle */ /* border-bottom-right-radius: radius */ border-bottom-right-radius: 3px; /* Percentage values */ border-bottom-right-radius: 20%; /* corner of a circle if box is a square or else corner of a rectangle */ border-bottom-right-radius: 20% 20%; /* same as above */...
...emi-major axis of the ellipse to use for the border in that corner. the second value is a <length> or a <percentage> denoting the vertical semi-major axis of the ellipse to use for the border in that corner. Values <length-percentage> Denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipse. As absolute length it can be expressed in any unit allowed by the CSS <length> data type. Percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. Negative values are invalid. Formal definition Initial value0Applies toall elements; but User Agents are not required to apply to table and inline-table elements when border-collapse is collapse. The behavior on internal table elements is unde...
... 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-bottom-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. Note: The specification doesn't define how borders of different styles connect in the corners. ...
...ating all border styles HTML <table> <tr> <td class="b1">none</td> <td class="b2">hidden</td> <td class="b3">dotted</td> <td class="b4">dashed</td> </tr> <tr> <td class="b5">solid</td> <td class="b6">double</td> <td class="b7">groove</td> <td class="b8">ridge</td> </tr> <tr> <td class="b9">inset</td> <td class="b10">outset</td> </tr> </table> CSS /* Define look of the table */ table { border-width: 3px; background-color: #52E385; } tr, td { padding: 3px; } /* border-bottom-style example classes */ .b1 {border-bottom-style: none;} .b2 {border-bottom-style: hidden;} .b3 {border-bottom-style: dotted;} .b4 {border-bottom-style: dashed;} .b5 {border-bottom-style: solid;} .b6 {border-bottom-style: double;} .b7 {border-bottom-style: groo...
... Recommendation Initial definition. ...
... Recommendation Initial definition. ...
border-bottom - CSS: Cascading Style Sheets
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 ... ...
...tted; 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. Constituent properties This property is a shorthand for the following CSS properties: border-bottom-color border-bottom-style border-bottom-width Syntax border-bottom: 1px; border-bottom: 2px dotted; border-bottom: medium dashed blue; 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-bottom-width. <br-style> See border-bottom-style. <color> See border-bottom-c...
...> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> Examples Applying a bottom border HTML <div> This box has a border on the bottom side. </div> CSS div { border-bottom: 4px dashed blue; background-color: gold; height: 100px; width: 100px; font-weight: bold; text-align: center; } Results Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-bottom' in that specification. Candidate Recommendation No direct changes, though the modifica...
... height: 100px; width: 100px; font-weight: bold; text-align: center; } Results Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-bottom' in that specification. Candidate Recommendation No direct changes, though the modification of values for the border-bottom-color do apply to it. CSS Level 2 (Revision 1)The definition of 'border-bottom' in that specification. Recommendation No significant changes. CSS Level 1The definition of 'border-bottom' in that specification. Recommendation Initial definition ...
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. ...
...ing 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. 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-botto...
... Editor's Draft Initial definition ...
... Editor's Draft Initial definition ...
border-inline - CSS: Cascading Style Sheets
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. The borders in the other dimension can be set with border-block, which sets border-block-start, and border-block-end. ...
...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 ...
... Editor's Draft Initial definition ...
... Editor's Draft Initial definition ...
border-left-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. Note: The specification doesn't define how borders of different styles connect in the corners. ...
...nset | outset Examples HTML <table> <tr> <td class="b1">none</td> <td class="b2">hidden</td> <td class="b3">dotted</td> <td class="b4">dashed</td> </tr> <tr> <td class="b5">solid</td> <td class="b6">double</td> <td class="b7">groove</td> <td class="b8">ridge</td> </tr> <tr> <td class="b9">inset</td> <td class="b10">outset</td> </tr> </table> CSS /* Define look of the table */ table { border-width: 2px; background-color: #52E385; } tr, td { padding: 3px; } /* border-left-style example classes */ .b1 {border-left-style: none;} .b2 {border-left-style: hidden;} .b3 {border-left-style: dotted;} .b4 {border-left-style: dashed;} .b5 {border-left-style: solid;} .b6 {border-left-style: double;} .b7 {border-left-style: groove;} .b8 {border...
... Recommendation Initial definition. Browser compatibility The compatibility table in this page is generated from structured data. If you'd ...
... Recommendation Initial definition. ...
border-left - 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. 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. ...
...ft-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 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 de...
...tage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> Examples Applying a left border HTML <div> This box has a border on the left side. </div> CSS div { border-left: 4px dashed blue; background-color: gold; height: 100px; width: 100px; font-weight: bold; text-align: center; } Results Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-left' in that specification. Candidate Recommendation No direct changes, though the modification...
...ld; height: 100px; width: 100px; font-weight: bold; text-align: center; } Results Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-left' in that specification. Candidate Recommendation No direct changes, though the modification of values for the border-left-color do apply to it. CSS Level 2 (Revision 1)The definition of 'border-left' in that specification. Recommendation No significant changes. CSS Level 1The definition of 'border-left' in that specification. Recommendation Initial definition Browser compatibility The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out http...
border-right-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. Note: The specification doesn't define how borders of different styles connect in the corners. ...
...Examples Border styles HTML <table> <tr> <td class="b1">none</td> <td class="b2">hidden</td> <td class="b3">dotted</td> <td class="b4">dashed</td> </tr> <tr> <td class="b5">solid</td> <td class="b6">double</td> <td class="b7">groove</td> <td class="b8">ridge</td> </tr> <tr> <td class="b9">inset</td> <td class="b10">outset</td> </tr> </table> CSS /* Define look of the table */ table { border-width: 2px; background-color: #52E385; } tr, td { padding: 3px; } /* border-right-style example classes */ .b1 {border-right-style: none;} .b2 {border-right-style: hidden;} .b3 {border-right-style: dotted;} .b4 {border-right-style: dashed;} .b5 {border-right-style: solid;} .b6 {border-right-style: double;} .b7 {border-right-style: groove;} .b8...
... Recommendation Initial definition. Browser compatibility The compatibility table in this page is generated from structured data. If you'...
... Recommendation Initial definition. ...
border-right - 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. 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. ...
...le: 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 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. ...
...entage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> Examples Applying a right border to a div HTML <div> This box has a border on the right side. </div> CSS div { border-right: 4px dashed blue; background-color: gold; height: 100px; width: 100px; font-weight: bold; text-align: center; } Results Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-right' in that specification. Candidate Recommendation No direct changes, though the modificati...
...; height: 100px; width: 100px; font-weight: bold; text-align: center; } Results Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-right' in that specification. Candidate Recommendation No direct changes, though the modification of values for the border-right-color do apply to it. CSS Level 2 (Revision 1)The definition of 'border-right' in that specification. Recommendation No significant changes. CSS Level 1The definition of 'border-right' in that specification. Recommendation Initial definition Browser compatibility The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out ht...
border-top-left-radius - 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 rounding can be a circle or an ellipse, or if one of the value is 0,no rounding is done and the corner is square. A background, being an image or a color, is clipped at the border, even a rounded one; the exact location of the clipping is defined by the value of the background-clip property. ...
...one of the value is 0,no rounding is done and the corner is square. A background, being an image or a color, is clipped at the border, even a rounded one; the exact location of the clipping is defined by the value of the background-clip property. Note: If the value of this property is not set in a border-radius shorthand property that is applied to the element after the border-top-left-radius CSS property, the value of this property is then reset to its initial value by the shorthand property. Syntax /* the corner is a circle */ /* border-top-left-radius: radius */ border-top-left-radius: 3px; /* the corner is an ellipse */ /* border-top-left-radius: horizontal vertical */ border-top-left-radius: 0.5em 1em; border-top-left-radius: inherit; With one value: the value is a <length> ...
...emi-major axis of the ellipse to use for the border in that corner. the second value is a <length> or a <percentage> denoting the vertical semi-major axis of the ellipse to use for the border in that corner. Values <length-percentage> Denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipse. As absolute length it can be expressed in any unit allowed by the CSS <length> data type. Percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. Negative values are invalid. Formal definition Initial value0Applies toall elements; but User Agents are not required to apply to table and inline-table elements when border-collapse is collapse. The behavior on internal table elements is unde...
... Candidate Recommendation Initial definition ...
border-top-right-radius - 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 rounding can be a circle or an ellipse, or if one of the value is 0 no rounding is done and the corner is square. A background, being an image or a color, is clipped at the border, even a rounded one; the exact location of the clipping is defined by the value of the background-clip property. ...
...ne of the value is 0 no rounding is done and the corner is square. A background, being an image or a color, is clipped at the border, even a rounded one; the exact location of the clipping is defined by the value of the background-clip property. Note: If the value of this property is not set in a border-radius shorthand property that is applied to the element after the border-top-right-radius CSS property, the value of this property is then reset to its initial value by the shorthand property. Syntax /* the corner is a circle */ /* border-top-right-radius: radius */ border-top-right-radius: 3px; /* the corner is an ellipse */ /* border-top-right-radius: horizontal vertical */ border-top-right-radius: 0.5em 1em; border-top-right-radius: inherit; With one value: the value is a <len...
...emi-major axis of the ellipse to use for the border in that corner. the second value is a <length> or a <percentage> denoting the vertical semi-major axis of the ellipse to use for the border in that corner. Values <length-percentage> Denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipse. As absolute length it can be expressed in any unit allowed by the CSS <length> data type. Percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. Negative values are invalid. Formal definition Initial value0Applies toall elements; but User Agents are not required to apply to table and inline-table elements when border-collapse is collapse. The behavior on internal table elements is unde...
... Candidate Recommendation Initial definition ...
border-top-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. The specification doesn't define how borders of different styles connect in the corners. ...
...nset | outset Examples HTML <table> <tr> <td class="b1">none</td> <td class="b2">hidden</td> <td class="b3">dotted</td> <td class="b4">dashed</td> </tr> <tr> <td class="b5">solid</td> <td class="b6">double</td> <td class="b7">groove</td> <td class="b8">ridge</td> </tr> <tr> <td class="b9">inset</td> <td class="b10">outset</td> </tr> </table> CSS /* Define look of the table */ table { border-width: 2px; background-color: #52E385; } tr, td { padding: 3px; } /* border-top-style example classes */ .b1 {border-top-style: none;} .b2 {border-top-style: hidden;} .b3 {border-top-style: dotted;} .b4 {border-top-style: dashed;} .b5 {border-top-style: solid;} .b6 {border-top-style: double;} .b7 {border-top-style: groove;} .b8 {border-top-sty...
... Recommendation Initial definition. Initial valuenoneApplies toall elements. It also applies to ::first-letter.InheritednoComputed valueas spe...
...der-top-style: double;} .b7 {border-top-style: groove;} .b8 {border-top-style: ridge;} .b9 {border-top-style: inset;} .b10 {border-top-style: outset;} Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-top-style' in that specification. Candidate Recommendation No significant change. CSS Level 2 (Revision 1)The definition of 'border-top-style' in that specification. Recommendation Initial definition. Initial valuenoneApplies toall elements. It also applies to ::first-letter.InheritednoComputed valueas specifiedAnimation typediscrete ...
border-top - 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. 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. ...
...rder-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: 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 ...
...entage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> Examples Applying a top border HTML <div> This box has a border on the top side. </div> CSS div { border-top: 4px dashed blue; background-color: gold; height: 100px; width: 100px; font-weight: bold; text-align: center; } Results Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-top' in that specification. Candidate Recommendation No direct changes, though the modification o...
...gold; height: 100px; width: 100px; font-weight: bold; text-align: center; } Results Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-top' in that specification. Candidate Recommendation No direct changes, though the modification of values for the border-top-color do apply to it. CSS Level 2 (Revision 1)The definition of 'border-top' in that specification. Recommendation No significant changes. CSS Level 1The definition of 'border-top' in that specification. Recommendation Initial definition Browser compatibility The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https:...
break-after - CSS: Cascading Style Sheets
If there is no generated box, the property is ignored. ...
...pis leo, malesuada quis nisl nec, volutpat egestas tellus. <h2>Subheading</h2> <p>In finibus viverra enim vel suscipit. Quisque consequat velit eu orci malesuada, ut interdum tortor molestie. Proin sed pellentesque augue. Nam risus justo, faucibus non porta a, congue vel massa. Cras luctus lacus nisl, sed tincidunt velit pharetra ac. ...
...cies.</p> </article> CSS html { font-family: helvetica, arial, sans-serif; } h1 { font-size: 3rem; letter-spacing: 2px; column-span: all; } h2 { font-size: 1.2rem; color: red; letter-spacing: 1px; } p { line-height: 1.5; break-after: column; } article { column-width: 200px; gap: 20px; } Result Specifications Specification Status Comment CSS Fragmentation Module Level 3The definition of 'break-after' in that specification. Candidate Recommendation Adds the recto and verso keywords. Changes the media type of this property from paged to visual. Defines the breaking algorithm with different kinds of breaks. CSS Regions Module Level 1The definition of 'break-after' in that specification. Working Draft Extends the pro...
... Candidate Recommendation Adds the recto and verso keywords. Changes the media type of this property from paged to visual. Defines the breaking algorithm with different kinds of breaks. CSS Regions Module Level 1The definition of 'break-after' in that specification. Working Draft Extends the property to handle region breaks. Adds the avoid-region and region keywords. CSS Multi-column Layout ModuleThe definition of 'break-after' in that specification. Working Draft Initial definition. Extends the CSS 2.1 page-break-after property to handle both page and column breaks. 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-co...
break-before - CSS: Cascading Style Sheets
If there is no generated box, the property is ignored. ...
...pis leo, malesuada quis nisl nec, volutpat egestas tellus. <h2>Subheading</h2> <p>In finibus viverra enim vel suscipit. Quisque consequat velit eu orci malesuada, ut interdum tortor molestie. Proin sed pellentesque augue. Nam risus justo, faucibus non porta a, congue vel massa. Cras luctus lacus nisl, sed tincidunt velit pharetra ac. ...
...ies.</p> </article> CSS html { font-family: helvetica, arial, sans-serif; } h1 { font-size: 3rem; letter-spacing: 2px; column-span: all; } h2 { font-size: 1.2rem; color: red; letter-spacing: 1px; break-before: column; } p { line-height: 1.5; } article { column-width: 200px; gap: 20px; } Result Specifications Specification Status Comment CSS Fragmentation Module Level 3The definition of 'break-before' in that specification. Candidate Recommendation Adds the recto and verso keywords. Changes the media type of this property from paged to visual. Defines the breaking algorithm with different kinds of breaks. CSS Regions Module Level 1The definition of 'break-before' in that specification. Working Draft Extends the p...
... Candidate Recommendation Adds the recto and verso keywords. Changes the media type of this property from paged to visual. Defines the breaking algorithm with different kinds of breaks. CSS Regions Module Level 1The definition of 'break-before' in that specification. Working Draft Extends the property to handle region breaks. Adds the avoid-region and region keywords. CSS Multi-column Layout ModuleThe definition of 'break-before' in that specification. Working Draft Initial definition. Extends the CSS 2.1 page-break-before property to handle both page and column breaks. 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-...
clip-path - CSS: Cascading Style Sheets
Web › CSS › clip-path
Parts that are inside the region are shown, while those outside are hidden. 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. ...
...creating the SVG viewport, the reference box is positioned at the origin of the coordinate system established by the viewBox attribute and the dimension of the size of the reference box is set to the width and height values of the viewBox attribute. none No clipping path is created. Note: A computed value other than none results in the creation of a new stacking context the same way that CSS opacity does for values other than 1. Formal definition Initial valuenoneApplies toall elements; In SVG, it applies to container elements excluding the defs element and all graphics elementsInheritednoPercentagesrefer to reference box when specified, otherwise border-boxComputed valueas specified, but with <url> values made absoluteAnimation typeyes, as specified for <basic-shape>, otherwise n...
...="0" width="90" height="90"/> </clipPath> </defs> </svg> <select id="clipPath"> <option value="none">none</option> <option value="circle(100px at 110px 100px)">circle</option> <option value="url(#cross)" selected>cross</option> <option value="inset(20px round 20px)">inset</option> <option value="path('M 0 200 L 0,110 A 110,90 0,0,1 240,100 L 200 340 z')">path</option> </select> CSS #clipped { margin-bottom: 20px; clip-path: url(#cross); } JavaScript const clipPathSelect = document.getElementById("clipPath"); clipPathSelect.addEventListener("change", function (evt) { document.getElementById("clipped").style.clipPath = evt.target.value; }); Result Specifications Specification Status Comment CSS Masking Module Level 1The definition...
...ing Module Level 1The definition of 'clip-path' in that specification. 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 definition of 'clip-path' in that specification. Recommendation Initial definition (applies to SVG elements only). CSS Shapes Module Level 2The definition of 'path' in that specification. Editor's Draft Defines path(). ...
clip - CSS: Cascading Style Sheets
Web › CSS › clip
The clip property applies only to absolutely positioned elements -- that is, elements with position:absolute or position:fixed. /* Keyword value */ clip: auto; /* <shape> values */ clip: rect(1px 10em 3rem 2ch); clip: rect(1px, 10em, 3rem, 2ch); /* Global values */ clip: inherit; clip: initial; clip: unset; Syntax Note: Where possible, authors are encouraged to use the newer clip-path property instead. Values <<shape>()> A rectangular <<shape>()> of the form rect(<top> <right> <bottom> <left>). The <top> and <bottom> values are offsets from the inside top border edge of the box, while <right> and <left> are offsets from the inside left border edge of the box -- that is, the extent of the padding box. ...
...border edges. ...
... Recommendation Initial definition. ...
... Recommendation Initial definition. ...
column-width - CSS: Cascading Style Sheets
The container will have as many columns as can fit without any of them having a width less than the column-width value. If the width of the container is narrower than the specified value, the single column's width will be smaller than the declared column width. 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 property can help you create responsive designs that fit different screen sizes. ...
...es listed below. Values <length> Indicates the optimal column width. The actual column width may differ from the specified value: it may be wider when necessary to fill available space, and narrower when the available space is too small. The value must be strictly positive or the declaration is invalid. Percentage values are also invalid. auto The width of the column is determined by other CSS properties, such as column-count. Formal definition Initial valueautoApplies toBlock containers except table wrapper boxesInheritednoComputed valuethe absolute length, zero or largerAnimation typea length Formal syntax <length> | auto Examples Setting column width in pixels HTML <p class="content-box"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod...
...on typea length Formal syntax <length> | auto Examples Setting column width in pixels HTML <p class="content-box"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. ...
...um dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. </p> CSS .content-box { column-width: 100px; } Result Specifications Specification Status Comment CSS Writing Modes Level 4The definition of 'column-width' in that specification. Candidate Recommendation Adds intrinsic sizes via the keywords min-content, max-content, fill-available, and fit-content. CSS Multi-column Layout ModuleThe definition of 'column-width' in that specification. Working Draft Initial definition. ...
cross-fade() - CSS: Cascading Style Sheets
The CSS cross-fade() function can be used to blend two or more images at a defined transparency. It can be used for many simple image manipulations, such as tinting an image with a solid color or highlighting a particular area of the page by combining an image with a radial gradient. Syntax Important: The specification and current implementations have different syntaxes. The specification syntax is explained first. Specification syntax The cross-fade() function takes a list of images with a percentage defining how much of each image is retained in terms of opacity when it is blended with the other images. The percent value must be coded without quotes, must contain the "%" symbol, and its value must be between 0% and 100%. ...
...syntaxes. The specification syntax is explained first. Specification syntax The cross-fade() function takes a list of images with a percentage defining how much of each image is retained in terms of opacity when it is blended with the other images. The percent value must be coded without quotes, must contain the "%" symbol, and its value must be between 0% and 100%. The function can be used in CSS anywhere an ordinary image reference can be used. Cross-fade percentages Think of the percentage as an opacity value for each image. This means a value of 0% means the image is fully transparent while a value of 100% makes the image fully opaque. cross-fade( url(white.png) 0%, url(black.png) 100%); /* fully black */ cross-fade( url(white.png) 25%, url(black.png) 75%); /* 25% white, 75% black *...
...h>?<linear-color-hint> = <length-percentage><length-percentage> = <length> | <percentage><angular-color-stop> = <color> && <color-stop-angle>?<angular-color-hint> = <angle-percentage>where <color-stop-length> = <length-percentage>{1,2}<color-stop-angle> = <angle-percentage>{1,2}<angle-percentage> = <angle> | <percentage> Examples Older syntax for cross-fade HTML <div class="crossfade"></div> CSS .crossfade { width: 300px; height: 300px; background-image: -webkit-cross-fade( url('https://mdn.mozillademos.org/files/8543/br.png'), url('https://mdn.mozillademos.org/files/8545/tr.png'), 75%); background-image: cross-fade( url('https://mdn.mozillademos.org/files/8543/br.png'), url('https://mdn.mozillademos.org/files/8545/tr.png'), ...
... Working Draft Initial definition ...
cursor - CSS: Cascading Style Sheets
Web › CSS › cursor
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. ...
...image types are not supported. A non-URL fallback (one or more of the keyword values) must be at the end of the fallback list. See Using URL values for the cursor property for more details. <x> <y> Optional x- and y-coordinates. Two unitless nonnegative numbers less than 32. Keyword values Move your mouse over values to see their live appearance in your browser: Category CSS value Example Description General auto The UA will determine the cursor to display based on the current context. E.g., equivalent to text when hovering text. default The platform-dependent default cursor. Typically an arrow. none No cursor is rendered. Links & status context-menu A context me...
... Recommendation Initial definition. ...
...ir; } .bar { cursor: zoom-in; } /* A fallback keyword value is required when using a URL */ .baz { cursor: url("hyper.cur"), auto; } Specifications Specification Status Comment CSS Basic User Interface Module Level 3The definition of 'cursor' in that specification. Recommendation Addition of several keywords and the positioning syntax for url(). CSS Level 2 (Revision 1)The definition of 'cursor' in that specification. Recommendation Initial definition. ...
element() - CSS: Cascading Style Sheets
Web › CSS › element
Syntax element(id) where: id The ID of an element to use as the background, specified using the HTML attribute #id on the element. ...
... Syntax element(id) where: id The ID of an element to use as the background, specified using the HTML attribute #id on the element. ...
... Syntax element(id) where: 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. ...
...nstrates 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 Draft Deferred from CSS3 Images. 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. Desktop...
env() - CSS: Cascading Style Sheets
Web › CSS › env
The difference is that, as well as being user-agent defined rather than user-defined, environment variables are globally scoped to a document, whereas custom properties are scoped to the element(s) on which they are declared. ...
...iewport, which is safe to put content into without risking it being cut off by the shape of a non-rectangular display. For rectangular viewports, like your average laptop monitor, their value is equal to zero. For non-rectangular displays -- like a round watch face -- the four values set by the user agent form a rectangle such that all content inside the rectangle is visible. Note: Unlike other CSS properties, user agent-defined property names are case-sensitive. Formal syntax env( <custom-ident> , <declaration-value>? ) Examples The below example makes use of the optional second parameter of env(), which allows you to provide a fallback value in case the environment variable is not available. <p> If the <code>env()</code> function is supported in your browser, this paragraph's tex...
...les The below example makes use of the optional second parameter of env(), which allows you to provide a fallback value in case the environment variable is not available. <p> If the <code>env()</code> function is supported in your browser, this paragraph's text will have 50px of padding between it and the left border -- but not the top, right and bottom. This is because the accompanying CSS is the equivalent of <code>padding: 0 0 0 50px</code>, because, unlike other CSS properties, user agent property names are case-sensitive. </p> p { width: 300px; border: 2px solid red; padding: env(safe-area-inset-top, 50px) env(safe-area-inset-right, 50px) env(safe-area-inset-bottom, 50px) env(SAFE-AREA-INSET-LEFT, 50px); } Example values padding: env(safe-area-ins...
... Editor's Draft Initial definition. ...
flex-direction - 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. Note that the values row and row-reverse are affected by the directionality of the flex container. If its dir attribute is ltr, row represents the horizontal axis oriented from the left to the right, and row-reverse from the right to the left; if the dir attribute is rtl, row represents the axis oriented from the right to the left, and row-reverse from the left to the right. ...
...s the same as column but the main-start and main-end are permuted. Accessibility concerns Using the flex-direction property with values of row-reverse or column-reverse will create a disconnect between the visual presentation of content and DOM order. This will adversely affect users experiencing low vision navigating with the aid of assistive technology such as a screen reader. If the visual (CSS) order is important, then screen reader users will not have access to the correct reading order. Flexbox & the keyboard navigation disconnect -- Tink Source Order Matters | Adrian Roselli MDN Understanding WCAG, Guideline 1.3 explanations Understanding Success Criterion 1.3.2 | W3C Understanding WCAG 2.0 Formal definition Initial valuerowApplies toflex containersInheritednoComputed value...
...ground-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> </div> CSS #content { width: 200px; height: 200px; border: 1px solid #c3c3c3; display: flex; flex-direction: column-reverse; } .box { width: 50px; height: 50px; } #content1 { width: 200px; height: 200px; border: 1px solid #c3c3c3; display: flex; flex-direction: row-reverse; } .box1 { width: 50px; height: 50px; } Result Specifications Specification Status C...
... Candidate Recommendation Initial definition ...
flex-wrap - CSS: Cascading Style Sheets
Web › CSS › flex-wrap
Syntax flex-wrap: nowrap; /* Default value */ flex-wrap: wrap; flex-wrap: wrap-reverse; /* Global values */ flex-wrap: inherit; flex-wrap: initial; flex-wrap: unset; The flex-wrap property is specified as a single keyword chosen from the list of values below. ...
... property sets whether flex items are forced onto one line or can wrap onto multiple lines. If wrapping is allowed, it sets the direction that lines are stacked. 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 Using CSS flexible boxes for more properties and information. Syntax flex-wrap: nowrap; /* Default value */ flex-wrap: wrap; flex-wrap: wrap-reverse; /* Global values */ flex-wrap: inherit; flex-wrap: initial; flex-wrap: unset; The flex-wrap property is specified as a single keyword chosen from the list of values below. Values The following values are accepted: nowrap The flex items are laid out...
... <div class="green">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...
... Candidate Recommendation ...
flex - CSS: Cascading Style Sheets
Web › CSS › flex
The flex CSS shorthand property sets how a flex item will grow or shrink to fit the space available in its flex container. 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. ...
... property sets how a flex item will grow or shrink to fit the space available in its flex container. 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. ...
...ypeas each of the properties of the shorthand:flex-grow: a numberflex-shrink: a numberflex-basis: a length, percentage or calc(); Formal syntax none | [ <'flex-grow'> <'flex-shrink'>? | <'flex-basis'> ] Examples Setting flex: auto HTML <div id="flex-container"> <div class="flex-item" id="flex">Flex box (click to 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%; ...
... Candidate Recommendation Initial definition ...
font-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. 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). ...
...h an oblique face is slanted. You can select this using the <angle> modifier for the oblique keyword. For TrueType or OpenType variable fonts, the "slnt" variation is used to implement varying slant angles for oblique, and the "ital" variation with a value of 1 is used to implement italic values. See font-variation-settings. For the example below to work, you'll need a browser that supports the CSS Fonts Level 4 syntax in which font-style: oblique can accept an <angle>. HTML <header> <input type="range" id="slant" name="slant" min="-90" max="90" /> <label for="slant">Slant</label> </header> <div class="container"> <p class="sample">...it would not be wonderful to meet a Megalosaurus, forty feet long or so, waddling like an elephantine lizard up Holborn Hill.</p> </div> CS...
... Recommendation No change ...
....</p> <p class="oblique">This paragraph is oblique.</p> .normal { font-style: normal; } .italic { font-style: italic; } .oblique { font-style: oblique; } Specifications Specification Status Comment CSS Fonts Module Level 4The definition of 'font-style' in that specification. Working Draft Adds the ability to specify an angle after oblique CSS Fonts Module Level 3The definition of 'font-style' in that specification. Candidate Recommendation No change CSS Level 2 (Revision 1)The definition of 'font-style' in that specification. Recommendation No change CSS Level 1The definition of 'font-style' in that specification. Recommendation Initial definition ...
font-variant-caps - 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. When a given font includes capital letter glyphs of multiple different sizes, this property selects the most appropriate ones. If petite capital glyphs are not available, they are rendered using small capital glyphs. If these are not present, the browser synthesizes them from the uppercase glyphs. Fonts sometimes include special glyphs for various caseless characters (such as punctuation marks) to better match the capitalized characters around them. ...
...es toall elements. It also applies to ::first-letter and ::first-line.InheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax normal | small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps Examples Setting the small-caps font variant HTML <p class="small-caps">Firefox rocks, small caps!</p> <p class="normal">Firefox rocks, normal caps!</p> CSS .small-caps { font-variant-caps: small-caps; font-style: italic; } .normal { font-variant-caps: normal; font-style: italic; } Result Specifications Specification Status Comment CSS Fonts Module Level 3The definition of 'font-variant-caps' in that specification. Candidate Recommendation Initial definition Browser compatibility The compatibi...
...To change preferences in Firefox, visit about:config.IE No support NoOpera Full support 39Safari No support NoWebView Android Full support 52Chrome Android ...
...To change preferences in Firefox, visit about:config.Opera Android Full support 41Safari iOS No support NoSamsung Internet Android Full support 6.0Legend Full support ...
font-variant-ligatures - CSS: Cascading Style Sheets
This leads to more harmonized forms in the resulting text. 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. ...
...l-alt-values> ]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 ] 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 ...
...</p> <p class="historical-ligatures"> historical-ligatures<br> if fi ff tf ft jf fj </p> <p class="no-historical-ligatures"> no-historical-ligatures<br> if fi ff tf ft jf fj </p> <p class="contextual"> contextual<br> if fi ff tf ft jf fj </p> <p class="no-contextual"> no-contextual<br> if fi ff tf ft jf fj </p> <p class="contextual"> contextual<br> if fi ff tf ft jf fj </p> CSS p { font-family: Lora, serif; } .normal { font-variant-ligatures: normal; } .none { font-variant-ligatures: none; } .common-ligatures { font-variant-ligatures: common-ligatures; } .no-common-ligatures { font-variant-ligatures: no-common-ligatures; } .discretionary-ligatures { font-variant-ligatures: discretionary-ligatures; } .no-discretionary-ligatures { font-variant-ligature...
... Candidate Recommendation Initial definition ...
font-variant-position - CSS: Cascading Style Sheets
The glyphs are positioned relative to the baseline of the font, which remains unchanged. These glyphs are typically used in <sub> and <sup> elements. /* Keyword values */ font-variant-position: normal; font-variant-position: sub; font-variant-position: super; /* Global values */ font-variant-position: inherit; font-variant-position: initial; font-variant-position: unset; When the usage of these alternate glyphs is activated, if one character in the run doesn't have such a typographically-enhanced glyph, the whole set of characters of the run is rendered using a fallback method, synthesizing these glyphs. ...
...he run are rendered using synthesized glyphs. Formal definition Initial valuenormalApplies toall elements. It also applies to ::first-letter and ::first-line.InheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax normal | sub | super Examples Setting superscript and subscript forms HTML <p class="normal">Normal!</p> <p class="super">Super!</p> <p class="sub">Sub!</p> CSS p { display: inline; } .normal { font-variant-position: normal; } .super { font-variant-position: super; } .sub { font-variant-position: sub; } Result Specifications Specification Status Comment CSS Fonts Module Level 3The definition of 'font-variant-position' in that specification. Candidate Recommendation Initial definition. Browser com...
...To change preferences in Firefox, visit about:config.IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android ...
...To change preferences in Firefox, visit about:config.Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support NoLegend Full support ...
font-variation-settings - 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. ...
... font-weight range. Registered and custom axes Variable font axes come in two types: registered and custom. Registered axes are the most commonly encountered -- 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. ...
...stom axes Variable font axes come in two types: registered and custom. Registered axes are the most commonly encountered -- 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. An...
... Formal definition Initial valuenormalApplies toall elements. It also applies to ::first-letter and ::first-line.InheritedyesComputed valueas specifiedAnimation typea transform Formal syntax normal | [ <string> <number> ]# Examples You can find a number of other variable fonts examples at our Variable fonts guide, v-fonts.com, and axis-praxis.org. Weight (wght) The following live example's CSS can be edited to allow you to play with font weight values. Slant (slnt) The following live example's CSS can be edited to allow you to play with font slant/oblique values. Specifications Specification Status Comment CSS Fonts Module Level 4The definition of 'font-variation-settings' in that specification. Working Draft Initial definition ...
grid-area - CSS: Cascading Style Sheets
Web › CSS › grid-area
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 four <grid-line> values are specified, grid-row-start is set to the first value, grid-column-start is set to the second value, grid-row-end is set to the third value, and grid-column-end is set to the fourth value. ...
...t>; otherwise, it is set to auto. When grid-column-start is omitted, if grid-row-start is a <custom-ident>, all four longhands are set to that value. Otherwise, it is set to auto. The grid-area property can also be set to a <custom-ident> which acts as a name for the area, which can then be placed using grid-template-areas. ...
... ...
... Candidate Recommendation Initial definition ...
grid-column - CSS: Cascading Style Sheets
If two <grid-line> values are given they are separated by "/". ...
...ic) to its grid placement, thereby specifying the inline-start and inline-end edge of its grid area. 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: grid-column-end grid-column-start Syntax This property is specified as one or two <grid-line> values. If two <grid-line> values are given they are separated by "/". The grid-column-start longhand is set to the value before the slash, and the grid-column-end longhand is set to the value after the slash. Each <grid-line> value can be specified as: either the auto keyword or...
...olumn-start: as specifiedgrid-column-end: as specifiedAnimation typediscrete Formal syntax <grid-line> [ / <grid-line> ]?where <grid-line> = auto | <custom-ident> | [ <integer> && <custom-ident>? ...
...<div id="item3"></div> </div> CSS #grid { display: grid; height: 100px; grid-template-columns: repeat(6, 1fr); grid-template-rows: 100px; } #item1 { background-color: lime; } #item2 { background-color: yellow; grid-column: 2 / 4; } #item3 { background-color: blue; grid-column: span 2 / 7; } Result Specifications Specification Status Comment CSS Grid LayoutThe definition of 'grid-column' in that specification. Candidate Recommendation Initial definition ...
grid-row - CSS: Cascading Style Sheets
Web › CSS › grid-row
The grid-row CSS shorthand property specifies a grid item's size and location within the grid row by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the inline-start and inline-end edge of its grid area. 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 two <grid-line> values are specified, the grid-row-start longhand is set to the value before the slash, and the grid-row-end longhand is set to the value after the slash. ...
...y. 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 two <grid-line> values are specified, the grid-row-start longhand is set to the value before the slash, and the grid-row-end longhand is set to the value after the slash. ...
...nd:grid-row-start: as specifiedgrid-row-end: as specifiedAnimation typediscrete Formal syntax <grid-line> [ / <grid-line> ]?where <grid-line> = auto | <custom-ident> | [ <integer> && <custom-ident>? ...
...iv> <div id="item3"></div> </div> CSS #grid { display: grid; height: 200px; grid-template-columns: 200px; grid-template-rows: repeat(6, 1fr); } #item1 { background-color: lime; } #item2 { background-color: yellow; grid-row: 2 / 4; } #item3 { background-color: blue; grid-row: span 2 / 7; } Result Specifications Specification Status Comment CSS Grid LayoutThe definition of 'grid-row' in that specification. Candidate Recommendation Initial definition ...
grid-template - CSS: Cascading Style Sheets
The grid-template CSS property is a shorthand property for defining grid columns, rows, and areas. 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 grid-template CSS property is a shorthand property for defining grid columns, rows, and areas. 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. ...
...-breadth> , <track-breadth> ) | fit-content( [ <length> | <percentage> ] )<explicit-track-list> = [ <line-names>? ...
... Candidate Recommendation Initial definition ...
grid - CSS: Cascading Style Sheets
Web › CSS › grid
The grid CSS property is a shorthand property that sets all of the explicit and implicit grid 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. Note: You can only specify the explicit or the implicit grid properties in a single grid declaration. The sub-properties you don't specify are set to their initial value, as normal for shorthands. Also, the gutter properties are NOT reset by this shorthand. ...
...://github.com/mdn/interactive-examples and send us a pull request. Note: You can only specify the explicit or the implicit grid properties in a single grid declaration. The sub-properties you don't specify are set to their initial value, as normal for shorthands. Also, the gutter properties are NOT reset by this shorthand. ...
... Candidate Recommendation Initial definition ...
... Candidate Recommendation Initial definition ...
inset-block - CSS: Cascading Style Sheets
The inset-block CSS property defines the logical block start and end offsets of an element, which maps to physical offsets depending on the element's writing mode, directionality, and text orientation. It corresponds to the top and bottom, or right and left properties depending on the values defined for writing-mode, direction, and text-orientation. ...
... Formal definition Initial valueautoApplies topositioned elementsInheritednoPercentageslogical-height of containing blockComputed valuesame as box offsets: top, right, bottom, left properties except that directions are logicalAnimation typea length, percentage ...
... Editor's Draft Init...
... Editor's Draft Initial definition ...
inset-inline - CSS: Cascading Style Sheets
The inset-inline CSS property defines the logical start and end offsets of an element in the inline direction, which maps to physical offsets depending on the element's writing mode, directionality, and text orientation. It corresponds to the top and bottom, or right and left properties depending on the values defined for writing-mode, direction, and text-orientation. ...
... Formal definition Initial valueautoApplies topositioned elementsInheritednoPercentageslogical-width of containing blockComputed valuesame as box offsets: top, right, bottom, left properties except that directions are logicalAnimation typea length, percentag...
... Editor's Draft In...
... Editor's Draft Initial definition ...
<integer> - CSS: Cascading Style Sheets
Web › CSS › integer
The <integer> CSS data type is a special type of <number> that represents a whole number, whether positive or negative. Integers can be used in numerous CSS properties, such as column-count, counter-increment, grid-column, grid-row, and z-index. Syntax The <integer> data type consists of one or several decimal digits, 0 through 9 inclusive, optionally preceded by a single + or - sign. There is no unit associated with integers. Note: There is no official range of valid <integer> values. Opera 12.1 supports values up to 215-1, IE up to 220-1, and other browsers even higher. ...
...unter-increment, grid-column, grid-row, and z-index. Syntax The <integer> data type consists of one or several decimal digits, 0 through 9 inclusive, optionally preceded by a single + or - sign. There is no unit associated with integers. Note: There is no official range of valid <integer> values. Opera 12.1 supports values up to 215-1, IE up to 220-1, and other browsers even higher. During the CSS3 Values cycle there was a lot of discussion about setting a minimum range to support: the latest decision, in April 2012 during the LC phase, was [-227-1; 227-1], but other values like 224-1 and 230-1 were also proposed. However, the latest spec doesn't specify a range anymore. Interpolation When animated, values of the <integer> data type are interpolated using discrete, whole steps. The calcu...
...d. ten Letters are not allowed. _5 Special characters are not allowed. \35 Escaped Unicode characters are not allowed, even if they are an integer (here: 5). \4E94 Non-arabic numerals are not allowed, even when escaped (here: the Japanese 5, ?). 3e4 Scientific notation is not allowed. Specifications Specification Status Comment CSS Values and Units Module Level 4The definition of '<integer>' in that specification. Editor's Draft No significant change. CSS Values and Units Module Level 3The definition of '<integer>' in that specification. Candidate Recommendation No significant change. CSS Level 2 (Revision 1)The definition of '<integer>' in that specification. Recommendation Explicit defi...
... Recommendation Implicit definition. Browser compatibility The compatibility table on this page is generated from structured data. ...
justify-content - CSS: Cascading Style Sheets
The interactive example below demonstrates some of the values using Grid 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 alignment is done after the lengths and auto margins are applied, meaning that, if in a Flexbox layout there is at least one flexible element, with flex-grow different from 0, it will have no effect as there won't be any available space. ...
...nersInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax normal | <content-distribution> | <overflow-position>? ...
... Candidate Recommendation Initial definition ...
...document.getElementById("container").style.justifyContent = evt.target.value; }); Result Specifications Specification Status Comment CSS Box Alignment Module Level 3The definition of 'justify-content' in that specification. Working Draft Adds the [ first | last ]? baseline, self-start, self-end, start, end, left, right, unsafe | safe values. CSS Flexible Box Layout ModuleThe definition of 'justify-content' in that specification. Candidate Recommendation Initial definition ...
left - CSS: Cascading Style Sheets
Web › CSS › left
It has no effect on non-positioned elements. 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 /* <length> values */ left: 3px; left: 2.4em; /* <percentage>s of the width of the containing block */ left: 10%; /* Keyword value */ left: auto; /* Global values */ left: inherit; left: initial; left: unset; Values <length> A negative, null, or positive <length> that represents: for absolutely positioned elements, the distance to the left edge of the containing block. ...
... <pre> position: absolute; bottom: 10px; right: 20px; </pre> <p>Absolute position inside of a parent with relative position</p> </div> <div id="example_5"> <pre> position: absolute; right: 0; left: 0; top: 200px; </pre> <p>Absolute position with both left and right declared</p> </div> </div> </div> CSS #wrap { width: 700px; margin: 0 auto; background: #5C5C5C; } pre { white-space: pre; white-space: pre-wrap; white-space: pre-line; word-wrap: break-word; } #example_1 { width: 200px; height: 200px; position: absolute; left: 20px; top: 20px; background-color: #D8F5FF; } #example_2 { width: 200px; height: 200px; position: relative; top: 0; right: 0; backgro...
... Recommendation Initial definition. ...
... Recommendation Initial definition. ...
linear-gradient() - CSS: Cascading Style Sheets
Its result is an object of the <gradient> data type, which is a special kind of <image>. 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. ...
...he gradient's axis). <color-hint> The color-hint is an interpolation hint defining how the gradient progresses between adjacent color stops. The length defines at which point between two color stops the gradient color should reach the midpoint of the color transition. If omitted, the midpoint of the color transition is the midpoint between two color stops. Note: Rendering of color stops in CSS gradients follows the same rules as color stops in SVG gradients. Note also that the first example above does not exactly render as depicted in Mozilla Firefox (particularly version 80.0b3). You'll have to set the html height property to 100% or 100vh to render as depicted. Description As with any gradient, a linear gradient has no intrinsic dimensions; i.e., it has no natural or preferr...
...tops of lower value will override the value of the previous color stop creating a hard transition. The following changes from red to yellow at the 30% mark, and then transitions from yellow to blue over 35% of the gradient linear-gradient(red 40%, yellow 30%, blue 65%); Multi-position color stop are allowed. A color can be declared as two adjacent color stops by including both positions in the CSS declaration. The following three gradients are equivalent: linear-gradient(red 0%, orange 10%, orange 30%, yellow 50%, yellow 70%, green 90%, green 100%); linear-gradient(red, orange 10% 30%, yellow 50% 70%, green 90%); linear-gradient(red 0%, orange 10% 30%, yellow 50% 70%, green 90% 100%); By default, if there is no color with a 0% stop, the first color declared will be at that point. Similar...
...cyan); } Gradient with multi-position color stops This example uses multi-position color stops, with adjacent colors having the same color stop value, creating a striped effect. body { width: 100vw; height: 100vh; } body { background: linear-gradient(to right, red 20%, orange 20% 40%, yellow 40% 60%, green 60% 80%, blue 80%); } More linear-gradient examples Please see Using CSS gradients for more examples. Specifications Specification Status Comment CSS Images Module Level 4The definition of 'Gradient Color-Stops' in that specification. Working Draft Adds interpolation hints. CSS Images Module Level 3The definition of 'linear-gradient()' in that specification. Candidate Recommendation Initial definition. ...
list-style-image - CSS: Cascading Style Sheets
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. ...
...pecifies that no image is used as the marker. If this value is set, the marker defined in list-style-type will be used instead. ...
... Recommendation Initial definition ...
...em 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. Recommendation Initial definition ...
margin-block - CSS: Cascading Style Sheets
The margin-block CSS shorthand property defines the logical block start and end margins of an element, which maps to physical margins depending on the element's writing mode, directionality, and text orientation. /* <length> values */ margin-block: 10px 20px; /* An absolute length */ margin-block: 1em 2em; /* relative to the text size */ margin-block: 5% 2%; /* relative to the nearest block container's width */ margin-block: 10px; /* sets both start and end values */ /* Keyword values */ margin-block: auto; /* Global values */ margin-block: inherit; margin-block: initial; margin-block: unset; These values corresponds to the margin-top and margin-bottom, or margin-right, and margin-left property depending on the values defined for writing-mode, direction, and text-orientation. Con...
...alues */ /* Keyword values */ margin-block: auto; /* Global values */ margin-block: inherit; margin-block: initial; margin-block: unset; These values corresponds to the margin-top and margin-bottom, or margin-right, and margin-left property depending on the values defined for writing-mode, direction, and text-orientation. Constituent properties This property is a shorthand for the following CSS properties: margin-block-end margin-block-start Syntax Values The margin-block property takes the same values as the margin-left property. Formal definition Initial value0Applies tosame as marginInheritednoPercentagesdepends on layout modelComputed valueif specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, autoAnimatio...
... Editor's Draft Initial definition. ...
... Editor's Draft Initial definition. ...
margin-bottom - CSS: Cascading Style Sheets
A positive value places it farther from its neighbors, while a negative value places it closer. 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 property has no effect on non-replaced inline elements, such as <span> or <code>. ...
...entagesrefer to the width of the containing blockComputed valuethe percentage as specified or the absolute lengthAnimation typea length Formal syntax <length> | <percentage> | auto Examples Setting positive and negative bottom margins HTML <div class="container"> <div class="box0">Box 0</div> <div class="box1">Box 1</div> <div class="box2">Box one's negative margin pulls me up</div> </div> CSS CSS for divs to set margin-bottom and height .box0 { margin-bottom:1em; height:3em; } .box1 { margin-bottom:-1.5em; height:4em; } .box2 { border:1px dashed black; border-width:1px 0; margin-bottom:2em; } Some definitions for container and divs so margins' effects can be seen more clearly .container { background-color:orange; width:320px; border:1px so...
... Recommendation Initial definition ...
...s so margins' effects can be seen more clearly .container { background-color:orange; width:320px; border:1px solid black; } div { width:320px; background-color:gold; } Result Specifications Specification Status Comment CSS Basic Box ModelThe definition of 'margin-bottom' in that specification. Working Draft No significant change CSS Level 2 (Revision 1)The definition of 'margin-bottom' in that specification. Recommendation Removes its effect on inline elements. CSS Level 1The definition of 'margin-bottom' in that specification. Recommendation Initial definition ...
margin-inline - CSS: Cascading Style Sheets
The margin-inline CSS shorthand property is a shorthand property that defines both the logical inline start and end margins of an element, which maps to physical margins depending on the element's writing mode, directionality, and text orientation. /* <length> values */ margin-inline: 10px 20px; /* An absolute length */ margin-inline: 1em 2em; /* relative to the text size */ margin-inline: 5% 2%; /* relative to the nearest block container's width */ margin-inline: 10px; /* sets both start and end values */ /* Keyword values */ margin-inline: auto; /* Global values */ margin-inline: inherit; margin-inline: initial; margin-inline: unset; This property corresponds to the margin-top and margin-bottom, or margin-right, and margin-left properties, depending on the values define...
... /* Keyword values */ margin-inline: auto; /* Global values */ margin-inline: inherit; margin-inline: initial; margin-inline: unset; This property corresponds to the margin-top and margin-bottom, or margin-right, and margin-left properties, depending on the values defined for writing-mode, direction, and text-orientation. Constituent properties This property is a shorthand for the following CSS properties: margin-inline-end margin-inline-start Syntax Values The margin-inline property takes the same values as the margin-left property. Formal definition Initial value0Applies tosame as marginInheritednoPercentagesdepends on layout modelComputed valueif specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, autoAnima...
... Editor's Draft Initial definition. ...
... Editor's Draft Initial definition. ...
margin-left - CSS: Cascading Style Sheets
A positive value places it farther from its neighbors, while a negative value places it closer. 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 vertical margins of two adjacent boxes may fuse. This is called margin collapsing. In the rare cases where width is overconstrained (i.e., when all of width, margin-left, border, padding, the content area, and margin-right are defined), margin-left is ignored, and will have the same calculated value as if the auto value was specified. ...
... Recomm...
...h Formal syntax <length> | <percentage> | auto Examples Setting left margin using pixels and percentages .content { margin-left: 5%; } .sidebox { margin-left: 10px; } .logo { margin-left: -5px; } Specifications Specification Status Comment CSS Basic Box ModelThe definition of 'margin-left' in that specification. Working Draft No significant change from CSS 2.1. CSS Flexible Box Layout ModuleThe definition of 'margin-left' in that specification. ...
...: -5px; } Specifications Specification Status Comment CSS Basic Box ModelThe definition of 'margin-left' in that specification. Working Draft No significant change from CSS 2.1. CSS Flexible Box Layout ModuleThe definition of 'margin-left' in that specification. Candidate Recommendation Defines the behavior of margin-left on flex items. CSS Level 2 (Revision 1)The definition of 'margin-left' in that specification. Recommendation Like in CSS1, but removes its effect on inline elements. CSS Level 1The definition of 'margin-left' in that specification. Recommendation Initial definition. ...
mask-border - CSS: Cascading Style Sheets
See mask-border-source. ...
...See mask-border-source. ...
... | <'mask-border-repeat'> | <'mask-border-mode'> Examples Setting a bitmap-based mask border In this example, we will mask an element's border with a diamond pattern. The source for the mask is a ".png" file of 90 by 90 pixels, with three diamonds going vertically and horizontally: HTML <div id="bitmap">This element is surrounded by a bitmap-based mask border! Pretty neat, isn't it?</div> CSS To match the size of a single diamond, we will use a value of 90 divided by 3, or 30, for slicing the image into corner and edge regions. A repeat value of round will make the mask slices fit evenly, i.e., without clipping or gaps. div { width: 200px; background-color: lavender; border: 18px solid salmon; padding: 10px; /* Prefixed longhand properties currently supported in Chromium ...
... Candidate Recommendation Initial definition ...
mask-image - CSS: Cascading Style Sheets
<image> An image value used as mask image layer. ...
... transparent); mask-image: image(url(mask.png), skyblue); /* Multiple values */ mask-image: image(url(mask.png), skyblue), linear-gradient(rgba(0, 0, 0, 1.0), transparent); /* Global values */ mask-image: inherit; mask-image: initial; mask-image: unset; Syntax Values none This keyword is interpreted as a transparent black image layer. <mask-source> A <url> reference to a <mask> or to a CSS image. <image> An image value used as mask image layer. Formal definition Initial valuenoneApplies toall elements; In SVG, it applies to container elements excluding the defs element and all graphics elementsInheritednoComputed valueas specified, but with <url> values made absoluteAnimation typediscrete Formal syntax <mask-reference>#where <mask-reference> = none | <image> | <mask-source>w...
... Candidate...
... Candidate Recommendation Initial definition ...
mask-repeat - CSS: Cascading Style Sheets
A mask image can be repeated along the horizontal axis, the vertical axis, both axes, or not repeated at all. ...
...xample: An image with an original width of 260px, repeated three times, might stretch until each repetition is 300px wide, and then another image will be added. They will then compress to 225px. no-repeat The image is not repeated (and hence the mask painting area will not necessarily be entirely covered). The position of the non-repeated mask image is defined by the mask-position CSS property. Formal definition Initial valueno-repeatApplies toall elements; In SVG, it applies to container elements excluding the defs element and all graphics elementsInheritednoComputed valueConsists of two keywords, one per dimensionAnimation typediscrete Formal syntax <repeat-style>#where <repeat-style> = repeat-x | repeat-y | [ repeat | space | round | no-repeat ]{1,2} Example...
...tion Initial valueno-repeatApplies toall elements; In SVG, it applies to container elements excluding the defs element and all graphics elementsInheritednoComputed valueConsists of two keywords, one per dimensionAnimation typediscrete Formal syntax <repeat-style>#where <repeat-style> = repeat-x | repeat-y | [ repeat | space | round | no-repeat ]{1,2} Examples Setting repeat for a single mask CSS #masked { width: 250px; height: 250px; background: blue linear-gradient(red, blue); mask-image: url(https://mdn.mozillademos.org/files/12676/star.svg); mask-repeat: repeat; /* Can be changed in the live sample */ margin-bottom: 10px; } HTML Content <div id="masked"> </div> <select id="repetition"> <option value="repeat-x">repeat-x</option> <option value="repeat-y">repeat-y</o...
... Candidate Recommendation Initial definition ...
mask-size - CSS: Cascading Style Sheets
Web › CSS › mask-size
The size of the image can be fully or partially constrained in order to preserve its intrinsic ratio. ...
... Syntax One or more <bg-size> values, separated by commas. A <bg-size> can be specified in one of three ways: using the keyword contain using the keyword cover using width and height values To specify a size using width and height, you can supply one or two values: If only one value is g...
... element and all graphics elementsInheritednoComputed valueas specified, but with relative lengths converted into absolute lengthsAnimation typerepeatable list of simple list of length, percentage, or calc Formal syntax <bg-size>#where <bg-size> = [ <length-percentage> | auto ]{1,2} | cover | containwhere <length-percentage> = <length> | <percentage> Examples Setting mask size as a percentage CSS #masked { width: 200px; height: 200px; background: blue linear-gradient(red, blue); -webkit-mask-image: url(https://mdn.mozillademos.org/files/12668/MDN.svg); mask-image: url(https://mdn.mozillademos.org/files/12668/MDN.svg); -webkit-mask-size: 50%; mask-size: 50%; /* Can be changed in the live sample */ margin-bottom: 10px; } HTML <div id="masked"> </div> <select id="maskSiz...
... Candidate Recommendation Initial definition ...
mask-type - CSS: Cascading Style Sheets
Web › CSS › mask-type
It applies to the <mask> element itself. /* Keyword values */ mask-type: luminance; mask-type: alpha; /* Global values */ mask-type: inherit; mask-type: initial; mask-type: unset; This property may be overridden by the mask-mode property, which has the same effect but applies to the element where the mask is used. Alpha masks will generally be faster to render. Syntax The mask-type property is specified as one of the keyword values listed below. Values luminance Is a keyword indicating that the associated mask image is a luminance mask, i.e., that its relative luminance values must be used when applying it. ...
...s 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/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="0" height="0"> <defs> <mask id="m" maskContentUnits="objectBoundingBox" ...
... Candidate Recommendation Initial definition. ...
... Candidate Recommendation Initial definition. ...
max-block-size - CSS: Cascading Style Sheets
That is, if the writing direction is horizontal, then max-block-size is equivalent to max-height; if the writing direction is vertical, max-block-size is the same as max-width. The other dimension's maximum length is specified using the max-inline-size property. This is useful because the max-width is always used for horizontal sizes and max-height is always used for vertical sizes, and if you need to set lengths based on the size of your text content, you need to be able to do so with the writing direction in mind. ...
...They may be restored in Level 4. The writing modes lr, lr-tb, rl, rb, and rb-tl are no longer allowed in HTML contexts; they may only be used in SVG 1.x contexts. Formal definition Initial value0Applies tosame as width and heightInheritednoPercentagesblock-size of containing blockComputed valuesame as max-width and max-heightAn...
...ng mode <code>vertical-rl</code>:</p> <div class="standard-box vertical"> Call me Ishmael. Some years ago--never mind how long precisely--having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. It is a way I have of driving off the spleen and regulating the circulation. </div> CSS The CSS defines three classes. The first, standard-box, is applied to both boxes, as seen above. It provides standard styling including the minimum and maximum block sizes, font size, and so forth. After that come the classes horizontal and vertical, which add the writing-mode property to the box, with the value set to horizontal-tb or vertical-rl depending on which class is used. .standard-bo...
...depending on which class is used. .standard-box { padding: 4px; background-color: #abcdef; color: #000; font: 16px "Open Sans", "Helvetica", "Arial", sans-serif; max-block-size: 160px; min-block-size: 100px; } .horizontal { writing-mode: horizontal-tb; } .vertical { writing-mode: vertical-rl; } Result Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'max-block-size' in that specification. Editor's Draft Initial definition ...
min() - CSS: Cascading Style Sheets
Web › CSS › min
The min() function can be used anywhere a <length>, <frequency>, <angle>, <time>, <percentage>, <number>, or <integer> is allowed. 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 the first above example, the width will be at most 200px, but will be smaller if the viewport is less than 400px wide (in which case 1vw would be 4px, so 50vw would be 200px). In other words, the maximum width is 200px. ...
... ) Accessibility concerns When using min() to set a maximum font size, ensure that the font can still be scaled at least 200% for readability (without assistive technology like a zoom function). ...
...ogy like a zoom function). MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.4 | W3C Understanding WCAG 2.0 Examples Setting a maximum size for a label and input Another use case for CSS functions is to set a maximum size on responsive form controls: enabling the width of labels and inputs to shrink as the width of the form shrinks. Let's look at some CSS: input, label { padding: 2px; box-sizing: border-box; display: inline-block; width: min(40%, 400px); background-color: pink; } form { margin: 4px; border: 1px solid black; padding: 4px; } Here, the form itself, along with the margin, border, and padding, will be 100% of its parent's width. We declare the input and label to be the lesser of 40% of the form width up to the paddi...
... of 40% of the form width up to the padding or 400px wide, whichever is smaller. In other words, the widest that the label and input can be is 400px. The narrowest they will be is 40% of the form's width, which on a smartwatch's screen is very small. <form> <label>Type something:</label> <input type="text"> </form> Specifications Specification Status Comment CSS Values and Units Module Level 4The definition of 'min()' in that specification. Editor's Draft Initial definition. ...
minmax() - CSS: Cascading Style Sheets
Web › CSS › minmax
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. ...
...ribution of the grid items occupying the grid track. auto As a maximum, identical to max-content. As a minimum it represents the largest minimum size (as specified by min-width/min-height) of the grid items occupying the grid track. ...
...size (as specified by min-width/min-height) of the grid items occupying the grid track. Formal syntax minmax( [ <length> | <percentage> | min-content | max-content | auto ] , [ <length> | <percentage> | <flex> | min-content | max-content | auto ] ) CSS properties minmax() function can be used within: grid-template-columns grid-template-rows grid-auto-columns grid-auto-rows Examples CSS #container { display: grid; grid-template-columns: minmax(min-content, 300px) minmax(200px, 1fr) 150px; grid-gap: 5px; box-sizing: border-box; height: 200px; width: 100%; background-color: #8cffa0; padding: 10px; } #container > div { background-color: #8ca0ff; padding: 5px; } HTML <div id="container"> <div> Item as wide as the content, but at most 300 pixels. </di...
... Candidate Recommendation Initial definition ...
<number> - CSS: Cascading Style Sheets
Web › CSS › number
The speed of the interpolation is determined by the timing function associated with the animation. Examples Valid numbers 12 A raw <integer> is also a <number>. ...
...The speed of the interpolation is determined by the timing function associated with the animation. Examples Valid numbers 12 A raw <integer> is also a <number>. ...
... with a leading - .60 Fractional number without a leading zero 10e3 Scientific notation -3.4e-2 Complicated scientific notation Invalid numbers 12. Decimal points must be followed by at least one digit. +-12.2 Only one leading +/- is allowed. 12.1.1 Only one decimal point is allowed. Specifications Specification Status Comment CSS Values and Units Module Level 4The definition of '<number>' in that specification. Editor's Draft No significant change. CSS Values and Units Module Level 3The definition of '<number>' in that specification. Candidate Recommendation No significant change. CSS Level 2 (Revision 1)The definition of '<number>' in that specification. Recommendation Explicit definit...
...its Module Level 4The definition of '<number>' in that specification. Editor's Draft No significant change. CSS Values and Units Module Level 3The definition of '<number>' in that specification. Candidate Recommendation No significant change. CSS Level 2 (Revision 1)The definition of '<number>' in that specification. Recommendation Explicit definition. CSS Level 1The definition of '<number>' in that specification. Recommendation Implicit definition. ...
object-position - CSS: Cascading Style Sheets
Areas of the box which aren't covered by the replaced element's object will show the element's background. You can adjust how the replaced element's object's intrinsic size (that is, its natural size) is adjusted to fit within the element's box using the object-fit 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. ...
...e> ] ]where <length-percentage> = <length> | <percentage> Examples Positioning image content 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...
...ion-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 positioned with its right edge flush against the right edge of the element's box and is located 10% of the way down the height of the element's box. Result Specifications Specification Status Comment CSS Images Module Level 3The definition of 'object-position' in that specification. 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://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInter...
... ...
opacity - CSS: Cascading Style Sheets
Web › CSS › opacity
Opacity is the degree to which content behind an element is hidden, and is the opposite of transparency. 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 Values <alpha-value> A <number> in the range 0.0 to 1.0, inclusive, or a <percentage> in the range 0% to 100%, inclusive, representing the opacity of the channel (that is, the value of its alpha channel). Any value outside the interval, though valid, is clamped to the nearest limit in the range. ...
...ial value1.0Applies toall elementsInheritednoComputed valuethe specified value, clipped in the range [0,1]Animation typea number Formal syntax <alpha-value>where <alpha-value> = <number> | <percentage> Examples Setting background opacity HTML <div class="light">You can barely see this.</div> <div class="medium">This is easier to see.</div> <div class="heavy">This is very easy to see.</div> CSS div { background-color: yellow; } .light { opacity: 0.2; /* Barely see the text over the background */ } .medium { opacity: 0.5; /* See the text more clearly over the background */ } .heavy { opacity: 0.9; /* See the text very clearly over the background */ } Result Setting opacity on hover HTML <img src="//developer.mozilla.org/static/img/opengraph-logo.png" alt="MDN logo" width=...
... Working Draft De...
.../static/img/opengraph-logo.png" alt="MDN logo" width="128" height="146" class="opacity"> CSS img.opacity { opacity: 1; filter: alpha(opacity=100); /* IE8 and lower */ zoom: 1; /* Triggers "hasLayout" in IE 7 and lower */ } img.opacity:hover { opacity: 0.5; filter: alpha(opacity=50); zoom: 1; } Result Specifications Specification Status Comment CSS Color Module Level 4The definition of 'opacity' in that specification. Working Draft Defines percentage opacity values. CSS Color Module Level 3The definition of 'opacity' in that specification. Recommendation Initial definition ...
order - CSS: Cascading Style Sheets
Web › CSS › order
Items in a container are sorted by ascending order value and then by their source code order. 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 /* <integer> values */ order: 5; order: -5; /* Global values */ order: inherit; order: initial; order: unset; Since order is only meant to affect the visual order of elements and not their logical or tab order. order must not be used on non-visual media such as speech. Values <integer> Represents the ordinal group to be used by the item. ...
...t be used on non-visual media such as speech. Values <integer> Represents the ordinal group to be used by the item. Accessibility concerns Using the order property will create a disconnect between the visual presentation of content and DOM order. This will adversely affect users experiencing low vision navigating with the aid of assistive technology such as a screen reader. If the visual (css) order is important, then screen reader users will not have access to the correct reading order. Flexbox & the keyboard navigation disconnect -- Tink Source Order Matters | Adrian Roselli MDN Understanding WCAG, Guideline 1.3 explanations Understanding Success Criterion 1.3.2 | W3C Understanding WCAG 2.0 Formal definition Initial value0Applies toflex items and absolutely-positioned flex ...
...ters | Adrian Roselli MDN Understanding WCAG, Guideline 1.3 explanations Understanding Success Criterion 1.3.2 | W3C Understanding WCAG 2.0 Formal definition Initial value0Applies toflex items and absolutely-positioned flex container childrenInheritednoComputed valueas specifiedAnimation typean integer Formal syntax <integer> Examples Ordering items in a flex container This example uses CSS to create a classic two-sidebar layout surrounding a content block. The Flexible Box Layout Module automatically creates blocks of equal vertical size and uses as much horizontal space as available. HTML <header>...</header> <main> <article>Article</article> <nav>Nav</nav> <aside>Aside</aside> </main> <footer>...</footer> CSS main { display: flex; text-align:center; } main > article { ...
... HTML <header>...</header> <main> <article>Article</article> <nav>Nav</nav> <aside>Aside</aside> </main> <footer>...</footer> CSS main { display: flex; text-align:center; } main > article { flex:1; order: 2; } main > nav { width: 200px; order: 1; } main > aside { width: 200px; order: 3; } Result Specifications Specification Status Comment CSS Flexible Box Layout ModuleThe definition of 'order' in that specification. Candidate Recommendation Initial definition Initial value0Applies toflex items and absolutely-positioned flex container childrenInheritednoComputed valueas specifiedAnimation typean integer ...
overflow - CSS: Cascading Style Sheets
Web › CSS › overflow
The overflow CSS shorthand property sets the desired behavior for an element's overflow -- i.e. when an element's content is too big to fit in its block formatting context -- in both directions. 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 an element's content is too big to fit in its block formatting context -- in both directions. 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: overflow-x overflow-y Syntax /* Keyword values */ overflow: visible; overflow: hidden; overflow: clip; overflow: scroll; overflow: auto; overflow: hidden visible; /* Global values */ overflow: inherit; overflow: initial; overflow: unset; The overflow property is specified as one or two keywords chosen from the list of values below. If two keywords are specified, the first ap...
...llbars-vertical [1] Use overflow-x: hidden and overflow-y: scroll, or overflow: scroll hidden instead. -moz-hidden-unscrollable Intended mainly for internal use and by themes. Disables scrolling of XML root elements, <html>, and <body> with the keyboard's arrow keys and the mouse wheel. [1] As of Firefox 63, this feature is behind a feature preference setting. In about:config, set layout.css.overflow.moz-scrollbars.enabled to true Description Overflow options include clipping, showing scrollbars, or displaying the content flowing out of its container into the surrounding area. Specifying a value other than visible (the default) creates a new block formatting context. This is necessary for technical reasons -- if a float intersected with the scrolling element it would forcibly rewr...
... /* always show scrollbars */ } overflow: scroll Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium. p { overflow: auto; /* append scrollbars if necessary */ } overflow: auto Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium. Specifications Specification Status Comment CSS Overflow Module Level 3The definition of 'overflow' in that specification. Working Draft Changed syntax to allow one or two keywords instead of only one CSS Level 2 (Revision 1)The definition of 'overflow' in that specification. Recommendation Initial definition. ...
padding-bottom - 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. An element's padding area is the space between its content and its border. Note: The padding property can be used to set paddings on all four sides of an element with a single declaration. ...
... Recommendation Initial definition. ...
... Recommendation Initial definition. ...
...and percentages .content { padding-bottom: 5%; } .sidebox { padding-bottom: 10px; } Specifications Specification Status Comment CSS Basic Box ModelThe definition of 'padding-bottom' in that specification. Working Draft No change. CSS Level 2 (Revision 1)The definition of 'padding-bottom' in that specification. Recommendation No change. CSS Level 1The definition of 'padding-bottom' in that specification. Recommendation Initial definition. ...
padding-left - 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. An element's padding area is the space between its content and its border. Note: The padding property can be used to set paddings on all four sides of an element with a single declaration. ...
... Recommendation Initial definition. ...
... Recommendation Initial definition. ...
... pixels and percentages .content { padding-left: 5%; } .sidebox { padding-left: 10px; } Specifications Specification Status Comment CSS Basic Box ModelThe definition of 'padding-left' in that specification. Working Draft No change. CSS Level 2 (Revision 1)The definition of 'padding-left' in that specification. Recommendation No change. CSS Level 1The definition of 'padding-left' in that specification. Recommendation Initial definition. ...
padding-right - 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. An element's padding area is the space between its content and its border. Note: The padding property can be used to set paddings on all four sides of an element with a single declaration. ...
... Recommendation Initial definition. ...
... Recommendation Initial definition. ...
...els and percentages .content { padding-right: 5%; } .sidebox { padding-right: 10px; } Specifications Specification Status Comment CSS Basic Box ModelThe definition of 'padding-right' in that specification. Working Draft No change. CSS Level 2 (Revision 1)The definition of 'padding-right' in that specification. Recommendation No change. CSS Level 1The definition of 'padding-right' in that specification. Recommendation Initial definition. ...
padding-top - 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. An element's padding area is the space between its content and its border. Note: The padding property can be used to set paddings on all four sides of an element with a single declaration. ...
... Recommendation Initial definition. ...
... Recommendation Initial definition. ...
...sing pixels and percentages .content { padding-top: 5%; } .sidebox { padding-top: 10px; } Specifications Specification Status Comment CSS Basic Box ModelThe definition of 'padding-top' in that specification. Working Draft No change. CSS Level 2 (Revision 1)The definition of 'padding-top' in that specification. Recommendation No change. CSS Level 1The definition of 'padding-top' in that specification. Recommendation Initial definition. ...
page-break-inside - CSS: Cascading Style Sheets
/* Keyword values */ page-break-inside: auto; page-break-inside: avoid; /* Global values */ page-break-inside: inherit; page-break-inside: initial; page-break-inside: unset; Syntax Values auto Initial value. Automatic page breaks (neither forced nor forbidden). avoid Avoid page breaks inside the element. Page break aliases The page-break-inside property is now a legacy property, replaced by break-inside. For compatibility reasons, page-break-inside should be treated by browsers as an alias of break-inside. ...
...t paragraph.</p> <section class="list"> <span>A list</span> <ol> <li>one</li> <!-- <li>two</li> --> </ol> </section> <ul> <li>one</li> <!-- <li>two</li> --> </ul> <p>This is the second paragraph.</p> <p>This is the third paragraph, it contains more text.</p> <p>This is the fourth paragraph. ...
... Recommendation Initial definition. ...
... Recommendation Initial definition. ...
paint() - CSS: Cascading Style Sheets
Web › CSS › paint
The paint() CSS function defines an <image> value generated with a PaintWorklet. Syntax paint(workletName, parameters) where: workletName The name of the registered worklet. parameters Optional additional parameters to pass to the paintWorklet Examples You can pass additional arguments via the CSS paint() function. In this example, we passed two arguments: whether the background-image on a group of list items is filled or just has a stroke outline, and the width of that outline: <ul> <li>item 1</li> <li>item 2</li> <li>item 3</li> <li>item 4</li> <li>item 5</li> <li>item 6</li> <li>item 7</li> <li>item 8</li> <li>item 9</li> <li>item 10</li> <li>item 11</li> <li>item 12</li> <li>item 13</li> <li>item 14</li> <...
... <li>item 2</li> <li>item 3</li> <li>item 4</li> <li>item 5</li> <li>item 6</li> <li>item 7</li> <li>item 8</li> <li>item 9</li> <li>item 10</li> <li>item 11</li> <li>item 12</li> <li>item 13</li> <li>item 14</li> <li>item 15</li> <li>item 16</li> <li>item 17</li> <li>item 18</li> <li>item 19</li> <li>item 20</li> </ul> CSS.paintWorklet.addModule('https://mdn.github.io/houdini-examples/cssPaint/intro/worklets/hilite.js'); li { --boxColor: hsla(55, 90%, 60%, 1.0); background-image: paint(hollowHighlights, stroke, 2px); } li:nth-of-type(3n) { --boxColor: hsla(155, 90%, 60%, 1.0); background-image: paint(hollowHighlights, filled, 3px); } li:nth-of-type(3n+1) { --boxColor: hsla(255, 90%, 60%, 1.0); ...
....0); background-image: paint(hollowHighlights, filled, 3px); } li:nth-of-type(3n+1) { --boxColor: hsla(255, 90%, 60%, 1.0); background-image: paint(hollowHighlights, stroke, 1px); } We've included a custom property in the selector block defining a boxColor. Custom properties are accessible to the PaintWorklet. Specifications Specification Status Comment CSS Painting API Level 1The definition of 'Paint Notation' in that specification. Working Draft 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://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOp...
... 47Safari iOS No support NoSamsung Internet Android Full support 9.2Legend Full support Full support No support No support See also PaintWorklet CSS Painting API Using the CSS Painting API <image> canvas ...
place-content - CSS: Cascading Style Sheets
The place-content CSS shorthand property allows you to align content along both the block and inline directions at once (i.e. the align-content and justify-content properties) in a relevant layout system such as Grid or Flexbox. 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. ...
...e align-content and justify-content properties) in a relevant layout system such as Grid or Flexbox. 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. ...
...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 live sample */ direction: ltr; /* Can be changed in the live sample */ place-content: flex-end center; /* Can be changed in the live sample */ } div > div { border: 2px solid #8c8c8c; width: 50px; background-color: #a0c8f...
... Working Draft Initial definition ...
place-self - CSS: Cascading Style Sheets
The place-self CSS shorthand property allows you to align an individual item in both the block and inline directions at once (i.e. the align-self and justify-self properties) in a relevant layout system such as Grid or Flexbox. If the second value is not present, the first value is also used for it. 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. ...
...em such as Grid or Flexbox. If the second value is not present, the first value is also used for it. 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. ...
...ven different values of place-self, to show how these override the default placements. These values cause the grid items to span only as wide/tall as their content width/height, and align in different positions across their cells, in the block and inline directions. ...
... Working Draft Initial definition ...
repeating-linear-gradient() - CSS: Cascading Style Sheets
It is similar to linear-gradient() and takes the same arguments, but it repeats the color stops infinitely in all directions so as to cover its entire container. The function's result is an object of the <gradient> data type, which is a special kind of <image>. 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 length of the gradient that repeats is the distance between the first and last color stop. ...
...ient will not repeat. <color-hint> Th color-hint is an interpolation hint defining how the gradient progresses between adjacent color stops. The length defines at which point between two color stops the gradient color should reach the midpoint of the color transition. If omitted, the midpoint of the color transition is the midpoint between two color stops. Note: Rendering of color stops in CSS gradients follows the same rules as color stops in SVG gradients. Formal syntax repeating-linear-gradient( [ <angle> | to <side-or-corner> ,]? <color-stop-list> ) \---------------------------------/ \---------------/ Definition of the gradient line List of color stops where <side-or-corner> = [left | right] || [top | bottom] a...
... Candidate Recommendation Initial definition. ...
... Candidate Recommendation Initial definition. ...
<resolution> - CSS: Cascading Style Sheets
Units dpi Represents the number of dots per inch. Screens typically contains 72 or 96 dots per inch, but the dpi for printed documents is usually much greater. As 1 inch is 2.54 cm, 1dpi ? 0.39dpcm. dpcm Represents the number of dots per centimeter. As 1 inch is 2.54 cm, 1dpcm ? 2.54dpi. ...
... Units dpi Represents the number of dots per inch. Screens typically contains 72 or 96 dots per inch, but the dpi for printed documents is usually much greater. As 1 inch is 2.54 cm, 1dpi ? 0.39dpcm. dpcm Represents the number of dots per centimeter. As 1 inch is 2.54 cm, 1dpcm ? 2.54dpi. ...
...iteral and the number. Units dpi Represents the number of dots per inch. Screens typically contains 72 or 96 dots per inch, but the dpi for printed documents is usually much greater. As 1 inch is 2.54 cm, 1dpi ? 0.39dpcm. dpcm Represents the number of dots per centimeter. As 1 inch is 2.54 cm, 1dpcm ? 2.54dpi. dppx Represents the number of dots per px unit. Due to the 1:96 fixed ratio of CSS in to CSS px, 1dppx is equivalent to 96dpi, which corresponds to the default resolution of images displayed in CSS as defined by image-resolution. x Alias for dppx. Note: Although the number 0 is always the same regardless of unit, the unit may not be omitted. In other words, 0 is invalid and does not represent 0dpi, 0dpcm, or 0dppx. Examples Use in a media query @media print and (min-re...
...epresent 0dpi, 0dpcm, or 0dppx. Examples Use in a media query @media print and (min-resolution: 300dpi) { ... } Valid resolutions 96dpi 50.82dpcm 3dppx Invalid resolutions 72 dpi Spaces are not allowed between the number and the unit. ten dpi The number must use digits only. 0 The unit is required. Specifications Specification Status Comment CSS Values and Units Module Level 4The definition of '<resolution>' in that specification. Editor's Draft Adds the x unit. CSS Values and Units Module Level 3The definition of '<resolution>' in that specification. Candidate Recommendation Adds the dppx unit. Media QueriesThe definition of '<resolution>' in that specification. Recommendation Initial definition. ...
revert - CSS: Cascading Style Sheets
Web › CSS › revert
This removes from the cascade all of the styles that have been overridden until the style being rolled back to is reached. ...
...rd 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. 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 us...
...ecific section the color of the section will be black. But if you have a rule to make all paragraphs red then all paragraphs will still be red in all sections. Revert is just a value. It is still possible to override revert value using specificity. The revert keyword is different from and should not be confused with initial, which uses the initial value defined on a per-property basis by the CSS specifications. In contrast, user-agent stylesheets set default values on the basis of CSS selectors. For example, the initial value for the display property is inline, whereas a normal user-agent stylesheet sets the default display value of <div>s to block, of <table>s to table, etc. Examples Revert vs unset Although revert and unset are similar they differ for some properties for some elem...
...raph will be red.</p> This will also be black. </section> Notice how paragraph still has a red color even though a color property for the section was reverted. Also note that both the header and plain text node is black. This is exactly the same as if section { color: darkgreen } would not exist for the second section. Specifications Specification Status Comment CSS Cascading and Inheritance Level 4The definition of 'revert' in that specification. Candidate Recommendation Initial definition. ...
row-gap (grid-row-gap) - CSS: Cascading Style Sheets
Web › CSS › row-gap
This prefixed property is being replaced by row-gap. However, in order to support browsers that implemented grid-row-gap and not row-gap for grid, you will need to use the prefixed property as in the interactive example above. ...
...This prefixed property is being replaced by row-gap. However, in order to support browsers that implemented grid-row-gap and not row-gap for grid, you will need to use the prefixed property as in the interactive example above. ...
...ted valueas specified, with <length>s made absolute, and normal computing to zero except on multi-column elementsAnimation typea length, percentage or calc(); Formal syntax normal | <length-percentage>where <length-percentage> = <length> | <percentage> Examples Flex layout HTML <div id="flexbox"> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> </div> CSS #flexbox { display: flex; flex-wrap: wrap; width: 300px; row-gap: 20px; } #flexbox > div { border: 1px solid green; background-color: lime; flex: 1 1 auto; width: 100px; height: 50px; } Result Grid layout HTML <div id="grid"> <div></div> <div></div> <div></div> </div> CSS #grid { grid-row-gap: 20px; } #grid { display: grid; height: 200px; grid-templa...
... Working Draft Initial definition ...
ruby-align - CSS: Cascading Style Sheets
/* Keyword values */ ruby-align: start; ruby-align: center; ruby-align: space-between; ruby-align: space-around; /* Global values */ ruby-align: inherit; ruby-align: initial; ruby-align: unset; Syntax Values start Is a keyword indicating that the ruby will be aligned with the start of the base text. center Is a keyword indicating that the ruby will be aligned at the middle of the base text. space-between Is a keyword indicating that the extra space will be distributed between the elements of the ruby. space-around Is a keyword indicating that the extra space will be distributed between the elements of the ruby, and around it. ...
...ion Initial valuespace-aroundApplies toruby bases, ruby annotations, ruby base containers, ruby annotation containersInheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax start | center | space-between | space-around Examples Ruby aligned at the start of the base text HTML <ruby> <rb>This is a long text to check</rb> <rp>(</rp><rt>short ruby</rt><rp>)</rp> </ruby> CSS ruby { ruby-align: start; } Result Ruby aligned at the center of the base text HTML <ruby> <rb>This is a long text to check</rb> <rp>(</rp><rt>short ruby</rt><rp>)</rp> </ruby> CSS ruby { ruby-align: center; } Result Extra space distributed between ruby elements HTML <ruby> <rb>This is a long text to check</rb> <rp>(</rp><rt>short ruby</rt><rp>)</rp> </ruby> CSS rub...
... Working Draft Initial definition ...
... Working Draft Initial definition ...
scroll-behavior - 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. Note that any other scrolls, such as those performed by the user, are not affected by this property. When this property is specified on the root element, it applies to the viewport instead. This property specified on the body element will not propagate to the viewport. User agents are allowed to ignore this property. ...
...sInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax auto | smooth Examples Setting smooth scroll behavior HTML <nav> <a href="#page-1">1</a> <a href="#page-2">2</a> <a href="#page-3">3</a> </nav> <scroll-container> <scroll-page id="page-1">1</scroll-page> <scroll-page id="page-2">2</scroll-page> <scroll-page id="page-3">3</scroll-page> </scroll-container> CSS a { display: inline-block; width: 50px; text-decoration: none; } nav, scroll-container { display: block; margin: 0 auto; text-align: center; } nav { width: 339px; padding: 5px; border: 1px solid black; } scroll-container { display: block; width: 350px; height: 200px; overflow-y: scroll; scroll-behavior: smooth; } scroll-page { display: flex; align-items: center; ...
... Working Draft Initial specification ...
... Working Draft Initial specification ...
shape-image-threshold - 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. Any pixels whose alpha component's value is greater than the threshold are considered to be part of the shape for the purposes of determining its boundaries. For example, a value of 0.5 means that the shape will enclose all the pixels that are more than 50% opaque. ...
...Formal definition Initial value0.0Applies tofloatsInheritednoComputed valueThe same as the specified value after clipping the <number> to the range [0.0, 1.0].Animation typea number Formal syntax <alpha-value>where <alpha-value> = <number> | <percentage> Examples Aligning text to a gradient This example creates a <div> block with a gradient background image. The gradient is established as a CSS shape using shape-outside, so that pixels within the gradient which are at least 20% opaque (that is, those pixels with an alpha component greater than 0.2) are considered part of the shape. HTML <div id="gradient-shape"></div> <p> Lorem ipsum dolor sit amet, consectetur adipisicing elit. Vel at commodi voluptates enim, distinctio officia. Saepe optio accusamus doloribus sint facilis ita...
...The same gradient is also...
...rather than an image file. The same gradient is also used as the image from which the shape is derived for establishing the float area, using the shape-outside property. The 20% opacity threshold for treating gradient pixels as part of the shape is then established using shape-image-threshold with a value of 0.2. Result Specifications Specification Status Comment CSS Shapes Module Level 1The definition of 'shape-image-threshold' in that specification. Candidate Recommendation Initial definition ...
text-emphasis - CSS: Cascading Style Sheets
It is a shorthand for text-emphasis-style and text-emphasis-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 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. However, text-emphasis does inherit, which means it is possible to change emphasis marks for descendents. ...
...e current leading is not enough for the marks. text-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; t...
... Candidate Recommendation Initial definition ...
...: a colortext-emphasis-style: discrete Formal syntax <'text-emphasis-style'> | <'text-emphasis-color'> Examples A heading with emphasis shape and color This example draws a heading with triangles used to emphasize each character. CSS h2 { text-emphasis: triangle #D55; } HTML <h2>This is important!</h2> Result Specifications Specification Status Comment CSS Text Decoration Module Level 3The definition of 'text-emphasis' in that specification. Candidate Recommendation Initial definition ...
text-overflow - CSS: Cascading Style Sheets
The text-overflow CSS property sets how hidden overflow content is signaled to users. It can be clipped, display an ellipsis ('...'), or display a custom string. 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-overflow property doesn't force an overflow to occur. To make text overflow its container you have to set other CSS properties: overflow and white-space. For example: overflow: hidden; white-space: nowrap; The text-overflow property only affects content that is overflowing a block container element in its inline progression direction (not text overflowing at the bottom of a box, for example). Synt...
...t is applied. The <percentage> is resolved against the width of the line box. Values lower than 0 are clipped to 0. Values greater than the width of the line box are clipped to the width of the line box. ...
...rflow-ellipsis">Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> <p class="overflow-string">Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> Result Note: Live results in the following table may be shown incorrectly due to a limitation of the MDN Editor which removes the all contents of style attributes which have text-overflow properties with string value. ...
...3. 1234567890 text-overflow: ',' clip ,3456 1234567890 ,4321 1234567890 text-overflow: ',' ellipsis ,34... 1234567890 ,43... 1234567890 text-overflow: ',' '.' ,34. 1234567890 ,43. 1234567890 Specifications Specification Status Comment CSS Overflow Module Level 4 Added the values <string> and fade and the fade() function CSS Overflow Module Level 3The definition of 'text-overflow' in that specification. Working Draft Initial definition A previous version of this interface reached the Candidate Recommendation status. As some not-listed-at-risk features needed to be removed, the spec was demoted to the Wo...
text-rendering - CSS: Cascading Style Sheets
However, Gecko and WebKit browsers let you apply this property to HTML and XML content on Windows, macOS, and Linux. ...
... browser makes trade-offs among speed, legibility, and geometric precision. /* Keyword values */ text-rendering: auto; text-rendering: optimizeSpeed; text-rendering: optimizeLegibility; text-rendering: geometricPrecision; /* Global values */ text-rendering: inherit; text-rendering: initial; text-rendering: unset; Note: The text-rendering property is an SVG property that is not defined in any CSS standard. However, Gecko and WebKit browsers let you apply this property to HTML and XML content on Windows, macOS, and Linux. One very visible effect is optimizeLegibility, which enables ligatures (ff, fi, fl, etc.) in text smaller than 20px for some fonts (for example, Microsoft's Calibri, Candara, Constantia, and Corbel, or the DejaVu font family). Syntax Values auto The browser makes ...
...ritedyesComputed valueas specifiedAnimation typediscrete Formal syntax auto | optimizeSpeed | optimizeLegibility | geometricPrecision Examples Automatic application of optimizeLegibility This demonstrates how optimizeLegibility is used by browsers automatically when the font-size is smaller than 20px. HTML <p class="small">LYoWAT - ff fi fl ffl</p> <p class="big">LYoWAT - ff fi fl ffl</p> CSS .small { font: 19.9px "Constantia", "Times New Roman", "Georgia", "Palatino", serif; } .big { font: 20px "Constantia", "Times New Roman", "Georgia", "Palatino", serif; } Result optimizeSpeed vs optimizeLegibility This example shows the difference between the appearance of optimizeSpeed and optimizeLegibility (in your browser; other browsers may vary). HTML <p class="speed">LYoWAT - ff f...
...gia", "Palatino", serif; } .big { font: 20px "Constantia", "Times New Roman", "Georgia", "Palatino", serif; } Result optimizeSpeed vs optimizeLegibility This example shows the difference between the appearance of optimizeSpeed and optimizeLegibility (in your browser; other browsers may vary). HTML <p class="speed">LYoWAT - ff fi fl ffl</p> <p class="legibility">LYoWAT - ff fi fl ffl</p> CSS p { font: 1.5em "Constantia", "Times New Roman", "Georgia", "Palatino", serif } .speed { text-rendering: optimizeSpeed; } .legibility { text-rendering: optimizeLegibility; } Result Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'text-rendering' in that specification. Candidate Recommendation No change ...
text-shadow - CSS: Cascading Style Sheets
It accepts a comma-separated list of shadows to be applied to the text and any of its decorations. Each shadow is described by some combination of X and Y offsets from the element, blur radius, and 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. ...
... ...
... ...
...tis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore.</p> Specifications Specification Status Comment CSS Text Decoration Module Level 3The definition of 'text-shadow' in that specification. Candidate Recommendation The CSS property text-shadow was improperly defined in CSS2 and dropped in CSS2 (Level 1). The CSS Text Module Level 3 spec refined the syntax. Later it was moved to CSS Text Decoration Module Level 3. ...
matrix3d() - CSS: Cascading Style Sheets
Its result is a <transform-function> data type. Syntax The matrix3d() function is specified with 16 values. They are described in the column-major order. matrix3d(a1, b1, c1, d1, a2, b2, c2, d2, a3, b3, c3, d3, a4, b4, c4, d4) Values a1 b1 c1 d1 a2 b2 c2 d2 a3 b3 c3 d3 Are <number>s describing the linear transformation. a4 b4 c4 d4 Are <number>s describing the translation to apply. Note: Until Firefox 16, Gecko accepted a <length> value for a4, b4 and c4. ...
... example shows a 3D cube created from DOM elements and transforms, which can be hovered/focused to apply a matrix3d() transform to it. ...
...50px); } Result Matrix translation and scale example Another transform3d() example, which implements an animated combined translate and scale. HTML <div class="foo"> Lorem ipsum dolor sit amet, consectetur adipisicing elit. ...
... Editor's Draft Initial definition ...
rotate() - CSS: Cascading Style Sheets
Its result is a <transform-function> data type. The fixed point that the element rotates around -- mentioned above -- is also known as the transform origin. This defaults to the center of the element, but you can set your own custom transform origin using the transform-origin property. Syntax The amount of rotation created by rotate() is specified by an <angle>. If positive, the movement will be clockwise; if negative, it will be counter-clockwise. A rotation by 180? is called point reflection. rotate(a) Values a Is an <angle> representing the angle of the rotation. ...
...For example, if you rotate before translatin...
... want apply multiple transformations to an element, be careful about the order in which you specify your transformations. ...
... Working Draft Initial definition ...
rotate3d() - CSS: Cascading Style Sheets
Its result is a <transform-function> data type. 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 3D space, rotations have three degrees of liberty, which together describe a single axis of rotation. The axis of rotation is defined by an [x, y, z] vector and pass by the origin (as defined by the transform-origin property). ...
... is defined by an [x, y, z] vector and pass by the origin (as defined by the transform-origin property). If, as specified, the vector is not normalized (i.e., if the sum of the square of its three coordinates is not 1), the user agent will normalize it internally. A non-normalizable vector, such as the null vector, [0, 0, 0], will cause the rotation to be ignored, but without invaliding the whole CSS property. Note: Unlike rotations in the 2D plane, the composition of 3D rotations is usually not commutative. In other words, the order in which the rotations are applied impacts the result. Syntax The amount of rotation created by rotate3d() is specified by three <number>s and one <angle>. The <number>s represent the x-, y-, and z-coordinates of the vector denoting the axis of rotation. The <...
...s coordinates on RP2 Cartesian coordinates on R3 1+(1-cos(a))(x2-1)z.sin(a)+xy(1-cos(a))-y.sin(a)+xz.(1-cos(a))-z.sin(a)+xy.(1-cos(a))1+(1-cos(a))(y2-1)x.sin(a)+yz.(1-cos(a))ysin(a) + xz(1-cos(a))-xsin(a)+yz(1-cos(a))1+(1-cos(a))(z2-1)t0001 Homogeneous coordinates on RP3 Examples Rotating on the y-axis HTML <div>Normal</div> <div class="rotated">Rotated</div> CSS body { perspective: 800px; } div { width: 80px; height: 80px; background-color: skyblue; } .rotated { transform: rotate3d(0, 1, 0, 60deg); background-color: pink; } Result Rotating on a custom axis HTML <div>Normal</div> <div class="rotated">Rotated</div> CSS body { perspective: 800px; } div { width: 80px; height: 80px; background-color: skyblue; } .rotated { t...
... Editor's Draft Initial definition ...
scale() - CSS: Cascading Style Sheets
Because the amount of scaling is defined by a vector, it can resize the horizontal and vertical dimensions at different scales. Its result is a <transform-function> data type. This scaling transformation is characterized by a two-dimensional vector. Its coordinates define how much scaling is done in each direction. If both coordinates are equal, the scaling is uniform (isotropic) and the aspect ratio of the element is preserved (this is a homothetic transformation). When a coordinate value is outside the [-1, 1] range, the element grows along that dimension; when inside, it shrinks. If it is negative, the result a point reflection in that dimension. A value of 1 has no effect. ...
... media feature -- use it to write a media query that will turn off animations if the user has reduced animation specified in their system preferences. ...
... Working Draft Initial definition ...
... Working Draft Initial definition ...
scale3d() - CSS: Cascading Style Sheets
Because the amount of scaling is defined by a vector, it can resize different dimensions at different scales. Its result is a <transform-function> data type. 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 scaling transformation is characterized by a three-dimensional vector. Its coordinates define how much scaling is done in each direction. If all three coordinates are equal, the scaling is uniform (isotropic) and the aspect ratio of the element is preserved (this is a homothetic transformation). ...
... scaling vector. Cartesian coordinates on R2 Homogeneous coordinates on RP2 Cartesian coordinates on R3 Homogeneous coordinates on RP3 This transformation applies to the 3D space and can't be represented on the plane. ...
... Editor's Draft Initial defi...
... Editor's Draft Initial definition ...
skew() - CSS: Cascading Style Sheets
Its result is a <transform-function> data type. 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 transformation is a shear mapping (transvection) that distorts each point within an element by a certain angle in the horizontal and vertical directions. The coordinates of each point are modified by a value proportionate to the specified angle and the distance to the origin; thus, the farther from the origin a point is, the greater will be the value added it. ...
...ng. ...
... Working Draft Initial definition ...
... Working Draft Initial definition ...
translate() - CSS: Cascading Style Sheets
Its result is a <transform-function> data type. This transformation is characterized by a two-dimensional vector. Its coordinates define how much the element moves in each direction. Syntax /* Single <length-percentage> values */ transform: translate(200px); transform: translate(50%); /* Double <length-percentage> values */ transform: translate(100px, 200px); transform: translate(100px, 50%); transform: translate(30%, 200px); transform: translate(30%, 50%); Values Single <length-percentage> values This value is a <length> or <percentage> representing the abscissa (horizontal, x-coordinate) of the translating vector. ...
... A translation is not a linear transformation in R2 and can't be represented using a Cartesian-coordinate matrix. ...
... Working Draft Initial definition ...
... Working Draft Initial definition ...
unset - CSS: Cascading Style Sheets
Web › CSS › unset
The unset CSS keyword resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not. In other words, it behaves like the inherit keyword in the first case, when the property is an inherited property, and like the initial keyword in the second case, when the property is a non-inherited property. unset can be applied to any CSS property, including the CSS shorthand all. ...
... the property is an inherited property, and like the initial keyword in the second case, when the property is a non-inherited property. unset can be applied to any CSS property, including the CSS shorthand all. ...
.../div> <div class="bar"> <p>This text is green (default inherited value).</p> </div> CSS .foo { color: blue; } .bar { color: green; } p { color: red; } .bar p { color: unset; } Result Border HTML <p>This text has a red border.</p> <div> <p>This text has a red border.</p> </div> <div class="bar"> <p>This text has a black border (initial default, not inherited).</p> </div> CSS div { border: 1px solid green; } p { border: 1px solid red; } .bar p { border-color: unset; } Result Specifications Specification Status Comment CSS Cascading and Inheritance Level 4The definition of 'unset' in that specification. ...
...ck border (initial default, not inherited).</p> </div> CSS div { border: 1px solid green; } p { border: 1px solid red; } .bar p { border-color: unset; } Result Specifications Specification Status Comment CSS Cascading and Inheritance Level 4The definition of 'unset' in that specification. Candidate Recommendation No changes from Level 3. CSS Cascading and Inheritance Level 3The definition of 'unset' in that specification. Candidate Recommendation Initial definition. ...
user-select - CSS: Cascading Style Sheets
This doesn't have any effect on content loaded as chrome, except in textboxes. ...
...t contain the entire element including all its descendants. If a double-click or context-click occurred in sub-elements, the highest ancestor with this value will be selected. contain Enables selection to start within the element; however, the selection will be contained by the bounds of that element. element (IE-specific alias) Same as contain. Supported only in Internet Explorer. Note: CSS UI 4 renames user-select: element to contain. Formal definition Initial valueautoApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax auto | text | none | contain | all Examples HTML <p>You should be able to select this text.</p> <p class="unselectable">Hey, you can't select this text!</p> <p class="all">Clicking once will select all of this text...
...names user-select: element to contain. ...
...ect this text!</p> <p class="all">Clicking once will select all of this text.</p> CSS .unselectable { -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none; } .all { -moz-user-select: all; -webkit-user-select: all; -ms-user-select: all; user-select: all; } Result Specifications Specification Status Comment CSS Basic User Interface Module Level 4The definition of 'user-select' in that specification. Working Draft Initial definition. Also defines -webkit-user-select as a deprecated alias of user-select. ...
visibility - CSS: Cascading Style Sheets
The property can also hide rows or columns in a <table>. 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 both hide an element and remove it from the document layout, set the display property to none instead of using visibility. Syntax /* Keyword values */ visibility: visible; visibility: hidden; visibility: collapse; /* Global values */ visibility: inherit; visibility: initial; visibility: unset; The visibility property is specified as one of the keyword values listed below. ...
...visibleApplies toall elementsInheritedyesComputed valueas specifiedAnimation typea visibility Formal syntax visible | hidden | collapse Examples Basic example HTML <p class="visible">The first paragraph is visible.</p> <p class="not-visible">The second paragraph is NOT visible.</p> <p class="visible">The third paragraph is visible. ...
...d paragraph is still occupying space.</p> CSS .visible { visibility: visible; } .not-visible { visibility: hidden; } Table example HTML <table> <tr> <td>1.1</td> <td class="collapse">1.2</td> <td>1.3</td> </tr> <tr class="collapse"> <td>2.1</td> <td>2.2</td> <td>2.3</td> </tr> <tr> <td>3.1</td> <td>3.2</td> <td>3.3</td> </tr> </table> CSS .collapse { visibility: collapse; } table { border: 1px solid red; } td { border: 1px solid gray; } Specifications Specification Status Comment CSS Flexible Box Layout ModuleThe definition of 'visibility' in that specification. Candidate Recommendation Defines the collapse value as it applies to flex items. ...
...td>3.3</td> </tr> </table> CSS .collapse { visibility: collapse; } table { border: 1px solid red; } td { border: 1px solid gray; } Specifications Specification Status Comment CSS Flexible Box Layout ModuleThe definition of 'visibility' in that specification. Candidate Recommendation Defines the collapse value as it applies to flex items. CSS Level 2 (Revision 1)The definition of 'visibility' in that specification. Recommendation Initial definition. ...
word-spacing - 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. Syntax /* Keyword value */ word-spacing: normal; /* <length> values */ word-spacing: 3px; word-spacing: 0.3em; /* <percentage> values */ word-spacing: 50%; word-spacing: 200%; /* Global values */ word-spacing: inherit; word-spacing: initial; word-spacing: unset; Values normal The normal inter-word spacing, as defined by the current font and/or the browser. ...
...normal The normal inter-word spacing, as defined by the current font and/or the browser. <length> Specifies extra spacing in addition to the intrinsic inter-word spacing defined by the font. <percentage> Specifies extra 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 o...
... Recommendation ...
...<length> | <percentage> Specifications Specification Status Comment CSS Text Module Level 3The definition of 'word-spacing' in that specification. Working Draft Replaces the previous values with a <spacing-limit> value that defines the same thing, plus the <percentage> value. Allows up to three values describing the optimum, minimum, and maximum value. CSS Level 2 (Revision 1)The definition of 'word-spacing' in that specification. Recommendation No change. CSS Level 1The definition of 'word-spacing' in that specification. Recommendation Initial definition. ...
zoom - CSS: Cascading Style Sheets
Web › CSS › zoom
/* Keyword values */ zoom: normal; zoom: reset; /* <percentage> values */ zoom: 50%; zoom: 200%; /* <number> values */ zoom: 1.1; zoom: 0.7; /* Global values */ zoom: inherit; zoom: initial; zoom: unset; Syntax Values normal Render this element at its normal size. reset Do not (de)magnify this element if the user applies non-pinch-based zooming (e.g. by pressing Ctrl-- or Ctrl++ keyboard shortcuts) to the document. Only supported by WebKit (and possibly Blink). <percentage> Zoom factor. ...
...onding percentage (1.0 = 100% = normal). Values larger than 1.0 zoom in. Values smaller than 1.0 zoom out. ...
...This property originated in Internet ...
...Rossen Atanassov of Microsoft has an unofficial draft specification proposal on GitHub. ...
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. ...
... A CSS property is a characteristic (like color) whose associated value defines one aspect of how the browser should display the element. ...
...lements */ /* in the document will be styled by that rule */ div { /* The property "color" with the value "black" indicates */ /* that the text will have the color black */ color: black; /* The property "background-color" with the value "white" indicates */ /* that the background color of the elements will be white */ background-color: white; } Learn more General knowledge Learn CSS Technical reference The CSS reference on MDN The CSS Working Group current work ...
Edit Shape Paths in CSS - Firefox Developer Tools
Once you have selected your element, you should see the shape icon alongside any valid value, e.g. one for shape-outside. Clicking the icon will cause the Editor to highlight the shape. To deactivate the Shape Path Editor click on the icon again, or select another element or a different editor. ...
...Once you have selected your element, you should see the shape icon alongside any valid value, e.g. one for shape-outside. Clicking the icon will cause the Editor to highlight the shape. To deactivate the Shape Path Editor click on the icon again, or select another element or a different editor. ...
...d. A solid line shows the outline of the shape that is wrapping the text. This is your shape. If the shape is clipped by the margin box then the margin box will make up part of this line. A dashed line demonstrates the outline of the shape which extends past the margin box reference; this is the area that will be clipped by the margin box. To understand the margin box, and other boxes used by CSS Shapes see our guide to Shapes from box values. Editing Basic Shapes The options given to you by the tool will differ depending on the type of basic shape that you are editing. Options can be accessed by activating the Shape Path Editor with a regular click on the icon, and you can use the context menu (Ctrl/Cmd + click) to access additional functionality. circle() If the value of shape-ou...
CSSGroupingRule - Web APIs
An object implementing the CSSGroupingRule interface represents any CSS at-rule that contains other rules nested within it. Objects deriving from it : CSSConditionRule and its children: CSSMediaRule, CSSSupportsRule, and CSSDocumentRule. CSSPageRule Syntax The syntax is described using the WebIDL format. interface CSSGroupingRule : CSSRule { readonly attribute CSSRuleList cssRules; unsigned long insertRule (DOMString rule, unsigned long index); void deleteRule (unsigned long index); } Properties common to all CSSGroupingRule instances The CSSGroupingRule derives 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 C...
...tring rule, unsigned long index); void deleteRule (unsigned long index); } Properties common to all CSSGroupingRule instances The CSSGroupingRule derives 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. ...
... 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. ...
CSSMediaRule - Web APIs
The CSSMediaRule interface represents a single CSS @media rule. It implements the CSSConditionRule interface, and therefore the CSSGroupingRule and the CSSRule interface with a type value of 4 (CSSRule.MEDIA_RULE). Syntax The syntax is described using the WebIDL 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. ...
...le : 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 from the CSSConditionRule. ...
...itionRule, 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 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 ...
CSSNumericValue - Web APIs
The CSSNumericValue interface of the CSS Typed Object Model API represents operations that all numeric values can perform. Interfaces based on CSSNumericValue Below is a list of interfaces based on the CSSNumericValue interface. CSSMathInvert CSSMathMax CSSMathMin CSSMathNegate CSSMathProduct CSSMathSum CSSMathValue CSSNumericArray CSSPerspective CSSPositionValue CSSRotate CSSSkew CSSSkeyX CSSSkeyW CSSTranslate CSSUnitValue Properties None. Event handlers No Methods CSSNumericValue.add Adds a supplied number to the CSSNumericValue. CSSNumericValue.sub Subtracts a supplied number from the CSSNumericValue. CSSNumericValue.mul Multiplies the CSSNumericValue by the supplied value. ...
...hValue CSSNumericArray CSSPerspective CSSPositionValue CSSRotate CSSSkew CSSSkeyX CSSSkeyW CSSTranslate CSSUnitValue Properties None. Event handlers No Methods CSSNumericValue.add Adds a supplied number to the CSSNumericValue. CSSNumericValue.sub Subtracts a supplied number from the CSSNumericValue. CSSNumericValue.mul Multiplies the CSSNumericValue by the supplied value. CSSNumericValue.div Divides the CSSNumericValue by the supplied value. CSSNumericValue.min Returns the minimum value passed CSSNumericValue.max Returns the maximum value passed CSSNumericValue.equals True if all the values are the exact same type and value, in the same order. Otherwise, false. CSSNumericValue.to Converts value into another one with the specified unit. ...
...e supplied value. CSSNumericValue.div Divides the CSSNumericValue by the supplied value. CSSNumericValue.min Returns the minimum value passed CSSNumericValue.max Returns the maximum value passed CSSNumericValue.equals True if all the values are the exact same type and value, in the same order. Otherwise, false. CSSNumericValue.to Converts value into another one with the specified unit. CSSNumericValue.toSum TBD CSSNumericValue.type TBD CSSNumericValue.parse Allows a CSSNumericValue to be constructed directly from a string containing CSS. Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'CSSNumericValue' in that specification. Working Draft Initial definition. ...
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. ...
...e 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. 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) Le...
... 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. ...
...epresenting 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. 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 ...
... Obsolete ...
CSSStyleSheet.addRule() - Web APIs
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). ...
... 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 re...
... 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. 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 ...
CSSUnparsedValue.keys() - Web APIs
Working Draft Initial definition. ...
... Working Draft Initial definition. ...
... Working Draft Initial definition. ...
Using the CSS properties and values API - Web APIs
The CSS Properties and Values API -- part of the CSS Houdini umbrella of APIs -- allows the registration of css custom properties, allowing for property type checking, default values, and properties that do or do not inherit their value. Registering a custom property Registering a custom property allows you to tell the browser how the custom property should behave; what are allowed types, whether the custom property inherits its value, and what the default value of the custom property is. There are two ways to register a property, in JavaScript or in CSS. Note: The JavaScript option has working implementations. The CSS option does not. ...
... a custom property Registering a custom property allows you to tell the browser how the custom property should behave; what are allowed types, whether the custom property inherits its value, and what the default value of the custom property is. There are two ways to register a property, in JavaScript or in CSS. Note: The JavaScript option has working implementations. The CSS option does not. CSS.registerProperty The following will register a css custom properties, --my-prop, using CSS.registerProperty, as a color, give it a default value, and have it not inherit its value: window.CSS.registerProperty({ name: '--my-prop', syntax: '<color>', inherits: false, initialValue: '#c0ffee', }); @property The same registration can take place in CSS. The following will register a css c...
...You cannot transition or animate from aut...
-moz-image-rect - CSS: Cascading Style Sheets
Syntax -moz-image-rect(<uri>, top, right, bottom, left); Values <url> The URI of the image from which to take the sub-image. top The top edge, specified as an <integer> or <percentage>, of the sub-image within the specified image. right The right edge, specified as an <integer> or <percentage>, of the sub-image within the specified image. bottom The bottom edge, specified as an <integer> or <percentage>, 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. ...
...ercentage>, 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. Clicking on their container causes the four segments to rotate around by swapping the background-image pr...
...s 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. 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 a...
-moz-user-focus - CSS: Cascading Style Sheets
/* Keyword values */ -moz-user-focus: normal; -moz-user-focus: ignore; /* Global values */ -moz-user-focus: inherit; -moz-user-focus: initial; -moz-user-focus: unset; By setting its value to ignore, you can disable focusing the element, which means that the user will not be able to activate the element. The element will be skipped in the tab sequence. Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Note: This property doesn't work for XUL <xul:textbox> elements, because the textbox itself never takes focus. ...
... ...
... ...
-webkit-line-clamp - CSS: Cascading Style Sheets
The -webkit-line-clamp CSS property allows limiting of the contents of a block container to the specified number of lines. It only works in combination with the display property set to -webkit-box or -webkit-inline-box and the -webkit-box-orient property set to vertical. In most cases you will also want to set overflow to hidden, otherwise the contents won't be clipped but an ellipsis will still be shown after the specified number of lines. When applied to anchor elements, the truncating can happen in the middle of the text, not necessarily at the end. Note: This property was originally implemented in WebKit and has some issues. It got standardized for legacy support. ...
...s you will also want to set overflow to hidden, otherwise the contents won't be clipped but an ellipsis will still be shown after the specified number of lines. When applied to anchor elements, the truncating can happen in the middle of the text, not necessarily at the end. Note: This property was originally implemented in WebKit and has some issues. It got standardized for legacy support. The CSS Overflow Module Level 3 specification also defines a line-clamp property, which is meant to replace this property and avoid its issues. Syntax /* Keyword value */ -webkit-line-clamp: none; /* <integer> values */ -webkit-line-clamp: 3; -webkit-line-clamp: 10; /* Global values */ -webkit-line-clamp: inherit; -webkit-line-clamp: initial; -webkit-line-clamp: unset; none This value specifies...
...al valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typeby computed value type Formal syntax none | <integer> Examples Truncating a paragraph HTML <p> In this example the <code>-webkit-line-clamp</code> property is set to <code>3</code>, which means the text is clamped after three lines. An ellipsis will be shown at the point where the text is clamped. </p> CSS p { width: 300px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; } Result Specifications Specification Status Comment CSS Overflow Module Level 3The definition of '-webkit-line-clamp' in that specification. Working Draft Initial definition ...
-webkit-overflow-scrolling - CSS: Cascading Style Sheets
Syntax Values auto Use "regular" scrolling, where the content immediately ceases to scroll when you remove your finger from the touchscreen. touch Use momentum-based scrolling, where the content continues to scroll for a while after finishing the scroll gesture and removing your finger from the touchscreen. The speed and duration of the continued scrolling is proportional to how vigorous the scroll gesture was. Also creates a new stacking context. ...
...ous the scroll gesture was. Also creates a new stacking context. Formal definition Initial valueautoApplies toscrolling boxesInheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax auto | touch Examples HTML <div class="scroll-touch"> <p> This paragraph has momentum scrolling </p> </div> <div class="scroll-auto"> <p> This paragraph does not. ...
...CSS div { width: 100%; overflow: auto; } p { width: 200%; background: #f5f9fa; border: 2px solid #eaf2f4; padding: 10px; } .scroll-touch { -webkit-overflow-scrolling: touch; /* Lets it scroll lazy */ } .scroll-auto { -webkit-overflow-scrolling: auto; /* Stops scrolling immediately */ } Results Specifications Not part of any standard. Apple has a description in the Safari CSS Reference. ...
-webkit-text-fill-color - CSS: Cascading Style Sheets
If this property is not set, the value of the color property is used. /* <color> values */ -webkit-text-fill-color: red; -webkit-text-fill-color: #000000; -webkit-text-fill-color: rgb(100, 200, 0); /* Global values */ -webkit-text-fill-color: inherit; -webkit-text-fill-color: initial; -webkit-text-fill-color: unset; Syntax Values <color> The foreground fill color of the element's text content. ...
...( <number>#{3} , <alpha-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>? ...
...mber> | <angle> Examples Changing the fill color CSS p { margin: 0; font-size: 3em; -webkit-text-fill-color: green; } HTML <p>This text is green.</p> Results Specifications Specification Status Comment Compatibility StandardThe definition of '-webkit-text-fill-color' in that specification. Living Standard Initial standardization Safari CSS Reference '-webkit-text-fill-color' in that document. Non-standard unofficial documentation Initial definition ...
-webkit-text-stroke-color - CSS: Cascading Style Sheets
If this property is not set, the value of the color property is used. /* <color> values */ -webkit-text-stroke-color: red; -webkit-text-stroke-color: #e08ab4; -webkit-text-stroke-color: rgb(200, 100, 0); /* Global values */ -webkit-text-stroke-color: inherit; -webkit-text-stroke-color: initial; -webkit-text-stroke-color: unset; Syntax Values <color> The color of the stroke. ...
...ercentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
... Non-standard unofficial documentation Initial documentation ...
-webkit-text-stroke-width - CSS: Cascading Style Sheets
The -webkit-text-stroke-width CSS property specifies the width of the stroke for text. Syntax /* Keyword values */ -webkit-text-stroke-width: thin; -webkit-text-stroke-width: medium; -webkit-text-stroke-width: thick; /* <length> values */ -webkit-text-stroke-width: 2px; -webkit-text-stroke-width: 0.1em; -webkit-text-stroke-width: 1mm; -webkit-text-stroke-width: 5pt; /* Global values */ -webkit-text-stroke-width: inherit; -webkit-text-stroke-width: initial; -webkit-text-stroke-width: unset; Values <line-width> The width of the stroke. ...
...h: 1mm; -webkit-text-stroke-width: 5pt; /* Global values */ -webkit-text-stroke-width: inherit; -webkit-text-stroke-width: initial; -webkit-text-stroke-width: unset; Values <line-width> The width of the stroke. ...
... Non-standard unofficial documentation Initial documentation ...
::cue - CSS: Cascading Style Sheets
Web › CSS › ::cue
The ::cue CSS pseudo-element matches WebVTT cues within a selected element. This can be used to style captions and other cues in media with VTT tracks. ::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. ...
... 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. ...
... ::cue { color: #fff; background-color: rgba(0, 0, 0, 0.6); } Specifications Specification Status Comment WebVTT: The Web Video Text Tracks FormatThe definition of '::cue' in that specification. Candidate Recommendation Initial definition. ...
::grammar-error - CSS: Cascading Style Sheets
The ::grammar-error CSS pseudo-element represents a text segment which the user agent has flagged as grammatically incorrect. Allowable properties Only a small subset of CSS properties can be used in a rule with ::grammar-error in its selector: color background-color cursor caret-color outline and its longhands text-decoration and its associated properties text-emphasis-color text-shadow Syntax ::grammar-error Examples Simple document grammar check In this example, eventual supporting browsers should highlight any flagged grammatical errors with the styles shown. ...
... Working Draft Initial definition. ...
... Syntax ::grammar-error Examples Simple document grammar check In this example, eventual supporting browsers should highlight any flagged grammatical errors with the styles shown. 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. ...
::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. ...
...es to apply to the `foo` part */ } Syntax ::part( <ident>+ ) Examples HTML <template id="tabbed-custom-element"> <style type="text/css"> *, ::before, ::after { box-sizing: border-box; padding: 1rem; } :host { display: flex; } </style> <div part="tab active">Tab 1</div> <div part="tab">Tab 2</div> <div part="tab">Tab 3</div> </template> <tabbed-custom-element></tabbed-custom-element> CSS tabbed-custom-element::part(tab) { color: #0c0c0dcc; border-bottom: transparent solid 2px; } tabbed-custom-element::part(tab):hover { background-color: #0c0c0d19; border-color: #0c0c0d33; } tabbed-custom-element::part(tab):hover:active { background-color: #0c0c0d33; } tabbed-custom-element::part(tab):focus { box-shadow: 0 0 0 1px #0a84ff inset, 0 0 0 1px #0a84ff, 0 0 0...
::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. ...
...round-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. ...
...t content must have a contrast ratio of 4.5:1, or 3:1 for larger text such as headings. (WCAG defines large text as between 18.66px and 24px and bold, or 24px or larger.) WebAIM: Color Contrast Checker MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.3 | W3C Understanding WCAG 2.0 Specifications Specification Status Comment CSS Pseudo-Elements Level 4The definition of '::selection' in that specification. Working Draft Initial definition. Note: ::selection was in drafts of CSS Selectors Level 3, but it was removed in the Candidate Recommendation phase because its was under-specified (especially with nested elements) and interoperability wasn't achieved (based on discussion in the W3C Style mailing list). It...
::slotted() - CSS: Cascading Style Sheets
Web › CSS › ::slotted
Note also that this selector won't select a text node placed into a slot; it only targets actual elements. ...
...Note also that this selector won't select a text node placed into a slot; it only targets actual elements. ...
...olor. 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">Superhero</span> </person-details> Specifications Specification Status Comment CSS Scoping Module Level 1The definition of '::slotted' in that specification. Working Draft 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://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOpera...
::spelling-error - CSS: Cascading Style Sheets
The ::spelling-error CSS pseudo-element represents a text segment which the user agent has flagged as incorrectly spelled. Allowable properties Only a small subset of CSS properties can be used in a rule with ::spelling-error in its selector: color background-color cursor caret-color outline and its longhands text-decoration and its associated properties text-emphasis-color text-shadow Syntax ::spelling-error Examples Simple document spell check In this example, eventual supporting browsers should highlight any flagged spelling errors with the styles shown. ...
... Working Draft Initial definition. ...
... Examples Simple document spell check In this example, eventual supporting browsers should highlight any flagged spelling errors with the styles shown. 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. ...
:checked - CSS: Cascading Style Sheets
Web › CSS › :checked
/* 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. ...
...="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> <select name="my-select" id="fruit"> <option value="opt1">Apples</option> <option value="opt2">Grapes</option> <option value="opt3">Pears</option> </select> CSS div, select { margin: 8px; } /* Labels for checked inputs */ input:checked + label { color: red; } /* Radio element, when checked */ input[type="radio"]:checked { box-shadow: 0 0 0 3px orange; } /* Checkbox element, when checked */ input[type="checkbox"]:checked { box-shadow: 0 0 0 3px hotpink; } /* Option elements, when selected */ option:checked { box-shadow: 0 0 0 3px lime; co...
...><td>[cell text]</td><td>[cell text]</td></tr> <tr><td>[cell text]</td><td>[cell text]</td><td>[cell text]</td></tr> <tr class="expandable"><td>[more text]</td><td>[more 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 *...
:dir() - CSS: Cascading Style Sheets
Web › CSS › :dir
Note: Be aware that the behavior of the :dir() pseudo-class is not equivalent to the [dir=...] attribute selectors. The latter match the HTML dir attribute, and ignore elements that lack it -- even if they inherit a direction from their parent. ...
... Note: Be aware that the behavior of the :dir() pseudo-class is not equivalent to the [dir=...] attribute selectors. The latter match the HTML dir attribute, and ignore elements that lack it -- even if they inherit a direction from their parent. ...
... types may have different methods. Syntax The :dir() pseudo-class requires one parameter, representing the text directionality you want to target. Parameters ltr Target left-to-right elements. rtl Target right-to-left elements. Formal syntax :dir( ltr | rtl ) Examples HTML <div dir="rtl"> <span>test1</span> <div dir="ltr">test2 <div dir="auto">?????</div> </div> </div> CSS :dir(ltr) { background-color: yellow; } :dir(rtl) { background-color: powderblue; } Result Specifications Specification Status Comment HTML Living StandardThe definition of ':dir(ltr)' in that specification. Living Standard No changes. Selectors Level 4The definition of ':dir()' in that specification. Working Draft Initial definition. ...
:first-of-type - CSS: Cascading Style Sheets
Note that the universal selector (*) is implied when no simple selector is written. ...
... sibling elements. /* Selects any <p> that 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 ...
...iversal 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. Selectors Level 3The definition of ':first-of-type' in that specification. Recommendation Initial ...
:first - CSS: Cascading Style Sheets
Web › CSS › :first
The :first CSS pseudo-class, used with the @page at-rule, represents the first page of a printed document. (See :first-child for general first element of a node.) /* Selects the first page when printing */ @page :first { margin-left: 50%; margin-top: 50%; } Note: You can't change all CSS properties with this pseudo-class. You can only change the margins, orphans, widows, and page breaks of the document. Furthermore, you may only use absolute-length units when defining the margins. All other properties will be ignored. ...
...-left: 50%; margin-top: 50%; } Note: You can't change all CSS properties with this pseudo-class. You can only change the margins, orphans, widows, and page breaks of the document. Furthermore, you may only use absolute-length units when defining the margins. All other properties will be ignored. Syntax :first Examples HTML <p>First Page.</p> <p>Second Page.</p> <button>Print!</button> CSS @page :first { margin-left: 50%; margin-top: 50%; } p { page-break-after: always; } JavaScript document.querySelector("button").addEventListener('click', () => { window.print(); }); Result Press the "Print!" button to print the example. The words on the first page should be somewhere around the center, while other pages will have their contents at the default position. Specific...
...page-break-after: always; } JavaScript document.querySelector("button").addEventListener('click', () => { window.print(); }); Result Press the "Print!" button to print the example. The words on the first page should be somewhere around the center, while other pages will have their contents at the default position. Specifications Specification Status Comment CSS Paged Media Module Level 3The definition of ':first' in that specification. Working Draft No change. CSS Level 2 (Revision 1)The definition of ':first' in that specification. Recommendation Initial definition. ...
:fullscreen - CSS: Cascading Style Sheets
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. ...
... 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 Full-screen Mode" button when the element is not in a full-screen state. The...
...re are two rules here. The first establishes the background color of the "Toggle Full-screen Mode" button when the element is not in a full-screen state. The key is the use of the :not(:fullscreen), which looks for the element to not have the :fullscreen pseudo-class applied to it. #fs-toggle:not(:fullscreen) { background-color: #afa; } When the document is in full-screen mode, the following CSS applies instead, setting the background color to a pale shade of red. #fs-toggle:fullscreen { background-color: #faa; } Specifications Specification Status Comment Fullscreen APIThe definition of ':fullscreen' in that specification. Living Standard Initial definition. ...
:host-context() - CSS: Cascading Style Sheets
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>. ...
...e taken from our host-selectors example (see it live also). ...
...; The :host-context(h1) { font-style: italic; } and :host-context(h1):after { content: " - no links in headers!" } rules style the instance of the <context-span> element (the shadow host in this instance) inside the <h1>. We've used it to make it clear that the custom element shouldn't appear inside the <h1> in our design. Specifications Specification Status Comment CSS Scoping Module Level 1The definition of ':host-context()' in that specification. Working Draft 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://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet Explore...
:host - CSS: Cascading Style Sheets
Web › CSS › :host
The :host CSS pseudo-class selects the shadow host of the shadow DOM containing the CSS it is used inside -- in other words, this allows you to select a custom element from inside its shadow DOM. Note: This has no effect when used outside a shadow DOM. /* Selects a shadow root host */ :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). ...
...e taken from our host-selectors example (see it live also). ...
...{ color: gray; }' + ':host(.footer) { color : red; }' + ':host { background: rgba(0,0,0,0.1); padding: 2px 5px; }'; The :host { background: rgba(0,0,0,0.1); padding: 2px 5px; } rule styles all instances of the <context-span> element (the shadow host in this instance) in the document. Specifications Specification Status Comment CSS Scoping Module Level 1The definition of ':host' in that specification. Working Draft 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://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSaf...
:hover - CSS: Cascading Style Sheets
Web › CSS › :hover
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. ...
...o-class might never match, match only for a moment after touching an element, or continue to match even after the user has stopped touching and until the user touches another element. Web developers should make sure that content is accessible on devices with limited or non-existent hovering capabilities. Syntax :hover Examples Basic example HTML <a href="#">Try hovering over this link.</a> CSS a { background-color: powderblue; transition: background-color .5s; } a:hover { background-color: gold; } Result Image gallery You can use the :hover pseudo-class to build an image gallery with full-size images that show only when the mouse moves over a thumbnail. See this demo for a possible cue. Note: For an analogous effect, but based on the :checked pseudo-class (applied to hidd...
... (applied to hidden radioboxes), see this demo, taken from the :checked reference page. Specifications Specification Comment Feedback HTML Living StandardThe definition of ':hover' in that specification. WHATWG HTML GitHub issues Selectors Level 4The definition of ':hover' in that specification. Allows :hover to be applied to any pseudo-element. CSS Working Group drafts GitHub issues Selectors Level 3The definition of ':hover' in that specification. CSS Level 2 (Revision 1)The definition of ':hover' in that specification. Initial definition. ...
:indeterminate - CSS: Cascading Style Sheets
The :indeterminate CSS pseudo-class represents any form element whose state is indeterminate, such as checkboxes which have their HTML indeterminate attribute set to true, radio buttons which are members of a group in which all radio buttons are unchecked, and indeterminate <progress> elements. /* Selects any <input> whose state is indeterminate */ input:indeterminate { background: lime; } Elements targeted by this selector are: <input type="checkbox"> elements whose indeterminate property is set to true by JavaScript <input type="radio"> elements, when all radio buttons with the same name value in the form are unchecked <progress> elements in an indeterminate state Syntax :indeterminate Examples Checkbox & radio button This example applies special styles to the labels associa...
... indeterminate state Syntax :indeterminate Examples Checkbox & radio button This example applies special styles to the labels associated with indeterminate form fields. ...
... Living Standard No change. HTML5The definition of ':indeterminate' in that specificati...
:is() (:matches(), :any()) - CSS: Cascading Style Sheets
Web › CSS › :is
This is useful for writing large selectors in a more compact form. Note that currently browsers support this functionality as :matches(), or through an older, prefixed pseudo-class -- :any(), including older versions of Chrome, Firefox, and Safari. :any() works in exactly the same way as :matches()/:is(), except that it requires vendor prefixes and doesn't support complex selectors. ...
...; } catch(e) { console.log('Your browser doesn\'t support :is(), :matches(), or :any()'); } } } } matchedItems.forEach(applyHandler); function applyHandler(elem) { elem.addEventListener('click', function(e) { alert('This paragraph is inside a ' + e.target.parentNode.nodeName); }); } Simplifying list selectors The :is() pseudo-class can greatly simplify your CSS selectors. For example, the following CSS: /* 3-deep (or more) unordered lists use a square */ ol ol ul, ol ul ul, ol menu ul, ol dir ul, ol ol menu, ol ul menu, ol menu menu, ol dir menu, ol ol dir, ol ul dir, ol menu dir, ol dir dir, ul ol ul, ul ul ul, ul menu ul, ul dir ul, ul ol menu, ul ul menu, ul menu menu, ul dir menu, ul ol dir, ul ul dir...
...To change preferences in Firefox, visit about:config. Full support 4Notes Alternate Name Notes Doesn't support combinators.Notes See bug 906353Alternate Name Uses the non-standard name: :-moz-any()IE No support NoOpera Full s...
:lang() - CSS: Cascading Style Sheets
Web › CSS › :lang
/* Selects any <p> in English (en) */ p:lang(en) { quotes: '\201C' '\201D' '\2018' '\2019'; } Note: In HTML, the language is determined by a combination of the lang attribute, the <meta> element, and possibly by information from the protocol (such as HTTP headers). For other document types there may be other document methods for determining the language. Syntax Formal syntax :lang( <language-code> ) Parameter <language-code> A <string> representing the language you want to target. Acceptable values are specified in the HTML spec. Examples In this example, the :lang() pseudo-class is used to match the parents of quote elements (<q>) using child combinators. ...
... that the best method to use depends on the type of document. Also note that Unicode values are used to specify some of the special quote characters. HTML <div lang="en"><q>This English quote has a <q>nested</q> quote inside.</q></div> <div lang="fr"><q>This French quote has a <q>nested</q> quote inside.</q></div> <div lang="de"><q>This German quote has a <q>nested</q> quote inside.</q></div> CSS :lang(en) > q { quotes: '\201C' '\201D' '\2018' '\2019'; } :lang(fr) > q { quotes: '<< ' ' >>'; } :lang(de) > q { quotes: '>>' '<<' '\2039' '\203A'; } Result Specifications Specification Status Comment Selectors Level 4The definition of ':lang()' in that specification. Working Draft Adds wildcard language matching and comma-separated list of languages. ...
... Recommendation Initial definition. ...
:last-child - CSS: Cascading Style Sheets
The :last-child CSS pseudo-class represents the last element among a group of sibling elements. /* Selects any <p> that is the last element among its siblings */ p:last-child { color: lime; } Note: As originally defined, the selected element had to have a parent. Beginning with Selectors Level 4, this is no longer required. ...
...-child { color: lime; } Note: As originally defined, the selected element had to have a parent. Beginning with Selectors Level 4, this is no longer required. ...
... selected!</p> </div> <div> <p>This text isn't selected.</p> <h2>This text isn't selected: it's not a `p`.</h2> </div> CSS p:last-child { color: lime; background-color: black; padding: 5px; } Result Styling a list HTML <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3 <ul> <li>Item 3.1</li> <li>Item 3.2</li> <li>Item 3.3</li> </ul> </li> </ul> CSS ul li { color: blue; } ul li:last-child { border: 1px solid red; color: red; } Result Specifications Specification Status Comment Selectors Level 4The definition of ':last-child' in that specification. Working Draft Matching elements are not required to have a parent. Selectors Level 3The definition of ':last-child' in that specification. ...
:last-of-type - CSS: Cascading Style Sheets
Note that the universal selector (*) is implied when no simple selector is written. ...
... of sibling elements. /* Selects any <p> that 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 `e...
... 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` qualifies!</b> <div>This is the final `div`!</div> </article> CSS article :last-of-type { background-color: pink; } Result Specifications Specification Status Comment Selectors Level 4The definition of ':last-of-type' in that specification. Working Draft Matching elements are not required to have a parent. Selectors Level 3The definition of ':last-of-type' in that specification. Recommendation Initial def...
:link - CSS: Cascading Style Sheets
Web › CSS › :link
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. ...
... 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' in that sp...
... 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' in that specification. Recommendation No change. CSS Level 2 (Revision 1)The definition of ':link' in that specification. Recommendation Lift the restriction to only apply it for <a> element. CSS Level 1The definition of ':link' in that specification. 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, ...
:nth-last-child() - CSS: Cascading Style Sheets
/* Selects every fourth element among any group of siblings, counting backwards from the last one */ :nth-last-child(4n) { color: lime; } Note: This pseudo-class is essentially the same as :nth-child, except it counts items backwards from the end, not forwards from the beginning. Syntax The nth-last-child pseudo-class is specified with a single argument, which represents the pattern for matching elements, counting from the end. Keyword values odd Represents elements whose numeric position in a series of siblings is odd: 1, 3, 5, etc., counting from the end. ...
...first element among a group of siblings, counting from the end. This is the same as the :last-child selector. ...
...st 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 required to have a parent. Selectors Level 3The d...
:only-child - CSS: Cascading Style Sheets
The :only-child CSS pseudo-class represents an element without any siblings. This is the same as :first-child:last-child or :nth-child(1):nth-last-child(1), but with a lower specificity. /* Selects each <p>, but only if it is the */ /* only child of its parent */ p:only-child { background-color: lime; } Note: As originally defined, the selected element had to have a parent. Beginning with Selectors Level 4, this is no longer required. ...
...; } Note: As originally defined, the selected element had to have a parent. Beginning with Selectors Level 4, this is no longer required. ...
... Working Draft Matching elements are not required to have a parent. Selectors Level 3The definition of ':only-child' in that specific...
:root - CSS: Cascading Style Sheets
Web › CSS › :root
Working Draft No change. Selectors Level 3The definition of ':root' in that specification. ...
... Working Draft No change. Selectors Level 3The definition of ':root' in that specification. ...
...lass matches the root element of a tree representing the document. In HTML, :root represents the <html> element and is identical to the selector html, except that its specificity is higher. /* Selects the root element of the document: <html> in the case of HTML */ :root { background: yellow; } Syntax :root Examples Declaring global CSS variables :root can be useful for declaring global CSS variables: :root { --main-color: hotpink; --pane-padding: 5px 42px; } Specifications Specification Status Comment Selectors Level 4The definition of ':root' in that specification. Working Draft No change. Selectors Level 3The definition of ':root' in that specification. Recommendation Initial definition. ...
:scope - CSS: Cascading Style Sheets
Web › CSS › :scope
/* Selects a scoped element */ :scope { background-color: lime; } Currently, when used in a stylesheet, :scope is the same as :root, since there is not at this time a way to explicitly establish a scoped element. When used from a DOM API such as querySelector(), querySelectorAll(), matches(), or Element.closest(), :scope matches the element on which the method was called. Syntax :scope Examples Identity match In this simple example, we demonstrate that using the :scope pseudo-class from the Element.matches() method matches the element on which it's called. ...
...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 true). To change preferences in Firefox, visit about:config.IE No support NoOpera Full support 15Safari Full support 7WebView Android Full support <=37Chrome Android ...
...> 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. Full support 20Disabled Disabled From version 20: this feature is behind the layout.css.scope-pseudo.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.Opera Android Full support 15Safari iOS Full support 7Samsung Internet Android Full support 1.5Support in DOM API such as in querySelector() and querySe...
:where() - CSS: Cascading Style Sheets
Web › CSS › :where
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. ...
...electors have a higher specificity than element selectors. However, selectors inside :where() have specificity 0, so the orange footer link will be overidden by our simple selector. You can see the result below (although bear in mind that currently :is() and :where() are currently only enabled by default in Firefox Nightly, version 77+. In other versions of Firefox it is behind a pref -- layout.css.is-where-selectors.enabled). Note: You can also find this example on GitHub; see is-where. Syntax :where( <complex-selector-list> )where <complex-selector-list> = <complex-selector>#where <complex-selector> = <compound-selector> [ <combinator>? <compound-selector> ]*where <compound-selector> = [ <type-selector>? <subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!<...
...To change preferences in Firefox, visit about:config.IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android...
symbols - CSS: Cascading Style Sheets
Syntax The symbols descriptor 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. ...
... Candidate Recommendation Initial definition. ...
... Candidate Recommendation Initial definition. ...
font-stretch - CSS: Cascading Style Sheets
The font-stretch CSS descriptor allows authors to specify a normal, condensed, or expanded face for the fonts specified in the @font-face rule. 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-stretch descriptor to explicitly specify the font face's stretch. The values for the CSS descriptor is same as that of its corresponding font property. Syntax /* Single values */ font-stretch: ultra-condensed; font-stretch: extra-condensed; font-stretch: condensed; font-stretch: semi-condensed; font-stretch: normal; font-stretch: semi-expanded; font-stretch: expanded; font-stretch: extra-expanded; font-stretch: ultra-expanded; font-stretch: 50%; font-stretch: 100%; font-stretch: 200%; /* mul...
...s the most condensed. semi-expanded, expanded, extra-expanded, ultra-expanded Specifies a more expanded font face than normal, with ultra-expanded as the most expanded. <percentage> A <percentage> value between 50% and 200% (inclusive). Negative values are not allowed for this property. In earlier versions of the font-stretch specification, the property accepts only the nine keyword values. CSS Fonts Level 4 extends the syntax to accept a <percentage> value as well. This enables variable fonts to offer something more like a continuum of character widths. For TrueType or OpenType variable fonts, the "wdth" variation is used to implement varying widths. If the font does not provide a face that exactly matches the given value, then values less than 100% map to a narrower face, and values ...
...etch The following find a local Open Sans font or import it, and allow using the font for normal, semi-condensed and semi-expanded states. @font-face { font-family: "Open Sans"; src: local("Open Sans") format("woff2"), url("/fonts/OpenSans-Regular-webfont.woff") format("woff"); font-stretch: 87.5% 112.5%; } Specifications Specification Status Comment CSS Fonts Module Level 4The definition of 'font-stretch' in that specification. Working Draft CSS Fonts Module Level 3The definition of 'font-stretch' in that specification. Candidate Recommendation ...
font-style - CSS: Cascading Style Sheets
Syntax font-style: normal; font-style: italic; font-style: oblique; font-style: oblique 30deg; font-style: oblique 30deg 50deg; Values normal Selects the normal version of the font-family. italic Specifies that font-face is an italicized version of the normal font. ...
... Syntax font-style: normal; font-style: italic; font-style: oblique; font-style: oblique 30deg; font-style: oblique 30deg 50deg; Values normal Selects the normal version of the font-family. italic Specifies that font-face is an italicized version of the normal font. ...
... and are a bit different from their upright counterparts, having some unique features and generally have a rounded and calligraphic quality. These fonts are specially created by font designers and are not artificially sloped. @font-face { font-family: garamond; src: url('garamond-italic.ttf'); font-style: italic; } Specifications Specification Status Comment CSS Fonts Module Level 4The definition of 'font-style' in that specification. Working Draft Adds oblique keyword with angle value CSS Fonts Module Level 3The definition of 'font-style' in that specification. Candidate Recommendation Initial definition ...
src - CSS: Cascading Style Sheets
Web › CSS › @font-face › src
It is required for the @font-face rule to be valid. ...
...is descriptor is a prioritized, comma-separated list of external references or locally-installed 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 ...
... Candidate Recommendation Initial definition ...
unicode-range - CSS: Cascading Style Sheets
If the page doesn't use any character in this range, the font is not downloaded; if it uses at least one, the whole font is downloaded. Syntax /* <unicode-range> values */ unicode-range: U+26; /* single codepoint */ unicode-range: U+0-7F; unicode-range: U+0025-00FF; /* codepoint range */ unicode-range: U+4??; /* wildcard range */ unicode-range: U+0025-00FF, U+4??; /* multiple values */ Values single codepoint A single Unicode character code point, for example U+26. codepoint range A range of Unicode code points. ...
...Computed 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. ...
...es 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> and applying a different font just to that, but that is an extra element and rule set. HTML <div>Me & You = Us</div> CSS @font-face { font-family: 'Ampersand'; src: local('Times New Roman'); unicode-range: U+26; } div { font-size: 4em; font-family: Ampersand, Helvetica, sans-serif; } Result Specifications Specification Status Comment CSS Fonts Module Level 3The definition of 'unicode-range' in that specification. Candidate Recommendation Initial definition ...
-ms-high-contrast - CSS: Cascading Style Sheets
High Contrast Mode is a specialized display mode that prioritizes making content as legible as possible by dynamically replacing foreground and background colors with a user-specified theme. For web content, theme colors are mapped to content types. This media feature applies to bitmap media types. It does not accept min/max prefixes. Syntax The -ms-high-contrast media feature is specified as one of the following values. Values none ... No longer supported as of Microsoft Edge 18. ...
...The available color keywords are: windowText: controls the color of text content. highlightText: controls the color of selected text. highlight: controls the background color of selected text. buttonFace: controls the color of a <button> element's text. window: controls the color of the background. The <a> element controls the color of links. Because High Contrast Mode t...
...xt: controls the color of text content. highlightText: controls the color of selected text. highlight: controls the background color of selected text. buttonFace: controls the color of a <button> element's text. window: controls the color of the background. The <a> element controls the color of links. Because High Contrast Mode themes are dynamic, use these color keywords in place of other CSS color values. This will ensure that content will always be able to be perceived. Content If at all possible, prefer updating HTML markup over modifying content using CSS2 system color keywords. This helps keep the content more predictable. Specifications Not part of any standard. Remarks As of Microsoft Edge 18, -ms-high-contrast: none is no longer supported. Microsoft Edge versions 18 and ...
aspect-ratio - CSS: Cascading Style Sheets
The aspect-ratio CSS media feature can be used to test the aspect ratio of the viewport. Syntax The aspect-ratio feature is specified as a <ratio> value representing the width-to-height aspect ratio of the viewport. It is a range feature, meaning you can also use the prefixed min-aspect-ratio and max-aspect-ratio variants to query minimum and maximum values, respectively. Examples The example below is contained in an <iframe>, which creates its own viewport. Resize the <iframe> to see aspect-ratio in action. HTML <div id='inner'> Watch this element as you resize your viewport's width and height. ...
... is a range feature, meaning you can also use the prefixed min-aspect-ratio and max-aspect-ratio variants to query minimum and maximum values, respectively. Examples The example below is contained in an <iframe>, which creates its own viewport. Resize the <iframe> to see aspect-ratio in action. HTML <div id='inner'> Watch this element as you resize your viewport's width and height. ...
...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=w.oninput=function(){ outer.style.width=w.value+"px" wf.textContent="width:"+w.value } h.onchange=h.oninput=function(){ outer.style.height=h.value+"px" hf.textContent="height:"+h.value } Result Specifications Specification Status Comment Media Queries Level...
color-index - CSS: Cascading Style Sheets
The color-index CSS media feature can be used to test the number of entries in the output device's color lookup table. Syntax The color-index feature is specified as an <integer> value representing the number of entries in the output device's color lookup table. (This value is zero if the device does not use 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. ...
...ature is specified as an <integer> value representing the number of entries in the output device's color lookup table. (This value is zero if the device does not use 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. 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.b...
... @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 The value can now be negative, in which case it computes to false. Media QueriesThe definition of 'color-index' in that specification. Recommendation Initial definition. The value must be nonnegative...
prefers-reduced-data - CSS: Cascading Style Sheets
Syntax no-preference Indicates that the user has made no preference known to the system. This keyword value evaluates as false in the boolean context. reduce Indicates that user has expressed the preference for lightweight alternate content. ...
...le will not work. ...
.... ...
shape - CSS: Cascading Style Sheets
Web › CSS › @media › shape
The shape CSS media feature can be used to test the shape of the device to distinguish recrangular and round displays. Syntax The shape descrete feature is specified as one of two acceptable strings, either rect reprsenting a rectangular screen or round representing a circular, oval or elliptical screen. rect The shape is an axis aligned rectangle or square, or a similar shape such as rounded rectangle for which the traditional 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. ...
...g a circular, oval or elliptical screen. rect The shape is an axis aligned rectangle or square, or a similar shape such as rounded rectangle for which the traditional 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. 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...
...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 ...
update - CSS: Cascading Style Sheets
The update CSS media feature can be used to test how frequently (if at all) the output device is able to modify the appearance of content. Syntax The update feature is specified as a single keyword value chosen from the list below. none Once it has been rendered, the layout can no longer be updated. Example: documents printed on paper. slow The layout may change dynamically according to the usual rules of CSS, but the output device is not able to render or display changes quickly enough for them to be perceived as a smooth animation. Examples: e-book readers or severely underpowered devices. ...
... can no longer be updated. Example: documents printed on paper. slow The layout may change dynamically according to the usual rules of CSS, but the output device is not able to render or display changes quickly enough for them to be perceived as a smooth animation. Examples: e-book readers or severely underpowered devices. fast The layout may change dynamically according to the usual rules of CSS, and the output device is not unusually constrained in speed, so regularly-updating things like CSS Animations can be used. Example: computer screens. ...
...mooth animation. Examples: e-book readers or severely underpowered devices. fast The layout may change dynamically according to the usual rules of CSS, and the output device is not unusually constrained in speed, so regularly-updating things like CSS Animations can be used. Example: computer screens. Examples HTML <p>If this text animates for you, you are using a fast-updating device.</p> CSS @keyframes jiggle { from { transform: translateY(0); } to { transform: translateY(25px); } } @media (update: fast) { p { animation: 1s jiggle linear alternate infinite; } } Result Specifications Specification Status Comment Media Queries Level 4The definition of 'update' in that specification. Candidate Recommendation Initial defin...
@namespace - CSS: Cascading Style Sheets
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. ...
..., and the <svg> and <math> elements will be assigned their proper namespaces (http://www.w3.org/2000/svg and http://www.w3.org/1998/Math/MathML). Note: In XML, unless a prefix is defined directly on an attribute (e.g., xlink:href), that attribute has no namespace. In other words, attributes do not inherit the namespace of the element they're on. To match this behaviour, the default namespace in CSS does not apply to attribute selectors. Formal syntax @namespace <namespace-prefix>? [ <string> | <url> ];where <namespace-prefix> = <ident> Examples Specifying default and prefixed namespaces @namespace url(http://www.w3.org/1999/xhtml); @namespace svg url(http://www.w3.org/2000/svg); /* This matches all XHTML <a> elements, as XHTML is the default unprefixed namespace */ a {} /* This matc...
... Recommendation Initial definition ...
height - CSS: Cascading Style Sheets
Web › CSS › @viewport › height
<length> A non-negative absolute or relative length. <percentage> A percentage value relative to the width or height of the initial viewport at zoom factor 1.0, for horizontal and vertical lengths respectively. ...
...port length value will set both, the minimum height and the maximum height, to the value provided. If two viewport values are provided, the first value will set the minimum height and the second value will set the maximum height. Syntax /* One value */ height: auto; height: 320px; height: 15em; /* Two values */ height: 320px 200px; Values auto The used value is calculated from the other CSS descriptors' values. <length> A non-negative absolute or relative length. <percentage> A percentage value relative to the width or height of the initial viewport at zoom factor 1.0, for horizontal and vertical lengths respectively. Must be non-negative. Formal definition Related at-rule@viewportInitial valueas each of the properties of the shorthand:min-height: automax-height: nonePercenta...
... Working Draft Initial definition ...
max-height - CSS: Cascading Style Sheets
<length> A non-negative absolute or relative length. <percentage> A percentage value relative to the height of the initial viewport at zoom factor 1.0 for vertical lengths. Must be non-negative. ...
...cument defined via the @viewport at-rule. The height will initially be set as close as possible to the initial viewport height considering the maximum height constraint. Syntax /* Keyword value */ max-height: auto; /* <length> values */ max-height: 400px; max-height: 50em; max-height: 20cm; /* <percentage> value */ max-height: 75%; Values auto The used value is calculated from the other CSS descriptors' values. <length> A non-negative absolute or relative length. <percentage> A percentage value relative to the height of the initial viewport at zoom factor 1.0 for vertical lengths. Must be non-negative. Formal definition Related at-rule@viewportInitial valueautoPercentagesrefer to the height of the initial viewportComputed valueif specified as a length, the corresponding absol...
... Working Draft Initial definition ...
max-width - CSS: Cascading Style Sheets
<length> A non-negative absolute or relative length. <percentage> A percentage value relative to the width of the initial viewport at zoom factor 1.0 for horizontal lengths. Must be non-negative. ...
...viewport of a document defined via the @viewport at-rule. By default, the width is set as close as possible to the initial viewport considering the maximum width constraint. Syntax /* Keyword value */ max-width: auto; /* <length> values */ max-width: 600px; max-width: 80em; max-width: 15cm; /* <percentage> value */ max-width: 75%; Values auto The used value is calculated from the other CSS descriptors' values. <length> A non-negative absolute or relative length. <percentage> A percentage value relative to the width of the initial viewport at zoom factor 1.0 for horizontal lengths. Must be non-negative. Formal definition Related at-rule@viewportInitial valueautoPercentagesrefer to the width of the initial viewportComputed valueif specified as a length, the corresponding absol...
... Working Draft Initial definition ...
min-height - CSS: Cascading Style Sheets
<length> A non-negative absolute or relative length. <percentage> A percentage value relative to the height of the initial viewport at zoom factor 1.0 for vertical lengths. Must be non-negative. ...
...cument defined via the @viewport at-rule. The height will initially be set as close as possible to the initial viewport height considering the minimum height constraint. Syntax /* Keyword value */ min-height: auto; /* <length> values */ min-height: 120px; min-height: 20em; min-height: 10cm; /* <percentage> value */ min-height: 25%; Values auto The used value is calculated from the other CSS descriptors' values. <length> A non-negative absolute or relative length. <percentage> A percentage value relative to the height of the initial viewport at zoom factor 1.0 for vertical lengths. Must be non-negative. Formal definition Related at-rule@viewportInitial valueautoPercentagesrefer to the height of the initial viewportComputed valueif specified as a length, the corresponding absol...
... Working Draft Initial definition ...
min-width - CSS: Cascading Style Sheets
<length> A non-negative absolute or relative length. <percentage> A percentage value relative to the width or height of the initial viewport at zoom factor 1.0, for horizontal and vertical lengths respectively. Must be non-negative. ...
...width of the viewport of a document defined via @viewport. By default, min-width is set as close as possible to the initial viewport considering the minimum width constraint. Syntax /* Keyword value */ min-width: auto; /* <length> values */ min-width: 320px; min-width: 40em; min-width: 5cm; /* <percentage> value */ min-width: 25%; Values auto The used value is calculated from the other CSS descriptors' values. <length> A non-negative absolute or relative length. <percentage> A percentage value relative to the width or height of the initial viewport at zoom factor 1.0, for horizontal and vertical lengths respectively. Must be non-negative. Formal definition Related at-rule@viewportInitial valueautoPercentagesrefer to the width of the initial viewportComputed valueif specified...
... Working Draft Initial definition ...
viewport-fit - CSS: Cascading Style Sheets
Syntax /* Keyword values */ viewport-fit: auto; viewport-fit: contain; viewport-fit: cover; Values auto This value doesn't affect the initial layout viewport, and the whole web page is viewable. contain The viewport is scaled to fit the largest rectangle inscribed within the display. cover The viewport is scaled to fill the device display. It is highly recommended to make use of the safe area inset variables to ensure that important content doesn't end up outside the display. This descriptor hasn't been added to https://github.com/mdn/data/blob/master/css/at-rules.json yet. ...
...he whole web page is viewable. contain The viewport is scaled to fit the largest rectangle inscribed within the display. cover The viewport is scaled to fill the device display. It is highly recommended to make use of the safe area inset variables to ensure that important content doesn't end up outside the display. This descriptor hasn't been added to https://github.com/mdn/data/blob/master/css/at-rules.json yet. Accessibility concerns When using the viewport-fit descriptor, one must keep in mind that not all device displays are rectangular, and should therefore make use of the safe area inset variables. Formal definition Related at-rule@viewportInitial valueautoComputed valueas specified Formal syntax auto | contain | cover Examples Scaling viewport to fit device display @view...
... that not all device displays are rectangular, and should therefore make use of the safe area inset variables. Formal definition Related at-rule@viewportInitial valueautoComputed valueas specified Formal syntax auto | contain | cover Examples Scaling viewport to fit device display @viewport { viewport-fit: cover; } Specifications Specification Status Comment CSS Round Display Level 1The definition of '"viewport-fit" descriptor' in that specification. Working Draft Initial definition. ...
width - CSS: Cascading Style Sheets
Web › CSS › @viewport › width
<length> A non-negative absolute or relative length. ...
...dth and the max-width to the value provided. If two viewport values are provided the first value will be set to the min-width and the second value will be set max-width. Syntax /* An example with one viewport value: */ @viewport { width: 320px; } /* An example with two viewport values: */ @viewport { width: 320px, 120px; } Values auto The used value is calculated from the other CSS descriptors' values. <length> A non-negative absolute or relative length. <percentage> A percentage value relative to the width or height of the initial viewport at zoom factor 1.0, for horizontal and vertical lengths respectively. Must be non-negative. Formal definition Related at-rule@viewportInitial valueas each of the properties of the shorthand:min-width: automax-width: nonePercentage...
... Working Draft Initial definition ...
@viewport - CSS: Cascading Style Sheets
Web › CSS › @viewport
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. ...
...system (such as a taskbar) or the application-available screen area (either the full screen or the screen minus any areas owned by the operating system or other applications). @viewport { width: 100vw; /*Sets the width of the actual viewport to the device width*/ } Note: The use of <meta name="viewport"> tag overrides @viewport Syntax The at-rule contains a set of nested descriptors in a CSS block that is delimited by curly braces. A zoom factor of 1.0 or 100% corresponds to no zooming. Larger values zoom in. Smaller values zoom out. Descriptors Browser support for @viewport is weak at this time, with support being largely available in Internet Explorer and Edge. Even in those browsers, only a small number of descriptors are available. Browsers will ignore @viewport if they don't ...
...ls the display of the document on non-rectangular displays. Formal syntax @viewport { <group-rule-body> } Examples Setting viewport size, zoom, and orientation @viewport { min-width: 640px; max-width: 800px; } @viewport { zoom: 0.75; min-zoom: 0.5; max-zoom: 0.9; } @viewport { orientation: landscape; } Specifications Specification Status Comment CSS Round Display Level 1The definition of '@viewport' in that specification. Working Draft Defined the viewport-fit descriptor. CSS Device AdaptationThe definition of '@viewport' in that specification. Working Draft Initial definition ...
Logical properties for margins, borders and padding - CSS: Cascading Style Sheets
This is mostly due to the fact that there are four longhand values each for margin, border, and padding side, plus all the shorthand values. ...
...t direction in the second. Margin shorthands As we can now target both sides of a box -- either both inline sides or both block sides -- there are new shorthands available, margin-inline and margin-block, which accept two values. The first value will apply to the start of that dimension, the second to the end. If you only use one value it is applied to both. In a horizontal writing mode this CSS would apply a 5px margin to the top of the box and a 10px margin to the bottom. .box { margin-block: 5px 10px; } Note: The shorthand properties margin-inline and margin-block shipped in Firefox 66. As these are new properties check browser support before using. Padding examples The mapped padding properties of padding-inline-start, padding-inline-end, padding-block-start, and padding-inli...
...vertical-rl. Again, notice how the padding stays in the same place for the first box, but switches around to follow the text direction in the second. Padding shorthands As with margin, there are two-value shorthands for padding -- padding-inline and padding-block -- which allow you to set the padding of the two inline, and two block dimensions, respectively. In a horizontal writing-mode this CSS would apply 5px of padding to the top of the box and 10px of padding to the bottom: .box { padding-block: 5px 10px; } Note: The shorthand properties padding-inline and padding-block shipped in Firefox 66. As these are new properties check browser support before using. Border examples The border properties are the main reason that Logical Properties and Values seems to have so many propert...
Child combinator - CSS: Cascading Style Sheets
The child combinator (>) is placed between two CSS selectors. It matches only those elements matched by the second selector that are the direct children of elements matched by the first. /* List items that are children of the "my-things" list */ ul.my-things > li { 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. ...
...atched 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 'child combinator' in that speci...
... Recommendation Initial definition. ...
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. There is no other way to specify comments in external style sheets. ...
...ne 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. ...
... 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. ...
Descendant combinator - CSS: Cascading Style Sheets
ents matched by the second selector are selected if they have an ancestor (parent, parent's parent, parent's parent's parent, etc) element matching the first selector. Selectors that utilize a descendant combinator are called descendant selectors. /* List items that are descendants of the "my-things" list */ ul.my-things li { margin: 2em; } The descendant combinator is technically one or more CSS white space characters -- 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. Syntax selector1 selector2 { /* property declarations */ } Examples CS...
... Recommendation Initial definition ...
... Specification Status Comment Selectors Level 4The definition of 'descendant combinator' in that specification. Working Draft Selectors Level 3The definition of 'descendant combinator' in that specification. Recommendation CSS Level 2 (Revision 1)The definition of 'descendant selectors' in that specification. Recommendation CSS Level 1The definition of 'contextual selectors' in that specification. Recommendation Initial definition ...
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 ...
... Recommendation Initial definition ...
...esult Specifications Specification Status Comment Selectors Level 4The definition of 'ID selectors' in that specification. Working Draft Selectors Level 3The definition of 'ID selectors' in that specification. Recommendation CSS Level 2 (Revision 1)The definition of 'ID selectors' in that specification. Recommendation CSS Level 1The definition of 'ID selectors' in that specification. Recommendation Initial definition ...
Grid wrapper - CSS: Cascading Style Sheets
pper pattern is useful for aligning grid content within a central wrapper, while also allowing items to break out and align to the edge of the containing element or page when desired. Requirements Items placed on the grid should be able to align to a horizontally-centered max-width wrapper and/or the outer edges of the grid. Recipe Download this example Choices made This recipe uses the CSS Grid minmax() function to define the grid track sizes in the grid-template-columns property. For the central columns with a maximum width we can set a minimum value of 0 or greater and a maximum value that specifies the maximum size the column tracks will grow to. Using a numeric unit (pixels, ems, rems) will create a fixed maximum size for the central wrapper, whereas using percentage values or ...
... ...
... ...
Media queries - CSS: Cascading Style Sheets
Media queries let you adapt your site or 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...
...evice, and to set up listeners that notify your code when the results of media queries change (such as when the user rotates the screen or resizes the browser). ...
...Accessibility Learn how Media Queries can help users understand your website better. ...
Pseudo-classes - CSS: Cascading Style Sheets
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. ...
...st, :future, :placeholder-shown, :user-invalid, :nth-col(), :nth-last-col(), :is() and :where(). Changed :empty to behave like :-moz-only-whitespace . No significant change for other pseudo-classes defined in Selectors Level 3 and HTML5 (though semantic meaning not taken over). HTML5 Recommendation Copies the relevant section from the canonical (WHATWG) HTML spec. CSS Basic User Interface Module Level 3 Recommendation Defined :default, :valid, :invalid, :in-range, :out-of-range, :required, :optional, :read-only and :read-write, but without the associated semantic meaning. Selectors Level 3 Recommendation Defined :target, :root, :nth-child(), :nth-last-of-child(), :nth-of-type(), :nth-last-of-type(), :last-child, :first-of-type, :last-of-ty...
...tors Level 3 Recommendation Defined :target, :root, :nth-child(), :nth-last-of-child(), :nth-of-type(), :nth-last-of-type(), :last-child, :first-of-type, :last-of-type, :only-child, :only-of-type, :empty and :not(). Defined the syntax of :enabled, :disabled, :checked, and :indeterminate, but without the associated semantic meaning. No significant change for pseudo-classes defined in CSS Level 2 (Revision 1). CSS Level 2 (Revision 1) Recommendation Defined :lang(), :first-child, :hover, and :focus. No significant change for pseudo-classes defined in CSS Level 1. CSS Level 1 Recommendation Defined :link, :visited and :active, but without the associated semantic meaning. ...
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 Initial definition ...
...ecification 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. Recommendation CSS Level 1The definition of 'type selectors' in that specification. Recommendation Initial definition ...
align-self - CSS: Cascading Style Sheets
In Grid, it aligns the item inside the grid area. In Flexbox, it aligns the item on the cross axis. 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 property doesn't apply to block-level boxes, or to table cells. If a flexbox item's cross-axis margin is auto, then align-self is ignored. ...
... Working D...
...es HTML <section> <div>Item #1</div> <div>Item #2</div> <div>Item #3</div> </section> CSS section { display: flex; align-items: center; height: 120px; background: beige; } div { height: 60px; background: cyan; margin: 5px; } div:nth-child(3) { align-self: flex-end; background: pink; } Result Specifications Specification Status Comment CSS Box Alignment Module Level 3The definition of 'align-self' in that specification. Working Draft Update to latest syntax definitions. CSS Flexible Box Layout ModuleThe definition of 'align-self' in that specification. Candidate Recommendation Initial definition. ...
<angle> - CSS: Cascading Style Sheets
Web › CSS › angle
It is used, for example, in <gradient>s and in some transform functions. 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 The <angle> data type consists of a <number> followed by one of the units listed below. As with all dimensions, there is no space between the unit literal and the number. The angle unit is optional after the number 0. Optionally, it may be preceded by a single + or - sign. Positive numbers represent clockwise angles, while negative numbers represent counterclockwise angles. ...
... Candidate Recommendation Initial definition. ...
... Candidate Recommendation Initial definition. ...
animation-timing-function - 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. It is often convenient to use the shorthand property animation to set all animation properties at once. ...
... Formal definition Initial valueeaseApplies toall elements, ::before and ::after pseudo-elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <timing-function>#where <timing-function> = linear | <cubic-bezier-timing-function> | <step-timing-function>where <cubic-bezier-timing-function> = ease | ease-in | ease-out | ease-in-out | cubic-bezier(<number <a href="/docs/CSS/Value_definition_syntax#Brackets" title="Brackets: enclose several entities, combinators, and multipliers to transform them as a single component">[0,1]>, <number>, <number <a href="/docs/CSS/Value_definition_syntax#Brackets" title="Brackets: enclose several entities, combinators, and multipliers to transform them as a single component">[0,1]>, <number>)<step-timing-function> = step-start | step-...
... Working Draft Initial definition. ...
appearance (-moz-appearance, -webkit-appearance) - CSS: Cascading Style Sheets
The -moz-appearance and -webkit-appearance properties are non-standard versions of this propery, used (respectively) by Gecko (Firefox) and by WebKit-based (e.g., Safari) and Blink-based (e.g., Chrome, Opera) 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. ...
...atibility note: If you wish to use this property on websites, you should test it very carefully. Although it is supported in most modern browsers, its implementation varies widely. In older browsers, even the keyword none does not have the same effect on all form elements across different browsers, and some do not support it at all. The differences are smaller in the newest browsers. ...
... Working Draft Initial definition. ...
backface-visibility - 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. An element's back face is a mirror image of its front face. Though invisible in 2D, the back face can become visible when a transformation causes the element to be rotated in 3D space. ...
..."cube hidebf"> <div class="face front">1</div> <div class="face back">2</div> <div class="face right">3</div> <div class="face left">4</div> <div class="face top">5</div> <div class="face bottom">6</div> </div> </div> <p> The three back faces (2, 4, 5) are hidden. ...
... Editor's Draft Initial definition. ...
background-color - 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. ...
... / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> Examples HTML <div class="exampleone"> Lorem ipsum dolor sit amet, consectetuer </div> <div class="exampletwo"> Lorem ipsum dolor sit amet, consectetuer </div> <div class="examplethree"> Lorem ipsum dolor sit amet, consectetuer </div> CSS .exampleone { background-color: teal; color: white; } .exampletwo { background-color: rgb(153,102,153); color: rgb(255,255,204); } .examplethree { background-color: #777799; color: #FFFFFF; } Result Specifications Specification Comment Feedback CSS Backgrounds and Borders Module Level 3The definition of 'background-color' in that specification. ...
...: #777799; color: #FFFFFF; } Result Specifications Specification Comment Feedback CSS Backgrounds and Borders Module Level 3The definition of 'background-color' in that specification. Though technically removing the transparent keyword, this doesn't change anything as it has been incorporated as a true <color> Backgrounds Level 3 GitHub issues CSS Level 2 (Revision 1)The definition of 'background-color' in that specification. CSS Level 1The definition of 'background-color' in that specification. Initial definition ...
background-position-x - CSS: Cascading Style Sheets
The position is relative to the position layer set by background-origin. 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 value of this property is overridden by any declaration of the background or background-position shorthand properties applied to the element after it. ...
...n typediscrete Formal syntax [ center | [ [ left | right | x-start | x-end ]? <length-percentage>? ]! ]#where <length-percentage> = <length> | <percentage> Examples Basic example The following example shows a simple background image implementation, with background-position-x and background-position-y used to define the image's horizontal and vertical positions separately. ...
... Editor's Draft Initial specification of longhand sub-properties of background-position to match longstanding implementations. Browser compatibility The compatibility table in this page is generated from structured data. ...
background-position-y - CSS: Cascading Style Sheets
The position is relative to the position layer set by background-origin. 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 value of this property is overridden by any declaration of the background or background-position shorthand properties applied to the element after it. ...
...n typediscrete Formal syntax [ center | [ [ top | bottom | y-start | y-end ]? <length-percentage>? ]! ]#where <length-percentage> = <length> | <percentage> Examples Basic example The following example shows a simple background image implementation, with background-position-x and background-position-y used to define the image's horizontal and vertical positions separately. ...
... Editor's Draft Initial specification of longhand sub-properties of background-position to match longstanding implementations. Browser compatibility The compatibility table in this page is generated from structured data. ...
<basic-shape> - 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. Syntax The <basic-shape> data type is defined with one of the basic shape functions listed below. When creating a shape, the reference box is defined by each property that uses <basic-shape> values. The coordinate system for the shape has its origin at the top-left corner of the reference box, with the x-axis running to the right and the y-axis running downwards. ...
... types of path data commands in the same order, interpolate each path data command as real numbers. In all other cases no interpolation occurs. Examples Animated polygon In this example, we use the @keyframes at-rule to animate a clip path between two polygons. Note that both polygons have the same number of vertices, which is necessary for this type of animation to work. ...
... Candidate Recommendation Initial definition. ...
border-bottom-color - 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. ...
...r. Formal definition Initial valuecurrentcolorApplies toall elements. It also applies to ::first-letter.InheritednoComputed valuecomputed colorAnimation typea color Formal syntax <'border-top-color'> Examples A simple div with a border HTML <div class="mybox"> <p>This is a box with a border around it. Note which side of the box is <span class="redtext">red</span>.</p> </div> CSS .mybox { border: solid 0.3em gold; border-bottom-color: red; width: auto; } .redtext { color: red; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-bottom-color' in that specification. Candidate Recommendation No significant changes, though the transparent keyword, now ...
... auto; } .redtext { color: red; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-bottom-color' in that specification. Candidate Recommendation No significant changes, though the transparent keyword, now included in <color> which has been extended, has been formally removed. CSS Level 2 (Revision 1)The definition of 'border-bottom-color' in that specification. Recommendation Initial definition ...
border-collapse - 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. 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. ...
...r><th>Browser</th> <th>Layout Engine</th></tr> <tr><td class="fx">Firefox</td> <td class="gk">Gecko</td></tr> <tr><td class="ed">Edge</td> <td class="tr">EdgeHTML</td></tr> <tr><td class="sa">Safari</td> <td class="wk">Webkit</td></tr> <tr><td class="ch">Chrome</td> <td class="bk">Blink</td></tr> <tr><td class="op">Opera</td> <td class="bk">Blink</td></tr> </tbody> </table> CSS .collapse { border-collapse: collapse; } .separate { border-collapse: separate; } table { display: inline-table; margin: 1em; border: dashed 5px; } table th, table td { border: solid 3px; } .fx { border-color: orange blue; } .gk { border-color: black red; } .ed { border-color: blue gold; } .tr { border-color: aqua; } .sa { border-color: silver blue; } .wk { border-color: gold blu...
... Recommendation Initial definition ...
border-end-end-radius - CSS: Cascading Style Sheets
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. ...
...-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 size of the circle radius or the semi-major and semi-minor axes of the ellipse. As absolute length it can be expressed in any unit allowed by the CSS <length> data type. Percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. Negative values are invalid. Formal definition Initial value0Applies toall elements; but User Agents are not required to apply to table and inline-table elements when border-collapse is collapse. The behavior on internal table elements is unde...
...lso applies to ::first-letter.InheritednoPercentagesrefer to the corresponding dimension of the border boxComputed valuetwo absolute <length>s or <percentage>sAnimation typea length, percentage or calc(); Formal syntax <length-percentage>{1,2}where <length-percentage> = <length> | <percentage> Examples Border radius with vertical text HTML <div> <p class="exampleText">Example</p> </div> CSS Content div { background-color: rebeccapurple; width: 120px; height: 120px; border-end-end-radius: 10px; } .exampleText { writing-mode: vertical-rl; padding: 10px; background-color: #fff; border-end-end-radius: 10px; } Results Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-end-end-ra...
border-end-start-radius - CSS: Cascading Style Sheets
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. ...
...art-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 the size of the circle radius or the semi-major and semi-minor axes of the ellipse. As absolute length it can be expressed in any unit allowed by the CSS <length> data type. Percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. Negative values are invalid. Formal definition Initial value0Applies toall elements; but User Agents are not required to apply to table and inline-table elements when border-collapse is collapse. The behavior on internal table elements is unde...
...lso applies to ::first-letter.InheritednoPercentagesrefer to the corresponding dimension of the border boxComputed valuetwo absolute <length>s or <percentage>sAnimation typea length, percentage or calc(); Formal syntax <length-percentage>{1,2}where <length-percentage> = <length> | <percentage> Examples Border radius with vertical text HTML <div> <p class="exampleText">Example</p> </div> CSS div { background-color: rebeccapurple; width: 120px; height: 120px; border-end-start-radius: 10px; } .exampleText { writing-mode: vertical-rl; padding: 10px; background-color: #fff; border-end-start-radius: 10px; } Results Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-end-start-radi...
border-image-repeat - 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. ...
...rder. Extra space will be distributed in between tiles to achieve the proper fit. Formal definition Initial valuestretchApplies toall elements, except internal table elements when border-collapse is collapse. ...
... Candidate Recommendation Initial definition ...
border-image-slice - CSS: Cascading Style Sheets
These regions form the components of an element's border image. 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 slicing process creates nine regions in total: four corners, four edges, and a middle region. Four slice lines, set a given distance from their respective sides, control the size of the regions. The above diagram illustrates the location of each region. Zones 1-4 are corner regions. Each one is used a single time to form the corners of the final border image. ...
...iv> </div> <ul> <li> <label for="width">slide to adjust <code>border-width</code></label> <input type="range" min="10" 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 sl...
... Candidate Recommendation Initial defintion ...
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 corres...
... Editor's Draft Initial definition ...
... Editor's Draft Initial definition ...
border-left-color - 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. ...
... )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> Examples A simple div with a border HTML <div class="mybox"> <p>This is a box with a border around it. Note which side of the box is <span class="redtext">red</span>.</p> </div> CSS .mybox { border: solid 0.3em gold; border-left-color: red; width: auto; } .redtext { color: red; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-left-color' in that specification. Candidate Recommendation No significant changes, though the transparent keyword, now incl...
...h: auto; } .redtext { color: red; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-left-color' in that specification. Candidate Recommendation No significant changes, though the transparent keyword, now included in <color> which has been extended, has been formally removed. CSS Level 2 (Revision 1)The definition of 'border-left-color' in that specification. Recommendation Initial definition ...
border-left-width - 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. Syntax /* Keyword values */ border-left-width: thin; border-left-width: medium; border-left-width: thick; /* <length> values */ border-left-width: 10em; border-left-width: 3vmax; border-left-width: 6px; /* Global keywords */ border-left-width: inherit; border-left-width: initial; border-left-width: unset; Values <line-width> Defines the width of the border, either as an explicit nonnegative <length> or a keyword. ...
... a single document. Formal definition Initial valuemediumApplies toall elements. It also applies to ::first-letter.InheritednoComputed valuethe absolute length or 0 if border-left-style is none or hiddenAnimation typea length Formal syntax <line-width>where <line-width> = <length> | thin | medium | thick Examples Comparing border widths HTML <div>Element 1</div> <div>Element 2</div> CSS div { border: 1px solid red; margin: 1em 0; } div:nth-child(1) { border-left-width: thick; } div:nth-child(2) { border-left-width: 2em; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-left-width' in that specification. Candidate Recommendation No significant change. C...
...dth: 2em; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-left-width' in that specification. Candidate Recommendation No significant change. CSS Level 2 (Revision 1)The definition of 'border-left-width' in that specification. Recommendation No significant change. CSS Level 1The definition of 'border-left-width' in that specification. Recommendation Initial definition. ...
border-radius - CSS: Cascading Style Sheets
You can set a single radius to make circular corners, or two radii to make elliptical corners. 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 radius applies to the whole background, even if the element has no border; the exact position of the clipping is defined by the background-clip property. The border-radius property does not apply to table elements when border-collapse is collapse. ...
...der-radius property does not apply to table elements when border-collapse is collapse. Note: As with any shorthand property, individual sub-properties cannot inherit, such as in border-radius:0 0 inherit inherit, which would partially override existing definitions. Instead, the individual longhand properties have to be used. ...
... Candidate Recommendation Initial definition ...
border-right-color - 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. ...
... )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> Examples A simple div with a border HTML <div class="mybox"> <p>This is a box with a border around it. Note which side of the box is <span class="redtext">red</span>.</p> </div> CSS .mybox { border: solid 0.3em gold; border-right-color: red; width: auto; } .redtext { color: red; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-right-color' in that specification. Candidate Recommendation No significant changes, though the transparent keyword, now in...
...: auto; } .redtext { color: red; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-right-color' in that specification. Candidate Recommendation No significant changes, though the transparent keyword, now included in <color> which has been extended, has been formally removed. CSS Level 2 (Revision 1)The definition of 'border-right-color' in that specification. Recommendation Initial definition ...
border-right-width - 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. Syntax /* Keyword values */ border-right-width: thin; border-right-width: medium; border-right-width: thick; /* <length> values */ border-right-width: 10em; border-right-width: 3vmax; border-right-width: 6px; /* Global keywords */ border-right-width: inherit; border-right-width: initial; border-right-width: unset; Values <line-width> Defines the width of the border, either as an explicit nonnegative <length> or a keyword. ...
...a single document. Formal definition Initial valuemediumApplies toall elements. It also applies to ::first-letter.InheritednoComputed valuethe absolute length or 0 if border-right-style is none or hiddenAnimation typea length Formal syntax <line-width>where <line-width> = <length> | thin | medium | thick Examples Comparing border widths HTML <div>Element 1</div> <div>Element 2</div> CSS div { border: 1px solid red; margin: 1em 0; } div:nth-child(1) { border-right-width: thick; } div:nth-child(2) { border-right-width: 2em; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-right-width' in that specification. Candidate Recommendation No significant change. ...
...div { border: 1px solid red; margin: 1em 0; } div:nth-child(1) { border-right-width: thick; } div:nth-child(2) { border-right-width: 2em; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-right-width' in that specification. Candidate Recommendation No significant change. CSS Level 2 (Revision 1)The definition of 'border-right-width' in that specification. Recommendation No significant change. CSS Level 1The definition of 'border-right-width' in that specification. Recommendation Initial definition. ...
border-start-end-radius - CSS: Cascading Style Sheets
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. ...
...d-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 the size of the circle radius or the semi-major and semi-minor axes of the ellipse. As absolute length it can be expressed in any unit allowed by the CSS <length> data type. Percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. Negative values are invalid. Formal definition Initial value0Applies toall elements; but User Agents are not required to apply to table and inline-table elements when border-collapse is collapse. The behavior on internal table elements is unde...
...lso applies to ::first-letter.InheritednoPercentagesrefer to the corresponding dimension of the border boxComputed valuetwo absolute <length>s or <percentage>sAnimation typea length, percentage or calc(); Formal syntax <length-percentage>{1,2}where <length-percentage> = <length> | <percentage> Examples Border radius with vertical text HTML <div> <p class="exampleText">Example</p> </div> CSS div { background-color: rebeccapurple; width: 120px; height: 120px; border-start-end-radius: 10px; } .exampleText { writing-mode: vertical-rl; padding: 10px; background-color: #fff; border-start-end-radius: 10px; } Results Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-start-end-radi...
border-start-start-radius - CSS: Cascading Style Sheets
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. ...
...-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-percentage> Denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipse. As absolute length it can be expressed in any unit allowed by the CSS <length> data type. Percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. Negative values are invalid. Formal definition Initial value0Applies toall elements; but User Agents are not required to apply to table and inline-table elements when border-collapse is collapse. The behavior on internal table elements is unde...
...lso applies to ::first-letter.InheritednoPercentagesrefer to the corresponding dimension of the border boxComputed valuetwo absolute <length>s or <percentage>sAnimation typea length, percentage or calc(); Formal syntax <length-percentage>{1,2}where <length-percentage> = <length> | <percentage> Examples Border radius with vertical text HTML <div> <p class="exampleText">Example</p> </div> CSS div { background-color: rebeccapurple; width: 120px; height: 120px; border-start-start-radius: 10px; } .exampleText { writing-mode: vertical-rl; padding: 10px; background-color: #fff; border-start-start-radius: 10px; } Results Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-start-star...
border-top-color - 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. Syntax /* <color> values */ border-top-color: red; border-top-color: #ffbb00; border-top-color: rgb(255, 0, 0); border-top-color: hsla(100%, 50%, 25%, 0.75); border-top-color: currentcolor; border-top-color: transparent; /* Global values */ border-top-color: inherit; border-top-color: initial; border-top-color: unset; The border-top-color property is specified as a single value. ...
... )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> Examples A simple div with a border HTML <div class="mybox"> <p>This is a box with a border around it. Note which side of the box is <span class="redtext">red</span>.</p> </div> CSS .mybox { border: solid 0.3em gold; border-top-color: red; width: auto; } .redtext { color: red; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-top-color' in that specification. Candidate Recommendation No significant changes, though the transparent keyword, now included in ...
...idth: auto; } .redtext { color: red; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-top-color' in that specification. Candidate Recommendation No significant changes, though the transparent keyword, now included in <color> which has been extended, has been formally removed. CSS Level 2 (Revision 1)The definition of 'border-top-color' in that specification. Recommendation Initial definition ...
border-top-width - 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. Syntax /* Keyword values */ border-top-width: thin; border-top-width: medium; border-top-width: thick; /* <length> values */ border-top-width: 10em; border-top-width: 3vmax; border-top-width: 6px; /* Global keywords */ border-top-width: inherit; border-top-width: initial; border-top-width: unset; Values <line-width> Defines the width of the border, either as an explicit nonnegative <length> or a keyword. ...
...values are constant within a single document. Formal definition Initial valuemediumApplies toall elements. ...
...nAnimation typea length Formal syntax <line-width>where <line-width> = <length> | thin | medium | thick Examples HTML <div>Element 1</div> <div>Element 2</div> CSS div { border: 1px solid red; margin: 1em 0; } div:nth-child(1) { border-top-width: thick; } div:nth-child(2) { border-top-width: 2em; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-top-width' in that specification. Candidate Recommendation No significant change. CSS Level 2 (Revision 1)The definition of 'border-top-width' in that specification. Recommendation No significant change. CSS Level 1The definition of 'border-top-width' in that specification. Recommendation Initial d...
bottom - CSS: Cascading Style Sheets
Web › CSS › bottom
It has no effect on non-positioned elements. 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 effect of bottom depends on how the element is positioned (i.e., the value of the position property): When position is set to absolute or fixed, the bottom property specifies the distance between the element's bottom edge and the bottom edge of its containing block. When position is set to relative, the bottom property specifies the distance the element's bottom edge is moved above its normal position. ...
...ercentage or calc(); Formal syntax <length> | <percentage> | auto Examples Absolute and fixed positioning This example demonstrates the difference in behavior of the bottom property, when position is absolute versus fixed. ...
...<div class="absolute"><p>Absolute</p></div> CSS p { font-size: 30px; line-height: 2em; } div { width: 48%; text-align: center; background: rgba(55,55,55,.2); border: 1px solid blue; } .absolute { position: absolute; bottom: 0; left: 0; } .fixed { position: fixed; bottom: 0; right: 0; } Result Specifications Specification Status Comment CSS Positioned Layout Module Level 3The definition of 'bottom' in that specification. Working Draft Adds behavior for sticky positioning. CSS Level 2 (Revision 1)The definition of 'bottom' in that specification. Recommendation Initial definition. ...
box-align - CSS: Cascading Style Sheets
Web › CSS › box-align
The effect of the property is only visible if there is extra space in the box. See flexbox for information about the current standard. /* Keyword values */ box-align: start; box-align: center; box-align: end; box-align: baseline; box-align: stretch; /* Global values */ box-lines: inherit; box-lines: initial; box-lines: unset; The direction of layout depends on the element's orientation: horizontal or vertical. ...
...xtra 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. If the alignment is set using the element's align attribute, then the style is ignored. ...
...signated the end. If the alignment is set using the element's align attribute, then the style is ignored. ...
box-decoration-break - 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. ...
.... Values slice The element is initially rendered as if its box were not fragmented, after which the rendering for this hypothetical box is sliced into pieces for each line/column/page. Note that the hypothetical box can be different for each fragment since it uses its own height if the break occurs in the inline direction, and its own width if the break occurs in the block direction. See the CSS specification for details. clone Each box fragment is rendered independently with the specified border, padding, and margin wrapping each fragment. The border-radius, border-image, and box-shadow are applied to each fragment independently. The background is also drawn independently for each fragment, which means that a background image with background-repeat: no-repeat may nevertheless repeat m...
... 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 examples above in your browser. Specifications Specification Status Comment CSS Fragmentation Module Level 3The definition of 'box-decoration-break' in that specification. Candidate Recommendation Initial definition. ...
box-flex - CSS: Cascading Style Sheets
Web › CSS › box-flex
This is a property for controlling parts of the XUL box model. It does not match either the old CSS Flexible Box Layout Module drafts for 'box-flex' (which were based on this property) or the behavior of '-webkit-box-flex' (which is based on those drafts). See flexbox for information about the current standard. The -moz-box-flex and -webkit-box-flex CSS properties specify how a -moz-box or -webkit-box grows to fill the box that contains it, in the direction of the containing box's layout. /* <number> values */ -moz-box-flex: 0; -moz-box-flex: 2; -moz-box-flex: 3.5; -webkit-box-flex: 0; -webkit-box-flex: 2; -webkit-box-flex: 3.5; /* Global values */ -moz-box-flex: inherit; -moz-box-flex: initial; -moz-box-flex: unset; -webkit-box-flex: inherit; -webkit-box-flex: initial; -webkit-box-fl...
...ment 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. ...
...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). ...
box-shadow - CSS: Cascading Style Sheets
You can set multiple effects separated by commas. A box shadow is described by X and Y offsets relative to the element, blur and spread radius, and 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 box-shadow property enables you to cast a drop shadow from the frame of almost any element. If a border-radius is specified on the element with a box shadow, the box shadow takes on the same rounded corners. The z-ordering of multiple box shadows is the same as multiple text shadows (the first specified shadow is on top). ...
...le, we include three shadows: an inset shadow, a regular drop shadow, and a 2px shadow that creates a border effect (we could have used an outline instead for that third shadow). HTML <blockquote><q>You may shoot me with your words,<br/> You may cut me with your eyes,<br/> You may kill me with your hatefulness,<br/> But still, like air, I'll rise.</q> <p>&mdash; Maya Angelou</p> </blockquote> CSS blockquote { padding: 20px; box-shadow: inset 0 -3em 3em rgba(0,0,0,0.1), 0 0 0 2px rgb(255,255,255), 0.3em 0.3em 1em rgba(0,0,0,0.3); } Result Setting zero for offset and blur When the x-offset, y-offset, and blur are all zero, the box shadow will be a solid-colored outline of equal-size on all sides. The shadows are drawn back to front, so the first...
...as is the default, the corners of the shadow will be, well, corners. Had we put in a border-radius of any other value, the corners would have been rounded. We added a margin the size of the widest box-shadow to ensure the shadow doesn't overlap adjacent elements or go beyond the border of the containing box. A box-shadow does not impact box model dimensions. HTML <div><p>Hello World</p></div> CSS p { box-shadow: 0 0 0 2em #F4AAB9, 0 0 0 4em #66CCFF; margin: 4em; padding:1em; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'box-shadow' in that specification. Candidate Recommendation Initial definition ...
caret-color - CSS: Cascading Style Sheets
This is sometimes referred to as the text input cursor. The caret appears in elements such as <input> or those with the contenteditable attribute. The caret is typically a thin vertical line that flashes to help make it more noticeable. By default, it is black, but its color can be altered with this 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. Note that the insertion caret is only one type of caret. ...
... Recommendation Initial definition. ...
... Recommendation Initial definition. ...
clamp() - CSS: Cascading Style Sheets
Web › CSS › clamp
clamp() enables selecting a middle value within a range of values between a defined minimum and maximum. It takes three parameters: a minimum value, a preferred value, and a maximum allowed value. The clamp() function can be used anywhere a <length>, <frequency>, <angle>, <time>, <percentage>, <number>, or <integer> is allowed. clamp(MIN, VAL, MAX) is resolved as max(MIN, min(VAL, MAX)) 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. ...
...> <p>Integer rutrum sollicitudin tellus, quis cursus nulla scelerisque nec. Nunc eu facilisis lorem. Maecenas faucibus sapien eleifend, semper tellus at, pharetra quam. Cras feugiat vulputate tortor at rhoncus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam non felis quis sem lobortis sodales vel id libero. Phasellus sit amet placerat lorem. ...
...quis sem lobortis sodales vel id libero. Phasellus sit amet placerat lorem. </p> CSS html { font-family: sans-serif; } body { margin: 0 auto; width: min(1000px, calc(70% + 100px)); } h1 { letter-spacing: 2px; font-size: clamp(1.8rem, 2.5vw, 2.8rem); } p { line-height: 1.5; font-size: max(1.2rem, 1.2vw); } Specifications Specification Status Comment CSS Values and Units Module Level 4The definition of 'clamp()' in that specification. Editor's Draft Initial definition. ...
color-adjust - CSS: Cascading Style Sheets
By default, the browser is allowed to make any adjustments to the element's appearance it determines to be necessary and prudent given the type and capabilities of the output device. Syntax color-adjust: economy; color-adjust: exact; The color-adjust property's value must be one of the following keywords. Values economy The user agent is allowed to make adjustments to the element as it deems appropriate and prudent in order to optimize the output for the device it's being rendered for. ...
...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. ...
... Editor's Draft Initial definition. ...
color - CSS: Cascading Style Sheets
Web › CSS › color
The color CSS property sets the foreground color value of an element's text and text decorations, and sets the currentcolor value. currentcolor may be used as an indirect value on other properties and is the default for other color properties, such as 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. For an overview of using color in HTML, see Applying color to HTML elements using CSS. Syntax /* Keyword values */ color: currentcolor; /* <named-color> values */ color: red; color: orange; color: tan; color: rebeccapurple; /* <hex-color> values */ color: #090; color: #009900; color: #090a; color: #0099...
... Working Draft Adds commaless syntaxes for the rgb(), rgba(), hsl(), and hsla() functions. Allows alpha values in rgb() and hsl(), turning rgba() and hsla() into (deprecated) aliases for them. Adds color keyword rebeccapurple. Adds 4- and 8-digit hex color values, where the last digit(s) represents the alpha value. ...
...ation. Working Draft Adds commaless syntaxes for the rgb(), rgba(), hsl(), and hsla() functions. Allows alpha values in rgb() and hsl(), turning rgba() and hsla() into (deprecated) aliases for them. Adds color keyword rebeccapurple. Adds 4- and 8-digit hex color values, where the last digit(s) represents the alpha value. Adds hwb(), device-cmyk(), and color() functions. CSS Color Module Level 3The definition of 'color' in that specification. Recommendation Deprecates system-colors. Adds SVG colors. Adds the rgba(), hsl(), and hsla() functions. CSS Level 2 (Revision 1)The definition of 'color' in that specification. Recommendation Adds the orange color and the system colors. CSS Level 1The definition of 'color' in that specification. ...
column-count - CSS: Cascading Style Sheets
<integer> Is a strictly positive <integer> describing the ideal number of columns into which the content of the element will be flowed. ...
...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. Syntax /* Keyword value */ column-count: auto; /* <integer> value */ column-count: 3; /* Global values */ column-count: inherit; column-count: initial; column-count: unset; Values auto The number of columns is determined by other CSS properties, such as column-width. <integer> Is a strictly positive <integer> describing the ideal number of columns into which the content of the element will be flowed. If the column-width is also set to a non-auto value, it merely indicates the maximum allowed number of columns. Formal definition Initial valueautoApplies toBlock containers except table wrapper boxesInheritednoComputed valu...
... value, it merely indicates the maximum allowed number of columns. Formal definition Initial valueautoApplies toBlock containers except table wrapper boxesInheritednoComputed valueas specifiedAnimation typean integer Formal syntax <integer> | auto Examples Splitting a paragraph across three columns HTML <p class="content-box"> This is a bunch of text split into three columns using the CSS `column-count` property. The text is equally distributed over the columns. </p> CSS .content-box { column-count: 3; } Result Specifications Specification Status Comment CSS Multi-column Layout ModuleThe definition of 'column-count' in that specification. Working Draft Initial definition. Browser compatibility The compatibility table in this ...
column-span - CSS: Cascading Style Sheets
/* Keyword values */ column-span: none; column-span: all; /* Global values */ column-span: inherit; column-span: initial; column-span: unset; An element that spans more than one column is called a spanning element. Syntax The column-span property is specified as one of the keyword values listed below. Values none The element does not span multiple columns. all The element spans across all columns. Content in the normal flow that appears before the element is automatically balanced across all columns before the element appears. The element establishes a new block formatting context. ...
...Formal syntax none | all Examples Making a heading span columns In this example, the heading is made to span across all the columns of the article. HTML <article> <h2>Header spanning all of the columns</h2> <p> The h2 should span all the columns. The rest of the text should be distributed among the columns. </p> <p>This is a bunch of text split into three columns using the CSS `columns` property. The text is equally distributed over the columns.</p> <p>This is a bunch of text split into three columns using the CSS `columns` property. The text is equally distributed over the columns.</p> <p>This is a bunch of text split into three columns using the CSS `columns` property. The text is equally distributed over the columns.</p> <p>This is a bunch of text split into t...
...e text is equally distributed over the columns.</p> <p>This is a bunch of text split into three columns using the CSS `columns` property. The text is equally distributed over the columns.</p> <p>This is a bunch of text split into three columns using the CSS `columns` property. The text is equally distributed over the columns.</p> <p>This is a bunch of text split into three columns using the CSS `columns` property. The text is equally distributed over the columns.</p> </article> CSS article { columns: 3; } h2 { column-span: all; } Result Specifications Specification Status Comment CSS Multi-column Layout ModuleThe definition of 'column-span' in that specification. Working Draft Initial definition. ...
counter-increment - CSS: Cascading Style Sheets
The counter-increment CSS property increases or decreases the value of a CSS counter by a given value. 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 counter's value can be reset to an arbitrary number using the counter-reset CSS property. Syntax /* Increment "my-counter" by 1 */ counter-increment: my-counter; /* Decrement "my-counter" by 1 */ counter-increment: my-counter -1; /* Increment "counter1" by 1, and decrement "counter2" by 4 */ counter-increment: counter1 counter2 -4; /* Do not increment/decrement anything: used to override less specific rules */ counter-increment: none; /* Global valu...
... Recommendation Initial definition. ...
... Recommendation Initial definition. ...
counter-reset - CSS: Cascading Style Sheets
The counter-reset CSS property resets a CSS counter to a given value. 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 counter's value can be increased or decreased using the counter-increment CSS property. Syntax /* Set "my-counter" to 0 */ counter-reset: my-counter; /* Set "my-counter" to -1 */ counter-reset: my-counter -1; /* Set "counter1" to 1, and "counter2" to 4 */ counter-reset: counter1 1 counter2 4; /* Cancel any reset that could have been set in less specific rules */ counter-reset: none; /* Global values */ counter-reset: inherit; counter-reset: initial; counter-reset: unset; The coun...
... Recommendation Initial definition. ...
... Recommendation Initial definition. ...
<dimension> - CSS: Cascading Style Sheets
Web › CSS › dimension
Syntax The syntax of <dimension> is a <number> immediately followed by a unit which is an identifier. Unit identifiers are case insensitive. Examples Valid dimensions 12px 12 pixels 1rem 1 rem 1.2pt 1.2 points 2200ms 2200 milliseconds 5s 5 seconds 200hz 200 Hertz 200Hz 200 Hertz (values are case insensitive) Invalid dimensions 12 px The unit must come immediately after the number. 12"px" Units are identifiers and therefore unquoted. ...
...points 2200ms 2200 milliseconds 5s 5 seconds 200hz 200 Hertz 200Hz 200 Hertz (values are case insensitive) Invalid dimensions 12 px The unit must come immediately after the number. 12"px" Units are identifiers and therefore unquoted. 3sec The seconds unit is abbreviated "s" not "sec". Specifications Specification Status Comment CSS Values and Units Module Level 4The definition of '<dimension>' in that specification. Editor's Draft Adds cap, ic, lh, rlh, vi, vb CSS Values and Units Module Level 3The definition of '<dimension>' in that specification. Candidate Recommendation Adds ch, rem, vw, vw, vmin, vmax, Q CSS Level 2 (Revision 1)The definition of '<dimension>' in that specification. Recom...
...ension>' in that specification. Editor's Draft Adds cap, ic, lh, rlh, vi, vb CSS Values and Units Module Level 3The definition of '<dimension>' in that specification. Candidate Recommendation Adds ch, rem, vw, vw, vmin, vmax, Q CSS Level 2 (Revision 1)The definition of '<dimension>' in that specification. Recommendation Defined under Numbers and Length CSS Level 1The definition of '<dimension>' in that specification. Recommendation Initial definition under "length units" ...
direction - CSS: Cascading Style Sheets
Web › CSS › direction
Use rtl for languages written from right to left (like Hebrew or Arabic), and ltr for those written from left to right (like English and most other languages). 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 that text direction is usually defined within a document (e.g., with HTML's dir attribute) rather than through direct use of the direction property. The property sets the base text direction of block-level elements and the direction of embeddings created by the unicode-bidi property. ...
... the direction property. The property sets the base text direction of block-level elements and the direction of embeddings created by the unicode-bidi property. It also sets the default alignment of text, block-level elements, and the direction that cells flow within a table row. Unlike the dir attribute in HTML, the direction property is not inherited from table columns into table cells, since CSS inheritance follows the document tree, and table cells are inside of rows but not inside of columns. The direction and unicode-bidi properties are the two only properties which are not affected by the all shorthand property. Syntax /* Keyword values */ direction: ltr; direction: rtl; /* Global values */ direction: inherit; direction: initial; direction: unset; Values ltr Text and other ...
...have any effect on inline-level elements, the unicode-bidi property's value must be embed or override. Formal definition Initial valueltrApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax ltr | rtl Examples Setting right-to-left direction blockquote { direction: rtl; } Specifications Specification Status Comment CSS Writing Modes Module Level 3The definition of 'direction' in that specification. Proposed Recommendation No change. CSS Level 2 (Revision 1)The definition of 'direction' in that specification. 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, pleas...
Adapting to the new two-value syntax of display - CSS: Cascading Style Sheets
Firefox 70 implemented the two-value syntax for the display property, which is part of the CSS Display Module Level 3. This guide explains the change to the syntax, including the reasoning behind this change. It also details the in-built backwards compatibility for the display property. What happens when we change the value of the display property? One of the first things we learn about CSS is that some elements are block-level and some are inline-level. For example, an <h1> or a <p> are block-level by default, and a <span> is inline-level. Using the display property we can switch between block and inline. For example to make a heading inline we would use the following CSS: h1 { display: inline; } More recently we have gained CSS Grid Layout and Flexbox. To access these we also use v...
...The two-value display: block flow-root maps to a fairly recent single value; display: flow-root. This value's only purpose is to create a new Block Formatting Context (BFC). A BFC ensures that everything inside your box stays inside it, and things from outside the box cannot intrude into it. The most obvi...
... two-value syntax for display: flow-root being display: block flow-root therefore makes a lot of sense. You are creating a block formatting context, with a block-level box and children participating in normal flow. What about the matched pair display: inline flow-root? This is the new way of describing display: inline-block. The value display: inline-block has been around since the early days of CSS. The reason we tend to use it is to allow padding to push inline items away from an element, when creating navigation items for example, or when wanting to add a background with padding to an inline element as in the example below. An element with display: inline-block however, will also contain floats. It contains everything inside the inline-level box. Therefore display: inline-block does ex...
<display-internal> - CSS: Cascading Style Sheets
ike <col> HTML elements. table-caption These elements behave like <caption> HTML elements. ruby-base These elements behave like <rb> HTML elements. ruby-text These elements behave like <rt> HTML elements. ruby-base-container These elements behave like <rbc> HTML elements generated as anonymous boxes. ruby-text-container These elements behave like <rtc> HTML elements. ...
...ments. ruby-base These elements behave like <rb> HTML elements. ruby-text These elements behave like <rt> HTML elements. ruby-base-container These elements behave like <rbc> HTML elements generated as anonymous boxes. ruby-text-container These elements behave like <rtc> HTML elements. Examples CSS tables example The following example demonstrates laying out a simple form using CSS table layout. ...
...by-text-container These elements behave like <rtc> HTML elements. Examples CSS tables example The following example demonstrates laying out a simple form using CSS table layout. HTML <main> <div> <label for="name">Name</label> <input type="text" id="name" name="name"> </div> <div> <label for="age">Age</label> <input type="text" id="age" name="age"> </div> </main> CSS main { display: table; } div { display: table-row; } label, input { display: table-cell; margin: 5px; } Result Specifications Specification Status CSS Display Module Level 3The definition of 'display-internal' in that specification. Candidate Recommendation ...
empty-cells - 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. This property has an effect only when the border-collapse property is separate. Syntax /* Keyword values */ empty-cells: show; empty-cells: hide; /* Global values */ empty-cells: inherit; empty-cells: initial; empty-cells: unset; The empty-cells property is specified as one of the keyword values listed below. Values show Borders and backgrounds are drawn like in normal cells. hide No borders or backgrounds are drawn. ...
... Recommendation Initial definition. Browser compatibility The compatibility table on this page i...
... Recommendation Initial definition. ...
filter - CSS: Cascading Style Sheets
Web › CSS › filter
You can also reference an SVG filter with a URL to an SVG filter 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. ...
...ternal XML file. filter: url(resources.svg#c1) Filter functions blur() The blur() fucntion applies a Gaussian blur to the input image. 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. filter: blur(5px) <table class="standard-table"> <thead> <tr> <th style="text-align: left;" scope="col">Original image</th> <th style="text-align: left;" scope="col">Live example</th> <th style="text-align: left;" scope="col">SVG Equivalent</th> <th style="text-align: left;" scope="col">Static example</th> </tr...
... text-align: left; vertical-align: top; width:25%; height:auto; } #img3 { height:100%; } drop-shadow() The drop-shadow() function applies a drop shadow effect to the input image. A drop shadow is effectively a blurred, offset version of the input image's alpha mask drawn in a particular color, composited below the image. The function accepts a parameter of type <shadow> (defined in CSS3 Backgrounds), with the exception that the inset keyword is not allowed. This function is similar to the more established box-shadow property; the difference is that with filters, some browsers provide hardware acceleration for better performance. The parameters of the <shadow> parameter are as follows: <offset-x> <offset-y> (required) These are two <length> values to set the shadow offset. <...
fit-content() - CSS: Cascading Style Sheets
The fit-content() CSS function clamps a given size to an available size according to the formula min(maximum size, max(minimum size, argument)). 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 function can be used as a track size in CSS Grid properties, where the maximum size is defined by max-content and the minimum size by auto, which is calculated similar to auto (i.e., minmax(auto, max-content)), except that the track size is clamped at argument if it is greater than the auto minimum. The function can also be used as laid out box size for width, height, min-width, min-height, max-width and max-height, wher...
... relative to the available inline size or block size of the laid out box depending on the writing mode. Examples Sizing grid columns with fit-content HTML <div id="container"> <div>Item as wide as the content.</div> <div> Item with more text in it. Because the contents of it are wider than the maximum width, it is clamped at 300 pixels. ...
...le item</div> </div> CSS #container { display: grid; grid-template-columns: fit-content(300px) fit-content(300px) 1fr; grid-gap: 5px; box-sizing: border-box; height: 200px; width: 100%; background-color: #8cffa0; padding: 10px; } #container > div { background-color: #8ca0ff; padding: 5px; } Result Specifications Specification Status Comment CSS Box Sizing Module Level 3The definition of 'fit-content()' in that specification. Working Draft Defines the function as laid out box size for width, height, min-width, min-height, max-width and max-height. CSS Grid LayoutThe definition of 'fit-content()' in that specification. Candidate Recommendation Defines the function when used as a track size. ...
flex-basis - CSS: Cascading Style Sheets
It sets the size of the content box unless otherwise set with box-sizing. 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: in case both flex-basis (other than auto) and width (or height in case of flex-direction: column) are set for an element, flex-basis has priority. ...
...ples Setting flex item initial sizes HTML <ul class="container"> <li class="flex 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%; ma...
... Candidate Recommendation Initial definition ...
flex-flow - CSS: Cascading Style Sheets
Web › CSS › flex-flow
The flex-flow CSS shorthand property specifies the direction of a flex container, as well as its wrapping behavior. 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. ...
...SS shorthand property specifies the direction of a flex container, as well as its wrapping behavior. 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. ...
... Candidate Recommendation Initial definition ...
flex-shrink - CSS: Cascading Style Sheets
If the size of all flex items is larger than the flex container, items shrink to fit according to flex-shrink. In use, flex-shrink is used alongside the other flex properties flex-grow and flex-basis, and normally defined using the flex shorthand. 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 /* <number> values */ flex-shrink: 2; flex-shrink: 0.6; /* Global values */ flex-shrink: inherit; flex-shrink: initial; flex-shrink: unset; The flex-shrink property is specified as a single <number>. ...
... Candidate Recommendation Initial definition...
... Candidate Recommendation Initial definition ...
font-family - 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. Values are separated by commas to indicate that they are alternatives. The browser will select the first font in the list that is installed or that can be downloaded using a @font-face at-rule. It is often convenient to use the shorthand property font to set font-size and other font related properties all at once. ...
..."> This is an example of a cursive font. </div> <div class="fantasy"> This is an example of a fantasy font. </div> <div class="math"> This is an example of a math font. </div> <div class="emoji"> This is an example of an emoji font. </div> <div class="fangsong"> This is an example of a fangsong font. ...
...div class="fangsong"> This is an example of a fangsong font. </div> Specifications Specification Status Comment CSS Fonts Module Level 4The definition of 'generic font families' in that specification. Working Draft Adds new generic font families, specifically: system-ui, ui-serif, ui-sans-serif, ui-monospace, ui-rounded, emoji, math, and fangsong. CSS Fonts Module Level 3The definition of 'font-family' in that specification. Candidate Recommendation No significant change CSS Level 2 (Revision 1)The definition of 'font-family' in that specification. Recommendation No significant change CSS Level 1The definition of 'font-family' in that specification. Recommendation Initial definition ...
font-kerning - 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. Kerning defines how letters are spaced. In well-kerned fonts, this feature makes character spacing more uniform and pleasant to read than it would otherwise be. In the image below, for instance, the examples on the left do not use kerning, while the ones on the right do: Syntax The font-kerning property is specified as one of the keyword values listed below. Values auto The browser determines whether font kerning should be used or not. ...
...kerning information stored in the font is disabled. Formal definition Initial valueautoApplies toall elements. It also applies to ::first-letter and ::first-line.InheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax auto | normal | none Examples Enabling and disabling kerning HTML <div id="kern"></div> <div id="nokern"></div> <textarea id="input">AV T. ...
... Candidate Recommendation Initial definition. ...
font-size-adjust - CSS: Cascading Style Sheets
/* Use the specified font size */ font-size-adjust: none; /* Use a font size that makes lowercase letters half the specified font size */ font-size-adjust: 0.5; /* Global values */ font-size-adjust: inherit; font-size-adjust: initial; font-size-adjust: unset; The property is useful since the legibility of fonts, especially at small sizes, is determined more by the size of lowercase letters than by the size of capital letters. ...
... Candidat...
...mes">This is the 10px Times, but now adjusted to the same aspect ratio as the Verdana.</p> CSS .times { font-family: Times, serif; font-size: 10px; } .verdana { font-family: Verdana, sans-serif; font-size: 10px; } .adjtimes { font-family: Times, serif; font-size-adjust: 0.58; font-size: 10px; } Results Specifications Specification Status Comment CSS Fonts Module Level 3The definition of 'font-size-adjust' in that specification. Candidate Recommendation Initial definition The CSS property font-size-adjust was initially defined in CSS 2, but dropped in CSS 2.1. It has been newly defined in CSS 3. Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the dat...
font-variant-east-asian - CSS: Cascading Style Sheets
The font-variant-east-asian CSS property controls the use of alternate glyphs for East Asian scripts, like Japanese and Chinese. font-variant-east-asian: normal; font-variant-east-asian: ruby; font-variant-east-asian: jis78; /* <east-asian-variant-values> */ font-variant-east-asian: jis83; /* <east-asian-variant-values> */ font-variant-east-asian: jis90; /* <east-asian-variant-values> */ font-variant-east-asian: jis04; /* <east-asian-variant-values> */ font-variant-east-asian: simplified; /* <east-asian-variant-values> */ font-variant-east-asian: traditional; /* <east-asian-variant-values> */ font-variant-east-asian: full-width; /* <east-asian-width-values> */ font-variant-east-asian: proportional-width; /* <east-asi...
...fonts may not support OpenType features. ...
... Candidate Recommendation Initial definition ...
font-variant-numeric - 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. ...
...[ <numeric-figure-values> | <numeric-spacing-values> | <numeric-fraction-values> | ordinal | slashed-zero ]where <numeric-figure-values> = [ lining-nums | oldstyle-nums ]<numeric-spacing-values> = [ proportional-nums | tabular-nums ]<numeric-fraction-values> = [ diagonal-fractions | stacked-fractions ] Examples Setting ordinal numeric forms HTML <p class="ordinal">1st, 2nd, 3rd, 4th, 5th</p> CSS /* This example uses the Source Sans Pro OpenType font, developed by Adobe 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 { font-family: "Source Sans Pro"; font-style: normal; font-weight: 400; src: url("https://mdn.mozillademos.org/files/15757/SourceSansPro-Regular.otf") format("opentype...
... Candidate Recommendation Initial definition ...
<frequency> - CSS: Cascading Style Sheets
Web › CSS › frequency
Units Hz Represents a frequency in hertz. Examples: 0Hz, 1500Hz, 10000Hz. kHz Represents a frequency in kilohertz. Examples: 0kHz, 1.5kHz, 10kHz. Note: Although the number 0 is always the same regardless of unit, the unit may not be omitted. In other words, 0 is invalid and does not represent 0Hz or 0kHz. Though the units are case-insensitive, it is good practice to use a capital "H" for Hz and kHz, as specified in the SI. ...
...with a leading + and a unit -0kHz Zero, with a leading - and a unit Invalid frequency values 12.0 This is a <number>, not an <frequency>, because it is missing a unit. 7 Hz No space is allowed between the number and the unit. 0 Although unitless zero is an allowable <length>, it's an invalid <frequency>. ...
...allowed between the number and the unit. 0 Although unitless zero is an allowable <length>, it's an invalid <frequency>. Specifications Specification Status Comment CSS Values and Units Module Level 3The definition of '<frequency>' in that specification. Candidate Recommendation Initial definition. Note: This data type was initially introduced in CSS Level 2 for the now-obsolete aural media type, where it was used to define the pitch of the voice. However, the <frequency> data type has been reintroduced in CSS3, though no CSS property is using it at the moment. ...
<gradient> - CSS: Cascading Style Sheets
Web › CSS › gradient
Its concrete size will match the size of the element to which it applies. Syntax The <gradient> data type is defined with one of the function types listed below. Linear gradient Linear gradients transition colors progressively along an imaginary line. They are generated with the linear-gradient() function. ...
...Its concrete size will match the size of the element to which it applies. Syntax The <gradient> data type is defined with one of the function types listed below. Linear gradient Linear gradients transition colors progressively along an imaginary line. They are generated with the linear-gradient() function. ...
...te 8px, white 16px); } Conic gradient example A simple conic gradient example. Note that this isn't supported widely across browser as of yet. <div class="conic-gradient">Conic gradient</div> div { width: 200px; height: 200px; } .conic-gradient { background: conic-gradient(lightpink, white, powderblue); } Specifications Specification Status Comment CSS Images Module Level 4The definition of '<gradient>' in that specification. Working Draft Adds conic-gradient CSS Images Module Level 3The definition of '<gradient>' in that specification. Candidate Recommendation Initial definition. ...
grid-auto-columns - 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 a grid item is positioned into a column that is not explicitly sized by grid-template-columns, implicit grid tracks are created to hold it. This can happen either by explicitly positioning into a column that is out of range, or by the auto-placement algorithm creating additional columns. ...
... Candidate Recommendation Initial definition ...
... Candidate Recommendation Initial definition ...
grid-auto-flow - 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. Syntax /* Keyword values */ grid-auto-flow: row; grid-auto-flow: column; grid-auto-flow: dense; grid-auto-flow: row dense; grid-auto-flow: column dense; /* Global values */ grid-auto-flow: inherit; grid-auto-flow: initial; grid-auto-flow: unset; This property may take one of two forms: a single keyword: one of row, column, or dense. two keywords: row dense or column dense. ...
... HTML <div id="grid"> <div id="item1"></div> <div id="item2"></div> <div id="item3"></div> <div id="item4"></div> <div id="item5"></div> </div> <select id="direction" onchange="changeGridAutoFlow()"> <option value="column">column</option> <option value="row">row</option> </select> <input id="dense" type="checkbox" onchange="changeGridAutoFlow()"> <label for="dense">dense</label> CSS #grid { height: 200px; width: 200px; display: grid; grid-gap: 10px; grid-template: repeat(4, 1fr) / repeat(2, 1fr); grid-auto-flow: column; /* or 'row', 'row dense', 'column dense' */ } #item1 { background-color: lime; grid-row-start: 3; } #item2 { background-color: yellow; } #item3 { background-color: blue; } #item4 { grid-column-start: 2; background-color: red; } ...
... Candidate Recommendation Initial definition ...
grid-auto-rows - 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 a grid item is positioned into a row that is not explicitly sized by grid-template-rows, implicit grid tracks are created to hold it. This can happen either by explicitly positioning into a row that is out of range, or by the auto-placement algorithm creating additional rows. ...
... Candidate Recommendation Initial definition ...
... Candidate Recommendation Initial definition ...
grid-column-end - 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. ...
...typediscrete Formal syntax <grid-line>where <grid-line> = auto | <custom-ident> | [ <integer> && <custom-ident>? ...
... Candidate Recommendation Initial definition ...
grid-column-start - CSS: Cascading Style Sheets
This start position defines the block-start edge of the grid area. 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. ...
...pediscrete Formal syntax <grid-line>where <grid-line> = auto | <custom-ident> | [ <integer> && <custom-ident>? ...
... Candidate Recommendation Initial definition ...
grid-row-end - 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. ...
...on typediscrete Formal syntax <grid-line>where <grid-line> = auto | <custom-ident> | [ <integer> && <custom-ident>? ...
... Candidate Recommendation Initial definition ...
grid-row-start - 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. ...
... typediscrete Formal syntax <grid-line>where <grid-line> = auto | <custom-ident> | [ <integer> && <custom-ident>? ...
... Candidate Recommendation Initial definition ...
grid-template-areas - 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. Those areas are not associated with any particular grid item, but can be referenced from the grid-placement properties grid-row-start, grid-row-end, grid-column-start, grid-column-end, and their shorthands grid-row, grid-column, and grid-area. ...
...Unless those cells form a rectangle, the declaration is invalid. ...
... Candidate Recommendation Initial definition ...
grid-template-columns - 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. ...
...> ]+ <line-names>? ...
...ntage> = <length> | <percentage> Examples Specifying grid column sizes HTML <div id="grid"> <div id="areaA">A</div> <div id="areaB">B</div> </div> CSS #grid { display: grid; width: 100%; grid-template-columns: 50px 1fr; } #areaA { background-color: lime; } #areaB { background-color: yellow; } Result Specifications Specification Status Comment CSS Grid LayoutThe definition of 'grid-template-columns' in that specification. Candidate Recommendation Initial definition CSS Grid Layout Module Level 2The definition of 'subgrid' in that specification. Working Draft Adds subgrid ...
grid-template-rows - 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. ...
...ize> ]+ <line-names>? ...
...ercentage> = <length> | <percentage> Examples Specifying grid row sizes HTML <div id="grid"> <div id="areaA">A</div> <div id="areaB">B</div> </div> CSS #grid { display: grid; height: 100px; grid-template-rows: 30px 1fr; } #areaA { background-color: lime; } #areaB { background-color: yellow; } Result Specifications Specification Status Comment CSS Grid LayoutThe definition of 'grid-template-rows' in that specification. Candidate Recommendation Initial definition CSS Grid Layout Module Level 2The definition of 'subgrid' in that specification. Working Draft Adds subgrid ...
height - CSS: Cascading Style Sheets
Web › CSS › height
By default, the property defines the height of the content area. If box-sizing is set to border-box, however, it instead determines the height of the border area. 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 min-height and max-height properties override height. Syntax /* Keyword value */ height: auto; /* <length> values */ height: 120px; height: 10em; /* <percentage> value */ height: 75%; /* Global values */ height: inherit; height: initial; height: unset; Values <length> Defines the height as an absolute value. ...
...rmal syntax auto | <length> | <percentage> | min-content | max-content | fit-content(<length-percentage>)where <length-percentage> = <length> | <percentage> Examples Setting height using pixels and percentages HTML <div id="taller">I'm 50 pixels tall.</div> <div id="shorter">I'm 25 pixels tall.</div> <div id="parent"> <div id="child"> I'm half the height of my parent. </div> </div> CSS div { width: 250px; margin-bottom: 5px; border: 2px solid blue; } #taller { height: 50px; } #shorter { height: 25px; } #parent { height: 100px; } #child { height: 50%; width: 75%; } Result Specifications Specification Status Comment CSS Box Sizing Module Level 4The definition of 'height' in that specification. Editor's Draft C...
...child { height: 50%; width: 75%; } Result Specifications Specification Status Comment CSS Box Sizing Module Level 4The definition of 'height' in that specification. Editor's Draft CSS Box Sizing Module Level 3The definition of 'height' in that specification. Working Draft Added the max-content, min-content, fit-content keywords. CSS Level 2 (Revision 1)The definition of 'height' in that specification. Recommendation Adds support for the <length> values and precises on which element it applies to. CSS Level 1The definition of 'height' in that specification. Recommendation Initial definition. ...
image() - CSS: Cascading Style Sheets
Disambiguation: Image(), the HTMLImageElement constructor. ...
... overall purpose, it is better to describe it semantically in the document. MDN Understanding WCAG, Guideline 1.1 explanations Understanding Success Criterion 1.1.1 | W3C Understanding WCAG 2.0 This feature can help improve accessibility by providing a fallback color when an image fails to load. While this can and should be done by including a background-color on every background image, 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-imag...
...hind the logo image instead of on top of it. Additionally, the entire container would have had the same background color. Because we used image() along with the background-size property (and prevented the image from repeating with the background-repeat property, the color swatch will only cover a quarter of the container. Specifications Specification Status Comment CSS Images Module Level 4The definition of 'image()' in that specification. Working Draft Initial definition ...
ime-mode - CSS: Cascading Style Sheets
Web › CSS › ime-mode
This property is obsolete. /* Keyword values */ ime-mode: auto; ime-mode: normal; ime-mode: active; ime-mode: inactive; ime-mode: disabled; /* Global values */ ime-mode: inherit; ime-mode: initial; ime-mode: unset; The ime-mode property is only partially and inconsistently implemented in browsers. It was introduced by Microsoft with Internet Explorer 5 as a proprietary extension: -ms-ime-mode Attribute | imeMode Property. Note: In general, it's not appropriate for a public web site to change the IME mode. This property should only be used for private web applications or to undo the property if it was previously set by legacy code. ...
...thod editor is disabled 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 ...
...hich 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. Recommendation Initial definition. Makes ime-mode officially obsolete. ...
inherit - CSS: Cascading Style Sheets
Web › CSS › inherit
For inherited properties, this reinforces the default behavior, and is only needed to override another rule. For non-inherited properties, this specifies a behavior that typically makes relatively little sense and you may consider using initial instead, or unset on the all property. Inheritance is always from the parent element in the document tree, even when the parent element is not the containing block. ...
...; } /* ...but leave those in the sidebar alone so they use their parent's color */ #sidebar h2 { color: inherit; } In this example the h2 elements inside the sidebar might be different colors. For example, if one of them were the child of a div matched by the rule ... div#current { color: blue; } ... it would be blue. ...
...ide the sidebar might be different colors. For example, if one of them were the child of a div matched by the rule ... div#current { color: blue; } ... it would be blue. Specifications Specification Status Comment CSS Cascading and Inheritance Level 4The definition of 'inherit' in that specification. Candidate Recommendation No changes from Level 3. CSS Values and Units Module Level 3The definition of 'inherit' in that specification. Candidate Recommendation No significant change from CSS Level 2 (Revision 1). CSS Level 2 (Revision 1)The definition of 'inherit' in that specification. Recommendation Initial definition. ...
Inheritance - CSS: Cascading Style Sheets
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. ...
... 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. ...
...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, and margin collapsing, or the initial, computed, resolved, specified, used, and actual values. Definitions of value syntax, s...
initial-letter-align - CSS: Cascading Style Sheets
/* Keyword values */ initial-letter-align: auto; initial-letter-align: alphabetic; initial-letter-align: hanging; initial-letter-align: ideographic; /* Global values */ initial-letter-align: inherit; initial-letter-align: initial; initial-letter-align: unset; Syntax One of the keyword values listed below. Values auto The user agent selects the value which corresponds to the language of the text. Western languages would default to alphabetic, CJK languages to ideographic, and some Indic languages to hanging. alphabetic As described above, the cap height of the initial letter aligns with the cap height of the first line of text. ...
... first child of a block containerInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax [ auto | alphabetic | hanging | ideographic ] Examples Aligning initial letter HTML <p class="auto ">Initial letter - auto</p> <p class="alphabetic">Initial letter - alphabetic</p> <p class="hanging">Initial letter - hanging</p> <p class="ideographic">Initial letter - ideographic</p> CSS .auto { -webkit-initial-letter-align: auto; initial-letter-align: auto; } .alphabetic { -webkit-initial-letter-align: alphabetic; initial-letter-align: alphabetic; } .hanging { -webkit-initial-letter-align: hanging; initial-letter-align: hanging; } .ideographic { -webkit-initial-letter-align: ideographic; initial-letter-align: ideographic; } Result Specifications ...
... Working Draft Initial definition ...
initial-letter - CSS: Cascading Style Sheets
/* Keyword values */ initial-letter: normal; /* Numeric values */ initial-letter: 1.5; /* Initial letter occupies 1.5 lines */ initial-letter: 3.0; /* Initial letter occupies 3 lines */ initial-letter: 3.0 2; /* Initial letter occupies 3 lines and sinks 2 lines */ /* Global values */ initial-letter: inherit; initial-letter: initial; initial-letter: unset; Syntax The keyword value normal, or a <number> optionally followed by an <integer>. Values normal No special initial-letter effect. Text behaves as normal. <number> Defines the size of the initial letter, in terms of how many lines it occupies. Negative values are not allowed. ...
... Working Draft Initial defi...
... Working Draft Initial definition ...
inset-block-start - CSS: Cascading Style Sheets
It corresponds to the top, right, bottom, or left property depending on the values defined for writing-mode, direction, and text-orientation. /* <length> values */ inset-block-start: 3px; inset-block-start: 2.4em; /* <percentage>s of the width or height of the containing block */ inset-block-start: 10%; /* Keyword value */ inset-block-start: auto; /* Global values */ inset-block-start: inherit; inset-block-start: initial; inset-block-start: unset; Syntax Values The inset-block-start property takes the same values as the left property. ...
... Editor's Draft Initi...
... Editor's Draft Initial definition ...
inset-inline-start - CSS: Cascading Style Sheets
It corresponds to the top, right, bottom, or left property depending on the values defined for writing-mode, direction, and text-orientation. /* <length> values */ inset-inline-start: 3px; inset-inline-start: 2.4em; /* <percentage>s of the width or height of the containing block */ inset-inline-start: 10%; /* Keyword value */ inset-inline-start: auto; /* Global values */ inset-inline-start: inherit; inset-inline-start: initial; inset-inline-start: unset; The shorthand for inset-inline-start and inset-inline-end is inset-inline. ...
... Editor's Draf...
... Editor's Draft Initial definition ...
inset - CSS: Cascading Style Sheets
Web › CSS › inset
It has the same multi-value syntax of the margin shorthand. It is a shorthand that corresponds to the top, right, bottom, and/or left properties. ...
... Ed...
... Editor's Draft Initial definition ...
justify-items - 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 effect of this property is dependent of the layout mode we are in: In block-level layouts, it aligns the items inside their containing block on the inline axis. For absolutely-positioned elements, it aligns the items inside their containing block on the inline axis, accounting for the offset values of top, left, bottom, and right. ...
...h of their cells. If you hover or tab onto the grid container however, it is given a justify-items value of center, which causes the grid items to span only as wide as their content width, and align in the center of their cells. ...
... Working Draft Initial definition ...
justify-self - 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 effect of this property is dependent of the layout mode we are in: In block-level layouts, it aligns an item inside its containing block on the inline axis. For absolutely-positioned elements, it aligns an item inside its containing block on the inline axis, accounting for the offset values of top, left, bottom, and right. ...
...rid items are then given different values of justify-self, to show how these override the justify-items value. These values cause the grid items to span only as wide as their content width, and align in different positions across their cells. ...
... Working Draft Initial definition ...
<length-percentage> - CSS: Cascading Style Sheets
The <length-percentage> CSS data type represents a value that can be either a <length> or a <percentage>. Syntax Refer to the documentation for <length> and <percentage> for details of the individual syntaxes allowed by this type. Examples length-percentage examples The following simple example demonstrates several properties that use <length-percentage> values. ...
...presents a value that can be either a <length> or a <percentage>. Syntax Refer to the documentation for <length> and <percentage> for details of the individual syntaxes allowed by this type. Examples length-percentage examples The following simple example demonstrates several properties that use <length-percentage> values. ...
...adjust: 20%; } Result Use in calc() Where a <length-percentage> is specified as an allowable type, this means that the percentage resolves to a length and therefore can be used in a calc() expression. Therefore, all of the following values are acceptable for width: width: 200px; width: 20%; width: calc(100% - 200px); Specifications Specification Status Comment CSS Values and Units Module Level 4The definition of '<length-percentage>' in that specification. Editor's Draft CSS Values and Units Module Level 3The definition of '<length-percentage>' in that specification. Candidate Recommendation Defines <length-percentage>. Adds calc() ...
letter-spacing - CSS: Cascading Style Sheets
This value is added to the natural spacing between characters while rendering the text. Positive values of letter-spacing causes characters to spread farther apart, while negative values of letter-spacing bring characters closer together. 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. ...
...line.InheritedyesComputed valuean optimum value consisting of either an absolute length or the keyword normalAnimation typea length Formal syntax normal | <length> Examples Setting letter spacing HTML <p class="normal">letter spacing</p> <p class="em-wide">letter spacing</p> <p class="em-wider">letter spacing</p> <p class="em-tight">letter spacing</p> <p class="px-wide">letter spacing</p> CSS .normal { letter-spacing: normal; } .em-wide { letter-spacing: 0.4em; } .em-wider { letter-spacing: 1em; } .em-tight { letter-spacing: -0.05em; } .px-wide { letter-spacing: 6px; } Result Specifications Specification Status Comment CSS Text Module Level 3The definition of 'letter-spacing' in that specification. Working Draft No change. CSS Leve...
... Recommendation Initial definition. Browser compatibility The compatibility table on this page is generated from structured data. ...
line-height - CSS: Cascading Style Sheets
It's commonly used to set the distance between lines of text. On block-level elements, it specifies the minimum height of line boxes within the element. On non-replaced inline elements, it specifies the height that is used to calculate line box height. 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. ...
... </div> <div class="box red"> <h1>Avoid unexpected results by using unitless line-height.</h1> length and percentage line-heights have poor inheritance behavior ... </div> <!-- The first <h1> line-height is calculated from its own font-size (30px x 1.1) = 33px --> <!-- The second <h1> line-height results from the red div's font-size (15px x 1.1) = 16.5px, probably not what you want --> CSS .green { line-height: 1.1; border: solid limegreen; } .red { line-height: 1.1em; border: solid red; } h1 { font-size: 30px; } .box { width: 18em; display: inline-block; vertical-align: top; font-size: 15px; } Result Specifications Specification Status Comment CSS Level 2 (Revision 1)The definition of 'line-height' in that specification. R...
... Recommendation Initial definition. ...
list-style-position - 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. 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. ...
...l class="inside">List 1 <li>List Item 1-1</li> <li>List Item 1-2</li> <li>List Item 1-3</li> <li>List Item 1-4</li> </ul> <ul class="outside">List 2 <li>List Item 2-1</li> <li>List Item 2-2</li> <li>List Item 2-3</li> <li>List Item 2-4</li> </ul> <ul class="inside-img">List 3 <li>List Item 3-1</li> <li>List Item 3-2</li> <li>List Item 3-3</li> <li>List Item 3-4</li> </ul> CSS .inside { list-style-position: inside; list-style-type: square; } .outside { list-style-position: outside; list-style-type: circle; } .inside-img { list-style-position: inside; list-style-image: url("https://mdn.mozillademos.org/files/11979/starsolid.gif"); } Result Specifications Specification Status Comment CSS Lists Module Level 3The definition o...
... Recommendation Initial definition. ...
margin-block-end - 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. ...
... Editor's Draft Initial definition ...
... Editor's Draft Initial definition ...
margin-block-start - 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. ...
... Editor's Draft Initial definitio...
... Editor's Draft Initial definition ...
margin-inline-end - CSS: Cascading Style Sheets
In other words, it corresponds to the margin-top, margin-right, margin-bottom or margin-left 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. ...
... Editor's Draft Initial definition ...
... Editor's Draft Initial definition ...
margin-inline-start - CSS: Cascading Style Sheets
It corresponds to the margin-top, margin-right, margin-bottom, or margin-left 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. ...
... Editor's Draft Initial definit...
... Editor's Draft Initial definition ...
margin-right - CSS: Cascading Style Sheets
A positive value places it farther from its neighbors, while a negative value places it closer. 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 vertical margins of two adjacent boxes may fuse. This is called margin collapsing. ...
... Recommendation ...
... syntax <length> | <percentage> | auto Examples Setting right margin using pixels and percentages .content { margin-right: 5%; } .sidebox { margin-right: 10px; } .logo { margin-right: -5px; } Specifications Specification Status Comment CSS Basic Box ModelThe definition of 'margin-right' in that specification. Working Draft No significant change CSS Flexible Box Layout ModuleThe definition of 'margin-right' in that specification. Candidate Recommendation Defines the behavior of margin-right on flex items. CSS Level 2 (Revision 1)The definition of 'margin-right' in that specification. Recommendation Removes its effect on inline elements. CSS Level 1The definition of 'margin-right' in that specification. Recomm...
margin-top - CSS: Cascading Style Sheets
A positive value places it farther from its neighbors, while a negative value places it closer. 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 property has no effect on non-replaced inline elements, such as <span> or <code>. ...
... Recommendation Initial definition ...
... | <percentage> | auto Examples Setting positive and negative top margins .content { margin-top: 5%; } .sidebox { margin-top: 10px; } .logo { margin-top: -5px; } #footer { margin-top: 1em; } Specifications Specification Status Comment CSS Basic Box ModelThe definition of 'margin-top' in that specification. Working Draft No significant change CSS Level 2 (Revision 1)The definition of 'margin-top' in that specification. Recommendation Removes its effect on inline elements. CSS Level 1The definition of 'margin-top' in that specification. Recommendation Initial definition ...
margin - CSS: Cascading Style Sheets
Web › CSS › margin
It is a shorthand for margin-top, margin-right, margin-bottom, and margin-left. 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 top and bottom margins have no effect on non-replaced inline elements, such as <span> or <code>. Note: Margins create extra space around an element. In contrast, padding creates extra space within an element. ...
... relative to the width of the containing block. auto The browser selects a suitable margin to use. For example, in certain cases this value can be used to center an element. ...
...t support Flexible Box Layout, these are not available. In order to center an element inside its parent, use margin: 0 auto;. Margin collapsing Elements' top and bottom margins are sometimes collapsed into a single margin that is equal to the larger of the two margins. See Mastering margin collapsing for more information. Specifications Specification Status Comment CSS Basic Box ModelThe definition of 'margin' in that specification. Working Draft No significant change. CSS Level 2 (Revision 1)The definition of 'margin' in that specification. Recommendation Removes the effect of top and bottom margins on inline elements. CSS Level 1The definition of 'margin' in that specification. Recommendation Initial definition. Init...
mask-clip - CSS: Cascading Style Sheets
Web › CSS › mask-clip
The painted content of an element must be restricted to this area. /* <geometry-box> values */ mask-clip: content-box; mask-clip: padding-box; mask-clip: border-box; mask-clip: margin-box; mask-clip: fill-box; mask-clip: stroke-box; mask-clip: view-box; /* Keyword values */ mask-clip: no-clip; /* Non-standard keyword values */ -webkit-mask-clip: border; -webkit-mask-clip: padding; -webkit-mask-clip: content; -webkit-mask-clip: text; /* Multiple values */ mask-clip: padding-box, no-clip; mask-clip: view-box, fill-box, border-box; /* Global values */ mask-clip: inherit; mask-clip: initial; mask-clip: unset; Syntax One or more of the keyword values listed below, separated by commas. ...
...SVG, it applies to container elements excluding the defs element and all graphics elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax [ <geometry-box> | no-clip ]#where <geometry-box> = <shape-box> | fill-box | stroke-box | view-boxwhere <shape-box> = <box> | margin-boxwhere <box> = border-box | padding-box | content-box Examples Clipping a mask to the border box CSS #masked { width: 100px; height: 100px; background-color: #8cffa0; margin: 20px; border: 20px solid #8ca0ff; padding: 20px; mask-image: url(https://mdn.mozillademos.org/files/12668/MDN.svg); mask-size: 100% 100%; mask-clip: border-box; /* Can be changed in the live sample */ } HTML <div id="masked"> </div> <select id="clipBox"> <option value="content-box">content-box</opti...
... Candidate Recommendation Initial definition ...
mask-composite - CSS: Cascading Style Sheets
/* Keyword values */ mask-composite: add; mask-composite: subtract; mask-composite: intersect; mask-composite: exclude; /* Global values */ mask-composite: inherit; mask-composite: initial; mask-composite: unset; Syntax One or more of the keyword values listed below, separated by commas. Values For the composition the current mask layer is referred to as source, while all layers below it are referred to as destination. add The source is placed over the destination. subtract The source is placed, where it falls outside of the destination. intersect The parts of source that overlap the destination, replace the destination. ...
...nd destination are combined. ...
... Candidate Recommendation Initial definition ...
mask-mode - CSS: Cascading Style Sheets
Web › CSS › mask-mode
/* Keyword values */ mask-mode: alpha; mask-mode: luminance; mask-mode: match-source; /* Multiple values */ mask-mode: alpha, match-source; /* Global values */ mask-mode: inherit; mask-mode: initial; mask-mode: unset; Syntax The mask-mode property is specified as one or more of the keyword values listed below, separated by commas. Values alpha This keyword indicates that the transparency (alpha channel) values of the mask layer image should be used as the mask values. luminance This keyword indicates that the luminance values of the mask layer image should be used as the mask values. ...
...the mask layer image should be used as the mask values. ...
... Candidate Recommendation Initial definition ...
mask-origin - CSS: Cascading Style Sheets
The mask-origin CSS property sets the origin of a mask. /* Keyword values */ mask-origin: content-box; mask-origin: padding-box; mask-origin: border-box; mask-origin: margin-box; mask-origin: fill-box; mask-origin: stroke-box; mask-origin: view-box; /* Multiple values */ mask-origin: padding-box, content-box; mask-origin: view-box, fill-box, border-box; /* Non-standard keyword values */ -webkit-mask-origin: content; -webkit-mask-origin: padding; -webkit-mask-origin: border; /* Global values */ mask-origin: inherit; mask-origin: initial; mask-origin: unset; For elements rendered as a single box, this property specifies the mask positioning area. In other words, this property specifies the origin position of an image specified by the mask-image CSS property. For elements rendered as mult...
...elements; In SVG, it applies to container elements excluding the defs element and all graphics elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <geometry-box>#where <geometry-box> = <shape-box> | fill-box | stroke-box | view-boxwhere <shape-box> = <box> | margin-boxwhere <box> = border-box | padding-box | content-box Examples Setting mask origin to border-box CSS #masked { width: 100px; height: 100px; margin: 10px; border: 10px solid blue; background-color: #8cffa0; padding: 10px; mask-image: url(https://mdn.mozillademos.org/files/12676/star.svg); mask-origin: border-box; /* Can be changed in the live sample */ } HTML <div id="masked"> </div> <select id="origin"> <option value="content-box">content-box</option> <option value="padd...
... Candidate Recommendation Initial definition ...
mask-position - CSS: Cascading Style Sheets
/* Keyword values */ mask-position: top; mask-position: bottom; mask-position: left; mask-position: right; mask-position: center; /* <position> values */ mask-position: 25% 75%; mask-position: 0px 0px; mask-position: 10% 8em; /* Multiple values */ mask-position: top right; mask-position: 1rem 1rem, center; /* Global values */ mask-position: inherit; mask-position: initial; mask-position: unset; Syntax One or more <position> values, separated by commas. Values <position> One to four values representing a 2D position regarding the edges of the element's box. Relative or absolute offsets can be given. ...
...gth, percentage, or calc Formal syntax <position>#where <position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? ...
... Candidate Recommendation Initial definition ...
mask - CSS: Cascading Style Sheets
Web › CSS › mask
The mask CSS shorthand property hides an element (partially or fully) 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. ...
..., 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. ...
... Candidate Recommendation Extends its usage to HTML elements. Extends its syntax by making it a shorthand for the new mask-* properties defined in that specification. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'mask' in that specification. Recommendation Initial definition. ...
max() - CSS: Cascading Style Sheets
Web › CSS › max
The max() function can be used anywhere a <length>, <frequency>, <angle>, <time>, <percentage>, <number>, or <integer> is allowed. 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 the first above example, the width will be at least 400px, but will be wider if the the viewport is more than 2000px wide (in which case 1vw would be 20px, so 20vw would be 400px). Think of the max() value as providing the minimum value a property can have. ...
... combine min() and max() values, or use max() within a clamp() or calc() function. Formal syntax max( <calc-sum># )where <calc-sum> = <calc-product> [ [ '+' | '-' ] <calc-product> ]*where <calc-product> = <calc-value> [ '*' <calc-value> | '/' <number> ]*where <calc-value> = <number> | <dimension> | <percentage> | ( <calc-sum> ) Examples Setting a minimum size for a font Another use case for CSS functions is allow a font size to grow while ensuring it is at least a mimum size, enabling responsive font sizes while ensuring legibility. Let's look at some CSS: h1 { font-size: 2rem; } h1.responsive { font-size: max(4vw, 2em, 2rem); } The font-size will at minimum be 2rems, or twice the default size of font for the page. This ensure it is legible and ensures accessibility <h1>This te...
...gth unit that is always large enough to read. For example: small { font-size: max(min(0.5vw, 0.5em), 1rem); } This ensures a minimum size of 1rem, with a text size that scales if the page is zoomed. MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.4 | W3C Understanding WCAG 2.0 Specifications Specification Status Comment CSS Values and Units Module Level 4The definition of 'max()' in that specification. Editor's Draft Initial definition ...
min-height - CSS: Cascading Style Sheets
It prevents the used value of the height property from becoming smaller than the value specified for min-height. 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 element's height is set to the value of min-height whenever min-height is larger than max-height or height. ...
... Recommendation Initial definition. ...
... <percentage> | min-content | max-content | fit-content(<length-percentage>)where <length-percentage> = <length> | <percentage> Examples Setting min-height table { min-height: 75%; } form { min-height: 0; } Specifications Specification Status Comment CSS Box Sizing Module Level 4The definition of 'min-height' in that specification. Editor's Draft CSS Box Sizing Module Level 3The definition of 'min-height' in that specification. Working Draft Adds the max-content, min-content, fit-content keywords. CSS Level 2 (Revision 1)The definition of 'min-height' in that specification. Recommendation Initial definition. ...
mix-blend-mode - 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. ...
...nd-mode: exclusion; } .hue .item { mix-blend-mode: hue; } .saturation .item { mix-blend-mode: saturation; } .color .item { mix-blend-mode: color; } .luminosity .item { mix-blend-mode: luminosity; } Using mix-blend-mode with HTML HTML <div class="isolate"> <div class="circle circle-1"></div> <div class="circle circle-2"></div> <div class="circle circle-3"></div> </div> CSS .circle { width: 80px; height: 80px; border-radius: 50%; mix-blend-mode: screen; position: absolute; } .circle-1 { background: red; } .circle-2 { background: lightgreen; left: 40px; } .circle-3 { background: blue; left: 20px; top: 40px; } .isolate { isolation: isolate; /* Without isolation, the background color will be taken into account */ position: relative; } Re...
... Candidate Recommendation Initial definition Browser compatibility Th...
offset-distance - CSS: Cascading Style Sheets
Syntax /* Default value */ offset-distance: 0; /* the middle of the offset-path */ offset-distance: 50%; /* a fixed length positioned along the path */ offset-distance: 40px; <length-percentage> A length that specifies how far the element is along the path (defined with offset-path). 100% represents the total length of the path (when the offset-path is defined as a basic shape or path()). ...
...ath()). ...
...re <length-percentage> = <length> | <percentage> Examples Using offset-distance in an animation The motion aspect in CSS Motion Path typically comes from animating the offset-distance property. If you want to animate an element along its full path, you would define its offset-path and then set up an animation that takes the offset-distance from 0% to 100%. ...
offset - CSS: Cascading Style Sheets
Web › CSS › offset
The offset CSS shorthand property sets all the properties required for animating an element along a defined path. Note: Early versions of the spec called this property motion. ...
... The offset CSS shorthand property sets all the properties required for animating an element along a defined path. Note: Early versions of the spec called this property motion. ...
...e>, <basic-shape> or <path()>offset-distance: a length, percentage or calc();offset-anchor: a positionoffset-rotate: as <angle>, <basic-shape> or <path()>Creates stacking contextyes Formal syntax [ <'offset-position'>? [ <'offset-path'> [ <'offset-distance'> | <'offset-rotate'> ]? ]? ]! ...
orphans - CSS: Cascading Style Sheets
Web › CSS › orphans
/* <integer> values */ orphans: 2; orphans: 3; /* Global values */ orphans: inherit; orphans: initial; orphans: unset; In typography, an orphan is the first line of a paragraph that appears alone at the bottom of a page. (The paragraph continues on a following page.) Syntax Values <integer> The minimum number of lines that can stay by themselves at the bottom of a fragment before a fragmentation break. The value must be positive. ...
...imation typediscrete Formal syntax <integer> Examples Setting a minimum orphan size of three lines HTML <div> <p>This is the first paragraph containing some text.</p> <p>This is the second paragraph containing some more text than the first one. It is used to demonstrate how orphans work.</p> <p>This is the third paragraph. It has a little bit more text than the first one.</p> </div> CSS div { background-color: #8cffa0; height: 150px; columns: 3; orphans: 3; } p { background-color: #8ca0ff; } p:first-child { margin-top: 0; } Result Specifications Specification Status Comment CSS Fragmentation Module Level 3The definition of 'orphans' in that specification. Candidate Recommendation Extends orphans to apply to any type of fragm...
... Recommendation Initial definition. ...
outline-color - 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. Syntax /* <color> values */ outline-color: #f92525; outline-color: rgb(30,222,121); outline-color: blue; /* Keyword value */ outline-color: invert; /* Global values */ outline-color: inherit; outline-color: initial; outline-color: unset; The outline-color property is specified as any one of the values listed below. Values <color> The color of the outline, specified as a <color>. ...
...percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
...e>? )where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> Examples Setting a solid blue outline HTML <p>My outline is blue, as you can see.</p> CSS p { outline: 2px solid; /* Set the outline width and style */ outline-color: #0000FF; /* Make the outline blue */ margin: 5px; } Result Specifications Specification Status Comment CSS Basic User Interface Module Level 3The definition of 'outline-color' in that specification. Recommendation No change. CSS Level 2 (Revision 1)The definition of 'outline-color' in that specification. Recommendation Initial definition. Browser compatibility The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, ...
outline-width - CSS: Cascading Style Sheets
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. Syntax /* Keyword values */ outline-width: thin; outline-width: medium; outline-width: thick; /* <length> values */ outline-width: 1px; outline-width: 0.1em; /* Global values */ outline-width: inherit; The outline-width property is specified as any one of the values listed below. ...
...ngth; if the keyword none 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 ...
... Recommendation Initial definition. ...
outline - CSS: Cascading Style Sheets
Web › CSS › outline
The outline CSS shorthand property 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 ...
... Recommendation No change. ...
...e-width'> ] Examples Using outline to set a focus style HTML <a href="#">This link has a special focus style.</a> CSS a { border: 1px solid; border-radius: 3px; display: inline-block; margin: 10px; padding: 5px; } a:focus { outline: 4px dotted #e73; outline-offset: 4px; background: #ffa; } Result Specifications Specification Status Comment CSS Basic User Interface Module Level 3The definition of 'outline' in that specification. Recommendation No change. CSS Level 2 (Revision 1)The definition of 'outline' in that specification. Recommendation Initial definition. ...
overflow-block - CSS: Cascading Style Sheets
This may be nothing, a scroll bar, or the overflow content. The overflow-block property maps to overflow-y or overflow-x depending on the writing mode of the document. Syntax /* Keyword values */ overflow-block: visible; overflow-block: hidden; overflow-block: scroll; overflow-block: auto; /* Global values */ overflow-block: inherit; overflow-block: initial; overflow-block: unset; The overflow-block property is specified as a single keyword chosen from the list of values below. Values visible Content is not clipped and may be rendered outside the padding box's block start and block end edges. ...
...scroll</code> <div id="div4"> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 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. ...
... Working Draft Initial valueautoApplies toBlock-containers, flex containers, and grid containersInheritednoComputed valueas specified, except with visible/clip computing to auto/hidden respectively if one of overflow-x or overflow-y is neither visible nor clipAnimation typediscrete ...
overflow-x - CSS: Cascading Style Sheets
This may be nothing, a scroll bar, or the overflow content. 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 /* Keyword values */ overflow-x: visible; overflow-x: hidden; overflow-x: clip; overflow-x: scroll; overflow-x: auto; /* Global values */ overflow-x: inherit; overflow-x: initial; overflow-x: unset; The overflow-x property is specified as a single keyword chosen from the list of values below. ...
... Working Draft...
... Working Draft ...
overflow-y - CSS: Cascading Style Sheets
This may be nothing, a scroll bar, or the overflow content. 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 /* Keyword values */ overflow-y: visible; overflow-y: hidden; overflow-y: clip; overflow-y: scroll; overflow-y: auto; /* Global values */ overflow-y: inherit; overflow-y: initial; overflow-y: unset; The overflow-y property is specified as a single keyword chosen from the list of values below. ...
...scroll</code> <div id="div4"> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 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. ...
.../li> </ul> CSS #div1, #div2, #div3, #div4 { border: 1px solid black; width: 250px; height: 100px; } #div1 { overflow-y: hidden; margin-bottom: 12px;} #div2 { overflow-y: scroll; margin-bottom: 12px;} #div3 { overflow-y: visible; margin-bottom: 120px;} #div4 { overflow-y: auto; margin-bottom: 120px;} Result Specifications Specification Status Comment CSS Overflow Module Level 3The definition of 'overflow-y' in that specification. Working Draft ...
overscroll-behavior-block - CSS: Cascading Style Sheets
See overscroll-behavior for a full explanation. /* Keyword values */ overscroll-behavior-block: auto; /* default */ overscroll-behavior-block: contain; overscroll-behavior-block: none; /* Global values */ overscroll-behavior-block: inherit; overscroll-behavior-block: initial; overscroll-behavior-block: unset; Syntax The overscroll-behavior-block property is specified as a keyword chosen from the list of values below. Values auto The default scroll overflow behavior occurs as normal. contain Default scroll overflow behavior is observed inside the element this value is set on (e.g. ...
..., which is probably not what we want. To avoid this happening in the block direction, we've set overscroll-behavior-block: contain on the inner box. ...
... Working Draft ...
overscroll-behavior-inline - CSS: Cascading Style Sheets
See overscroll-behavior for a full explanation. /* Keyword values */ overscroll-behavior-inline: auto; /* default */ overscroll-behavior-inline: contain; overscroll-behavior-inline: none; /* Global values */ overscroll-behavior-inline: inherit; overscroll-behavior-inline: initial; overscroll-behavior-inline: unset; Syntax The overscroll-behavior-inline property is specified as a keyword chosen from the list of values below. Values auto The default scroll overflow behavior occurs as normal. contain Default scroll overflow behavior is observed inside the element this value is set on (e.g. ...
...hich is probably not what we want. To avoid this happening in the inline direction, we've set overscroll-behavior-inline: contain on the inner box. ...
... Working Draft ...
padding-block - CSS: Cascading Style Sheets
The padding-block CSS shorthand property defines the logical block start and end padding of an element, which maps to physical padding properties depending on the element's writing mode, directionality, and text orientation. /* <length> values */ padding-block: 10px 20px; /* An absolute length */ padding-block: 1em 2em; /* relative to the text size */ padding-block: 10px; /* sets both start and end values */ /* <percentage> values */ padding-block: 5% 2%; /* relative to the nearest block container's width */ /* Global values */ padding-block: inherit; padding-block: initial; padding-block: unset; These values corresponds to the padding-top and padding-bottom, or padding-right, and padding-left property depending on the values defined for writing-mode, direction, and text-or...
...e to the nearest block container's width */ /* Global values */ padding-block: inherit; padding-block: initial; padding-block: unset; These values corresponds to the padding-top and padding-bottom, or padding-right, and padding-left property depending on the values defined for writing-mode, direction, and text-orientation. Constituent properties This property is a shorthand for the following CSS properties: padding-block-end padding-block-start Syntax Values The padding-block property takes the same values as the padding-left property. Formal definition Initial value0Applies toall elementsInheritednoPercentageslogical-width of containing blockComputed valueas <length>Animation typediscrete Formal syntax <'padding-left'>{1,2} Examples Setting block padding for vertical text ...
... Values The padding-block property takes the same values as the padding-left property. Formal definition Initial value0Applies toall elementsInheritednoPercentageslogical-width of containing blockComputed valueas <length>Animation typediscrete Formal syntax <'padding-left'>{1,2} Examples Setting block padding for vertical text HTML <div> <p class="exampleText">Example text</p> </div> CSS div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-rl; padding-block: 20px 40px; background-color: #c8c800; } Result Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'padding-block' in that specification. Editor's Draft Initial definition ...
padding-inline - CSS: Cascading Style Sheets
The padding-inline CSS shorthand property defines the logical inline start and end padding of an element, which maps to physical padding properties depending on the element's writing mode, directionality, and text orientation. ...
... Description Values for this property correspond to the padding-top and padding-bottom, or padding-right, and padding-left property depending on the values defined for writing-mode, direction, and text-orientation. Formal definition Initial v...
...rty depending on the values defined for writing-mode, direction, and text-orientation. Formal definition Initial value0Applies toall elementsInheritednoPercentageslogical-width of containing blockComputed valueas <length>Animation typediscrete Formal syntax <'padding-left'>{1,2} Examples Setting inline padding for vertical text HTML <div> <p class="exampleText">Example text</p> </div> CSS div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-rl; padding-inline: 20px 40px; background-color: #c8c800; } Result Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'padding-inline' in that specification. Editor's Draft Initial definition ...
<percentage> - CSS: Cascading Style Sheets
The <percentage> CSS data type represents a percentage value. It is often used to define a size as relative to an element's parent object. Numerous properties can use percentages, such as width, height, margin, padding, and font-size. Note: Only calculated values can be inherited. Thus, even if a percentage value is used on the parent property, a real value (such as a width in pixels for a <length> value) will be accessible on the inherited property, not the percentage value. Syntax The <percentage> data type consists of a <number> followed by the percentage sign (%). Optionally, it may be preceded by a single + or - sign, 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 animate...
...round-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 significant change. CSS Values and Units Module Level 3The definition of '<percentage>' in that specification. Candidate Recommendation No significant change from CSS Level 2 (Revision 1). CSS Level 2 (Revision 1)The definition of '<percentage>' in that specificat...
...ition of '<percentage>' in that specification. Editor's Draft No significant change. CSS Values and Units Module Level 3The definition of '<percentage>' in that specification. Candidate Recommendation No significant change from CSS Level 2 (Revision 1). CSS Level 2 (Revision 1)The definition of '<percentage>' in that specification. Recommendation No change from CSS Level 1. CSS Level 1The definition of '<percentage>' in that specification. Recommendation Initial definition. ...
perspective-origin - CSS: Cascading Style Sheets
It is used as the vanishing point by the perspective 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. The perspective-origin and perspective properties are attached to the parent of a child transformed in 3-dimensional space, unlike the perspective() transform function which is placed on the element being transformed. ...
... <figcaption><code>perspective-origin: 200% -200%;</code></figcaption> <div class="container"> <div class="cube po200200"> <div class="face front">1</div> <div class="face back">2</div> <div class="face right">3</div> <div class="face left">4</div> <div class="face top">5</div> <div class="face bottom">6</div> </div> </div> </figure> </section> CSS /* perspective-origin values (unique per example) */ .potl { perspective-origin: top left; } .potm { perspective-origin: top; } .potr { perspective-origin: top right; } .poml { perspective-origin: left; } .pomm { perspective-origin: 50% 50%; } .pomr { perspective-origin: right; } .pobl { perspective-origin: bottom left; } .pobm { perspective-origin: bottom; } .pobr { perspectiv...
... Editor's Draft Initial definition. ...
place-items - CSS: Cascading Style Sheets
The CSS place-items shorthand property allows you to align items along both the block and inline directions at once (i.e. the align-items and justify-items properties) in a relevant layout system such as Grid or Flexbox. If the second value is not set, the first value is also used for it. 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. ...
...system such as Grid or Flexbox. If the second value is not set, the first value is also used for it. 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. ...
...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-template-columns: repeat(auto-fill, 50px); } Result Specifications Specification Status Comment CSS Box Alignment...
pointer-events - 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. ...
...inter events on all images This example disables pointer events (clicking, dragging, hovering, etc.) on all images. img { pointer-events: none; } Disabling pointer events on a single link This example disables pointer events on the link to http://example.com. HTML <ul> <li><a href="https://developer.mozilla.org">MDN</a></li> <li><a href="http://example.com">example.com</a></li> </ul> CSS a[href="http://example.com"] { pointer-events: none; } Result Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'pointer-events' in that specification. Candidate Recommendation Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'pointer-events' in that specification. Recommendation...
...pecification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'pointer-events' in that specification. Candidate Recommendation Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'pointer-events' in that specification. Recommendation Initial definition Its extension to HTML elements, though present in early drafts of CSS Basic User Interface Module Level 3, has been pushed to its level 4. 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. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for A...
<position> - CSS: Cascading Style Sheets
It is used in the background-position and offset-anchor properties. Note: The final position described by the <position> value does not need to be inside the element's box. Syntax The <position> data type is specified with one or two keywords, with optional offsets. The keyword values are center, top, right, bottom, and left. Each keyword represents either an edge of the element's box or the center line between two edges. Depending on the context, center represents either the center between the left and right edges, or the center between the top and bottom edges. ...
...y. However, because the speed of the interpolation is determined by a single timing function for both coordinates, the point will move in a straight line. Examples Valid positions center left center top right 8.5% bottom 12vmin right -6px 10% 20% 8rem 14px Invalid positions left right bottom top 10px 15px 20px 15px Specifications Specification Status Comment CSS Values and Units Module Level 3The definition of '<position>' in that specification. Candidate Recommendation Relists links to both definitions: if CSS Backgrounds and Borders Module Level 3 is supported, its definition of <position> must also be used. CSS Backgrounds and Borders Module Level 3The definition of '<bg-position>' in that specification. Candidate Recommendation D...
... Candidate Recommendation Relists links to both definitions: if CSS Backgrounds and Borders Module Level 3 is supported, its definition of <position> must also be used. CSS Backgrounds and Borders Module Level 3The definition of '<bg-position>' in that specification. Candidate Recommendation Defines <position> explicitly and extends it to support offsets from any edge. CSS Level 2 (Revision 1)The definition of '<position>' in that specification. Recommendation Allows combination of a keyword with a <length> or <percentage> value. CSS Level 1The definition of '<position>' in that specification. Recommendation Defines <position> anonymously as the value of background-position. ...
quotes - CSS: Cascading Style Sheets
Web › CSS › quotes
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. ...
...esents the outer level of quotation, the second pair is for the first nested level, next pair for third level and so on. Formal definition Initial valuedepends on user agentApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax none | auto | [ <string> <string> ]+ Examples Basic quote marks HTML <q>To be or not to be. That's the question!</q> CSS q { quotes: '"' '"' "'" "'"; } q::before { content: open-quote; } q::after { content: close-quote; } Result Auto quotes For most browsers, the default value of quotes is auto (Firefox 70+), or the browser otherwise had this default behavior (Chromiums, Safari, Edge), so this example works without it being explicitly being set. HTML <div lang="fr"> <q>Ceci est une citation francais...
...+), or the browser otherwise had this default behavior (Chromiums, Safari, Edge), so this example works without it being explicitly being set. HTML <div lang="fr"> <q>Ceci est une citation francaise.</q> <div> <hr> <div lang="ru"> <q>??? ??????? ??????</q> <div> <hr> <div lang="de"> <q>Dies ist ein deutsches Zitat</q> <div> <hr> <div lang="en"> <q>This is an English quote.</q> <div> CSS /*q { quotes: auto; }*/ Result Specifications Specification Status Comment CSS Generated Content Module Level 3The definition of 'quotes' in that specification. Working Draft CSS Level 2 (Revision 1)The definition of 'quotes' in that specification. Recommendation Initial definition Browser compatibility The compatibility table on...
radial-gradient() - CSS: Cascading Style Sheets
Its shape may be a circle or an ellipse. The function's result is an object of the <gradient> data type, which is a special kind of <image>. 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. ...
... Candidate Recommendation Initial definition. ...
... Candidate Recommendation Initial definition. ...
repeat() - CSS: Cascading Style Sheets
Web › CSS › repeat
The repeat() CSS function represents a repeated fragment of the track list, allowing a large number of columns or rows that exhibit a recurring pattern to be written in a more compact form. This function can be used in the CSS Grid properties grid-template-columns and grid-template-rows. /* <track-repeat> values */ repeat(4, 1fr) repeat(4, [col-start] 250px [col-end]) repeat(4, [col-start] 60% [col-end]) repeat(4, [col-start] 1fr [col-end]) repeat(4, [col-start] min-content [col-end]) repeat(4, [col-start] max-content [col-end]) repeat(4, [col-start] auto [col-end]) repeat(4, [col-start] minmax(100px, 1fr) [col-end]) repeat(4, [col-start] fit-content(200px) [col-end]) repeat(4, 10px [col-start] 30% [col-middle] auto [col-end]) repeat(4, [col-start] min-content [col-middle] max-content [col...
...nt specified value (e.g., 1px), to avoid division by zero. Examples Specifying grid columns using repeat() HTML <div id="container"> <div> This item is 50 pixels wide. </div> <div> Item with flexible width. </div> <div> This item is 50 pixels wide. </div> <div> Item with flexible width. </div> <div> Inflexible item of 100 pixels width. ...
...of 100 pixels width. </div> </div> CSS #container { display: grid; grid-template-columns: repeat(2, 50px 1fr) 100px; grid-gap: 5px; box-sizing: border-box; height: 200px; width: 100%; background-color: #8cffa0; padding: 10px; } #container > div { background-color: #8ca0ff; padding: 5px; } Result Specifications Specification Status Comment CSS Grid LayoutThe definition of 'repeat()' in that specification. Candidate Recommendation Initial definition ...
rotate - CSS: Cascading Style Sheets
Web › CSS › rotate
This maps better to typical user interface usage, and saves having to remember the exact order of transform functions to specify in the transform property. Syntax /* Keyword values */ rotate: none; /* Angle value */ rotate: 90deg; rotate: 0.25turn; rotate: 1.57rad; /* x, y, or z axis name plus angle */ rotate: x 90deg; rotate: y 0.25turn; rotate: z 1.57rad; /* Vector plus angle value */ rotate: 1 1 1 90deg; Values angle value An <angle> specifying the angle to rotate the affected element through, around the Z axis. Equivalent to a rotate() (2D rotation) function. ...
...3D rotation) function. none Specifies that no rotation should be applied. ...
... Editor's Draft Initial definition. ...
scale - CSS: Cascading Style Sheets
Web › CSS › scale
This maps better to typical user interface usage, and saves having to remember the exact order of transform functions to specify in the transform value. Syntax /* Keyword values */ scale: none; /* Single values */ /* values of more than 1 make the element grow */ scale: 2; /* values of less than 1 make the element shrink */ scale: 0.5; /* Two values */ scale: 2 0.5; /* Three values */ scale: 2 0.5 2; Values Single number value A <number> specifying a scale factor to make the affected element scale by the same factor along both the X and Y axes. Equivalent to a scale() (2D scaling) function with a single value specified. ...
... 3D scale. Equivalent to a scale3d() (3D scaling) function. none Specifies that no scaling should be applied. ...
... Editor's Draft Initial definition. ...
scroll-margin-inline - CSS: Cascading Style Sheets
The scroll-margin-inline shorthand property sets the scroll margins of an element in the inline dimension. Constituent properties This property is a shorthand for the following CSS properties: scroll-margin-inline-end scroll-margin-inline-start Syntax /* <length> values */ scroll-margin-inline: 10px; scroll-margin-inline: 1em .5em ; /* Global values */ scroll-margin-inline: inherit; scroll-margin-inline: initial; scroll-margin-inline: unset; Values <length> An outset from the corresponding edge of the scroll container. Description The scroll-margin values represent outsets defining the scroll snap area that is used for snapping this box to the snapport. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-align...
... the interactive example above, except that here we'll 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 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. the outer container is styled like this: .scroller { text-align: left; width: 250px; height: 250px; overflow-x: scroll; display: flex; box-sizing: 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 ...
...Here we are setting scroll-margin on the start and end of the inline axis (x in our case), but only the end edge is really relevant. It would work just as well here to only set a scroll margin on that one edge, for example with scroll-margin-inline: 0 1rem, or scroll-margin-inline-end: 1rem. Result Try it for yourself: Specifications Specification Status Comment CSS Scroll Snap Module Level 1The definition of 'scroll-margin-inline' in that specification. Candidate Recommendation Initial definition ...
scroll-margin - CSS: Cascading Style Sheets
f an element at once, assigning values much like the margin property does for margins of an 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. Constituent properties This property is a shorthand for the following CSS properties: scroll-margin-bottom scroll-margin-left scroll-margin-right scroll-margin-top Syntax /* <length> values */ scroll-margin: 10px; scroll-margin: 1em .5em 1em 1em; /* Global values */ scroll-margin: inherit; scroll-margin: initial; scroll-margin: unset; Values <length> An outset from the corresponding edge of the scroll container. Description You can see the effect of ...
...o the interactive example above, except that here we'll 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. the outer container is styled like this: .scroller { text-align: left; width: 250px; height: 250px; overflow-x: scroll; display: flex; box-sizing: 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 ...
... edge of the third <div>. Note: Here we are setting scroll-margin on all sides at once, but only the start edge is really relevant. It would work just as well here to only set a scroll margin on that one edge, for example with scroll-margin-inline-start: 1rem, or scroll-margin: 0 0 0 1rem. Result Try it for yourself: Specifications Specification Status Comment CSS Scroll Snap Module Level 1The definition of 'scroll-margin' in that specification. Candidate Recommendation Initial definition ...
scroll-snap-stop - CSS: Cascading Style Sheets
/* Keyword values */ scroll-snap-stop: normal; scroll-snap-stop: always; /* Global values */ scroll-snap-type: inherit; scroll-snap-type: initial; scroll-snap-type: unset; Syntax Values normal When the visual viewport of this element's scroll container is scrolled, it may "pass over" possible snap positions. always The scroll container must not "pass over" a possible snap position; and must snap to the first of this elements' snap positions. ...
...ways The scroll container must not "pass over" a possible snap position; and must snap to the first of this elements' snap positions. Formal definition Initial valuenormalApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax normal | always Examples Snapping in different axes This example is duplicated from scroll-snap-type with minor variances. ...
...div> <div class="container y mandatory-scroll-snapping" dir="rtl"> <div>Y Mand. RTL</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> </div> <div class="container y proximity-scroll-snapping" dir="rtl"> <div>Y Prox. RTL</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> </div> Result Specifications Specification Status Comment CSS Scroll Snap Module Level 1The definition of 'scroll-snap-stop' in that specification. Candidate Recommendation Initial definition ...
scroll-snap-type - 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. Specifying any precise animations or physics used to enforce those snap points is not covered by this property but instead left up to the user agent. ...
...ox. RTL</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> </div> <div class="container y mandatory-scroll-snapping" dir="rtl"> <div>Y Mand. RTL</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> </div> <div class="container y proximity-scroll-snapping" dir="rtl"> <div>Y Prox. ...
... Candidate Recommendation Initial definition ...
scrollbar-color - CSS: Cascading Style Sheets
The track refers to the background of the scrollbar, which is generally fixed regardless of the scrolling position. The thumb refers to the moving part of the scrollbar, which usually floats on top of the track. Syntax /* Keyword values */ scrollbar-color: auto; scrollbar-color: dark; scrollbar-color: light; /* <color> values */ scrollbar-color: rebeccapurple green; /* Two valid colors. The first applies to the thumb of the scrollbar, the second to the track. */ /* Global values */ scrollbar-color: inherit; scrollbar-color: initial; scrollbar-color: unset; Values <scrollbar-color> Defines the color of the scrollbar. ...
...Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard greens dandeli...
...inde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo melon azuki bean garlic. Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini.</div> Result Specifications Specification Status Comment CSS Scrollbars Level 1The definition of 'scrollbar-color' in that specification. Working Draft Initial definition. ...
<shape> - CSS: Cascading Style Sheets
Web › CSS › shape
The region represents the part of an element to which the clip property applies. Note: <shape> and rect() work in conjunction with clip, which has been deprecated in favor of clip-path. When possible, use clip-path and the <basic-shape> data type instead. Syntax The <shape> data type is specified using the rect() function, which produces a region in the form of a rectangle. rect() rect(top, right, bottom, left) Values top Is a <length> representing the offset for the top of the rectangle relative to the top border of the element's box. right Is a <length> representing the offset for the right of the rectangle relative to the left border of the element's box. ...
...When animated, values of the <shape> data type are interpolated over their top, right, bottom, and left components, each treated as a real, floating-point number. The speed of the interpolation is determined by the timing function associated with the animation. Example img.clip04 { clip: rect(10px, 20px, 20px, 10px); } Specifications Specification Status Comment CSS Level 2 (Revision 1)The definition of '<shape>' in that specification. Recommendation Defines with the clip property. 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. DesktopMobileChromeEdgeFirefoxInternet Expl...
... ...
<string> - CSS: Cascading Style Sheets
Web › CSS › string
Syntax The <string> data type is composed of any number of Unicode characters surrounded by either double (") or single (') quotes. Most characters can be represented literally. All characters can also be represented with their respective Unicode code points in hexadecimal, in which case they are preceded by a backslash (\). For example, \22 represents a double quote, \27 a single quote ('), and \A9 the copyright symbol ((C)). Importantly, certain characters which would otherwise be invalid can be escaped with a backslash. ...
... To output new lines, you must escape them with a line feed character such as \A or \00000A. In your code, however, strings can span multiple lines, in which case each new line must be escaped with a \ as the last character of the line. However, to get new lines, you must also set the white-space property to appropriate value. Note: HTML entities (such as &nbsp; or &#8212;) cannot be used in a CSS <string>. Examples /* Simple strings */ "This string is demarcated by double quotes." 'This string is demarcated by single quotes.' /* Character escaping */ "This is a string with \" an escaped double quote." "This string also has \22 an escaped double quote." 'This is a string with \' an escaped single quote.' 'This string also has \27 an escaped single quote.' "This is a string with \\ an e...
...e.' 'This string also has \27 an escaped single quote.' "This is a string with \\ an escaped backslash." /* New line in a string */ "This string has a \Aline break in it." /* String spanning two lines of code (these two strings will have identical output) */ "A really long \ awesome string" "A really long awesome string" Specifications Specification Status Comment CSS Values and Units Module Level 3The definition of '<string>' in that specification. Candidate Recommendation No significant change from CSS Level 2 (Revision 1). CSS Level 2 (Revision 1)The definition of '<string>' in that specification. Recommendation Explicit definition; allows 6-digit Unicode escaped characters. CSS Level 1The definition of '<string>' in that speci...
text-combine-upright - CSS: Cascading Style Sheets
If the combined text is wider than 1em, the user agent must fit the contents within 1em. The resulting composition is treated as a single upright glyph for layout and decoration. This property only has an effect in vertical writing modes. This is used to produce an effect that is known as tate-chu-yoko (???) in Japanese, or as ???? in Chinese. ...
...s tonon-replaced inline elementsInheritedyesComputed valuespecified keyword, plus integer if 'digits'Animation typediscrete Formal syntax none | all | [ digits <integer>? ] Examples Digits The digits value requires less markup than the all value when digits are being combined, but it is currently not very widely supported by browsers. HTML <p lang="ja" class="exampleText">??20?4?16??</p> CSS .exampleText { writing-mode: vertical-lr; text-combine-upright: digits 2; font: 36px serif; } Results ScreenshotLive sample All The all value requires markup around every piece of horizontal text, but it is currently supported by more browsers than the digits value. HTML <p lang="zh-Hant">??<span class="num">105</span >?<span class="num">4</span >?<span class="num">29</span>?</p> C...
...tal text, but it is currently supported by more browsers than the digits value. HTML <p lang="zh-Hant">??<span class="num">105</span >?<span class="num">4</span >?<span class="num">29</span>?</p> CSS html { writing-mode: vertical-rl; font: 24px serif } .num { text-combine-upright: all } Results ScreenshotLive sample Specifications Specification Status Comment CSS Writing Modes Level 4The definition of 'text-combine-upright' in that specification. Candidate Recommendation Add digits value CSS Writing Modes Module Level 3The definition of 'text-combine-upright' in that specification. Proposed Recommendation Initial definition ...
text-decoration-line - 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. When setting multiple line-decoration properties at once, it may be more convenient to use the text-decoration shorthand property instead. ...
...ne Produces no text decoration. underline Each line of text has a decorative line beneath it. overline Each line of text has a decorative line above it. line-through Each line of text has a decorative line going through its middle. blink The text blinks (alternates between visible and invisible). Conforming user agents may simply not blink the text. This value is deprecated in favor of CSS animations. Formal definition Initial valuenoneApplies toall elements. It also applies to ::first-letter and ::first-line.InheritednoComputed valueas specifiedAnimation typediscrete Formal syntax none | [ underline | overline | line-through | blink ] | spelling-error | grammar-error Examples <p class="wavy">Here's some text with wavy red underline!</p> <p class="both">This text has lines b...
... Candidate Recommendation Initial definition. The text-decoration property is now a shorthand to define multiple related properties. ...
text-decoration-skip-ink - 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. text-decoration-skip-ink is not part of the text-decoration shorthand. ...
... Initial valueautoApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax auto | all | none Examples HTML <p>You should go on a quest for a cup of coffee.</p> <p class="no-skip-ink">Or maybe you'd prefer some tea?</p> <p>????? text-decoration-skip-ink: auto ????????????</p> <p class="skip-ink-all">????? ...
... Working Draft Initial definition ...
text-decoration-style - CSS: Cascading Style Sheets
The style applies to all lines that are set with text-decoration-line. 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. ...
... Candidate Recommendation Initia...
...ed; -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 that specification. Candidate Recommendation Initial definition. The text-decoration property is now a shorthand to define multiple related properties. ...
text-decoration-thickness - CSS: Cascading Style Sheets
Syntax /* Single keyword */ text-decoration-thickness: auto; text-decoration-thickness: from-font; /* length */ text-decoration-thickness: 0.1em; text-decoration-thickness: 3px; /* percentage */ text-decoration-thickness: 10%; /* Global values */ text-decoration-thickness: inherit; text-decoration-thickness: initial; text-decoration-thickness: unset; Values auto The browser chooses an appropriate width for the text decoration line. from-font If the font file includes information about a preferred thickness, use that value. ...
...ritednoPercentagesrefer to the font size of the element itselfComputed 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 ...
... Working Draft Initial definition. Note: The property used to be called text-decoration-width, but was updated in 2019 to text-decoration-thickness. ...
text-emphasis-color - CSS: Cascading Style Sheets
This value can also be set using the text-emphasis shorthand. /* Initial value */ text-emphasis-color: currentcolor; /* <color> */ text-emphasis-color: #555; text-emphasis-color: blue; text-emphasis-color: rgba(90, 200, 160, 0.8); text-emphasis-color: transparent; /* Global values */ text-emphasis-color: inherit; text-emphasis-color: initial; text-emphasis-color: unset; Syntax Values <color> Defines the color of the emphasis marks. If no color is present, it defaults to currentcolor. ...
... Candidate Recommendation Initial definition ...
... Candidate Recommendation Initial definition ...
text-size-adjust - CSS: Cascading Style Sheets
Other browsers will ignore this property. /* Keyword values */ text-size-adjust: none; text-size-adjust: auto; /* <percentage> value */ text-size-adjust: 80%; /* Global values */ text-size-adjust: inherit; text-size-adjust: initial; text-size-adjust: unset; Because many websites have not been developed with small devices in mind, mobile browsers differ from desktop browsers in the way they render web pages. Instead of laying out pages at the width of the device screen, they lay them out using a viewport that is much wider, usually 800 or 1000 pixels. ...
...size-adjust property allows web authors to disable or modify this behavior, as web pages designed with small screens in mind do not need it. Syntax The text-size-adjust property is specified as none, auto, or a <percentage>. Values none Disables the browser's inflation algorithm. auto Enables the browser's inflation algorithm. This value is used to cancel a none value previously set with CSS. <percentage> Enables the browser's inflation algorithm, specifying a percentage value with which to increase the font size. Formal definition Initial valueauto for smartphone browsers supporting inflation, none in other cases (and then not modifiable).Applies toall elementsInheritedyesPercentagesyes, refer to the corresponding size of the text fontComputed valueas specifiedAnimation typedis...
... Editor's Draft Initial definition ...
text-underline-position - 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. ...
...lam volutpat pharetra lorem, sit amet feugiat tortor volutpat quis. Nam eget sodales quam. Aliquam accumsan tellus ac erat posuere.</p> <p class="vertical">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam consectetur ac turpis vel laoreet. Nullam volutpat pharetra lorem, sit amet feugiat tortor volutpat quis. Nam eget sodales quam. Aliquam accumsan tellus ac erat posuere.</p> Our CSS looks like this: p { font-size: 1.5rem; text-transform: capitalize; text-decoration: underline; text-decoration-thickness: 2px; } .horizontal { text-underline-position: under; } .vertical { writing-mode: vertical-rl; text-underline-position: left; } In this example we set both the paragraphs to have a thick underline. In the horizontal text we use text-underline-position: under;...
...rty inherits and is not reset by the text-decoration shorthand property, it may be appropriate to set its value at a global level. For example, the under value may be appropriate for a document with lots of chemical and mathematical formulas, which make a large use of subscripts. :root { text-underline-position: under; } Specifications Specification Status Comment CSS Text Decoration Module Level 3The definition of 'text-underline-position' in that specification. Candidate Recommendation Initial definition ...
top - CSS: Cascading Style Sheets
Web › CSS › top
It has no effect on non-positioned elements. 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 effect of top depends on how the element is positioned (i.e., the value of the position property): When position is set to absolute or fixed, the top property specifies the distance between the element's top edge and the top edge of its containing block. When position is set to relative, the top property specifies the distance the element's top edge is moved below its normal position. ...
... Recommendation Initial definition. ...
... Recommendation Initial definition. ...
transform-box - CSS: Cascading Style Sheets
/* Keyword values */ transform-box: content-box; transform-box: border-box; transform-box: fill-box; transform-box: stroke-box; transform-box: view-box; /* Global values */ transform-box: inherit; transform-box: initial; transform-box: unset; Syntax The transform-box property is specified as one of the keyword values listed below. Values content-box The content box is used as the reference box. The reference box of a <table> is the border box of its table wrapper box, not its table box. border-box The border box is used as the reference box. The reference box of a <table> is the border box of its table wrapper box, not its table box. ...
...transform-box: fill-box is used to make the the transform-origin the center of the bounding box, so the rectangle spins in place. Without it, the transform origin is the center of the SVG canvas, and so you get a very different effect. svg{ width:80vh; border:1px solid #d9d9d9; position:absolute; margin: auto;...
... Working Draft Initial definition ...
matrix() - CSS: Cascading Style Sheets
Its result is a <transform-function> data type. Note: matrix(a, b, c, d, tx, ty) is a shorthand for matrix3d(a, b, 0, 0, c, d, 0, 0, 0, 0, 1, 0, tx, ty, 0, 1). Syntax The matrix() function is specified with six values. The constant values are implied and not passed as parameters; the other parameters are described in the column-major order. Note: Until Firefox 16, Gecko accepted a <length> value for tx and ty. matrix(a, b, c, d, tx, ty) Values a b c d Are <number>s describing the linear transformation. tx ty Are <number>s describing the translation to apply. ...
... Working Draft Initial definition ...
... Working Draft Initial definition ...
perspective() - CSS: Cascading Style Sheets
Its result is a <transform-function> data type. 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 perspective() transform function is part of the transform value applied on the element being transformed. This differs from the perspective and perspective-origin properties which are attached to the parent of a child transformed in 3-dimensional space. ...
...p">B</div> <div class="face left">C</div> </div> <p>With perspective (9cm):</p> <div class="perspective-box-far"> <div class="face front">A</div> <div class="face top">B</div> <div 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); } .perspectiv...
... Editor's Draft Initial definition ...
rotateX() - CSS: Cascading Style Sheets
Note: rotateX(a) is equivalent to rotate3d(1, 0, 0, a). Note: Unlike rotations in the 2D plane, the composition of 3D rotations is usually not commutative. In other words, the order in which the rotations are applied impacts the result. ...
...issa (horizontal axis) without deforming it. Its result is a <transform-function> data type. 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 axis of rotation passes through an origin, defined by the transform-origin CSS property. Note: rotateX(a) is equivalent to rotate3d(1, 0, 0, a). Note: Unlike rotations in the 2D plane, the composition of 3D rotations is usually not commutative. In other words, the order in which the rotations are applied impacts the result. Syntax The amount of rotation created by rotateX() is specified by an <angle>. If positive, the movement will be clockwise; if negative, it will b...
...ise one. Cartesian coordinates on R2 Homogeneous coordinates on RP2 Cartesian coordinates on R3 Homogeneous coordinates on RP3 This transformation applies to the 3D space and can't be represented on the plane. 1000cos(a)-sin(a)0sin(a)cos(a) 10000cos(a)-sin(a)00sin(a)cos(a)00001 Examples HTML <div>Normal</div> <div class="rotated">Rotated</div> CSS div { width: 80px; height: 80px; background-color: skyblue; } .rotated { transform: rotateX(45deg); background-color: pink; } Result Specifications Specification Status Comment CSS Transforms Level 2The definition of 'rotateX()' in that specification. Editor's Draft Initial definition ...
rotateY() - CSS: Cascading Style Sheets
Note: rotateY(a) is equivalent to rotate3d(0, 1, 0, a). Note: Unlike rotations in the 2D plane, the composition of 3D rotations is usually not commutative. In other words, the order in which the rotations are applied impacts the result. ...
...dinate (vertical axis) without deforming it. Its result is a <transform-function> data type. 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 axis of rotation passes through an origin, defined by the transform-origin CSS property. Note: rotateY(a) is equivalent to rotate3d(0, 1, 0, a). Note: Unlike rotations in the 2D plane, the composition of 3D rotations is usually not commutative. In other words, the order in which the rotations are applied impacts the result. Syntax The amount of rotation created by rotateY() is specified by an <angle>. If positive, the movement will be clockwise; if negative, it will b...
...ise one. Cartesian coordinates on R2 Homogeneous coordinates on RP2 Cartesian coordinates on R3 Homogeneous coordinates on RP3 This transformation applies to the 3D space and can't be represented on the plane. cos(a)0sin(a)010-sin(a)0cos(a) cos(a)0sin(a)00100-sin(a)0cos(a)00001 Examples HTML <div>Normal</div> <div class="rotated">Rotated</div> CSS div { width: 80px; height: 80px; background-color: skyblue; } .rotated { transform: rotateY(60deg); background-color: pink; } Result Specifications Specification Status Comment CSS Transforms Level 2The definition of 'rotateY()' in that specification. Editor's Draft Initial definition ...
rotateZ() - CSS: Cascading Style Sheets
Note: rotateZ(a) is equivalent to rotate(a) or rotate3d(0, 0, 1, a). Note: Unlike rotations in the 2D plane, the composition of 3D rotations is usually not commutative. In other words, the order in which the rotations are applied impacts the result. ...
...ment around the z-axis without deforming it. Its result is a <transform-function> data type. 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 axis of rotation passes through an origin, defined by the transform-origin CSS property. Note: rotateZ(a) is equivalent to rotate(a) or rotate3d(0, 0, 1, a). Note: Unlike rotations in the 2D plane, the composition of 3D rotations is usually not commutative. In other words, the order in which the rotations are applied impacts the result. Syntax The amount of rotation created by rotateZ() is specified by an <angle>. If positive, the movement will be clockwise; if negati...
.... Cartesian coordinates on R2 Homogeneous coordinates on RP2 Cartesian coordinates on R3 Homogeneous coordinates on RP3 This transformation applies to the 3D space and can't be represented on the plane. cos(a)-sin(a)0sin(a)cos(a)0001 cos(a)-sin(a)00 sin(a)cos(a)00 0010 0001 Examples HTML <div>Normal</div> <div class="rotated">Rotated</div> CSS div { width: 80px; height: 80px; background-color: skyblue; } .rotated { transform: rotateZ(45deg); background-color: pink; } Result Specifications Specification Status Comment CSS Transforms Level 2The definition of 'rotateZ()' in that specification. Editor's Draft Initial definition ...
scaleZ() - CSS: Cascading Style Sheets
Its result is a <transform-function> data type. 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 scaling transformation modifies the z-coordinate of each element point by a constant 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). ...
... Cartesian coordinates on R2 Homogeneous coordinates on RP2 Cartesian coordinates on R3 Homogeneous coordinates on RP3 This transformation applies to the 3D space and can't be represented on the plane. ...
... Editor's Draft Initial definition ...
translate3d() - CSS: Cascading Style Sheets
Its result is a <transform-function> data type. 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 transformation is characterized by a three-dimensional vector. Its coordinates define how much the element moves in each direction. Syntax translate3d(tx, ty, tz) Values tx Is a <length> or <percentage> representing the abscissa of the translating vector. ty Is a <length> or <percentage> representing the ordinate of the translating vector. tz Is a <length> representing the z component of the translating vector. ...
...mogeneous coordinates on RP3 This transformation applies to the 3D space and can't be represented on the plane. A translation is not a linear transformation in R3 and can't be represented using a Cartesian-coordinate matrix. ...
...class="moved">Moved</div> <div>Static</div> CSS div { width: 60px; height: 60px; background-color: skyblue; } .moved { /* Equivalent to perspective(500px) translateX(10px) */ transform: perspective(500px) translate3d(10px, 0, 0px); background-color: pink; } Result Combining z-axis and x-axis translation HTML <div>Static</div> <div class="moved">Moved</div> <div>Static</div> CSS div { width: 60px; height: 60px; background-color: skyblue; } .moved { transform: perspective(500px) translate3d(10px, 0, 100px); background-color: pink; } Result Specifications Specification Status Comment CSS Transforms Level 2The definition of 'translate3d()' in that specification. Editor's Draft Initial definition ...
translateZ() - CSS: Cascading Style Sheets
Its result is a <transform-function> data type. 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 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. ...
... a linear transformation in R3 and can't be represented using a Cartesian-coordinate matrix. 10000100001t0001 Examples In this example, two boxes are created. One is positioned normally on the page, without being translated at all. The second is altered by applying perspective to create a 3D space, then moved towards the user. HTML <div>Static</div> <div class="moved">Moved</div> CSS div { position: relative; width: 60px; height: 60px; left: 100px; background-color: skyblue; } .moved { transform: perspective(500px) translateZ(200px); background-color: pink; } What really matters here is the class "moved"; let's take a look at what it does. First, the perspective() function positions the viewer relative to the plane that lies where z=0 (in essence, the surfac...
...eZ() value, such as transform: perspective(200px) translateZ(300px); the transformed element will not be visible as it is further than the user's viewport. The smaller the difference between the perspective and transform values, the closer the user is to the element and the larger the translated element will seem. Result Specifications Specification Status Comment CSS Transforms Level 2The definition of 'transform' in that specification. Editor's Draft Adds 3D transform functions to the CSS Transforms standard. ...
transform-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 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. ...
...u are using. ...
... Editor's Draft Initial definition. ...
transition-delay - 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 delay may be zero, positive, or negative: A value of 0s (or 0ms) will begin the transition effect immediately. A positive value will delay the start of the transition effect for the given length of time. A negative value will begin the transition effect immediately, and partway through the effect. In other words, the effect will be animated as if it had already been running for the given length of time. ...
...e properties. Each delay will be applied to the corresponding property as specified by the transition-property property, which acts as a master list. If there are fewer delays specified than in the master list, the list of delay values will be repeated until there are enough. If there are more delays, the list of delay values will be truncated to match the number of properties. In both cases, the CSS declaration remains valid. Syntax /* <time> values */ transition-delay: 3s; transition-delay: 2s, 4ms; /* Global values */ transition-delay: inherit; transition-delay: initial; transition-delay: unset; Values <time> Denotes the amount of time to wait between a property's value changing and the start of the transition effect. Formal definition Initial value0sApplies toall elements, ::b...
... Working Draft Initial definition ...
transition-duration - CSS: Cascading Style Sheets
The transition-duration CSS property sets the length of time a transition animation should take to complete. By default, the value is 0s, meaning that no animation will occur. 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. You may specify multiple durations; each duration will be applied to the corresponding property as specified by the transition-property property, which acts as a master list. If there are fewer durations specified than in the master list, the user agent repeat the list of durations. If there are more durations, the list is simply truncated to the right size. ...
...d us a pull request. You may specify multiple durations; each duration will be applied to the corresponding property as specified by the transition-property property, which acts as a master list. If there are fewer durations specified than in the master list, the user agent repeat the list of durations. If there are more durations, the list is simply truncated to the right size. In both case the CSS declaration stays valid. Syntax /* <time> values */ transition-duration: 6s; transition-duration: 120ms; transition-duration: 1s, 15s; transition-duration: 10s, 30s, 230ms; /* Global values */ transition-duration: inherit; transition-duration: initial; transition-duration: unset; Values <time> Is a <time> denoting the amount of time the transition from the old value of a property to the ...
... Working Draft Initial definition ...
translate - CSS: Cascading Style Sheets
Web › CSS › translate
This maps better to typical user interface usage, and saves having to remember the exact order of transform functions to specify in the transform value. Syntax /* Keyword values */ translate: none; /* Single values */ translate: 100px; translate: 50%; /* Two values */ translate: 100px 200px; translate: 50% 105px; /* Three values */ translate: 50% 105px 5rem; Values Single <length-percentage> value A <length> or <percentage> that specifies a 2D translation, with the same translation along both the X and Y axes. Equivalent to a translate() (2D translation) function with a single value specified. ...
...elementsInheritednoPercentagesrefer to the size of bounding boxComputed valueas specified, but with relative lengths converted into absolute lengthsAnimation typea transformCreates stacking contextyes Formal syntax none | <length-percentage> [ <length-percentage> <length>? ...
... Editor's Draft Initial definition. Initial valuenoneApplies totransformable elementsInheritednoPercentagesrefer to the size of bounding boxComputed valueas specified, but with relative lengths converted into absolute lengthsAnimation typea transformCreates stacking contextyes ...
unicode-bidi - CSS: Cascading Style Sheets
For example, if a block of content contains both left-to-right and right-to-left text, the user-agent uses a complex Unicode algorithm to decide how to display the text. The unicode-bidi property overrides this algorithm and allows the developer to control the text embedding. The unicode-bidi and direction properties are the only properties that are not affected by the all shorthand. Note: This property is intended for Document Type Definition (DTD) designers. Web designers and similar authors should not override it. ...
...s value allows the display of data that is already formatted using a tool following the Unicode Bidirectional Algorithm. Formal definition Initial valuenormalApplies toall elements, though some values have no effect on non-inline elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax normal | embed | isolate | bidi-override | isolate-override | plaintext Examples CSS .bible-quote { direction: rtl; unicode-bidi: embed; } HTML <div class="bible-quote"> A line of text </div> <div> Another line of text </div> Result Specifications Specification Status Comment CSS Writing Modes Module Level 3The definition of 'unicode-bidi' in that specification. Proposed Recommendation Added plaintext, isolate, and isolate-overr...
...ction: rtl; unicode-bidi: embed; } HTML <div class="bible-quote"> A line of text </div> <div> Another line of text </div> Result Specifications Specification Status Comment CSS Writing Modes Module Level 3The definition of 'unicode-bidi' in that specification. Proposed Recommendation Added plaintext, isolate, and isolate-override keywords. CSS Level 2 (Revision 1)The definition of 'unicode-bidi' in that specification. Recommendation Initial definition. ...
var() - CSS: Cascading Style Sheets
Web › CSS › var
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 var() function cannot be used in property names, selectors or anything else besides property values. (Doing so usually produces invalid syntax, or else a value whose meaning has no connection to the variable.) Syntax The first argument to the function is the name of the custom property to be substituted. An optional second argument to the function serves as a fallback value. ...
...ack, like that of custom properties, allows commas. For example, var(--foo, red, blue) defines a fallback of red, blue; that is, anything between the first comma and the end of the function is considered a fallback value. Values <custom-property-name> A custom property's name represented by an identifier that starts with two dashes. Custom properties are solely for use by authors and users; CSS will never give them a meaning beyond what is presented here. <declaration-value> The custom property's fallback value, 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. Examples :root ...
... Candidate Recommendation Initial definition ...
vertical-align - 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 vertical-align property can be used in two contexts: To vertically align an inline element's box inside its containing line box. ...
... Recommendation Adds the <length> value and allows it to be applied to elements with a display type of ta...
...ottom alignment.</div> <div>An <img class="middle" src="https://udn.realityripple.com/samples/b4/e1f0faff5b.svg" alt="link" width="32" height="32" /> image with a middle alignment.</div> CSS img.top { vertical-align: text-top; } img.bottom { vertical-align: text-bottom; } img.middle { vertical-align: middle; } Result Specifications Specification Status Comment CSS Level 2 (Revision 1)The definition of 'vertical-align' in that specification. Recommendation Adds the <length> value and allows it to be applied to elements with a display type of table-cell. CSS Level 1The definition of 'vertical-align' in that specification. Recommendation Initial definition. ...
widows - CSS: Cascading Style Sheets
Web › CSS › widows
/* <integer> values */ widows: 2; widows: 3; /* Global values */ widows: inherit; widows: initial; widows: unset; In typography, a widow is the last line of a paragraph that appears alone at the top of a page. (The paragraph is continued from a prior page.) Syntax Values <integer> The minimum number of lines that can stay by themselves at the top of a new fragment after a fragmentation break. The value must be positive. ...
... valueas specifiedAnimation typediscrete Formal syntax <integer> Examples Controlling column widows HTML <div> <p>This is the first paragraph containing some text.</p> <p>This is the second paragraph containing some more text than the first one. It is used to demonstrate how widows work.</p> <p>This is the third paragraph. It has a little bit more text than the first one.</p> </div> CSS div { background-color: #8cffa0; columns: 3; widows: 2; } p { background-color: #8ca0ff; } p:first-child { margin-top: 0; } Result Specifications Specification Status Comment CSS Fragmentation Module Level 3The definition of 'widows' in that specification. Candidate Recommendation Extends widows to apply to any type of fragment, including pages...
...fa0; columns: 3; widows: 2; } p { background-color: #8ca0ff; } p:first-child { margin-top: 0; } Result Specifications Specification Status Comment CSS Fragmentation Module Level 3The definition of 'widows' in that specification. Candidate Recommendation Extends widows to apply to any type of fragment, including pages, regions, or columns. CSS Multi-column Layout ModuleThe definition of 'widows' in that specification. Working Draft Recommendations to consider widows in relation to columns. CSS Level 2 (Revision 1)The definition of 'widows' in that specification. Recommendation Initial definition. ...
width - CSS: Cascading Style Sheets
Web › CSS › width
By default, it sets the width of the content area, but if box-sizing is set to border-box, it sets the width of the border area. 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 min-width and max-width properties override width. ...
... Recommendation Precises on which element it applie...
... background: lightblue; width: -moz-min-content; /* Firefox */ width: -webkit-min-content; /* Chrome */ width: min-content; } <p class="minblue">The Mozilla community produces a lot of great software.</p> Specifications Specification Status Comment CSS Box Sizing Module Level 4The definition of 'width' in that specification. Editor's Draft CSS Box Sizing Module Level 3The definition of 'width' in that specification. Working Draft Added the max-content, min-content, fit-content keywords. CSS Level 2 (Revision 1)The definition of 'width' in that specification. Recommendation Precises on which element it applies to. CSS Level 1The definition of 'width' in that specification. Recommendation Initial defin...
will-change - CSS: Cascading Style Sheets
Browsers may set up optimizations before an element is actually changed. These kinds of optimizations can increase the responsiveness of a page by doing potentially expensive work before they are actually required. Important: will-change is intended to be used as a last resort, in order to try to deal with existing performance problems. It should not be used to anticipate performance problems. ...
...e property given is a shorthand, it indicates the expectation for all the longhands the 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 t...
... Candidate Recommendation Initial definition ...
word-break - 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. Syntax /* Keyword values */ word-break: normal; word-break: break-all; word-break: keep-all; word-break: break-word; /* deprecated */ /* Global values */ word-break: inherit; word-break: initial; word-break: unset; The word-break property is specified as a single keyword chosen from the list of values below. Values normal Use the default line break rule. ...
...akatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu ???????????????????????????????????</p> <p>4. ...
...???????????</p> CSS .narrow { padding: 10px; border: 1px solid; width: 500px; margin: 0 auto; font-size: 20px; line-height: 1.5; letter-spacing: 1px; } .normal { word-break: normal; } .breakAll { word-break: break-all; } .keepAll { word-break: keep-all; } .breakWord { word-break: break-word; } Specifications Specification Status Comment CSS Text Module Level 3The definition of 'word-break' in that specification. Working Draft Initial definition ...
z-index - CSS: Cascading Style Sheets
Web › CSS › z-index
Overlapping elements with a larger z-index cover those with a smaller one. 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. For a positioned box (that is, one with any position other than static), the z-index property specifies: The stack level of the box in the current stacking context. Whether the box establishes a local stacking context. ...
...xes of elements outside this element. ...
... Recommendation Initial definition ...
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 t...
...de, 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. ...
CSS pixel - MDN Web Docs Glossary: Definitions of Web-related terms
By definition, this is the physical size of a single pixel at a pixel density of 96 DPI, located an arm's length away from the viewer's eyes. That definition, of course, leaves a lot of wiggle room, as the terms "be comfortably seen" and "an arm's length away" are imprecise, varying from person to person. When a user is sitting at a desk in front of a desktop, the display is generally substantially farther away from their eyes than when they're on a cell phone, for instance. ...
...say that when the unit px is used, the goal is to try to have the distance 96px equal about 1 inch on the screen, regardless of the actual pixel density of the screen. In other words, if the user is on a phone with a pixel density of 266 DPI, and an element is placed on the screen with a width of 96px, the actual width of the element would be 266 device pixels. Learn more Technical reference CSS Values and Units Module, section 5.2: Absolute Lengths Learn about it CSS Length Explained on the MDN Hacks Blog ...
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. ...
...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. 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. ...
Animation inspector example: CSS transitions - Firefox Developer Tools
firefox-logo-animation Example animation using CSS transitions. ...
... firefox-logo-animation Example animation using CSS transitions. ...
CSSConditionRule - Web APIs
An object implementing the CSSConditionRule interface represents a single condition CSS at-rule, which consists of a condition and a statement block. It is a child of CSSGroupingRule. Two objects derive from it : CSSMediaRule and CSSSupportsRule. Syntax The syntax is described using the WebIDL format. interface CSSConditionRule : CSSGroupingRule { attribute DOMString conditionText; } Properties The CSSConditionRule derives from CSSRule, CSSGroupingRule and inherits all properties of these classes. It has one specific property: CSSConditionRule.conditionText Represents the text of the condition of the rule. Methods The CSSConditionRule derives from CSSRule, CSSGroupingRule and inherits all methods of these classes. It has no specific property of its own. Specifications ...
...roupingRule and inherits all properties of these classes. It has one specific property: CSSConditionRule.conditionText Represents the text of the condition of the rule. Methods The CSSConditionRule derives from CSSRule, CSSGroupingRule and inherits all methods of these classes. It has no specific property of its own. Specifications Specification Status Comment CSS Conditional Rules Module Level 3The definition of 'CSSConditionRule' in that specification. Candidate Recommendation Initial definition. ...
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. 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. We then get() the background-image from the stylemap and stringify it: // get the element ...
...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. Working Draft Initial definition. ...
CSSKeywordValue - Web APIs
The CSSKeywordValue interface of the the CSS Typed Object Model API creates an object to represent 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. 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...
...perty 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 Initial definition. ...
CSSNumericValue.max() - Web APIs
The max() method of the CSSNumericValue interface returns the highest value from among the values passed. The passed values must be of the same type. Syntax var cssUnitValue = CSSNumericValue.man(number1 ... numbern); Parameters number Either a Number or a CSSNumericValue. Return value A CSSUnitValue. Exceptions TypeError Indicates that an invalid type was passed to the method. Examples As stated earlier, all passed values must be of the same type and value. Some of the following examples illustrate what happens when they are not. ...
...ericValue.man(number1 ... numbern); Parameters number Either a Number or a CSSNumericValue. Return value A CSSUnitValue. Exceptions TypeError Indicates that an invalid type was passed to the method. Examples As stated earlier, all passed values must be of the same type and value. Some of the following examples illustrate what happens when they are not. // Prints "2cm" console.log(CSS.cm("1").max(CSS.cm("2")).toString()); // Prints "max(1cm, 0.393701in)" console.log(CSS.cm("1").max(CSS.in("0.393701")).toString()); Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'max' in that specification. Working Draft Initial definition. ...
CSSNumericValue.min() - Web APIs
The min() method of the CSSNumericValue interface returns the lowest value from among those values passed. The passed values must be of the same type. Syntax var cssUnitValue = CSSNumericValue.min(number1 ... numbern); Parameters number Either a Number or a CSSNumericValue. Return value A CSSUnitValue. Exceptions TypeError Indicates that an invalid type was passed to the method. Examples As stated earlier, all passed values must be of the same type and value. Some of the following examples illustrate what happens when they are not. ...
...ericValue.min(number1 ... numbern); Parameters number Either a Number or a CSSNumericValue. Return value A CSSUnitValue. Exceptions TypeError Indicates that an invalid type was passed to the method. Examples As stated earlier, all passed values must be of the same type and value. Some of the following examples illustrate what happens when they are not. // Prints "1cm" console.log(CSS.cm("1").min(CSS.cm("2")).toString()); // Prints "max(1cm, 0.393701in)" console.log(CSS.cm("1").max(CSS.in("0.393701")).toString()); Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'min' in that specification. Working Draft Initial definition. ...
CSSOMString - Web APIs
CSSOMString is used to denote string data in CSSOM specifications and can refer to either DOMString or USVString. When a specification says CSSOMString, it depends on the browser vendors to choose whether to use DOMString or USVString. While browser implementations that use UTF-8 internally to represent strings in memory can use USVString when the specification says CSSOMString, implementations that already represent strings as 16-bit sequences might choose to use DOMString instead. ...
...on the browser vendors to choose whether to use DOMString or USVString. While browser implementations that use UTF-8 internally to represent strings in memory can use USVString when the specification says CSSOMString, implementations that already represent strings as 16-bit sequences might choose to use DOMString instead. Implementation differences Browser DOMString or USVString for CSSOMString Firefox (Gecko) USVString Chrome (Blink) USVString Safari (WebKit) USVString Edge (EdgeHTML) - Opera (Blink) USVString Specifications Specification Status Comment CSS Object Model (CSSOM)The definition of 'CSSOMString' in that specification. Working Draft Initial definition. ...
CSSPositionValue - Web APIs
The CSSPositionValue interface of the the CSS Typed Object Model API represents values for properties that take a position, for example object-position. Constructor CSSPositionValue.CSSPositionValue() Creates a new CSSPositionValue object. Properties CSSPositionValue.x Returns the item's position 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. ...
... object. Properties CSSPositionValue.x Returns the item's position 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; ob...
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. this is not CSS_RGBCOLOR). ...
...rface. 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). ...
...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 ...
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. ...
... Obsolete ...
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. 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 st...
... 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 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...
... 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. Working Draft Document Object Model (DOM) Level 2 Style SpecificationThe definiti...
...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. ...
... 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. ...
...ity 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 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. ...
...roperty 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. 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 Statu...
...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 Comment CSS Typed OM Level 1The definition of 'CSSStyleValue' in that specification. Working Draft Initial definition. ...
CSSSupportsRule - Web APIs
The CSSSupportsRule interface describes an object representing a single CSS @supports at-rule. It implements the CSSConditionRule interface, and therefore the CSSRule and CSSGroupingRule interfaces with a type value of 12 (CSSRule.SUPPORTS_RULE). Syntax The syntax is described using the WebIDL format. interface CSSSupportsRule : CSSConditionRule { } Properties As a CSSConditionRule and therefore a CSSRule and a CSSGroupingRule, CSSSupportsRule also implements the properties of these interfaces. It has no specific properties. Methods As a CSSConditionRule and therefore a CSSRuleand a CSSGroupingRule, CSSSupportsRule also implements the methods of that interface. It has no specific methods. ...
...nditionRule and therefore a CSSRule and a CSSGroupingRule, CSSSupportsRule also implements the properties of these interfaces. It has no specific properties. Methods As a CSSConditionRule and therefore a CSSRuleand a CSSGroupingRule, CSSSupportsRule also implements the methods of that interface. It has no specific methods. Specification Specification Status Comment CSS Conditional Rules Module Level 3The definition of 'CSSSupportsRule' in that specification. Candidate Recommendation Initial definition ...
CSSUnitValue - Web APIs
The CSSUnitValue interface of the CSS Typed Object Model API represents values that contain a single unit type. For example, "42px" would be represented by a CSSNumericValue. Constructor CSSStyleValue.CSSUnitValue() Creates a new CSSUnitValue object. 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. ...
...structor CSSStyleValue.CSSUnitValue() Creates a new CSSUnitValue object. 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. let pos = new CSSPositionValue( new CSSUnitValue(5, "px"), new CSSUnitValue(10, "px")); Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'CSSUnitValue' in that specification. Working Draft Initial definition. ...
CSSUnparsedValue.forEach() - Web APIs
The CSSUnparsedValue.forEach() method executes a provided function once for each element of the CSSUnparsedValue. Syntax CSSUnparsedValue.forEach(function callback(currentValue[, index[, array]]) { // your iterator }[, thisArg]); Parameters callback The function to execute for each element, taking three arguments: currentValue The value of the current element being processed. indexOptional The index of the current element being processed. arrayOptional The CSSUnparsedValue that forEach() is being called on. thisArg Optional Value to use as this (i.e the reference Object) when executing callback. Return value undefined. ...
...entValue The value of the current element being processed. indexOptional The index of the current element being processed. arrayOptional The CSSUnparsedValue that forEach() is being called on. thisArg Optional Value to use as this (i.e the reference Object) when executing callback. Return value undefined. Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'forEach()' in that specification. Working Draft Initial definition. ...
CSSValue - Web APIs
Web › API › CSSValue
The CSSValue interface represents the current computed value of a CSS property. Properties CSSValue.cssText A DOMString representing the current value. CSSValue.cssValueTypeRead only An unsigned short representing a code defining the type of the value. Possible values are: Constant Description CSS_CUSTOM The value is a custom value. CSS_INHERIT The value is inherited and the cssText contains "inherit". CSS_PRIMITIVE_VALUE The value 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. ...
...Constant Description CSS_CUSTOM The value is a custom value. CSS_INHERIT The value is inherited and the cssText contains "inherit". CSS_PRIMITIVE_VALUE The value 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. Specifications Specification Status Comment Document Object Model (DOM) Level 2 Style SpecificationThe definition of 'CSSValue' in that specification. Obsolete Ini...
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. ...
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. ...
...le 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 (CSSOM)The definition of 'HTMLOrForeignElement' in that specification. Working Draft Initial definition. ...
-moz-float-edge - CSS: Cascading Style Sheets
/* Keyword values */ -moz-float-edge: border-box; -moz-float-edge: content-box; -moz-float-edge: margin-box; -moz-float-edge: padding-box; /* Global values */ -moz-float-edge: inherit; -moz-float-edge: initial; -moz-float-edge: unset; Syntax Values border-box The height and width properties include the content, padding and border but not the margin. content-box The height and width properties include the content, but not the padding, border or margin. margin-box The height and width properties include the content, padding, border and margin. ...
... The height and width properties include the content and padding but not the border or margin. Formal definition Initial valuecontent-boxApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax border-box | content-box | margin-box | padding-box Examples HTML <div class="box"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> </div> CSS .box { display: block; height: 5px; margin: 0.5em auto 0.5em auto; color: gray; -moz-float-edge: margin-box; box-sizing: border-box; } Result Specifications Not part of any standard. ...
-moz-force-broken-image-icon - CSS: Cascading Style Sheets
The -moz-force-broken-image-icon extended CSS property can be used to force the broken image icon to be shown even when a broken image has an alt attribute. Syntax Values <integer> A value of 1 means that the broken image icon is shown even if the image has an alt attribute. When the value 0 is used the image will act as usual and only display the alt attribute. Note: Even if the value is set to 1 the alt attribute will still be displayed, alongside the broken image icon. ...
... is used the image will act as usual and only display the alt attribute. Note: Even if the value is set to 1 the alt attribute will still be displayed, alongside the broken image icon. Formal definition Initial value0Applies toimagesInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <integer> Examples HTML <img src='/broken/image/link.png' alt='Broken image link'> CSS img { -moz-force-broken-image-icon: 1; height: 100px; width: 100px; } Result ScreenshotLive sample Note: Unless the image has a specified height and width the broken image icon will not be displayed but the alt attribute will also be hidden if -moz-force-broken-image-icon is set to 1. Notes This property will only work in Gecko-based browsers. The use of this property is not recomm...
-moz-orient - CSS: Cascading Style Sheets
Syntax The -moz-orient property is specified as one of the keyword values chosen from the list below. Values inline The element is rendered in the same direction as the axis of the text: horizontally for horizontal writing modes, vertically for vertical writing modes. block The element is rendered orthogonally to the axis of the text: vertically for horizontal writing modes, horizontal for vertical writing modes. horizontal The element is rendered horizontally. vertical The element is rendered vertically. ...
...Though submitted to the W3C, with positive initial feedback, this property is not yet part of any specification; currently, this is a Mozilla-specific extension (that is, -moz-orient). ...
-moz-outline-radius - CSS: Cascading Style Sheets
In Mozilla applications like Firefox, the -moz-outline-radius CSS shorthand property can be used to give an element's outline rounded corners. /* One value */ -moz-outline-radius: 25px; /* Two values */ -moz-outline-radius: 25px 1em; /* Three values */ -moz-outline-radius: 25px 1em 12%; /* Four values */ -moz-outline-radius: 25px 1em 12% 4mm; /* Global values */ -moz-outline-radius: inherit; -moz-outline-radius: initial; -moz-outline-radius: unset; Constituent properties This property is a shorthand for the following CSS properties: -moz-outline-radius-bottomleft -moz-outline-radius-bottomright -moz-outline-radius-topleft -moz-outline-radius-topright Syntax Values Elliptical outlines and <percentage> values follow the syntax described in border-radius. One, two, ...
...gth, percentage or calc();-moz-outline-radius-bottomleft: a length, percentage or calc(); Formal syntax <outline-radius>{1,4} [ / <outline-radius>{1,4} ]?where <outline-radius> = <length> | <percentage> Examples Rounding an outline Note: This example will not display the desired effect if you are viewing this in a browser other than Firefox. HTML <p>This element has a rounded outline!</p> CSS p { margin: 5px; border: 1px solid black; outline: dotted red; -moz-outline-radius: 12% 1em 25px; } Result Notes dotted or dashed radiused corners were rendered as solid until Firefox 50, bug 382721 Future versions of Gecko/Firefox may drop this property completely. See bug 593717. Specifications Not part of any standard. ...
-webkit-border-before - CSS: Cascading Style Sheets
/* 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. ...
... ...
-webkit-print-color-adjust - CSS: Cascading Style Sheets
/* Keyword values */ -webkit-print-color-adjust: economy; -webkit-print-color-adjust: exact; /* Global values */ -webkit-print-color-adjust: inherit; -webkit-print-color-adjust: initial; -webkit-print-color-adjust: unset; Syntax The -webkit-print-color-adjust property is specified as one of the keyword values listed below. Values economy Normal behavior. Background colors and images are only printed if the user explicitly allows it in their browser's print settings dialog. ...
... ...
-webkit-touch-callout - CSS: Cascading Style Sheets
When a target is touched and held on iOS, Safari displays a callout information about the link. This property allows disabling that behavior. /* Keyword values */ -webkit-touch-callout: default; -webkit-touch-callout: none; /* Global values */ -webkit-touch-callout: initial; -webkit-touch-callout: inherit; -webkit-touch-callout: unset; Syntax Values default The default callout is displayed. none The callout is disabled. ...
... ...
:-moz-focusring - CSS: Cascading Style Sheets
If :-moz-focusring matches, then :focus also matches, but the converse is not always true: it depends on whether the user agent has focus ring drawing enabled and how the element was focused. Whether the user agent has focus ring drawing enabled can depend on operating system settings and other factors, so the precise behavior of this pseudo-class will vary from platform to platform. This feature 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. ...
...g 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-locale-dir(ltr) - CSS: Cascading Style Sheets
This is determined by the preference intl.uidirection.locale (where locale is the current locale) being set to "ltr". Note: This selector is mainly used by extensions and themes to adapt the user interface based on the user's locale. (This can vary from window to window, and even from tab to tab.) It also allows extensions to work even when they don't support the user's default locale, since they can support both left-to-right and right-to-left layouts regardless of locale specifics. ...
... matches, regardless of whether the UI locale is left-to-right or right-to-left. Syntax :-moz-locale-dir(ltr) Examples This example doesn't work if you're not using Firefox, and may not work even in Firefox due to an issue with the selector not working propertly with HTML content. It was designed for use with XUL. HTML <p>If you're using a left-to-right interface, this should be red.</p> CSS p:-moz-locale-dir(ltr) { color: red; } Result Specifications Not part of any standard. ...
:-moz-locale-dir(rtl) - CSS: Cascading Style Sheets
This is determined by the preference intl.uidirection.locale (where locale is the current locale) being set to "rtl". Note: This selector is mainly used by extensions and themes to adapt the user interface based on the user's locale. (This can vary from window to window, and even from tab to tab.) It also allows extensions to work even when they don't support the user's default locale, since they can support both left-to-right and right-to-left layouts regardless of locale specifics. ...
... ...
:-moz-only-whitespace - CSS: Cascading Style Sheets
Note: In Selectors Level 4 the :empty selector was changed to act like :-moz-only-whitespace, but no browser currently supports this yet. The :-moz-only-whitespace CSS pseudo-class matches elements that only contains text nodes that only contain whitespace. ...
...In Selectors Level 4 the :empty selector was changed to act like :-moz-only-whitespace, but no browser currently supports this yet. The :-moz-only-whitespace CSS pseudo-class matches elements that only contains text nodes that only contain whitespace. ...
:-moz-window-inactive - CSS: Cascading Style Sheets
The :-moz-window-inactive CSS pseudo-class is a Mozilla extension that matches any element while it's in an inactive window. :-moz-window-inactive works in content HTML documents, too. Note: Prior to the addition of this pseudo-class, giving different styles to background windows was achieved by setting an attribute (active="true") on the top-level XUL chrome window. This attribute is no longer used. Syntax :-moz-window-inactive Examples This example alters the appearance of a box's background depending on whether its window is active or not. ...
...ion of this pseudo-class, giving different styles to background windows was achieved by setting an attribute (active="true") on the top-level XUL chrome window. This attribute is no longer used. Syntax :-moz-window-inactive Examples This example alters the appearance of a box's background depending on whether its window is active or not. HTML <div id="mybox"> <p>This is a box!</p> </div> CSS #mybox { background: linear-gradient(to bottom, yellow, cyan); width: 200px; height: 200px; } #mybox:-moz-window-inactive { background: cyan; } Result The result of this code is shown below. You can view this as a separate page as well. Specifications Not part of any standard. ...
::-moz-focus-inner - CSS: Cascading Style Sheets
The ::-moz-focus-inner CSS pseudo-element is a Mozilla extension that represents an inner focus ring of the <button> element as well as the button, submit, reset, and color types of the <input> element. Note: Using ::-moz-focus-inner with anything than the buttons that support it doesn't match anything and has no effect. ...
... extension that represents an inner focus ring of the <button> element as well as the button, submit, reset, and color types of the <input> element. Note: Using ::-moz-focus-inner with anything than the buttons that support it doesn't match anything and has no effect. Syntax Syntax not found in DB! Examples HTML <input type="submit" value="Input"/> <button type="submit">Button</button> CSS button::-moz-focus-inner, input[type="color"]::-moz-focus-inner, input[type="reset"]::-moz-focus-inner, input[type="button"]::-moz-focus-inner, input[type="submit"]::-moz-focus-inner { padding-block-start: 0px; padding-inline-end: 2px; padding-block-end: 0px; padding-inline-start: 2px; border: 1px dotted red; } Result Specifications Not part of any standard. ...
::-webkit-file-upload-button - CSS: Cascading Style Sheets
The screenshot to the left shows what the button will look like if you are without access to Chrome, Opera or Safari. ...
...The screenshot to the left shows what the button will look like if you are without access to Chrome, Opera or Safari. ScreenshotLive sample Specifications Not part of any standard. ...
::-webkit-meter-bar - CSS: Cascading Style Sheets
The ::-webkit-meter-bar CSS pseudo-class is a WebKit extension that represents the meter bar in a <meter> element. Syntax ::-webkit-meter-bar Specifications Not part of any standard. ...
... The ::-webkit-meter-bar CSS pseudo-class is a WebKit extension that represents the meter bar in a <meter> element. Syntax ::-webkit-meter-bar Specifications Not part of any standard. ...
::-webkit-meter-inner-element - CSS: Cascading Style Sheets
::-webkit-meter-inner-element is a proprietary WebKit CSS pseudo-element for selecting and applying styles to to the outer containing element of a <meter> element. 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. ...
...styles to to the outer containing element of a <meter> element. Additional markup to render the meter element as read-only. Syntax ::-webkit-meter-inner-element Specifications Not part of any standard. ...
::-webkit-meter-optimum-value - CSS: Cascading Style Sheets
The ::-webkit-meter-optimum-value CSS pseudo-element styles the <meter> element when its value is inside the low-high range. 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. ...
... The ::-webkit-meter-optimum-value CSS pseudo-element styles the <meter> element when its value is inside the low-high range. 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-progress-bar - CSS: Cascading Style Sheets
The ::-webkit-progress-bar CSS pseudo-element represents the entire bar of a <progress> element. Normally it's only visible as the unfilled portion of the bar, since by default it's rendered below the ::-webkit-progress-value pseudo-element. It is a child of the ::-webkit-progress-inner-element pseudo-element and the parent of the ::-webkit-progress-value pseudo-element. Note: For ::-webkit-progress-value to take effect, appearance needs to be set to none on the <progress> element. ...
...filled portion of the bar, since by default it's rendered below the ::-webkit-progress-value pseudo-element. It is a child of the ::-webkit-progress-inner-element pseudo-element and the parent of the ::-webkit-progress-value pseudo-element. Note: For ::-webkit-progress-value to take effect, appearance needs to be set to none on the <progress> element. Syntax ::-webkit-progress-bar Examples CSS content progress { -webkit-appearance: none; } ::-webkit-progress-bar { background-color: orange; } HTML content <progress value="10" max="50"> Result Result screenshot If you're not using a WebKit or Blink browser, the code above results in a progress bar that looks like this: Specifications Not part of any standard. ...
::-webkit-progress-inner-element - CSS: Cascading Style Sheets
The ::-webkit-progress-inner-element CSS pseudo-element represents the outermost container of the <progress> element. It is the parent of the ::-webkit-progress-bar pseudo-element. Note: In order to let ::-webkit-progress-value take effect, -webkit-appearance needs to be set to none on the <progress> element. Syntax ::-webkit-progress-inner-element Examples These examples work only on Blink and WebKit. Adding a black border around the progress bar In this example, a 2px black border is added around the progress bar. ...
...-element. Note: In order to let ::-webkit-progress-value take effect, -webkit-appearance needs to be set to none on the <progress> element. Syntax ::-webkit-progress-inner-element Examples These examples work only on Blink and WebKit. Adding a black border around the progress bar In this example, a 2px black border is added around the progress bar. HTML <progress value="10" max="50"> CSS progress { -webkit-appearance: none; } ::-webkit-progress-inner-element { border: 2px solid black; } Result Result screenshot If you're not using a Blink or WebKit browsear, the above code resuls in a progress bar looking like this: Specifications Not part of any standard. ...
::backdrop - CSS: Cascading Style Sheets
This includes both elements which have been placed in full-screen mode using the Fullscreen API and <dialog> elements. When multiple elements have been placed into full-screen mode, the backdrop is drawn immediately beneath the frontmost such element, and on top of the older full-screen elements. ...
...p style used when a video is shifted to full-screen mode is configured to be a grey-blue color rather than the black it defaults to in most browsers. 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. Normally that area is black, but its appearance has been altered by the CSS above. You can see this example in action or view or remix the code on Glitch. Specifications Specification Status Comment Fullscreen APIThe definition of '::backdrop' in that specification. Living Standard Initial definition. ...
::cue-region - CSS: Cascading Style Sheets
The ::cue-region CSS pseudo-element matches WebVTT cues within a selected element. This can be used to style captions and other cues in media with VTT tracks. ::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. ...
...roperties 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. ...
::marker - CSS: Cascading Style Sheets
Web › CSS › ::marker
The ::marker CSS pseudo-element selects the marker box of a list item, which typically contains a bullet or number. It works on any element or pseudo-element set to display: list-item, such as the <li> and <summary> elements. ::marker { color: blue; font-size: 1.2em; } Allowable properties Only certain CSS properties can be used in a rule with ::marker as a selector: All font properties The white-space property color text-combine-upright, unicode-bidi and direction properties The content property All animation and transition properties The specification states that additional CSS properties may be supported in future. ...
...e with ::marker as a selector: All font properties The white-space property color text-combine-upright, unicode-bidi and direction properties The content property All animation and transition properties The specification states that additional CSS properties may be supported in future. Syntax ::marker Examples HTML <ul> <li>Peaches</li> <li>Apples</li> <li>Plums</li> </ul> CSS ul li::marker { color: red; font-size: 1.5em; } Result Specifications Specification Status Comment CSS Pseudo-Elements Level 4The definition of '::marker' in that specification. Working Draft No significant change. CSS Lists Module Level 3The definition of '::marker' in that specification. Working Draft Initial definition. ...
::placeholder - CSS: Cascading Style Sheets
Note: In most browsers, the appearance of placeholder text is a translucent or light gray color by default. Syntax ::placeholder Accessibility concerns Color contrast Contrast Ratio Placeholder text typically has a lighter color treatment to indicate that it is a suggestion for what kind of input will be valid, and is not actual input of any kind. ...
...t a replacement for the <label> element. Without a label that has been 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 def...
:any-link - CSS: Cascading Style Sheets
Web › CSS › :any-link
The :any-link CSS pseudo-class selector represents an element that acts as the source anchor of a hyperlink, independent of whether it has been visited. In other words, it matches every <a>, <area>, or <link> element that has an href attribute. Thus, it matches all elements that match :link or :visited. ...
... 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. ...
:default - CSS: Cascading Style Sheets
Web › CSS › :default
What this selector matches is defined in HTML Standard ?4.16.3 Pseudo-classes -- it may match the <button>, <input type="checkbox">, <input type="radio">, and <option> elements: A default option element is the first one with the selected attribute, or the first enabled option in DOM order. multiple <select>s can have more than one selected option, so all will match :default. <input type="checkbox"> and <input type="radio"> match if they have the checked attribute. <button> matches if it is a <form>'s default submission button: the first <button> in DOM order that belongs to the form. This also applies to <input> types that submit forms, like image or submit. ...
... Living Standard No change. HTML5The definition of ':default' in that specification. Recommendation Defines associated HTML sem...
:defined - CSS: Cascading Style Sheets
Web › CSS › :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). ...
... let divElem = document.createElement('div'); divElem.textContent = this.getAttribute('text'); let shadowRoot = this.attachShadow({mode: 'open'}) .appendChild(divElem); } }) Then insert a copy of this element into the 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...
:disabled - CSS: Cascading Style Sheets
Web › CSS › :disabled
An element is disabled if it can't be activated (selected, clicked on, typed into, etc.) or accept focus. The element also has an enabled state, in which it can be activated or accept focus. /* Selects any disabled <input> */ input:disabled { background: #ccc; } Syntax :disabled Examples This example shows a basic shipping form. It uses the JavaScript change event to let the user enable/disable the billing fields. ...
...eldset> <br> <fieldset id="billing"> <legend>Billing address</legend> <label for="billing-checkbox">Same as shipping address:</label> <input type="checkbox" id="billing-checkbox" checked> <br> <input type="text" placeholder="Name" disabled> <input type="text" placeholder="Address" disabled> <input type="text" placeholder="Zip Code" disabled> </fieldset> </form> CSS input[type="text"]:disabled { background: #ccc; } JavaScript // Wait for the page to finish loading document.addEventListener('DOMContentLoaded', function () { // Attach `change` event listener to checkbox document.getElementById('billing-checkbox').onchange = toggleBilling; }, false); function toggleBilling() { // Select the billing text fields var billingItems = document.querySel...
:empty - CSS: Cascading Style Sheets
Web › CSS › :empty
Note: In Selectors Level 4 the :empty pseudo-class was changed to act like :-moz-only-whitespace, but no browser currently supports this yet. /* Selects any <div> that contains no content */ div:empty { background: lime; } Syntax :empty Examples HTML <div class="box"><!-- I will be lime. --></div> <div class="box">I will be pink.</div> <div class="box"> <!-- I will be pink in older browsers because of the whitespace around this comment. ...
...ound: lime; } Syntax :empty Examples HTML <div class="box"><!-- I will be lime. --></div> <div class="box">I will be pink.</div> <div class="box"> <!-- I will be pink in older browsers because of the whitespace around this comment. --> </div> <div class="box"> <p><!-- I will be pink in all browsers because of the non-collapsible whitespace and elements around this comment. --></p> </div> CSS body { display: flex; justify-content: space-around; } .box { background: pink; height: 80px; width: 80px; } .box:empty { background: lime; } Result Accessibility concerns Assistive technology such as screen readers cannot parse interactive content that is empty. All interactive content must have an accessible name, which is created by providing a text value for the interact...
:enabled - CSS: Cascading Style Sheets
Web › CSS › :enabled
An element is enabled if it can be activated (selected, clicked on, typed into, etc.) or accept focus. The element also has a disabled state, in which it can't be activated or accept focus. /* Selects any enabled <input> */ input:enabled { color: blue; } Syntax :enabled Examples The following example makes the color of text and button <input>s green when enabled, and gray when disabled. This helps the user understand which elements can be interacted with. ...
...helps the user understand which elements can be interacted with. HTML <form action="url_of_form"> <label for="FirstField">First field (enabled):</label> <input type="text" id="FirstField" value="Lorem"><br> <label for="SecondField">Second field (disabled):</label> <input type="text" id="SecondField" value="Ipsum" disabled="disabled"><br> <input type="button" value="Submit"> </form> CSS input:enabled { color: #2b2; } input:disabled { color: #aaa; } Result Specifications Specification Status Comment HTML Living StandardThe definition of ':enabled' in that specification. Living Standard No change. HTML5The definition of ':enabled' in that specification. Recommendation Defines the semantics for HTML and forms. Se...
:focus-within - CSS: Cascading Style Sheets
In other words, it represents an element that is itself matched by the :focus pseudo-class or has a descendant that is matched 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. ...
... 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; } input { margin: 4px; } Result Specifications Specification Status Comment Selectors Level 4The definition of ':focus-within' in that specification. Working Draft Initial definition. ...
:has() - CSS: Cascading Style Sheets
Web › CSS › :has
The :has() CSS pseudo-class represents an element if any of the selectors passed as parameters (relative to the :scope of the given element) match at least one element. /* Selects any <a>, as long as it has an <img> element directly inside it */ /* Note that this is not supported in any browser yet */ let test = document.querySelector('a:has(> img)'); Syntax :has( <relative-selector-list> )where <relative-selector-list> = <relative-selector>#where <relative-selector> = <combinator>? <complex-selector>where <combinator> = '>' | '+' | '~' | [ '|' ]<complex-selector> = <compound-selector> [ <combinator>? <compound-selector> ]*where <compound-selector> = [ <type-selector>? <subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!where <type-selector> = <wq-name> | <ns-p...
... | '*' ]? | <id-selector> = <hash-token><class-selector> = '.' <ident-token><attribute-selector> = '[' <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> elem...
:in-range - CSS: Cascading Style Sheets
Web › CSS › :in-range
/* Selects any <input>, but only when it has a range specified, and its value is inside that range */ input:in-range { background-color: rgba(0, 255, 0, 0.25); } This pseudo-class is useful for giving the user a visual indication that a field's current value is within the permitted limits. Note: This pseudo-class only applies to elements that have (and can take) a range limitation. In the 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. ...
...mitation. In the 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. ...
:invalid - CSS: Cascading Style Sheets
Web › CSS › :invalid
The :invalid CSS pseudo-class represents any <input> or other <form> element whose contents fail to validate. /* Selects any invalid <input> */ input:invalid { background-color: pink; } This pseudo-class is useful for highlighting field errors for the user. Syntax :invalid Examples This example presents a simple form that colors elements green when they validate and red when they don't. ...
...xamples This example presents a simple form that colors elements green when they validate and red when they don't. ...
:left - CSS: Cascading Style Sheets
Web › CSS › :left
/* Selects any left-hand pages when printing */ @page :left { margin: 2in 3in; } Whether a given page is "left" or "right" is determined by the major writing direction of the document. For example, if the first page has a major writing direction of left-to-right then it will be a :right page; if it has a major writing direction of right-to-left then it will be a :left page. Note: This pseudo-class can be used to change only the margin, padding, border, and background properties of the page box. All other properties will be ignored, and only the page box, not the document content on the page, will be affected. ...
...do-class can be used to change only the margin, padding, border, and background properties of the page box. All other properties will be ignored, and only the page box, not the document content on the page, will be affected. Syntax :left Examples Setting a margin for left-hand pages @page :left { margin: 2in 3in; } Specifications Specification Status Comment CSS Paged Media Module Level 3The definition of ':left' in that specification. Working Draft No change. CSS Level 2 (Revision 1)The definition of ':left' in that specification. Recommendation Initial definition. ...
:not() - CSS: Cascading Style Sheets
Web › CSS › :not
Since it prevents specific items from being selected, it is known as the negation pseudo-class. /* Selects any element that is NOT a paragraph */ :not(p) { color: blue; } The :not() pseudo-class has a number of quirks, tricks, and unexpected results that you should be aware of before using it. Syntax The :not() pseudo-class requires a comma-separated list of one or more selectors as its argument. The list must not contain another negation selector or a pseudo-element. The ability to list more than one selector is experimental and not yet widely supported. ...
...anything that isn't .foo, including <html> and <body>. This selector only applies to one element; you cannot use it to exclude all ancestors. For instance, body :not(table) a will still apply to links inside of a table, since <tr> will match with the :not() part of the selector. ...
:nth-child() - CSS: Cascading Style Sheets
/* Selects the second <li> element in a list */ li:nth-child(2) { color: lime; } /* Selects every fourth element among any group of siblings */ :nth-child(4n) { color: lime; } Syntax The nth-child pseudo-class is specified with a single argument that describes a pattern for matching element indices in a list of siblings. Element indices are 1-based. Keyword values odd Represents elements whose numeric position in a series of siblings is odd: 1, 3, 5, etc. even Represents elements whose numeric position in a series of siblings is even: 2, 4, 6, etc. ...
...>&lt;em&gt;</code>, not a <code>&lt;span&gt;</code>, and <code>nth-of-type</code> only selects children of that type. ...
:nth-last-of-type() - CSS: Cascading Style Sheets
/* Selects every fourth <p> element among any group of siblings, counting backwards from the last one */ p:nth-last-of-type(4n) { color: lime; } Note: This pseudo-class is essentially the same as :nth-of-type, except it counts items backwards from the end, not forwards from the beginning. Syntax The nth-last-of-type pseudo-class is specified with a single argument, which represents the pattern for matching elements, counting from the end. See :nth-last-child for a more detailed explanation of its syntax. ...
...:nth-last-child for a more detailed explanation of its syntax. Formal syntax :nth-last-of-type( <nth> )where <nth> = <an-plus-b> | even | odd Examples HTML <div> <span>This is a span.</span> <span>This is another span.</span> <em>This is emphasized.</em> <span>Wow, this span gets limed!!!</span> <strike>This is struck through.</strike> <span>Here is one last span.</span> </div> CSS span:nth-last-of-type(2) { background-color: lime; } Result Specifications Specification Status Comment Selectors Level 4The definition of ':nth-last-of-type' in that specification. Working Draft Matching elements are not required to have a parent. Selectors Level 3The definition of ':nth-last-of-type' in that specification. Recommendation ...
:nth-of-type() - CSS: Cascading Style Sheets
The :nth-of-type() CSS pseudo-class matches elements of a given type (tag name), based on their position among a group of siblings. /* Selects every fourth <p> element among any group of siblings */ p:nth-of-type(4n) { color: lime; } Syntax The nth-of-type pseudo-class is specified with a single argument, which represents the pattern for matching elements. See :nth-child for a more detailed explanation of its syntax. ...
...or matching elements. See :nth-child for a more detailed explanation of its syntax. ...
:only-of-type - CSS: Cascading Style Sheets
The :only-of-type CSS pseudo-class represents an element that has no siblings of the same type. /* Selects each <p>, but only if it is the */ /* only <p> element inside its parent */ p:only-of-type { background-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 :only-of-type Examples Styling elements with no siblings of the same type HTML <main> <div>I am `div` #1.</div> <p>I am the only `p` among my siblings.</p> <div>I am `div` #2.</div> <div>I am `div` #3. ...
...nt. Beginning with Selectors Level 4, this is no longer required. Syntax :only-of-type Examples Styling elements with no siblings of the same type HTML <main> <div>I am `div` #1.</div> <p>I am the only `p` among my siblings.</p> <div>I am `div` #2.</div> <div>I am `div` #3. <i>I am the only `i` child.</i> <em>I am `em` #1.</em> <em>I am `em` #2.</em> </div> </main> CSS main :only-of-type { color: red; } Result Specifications Specification Status Comment Selectors Level 4The definition of ':only-of-type' in that specification. Working Draft Matching elements are not required to have a parent. Selectors Level 3The definition of ':only-of-type' in that specification. Recommendation Initial definition. ...
:out-of-range - CSS: Cascading Style Sheets
/* Selects any <input>, but only when it has a range specified, and its value is outside that range */ input:out-of-range { background-color: rgba(255, 0, 0, 0.25); } This pseudo-class is useful for giving the user a visual indication that a field's current value is outside the permitted limits. Note: This pseudo-class only applies to elements that have (and can take) a range limitation. ...
...the absence of such 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 ...
:right - CSS: Cascading Style Sheets
Web › CSS › :right
/* Selects any right-hand pages when printing */ @page :right { margin: 2in 3in; } Whether a given page is "left" or "right" is determined by the major writing direction of the document. For example, if the first page has a major writing direction of left-to-right then it will be a :right page; if it has a major writing direction of right-to-left then it will be a :left page. Note: This pseudo-class can be used to change only the margin, padding, border, and background properties of the page box. All other properties will be ignored, and only the page box, not the document content on the page, will be affected. ...
...-class can be used to change only the margin, padding, border, and background properties of the page box. All other properties will be ignored, and only the page box, not the document content on the page, will be affected. Syntax :right Examples Setting margins for right-hand pages @page :right { margin: 2in 3in; } Specifications Specification Status Comment CSS Paged Media Module Level 3The definition of ':right' in that specification. Working Draft No change. CSS Level 2 (Revision 1)The definition of ':right' in that specification. Recommendation Initial definition. ...
:valid - CSS: Cascading Style Sheets
Web › CSS › :valid
This allows to easily make valid fields adopt an appearance that helps the user confirm that their data is formatted properly. /* Selects any valid <input> */ input:valid { background-color: powderblue; } This pseudo-class is useful for highlighting correct fields for the user. ...
...We t...
additive-symbols - CSS: Cascading Style Sheets
Candidate Recommendation Initial definition. ...
... Candidate Recommendation Initial definition. ...
negative - CSS: Cascading Style Sheets
Candidate Recommendation Initial definition. ...
... Candidate Recommendation Initial definition. ...
pad - CSS: Cascading Style Sheets
Candidate Recommendation Initial definition ...
... Candidate Recommendation Initial definition ...
prefix - CSS: Cascading Style Sheets
Candidate Recommendation Initial definition. ...
... Candidate Recommendation Initial definition. ...
suffix - CSS: Cascading Style Sheets
Candidate Recommendation Initial definition. ...
... Candidate Recommendation Initial definition. ...
@counter-style - CSS: Cascading Style Sheets
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. ...
... Candidate Recommendation Initial definition. ...
font-variation-settings - CSS: Cascading Style Sheets
Syntax /* Use the default settings */ font-variation-settings: normal; /* Set values for OpenType axis names */ font-variation-settings: "xhgt" 0.7; Values normal Text is laid out using default settings. <string> <number> When rendering text, the list of OpenType axis names is passed to the text layout engine to enable or disable font features. Each setting is always a <string> of 4 ASCII characters, followed by a <number> indicating the axis value. If the <string> has more or fewer characters or contains characters outside the U+20 - U+7E codepoint range, the whole property is invalid. ...
... Working Draft Initial definition ...
-moz-device-pixel-ratio - CSS: Cascading Style Sheets
The -moz-device-pixel-ratio Gecko-only CSS media feature can be used to apply styles based on the number of device pixels per CSS pixel. 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. Media: media/visual Accepts min/max prefixes: yes Examples Basic compatibility example -moz-device-pixel-ratio may be used for compat...
...o for compatibility with WebKit-based browsers that do not support dppx. Example: @media (-webkit-min-device-pixel-ratio: 2), /* Webkit-based browsers */ (min--moz-device-pixel-ratio: 2), /* Older Firefox browsers (prior to Firefox 16) */ (min-resolution: 2dppx), /* The standard way */ (min-resolution: 192dpi) /* dppx fallback */ Note: See this CSSWG article for compatibility good practices regarding resolution and dppx. Specifications Not part of any standard. ...
-webkit-transform-3d - CSS: Cascading Style Sheets
The -webkit-transform-3d Boolean CSS media feature is a Chrome extension whose value is true if vendor-prefixed CSS 3D transforms are supported. Note: This media feature is only supported by WebKit and Blink. If possible, use an @supports feature 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 Specificati...
... Non-standard unofficial documentation Initial documentation ...
-webkit-transition - CSS: Cascading Style Sheets
The -webkit-transition Boolean CSS media feature is a Chrome extension whose value is true if the browsing context supports CSS transitions. It was never supported in browsers not based on WebKit or Blink. Apple has a description in Safari CSS Reference; this is now called simply transition there. Note: You should not use this media feature; it was never specified, has never been widely implemented, and has been removed from all browsers. Use an @supports feature query instead. Syntax @media (-webkit-transition) { /* CSS to use if transitions are supported */ } Examples Use @supports instead Do not use the -webkit-transition media feature. ...
...: You should not use this media feature; it was never specified, has never been widely implemented, and has been removed from all browsers. Use an @supports feature query instead. Syntax @media (-webkit-transition) { /* CSS to use if transitions are supported */ } Examples Use @supports instead Do not use the -webkit-transition media feature. Instead, test for transition support using the CSS @supports at-rule, like this: @supports (transition: initial) { /* CSS to use if transitions are supported */ } Obsolete example Before this became obsolete, you could use -webkit-transition in your CSS like this: @media (-webkit-transition) { /* CSS to use if transitions are supported */ } Specifications Not part of any standard. ...
any-pointer - CSS: Cascading Style Sheets
Note: If you want to test the accuracy of the primary pointing device, use pointer instead. Syntax The any-pointer feature is specified as a keyword value chosen from the list below. none No pointing device is available. coarse At least one input mechanism includes a pointing device of limited accuracy. fine At least one input mechanism includes an accurate pointing device. Note: More than one value can match if the available devices have different characteristics, although none only matches when none of them are pointing devices. ...
...characteristics, although none only matches when none of them are pointing devices. Examples This example creates a small checkbox for users with at least one fine pointer and a large checkbox for users with at least one coarse pointer. The big checkbox takes precedence because it is declared after the small one. ...
color-gamut - CSS: Cascading Style Sheets
The color-gamut CSS media feature can be used to test the approximate range of colors that are supported by the user agent and the output device. Syntax The color-gamut feature is specified as a keyword value chosen from the list below. srgb The output device can support approximately the sRGB gamut or more. This includes the vast majority of color displays. p3 The output device can support approximately the gamut specified by the DCI P3 Color Space or more. The p3 gamut is larger than and includes the srgb gamut. rec2020 The output device can support approximately the gamut specified by the ITU-R Recommendation BT.2020 Color Space or more. The rec2020 gamut is larger than and includes the p3 gamut. ...
...lays. p3 The output device can support approximately the gamut specified by the DCI P3 Color Space or more. The p3 gamut is larger than and includes the srgb gamut. rec2020 The output device can support approximately the gamut specified by the ITU-R Recommendation BT.2020 Color Space or more. The rec2020 gamut is larger than and includes the p3 gamut. Examples HTML <p>This is a test.</p> CSS @media (color-gamut: srgb) { p { background: #f4ae8a; } } Result Specifications Specification Status Comment Media Queries Level 4The definition of 'color-gamut' in that specification. Candidate Recommendation Initial definition. ...
forced-colors - CSS: Cascading Style Sheets
The forced-colors CSS media feature is used to detect if the user agent has enabled a forced colors mode where it enforces a user-chosen limited color palette on the page. Note: This feature is not supported by any user agent and its specifics are subject to change. Syntax The forced-colors media feature indicates whether or not the browser is currently in forced-colors mode. Values none Forced colors mode is not active; the page's colors are not being forced into a limited palette. active Indicates that forced colors mode is active. The browser provides the color palette to authors through the CSS system color keywords and, if appropriate, it triggers the appropriate value of prefers-color-scheme so that authors can adapt the page. Usage notes Properties affected by forced-co...
...ery is ever implemented user agents will likely rely on the settings provided by the operating system in use. Examples Note: No browser currently implements this feature so the following example will not work. This example has an annoying color palette by default. This example does not take advantage of the colors provided by the user agent. HTML <div class="colors">weird color box</div> CSS .colors { background-color: red; color: grey; } @media (forced-colors: active) { .colors { background-color: white; color: black; } } Result Specifications Specification Status Comment Media Queries Level 5The definition of 'forced-colors' in that specification. Editor's Draft Initial definition. ...
grid - CSS: Cascading Style Sheets
Web › CSS › @media › grid
The grid CSS media feature can be used to test whether the output device uses a grid-based screen. Most modern computers and smartphones have bitmap-based screens. Examples of grid-based devices include text-only terminals and basic phones with only one fixed font. Syntax The grid feature is specified as a <mq-boolean> value (0 or 1) representing whether or not the ouput device is grid-based. Examples HTML <p class="unknown">I don't know if you're using a grid device. ...
...nclude text-only terminals and basic phones with only one fixed font. Syntax The grid feature is specified as a <mq-boolean> value (0 or 1) representing whether or not the ouput device is grid-based. Examples HTML <p class="unknown">I don't know if you're using a grid device. ...
height - CSS: Cascading Style Sheets
Web › CSS › @media › height
The height CSS media feature can be used to apply styles based on the height of the viewport (or the page box, for paged media). 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. ...
... on the height of the viewport (or the page box, for paged media). 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. ...
inverted-colors - CSS: Cascading Style Sheets
The inverted-colors CSS media feature can be used to test whether the user agent or underlying OS is inverting colors. Syntax The inverted-colors feature is specified as a keyword value chosen from the list below. none Colors are displayed normally. inverted All pixels within the displayed area have been inverted. Examples HTML <p>If you're using inverted colors, this text should be blue on white (the inverse of yellow on black). ...
...en from the list below. none Colors are displayed normally. inverted All pixels within the displayed area have been inverted. Examples HTML <p>If you're using inverted colors, this text should be blue on white (the inverse of yellow on black). If you're not, it should be red on light gray.</p> <p>If the text is gray, your browser doesn't support the `inverted-colors` media feature.</p> CSS p { color: gray; } @media (inverted-colors: inverted) { p { background: black; color: yellow; } } @media (inverted-colors: none) { p { background: #eee; color: red; } } Result Specifications Specification Status Comment Media Queries Level 5The definition of 'inverted-colors' in that specification. Editor's Draft ...
monochrome - CSS: Cascading Style Sheets
Web › CSS › @media › monochrome
The monochrome CSS media feature can be used to test the number of bits per pixel in the monochrome frame buffer of the output device. Syntax The monochrome feature is specified as an <integer> representing the number of bits per pixel in the monochrome frame buffer. If the device is not a monochrome device, the value is zero. It is a range feature, meaning that you can also use the prefixed min-monochrome and max-monochrome variants to query minimum and maximum values, respectively. ...
...n the monochrome frame buffer. If the device is not a monochrome device, the value is zero. It is a range feature, meaning that you can also use the prefixed min-monochrome and max-monochrome 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. ...
...rait. 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; } div { background: yellow; } @media (orientation: landscape) { body { flex-direction: row; } } @media (orientation: portrait) { body { flex-direction: column; } } Result Specifications Specification Status Comment Media Queries Level 4The definition of 'orientation' in that specification. Candidate Recommendation ...
overflow-block - CSS: Cascading Style Sheets
Syntax The overflow-block feature is specified as a keyword value chosen from the list below. none Content that overflows the block axis is not displayed. scroll Content that overflows the block axis can be seen by scrolling to it. optional-paged Content that overflows the block axis can be seen by scrolling to it, but page breaks can be manually triggered (such as via break-inside, etc.) to cause the following content to display on the following page. paged Content is broken up into discrete pages; content that overflows one page in the block axis is displayed on the following page. ...
...cibus orci luctus et ultrices posuere cubilia Curae; Nunc velit erat, tempus id rutrum sed, dapibus ut urna. Integer vehicula nibh a justo imperdiet rutrum. Nam faucibus pretium orci imperdiet sollicitudin. Nunc id facilisis dui. Proin elementum et massa et feugiat. Integer rutrum ullamcorper eleifend. Proin sit amet tincidunt risus. Sed nec augue congue eros accumsan tincidunt sed eget ex.</p> CSS @media (overflow-block: scroll) { p { color: red; } } Result Specifications Specification Status Comment Media Queries Level 4The definition of 'overflow-block' in that specification. Candidate Recommendation Initial definition. ...
overflow-inline - CSS: Cascading Style Sheets
Syntax The overflow-inline feature is specified as a keyword value chosen from the list below. none Content that overflows the inline axis is not displayed. scroll Content that overflows the inline axis can be seen by scrolling to it. Examples HTML <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ac turpis eleifend, fringilla velit ac, aliquam tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nunc velit erat, tempus id rutrum sed, dapibus ut urna. Integer vehicula nibh a justo imperdiet rutrum. ...
...cibus orci luctus et ultrices posuere cubilia Curae; Nunc velit erat, tempus id rutrum sed, dapibus ut urna. Integer vehicula nibh a justo imperdiet rutrum. Nam faucibus pretium orci imperdiet sollicitudin. Nunc id facilisis dui. Proin elementum et massa et feugiat. Integer rutrum ullamcorper eleifend. Proin sit amet tincidunt risus. Sed nec augue congue eros accumsan tincidunt sed eget ex.</p> CSS p { white-space: nowrap; } @media (overflow-inline: scroll) { p { color: red; } } Result Specifications Specification Status Comment Media Queries Level 4The definition of 'overflow-inline' in that specification. Candidate Recommendation Initial definition. ...
pointer - CSS: Cascading Style Sheets
Web › CSS › @media › pointer
The pointer CSS media feature tests whether the user has a pointing device (such as a mouse), and if so, how accurate the primary pointing device is. Note: If you want to test the accuracy of any pointing device, use any-pointer instead. Syntax The pointer feature is specified as a keyword value chosen from the list below. none The primary input mechanism does not include a pointing device. coarse The primary input mechanism includes a pointing device of limited accuracy. fine The primary input mechanism includes an accurate pointing device. Examples This example creates a small checkbox for users with fine primary pointers and a large checkbox for users with coarse primary pointers. ...
...ing device. coarse The primary input mechanism includes a pointing device of limited accuracy. fine The primary input mechanism includes an accurate pointing device. Examples This example creates a small checkbox for users with fine primary pointers and a large checkbox for users with coarse primary pointers. ...
prefers-color-scheme - CSS: Cascading Style Sheets
If you have set privacy.resistFingerprinting to true, prefers-color-scheme preference is overridden to light. Alternately, users can create the numeric preference ui.systemUsesDarkTheme to override the default behavior and return light (value: 0), dark (value: 1), or no-preference (value: 2). (Any other value causes Firefox to return light.) The prefers-color-scheme CSS media feature is used to detect if the user has requested the system use a light or dark color theme. Syntax light Indicates that user has notified the system that they prefer an interface that has a light theme, or has not expressed an active preference. dark Indicates that user has notified the system that they prefer an interface that has a dark theme. Examples The elements below have an initial color ...
...to the user's color scheme preference. ...
prefers-contrast - CSS: Cascading Style Sheets
Syntax no-preference Indicates that the user has made no preference known to the system. This keyword value evaluates as false in a Boolean context. more Indicates that user has notified the system that they prefer an interface that has a higher level of contrast. less Indicates that user has notified the system that they prefer an interface that has a lower level of contrast. User preferences Various operating systems do support such preferences and user agents are likely to rely on the settings provided by the operating system. ...
...ast. less Indicates that user has notified the system that they prefer an interface that has a lower level of contrast. User preferences Various operating systems do support such preferences and user agents are likely to rely on the settings provided by the operating system. Examples This example has an annoying low contrast by default. HTML <div class="contrast">low contrast box</div> CSS .contrast { width: 100px; height: 100px; outline: 2px dashed black; } @media (prefers-contrast: high) { .contrast { outline: 2px solid black; } } Result Specifications Specification Status Comment Media Queries Level 5The definition of 'prefers-contrast' in that specification. Editor's Draft Initial definition. ...
prefers-reduced-motion - CSS: Cascading Style Sheets
Important: An embedded example at the bottom of this page has a scaling movement that may be problematic for some readers. Readers with vestibular motion disorders may wish to enable the reduce motion feature on their device before viewing the animation. Syntax no-preference Indicates that the user has made no preference known to the system. reduce Indicates that user has notified the system that they prefer an interface that removes or replaces the types of motion-based animation that trigger discomfort for those with vestibular motion disorders. ...
...:config: Add a number preference called ui.prefersReducedMotion and set its value to 1. Changes to this preference take effect immediately. Examples This example has a scaling animation by default. If Reduce Motion is enabled in your accessibility preferences, the animation is toned down to a simple dissolve without vestibular motion triggers. HTML <div class="animation">animated box</div> CSS .animation { animation: pulse 1s linear infinite both; } /* Tone down the animation to avoid vestibular motion triggers like scaling or panning large objects. */ @media (prefers-reduced-motion) { .animation { animation-name: dissolve; } } .animation { background-color: #306; color: #fff; font: 1.2em sans-serif; width: 10em; padding: 1em; border-radius: 1em; text-align...
prefers-reduced-transparency - CSS: Cascading Style Sheets
Syntax no-preference Indicates that the user has made no preference known to the system. This keyword value evaluates as false in the boolean context. reduce Indicates that user has notified the system that they prefer an interface that minimizes the amount of transparent or translucent layer effects. User preferences Currently no user agent implements this feature, although various operating systems do support such preferences and if this media query is ever implemented user agents will likely rely on the settings provided by the operating systems. ...
...arious operating systems do support such preferences and if this media query is ever implemented user agents will likely rely on the settings provided by the operating systems. Examples Note: No browser currently implements this feature so the following example will not work. This example has an annoying transparency effect by default. HTML <div class="transparency">transparent box</div> CSS .transparency { opacity: 0.5; } @media (prefers-reduced-transparency: reduce) { .transparency { opacity: 1; } } Result Specifications Specification Status Comment Media Queries Level 5The definition of 'prefers-reduced-transparency' in that specification. Editor's Draft Initial definition. ...
resolution - CSS: Cascading Style Sheets
Web › CSS › @media › resolution
The resolution CSS media feature can be used to test the pixel density of the output device. Syntax The resolution feature is specified as a <resolution> value representing the pixel density of the output device. It is a range feature, meaning that you can also use the prefixed min-resolution and max-resolution variants to query minimum and maximum values, respectively. ...
...test the pixel density of the output device. Syntax The resolution feature is specified as a <resolution> value representing the pixel density of the output device. It is a range feature, meaning that you can also use the prefixed min-resolution and max-resolution variants to query minimum and maximum values, respectively. ...
scan - CSS: Cascading Style Sheets
Web › CSS › @media › scan
The word scanning used in this context does not refer to an image scanner, such as one used to digitize a photograph. Rather, it means the process by which an image is painted onto a television screen (or other device). Syntax The scan feature is specified as a single keyword value chosen from the list below. interlace The device draws odd lines and even lines alternately. Some televisions use interlaced scanning. progressive The device draws all lines in sequence. All computer screens use progressive scanning. Examples HTML <p>If your screen uses interlaced rendering, this text should be in a sans-serif font. ...
... interlace The device draws odd lines and even lines alternately. Some televisions use interlaced scanning. progressive The device draws all lines in sequence. All computer screens use progressive scanning. Examples HTML <p>If your screen uses interlaced rendering, this text should be in a sans-serif font. If your screen uses progressive scanning, you should see a serif font.</p> CSS p { font-family: cursive; } @media (scan: interlace) { p { font-family: sans-serif; } } @media (scan: progressive) { p { font-family: serif; } } Result Specifications Specification Status Comment Media Queries Level 4The definition of 'scan' in that specification. Candidate Recommendation No change. Media QueriesThe definition o...
scripting - CSS: Cascading Style Sheets
Web › CSS › @media › scripting
The scripting CSS media feature can be used to test whether scripting (such as JavaScript) is available. Syntax The scripting feature is specified as a keyword value chosen from the list below. none Scripting is completely unavailable on the current document. initial-only Scripting is enabled during the initial page load, but not afterwards. enabled Scripting is supported and active on the current document. Examples HTML <p class="script-none">You do not have scripting available. :-(</p> <p class="script-initial-only">Your scripting is only enabled during the initial page load. ...
...-only Scripting is enabled during the initial page load, but not afterwards. enabled Scripting is supported and active on the current document. Examples HTML <p class="script-none">You do not have scripting available. :-(</p> <p class="script-initial-only">Your scripting is only enabled during the initial page load. ...
width - CSS: Cascading Style Sheets
Web › CSS › @media › width
The width CSS media feature can be used to test the width of the viewport (or the page box, for paged media). Syntax The width feature is specified as a <length> value representing the viewport width. It is a range feature, meaning that you can also use the prefixed min-width and max-width variants to query minimum and maximum values, respectively. ...
...d to test the width of the viewport (or the page box, for paged media). Syntax The width feature is specified as a <length> value representing the viewport width. It is a range feature, meaning that you can also use the prefixed min-width and max-width variants to query minimum and maximum values, respectively. ...
bleed - CSS: Cascading Style Sheets
Web › CSS › @page › bleed
This property only has effect if crop marks are enabled using the marks property. Syntax /* Keyword values */ bleed: auto; /* <length> values */ bleed: 8pt; bleed: 1cm; Values auto Computes to 6pt if the value of marks is crop. Otherwise it computes to zero. <length> Specifies by how far outward, in each direction, the bleed area extends past the page box. Values may be negative, but there may be implementation-specific limits. ...
... outward, in each direction, the bleed area extends past the page box. Values may be negative, but there may be implementation-specific limits. Formal definition Related at-rule@pageInitial valueautoComputed valueas specified Formal syntax auto | <length> Examples Setting a page bleed of 1cm @page { bleed: 1cm; } Specifications Specification Status Comment CSS Paged Media Module Level 3The definition of 'bleed' in that specification. Working Draft Initial definition ...
marks - CSS: Cascading Style Sheets
Web › CSS › @page › marks
Crop marks indicate where the page should be cut. Cross marks are used to align sheets. Crop marks and cross marks are printed outside the page box. To have room to show crop and cross marks, the final pages will have to be somewhat bigger than the page box. Syntax /* Keyword values */ marks: none; marks: crop; marks: cross; marks: crop cross; Values crop Crop marks will be displayed. cross Cross marks will be displayed. none No marks will be displayed. ...
...cross; Values crop Crop marks will be displayed. cross Cross marks will be displayed. none No marks will be displayed. Formal definition Related at-rule@pageInitial valuenoneComputed valueas specified Formal syntax none | [ crop | cross ] Examples Adding crop and cross marks @page { marks: crop cross; } Specifications Specification Status Comment CSS Paged Media Module Level 3The definition of 'marks' in that specification. Working Draft Initial definition This CSS property was initially proposed in CSS Level 2, but was dropped from CSS Level 2 (Revision 1). ...
size - CSS: Cascading Style Sheets
Web › CSS › @page › size
Most of the time, this size corresponds to the target size of the printed page if applicable. Size may either be defined with a "scalable" keyword (in this case the page will fill the available dimensions) or with absolute dimensions. ...
... Working Draft Initial definition ...
max-zoom - CSS: Cascading Style Sheets
The browser will not zoom in any further than this, whether automatically or at the user's request. A zoom factor of 1.0 or 100% corresponds to no zooming. Larger values are zoomed in. Smaller values are zoomed out. Syntax /* Keyword value */ max-zoom: auto; /* <number> values */ max-zoom: 0.8; max-zoom: 2.0; /* <percentage> value */ max-zoom: 150%; Values auto The user agent will set the document's upper zoom factor limit. <number> A non-negative number limiting the maximum value of the zoom factor. <percentage> A non-negative percentage limiting the maximum value of the zoom factor. ...
...e limiting the maximum value of the zoom factor. Formal definition Related at-rule@viewportInitial valueautoPercentagesthe zoom factor itselfComputed valueauto, or a non-negative number or percentage as specified Formal syntax auto | <number> | <percentage> Examples Setting max-zoom @viewport { max-zoom: 1.5; } Specifications Specification Status Comment CSS Device AdaptationThe definition of '"max-zoom" descriptor' in that specification. Working Draft Initial definition ...
min-zoom - CSS: Cascading Style Sheets
The browser will not zoom out any further than this, whether automatically or at the user's request. A zoom factor of 1.0 or 100% corresponds to no zooming. Larger values are zoomed in. Smaller values are zoomed out. Syntax /* Keyword value */ min-zoom: auto; /* <number> values */ min-zoom: 0.8; min-zoom: 2.0; /* <percentage> value */ min-zoom: 150%; Values auto The user agent will set the document's lower zoom factor limit. <number> A non-negative number limiting the minimum value of the zoom factor. <percentage> A non-negative percentage limiting the minimum value of the zoom factor. ...
...miting the minimum value of the zoom factor. Formal definition Related at-rule@viewportInitial valueautoPercentagesthe zoom factor itselfComputed valueauto, or a non-negative number or percentage as specified Formal syntax auto | <number> | <percentage> Examples Setting min zoom factor @viewport { min-zoom: 2.0; } Specifications Specification Status Comment CSS Device AdaptationThe definition of '"min-zoom" descriptor' in that specification. Working Draft Initial definition ...
orientation - CSS: Cascading Style Sheets
/* Keyword values */ orientation: auto; orientation: portrait; orientation: landscape; For a UA/device where the orientation is changed upon tilting the device, an author can use this descriptor to inhibit the orientation change. Syntax Values auto The user agent will set the document's orientation automatically, typically based on the device's orientation as determined by an accelerometer (if the device has such a hardware sensor), although there is often a user-controlled, OS-level "Lock orientation" setting that will trump the accelerometer reading. portrait The document should be locked into portrait orientation. ...
...andscape The document should be locked into landscape orientation. Formal definition Related at-rule@viewportInitial valueautoPercentagesrefer to the size of bounding boxComputed valueas specified Formal syntax auto | portrait | landscape Examples Setting viewport orientation @viewport { orientation: landscape; } Specifications Specification Status Comment CSS Device AdaptationThe definition of '"orientation" descriptor' in that specification. Working Draft Initial definition ...
user-zoom - CSS: Cascading Style Sheets
/* Keyword values */ user-zoom: zoom; user-zoom: fixed; Syntax Values zoom The user can zoom in or out. fixed The user cannot zoom in or out. Accessibility concerns Disabling zooming capabilities prevents people experiencing low vision conditions from being able to read and understand page content. ...
... Working Draft Initial definition ...
zoom - CSS: Cascading Style Sheets
Web › CSS › @viewport › zoom
A zoom factor of 1.0 or 100% corresponds to no zooming. Larger values are zoomed in. Smaller values are zoomed out. Syntax /* Keyword value */ zoom: auto; /* <number> values */ zoom: 0.8; zoom: 2.0; /* <percentage> values */ zoom: 150%; Values auto The user agent will set the document's initial zoom factor. The user agent may use the size of canvas area on which the document is rendered to determine that factor. <number> A non-negative number used as the zoom factor. <percentage> A non-negative percentage value used as the zoom factor. ...
... percentage value used as the zoom factor. Formal definition Related at-rule@viewportInitial valueautoPercentagesthe zoom factor itselfComputed valueauto, or a non-negative number or percentage as specified Formal syntax auto | <number> | <percentage> Examples Setting viewport zoom factor @viewport { zoom: 2.0; } Specifications Specification Status Comment CSS Device AdaptationThe definition of '"zoom" descriptor' in that specification. Working Draft Initial specification ...
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. Recomm...
... Recommendation Initial definition. ...
Border-radius generator - CSS: Cascading Style Sheets
This tool can be used to generate CSS3 border-radius effects. border-radius HTML Content <div id="container"> <div class="group section"> <div id="preview" class="col span_12"> <div id="subject"> <div id="top-left" class="radius-container" data-X="left" data-Y="top"> </div> <div id="top-right" class="radius-container" data-X="right" data-Y="top"> </div> <div id="bottom-right" class="radius-container" data-X="right" data-Y="bottom"> </div> <div id="bottom-left" class="radius-container" data-X="left" data-Y="bottom"> </div> <div id="radiu...
...</div> <div class="ui-checkbox" data-topic='top-right'></div> <div class="ui-checkbox" data-topic='bottom-right'></div> <div class="ui-checkbox" data-topic='bottom-left'></div> </div> <div id="unit-selection"> <div class="info"> select border units </div> </div> </div> </div> </div> CSS Content /* GRID OF TEN * ========================================================================== */ .span_12 { width: 100%; } .span_11 { width: 91.46%; } .span_10 { width: 83%; } .span_9 { width: 74.54%; } .span_8 { width: 66.08%; } .span_7 { width: 57.62%; } .span_6 { width: 49.16%; } .span_5 { width: 40.7%; } .span_4 { width: 32.24%; } .span_3 { width: 23.78%; } .span...
Using multiple backgrounds - CSS: Cascading Style Sheets
is, the following background properties can be specified as a list, one per background: background, background-attachment, background-clip, background-image, background-origin, background-position, background-repeat, background-size. ...
...Each subsequent sub-property (background-repeat and background-position) applies to the corresponding backgrounds. So the first listed value for background-repeat applies to the firs...
Box alignment in Flexbox - CSS: Cascading Style Sheets
and shrinks to try to fit into space. The gap properties row-gap column-gap gap Creating fixed size gaps between items On the main axis, the column-gap property will create fixed size gaps between adjacent items. ...
...te spacing between adjacent flex lines, therefore flex-wrap must also be set to wrap for this to have any effect. ...
Basic Concepts of Multicol - CSS: Cascading Style Sheets
Multiple-column Layout, usually referred to as multicol, is a specification for laying out content into a set of column boxes much like columns in a newspaper. 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-...
...is space for more than two columns, we get two. If there is not enough space for two columns of 200px, however, we get one. The columns shorthand You can use the columnsshorthand to set column-count and column-width. If you set a length unit, this will be used for column-width, set an integer and it will be used for column-count. You can set both, separating the two values with a space. This CSS would give the same result as example 1, column-count set to 3. .container { columns: 3; } This CSS would give the same result as example 2, with column-width of 200px. .container { columns: 200px; } This CSS would give the same result as example 3, with both column-count and column-width set. .container { columns: 2 200px; } Next Steps In this guide we've learned the basic use of Mu...
Handling content breaks in multicol - CSS: Cascading Style Sheets
In multicol, the fragmentainer is the column box. ...
...In multicol, the fragmentainer is the column box. ...
Aligning Items in a Flex Container - CSS: Cascading Style Sheets
items on the cross axis. align-self -- controls alignment of an individual flex item on the cross axis. align-content -- described in the spec as for "packing flex lines"; controls space between flex lines on the cross axis. We will also discover how auto margins can be used for alignment in flexbox. Note: The alignment properties in Flexbox have been placed into their own specification -- CSS Box Alignment Level 3. It is expected that this spec will ultimately supersede the properties as defined in Flexbox Level One. The Cross Axis The align-items and align-self properties control alignment of our flex items on the cross axis, down the columns if flex-direction is row and along the row if flex-direction is column. We are making use of cross-axis alignment in the most simple flex e...
...also included in Box Alignment Level 3, which may well extend these properties and values in the future. We have already seen one place where this has happened, with the introduction of the space-evenly value for align-content and justify-content properties. The Box Alignment module also includes other methods of creating space between items, such as the column-gap and row-gap feature as seen in CSS Grid Layout. The inclusion of these properties in Box Alignment means that in future we should be able to use column-gap and row-gap in flex layouts too, and in Firefox 63 you will find the first browser implementation of the gap properties in flex layout. My suggestion when exploring flexbox alignment in depth is to do so alongside looking at alignment in Grid Layout. Both specifications use th...
Ordering Flex Items - CSS: Cascading Style Sheets
should be mindful that the items are only visually displayed in reverse order. The specification says the following on this matter: "Note: The reordering capabilities of flex layout intentionally affect only the visual rendering, leaving speech order and navigation based on the source order. This allows authors to manipulate the visual presentation while leaving the source order intact for non-CSS UAs and for linear models such as speech and sequential navigation." - Ordering and Orientation If your items were links or some other element that the user could tab to, then the tabbing order would be the order that these items appear in the document source -- not your visual order. If you are using a reverse value, or otherwise reordering your items, you should consider whether you actually...
...around any of the live examples on this page, you can see how order is potentially creating a strange experience for anyone not using a pointing device of some kind. To read more about this disconnect of visual order and logical order and some of the potential problems it raises for accessibility, see the following resources. Flexbox and the keyboard navigation disconnect HTML Source Order vs CSS Display Order The Responsive Order Conflict for Keyboard Focus Use cases for order There are sometimes places where the fact that the logical and therefore reading order of flex items is separate from the visual order, is helpful. Used carefully the order property can allow for some useful common patterns to be easily implemented. You might have a design, perhaps a card that will display a n...
Typical use cases of Flexbox - CSS: Cascading Style Sheets
perfect world of browser support, the reason you'd choose to use flexbox is because you want to lay a collection of items out in one direction or another. As you lay out your items you want to control the dimensions of the items in that one dimension, or control the spacing between items. These are the uses that flexbox was designed for. You can read more about the difference between flexbox and CSS Grid Layout in Relationship of Flexbox to other layout methods, where we discuss how flexbox fits into the overall picture of CSS Layout. In reality we also often use Flexbox for jobs that might be better done by Grid Layout, as a fallback for Grid, and also in order to get alignment capabilities. This is something that may well change once Box Alignment is implemented in Block Layout. In this g...
...Alignment properties will ultimately be implemented in Block layout. For now however, if you need to properly centre one thing inside another, flexbox is the way to do it. As in the above example, make a container into a flex container, and then use either align-items on the parent element or target the flex item itself with align-self. Card layout pushing footer down Whether you use flexbox or CSS Grid to lay out a list of card components, these layout methods only work on direct children of the flex or grid component. This means that if you have variable amounts of content, the card will stretch to the height of the grid area or flex container. Any content inside uses regular block layout, meaning that on a card with less content the footer will rise up to the bottom of the content rather...
Stacking context example 1 - CSS: Cascading Style Sheets
In the root stacking context we have two DIVs (DIV #1 and DIV #3), both relatively positioned, but without z-index properties. Inside DIV #1 there is an absolutely positioned DIV #2, while in DIV #3 there is an absolutely positioned DIV #4, both without z-index properties. The only stacking context is the root context. Without z-indexes, elements are stacked in order of occurrence. If DIV #2 is assigned a positive (non-zero and non-auto) z-index value, it is rendered above all the other DIVs. Then if DIV #4 is also assigned a positive z-index greater than DIV #2's z-index, it is rendered above all the other DIVs including DIV #2. ...
...#1</span> <br />position: relative; <div id="div2"> <br /><span class="bold">DIV #2</span> <br />position: absolute; <br />z-index: 1; </div> </div> <br /> <div id="div3"> <br /><span class="bold">DIV #3</span> <br />position: relative; <div id="div4"> <br /><span class="bold">DIV #4</span> <br />position: absolute; <br />z-index: 2; </div> </div> </body></html> CSS .bold { font-weight: bold; font: 12px Arial; } #div1, #div3 { height: 80px; position: relative; border: 1px dashed #669966; background-color: #ccffcc; padding-left: 5px; } #div2 { opacity: 0.8; z-index: 1; position: absolute; width: 150px; height: 200px; top: 20px; left: 170px; border: 1px dashed #990000; background-color: #ffdddd; ...
Stacking context example 2 - CSS: Cascading Style Sheets
There are the same four DIVs of the previous example, but now z-index properties are assigned on both levels of the hierarchy. You can see that DIV #2 (z-index: 2) is above DIV #3 (z-index: 1), because they both belong to the same stacking context (the root one), so z-index values rule how elements are stacked. What can be considered strange is that DIV #2 (z-index: 2) is above DIV #4 (z-index: 10), despite their z-index values. The reason is that they do not belong to the same stacking context. ...
...e: 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. ...
Stacking context example 3 - CSS: Cascading Style Sheets
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. ...
...ML 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. ...
Browser compatibility and Scroll Snap - CSS: Cascading Style Sheets
p-points-y and scroll-snap-destination properties, which are deprecated, to make scroll snapping work in Firefox. We also added the scroll-snap-type property twice, once with the y axis value needed for browsers that support the new spec, and once for Firefox pre-68, which supports the property but without the y value. Do I need to use both specs? Scroll snapping is one of those nice parts of CSS in which the fallback is that you don't get the enhanced functionality, but everything still works. I would suggest at this point you should implement the new specification only, unless you have data to show a large number of users who would benefit from a fallback version. If you want to test using Feature Queries for support of the new spec then we'd suggest testing for scroll-snap-align as th...
..., unless you have data to show a large number of users who would benefit from a fallback version. If you want to test using Feature Queries for support of the new spec then we'd suggest testing for scroll-snap-align as this property did not exist in the old implementation. However, these properties shouldn't cause any problems to non-supporting browsers due to the way that browsers simply ignore CSS that they do not understand. Why are there two versions of scroll snap? Finally, you might wonder why we ended up in a scenario where two versions exist at all. This is the reality of developing new CSS -- it can't be developed in a vacuum away from browser implementations. At some point browsers need to implement a spec to show that it works, and to discover any problems that only become appar...
Shapes From Images - CSS: Cascading Style Sheets
A simple shape from an image To use an image for the shape the image needs to have an Alpha Channel, an area that is not fully opaque. The shape-image-threshold property is used to set a threshold for this opacity. Pixels that are more opaque than this value will be used to calculate the area of the shape. ...
...s not related to the image that is displayed on the page and so you do not need to display an image to use an image to create a shape. You do need something to float, but that could be some generated content as in the below example. I am floating generated content and using a larger star image to shape my content without displaying any image on the page. Creating shapes using a gradient As a CSS gradient is treated as an image, you can use a gradient to generate your shape, by having transparent or semi-transparent areas as part of the gradient. In this next example I have used generated content and floated this content, giving it a background image of a linear gradient. I am using that same value as the value of shape-outside. The linear gradient goes from purple to transparent, so by ...
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. ...
... Working Draft Initial definition. ...
Card - CSS: Cascading Style Sheets
ponents with optional footers. Requirements The card component can contain a variety of content, including a heading, image, content and a footer. Each card should be the same height, and footers should stick to the bottom of the card. When added to a collection of cards, the cards should line up in two dimensions. Recipe Download this example Choices made The card is laid out using CSS Grid Layout despite being a single dimensional layout, as it enables the use of content sizing for the grid tracks. When setting up the single column grid I use the following: .card { display: grid; grid-template-rows: max-content 200px 1fr; } The heading track is set to max-content, which prevents it from stretching. I have decided that I want my image to live within a track that is 200 pi...
... not grow. This would be a reasonable way to lay out the card, although I have a slight preference for being able to control the tracks from the container rather than needing to add rules to the items. For the overall layout you could use flexbox, however this will result in cards stretching over the final flex row where there are fewer than can fit in the rows above. Alternatively you could use CSS multi-col -- this would cause the cards to lay out down the columns, which may or may not be a problem. See the columns recipe for demonstrations of each of these layout methods. Accessibility concerns Depending on the content of your card there may be things you could, or should do to enhance accessibility. See Inclusive Components: Card by Heydon Pickering, for a very detailed explanation of...
Column layouts - CSS: Cascading Style Sheets
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. ...
... Use flexbox: For single rows or columns of items. When you want to do alignment on the cross axis after laying out your items. When you are happy for wrapped items to share out space along their line only and not line up with items in other lines. Lining items up in rows and columns -- grid layout If what you want is a layout where items line up in rows and columns then you should choose CSS Grid Layout. Grid Layout works on the direct children of the grid container in a similar way to the manner in which flexbox works on the direct children of the flex container, however with CSS Grid you can line your items up in rows and columns -- it is described as two-dimensional. Download this example Use Grid: For multiple rows or columns of items. When you want to be able to align ...
Recipe: Media objects - CSS: Cascading Style Sheets
ze of 200 pixels, when we have a small image such as the icon, the track only gets as large as the size of that image -- the max-content size. If the image is larger, the track stops growing at 200 pixels and as the image has a max-width of 100% applied, it scales down so that it continues to fit inside the column. By using grid-template-areas to achieve the layout, I can see the pattern in the CSS. I define my grid once we have a max-width of 500 pixels, so on smaller devices the media object stacks. An option for the pattern is to flip it to switch the image to the other side -- this is done by adding the media-flip class, which defines a flipped grid template causing the layout to be mirrored. When we nest one media object inside another we need to place it into the second track in the...
... Download this example Once floated elements become grid items the float no longer applies so you don't need to do anything special to clear the float. What you will need to do is remove any margins applied to the item, and any widths which we don't need in a grid context (we have the gap property to control it in grids, and the track takes control of the sizing). Relevant resources on MDN CSS Grid Layout Progressive Enhancement and Grid Layout Using Grid Template Areas fit-content Grid-template-areas ...
Layout mode - CSS: Cascading Style Sheets
There are several of them: Normal flow -- all elements are part of normal flow until you do something to take them out of it. Normal flow includes block layout, designed for laying out boxes such as paragraphs and inline layout, which lays out inline items such as text. Table layout, designed for laying out tables. Float layout, designed to cause an item to position itself left or right with the rest of the content in normal flow wrapping around it. Positioned layout, designed for positioning elements without much interaction with other elements. ...
... in normal flow wrapping around it. Positioned layout, designed for positioning elements without much interaction with other elements. Multi-column layout, designed for laying content out in columns as in a newspaper. Flexible box layout, designed for laying out complex pages that can be resized smoothly. Grid layout, designed for laying out elements relative to a fixed grid. Note: Not all CSS properties apply to all layout modes. Most of them apply to one or two of them and have no effect if they are set on an element participating in another layout mode. ...
Using Media Queries for Accessibility - CSS: Cascading Style Sheets
rence known to the system. reduce Indicates that user has notified the system that they prefer an interface that minimizes the amount of movement or animation, preferably to the point where all non-essential movement is removed. Example This example has an annoying animation unless you turn on Reduce Motion in your accessibility preferences. ...
...as an annoying animation unless you turn on Reduce Motion in your accessibility preferences. HTML <div class="animation">animated box</div> CSS .animation { -webkit-animation: vibrate 0.3s linear infinite both; animation: vibrate 0.3s linear infinite both; } @media (prefers-reduced-motion: reduce) { .animation { animation: none; } } High Contrast Mode The -ms-high-contrast CSS media feature is a Microsoft extension that describes whether the application is being displayed in high contrast mode, and with what color variation. This will help not only users with low vision and contrast sensitivity issues but also users that are working on a computer or phone with direct sunlight. Syntax The -ms-high-contrast media feature is specified as one of the following values. V...
Pseudo-elements - CSS: Cascading Style Sheets
For example, ::first-line can be used to change the font of the first line of a paragraph. /* The first line of every <p> element. */ p::first-line { color: blue; text-transform: uppercase; } Note: In contrast to pseudo-elements, pseudo-classes can be used to style an element based on its state. 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
/* Selects all matching elements */ span, div { border: red 2px solid; } To reduce the size of style sheets, one can group selectors in comma-separated lists. Syntax element, element, element { style properties } Examples Single Line Grouping Grouping selectors in a single line 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. ...
...ulates specificity. h1 { font-family: sans-serif } h2:maybe-unsupported { font-family: sans-serif } h3 { font-family: sans-serif } :is(h1, h2:maybe-unsupported, h3) { font-family: sans-serif } Specifications Specification Status Comment Selectors Level 4The definition of 'Selector Lists' in that specification. Working Draft Renamed to "selector list" CSS Level 1The definition of 'grouping' in that specification. Recommendation Initial definition ...
Universal selectors - CSS: Cascading Style Sheets
The CSS universal selector (*) matches elements of any type. /* Selects all elements */ * { color: green; } Beginning with CSS3, the asterisk may be used in combination with namespaces: ns|* - matches all elements in namespace ns *|* - matches all elements |* - matches all elements without any declared namespace Syntax * { style properties } The asterisk is optional with simple selectors. For instance, *.warning and .warning are equivalent. Examples CSS * [lang^=en] { color: green; } *.warning { color: red; } *#maincontent { border: 1px solid blue; } .floating { float: left } /* automatically clear the next sibling after a floating element */ .floating + * { clear: left; } HTML <p class="warning"> <span lang="en-us">A green span</span> in a red paragraph. <...
... Recommendation Initial definition ...
Actual value - CSS: Cascading Style Sheets
For example, a user agent that can only render borders with a whole-number pixel width may round the thickness of the border to the nearest integer. Calculating a property's actual value The user agent performs four steps to calculate a property's actual (final) value: First, the specified value is determined based on the result of cascading, inheritance, or using the initial value. Next, the computed value is calculated according to the specification (for example, a span with position: absolute will have its computed display changed to block). Then, layout is calculated, resulting in the used value. ...
... Recommendation Initial definition. ...
animation-duration - 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. It is often convenient to use the shorthand property animation to set all animation properties at once. Syntax /* Single animation */ animation-duration: 6s; animation-duration: 120ms; /* Multiple animations */ animation-duration: 1.64s, 15.22s; animation-duration: 10s, 35s, 230ms; Values <time> The time that an animation takes to complete one cycle. This may be specified in either seconds (s) or milliseconds (ms). ...
...y, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are. For more information, see Setting multiple animation property values. Formal definition Initial value0sApplies toall elements, ::before and ::after pseudo-elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <time># Examples See CSS animations for examples. Specifications Specification Status Comment CSS AnimationsThe definition of 'animation-duration' in that specification. Working Draft Initial definition. ...
animation-iteration-count - CSS: Cascading Style Sheets
If multiple values are specified, each time the animation is played the next value in the list is used, cycling back to the first value after the last one is used. 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. ...
...fferent ways depending on how many there are. For more information, see Setting multiple animation property values. Formal definition Initial value1Applies toall elements, ::before and ::after pseudo-elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <single-animation-iteration-count>#where <single-animation-iteration-count> = infinite | <number> Examples See CSS animations for examples. Specifications Specification Status Comment CSS AnimationsThe definition of 'animation-iteration-count' in that specification. Working Draft Initial definition. ...
animation-name - 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. It is often convenient to use the shorthand property animation to set all animation properties at once. ...
...e property in different ways depending on how many there are. For more information, see Setting multiple animation property values. Formal definition Initial valuenoneApplies toall elements, ::before and ::after pseudo-elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax [ none | <keyframes-name> ]#where <keyframes-name> = <custom-ident> | <string> Examples See CSS animations for examples. Specifications Specification Status Comment CSS AnimationsThe definition of 'animation-name' in that specification. Working Draft Initial definition. ...
animation-play-state - 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. Resuming a paused animation will start the animation from where it left off at the time it was paused, rather than starting over from the beginning of the animation sequence. ...
...y in different ways depending on how many there are. For more information, see Setting multiple animation property values. Formal definition Initial valuerunningApplies toall elements, ::before and ::after pseudo-elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <single-animation-play-state>#where <single-animation-play-state> = running | paused Examples See CSS animations for examples. Specifications Specification Status Comment CSS AnimationsThe definition of 'animation-play-state' in that specification. Working Draft Initial definition. ...
backdrop-filter - CSS: Cascading Style Sheets
Because it applies to everything behind the element, to see the effect you must make the element or its background at least partially transparent. ...
..., <alpha-value>? ) | rgba( <number>#{3} , <alpha-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>? ...
background-origin - 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. Note that background-origin is ignored when background-attachment is fixed. Syntax /* Keyword values */ background-origin: border-box; background-origin: padding-box; background-origin: content-box; /* Global values */ background-origin: inherit; background-origin: initial; background-origin: unset; The background-origin property is specified as one of the keyword values listed below. ...
... Candidate Recommendation Initial definition. ...
<blend-mode> - CSS: Cascading Style Sheets
It is used in the background-blend-mode and mix-blend-mode properties. Syntax The <blend-mode> data type is defined using a keyword value chosen from the list below. Values normal The final color is the top color, regardless of what the bottom color is. The effect is like two opaque pieces of paper overlapping. <div id="div"></div> #div { width: 300px; height: 300px; background: url('https://mdn.mozillademos.org/files/8543/br.png'), url('https://mdn.mozillademos.org/files/8545/tr.png'); background-blend-mode: normal; } multiply The final color is the result of multiplying the top and bottom colors. ...
...tion>screen</option> <option>overlay</option> <option>darken</option> <option>lighten</option> <option>color-dodge</option> <option>color-burn</option> <option>hard-light</option> <option>soft-light</option> <option>difference</option> <option>exclusion</option> <option>hue</option> <option>saturation</option> <option>color</option> <option>luminosity</option> </select> CSS div { width: 300px; height: 300px; background: url(https://media.prod.mdn.mozit.cloud/attachments/2020/07/29/17350/3b4892b7e820122ac6dd7678891d4507/firefox.png) no-repeat center, linear-gradient(to bottom, blue, orange); } JavaScript const selectElem = document.querySelector('select'); const divElem = document.querySelector('div'); selectElem.addEventListener('change', () => { divEl...
block-size - CSS: Cascading Style Sheets
It corresponds to either the width or the height property, depending on the value of writing-mode. 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. ...
...lock-size property takes the same values as the width and height properties. Formal definition Initial valueautoApplies tosame as width and heightInheritednoPercentagesblock-size of containing blockComputed valuesame as width and heightAnimation typea length, percentage or calc(); Formal syntax <'width'> Examples Block size with vertical text HTML <p class="exampleText">Example text</p> CSS .exampleText { writing-mode: vertical-rl; background-color: yellow; block-size: 200px; } Result Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'block-size' in that specification. Editor's Draft Initial definition ...
border-block-color - CSS: Cascading Style Sheets
It corresponds to the border-top-color and border-bottom-color, or border-right-color and border-left-color property depending on the values defined for writing-mode, direction, and text-orientation. border-block-color: yellow; border-block-color: #F5F6F7; The border color in the other dimension can be set with border-inline-color which sets border-inline-start-color, and border-inline-end-color. Syntax Values <'color'> The color of the border. See color. ...
...sets border-inline-start-color, and border-inline-end-color. Syntax Values <'color'> The color of the border. See color. Formal definition Initial valuecurrentcolorApplies toall elementsInheritednoComputed valuecomputed colorAnimation typediscrete Formal syntax <'border-top-color'>{1,2} Examples Border with vertical text HTML <div> <p class="exampleText">Example text</p> </div> CSS div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-lr; border: 10px solid blue; border-block-color: red; } Results Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-block-color' in that specification. Editor's Draft Initial definition ...
border-block-end-color - CSS: Cascading Style Sheets
It corresponds to the border-top-color, border-right-color, border-bottom-color, or border-left-color 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. ...
...line-end-color, which define the other border colors of the element. Values <'color'> The color of the border. See color. Formal definition Initial valuecurrentcolorApplies toall elementsInheritednoComputed valuecomputed colorAnimation typea color Formal syntax <'border-top-color'> Examples Border color with vertical text HTML <div> <p class="exampleText">Example text</p> </div> CSS div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-lr; border: 10px solid blue; border-block-end-color: red; } Results Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-block-end-color' in that specification. Editor's Draft Initial def...
border-block-end-style - CSS: Cascading Style Sheets
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. ...
...yle, 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 elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <'border-top-style'> Examples Dashed border with vertical text 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-block-end-style: dashed; } Results Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-block-end-style' in that specification. Editor's Draft Initial d...
border-block-end-width - CSS: Cascading Style Sheets
It corresponds to the border-top-width, border-right-width, border-bottom-width, or border-left-width 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. ...
...> The width of the border. See border-width. Formal definition Initial valuemediumApplies toall elementsInheritednoPercentageslogical-width of containing blockComputed valueabsolute length; 0 if the border style is none or hiddenAnimation typea length Formal syntax <'border-top-width'> Examples Border width with veritcal text HTML <div> <p class="exampleText">Example text</p> </div> CSS div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-lr; border: 1px solid blue; border-block-end-width: 5px; } Results Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-block-end-width' in that specification. Editor's Draft Initial defi...
border-block-start-color - CSS: Cascading Style Sheets
It corresponds to the border-top-color, border-right-color, border-bottom-color, or border-left-color 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. ...
...olor, and border-inline-end-color, which define the other border colors of the element. Values <'color'> See border-color Formal definition Initial valuecurrentcolorApplies toall elementsInheritednoComputed valuecomputed colorAnimation typea color Formal syntax <'border-top-color'> Examples Border color with vertical text HTML <div> <p class="exampleText">Example text</p> </div> CSS div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-lr; border: 10px solid blue; border-block-start-color: red; } Results Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-block-start-color' in that specification. Editor's Draft Initial...
border-block-start-style - CSS: Cascading Style Sheets
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. ...
...yle, 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 elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <'border-top-style'> Examples Dashed border wtih vertical text 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-block-start-style: dashed; } Results Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-block-start-style' in that specification. Editor's Draft Initi...
border-block-start-width - CSS: Cascading Style Sheets
It corresponds to the border-top-width, border-right-width, border-bottom-width, or border-left-width 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. ...
...> The width of the border. See border-width. Formal definition Initial valuemediumApplies toall elementsInheritednoPercentageslogical-width of containing blockComputed valueabsolute length; 0 if the border style is none or hiddenAnimation typea length Formal syntax <'border-top-width'> Examples Border width with vertical text HTML <div> <p class="exampleText">Example text</p> </div> CSS div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-lr; border: 1px solid blue; border-block-start-width: 5px; } Results Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-block-start-width' in that specification. Editor's Draft Initial ...
border-block-style - CSS: Cascading Style Sheets
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. ...
...-inline-start-style, and border-inline-end-style. Syntax Values <'border-style'> The line style of the border. See border-style. Formal definition Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <'border-top-style'> Examples Dashed border with vertical text 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-block-style: dashed; } Results Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-block-style' in that specification. Editor's Draft Initial definitio...
border-block-width - CSS: Cascading Style Sheets
It corresponds to the border-top-width and border-bottom-width, or border-left-width, and border-right-width property depending on the values defined for writing-mode, direction, and text-orientation. /* <'border-width'> values */ border-block-width: 5px; border-block-width: 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. ...
...> The width of the border. See border-width. Formal definition Initial valuemediumApplies toall elementsInheritednoPercentageslogical-width of containing blockComputed valueabsolute length; 0 if the border style is none or hiddenAnimation typediscrete Formal syntax <'border-top-width'> Examples Border width with vertical text HTML <div> <p class="exampleText">Example text</p> </div> CSS div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-lr; border: 1px solid blue; border-block-width: 5px; } Results Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-block-width' in that specification. Editor's Draft Initial definition ...
border-image-outset - CSS: Cascading Style Sheets
The parts of the border image that are rendered outside the element's border box with border-image-outset do not trigger overflow scrollbars and don't capture mouse events. 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. ...
...ll elements, except internal table elements when border-collapse is collapse. It also applies to ::first-letter.InheritednoComputed valueas specified, but with relative lengths converted into absolute lengthsAnimation typeby computed value type Formal syntax [ <length> | <number> ]{1,4} Examples Outsetting a border image HTML <div id="outset">This element has an outset border image!</div> CSS #outset { width: 10rem; background: #cef; border: 1.4rem solid; border-image: radial-gradient(#ff2, #55f) 40; border-image-outset: 1.5; /* 1.5 x 1.4rem = 2.1rem */ margin: 2.1rem; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-image-outset' in that specification. Candidate R...
border-image-source - 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 border-image-slice property is used to divide the source image into regions, which are then dynamically applied to the final border image. ...
... Candidate Recommendation Initial definition ...
border-image-width - 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 this property's value is greater than the element's border-width, the border image will extend beyond the padding (and/or content) edge. ...
... 90 by 90 pixels: Thus, each circle in the source image is 30 by 30 pixels. HTML <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p> CSS p { border: 20px solid; border-image: url("/static/external/21/214842819586a8dd293c17b38d0fd0e26430146a86dd04294a53ecaeeea7d0e2.png") 30 round; border-image-width: 16px; padding: 40px; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-image-width' in that specification. Candidate Re...
border-inline-color - CSS: Cascading Style Sheets
It corresponds to the border-top-color and border-bottom-color, or border-right-color and border-left-color property depending on the values defined for writing-mode, direction, and text-orientation. border-inline-color: yellow; border-inline-color: #F5F6F7; The border color in the other dimension can be set with border-block-color which sets border-block-start-color, and border-block-end-color. Syntax Values <'color'> The color of the border. See color. ...
... border-block-start-color, and border-block-end-color. Syntax Values <'color'> The color of the border. See color. Formal definition Initial valuecurrentcolorApplies toall elementsInheritednoComputed valuecomputed colorAnimation typediscrete Formal syntax <'border-top-color'>{1,2} Examples Border color with vertical text HTML <div> <p class="exampleText">Example text</p> </div> CSS div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-lr; border: 10px solid blue; border-inline-color: red; } Results Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-inline-color' in that specification. Editor's Draft Initial definitio...
border-inline-end-color - CSS: Cascading Style Sheets
It corresponds to the border-top-color, border-right-color, border-bottom-color, or border-left-color 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. ...
...l valuecurrentcolorApplies toall elementsInheritednoComputed valuecomputed colorAnimation typea color Values <'color'> The color of the border. See color. Formal definition Initial valuecurrentcolorApplies toall elementsInheritednoComputed valuecomputed colorAnimation typea color Formal syntax <'border-top-color'> 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: 10px solid blue; border-inline-end-color: red; } Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-inline-end-color' in that specification. Editor's Draft Initial definition...
border-inline-end-style - CSS: Cascading Style Sheets
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. ...
...-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 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...
border-inline-end-width - CSS: Cascading Style Sheets
It corresponds to the border-top-width, border-right-width, border-bottom-width, or border-left-width 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. ...
...e width of the border. See border-width. Formal definition Initial valuemediumApplies toall elementsInheritednoPercentageslogical-width of containing blockComputed valueabsolute length; 0 if the border style is none or hiddenAnimation typea length Formal syntax <'border-top-width'> Examples Applying a border with vertical text HTML <div> <p class="exampleText">Example text</p> </div> CSS div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-lr; border: 1px solid blue; border-inline-end-width: 5px; } Results Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-inline-end-width' in that specification. Editor's Draft Initial de...
border-inline-start-color - CSS: Cascading Style Sheets
It corresponds to the border-top-color, border-right-color, border-bottom-color, or border-left-color 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. ...
...er-block-end-color, and border-inline-end-color, which define the other border colors of the element. Values <'color'> The color of the border. See color. Formal definition Initial valuecurrentcolorApplies toall elementsInheritednoComputed valuecomputed colorAnimation typea color Formal syntax <'border-top-color'> 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: 10px solid blue; border-inline-start-color: red; } Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-inline-start-color' in that specification. Editor's Draft Initial defini...
border-inline-start-style - CSS: Cascading Style Sheets
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. ...
... valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Values <'border-style'> The line style of the border. See border-style. 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-start-style: dashed; } Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-inline-start-style' in that specification. Editor's Draft Initial defi...
border-inline-start-width - CSS: Cascading Style Sheets
It corresponds to the border-top-width, border-right-width, border-bottom-width, or border-left-width 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. ...
...ement. Values <'border-width'> The width of the border. See border-width. Formal definition Initial valuemediumApplies toall elementsInheritednoPercentageslogical-width of containing blockComputed valueabsolute length; 0 if the border style is none or hiddenAnimation typea length Formal syntax <'border-top-width'> 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: 1px solid blue; border-inline-start-width: 5px; } Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-inline-start-width' in that specification. Editor's Draft Initial definit...
border-inline-style - CSS: Cascading Style Sheets
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. ...
...ock-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 valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <'border-top-style'> Examples HTML Content <div> <p class="exampleText">Example text</p> </div> CSS Content div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-lr; border: 5px solid blue; border-inline-style: dashed; } Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-inline-style' in that specification. Editor's Draft Initial definiti...
border-inline-width - CSS: Cascading Style Sheets
It corresponds to the border-top-width and border-bottom-width, or border-left-width, and border-right-width property depending on the values defined for writing-mode, direction, and text-orientation. /* <'border-width'> values */ border-inline-width: 5px 10px; border-inline-width: 5px; border-inline-width: 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. ...
...Syntax Values <'border-width'> The width of the border. See border-width. Formal definition Initial valuemediumApplies toall elementsInheritednoPercentageslogical-width of containing blockComputed valueabsolute length; 0 if the border style is none or hiddenAnimation typediscrete Formal syntax <'border-top-width'> 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: 1px solid blue; border-inline-width: 5px 10px; } Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-inline-width' in that specification. Editor's Draft Initial definition ...
border-spacing - CSS: Cascading Style Sheets
This property applies only when border-collapse is separate. 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 border-spacing value is also used along the outside edge of the table, where the distance between the table's border and the cells in the first/last column or row is the sum of the relevant (horizontal or vertical) border-spacing and the relevant (top, right, bottom, or left) padding on the table. ...
... and padding table cells This example applies a spacing of .5em vertically and 1em horizontally between a table's cells. Note how, along its outside edges, the table's padding values are added to its border-spacing values. HTML <table> <tr> <td>1</td><td>2</td><td>3</td> </tr> <tr> <td>4</td><td>5</td><td>6</td> </tr> <tr> <td>7</td><td>8</td><td>9</td> </tr> </table> CSS table { border-spacing: 1em .5em; padding: 0 2em 1em 0; border: 1px solid orange; } td { width: 1.5em; height: 1.5em; background: #d2d2d2; text-align: center; vertical-align: middle; } Result Specifications Specification Status Comment CSS Level 2 (Revision 1)The definition of 'border-spacing' in that specification. Recommendation Initial ...
box-pack - CSS: Cascading Style Sheets
Web › CSS › box-pack
The effect of this is only visible if there is extra space in the box. /* Keyword values */ box-pack: start; box-pack: center; box-pack: end; box-pack: justify; /* Global values */ box-pack: inherit; box-pack: initial; box-pack: unset; The direction of layout depends on the element's orientation: horizontal or vertical. Syntax The box-pack property is specified as one of the keyword values listed below. ...
...nated 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. If the packing is set using the element's pack attribute, then the style is ignored. ...
column-fill - 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. Syntax /* Keyword values */ column-fill: auto; column-fill: balance; column-fill: balance-all; /* Global values */ column-fill: inherit; column-fill: initial; column-fill: unset; The column-fill property is specified as one of the keyword values listed below. The initial value is balance so the content will be balanced across the columns. Values auto Columns are filled sequentially. ...
...ween columns. In fragmented contexts, such as paged media, all fragments are balanced. Formal definition Initial valuebalanceApplies tomulticol elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax auto | balance | balance-all Examples Splitting text evenly across columns HTML <p class="content-box"> This is a bunch of text split into multiple columns. The CSS `column-fill` property is used to spread the contents evenly across all the columns. </p> CSS .content-box { column-count: 4; column-rule: 1px solid black; column-fill: balance; } Result Specifications Specification Status Comment CSS Multi-column Layout ModuleThe definition of 'column-fill' in that specification. Working Draft Initial definiti...
column-rule-color - 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. Syntax /* <color> values */ column-rule-color: red; column-rule-color: rgb(192, 56, 78); column-rule-color: transparent; column-rule-color: hsla(0, 100%, 50%, 0.6); /* Global values */ column-rule-color: inherit; column-rule-color: initial; column-rule-color: unset; The column-rule-color property is specified as a single <color> value. Values <color> The color of the rule that separates columns. ...
...<alpha-value> ]? ) | hsla( <hue>, <percentage>, <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. ...
column-rule-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. ...
...efinition Initial valuenoneApplies tomulticol elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <'border-style'> Examples Setting a dashed column rule HTML <p>This is a bunch of text split into three columns. The `column-rule-style` property is used to change the style of the line that is drawn between columns. Don't you think that's wonderful?</p> CSS p { column-count: 3; column-rule-style: dashed; } Result Specifications Specification Status Comment CSS Multi-column Layout ModuleThe definition of 'column-rule-style' in that specification. Working Draft Initial definition. ...
column-rule-width - 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. Syntax /* Keyword values */ column-rule-width: thin; column-rule-width: medium; column-rule-width: thick; /* <length> values */ column-rule-width: 1px; column-rule-width: 2.5em; /* Global values */ column-rule-width: inherit; column-rule-width: initial; column-rule-width: unset; The column-rule-width property is specified as a single <'border-width'> value. ...
...ntsInheritednoComputed valuethe absolute length; 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. ...
column-rule - 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. 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). ...
..." */ p.bar { column-rule: solid blue; } /* Same as "8px solid currentcolor" */ p.baz { column-rule: solid 8px; } p.abc { column-rule: thick inset blue; } Example 2 HTML <p class="content-box"> This is a bunch of text split into three columns. Take note of how the `column-rule` property is used to adjust the style, width, and color of the rule that appears between the columns. </p> CSS .content-box { padding: 0.3em; background: #ff7; column-count: 3; column-rule: inset 2px #33f; } Result Specifications Specification Status Comment CSS Multi-column Layout ModuleThe definition of 'column-rule' in that specification. Working Draft Initial definition. ...
Computed value - CSS: Cascading Style Sheets
It is calculated from the specified value by: Handling the special values inherit, initial, unset, and revert. Doing the computation needed to reach the value described in the "Computed value" line in the property's definition table. The computation needed to reach a property's computed value typically involves converting relative values (such as those in em units or percentages) to absolute values. For example, if an element has specified values font-size: 16px and padding-top: 2em, then the computed value of padding-top is 32px (double the font size). ...
...n 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 specification. Recommendation Initial definition. ...
contain - CSS: Cascading Style Sheets
Web › CSS › contain
This allows the browser to recalculate layout, style, paint, size, or any combination of them for a limited area of the DOM and not the entire page, leading to obvious performance benefits. 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. 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. ...
... Recommendation Initial definition ...
counter-set - CSS: Cascading Style Sheets
The counter-set CSS property sets a CSS counter to a given value. It manipulates the value of existing counters, and will only create new counters if there isn't already a counter of the given name on the element. Note: The counter's value can be incremented or decremented using the counter-increment CSS property. Syntax /* Set "my-counter" to 0 */ counter-set: my-counter; /* Set "my-counter" to -1 */ counter-set: my-counter -1; /* Set "counter1" to 1, and "counter2" to 4 */ counter-set: counter1 1 counter2 4; /* Cancel any counter that could have been set in less specific rules */ counter-set: none; /* Global values */ counter-set: inherit; counter-set: initial; counter-set: unset; The counter-set property is specified as either one of the following: A <custom-ident> naming th...
... Working Draft Initial definition. ...
<display-inside> - CSS: Cascading Style Sheets
le 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. Examples In this example the parent box has been given display: flow-root and so establishes a new BFC and contains the floated item. ...
... Candidate Recommendation ...
<display-legacy> - CSS: Cascading Style Sheets
This page details those values. Syntax Valid <display-legacy> values: inline-block The element generates a block element box that will be flowed with surrounding content as if it were a single inline box (behaving much like a replaced element would). It is equivalent to inline flow-root. inline-table The inline-table value does not have a direct mapping in HTML. It behaves like an HTML <table> element, but as an inline box, rather than a block-level box. Inside the table box is a block-level context. It is equivalent to inline table. ...
... It is equivalent to inline flex. inline-grid The element behaves like an inline element and lays out its content according to the grid model. It is equivalent to inline grid. Examples In the below example, we are creating an inline flex container with the legacy keyword inline-flex. HTML <div class="container"> <div>Flex Item</div> <div>Flex Item</div> </div> Not a flex item CSS .container { display: inline-flex; } Result In the new syntax the inline flex container would be created using two values, inline for the outer display type, and flex for the inner display type. .container { display: inline flex; } Specifications Specification Status CSS Display Module Level 3The definition of 'display-legacy' in that specification. Candi...
<filter-function> - CSS: Cascading Style Sheets
It is used in the filter and backdrop-filter properties. Syntax The <filter-function> data type is specified using one of the filter functions listed below. Each function requires an argument which, if invalid, results in no filter being applied. blur() Blurs the image. brightness() Makes the image brighter or darker. contrast() Increases or decreases the image's contrast. drop-shadow() Applies a drop shadow behind the image. grayscale() Converts the image to grayscale. hue-rotate() Changes the overall hue of the image. invert() Inverts the colors of the image. opacity() Makes the image transparent. ...
...n> <option>contrast</option> <option>drop-shadow</option> <option>grayscale</option> <option>hue-rotate</option> <option>invert</option> <option>opacity</option> <option>saturate</option> <option>sepia</option> </select> </li> <li> <input type="range"><output></output> </li> <li> <p>Current value: <code></code></p> </li> </ul> CSS div { width: 300px; height: 300px; background: url(https://media.prod.mdn.mozit.cloud/attachments/2020/07/29/17350/3b4892b7e820122ac6dd7678891d4507/firefox.png) no-repeat center; } li { display: flex; align-items: center; justify-content: center; margin-bottom: 20px; } input { width: 60% } output { width: 5%; text-align: center; } select { width: 40%; margin-left: 2px...
flex-grow - CSS: Cascading Style Sheets
Web › CSS › flex-grow
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 /* <number> values */ flex-grow: 3; flex-grow: 0.6; /* Global values */ flex-grow: inherit; flex-grow: initial; flex-grow: unset; The flex-grow property is specified as a single <number>. Values <number> See <number>. Negative values are invalid. Defaults to 0. Description This property specifies how much of the remaining space in the flex container should be assigned to the item (the flex grow factor). ...
... .</h5> <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 class="box1" style="background-color:brown;">D</div> <div class="box1" style="background-color:lightgreen;">E</div> <div class="box" style="background-color:brown;">F</div> </div> CSS #content { display: flex; justify-content: space-around; flex-flow: row wrap; align-items: stretch; } .box { flex-grow: 1; border: 3px solid rgba(0,0,0,.2); } .box1 { flex-grow: 2; border: 3px solid rgba(0,0,0,.2); } Result Specifications Specification Status Comment CSS Flexible Box Layout ModuleThe definition of 'flex-grow' in that specific...
font-feature-settings - 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. ...
... Candidate Recommendation Initial definition ...
font-language-override - CSS: Cascading Style Sheets
/* Keyword value */ font-language-override: normal; /* <string> values */ font-language-override: "ENG"; /* Use English glyphs */ font-language-override: "TRK"; /* Use Turkish glyphs */ /* Global values */ font-language-override: initial; font-language-override: inherit; font-language-override: unset; By default, HTML's lang attribute tells browsers to display glyphs designed specifically for that language. ...
...ean. Formal definition Initial valuenormalApplies toall elements. It also applies to ::first-letter and ::first-line.InheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax normal | <string> Examples Using Danish glyphs HTML <p class="para1">Default language setting.</p> <p class="para2">This is a string with the <code>font-language-override</code> set to Danish.</p> CSS p.para1 { font-language-override: normal; } p.para2 { font-language-override: "DAN"; } Result Specifications Specification Status Comment CSS Fonts Module Level 4The definition of 'font-language-override' in that specification. Working Draft Initial definition. ...
font-optical-sizing - 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. Syntax /* keyword values */ font-optical-sizing: none; font-optical-sizing: auto; /* default */ /* Global values */ font-optical-sizing: inherit; font-optical-sizing: initial; font-optical-sizing: unset; Values none The browser will not modify the shape of glyphs for optimal viewing. auto The browser will modify the shape of glyphs for optimal viewing. ...
... Working Draft ...
font-smooth - CSS: Cascading Style Sheets
Syntax /* Keyword values */ font-smooth: auto; font-smooth: never; font-smooth: always; /* <length> value */ font-smooth: 2em; WebKit implements a similar property, but with different values: -webkit-font-smoothing. It only works on Mac OS X/macOS. auto - Let the browser decide (Uses subpixel anti-aliasing when available; this is the default) none - Turn font smoothing off; display text with jagged sharp edges. antialiased - Smooth the font on the level of the pixel, as opposed to the subpixel. Switching from subpixel rendering to antialiasing for light text on dark backgrounds makes it look lighter. ...
...e Examples Basic usage example The following example shows the Safari/Chromium and Firefox equivalents that turn on font-smoothing on macOS. In both cases the smoothed font should look slightly lighter in weight. For those of you not on a macOS system, here is a screenshot (the live version appears later on): HTML <p>Without font smoothing</p> <p class="smoothed">With font smoothing</p> CSS html { background-color: black; color: white; font-size: 3rem; } p { text-align: center; } .smoothed { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } Result Specifications Not part of any standard. ...
font-synthesis - 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. 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. ...
...he browser's default font-synthesis. Formal definition Initial valueweight 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-alternates - CSS: Cascading Style Sheets
These alternate glyphs may be referenced by alternative names defined in @font-feature-values. ...
...You can find a few free versions for testing purposes, for example from fontsgeek.com. Speci...
<frequency-percentage> - CSS: Cascading Style Sheets
Syntax The value of a <frequency-percentage> is either a <frequency> or a <percentage>; see their individual reference pages for details about their syntaxes. Description Use in calc() Where a <frequency-percentage> is specified as an allowable type, this means that the percentage resolves to a frequency and therefore can be used in a calc() expression. ...
...with a leading + and a unit -0kHz Zero, with a leading - and a unit Invalid frequency values 12.0 This is a <number>, not an <frequency>, because it is missing a unit. 7 Hz No space is allowed between the number and the unit. 0 Although unitless zero is an allowable <length>, it's an invalid <frequency>. Specifications Specification Status Comment CSS Values and Units Module Level 4The definition of '<frequency-percentage>' in that specification. Editor's Draft CSS Values and Units Module Level 3The definition of '<frequency-percentage>' in that specification. Candidate Recommendation Defines <frequency-percentage>. Adds calc() ...
hanging-punctuation - CSS: Cascading Style Sheets
Hanging punctuation may be placed outside the line box. ...
...entsInheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax none | [ first | [ force-end | allow-end ] | last ] Examples Setting opening and closing quotes to hang HTML <p>"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur dignissim nunc mauris, et sollicitudin est scelerisque sed. Praesent laoreet tortor massa, sit amet vulputate nulla pharetra ut."</p> CSS p { hanging-punctuation: first last; margin: .5rem; } Result Specifications Specification Status Comment CSS Text Module Level 3The definition of 'hanging-punctuation' in that specification. Working Draft Initial definition ...
hyphens - CSS: Cascading Style Sheets
Web › CSS › hyphens
It can prevent hyphenation entirely, hyphenate at manually-specified points within the text, or let the browser automatically insert hyphens where appropriate. 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. Hyphenation rules are language-specific. In HTML, the language is determined by the lang attribute, and browsers will hyphenate only if this attribute is present and the appropriate hyphenation dictionary is available. In XML, the xml:lang attribute must be used. ...
...w if needed</dt> <dd lang="en" class="none">An extreme&shy;ly long English word</dd> <dt><code>manual</code>: hyphen only at &amp;hyphen; or &amp;shy; (if needed)</dt> <dd lang="en" class="manual">An extreme&shy;ly long English word</dd> <dt><code>auto</code>: hyphens where the algorithm decides (if needed)</dt> <dd lang="en" class="auto">An extreme&shy;ly long English word</dd> </dl> CSS dd { width: 55px; border: 1px solid black; } dd.none { -webkit-hyphens: none; -ms-hyphens: none; hyphens: none; } dd.manual { -webkit-hyphens: manual; -ms-hyphens: manual; hyphens: manual; } dd.auto { -webkit-hyphens: auto; -ms-hyphens: auto; hyphens: auto; } Result Specifications Specification Status Comment CSS Text Module Level 3The d...
ident - CSS: Cascading Style Sheets
Web › CSS › ident
It consists of one or more characters, where characters can be any of the following: any alphabetical character (A to Z, or a to z), any decimal digit (0 to 9), a hyphen (-), an underscore (_), an escaped character (preceded by a backslash, \), a Unicode character (in the format of a backslash, \, followed by one to six hexadecimal digits, representing its Unicode code point) Note that id1, Id1, iD1 and ID1 are all different identifiers as they are case-sensitive. ...
...ters bili\.bob A correctly escaped period Invalid identifiers 34rem It must not start with a decimal digit. -12rad It must not start with a dash followed by a decimal digit. bili.bob Only alphanumeric characters, _, and - needn't be escaped. 'bilibob' This would be a <string>. "bilibob" This would be a <string>. Specifications Specification Status Comment CSS Values and Units Module Level 4The definition of '<ident>' in that specification. Editor's Draft CSS Values and Units Module Level 3The definition of '<ident>' in that specification. Candidate Recommendation ...
image-rendering - CSS: Cascading Style Sheets
The property applies to an element itself, to any images set in its other properties, and to its descendants. The user agent will scale an image when the page author specifies dimensions other than its natural size. Scaling may also occur due to user interaction (zooming). For example, if the natural size of an image is 100x100px, but its actual dimensions are 200x200px (or 50x50px), then the image will be upscaled (or downscaled) using the algorithm specified by image-rendering. This property has no effect on non-scaled images. ...
...ipulation or with imageSmoothingEnabled. <div> <img class="auto" alt="auto" src="https://udn.realityripple.com/samples/de/cedd397be3.jpg" /> <img class="pixelated" alt="pixelated" src="https://udn.realityripple.com/samples/de/cedd397be3.jpg" /> <img class="crisp-edges" alt="crisp-edges" src="https://udn.realityripple.com/samples/de/cedd397be3.jpg" /> </div> img { height: 200px; } CSS .auto { image-rendering: auto; } .pixelated { -ms-interpolation-mode: nearest-neighbor; image-rendering: pixelated; } .crisp-edges { image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges; } Result Specifications Specification Status Comment CSS Images Module Level 3The definition of 'image-rendering' in that specification. Candi...
image-set() - CSS: Cascading Style Sheets
Web › CSS › image-set
Resolution and bandwidth differ by device and network access. The image-set() function delivers the most appropriate image resolution for a user's device, providing a set of image options -- each with an associated resolution declaration -- from which the browser picks the most appropriate for the device and settings. Resolution can be used as a proxy for filesize -- a user agent on a slow mobile connection with a high-resolution screen may prefer to receive lower-resolution images rather than waiting for a higher resolution image to load. ...
... its presence and therefore convey nothing to its users. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. MDN Understanding WCAG, Guideline 1.1 explanations Understanding Success Criterion 1.1.1 | W3C Understanding WCAG 2.0 Specifications Specification Status Comment CSS Images Module Level 4The definition of 'The image-set() notation' in that specification. Working Draft 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. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafar...
initial - CSS: Cascading Style Sheets
Web › CSS › initial
The initial CSS keyword applies the initial (or default) value of a property to an element. It can be applied to any CSS property. This includes the CSS shorthand all, with which initial can be used to restore all CSS properties to their initial state. On inherited properties, the initial value may be unexpected. You should consider using the inherit, unset, or revert keywords instead. ...
...sed to restore all CSS properties to their initial state. On inherited properties, the initial value may be unexpected. You should consider using the inherit, unset, or revert keywords instead. Examples Using initial to reset color for an element HTML <p> <span>This text is red.</span> <em>This text is in the initial color (typically black).</em> <span>This is red again.</span> </p> CSS p { color: red; } em { color: initial; } Result Specifications Specification Status Comment CSS Cascading and Inheritance Level 4The definition of 'initial' in that specification. Candidate Recommendation No changes from Level 3. CSS Cascading and Inheritance Level 3The definition of 'initial' in that specification. Candidate Recommendation...
Initial value - CSS: Cascading Style Sheets
The initial value of a CSS property is its default value, as listed in its definition table in the specification. The usage of the initial value depends on whether a property is inherited or not: For inherited 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. ...
...perties, 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. ...
inline-size - CSS: Cascading Style Sheets
It corresponds to either the width or the height property, depending on the value of writing-mode. 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. ...
...ine-size property takes the same values as the width and height properties. Formal definition Initial valueautoApplies tosame as width and heightInheritednoPercentagesinline-size of containing blockComputed valuesame as width and heightAnimation typea length, percentage or calc(); Formal syntax <'width'> Examples Setting inline size in pixels HTML <p class="exampleText">Example text</p> CSS .exampleText { writing-mode: vertical-rl; background-color: yellow; inline-size: 110px; } Result Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'inline-size' in that specification. Editor's Draft Initial definition ...
inset-block-end - CSS: Cascading Style Sheets
It corresponds to the top, right, bottom, or left property depending on the values defined for writing-mode, direction, and text-orientation. /* <length> values */ inset-block-end: 3px; inset-block-end: 2.4em; /* <percentage>s of the width or height of the containing block */ inset-block-end: 10%; /* Keyword value */ inset-block-end: auto; /* Global values */ inset-block-end: inherit; inset-block-end: initial; inset-block-end: unset; Syntax Values The inset-block-end property takes the same values as the left property. ...
...y. Formal definition Initial valueautoApplies topositioned elementsInheritednoPercentageslogical-height of containing blockComputed valuesame as box offsets: top, right, bottom, left properties except that directions are logicalAnimation typea length, percentage or calc(); Formal syntax <'top'> Examples Setting block end offset HTML <div> <p class="exampleText">Example text</p> </div> CSS div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-rl; position: relative; inset-block-end: 20px; background-color: #c8c800; } Result Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'inset-block-end' in that specification. Editor's Draft I...
inset-inline-end - CSS: Cascading Style Sheets
It corresponds to the top, right, bottom, or left property depending on the values defined for writing-mode, direction, and text-orientation. /* <length> values */ inset-inline-end: 3px; inset-inline-end: 2.4em; /* <percentage>s of the width or height of the containing block */ inset-inline-end: 10%; /* Keyword value */ inset-inline-end: auto; /* Global values */ inset-inline-end: inherit; inset-inline-end: initial; inset-inline-end: unset; The shorthand for inset-inline-start and inset-inline-end is inset-inline. ...
...ty. Formal definition Initial valueautoApplies topositioned elementsInheritednoPercentageslogical-width of containing blockComputed valuesame as box offsets: top, right, bottom, left properties except that directions are logicalAnimation typea length, percentage or calc(); Formal syntax <'top'> Examples Setting inline end offset HTML <div> <p class="exampleText">Example text</p> </div> CSS div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-rl; position: relative; inset-inline-end: 20px; background-color: #c8c800; } Result Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'inset-inline-end' in that specification. Editor's Draft ...
isolation - CSS: Cascading Style Sheets
Web › CSS › isolation
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 property is especially helpful when used in conjunction with mix-blend-mode. Syntax /* Keyword values */ isolation: auto; isolation: isolate; /* Global values */ isolation: inherit; isolation: initial; isolation: unset; The isolation property is specified as one of the keyword values listed below. Values auto A new stacking context is created only if one of the properties applied to the element requires it. ...
...s. ...
line-break - CSS: Cascading Style Sheets
/* Keyword values */ line-break: auto; line-break: loose; line-break: normal; line-break: strict; line-break: anywhere; /* Global values */ line-break: inherit; line-break: initial; line-break: unset; Syntax Values auto Break text using the default line break rule. loose Break text using the least restrictive line break rule. Typically used for short lines, such as in newspapers. normal Break text using the most common line break rule. strict Break text using the most stringent line break rule. ...
...???????????<br>?????????????????????</p> <p class="wrapbox loose">loose:<br>??????????????????<br>?????????????????????</p> <p class="wrapbox normal">normal:<br>??????????????????<br>?????????????????????</p> <p class="wrapbox strict">strict:<br>??????????????????<br>?????????????????????</p> <p class="wrapbox anywhere">anywhere:<br>??????????????????<br>?????????????????????</p> </div> CSS .wrapbox { width: 10em; margin: 0.5em; white-space: normal; vertical-align: top; display: inline-block; } .auto { line-break: auto; } .loose { line-break: loose; } .normal { line-break: normal; } .strict { line-break: strict; } .anywhere { line-break: anywhere; } Result Specifications Specification Status Comment CSS Text Module Level 3The definition of 'line-br...
line-height-step - CSS: Cascading Style Sheets
When the property is set, line box heights are rounded up to the closest multiple of the unit. /* Point values */ line-height-step: 18pt; Syntax The line-height-step property is specified as any one of the following: a <length>. Values <length> The specified <length> is used in the calculation of the line box height step. Formal definition Initial value0Applies toblock containersInheritedyesComputed valueabsolute <length>Animation typediscrete Formal syntax <length> Examples Setting step unit for line box height In the following example, the height of line box in each paragraph is rounded up to the step unit. ...
... not fit into one step unit and thus occupies two, but it is still centered within the two step unit. :root { font-size: 12pt; --my-grid: 18pt; line-height-step: var(--my-grid); } h1 { font-size: 20pt; margin-top: calc(2 * var(--my-grid)); } The result of these rules is shown below in the following screenshot: Specifications Specification Status Comment CSS Rhythmic SizingThe definition of 'line-height-step' in that specification. Working Draft Initial definition. ...
mask-border-mode - CSS: Cascading Style Sheets
Syntax /* Keyword values */ mask-border-mode: luminance; mask-border-mode: alpha; /* Global values */ mask-border-mode: inherit; mask-border-mode: initial; mask-border-mode: unset; Values luminance The luminance values of the mask border image are used as the mask values. alpha The alpha values of the mask border image are used as the mask values. Formal definition Initial valuealphaApplies toall elements; In SVG, it applies to container elements excluding the defs element and all graphics elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax luminance | alpha Examples Basic usage This property doesn't yet seem to have support anywhere. ...
... Candidate Recommendation Initial definition ...
mask-border-outset - CSS: Cascading Style Sheets
Syntax /* <length> value */ mask-border-outset: 1rem; /* <number> value */ mask-border-outset: 1.5; /* vertical | horizontal */ mask-border-outset: 1 1.2; /* top | horizontal | bottom */ mask-border-outset: 30px 2 45px; /* top | right | bottom | left */ mask-border-outset: 7px 12px 14px 5px; /* Global values */ mask-border-outset: inherit; mask-border-outset: initial; mask-border-outset: unset; The mask-border-outset property may be specified as one, two, three, or four values. Each value is a <length> or <number>. Negative values are invalid. When one value is specified, it applies the same outset to all four sides. ...
... Candidate Recommendation Initial definition ...
mask-border-repeat - CSS: Cascading Style Sheets
Syntax /* Keyword value */ mask-border-repeat: stretch; mask-border-repeat: repeat; mask-border-repeat: round; mask-border-repeat: space; /* vertical | horizontal */ mask-border-repeat: round stretch; /* Global values */ mask-border-repeat: inherit; mask-border-repeat: initial; mask-border-repeat: unset; The mask-border-repeat property may be specified using one or two values chosen from the list of values below. When one value is specified, it applies the same behavior on all four sides. When two values are specified, the first applies to the top and bottom, the second to the left and right. ...
... Candidate Recommendation Initial definition ...
mask-border-slice - CSS: Cascading Style Sheets
These regions are used to form the components of an element's mask border. Syntax /* All sides */ mask-border-slice: 30%; /* vertical | horizontal */ mask-border-slice: 10% 30%; /* top | horizontal | bottom */ mask-border-slice: 30 30% 45; /* top | right | bottom | left */ mask-border-slice: 7 12 14 5; /* Using the `fill` keyword */ mask-border-slice: 10% fill 7 12; /* Global values */ mask-border-slice: inherit; mask-border-slice: initial; mask-border-slice: unset; The mask-border-slice property may be specified using one to four <number-percentage> values to represent the position of each image slice. ...
... Candidate Recommendation Initial defintion ...
mask-border-source - CSS: Cascading Style Sheets
The mask-border-slice property is used to divide the source image into regions, which are then dynamically applied to the final mask border. Syntax /* Keyword value */ mask-border-source: none; /* <image> values */ mask-border-source: url(image.jpg); mask-border-source: linear-gradient(to top, red, yellow); /* Global values */ mask-border-source: inherit; mask-border-source: initial; mask-border-source: unset; Values none No mask border is used. <image> Image reference to use for the mask border. ...
... Candidate Recommendation Initial definition ...
mask-border-width - CSS: Cascading Style Sheets
Syntax /* Keyword value */ mask-border-width: auto; /* <length> value */ mask-border-width: 1rem; /* <percentage> value */ mask-border-width: 25%; /* <number> value */ mask-border-width: 3; /* vertical | horizontal */ mask-border-width: 2em 3em; /* top | horizontal | bottom */ mask-border-width: 5% 15% 10%; /* top | right | bottom | left */ mask-border-width: 5% 2em 10% auto; /* Global values */ mask-border-width: inherit; mask-border-width: initial; mask-border-width: unset; The mask-border-width property may be specified using one, two, three, or four values chosen from the list of values below. When one value is specified, it applies the same width to all four sides. ...
... Candidate Recommendation Initial definition ...
max-inline-size - CSS: Cascading Style Sheets
It corresponds to the max-width or the max-height property depending on the value defined for writing-mode. If the writing mode is vertically oriented, the value of max-inline-size relates to the maximal height of the element, otherwise it relates to the maximal width of the element. It relates to max-block-size, which defines the other dimension 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. ...
...es the same values as the max-width and max-height properties. Formal definition Initial value0Applies tosame as width and heightInheritednoPercentagesinline-size of containing blockComputed valuesame as max-width and max-heightAnimation typea length, percentage or calc(); Formal syntax <'max-width'> Examples Setting max inline size in pixels HTML <p class="exampleText">Example text</p> CSS .exampleText { writing-mode: vertical-rl; background-color: yellow; block-size: 100%; max-inline-size: 200px; } Result Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'max-inline-size' in that specification. Editor's Draft Initial definition ...
min-block-size - CSS: Cascading Style Sheets
It corresponds to either the min-width or the min-height property, depending on the value of writing-mode. 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. ...
...e values as the min-width and min-height properties. Formal definition Initial value0Applies tosame as width and heightInheritednoPercentagesblock-size of containing blockComputed valuesame as min-width and min-heightAnimation typea length, percentage or calc(); Formal syntax <'min-width'> Examples Setting minimum block size for vertical text HTML <p class="exampleText">Example text</p> CSS .exampleText { writing-mode: vertical-rl; background-color: yellow; min-block-size: 200px; } Result Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'min-block-size' in that specification. Editor's Draft Initial definition ...
min-inline-size - CSS: Cascading Style Sheets
It corresponds to either the min-width or the min-height property, depending on the value of writing-mode. 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. ...
...values as the min-width and min-height properties. Formal definition Initial value0Applies tosame as width and heightInheritednoPercentagesinline-size of containing blockComputed valuesame as min-width and min-heightAnimation typea length, percentage or calc(); Formal syntax <'min-width'> Examples Setting minimum inline size for vertical text HTML <p class="exampleText">Example text</p> CSS .exampleText { writing-mode: vertical-rl; background-color: yellow; block-size: 5%; min-inline-size: 200px; } Result Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'min-inline-size' in that specification. Editor's Draft Initial definition ...
offset-anchor - CSS: Cascading Style Sheets
The offset-anchor CSS property specifies the point inside the box of an element travelling along an offset-path that is actually moving along the path. Syntax /* Keyword values */ offset-anchor: top; offset-anchor: bottom; offset-anchor: left; offset-anchor: right; offset-anchor: center; offset-anchor: auto; /* <percentage> values */ offset-anchor: 25% 75%; /* <length> values */ offset-anchor: 0 0; offset-anchor: 1cm 2cm; offset-anchor: 10ch 8em; /* Edge offsets values */ offset-anchor: bottom 10px right 20px; offset-anchor: right 3em bottom 10px; /* Global values */ offset-anchor: inherit; offset-anchor: initial; offset-anchor: unset; Values auto offset-anchor is given the same value as the element's transform-origin, unless offset-path is none, in which case it takes its value...
...fferent 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 path, respectively. ...
offset-rotate - CSS: Cascading Style Sheets
Note: Early versions of the spec called this property motion-rotation. Syntax /* Follow the path direction, with optional additional angle */ offset-rotate: auto; offset-rotate: auto 45deg; /* Follow the path direction but facing the opposite direction of `auto` */ offset-rotate: reverse; /* Keep a constant rotation regardless the position on the path */ offset-rotate: 90deg; offset-rotate: .5turn; auto The element is rotated by the angle of the direction of the offset-path, relative to the positive x-axis. This is the default value. ...
...t it faces the opposite direction. It is the same as specifying a value of auto 180deg. ...
outline-offset - 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. Syntax /* <length> values */ outline-offset: 3px; outline-offset: 0.2em; /* Global values */ outline-offset: inherit; outline-offset: initial; outline-offset: unset; Values <length> The width of the space between the element and its outline. A negative value places the outline inside the element. A value of 0 places the outline so that there is no space between it and the element. ...
...t and its outline is transparent. In other words, it is the same as the parent element's background. Formal definition Initial value0Applies toall elementsInheritednoComputed valueas specified, but with relative lengths converted into absolute lengthsAnimation typea length Formal syntax <length> Examples Setting outline offset in pixels HTML <p>Gallia est omnis divisa in partes tres.</p> CSS p { outline: 1px dashed red; outline-offset: 10px; background: yellow; border: 1px solid blue; margin: 15px; } Result Specifications Specification Status Comment CSS Basic User Interface Module Level 3The definition of 'outline-offset' in that specification. Recommendation Initial definition Browser compatibility The compatibility table i...
Guide to scroll anchoring - CSS: Cascading Style Sheets
exactly what you want -- content jumping is a poor experience for anyone. What if I need to debug it? If your page is not behaving well with scroll anchoring enabled, it is probably because some scroll event listener is not handling well the extra scrolling to compensate for the anchor node movement. You can check whether disabling scroll anchoring fixes the issue in Firefox by changing layout.css.scroll-anchoring.enabled to false in about:config. If it does, you can check what node is Firefox using as the anchor using the layout.css.scroll-anchoring.highlight switch. That will show a purple overlay on top of the anchor node. If one node doesn't seem appropriate to be an anchor, you can exclude it using overflow-anchor, as described below. What if I need to disable it? The specificatio...
... happen on the anchor node, or an ancestor of it, anchoring is suppressed. ...
overflow-anchor - CSS: Cascading Style Sheets
Scroll anchoring behavior is enabled by default in any browser that supports it. Therefore, changing the value of this property is typically only required if you are experiencing problems with scroll anchoring in a document or part of a document and need to turn the behavior off. Syntax /* Keyword values */ overflow-anchor: auto; overflow-anchor: none; /* Global values */ overflow-anchor: inherit; overflow-anchor: initial; overflow-anchor: unset; Values auto The element becomes a potential anchor when adjusting scroll position. none The element won't be selected as a potential anchor. ...
...d as a potential anchor. Formal definition Initial valueautoApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax auto | none Examples Prevent scroll anchoring To prevent scroll anchoring in a document, use the overflow-anchor property. body { overflow-anchor: none; } Specifications Specification Status Comment CSS Scroll Anchoring Module Level 1The definition of 'overflow-anchor' in that specification. Editor's Draft Initial definition. ...
overflow-inline - CSS: Cascading Style Sheets
This may be nothing, a scroll bar, or the overflow content. The overflow-inline property maps to overflow-y or overflow-x depending on the writing mode of the document. Syntax /* Keyword values */ overflow-inline: visible; overflow-inline: hidden; overflow-inline: scroll; overflow-inline: auto; /* Global values */ overflow-inline: inherit; overflow-inline: initial; overflow-inline: unset; The overflow-inline property is specified as a single keyword chosen from the list of values below. Values visible Content is not clipped and may be rendered outside the padding box's inline start and end edges. ...
...div> </li> <li><code>overflow-inline:visible</code> -- displays the text outside the box if needed <div id="div3"> ABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZ </div> </li> <li><code>overflow-inline:auto</code> -- on most browsers, equivalent to <code>scroll</code> <div id="div4"> ABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZ </div> </li> </ul> CSS #div1, #div2, #div3, #div4 { border: 1px solid black; width: 250px; margin-bottom: 12px; } #div1 { overflow-inline: hidden;} #div2 { overflow-inline: scroll;} #div3 { overflow-inline: visible;} #div4 { overflow-inline: auto;} Result Specifications Specification Status Comment CSS Overflow Module Level 3The definition of 'overflow-inline' in that specif...
overflow-wrap - 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. Note: In contrast to word-break, overflow-wrap will only create a break if an entire word cannot be placed on its own line without overflowing. The property was originally a nonstandard and unprefixed Microsoft extension called word-wrap, and was implemented by most browsers with the same name. ...
...excellent at Lake <em class="hyphens">Chargoggagoggmanchauggagoggchaubunagungamaugg</em>, though I've never been there myself. (<code>hyphens</code>, English rules)</p> <p class="hyphens" lang="de">They say the fishing is excellent at Lake <em class="hyphens">Chargoggagoggmanchauggagoggchaubunagungamaugg</em>, though I've never been there myself. (<code>hyphens</code>, German rules)</p> CSS p { width: 13em; margin: 2px; background: gold; } .ow-anywhere { overflow-wrap: anywhere; } .ow-break-word { overflow-wrap: break-word; } .word-break { word-break: break-all; } .hyphens { hyphens: auto; } Result Specifications Specification Status Comment CSS Text Module Level 3The definition of 'overflow-wrap' in that specification. ...
overscroll-behavior-x - CSS: Cascading Style Sheets
See overscroll-behavior for a full explanation. /* Keyword values */ overscroll-behavior-x: auto; /* default */ overscroll-behavior-x: contain; overscroll-behavior-x: none; /* Global values */ overscroll-behavior-x: inherit; overscroll-behavior-x: initial; overscroll-behavior-x: unset; Syntax The overscroll-behavior-x property is specified as a keyword chosen from the list of values below. Values auto The default scroll overflow behavior occurs as normal. contain Default scroll overflow behavior is observed inside the element this value is set on (e.g. ...
...oll boundary is reached, the whole page will begin to scroll, which is probably not what we want. To avoid this, you can set overscroll-behavior-x: contain on the inner box: main > div { height: 300px; width: 500px; overflow: auto; position: relative; top: 100px; left: 100px; overscroll-behavior-x: contain; } Specifications Specification Status Comment CSS Overscroll Behavior Module Level 1The definition of 'overscroll-behavior-x' in that specification. Working Draft ...
overscroll-behavior-y - CSS: Cascading Style Sheets
See overscroll-behavior for a full explanation. /* Keyword values */ overscroll-behavior-y: auto; /* default */ overscroll-behavior-y: contain; overscroll-behavior-y: none; /* Global values */ overscroll-behavior-y: inherit; overscroll-behavior-y: initial; overscroll-behavior-y: unset; Initial valueautoApplies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax The overscroll-behavior-y property is specified as a keyword chosen from the list of values below. Values auto The default scroll overflow behavior occurs as normal. ...
... Working Draft ...
overscroll-behavior - CSS: Cascading Style Sheets
It's a shorthand for overscroll-behavior-x and overscroll-behavior-y. /* Keyword values */ overscroll-behavior: auto; /* default */ overscroll-behavior: contain; overscroll-behavior: none; /* Two values */ overscroll-behavior: auto contain; /* Global values */ overscroll-behavior: inherit; overscroll-behavior: initial; overscroll-behavior: unset; By default, mobile browsers tend to provide a "bounce" effect or even a page refresh when the top or bottom of a page (or other scroll area) is reached. ...
...lso wanted to get rid of the standard overscroll effects when the contacts are scrolled to the top or bottom (e.g. Chrome on Android refreshes the page when you scroll past the top boundary). This can be prevented by setting overscroll-behavior: none on the <body> element: body { margin: 0; overscroll-behavior: none; } Specifications Specification Status Comment CSS Overscroll Behavior Module Level 1The definition of 'overscroll-behavior' in that specification. Working Draft ...
padding-block-end - 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. ...
...start, and padding-inline-end, which define the other paddings of the element. Formal definition Initial value0Applies toall elementsInheritednoPercentageslogical-width of containing blockComputed valueas <length>Animation typea length Formal syntax <'padding-left'> Examples Setting block end padding for vertical text HTML Content <div> <p class="exampleText">Example text</p> </div> CSS Content div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-lr; padding-block-end: 20px; background-color: #C8C800; } Result Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'padding-block-end' in that specification. Editor's Draft Initial def...
padding-block-start - 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. ...
...-inline-start, and padding-inline-end, which define the other paddings of the element. Formal definition Initial value0Applies toall elementsInheritednoPercentageslogical-width of containing blockComputed valueas <length>Animation typea length Formal syntax <'padding-left'> Examples Setting block start padding for vertical text HTML <div> <p class="exampleText">Example text</p> </div> CSS div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-lr; padding-block-start: 20px; background-color: #C8C800; } Result Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'padding-block-start' in that specification. Editor's Draft Initial definit...
padding-inline-end - 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. ...
...ng-block-end, and padding-inline-start, which define the other paddings of the element. Formal definition Initial value0Applies toall elementsInheritednoPercentageslogical-width of containing blockComputed valueas <length>Animation typea length Formal syntax <'padding-left'> Examples Setting inline end padding for vertical text HTML <div> <p class="exampleText">Example text</p> </div> CSS div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-lr; padding-inline-end: 20px; background-color: #C8C800; } Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'padding-inline-end' in that specification. Editor's Draft Initial definition ...
padding-inline-start - 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. ...
...ng-block-end, and padding-inline-end, which define the other paddings of the element. Formal definition Initial value0Applies toall elementsInheritednoPercentageslogical-width of containing blockComputed valueas <length>Animation typea length Formal syntax <'padding-left'> Examples Setting inline start padding for vertical text HTML <div> <p class="exampleText">Example text</p> </div> CSS div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-lr; padding-inline-start: 20px; background-color: #C8C800; } Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'padding-inline-start' in that specification. Editor's Draft Initial definition ...
page-break-after - CSS: Cascading Style Sheets
/* Keyword values */ page-break-after: auto; page-break-after: always; page-break-after: avoid; page-break-after: left; page-break-after: right; page-break-after: recto; page-break-after: verso; /* Global values */ page-break-after: inherit; page-break-after: initial; page-break-after: unset; This property applies to block elements that generate a box. It won't apply on an empty <div> that won't generate a box. Syntax Values auto Initial value. Automatic page breaks (neither forced nor forbidden). always Always force page breaks after the element. ...
...may also apply it to other elements like table-row elements.InheritednoComputed valueas specifiedAnimation typediscrete Formal syntax auto | always | avoid | left | right | recto | verso Examples Setting a page break after footnotes /* move to a new page after footnotes */ div.footnotes { page-break-after: always; } Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'recto and verso' in that specification. Editor's Draft Adds the values recto and verso. CSS Paged Media Module Level 3The definition of 'page-break-after' in that specification. Working Draft Extends the element that this property applies to table rows and table row groups. CSS Level 2 (Revision 1)The definition...
page-break-before - CSS: Cascading Style Sheets
This property applies to block elements that generate a box. It won't apply on an empty <div> that won't generate a box. /* Keyword values */ page-break-before: auto; page-break-before: always; page-break-before: avoid; page-break-before: left; page-break-before: right; page-break-before: recto; page-break-before: verso; /* Global values */ page-break-before: inherit; page-break-before: initial; page-break-before: unset; Syntax Values auto Initial value. Automatic page breaks (neither forced nor forbidden). ...
...r agents may also apply it to other elements like table-row elements.InheritednoComputed valueas specifiedAnimation typediscrete Formal syntax auto | always | avoid | left | right | recto | verso Examples Avoid a page break before the dic /* avoid page break before the div */ div.note { page-break-before: avoid; } Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'recto and verso' in that specification. Editor's Draft Adds the values recto and verso. CSS Paged Media Module Level 3The definition of 'page-break-before' in that specification. Working Draft Extends the element that this property applies to table rows and table row groups. CSS Level 2 (Revision 1)The definitio...
paint-order - CSS: Cascading Style Sheets
Syntax /* Normal */ paint-order: normal; /* Single values */ paint-order: stroke; /* draw the stroke first, then fill and markers */ paint-order: markers; /* draw the markers first, then fill and stroke */ /* Multiple values */ paint-order: stroke fill; /* draw the stroke first, then the fill, then the markers */ paint-order: markers stroke fill; /* draw markers, then stroke, then fill */ If no value is specified, the default paint order is fill, stroke, markers. When one value is specified, that one is painted first, followed by the other two in their default order relative to one another. ...
... Candidate Recommendation Initial definition. ...
repeating-radial-gradient() - CSS: Cascading Style Sheets
It is similar to radial-gradient() and takes the same arguments, but it repeats the color stops infinitely in all directions so as to cover its entire container, similar to repeating-linear-gradient() . The function's result is an object of the <gradient> data type, which is a special kind of <image>. 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 elliptical gradient will be centered 20% from the top left, and will repeat 10 times between the center and the farthest corner (the bottom right corner). Browsers supporting multi position color stops will display a red and green striped ellipse. Browsers not supporting the syntax yet will see a gradient that goes from red to black and then from blue to green. Note: Please see Using CSS gradients for more examples. Specifications Specification Status Comment CSS Images Module Level 3The definition of 'repeating-radial-gradient()' in that specification. Candidate Recommendation Initial definition. ...
ruby-position - CSS: Cascading Style Sheets
It can be position over the element (over), under it (under), or between the characters, on their right side (inter-character). /* Keyword values */ ruby-position: over; ruby-position: under; ruby-position: inter-character; /* Global values */ ruby-position: inherit; ruby-position: initial; ruby-position: unset; Syntax Values over Is a keyword indicating that the ruby has to be placed over the main text for horizontal scripts and right to it for vertical scripts. under Is a keyword indicating that the ruby has to be placed under the main text for horizontal scripts and left to it for vertical scripts. ...
...character Is a keyword indicating that the ruby has to be placed between the different characters. Formal definition Initial valueoverApplies toruby annotations containersInheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax over | under | inter-character Examples Ruby positioned over the text HTML <ruby> <rb>????</rb> <rp>(</rp><rt>?????</rt><rp>)</rp> </ruby> CSS ruby { ruby-position:over; } Result Ruby positioned under the text HTML <ruby> <rb>????</rb> <rp>(</rp><rt>?????</rt><rp>)</rp> </ruby> CSS ruby { ruby-position:under; } Result Specifications Specification Status Comment CSS Ruby Layout Module Level 1The definition of 'ruby-position' in that specification. Working Draft Initial definitio...
scroll-margin-block - CSS: Cascading Style Sheets
scroll-margin-block shorthand property sets the scroll margins of an element in the block dimension. 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: scroll-margin-block-end scroll-margin-block-start Syntax /* <length> values */ scroll-margin-block: 10px; scroll-margin-block: 1em .5em ; /* Global values */ scroll-margin-block: inherit; scroll-margin-block: initial; scroll-margin-block: unset; Values <length> An outset from the corresponding edge of the scroll container. Description The scroll-margin values represen...
... Candidate Recommendation Initial definition ...
scroll-margin-inline-end - CSS: Cascading Style Sheets
the interactive example above, except that here we'll 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 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. the outer container is styled like this: .scroller { text-align: left; width: 250px; height: 250px; overflow-x: scroll; display: flex; box-sizing: 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 ...
... Candidate Recommendation Initial definition ...
scroll-margin-inline-start - CSS: Cascading Style Sheets
o the interactive example above, except that here we'll 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. the outer container is styled like this: .scroller { text-align: left; width: 250px; height: 250px; overflow-x: scroll; display: flex; box-sizing: 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 ...
... Candidate Recommendation Initial definition ...
scroll-padding-block - CSS: Cascading Style Sheets
crollport: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targeted element and the edges of the scrollport. ...
... value is more appropriate. Formal definition Initial valueautoApplies toscroll containersInheritednoPercentagesrelative to the scroll container's scrollportComputed valueas specifiedAnimation typeby computed value type Formal syntax [ auto | <length-percentage> ]{1,2}where <length-percentage> = <length> | <percentage> Specifications Specification Status Comment CSS Scroll Snap Module Level 1The definition of 'scroll-padding-block' in that specification. Candidate Recommendation Initial definition ...
scroll-padding-inline - CSS: Cascading Style Sheets
rollport: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. ...
... value is more appropriate. Formal definition Initial valueautoApplies toscroll containersInheritednoPercentagesrelative to the scroll container's scrollportComputed valueas specifiedAnimation typeby computed value type Formal syntax [ auto | <length-percentage> ]{1,2}where <length-percentage> = <length> | <percentage> Specifications Specification Status Comment CSS Scroll Snap Module Level 1The definition of 'scroll-padding-inline' in that specification. Candidate Recommendation Initial definition ...
scroll-padding - CSS: Cascading Style Sheets
rollport: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars), or simply to put more breathing room between a targeted element and the edges of the scrollport. ...
... value is more appropriate. Formal definition Initial valueautoApplies toscroll containersInheritednoPercentagesrelative to the scroll container's scrollportComputed valueas specifiedAnimation typeby computed value type Formal syntax [ auto | <length-percentage> ]{1,4}where <length-percentage> = <length> | <percentage> Specifications Specification Status Comment CSS Scroll Snap Module Level 1The definition of 'scroll-padding' in that specification. Candidate Recommendation Initial definition ...
scroll-snap-coordinate - CSS: Cascading Style Sheets
/* Keyword value */ scroll-snap-coordinate: none; /* <position> values */ scroll-snap-coordinate: 50px 50px; /* Single coordinate */ scroll-snap-coordinate: 100px 100px, 100px bottom; /* Multiple coordinates */ /* Global values */ scroll-snap-coordinate: inherit; scroll-snap-coordinate: initial; scroll-snap-coordinate: unset; If the element has been transformed, the snap coordinates are likewise transformed, thus aligning the snap points with the element as it is displayed. ...
... <div>2</div> <div>3</div> </div> </div> <div> <p>At coordinate (25, 0)</p> <div class="scrollContainer coordinate25"> <div>1</div> <div>2</div> <div>3</div> </div> </div> <div> <p>At coordinate (50, 0)</p> <div class="scrollContainer coordinate50"> <div>1</div> <div>2</div> <div>3</div> </div> </div> </div> CSS #container { display: flex; } #container > div:nth-child(-n+2) { margin-right: 20px; } .scrollContainer { width: 100px; overflow: auto; white-space: nowrap; scroll-snap-type: mandatory; font-size: 0; } .scrollContainer > div { width: 100px; height: 100px; display: inline-block; line-height: 100px; text-align: center; font-size: 50px; } .coordinate0 > div { scroll-...
scroll-snap-destination - CSS: Cascading Style Sheets
/* <position> value */ scroll-snap-destination: 400px 600px; /* Global values */ scroll-snap-destination: inherit; scroll-snap-destination: initial; scroll-snap-destination: unset; Syntax Values <position> Specifies the offset of the snap destination from the start edge of the scroll container's visual viewport. The first value gives the x coordinate of the snap destination, the second value its y coordinate. ...
... <div>2</div> <div>3</div> </div> </div> <div> <p>At coordinate (25, 0)</p> <div class="scrollContainer destination25"> <div>1</div> <div>2</div> <div>3</div> </div> </div> <div> <p>At coordinate (50, 0)</p> <div class="scrollContainer destination50"> <div>1</div> <div>2</div> <div>3</div> </div> </div> </div> CSS #container { display: flex; } #container > div:nth-child(-n+2) { margin-right: 20px; } .scrollContainer { width: 100px; overflow: auto; white-space: nowrap; scroll-snap-points-x: repeat(100%); scroll-snap-type: mandatory; scroll-snap-destination: 20px 0; font-size: 0; } .destination0 { scroll-snap-destination: 0 0; } .destination25 { scroll-snap-destination: 25px 0; } ...
scroll-snap-points-x - CSS: Cascading Style Sheets
/* Keyword value */ scroll-snap-points-x: none; /* Repeating snap points */ scroll-snap-points-x: repeat(400px); /* Global values */ scroll-snap-points-x: inherit; scroll-snap-points-x: initial; scroll-snap-points-x: unset; Syntax Values none The scroll container does not define any snap points. Elements within the scroll container may still define snap points on behalf of the scroll container. repeat(<length-percentage>) Defines an interval at which snap points are defined, starting from the container's relevant start edge. Only positive lengths are allowed. ...
...ve to same axis of the padding-box of the scroll containerComputed valueas specified, but with relative lengths converted into absolute lengthsAnimation typediscrete Formal syntax none | repeat( <length-percentage> )where <length-percentage> = <length> | <percentage> Examples Setting horizontal scroll snap points HTML <div id="container"> <div>1</div> <div>2</div> <div>3</div> </div> CSS #container { width: 200px; overflow: auto; white-space: nowrap; scroll-snap-points-x: repeat(100%); scroll-snap-type: mandatory; font-size: 0; } #container > div { width: 200px; height: 200px; display: inline-block; line-height: 200px; text-align: center; font-size: 100px; } #container > div:nth-child(even) { background-color: #87ea87; } #container > div:nth-child(od...
scroll-snap-points-y - CSS: Cascading Style Sheets
/* Keyword value */ scroll-snap-points-y: none; /* Repeated snap points */ scroll-snap-points-y: repeat(400px); /* Global values */ scroll-snap-points-y: inherit; scroll-snap-points-y: initial; scroll-snap-points-y: unset; Syntax Values none The scroll container does not define any snap points. Elements within the scroll container may still define snap points on behalf of the scroll container. repeat(<length-percentage>) Defines an interval at which snap points are defined, starting from the container's relevant start edge. Only positive lengths are allowed. ...
...tive to same axis of the padding-box of the scroll containerComputed valueas specified, but with relative lengths converted into absolute lengthsAnimation typediscrete Formal syntax none | repeat( <length-percentage> )where <length-percentage> = <length> | <percentage> Examples Setting vertical scroll snap points HTML <div id="container"> <div>1</div> <div>2</div> <div>3</div> </div> CSS #container { height: 200px; width: 220px; overflow-x: hidden; overflow-y: auto; scroll-snap-points-y: repeat(200px); scroll-snap-type: mandatory; font-size: 0; } #container > div { width: 200px; height: 200px; display: inline-block; line-height: 200px; text-align: center; font-size: 100px; } #container > div:nth-child(even) { background-color: #87EA87; } #container...
scrollbar-width - CSS: Cascading Style Sheets
Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard greens dandelion okra wakame ...
...inde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo melon azuki bean garlic. Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini.</div> Result Specifications Specification Status Comment CSS Scrollbars Level 1The definition of 'scrollbar-width' in that specification. Working Draft Initial Definition ...
shape-margin - 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 margin lets you adjust the distance between the edges of the shape (the float element) and the surrounding content. ...
...ht, and the economic laws of society are uncertain to every one except some individual who attempts to set them forth; but before the world was fashioned the square on the hypotenuse was equal to the sum of the squares on the other two sides of a right triangle, and it will be so after this world is dead; and the inhabitant of Mars, if he exists, probably knows its truth as we know it.</section> CSS section { max-width: 400px; } .shape { float: left; width: 150px; height: 150px; background-color: maroon; clip-path: polygon(0 0, 150px 150px, 0 150px); shape-outside: polygon(0 0, 150px 150px, 0 150px); shape-margin: 20px; } Result Specifications Specification Status Comment CSS Shapes Module Level 1The definition of 'shape-margin' in that spec...
symbols() - CSS: Cascading Style Sheets
Web › CSS › symbols
Unlike @counter-style, symbols() is anonymous (i.e., it can only be used once). Although less powerful, it is shorter and easier to write than @counter-style. 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. ...
...alue numbering system 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. ...
tab-size - CSS: Cascading Style Sheets
Web › CSS › tab-size
Syntax /* <integer> values */ tab-size: 4; tab-size: 0; /* <length> values */ tab-size: 10px; tab-size: 2em; /* Global values */ tab-size: inherit; tab-size: initial; tab-size: unset; Values <integer> A multiple of the advance width of the space character (U+0020) to be used as the width of tabs. Must be nonnegative. <length> The width of tabs. Must be nonnegative. ...
...e indentation */ } Comparing to the default size This example compares a default tab size with a custom tab size. Note that white-space is set to pre to prevent the tabs from collapsing. HTML <p>no tab</p> <p>&#0009;default tab size of 8 characters wide</p> <p class="custom">&#0009;custom tab size of 3 characters wide</p> <p>&nbsp;&nbsp;&nbsp;3 spaces, equivalent to the custom tab size</p> CSS p { white-space: pre; } .custom { tab-size: 3; -moz-tab-size: 3; } Result Specifications Specification Status Comment CSS Text Module Level 3The definition of 'tab-size' in that specification. Working Draft Initial definition ...
table-layout - 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. Syntax /* Keyword values */ table-layout: auto; table-layout: fixed; /* Global values */ table-layout: inherit; table-layout: initial; table-layout: unset; Values auto By default, most browsers use an automatic table layout algorithm. The widths of the table and its cells are adjusted to fit the content. fixed Table and column widths are set by the widths of table and col elements or by the width of the first row of cells. ...
...idth. The text-overflow property is used to apply an ellipsis to words that are too long to fit. If the table layout were auto, the table would grow to accomodate its contents, despite the specified width. HTML <table> <tr><td>Ed</td><td>Wood</td></tr> <tr><td>Albert</td><td>Schweitzer</td></tr> <tr><td>Jane</td><td>Fonda</td></tr> <tr><td>William</td><td>Shakespeare</td></tr> </table> CSS table { table-layout: fixed; width: 120px; border: 1px solid red; } td { border: 1px solid blue; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } Result Specifications Specification Status Comment CSS Level 2 (Revision 1)The definition of 'table-layout' in that specification. Recommendation Initial definition. ...
text-align-last - 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. ...
...rsInheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax auto | start | end | left | right | center | justify Examples Justifying the last line <p>Integer elementum massa at nulla placerat varius. Suspendisse in libero risus, in interdum massa. Vestibulum ac leo vitae metus faucibus gravida ac in neque. Nullam est eros, suscipit sed dictum quis, accumsan a ligula.</p> CSS p { font-size: 1.4em; text-align: justify; text-align-last: center; } Results Specifications Specification Status Comment CSS Text Module Level 3The definition of 'text-align-last' in that specification. Working Draft Initial definition ...
text-decoration-color - CSS: Cascading Style Sheets
The text-decoration-color CSS property sets the color of decorations added to text by text-decoration-line. The color applies to decorations, such as underlines, overlines, strikethroughs, and wavy lines like those used to mark misspellings, in the scope of the property's value. 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. CSS does not provide a direct mechanism for specifying a unique color for each line type. This effect can nevertheless be achieved by nesting elements, applying a different line type to each element (with the text-decoration-line property), and specifying the line color (with text-decoration-...
... Candidate Recommendation Initial definition. The text-decoration property is now a shorthand to define multiple related properties. ...
text-decoration-skip - CSS: Cascading Style Sheets
It controls all text decoration lines drawn by the element and also any text decoration lines drawn by its ancestors. Note: Most other browsers are converging on supporting the simpler text-decoration-skip-ink property. ...
...ions imposed by an ancestor; a decorating box never draws over its own box decoration. Formal definition Initial valueobjectsApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax none | [ objects | [ spaces | [ leading-spaces | trailing-spaces ] ] | edges | box-decoration ] Examples Skipping edges HTML <p>Hey, grab a cup of <em>coffee!</em></p> CSS p { margin: 0; font-size: 3em; text-decoration: underline; text-decoration-skip: edges; } Result Specifications Specification Status Comment CSS Text Decoration Module Level 4The definition of 'text-decoration-skip' in that specification. Working Draft Initial definition ...
text-emphasis-position - CSS: Cascading Style Sheets
Like ruby text, if there isn't enough room for emphasis marks, the line height is increased. /* Initial value */ text-emphasis-position: over right; /* Keywords value */ text-emphasis-position: over left; text-emphasis-position: under right; text-emphasis-position: under left; text-emphasis-position: left over; text-emphasis-position: right under; text-emphasis-position: left under; /* Global values */ text-emphasis-position: inherit; text-emphasis-position: initial; text-emphasis-position: unset; Syntax Values over Draw marks over the text in horizontal writing mode. under Draw marks under the text in horizontal writing mode. ...
...mphasis: 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 Comment CSS Text Decoration Module Level 3The definition of 'text-emphasis' in that specification. Candidate Recommendation Initial definition ...
text-emphasis-style - CSS: Cascading Style Sheets
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. ...
...onsisting 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 ...
text-justify - CSS: Cascading Style Sheets
text-justify: none; text-justify: auto; text-justify: inter-word; text-justify: inter-character; text-justify: distribute; /* Deprecated value */ Syntax The text-justify property is specified as a single keyword chosen from the list of values below. Values none The text justification is turned off. This has the same effect as not setting text-align at all, although it is useful if you need to turn justification on and off for some reason. ...
... Working Draft ...
text-orientation - CSS: Cascading Style Sheets
It only affects text in vertical mode (when writing-mode is not horizontal-tb). It is useful for controlling the display of languages that use vertical script, and also for making vertical table headers. 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. ...
...eads to use the value of the deprecated SVG properties glyph-orientation-vertical and glyph-orientation-horizontal. Formal definition Initial valuemixedApplies toall elements, except table row groups, rows, column groups, and columnsInheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax mixed | upright | sideways Examples HTML <p>Lorem ipsum dolet semper quisquam.</p> CSS p { writing-mode: vertical-rl; text-orientation: upright; } Result Specifications Specification Status Comment CSS Writing Modes Module Level 3The definition of 'text-orientation' in that specification. Proposed Recommendation Initial definition. ...
text-underline-offset - CSS: Cascading Style Sheets
text-underline-offset is not part of the text-decoration shorthand. While an element can have multiple text-decoration lines, text-underline-offset only impacts underlining, and not other possible line decoration options such as overline or line-through. ...
...s some text with an offset wavy red underline!</p> <br> <p class="twolines">This text has lines both above and below it. Only the bottom one is offset.</p> p { text-decoration: underline wavy red; text-underline-offset: 1em; } .twolines { text-decoration-color: purple; text-decoration-line: underline overline; } Specifications Specification Status Comment CSS Text Decoration Module Level 4The definition of 'text-underline-offset' in that specification. Working Draft Initial definition. ...
<time-percentage> - CSS: Cascading Style Sheets
Syntax Refer to the documentation for <time> and <percentage> for details of the individual syntaxes allowed by this type. Examples Use in calc() Where a <time-percentage> is specified as an allowable type, this means that the percentage resolves to a time and therefore can be used in a calc() expression. ...
... Zero with a leading + and a unit -0ms Zero with a leading - and a unit Invalid times 0 Although unitless zero is allowed for <length>s, it's invalid for <time>s. 12.0 This is a <number>, not a <time>, because it's missing a unit. 7 ms No space is allowed between the number and the unit. Specifications Specification Status Comment CSS Values and Units Module Level 4The definition of '<time-percentage>' in that specification. Editor's Draft CSS Values and Units Module Level 3The definition of '<time-percentage>' in that specification. Candidate Recommendation Defines <time-percentage>. Adds calc() ...
<time> - CSS: Cascading Style Sheets
Web › CSS › time
It is used in animation, transition, and related properties. Syntax The <time> data type consists of a <number> followed by one of the units listed below. Optionally, it may be preceded by a single + or - sign. As with all dimensions, there is no space between the unit literal and the number. Note: Although the number 0 is always the same regardless of unit, the unit may not be omitted. In other words, 0 is invalid and does not represent 0s or 0ms. Units s Represents a time in seconds. Examples: 0s, 1.5s, -60s. ms Represents a time in milliseconds. Examples: 0ms, 150.25ms, -60000ms. Note: Conversion between s and ms follows the logical 1s = 1000ms. ...
... Zero with a leading + and a unit -0ms Zero with a leading - and a unit Invalid times 0 Although unitless zero is allowed for <length>s, it's invalid for <time>s. 12.0 This is a <number>, not a <time>, because it's missing a unit. 7 ms No space is allowed between the number and the unit. Specifications Specification Status Comment CSS Values and Units Module Level 4The definition of '<time>' in that specification. Editor's Draft CSS Values and Units Module Level 3The definition of '<time>' in that specification. Candidate Recommendation Normative definition of s and ms. CSS Level 2 (Revision 1)The definition of '<time>' in that specification. Recommendation Informal definition of s and ms. ...
touch-action - CSS: Cascading Style Sheets
/* Keyword values */ touch-action: auto; touch-action: none; touch-action: pan-x; touch-action: pan-left; touch-action: pan-right; touch-action: pan-y; touch-action: pan-up; touch-action: pan-down; touch-action: pinch-zoom; touch-action: manipulation; /* Global values */ touch-action: inherit; touch-action: initial; touch-action: unset; By default, panning (scrolling) and pinching gestures are handled exclusively by the browser. An application using Pointer events will receive a pointercancel event when the browser starts handling a touch gesture. ...
...Animation typediscrete Formal syntax auto | none | [ [ pan-x | pan-left | pan-right ] | [ pan-y | pan-up | pan-down ] | pinch-zoom ] | manipulation Examples Disabling all gestures The most common usage is to disable all gestures on an element (and its non-scrollable descendants) that provides its own dragging and zooming behavior - such as a map or game surface. HTML <div id="map"></div> CSS #map { height: 400px; width: 400px; background: blue; touch-action: none; } Result Specifications Specification Status Comment Compatibility StandardThe definition of 'touch-action' in that specification. Living Standard Added pinch-zoom property value. Pointer Events - Level 3The definition of 'touch-action' in that specification. Edit...
scaleX() - CSS: Cascading Style Sheets
Its result is a <transform-function> data type. It modifies the abscissa of each element point by a constant 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. scaleX(-1) defines an axial symmetry, with a vertical axis passing through the origin (as specified by the transform-origin property). Note: scaleX(sx) is equivalent to scale(sx, 1) or scale3d(sx, 1, 1). Syntax scaleX(s) Values s Is a <number> representing the scaling factor to apply on the abscissa of each point of the element. ...
...resenting the scaling factor to apply on the abscissa of each point of the element. Cartesian coordinates on R2 Homogeneous coordinates on RP2 Cartesian coordinates on R3 Homogeneous coordinates on RP3 s0 01 s00010001 s00010001 s000010000100001 [s 0 0 1 0 0] Examples HTML <div>Normal</div> <div class="scaled">Scaled</div> CSS div { width: 80px; height: 80px; background-color: skyblue; } .scaled { transform: scaleX(0.6); background-color: pink; } Result Specifications Specification Status Comment CSS Transforms Level 1The definition of 'scaleX()' in that specification. Working Draft Initial definition ...
scaleY() - CSS: Cascading Style Sheets
Its result is a <transform-function> data type. It modifies the ordinate of each element point by a constant 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. scaleY(-1) defines an axial symmetry, with a horizontal axis passing through the origin (as specified by the transform-origin property). Note: scaleY(sy) is equivalent to scale(1, sy) or scale3d(1, sy, 1). ...
...epresenting the scaling factor to apply on the ordinate of each point of the element. Cartesian coordinates on R2 Homogeneous coordinates on RP2 Cartesian coordinates on R3 Homogeneous coordinates on RP3 10 0s 1000s0001 1000s0001 10000s0000100001 [1 0 0 s 0 0] Examples HTML <div>Normal</div> <div class="scaled">Scaled</div> CSS div { width: 80px; height: 80px; background-color: skyblue; } .scaled { transform: scaleY(0.6); background-color: pink; } Result Specifications Specification Status Comment CSS Transforms Level 1The definition of 'scaleY()' in that specification. Working Draft Initial definition ...
skewX() - CSS: Cascading Style Sheets
Its result is a <transform-function> data type. 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 transformation is a shear mapping (transvection) that distorts each point within an element by a certain angle in the horizontal direction. The abscissa coordinate of each point is modified by a value proportionate to the specified angle and the distance to the origin; thus, the farther from the origin a point is, the greater will be the value added it. ...
...ng the angle to use to distort the element along the abscissa. Cartesian coordinates on R2 Homogeneous coordinates on RP2 Cartesian coordinates on R3 Homogeneous coordinates on RP3 1tan(a)01 1tan(a)0010001 1tan(a)0010001 1tan(a)00010000100001 [1 0 tan(a) 1 0 0] Examples HTML <div>Normal</div> <div class="skewed">Skewed</div> CSS div { width: 80px; height: 80px; background-color: skyblue; } .skewed { transform: skewX(10deg); /* Equal to skew(10deg) */ background-color: pink; } Result Specifications Specification Status Comment CSS Transforms Level 1The definition of 'skewX()' in that specification. Working Draft Initial definition ...
skewY() - CSS: Cascading Style Sheets
Its result is a <transform-function> data type. 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 transformation is a shear mapping (transvection) that distorts each point within an element by a certain angle in the vertical direction. The ordinate coordinate of each point is modified by a value proportionate to the specified angle and the distance to the origin; thus, the farther from the origin a point is, the greater will be the value added it. ...
...ng the angle to use to distort the element along the ordinate. Cartesian coordinates on R2 Homogeneous coordinates on RP2 Cartesian coordinates on R3 Homogeneous coordinates on RP3 10tan(a)1 100tan(a)10001 100tan(a)10001 1000tan(a)10000100001 [1 tan(a) 0 1 0 0] Examples HTML <div>Normal</div> <div class="skewed">Skewed</div> CSS div { width: 80px; height: 80px; background-color: skyblue; } .skewed { transform: skewY(40deg); background-color: pink; } Result Specifications Specification Status Comment CSS Transforms Level 1The definition of 'skewY()' in that specification. Working Draft Initial definition ...
translateX() - CSS: Cascading Style Sheets
Its result is a <transform-function> data type. Note: translateX(tx) is equivalent to translate(tx, 0) or translate3d(tx, 0, 0). Syntax /* <length-percentage> values */ transform: translateX(200px); transform: translateX(50%); Values <length-percentage> Is a <length> or <percentage> representing the abscissa of the translating vector. A percentage value refers to the width of the reference box defined by the transform-box property. ...
...inates on R3 Homogeneous coordinates on RP3 A translation is not a linear transformation in R2 and can't be represented using a Cartesian-coordinate matrix. 10t010001 10t010001 100t010000100001 [1 0 0 1 t 0] Formal syntax translateX(<length-percentage>) Examples HTML <div>Static</div> <div class="moved">Moved</div> <div>Static</div> CSS div { width: 60px; height: 60px; background-color: skyblue; } .moved { transform: translateX(10px); /* Equal to translate(10px) */ background-color: pink; } Result Specifications Specification Status Comment CSS Transforms Level 1The definition of 'translateX()' in that specification. Working Draft Initial definition ...
translateY() - CSS: Cascading Style Sheets
Its result is a <transform-function> data type. Note: translateY(ty) is equivalent to translate(0, ty) or translate3d(0, ty, 0). Syntax /* <length-percentage> values */ transform: translateY(200px); transform: translateY(50%); Values <length-percentage> The value is a <length> or <percentage> representing the ordinate of the translating vector. A percentage value refers to the height of the reference box defined by the transform-box property. ...
...nates on R3 Homogeneous coordinates on RP3 A translation is not a linear transformation in R2 and can't be represented using a Cartesian-coordinate matrix. 10001t001 10001t001 1000010t00100001 [1 0 0 1 0 t] Formal syntax translateY(<length-percentage>) Examples HTML <div>Static</div> <div class="moved">Moved</div> <div>Static</div> CSS div { width: 60px; height: 60px; background-color: skyblue; } .moved { transform: translateY(10px); background-color: pink; } Result Specifications Specification Status Comment CSS Transforms Level 1The definition of 'translateY()' in that specification. Working Draft Initial definition ...
transform-origin - 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 transformation origin is the point around which a transformation is applied. For example, the transformation origin of the rotate() function is the center of rotation. This property is applied by first translating the element by the value of the property, then applying the element's transform, then translating by the negated property value. ...
... Working Draft ...
transition-property - 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. Note: The set of properties that can be animated is subject to change. As such, you should avoid including any properties in the list that don't currently animate, as someday they might, causing unexpected results. If you specify a shorthand property (e.g., background), all of its longhand sub-properties that can be animated will be. ...
...tifying the property to which a transition effect should be applied when its value changes. Formal definition Initial valueallApplies toall elements, ::before and ::after pseudo-elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax none | <single-transition-property>#where <single-transition-property> = all | <custom-ident> Examples There are several examples of CSS transitions included in the main CSS transitions article. Specifications Specification Status Comment CSS TransitionsThe definition of 'transition-property' in that specification. Working Draft Initial definition ...
Comparison of CSS Selectors and XPath - XPath
XSLT/XPath Reference: XSLT elements, EXSLT functions, XPath functions, XPath axes This article seeks to document the difference between CSS Selectors and XPath for web developers to be able to better choose the right tool for the right job. ...
... XSLT/XPath Reference: XSLT elements, EXSLT functions, XPath functions, XPath axes This article seeks to document the difference between CSS Selectors and XPath for web developers to be able to better choose the right tool for the right job. ...
CSS preprocessor - MDN Web Docs Glossary: Definitions of Web-related terms
A CSS preprocessor is a program that lets you generate CSS from the preprocessor's own unique syntax. There are many CSS preprocessors to choose from, however most CSS preprocessors will add some features that don't exist in pure CSS, such as mixin, nesting selector, inheritance selector, and so on. These features make the CSS structure more readable and easier to maintain. To use a CSS preprocessor, you must install a CSS compiler on your web server; Or use the CSS preprocessor to compile on the development environment, and then upload compiled CSS file to the web server. ...
Descriptor (CSS) - MDN Web Docs Glossary: Definitions of Web-related terms
At-rules may have one or multiple descriptors. ...
CSS -moz-bool-pref() @supports function
if a boolean preference is enabled. ...
Investigating CSS Performance
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. ...
GetComputedStyleCSSValue
...
Edit CSS filters - Firefox Developer Tools
You can edit these lines, remove them individually, or drag the effects to change the order in which they are applied. You can also add new effects by selecting an effect from the dropdown list at the bottom of the dialog. Once you have selected the effect you want to add, click the plus sign (+) to the right of the dropdown list. Once you have added an effect, enter the settings you want and then press Enter to update the effect. The change will be apparent as soon as youpress Enter. ...
CSS.paintWorklet (Static property) - Web APIs
Web › API › CSS › paintWorklet
paintWorklet 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. Syntax var worklet = CSS.paintWorklet; Value The PaintWorklet object. Examples The following example demonstrates loading a PaintWorklet from its js file and does so by feature detection. <script> if ('paintWorklet' in CSS) { CSS.paintWorklet.addModule('checkerboard.js'); } </script> Specifications Specification Status Comment CSS Painting API Level 1The definition of 'paintWorklet' in that specification. Working Draft Initial definition. ...
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. ...
CSSNumericValue.add() - Web APIs
The add() method of the CSSNumericValue interface adds a supplied number to the CSSNumericValue. Syntax var cssMathSum = CSSNumericValue.add(double | CSSNumericValue); Parameters number either a Number or a CSSNumericValue. Return value A CSSMathSum Exceptions TypeError Indicates that an invalid type was passed to the method. Examples let mathSum = CSS.px("23").add(CSS.percent("4")).add(CSS.cm("3")).add(CSS.in("9")); // Prints "calc(23px + 4% + 3cm + 9in)" console.log(mathSum.toString()); Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'add' in that specification. Working Draft Initial definition. ...
CSSNumericValue.div() - Web APIs
The div() method of the CSSNumericValue interface divides the CSSNumericValue by the supplied value. Syntax var cssNumericValue = CSSNumericValue.div(number); Parameters number Either a Number or a CSSNumericValue. Return value A CSSMathProduct. Exceptions TypeError Indicates that an invalid type was passed to the method. Examples let mathProduct = CSS.px("24").div(CSS.percent("4")); // Prints "calc(24px / 4%)" mathProduct.toString(); Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'div' in that specification. Working Draft Initial definition. ...
CSSNumericValue.mul() - Web APIs
The mul() method of the CSSNumericValue interface multiplies the CSSNumericValue by the supplied value. Syntax var cssMathProduct = CSSNumericValue.mul(number); Parameters number Either a Number or a CSSNumericValue. Return value A CSSMathProduct Exceptions TypeError Indicates that an invalid type was passed to the method. Examples let mathSum = CSS.px("23").mul(CSS.percent("4")).mul(CSS.cm("3")).mul(CSS.in("9")); // Prints "calc(23px * 4% * 3cm * 9in)" console.log(mathSum.toString()); Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'mul' in that specification. Working Draft Initial definition. ...
CSSNumericValue.parse() - Web APIs
The parse() method of the CSSNumericValue interface converts a value string into an object whose members are value and the units. Syntax var cssNumericValue = CSSNumericValue.parse(cssText); Parameters cssText a string containing numeric and unit parts. Return value A CSSNumericValue. Exceptions SyntaxError TBD Examples The following returns a CSSUnitValue object with a unit property equal to "px" and a value property equal to 42. let numValue = CSSNumericValue.parse("42.0px"); Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'parse' in that specification. Working Draft Initial definition. ...
CSSNumericValue.sub() - Web APIs
The sub() method of the CSSNumericValue interface subtracts a supplied number from the CSSNumericValue. Syntax var cssMathSum = CSSNumericValue.sub(number); Parameters number Either a Number or a CSSMathSum. Return value A CSSMathSum Exceptions TypeError Indicates that an invalid type was passed to the method. Examples let mathSum = CSS.px("23").sum(CSS.percent("4")).sum(CSS.cm("3")).sum(CSS.in("9")); // Prints "calc(23px - 4% - 3cm - 9in)" console.log(mathSum.toString()); And/or include a list of links to useful code samples that live elsewhere: Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'sub' in that specification. Working Draft Initial definition. ...
CSSNumericValue.sum() - Web APIs
The sub() method of the CSSNumericValue interface subtracts a supplied number from the CSSNumericValue. Syntax var cssMathSum = CSSNumericValue.sub(number); Parameters number Either a Number or a CSSMathSum Return value A CSSMathSum Exceptions TypeError Indicates that an invalid type was passed to the method. Examples let mathSum = CSS.px("23").sum(CSS.percent("4")).sum(CSS.cm("3")).sum(CSS.in("9")); // Prints "calc(23px - 4% - 3cm - 9in)" console.log(mathSum.toString()); And/or include a list of links to useful code samples that live elsewhere: Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'sub' in that specification. Working Draft Initial definition. ...
CSSNumericValue.to() - Web APIs
The to() method of the CSSNumericValue interface converts a numberic value from one unit to another. Syntax var cssUnitValue = CSSNumericValue.to(unit); Parameters unit The unit to which you want to convert. Return value A CSSMathSum. Exceptions SyntaxError Indicates that an invalid type was passed to the method. TypeError Indicates that the passed values cannot be summed. Examples // Prints "0.608542cm" console.log(CSS.px("23").to("com").toString()); Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'to' in that specification. Working Draft Initial definition. ...
CSSNumericValue.toSum() - Web APIs
The toSum() method of the CSSNumericValue interface converts the object's value to a CSSMathSum object to values of the specified unit. Syntax var cssMathSum = CSSNumericValue.toSum(units); Parameters units The units to convert to. Return value A CSSNumericValue. Exceptions SyntaxError undefined TypeError Indicates that an invalid type was passed to the method. Examples let v = CSS.px("23").add(CSS.percent("4")).add(CSS.cm("3")).add(CSS.in("9")); v.toString() // => "calc(23px + 4% + 3cm + 9in)" v.toSum("px", "percent").toString() // => "calc(1000.39px + 4%)" Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'toSum' in that specification. Working Draft Initial definition. ...
CSSNumericValue.type - Web APIs
The type() method of the CSSNumericValue interface returns the type of CSSNumericValue, one of angle, flex, frequency, length, resolution, percent, percentHint, or time. Syntax var cssNumericType = CSSNumericValue.type(); Parameters None. Return value A CSSNumericType object. Exceptions None. Examples let mathSum = CSS.px("23").sub(CSS.percent("4")).sub(CSS.cm("3")).sub(CSS.in("9")); // Returns an object with the structure: {length: 1, percentHint: "length"} let cssNumericType = mathSum.type(); Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'type' in that specification. Working Draft Initial definition. ...
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.getStringValue() - Web APIs
The getStringValue() method of the CSSPrimitiveValue interface 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 definit...
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 ...
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 Bro...
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). ...
CSSStyleRule.styleMap - Web APIs
The styleMap read-only property of the CSSStyleRule interface returns a StylePropertyMap object which provides access to the rule's property-value pairs. Syntax var stylePropertyMap = cssStyleRule.styleMap; Value A StylePropertyMap object. Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'styleMap' in that specification. Working Draft Initial definition. ...
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 ...
CSSStyleValue.parseAll() - Web APIs
The parseAll() method of the CSSStyleValue interface 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. ...
CSSUnparsedValue.length - Web APIs
The length read-only property of the CSSUnparsedValue interface returns the number of items in the object. Syntax var length = CSSUnparsedValue.length; Value An integer. Examples In this example we employ the CSSUnparsedValue.CSSUnparsedValue() constructor, then query the length: let values = new CSSUnparsedValue( ['1em', '#445566', '-45px'] ); console.log( values.length ) // 3 Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'length' in that specification. Working Draft 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 ...
CSSVariableReferenceValue() - Web APIs
Creates a new CSSVariableReferenceValue. Syntax new CSSVariableReferenceValue(variable[, fallback]]) Parameters variable A custom property name. fallback Optional. A custom property fallback value. Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'CSSVariableReferenceValue()' in that specification. Working Draft Initial definition. ...
CSSVariableReferenceValue.fallback - Web APIs
The fallback read-only property of the CSSVariableReferenceValue interface returns the custom property fallback value of the CSSVariableReferenceValue. Syntax var fallback = cssVariableReferenceValue.fallback; Value A CSSUnparsedValue. Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'fallback' in that specification. Working Draft ...
CSSVariableReferenceValue.variable - Web APIs
The variable property of the CSSVariableReferenceValue interface returns the custom property name of the CSSVariableReferenceValue. Syntax var variable = cssVariableReferenceValue.variable; Value A USVString beginning with -- (that is, a custom property name). Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'variable' in that specification. Working Draft ...
CSSVariableReferenceValue - Web APIs
The CSSVariableReferenceValue interface of the CSS Typed Object Model API allows you to create a custom name for a built-in CSS value. This object functionality is sometimes called a "CSS variable" and serves the same purpose as the var() function. The custom name must begin with two dashes. Constructor CSSVariableReferenceValue.CSSVariableReferenceValue() Creates a new CSSVariableReferenceValue object. Properties CSSVariableReferenceValue.variable Returns the custom name passed to the constructor. CSSVariableReferenceValue.fallback Read only Returns the built-in CSS value for the custom name. Methods None. Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'CSSVariableReferenceValue' in that specification. Worki...
CSS Font Loading API - Web APIs
The CSS Font Loading API provides events and interfaces for dynamically loading font resources. Interfaces FontFace Represents a single usable font face. FontFaceSet An interface loading font faces and checking their download statuses. FontFaceSource A mixin providing all of the fonts used in font-related operations, unless defined otherwise. It defines the FontFaceSources.fonts property available to Document and WorkerGlobalScope. FontFaceSetLoadEvent Fired whenever a FontFaceSet loads. Specifications Specification Status Comment CSS Font Loading Module Level 3 Working Draft Initial definition. ...
WebKitCSSMatrix - Web APIs
An alias for DOMMatrix. Specifications Specification Status Comment Geometry Interfaces Module Level 1The definition of 'WebKitCSSMatrix' in that specification. Candidate Recommendation ...
-moz-user-input - CSS: Cascading Style Sheets
pt user input. /* Keyword values */ -moz-user-input: none; -moz-user-input: enabled; -moz-user-input: disabled; /* Global values */ -moz-user-input: inherit; -moz-user-input: initial; -moz-user-input: unset; For elements that normally take user input, such as a <textarea>, the initial value of -moz-user-input is enabled. Note: -moz-user-input was one of the proposals leading to the proposed CSS 3 user-input property, which has not yet reached Candidate Recommendation (call for implementations). A similar property, user-focus, was proposed in early drafts of a predecessor of the CSS3 UI specification, but was rejected by the working group. Syntax Values none The element does not respond to user input, and it does not become :active. enabled The element accepts user input. For te...
-webkit-mask-position-x - CSS: Cascading Style Sheets
The -webkit-mask-position-x CSS property sets the initial horizontal position of a mask image. /* Keyword values */ -webkit-mask-position-x: left; -webkit-mask-position-x: center; -webkit-mask-position-x: right; /* <percentage> values */ -webkit-mask-position-x: 100%; -webkit-mask-position-x: -50%; /* <length> values */ -webkit-mask-position-x: 50px; -webkit-mask-position-x: -1cm; /* Multiple values values */ -webkit-mask-position-x: 50px, 25%, -3em; /* Global values */ -webkit-mask-position-x: inherit; -webkit-mask-position-x: initial; -webkit-mask-position-x: unset; Initial value0%Applies toall elementsInheritednoPercentagesrefer to the size of the box itselfComputed valuefor <length> the absolute value, otherwise a percentageAnimation typediscrete Syntax Values <leng...
-webkit-mask-position-y - CSS: Cascading Style Sheets
The -webkit-mask-position-y CSS property sets the initial vertical position of a mask image. /* Keyword values */ -webkit-mask-position-y: top; -webkit-mask-position-y: center; -webkit-mask-position-y: bottom; /* <percentage> values */ -webkit-mask-position-y: 100%; -webkit-mask-position-y: -50%; /* <length> values */ -webkit-mask-position-y: 50px; -webkit-mask-position-y: -1cm; /* Multiple values values */ -webkit-mask-position-y: 50px, 25%, -3em; /* Global values */ -webkit-mask-position-y: inherit; -webkit-mask-position-y: initial; -webkit-mask-position-y: unset; Initial value0%Applies toall elementsInheritednoPercentagesrefer to the size of the box itselfComputed valuefor <length> the absolute value, otherwise a percentageAnimation typediscrete Syntax Values <length...
-webkit-tap-highlight-color - CSS: Cascading Style Sheets
The highlighting indicates to the user that their tap is being successfully recognized, and indicates which element they're tapping on. -webkit-tap-highlight-color: red; -webkit-tap-highlight-color: transparent; /* for removing the highlight */ Syntax Values A <color value>. ...
-webkit-text-security - CSS: Cascading Style Sheets
-webkit-text-security is a non-standard CSS property that obfuscates characters in a <form> field (such as <input> or <textarea>) by replacing them with a shape. It only affects fields that are not of type=password. Syntax -webkit-text-security: circle; -webkit-text-security: disc; -webkit-text-security: square; -webkit-text-security: none; Formal definition Value not found in DB! Formal syntax Syntax not found in DB! Examples Obscuring a text input Try typing in the field below. If your browser supports this property, the characters should be visually replaced with squares. HTML <label for="name">Name:</label> <input type="text" name="name" id="name" /> CSS input { -webkit-text-security: square; } Result Specifications Not part of any standard. ...
:-moz-broken - CSS: Cascading Style Sheets
The :-moz-broken CSS pseudo-class is a Mozilla extension that matches elements representing broken image links. Note: This selector is mainly intended to be used by theme developers. Syntax :-moz-broken Examples HTML <img src="broken.jpg" alt="This image is broken. :-("> CSS :-moz-broken { background: bisque; padding: 8px; } Result Specifications Not part of any standard. ...
:-moz-drag-over - CSS: Cascading Style Sheets
The :-moz-drag-over CSS pseudo-class is a Mozilla extension that matches an element when a dragover event is called on it. Syntax :-moz-drag-over Examples HTML <table border="1"> <tr> <td width="100px" height="100px">Drag Over</td> </tr> </table> CSS td:-moz-drag-over { color: red; } Result Specifications Not part of any standard. ...
:-moz-first-node - CSS: Cascading Style Sheets
The :-moz-first-node CSS pseudo-class is a Mozilla extension that represents any element that is the first child node of some other element. It differs from :first-child because it does not match a first-child element with (non-whitespace) text before it. Note: Any whitespace at the start of an element is ignored for the determination of :-moz-first-node. Syntax :-moz-first-node Examples CSS span:-moz-first-node { background-color: lime; } HTML <p> <span>This matches!</span> <span>This doesn't match.</span> </p> <p> Blahblah. <span>This doesn't match because it's preceded by text.</span> </p> Result Specifications Not part of any standard. ...
:-moz-handler-blocked - CSS: Cascading Style Sheets
Note: This selector is mainly intended to be used by theme developers. ...
:-moz-handler-crashed - CSS: Cascading Style Sheets
Note: This selector is mainly intended to be used by theme developers. ...
:-moz-handler-disabled - CSS: Cascading Style Sheets
Note: This selector is mainly intended to be used by theme developers. ...
:-moz-last-node - CSS: Cascading Style Sheets
The :-moz-last-node CSS pseudo-class is a Mozilla extension that represents any element that is the last child node of some other element. It differs from :last-child because it does not match a last-child element with (non-whitespace) text after it. Note: Any whitespace at the end of an element is ignored for the determination of :-moz-last-node. Syntax :-moz-last-node Examples CSS span:-moz-last-node { background-color: lime; } HTML <p> <span>This does not match.</span> <span>This matches!</span> </p> <p> <span>This doesn't match because it's followed by text.</span> Blahblah. </p> Result Specifications Not part of any standard. ...
::-moz-list-bullet - CSS: Cascading Style Sheets
The ::-moz-list-bullet CSS pseudo-element is a Mozilla extension that represents the marker (typically a bullet) of a list item (<li>) in an unordered list (<ul>). Syntax li::-moz-list-bullet Examples HTML <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul> CSS ::-moz-list-bullet { color: red; font-size: 1.5em; } Result Specifications Not part of any standard. ...
::-moz-list-number - CSS: Cascading Style Sheets
The ::-moz-list-number CSS pseudo-element is a Mozilla extension that represents the marker (typically a number) of a list item (<li>) in an ordered list (<ol>). Syntax li::-moz-list-number Examples HTML <ol> <li>First item</li> <li>Second item</li> <li>Third item</li> </ol> CSS li::-moz-list-number { font-style: italic; font-weight: bold; } Result ScreenshotLive sample Specifications Not part of any standard. ...
:-moz-loading - CSS: Cascading Style Sheets
Note that images that are in the process of loading are not matched by this pseudo-class. Note: This selector is mainly intended to be used by theme developers. ...
:-moz-submit-invalid - CSS: Cascading Style Sheets
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. ...
:-moz-suppressed - CSS: Cascading Style Sheets
Note: This selector is mainly intended to be used by theme developers. ...
:-moz-ui-invalid - CSS: Cascading Style Sheets
This pseudo-class is applied according to the following rules: If the control does not have focus, and the value is invalid, apply this pseudo-class. If the control has focus, and the value was valid (including empty) when it gained focus, do not apply the pseudo-class. If the control has focus, and the value was invalid when it gained focus, re-validate on every keystroke. If the element is required, the preceding rules apply only if the user has changed the value or attempted to submit the form. ...
:-moz-ui-valid - CSS: Cascading Style Sheets
This pseudo-class is applied according to the following rules: If the control does not have focus, and the value is valid, apply this pseudo-class. If the control has focus, and the value was valid (including empty) when it gained focus, apply this pseudo-class. If the control has focus, and the value was invalid when it gained focus, re-validate on every keystroke. If the element is required, the preceding rules apply only if the user has changed the value or attempted to submit the form. ...
:-moz-user-disabled - CSS: Cascading Style Sheets
Note: This selector is mainly intended to be used by theme developers. ...
:-webkit-autofill - CSS: Cascading Style Sheets
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. ...
::-moz-color-swatch - CSS: Cascading Style Sheets
The ::-moz-color-swatch CSS pseudo-element is a Mozilla extension that represents the color selected in an <input> of type="color". Note: Using ::-moz-color-swatch with anything but an <input type="color"> doesn't match anything and has no effect. Syntax Syntax not found in DB! Examples HTML <input type="color" value="#de2020" /> CSS input[type=color]::-moz-color-swatch { border-radius: 10px; border-style: none; } Result Specifications Not part of any standard. ...
::-moz-page-sequence - CSS: Cascading Style Sheets
The ::-moz-page-sequence CSS pseudo-element is a Mozilla extension that represents the background of a print preview. Syntax Syntax not found in DB! Specifications Not part of any standard. ...
::-moz-page - CSS: Cascading Style Sheets
The ::-moz-page CSS pseudo-element is a Mozilla extension that represents an individual page when printed or in a print preview. Syntax Syntax not found in DB! Specifications Not part of any standard. ...
::-moz-progress-bar - CSS: Cascading Style Sheets
The ::-moz-progress-bar CSS pseudo-element is a Mozilla extension that represents the progress bar inside a <progress> element. (The bar represents the amount of progress that has been made.) If you want to select the unfinished part of <progress> in Mozilla, please select the <progress> directly. Syntax ::-moz-progress-bar Examples HTML <progress value="30" max="100">30%</progress> <progress max="100">Indeterminate</progress> CSS ::-moz-progress-bar { background-color: red; } /* Force indeterminate bars to have zero width */ :indeterminate::-moz-progress-bar { width: 0; } Result Specifications Not part of any standard. ...
::-moz-range-progress - CSS: Cascading Style Sheets
The ::-moz-range-progress CSS pseudo-element is a Mozilla extension that represents the lower portion of the track (i.e., groove) in which the indicator slides in an <input> of type="range". This portion corresponds to values lower than the value currently selected 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 ::-moz-range-thumb CSS pseudo-element is a Mozilla extension that represents the thumb (i.e., virtual knob) of an <input> of type="range". The user can move 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
The ::-moz-range-track CSS pseudo-element is a Mozilla extension that represents the track (i.e., groove) 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. ...
::-moz-scrolled-page-sequence - CSS: Cascading Style Sheets
The ::-moz-scrolled-page-sequence CSS pseudo-element is a Mozilla extension that represents the background of a print preview. Syntax Syntax not found in DB! Specifications Not part of any standard. ...
::-webkit-inner-spin-button - CSS: Cascading Style Sheets
The ::-webkit-inner-spin-button CSS pseudo-element is used to style the inner part of the spinner button of number picker input elements. 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. HTML <input type="number"> CSS input[type=number]::-webkit-inner-spin-button { cursor: pointer; } Result Specifications Not part of any standard. ...
::-webkit-meter-even-less-good-value - CSS: Cascading Style Sheets
alue gives a red color to a <meter> element when the value and the optimum attributes fall outside the low-high range, but in opposite zones. ...
::-webkit-meter-suboptimum-value - CSS: Cascading Style Sheets
The ::-webkit-meter-suboptimum-value pseudo-element gives a yellow color to the <meter> element when the value attribute falls outside of the low-high range. Syntax ::-webkit-meter-suboptimum-value Examples This example will only work in browsers based on WebKit or Blink. HTML <meter min="0" max="10" value="6">Score out of 10</meter> CSS meter::-webkit-meter-suboptimum-value { background: -webkit-gradient linear, left top, left bottom; height: 100%; box-sizing: border-box; } Result Specifications Not part of any standard. ...
::-webkit-outer-spin-button - CSS: Cascading Style Sheets
The ::-webkit-outer-spin-button CSS pseudo-element is used to style the outer part of the spinner button of number picker <input> elements. 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. HTML <input type="number"> CSS input::-webkit-outer-spin-button { -webkit-appearance: none; } Result Specifications Not part of any standard. ...
::-webkit-progress-value - CSS: Cascading Style Sheets
The ::-webkit-progress-value CSS pseudo-element represents the filled-in portion of the bar of a <progress> element. It is a child of the ::-webkit-progress-bar pseudo-element. Note: In order to let ::-webkit-progress-value take effect, -webkit-appearance needs to be set to none on the <progress> element. Syntax ::-webkit-progress-value Examples This example will only work in browsers based on Blink or WebKit. HTML <progress value="10" max="50"> CSS progress { -webkit-appearance: none; } ::-webkit-progress-value { background-color: orange; } Result Result screenshot A progress bar using the style above would look like this: Specifications Not part of any standard. ...
::-webkit-scrollbar - CSS: Cascading Style Sheets
::-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. ::-webkit-scrollbar-track-piece -- the part of the track (progress bar) not covered by the handle. ...
::-webkit-search-cancel-button - CSS: Cascading Style Sheets
This button and pseudo-element are non-standard, supported only in WebKit and Blink, hence the vendor prefix. The clear button is only shown on non-empty search <input> elements. ...
::-webkit-search-results-button - CSS: Cascading Style Sheets
This button and pseudo-element are non-standard, supported only in WebKit and Blink, hence the vendor prefix. The search results button is only shown on search <input> elements that have a results attribute. ...
::-webkit-slider-runnable-track - CSS: Cascading Style Sheets
The ::-webkit-slider-runnable-track CSS pseudo-element represents the "track" (the groove in which the indicator slides) of an <input type="range">. Syntax ::-webkit-slider-runnable-track Specifications Not part of any standard. ...
::-webkit-slider-thumb - CSS: Cascading Style Sheets
The ::-webkit-slider-thumb CSS pseudo-element represents the "thumb" that the user can move within the "groove" of an <input> of type="range" to alter its numerical value. Syntax ::-webkit-slider-thumb Specifications Not part of any standard. ...
:blank - CSS: Cascading Style Sheets
Web › CSS › :blank
Note: The :blank selector is considered at risk, as the CSSWG keeps changing it. See CSSWG issue #1967. The :blank CSS pseudo-class selects empty user input elements (eg. <input> or <textarea>). Syntax :blank Examples Simple :blank example In eventual supporting browsers, the :blank pseudo-class will enable developers to highlight in some way input controls that are not required, but still have no content filled in, perhaps as a reminder to users. HTML <textarea></textarea> CSS textarea:blank { border: 3px solid red; } Result Specifications Specification Status Comment Selectors Level 4The definition of ':blank' in that specification. Working Draft Initial definition. ...
:optional - CSS: Cascading Style Sheets
Web › CSS › :optional
/* Selects any optional <input> */ input:optional { border: 1px dashed black; } This pseudo-class is useful for styling fields that are not required to submit a form. Note: The :required pseudo-class selects required form fields. Syntax :optional Examples See :invalid for an example. Accessibility concerns If a form contains optional <input>s, required inputs should be indicated using the required attribute. This will ensure that people navigating with the aid of assistive technology such as a screen reader will be able to understand which inputs need valid content to ensure a successful form submission. ...
:read-only - CSS: Cascading Style Sheets
input:read-only, textarea:read-only { background-color: #ccc; } p:read-only { background-color: #ccc; } Syntax :read-only Examples Confirming form information in read-only/read-write controls One use of readonly form controls is to allow the user to check and verify information that they may have entered in an earlier form (for example, shipping details), while still being able to submit the information along with the rest of the form. We do just this in the example below. ...
:read-write - CSS: Cascading Style Sheets
input:read-write, textarea:read-write { background-color: #bbf; } p:read-write { background-color: #bbf; } Syntax :read-write Examples Confirming form information in read-only/read-write controls One use of readonly form controls is to allow the user to check and verify information that they may have entered in an earlier form (for example, shipping details), while still being able to submit the information along with the rest of the form. We do just this in the example below. ...
:required - CSS: Cascading Style Sheets
Web › CSS › :required
/* Selects any required <input> */ input:required { border: 1px dashed red; } This pseudo-class is useful for highlighting fields that must have valid data before a form can be submitted. Note: The :optional pseudo-class selects optional form fields. Syntax :required Examples See :invalid for an example. Accessibility concerns Mandatory <input>s should have the required attribute applied to them. This will ensure that people navigating with the aid of assistive technology such as a screen reader will be able to understand which inputs need valid content to ensure a successful submission. ...
:state() - CSS: Cascading Style Sheets
Web › CSS › :state
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. ...
fallback - CSS: Cascading Style Sheets
he fallback style will be used for the rest of the list items. Formal definition Related at-rule@counter-styleInitial valuedecimalComputed valueas specified Formal syntax <counter-style-name>where <counter-style-name> = <custom-ident> Examples Specifying a fallback counter style HTML <ul class="list"> <li>One</li> <li>Two</li> <li>Three</li> <li>Four</li> <li>Five</li> </ul> CSS @counter-style fallback-example { system: fixed; symbols: "\24B6" "\24B7" "\24B8"; fallback: upper-alpha; } .list { list-style: fallback-example; } Result Specifications Specification Status Comment CSS Counter Styles Level 3The definition of 'fallback' in that specification. Candidate Recommendation Initial definition ...
range - CSS: Cascading Style Sheets
Candidate Recommendation Initial definition ...
font-display - CSS: Cascading Style Sheets
Working Draft Initial definition ...
font-family - CSS: Cascading Style Sheets
The font-family CSS descriptor allows authors to specify the font family for the font specified in an @font-face rule. Syntax /* <string> values */ font-family: "font family"; font-family: 'another font family'; /* <custom-ident> value */ font-family: examplefont; Values <family-name> Specifies the name of the font family. Formal definition Related at-rule@font-faceInitial valuen/a (required)Computed valueas specified Formal syntax <family-name>where <family-name> = <string> | <custom-ident>+ Examples Setting the font family name @font-face { font-family: examplefont; src: url('examplefont.ttf'); } Specifications Specification Status Comment CSS Fonts Module Level 3The definition of 'font-family' in that specification. Candidate Recommen...
-webkit-animation - CSS: Cascading Style Sheets
The -webkit-animation Boolean CSS media feature is a Chrome extension whose value is true if vendor-prefixed CSS animations are supported. Apple has a description in Safari CSS Reference. Note: This media feature is only supported by WebKit. If possible, use an @supports feature query instead. Syntax The -webkit-animation media feature is a Boolean whose value is true if the vendor-prefixed CSS animation properties are supported. Values true The browser supports -webkit prefixed CSS animations. false The browser doesn't support these prefixed CSS animations. Examples @media (-webkit-animation) { /* CSS to use if animations are supported */ } Specifications Not part of any standard. ...
any-hover - CSS: Cascading Style Sheets
Web › CSS › @media › any-hover
The any-hover CSS media feature can be used to test whether any available input mechanism can hover over elements. Syntax The any-hover feature is specified as a keyword value chosen from the list below. none None of the available input mechanism(s) can hover conveniently, or there is no pointing input mechanism. hover One or more available input mechanisms can conveniently hover over elements. Examples Testing whether input methods can hover HTML <a href="#">Try hovering over me!</a> CSS @media (any-hover: hover) { a:hover { background: yellow; } } Result Specifications Specification Status Comment Media Queries Level 4The definition of 'any-hover' in that specification. Candidate Recommendation Initial definition. ...
aural - CSS: Cascading Style Sheets
Web › CSS › @media › aural
The aural 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-aspect-ratio - CSS: Cascading Style Sheets
Syntax The device-aspect-ratio feature is specified as a <ratio>. It is a range feature, meaning that you can also use the prefixed min-device-aspect-ratio and max-device-aspect-ratio variants to query minimum and maximum values, respectively. Examples article { padding: 1rem; } @media screen and (min-device-aspect-ratio: 16/9) { article { padding: 1rem 5vw; } } Specifications Specification Status Comment Media Queries Level 4The definition of 'device-aspect-ratio' in that specification. Candidate Recommendation Deprecated in Media Queries Level 4. ...
device-height - CSS: Cascading Style Sheets
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. ...
device-width - CSS: Cascading Style Sheets
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. ...
display-mode - CSS: Cascading Style Sheets
You can use it to provide a consistent user experience between launching a site from a URL and launching it from a desktop icon. This feature corresponds to the Web app manifest's display member. Both apply to the top-level browsing context and any child browsing contexts. The feature query applies regardless of whether a web app manifest is present. Syntax The display-mode feature is specified as a keyword value chosen from the list below. Display mode Description Fallback display mode fullscreen All of the available display area is used and no user agent chrome is shown. ...
hover - CSS: Cascading Style Sheets
Web › CSS › @media › hover
The hover CSS media feature can be used to test whether the user's primary input mechanism can hover over elements. Syntax The hover feature is specified as a keyword value chosen from the list below. none The primary input mechanism cannot hover at all or cannot conveniently hover (e.g., many mobile devices emulate hovering when the user performs an inconvenient long tap), or there is no primary pointing input mechanism. hover The primary input mechanism can conveniently hover over elements. Examples HTML <a href="#">Try hovering over me!</a> CSS @media (hover: hover) { a:hover { background: yellow; } } Result Specifications Specification Status Comment Media Queries Level 4The definition of 'hover' in that specification. Candidate R...
light-level - CSS: Cascading Style Sheets
Syntax dim The device is used in a dim environment, where excessive contrast and brightness would be distracting or uncomfortable to the reader. For example: night time, or a dimly illuminated indoor environment. normal The device is used in a environment with a light level in the ideal range for the screen, and which does not necessitate any particular adjustment. washed The device is used in an exceptionally bright environment, causing the screen to be washed out and difficult to read. For example: bright daylight. Examples This code will likely not work on any devices (device compatibility is low). ...
Box alignment for block, absolutely positioned and table layout - CSS: Cascading Style Sheets
have access to the vertical-align property to align the contents of a cell inside that cell. ...
Box alignment in Multi-column Layout - CSS: Cascading Style Sheets
justify-content. ...
Mastering margin collapsing - CSS: Cascading Style Sheets
.. with the top margin of this paragraph, yielding a margin of <code>1.2rem</code> in between.</p> <div>This parent element contains two paragraphs! <p>This paragraph has a <code>.4rem</code> margin between it and the text above.</p> <p>My bottom margin collapses with my parent, yielding a bottom margin of <code>2rem</code>.</p> </div> <p>I am <code>2rem</code> below the element above.</p> CSS div { margin: 2rem 0; background: lavender; } p { margin: .4rem 0 1.2rem 0; background: yellow; } Result Specifications Specification Status Comment CSS Level 2 (Revision 1)The definition of 'margin collapsing' in that specification. Recommendation Initial definition. ...
Styling Columns - CSS: Cascading Style Sheets
e specification it might be. For now, however, we are able to change the spacing and add lines between columns. The column-gap property The gap between our columns is controlled by the column-gap property. This property was originally defined in the Multi-column Layout specification. However, it is now defined in Box Alignment in order to unify gaps between boxes in other specifications such as CSS Grid Layout. The initial value of column-gap in multicol is 1em. This means your columns will not run into each other. In other layout methods the initial value for column-gap is 0. If you use the keyword value "normal" the gap will be set to 1em. You 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...
Controlling Ratios of Flex Items Along the Main Axis - CSS: Cascading Style Sheets
the natural size of flex items before any growing or shrinking takes place, and to the concept of free space. Flex item sizing In order to work out how much space there is available to lay out flex items, the browser needs to know how big the item is to start with. How is this worked out for items that don't have a width or a height applied using an absolute length unit? There is a concept in CSS of min-content and max-content -- these keywords are defined in the CSS Intrinsic and Extrinsic Sizing Specification, and can be used in place of a length unit. In the live example below for instance I have two paragraph elements that contain a string of text. The first paragraph has a width of min-content. In a browser that supports this keyword you should be able to see that the text has taken...
Flow Layout and Overflow - CSS: Cascading Style Sheets
This guide explains how overflow works when working with normal flow. What is overflow? Giving an element a fixed height and width, then adding significant content to the box, creates a basic overflow example: The content goes into the box. Once it fills the box, it continues to overflow in a visible way, displaying content outside the box, potentially displaying under subsequent content. ...
Introduction to formatting contexts - CSS: Cascading Style Sheets
yout behaves when in that context. Block formatting contexts The outermost element in a document that uses block layout rules establishes the first, or initial block formatting context. This means that every element inside the <html> element's block is laid out according to normal flow following the rules for block and inline layout. Elements participating in a BFC use the rules outlined by the CSS Box Model, which defines how an element's margins, borders, and padding interact with other blocks in the same context. Creating a new block formatting context The <html> element is not the only element capable of creating a block formatting context. Any block-level element can be made to create a BFC by the application of certain CSS properties. A new BFC is created in the following situation...
Consistent list indentation - CSS: Cascading Style Sheets
mple and unadorned, as shown in Figure 1. That dotted red border represents outer edges of the content-area of the list item. Remember that, at this point, the list item has no padding or borders. If we add two more list items, we get a result like that shown in Figure 2. Now we wrap these in a parent element; in this case, we'll wrap them in an unordered list (i.e., <ul>). According to the CSS box model, the list items' boxes must be displayed within the parent element's content area. Since that parent has no padding or margins yet, we get the situation shown in Figure 3. Here, the dotted blue border shows us the edges of the <ul> element's content area. Since we have no padding for the <ul> element, its content wraps snugly around the three list items. Now we add the list item mar...
Using z-index - CSS: Cascading Style Sheets
r />position: absolute; <br />z-index: 5; </div> <div id="rel1"> <b>DIV #2</b> <br />position: relative; <br />z-index: 3; </div> <div id="rel2"> <b>DIV #3</b> <br />position: relative; <br />z-index: 2; </div> <div id="abs2"> <b>DIV #4</b> <br />position: absolute; <br />z-index: 1; </div> <div id="sta1"> <b>DIV #5</b> <br />no positioning <br />z-index: 8; </div> CSS div { padding: 10px; opacity: 0.7; text-align: center; } b { font-family: sans-serif; } #abs1 { z-index: 5; position: absolute; width: 150px; height: 350px; top: 10px; left: 10px; border: 1px dashed #900; background-color: #fdd; } #rel1 { z-index: 3; height: 100px; position: relative; top: 30px; border: 1px dashed #696; background-color: #cfc; margin: 0px...
Stacking with floated blocks - CSS: Cascading Style Sheets
g context (see What No One Told You About Z-Index). ...
Stacking without the z-index property - CSS: Cascading Style Sheets
<div id="abs1" class="absolute"> <b>DIV #1</b><br />position: absolute;</div> <div id="rel1" class="relative"> <b>DIV #2</b><br />position: relative;</div> <div id="rel2" class="relative"> <b>DIV #3</b><br />position: relative;</div> <div id="abs2" class="absolute"> <b>DIV #4</b><br />position: absolute;</div> <div id="sta1" class="static"> <b>DIV #5</b><br />position: static;</div> CSS b { font-family: sans-serif; } div { padding: 10px; border: 1px dashed; text-align: center; } .static { position: static; height: 80px; background-color: #ffc; border-color: #996; } .absolute { position: absolute; width: 150px; height: 350px; background-color: #fdd; border-color: #900; opacity: 0.7; } .relative { position: relative; height: 80px; background-...
The stacking context - CSS: Cascading Style Sheets
<code>position: relative;<br/> z-index: 6;</code> </div> <h1>Division Element #3</h1> <code>position: absolute;<br/> z-index: 4;</code> <div id="div5"> <h1>Division Element #5</h1> <code>position: relative;<br/> z-index: 1;</code> </div> <div id="div6"> <h1>Division Element #6</h1> <code>position: absolute;<br/> z-index: 3;</code> </div> </div> CSS * { margin: 0; } html { padding: 20px; font: 12px/20px Arial, sans-serif; } div { opacity: 0.7; position: relative; } h1 { font: inherit; font-weight: bold; } #div1, #div2 { border: 1px dashed #696; padding: 10px; background-color: #cfc; } #div1 { z-index: 5; margin-bottom: 190px; } #div2 { z-index: 2; } #div3 { z-index: 4; opacity: 1; position: absolute; top: 4...
Using the :target pseudo-class in selectors - CSS: Cascading Style Sheets
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. ...
Compositing and Blending - CSS: Cascading Style Sheets
Compositing and Blending is a CSS module that defines how shapes of different elements are combined into a single image. Reference Properties background-blend-mode isolation mix-blend-mode Data types <blend-mode> Specifications Specification Status Comment Compositing and Blending Level 1 Candidate Recommendation Initial definition ...
Layout and the containing block - CSS: Cascading Style Sheets
rties and offset properties: The height, top, and bottom properties compute percentage values from the height of the containing block. The width, left, right, padding, and margin properties compute percentage values from the width of the containing block. Some examples The HTML code for all our examples is: <body> <section> <p>This is a paragraph!</p> </section> </body> Only the CSS is altered in each instance below. Example 1 In this example, the paragraph is statically positioned, so its containing block is <section> because it's the nearest ancestor that is a block container. <body> <section> <p>This is a paragraph!</p> </section> </body> body { background: beige; } section { display: block; width: 400px; height: 160px; background: lightgray; } ...
Filter Effects - CSS: Cascading Style Sheets
Reference Properties backdrop-filter filter Data types <filter-function> Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'filter' in that specification. ...
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 Dr...
Breadcrumb Navigation - CSS: Cascading Style Sheets
selectors to insert content before every li except the first one. This could also be achieved using one selector only: .breadcrumb li:not(:first-child)::before { content: "->"; } This solution uses a more complex selector, but requires less rules. Feel free to choose the solution that you prefer. Choices made This pattern is laid out using a simple flex layout demonstrating how a line of CSS can give us our navigation. The separators are added using CSS Generated Content. You could change these to any separator that you like. Accessibility concerns I have used the aria-label and aria-current attributes to help users understand what this navigation is and where the current page is in the structure. See the related links for more information. ...
Cookbook template - CSS: Cascading Style Sheets
Please use this as a raw template when you create a new cookbook page. Comment in italics are information about how to use part of the template. Description of the problem this recipe solves or the pattern you are demonstrating. Requirements What does this pattern need to include, or what problems does it need to solve? List that here. Recipe Change the path to the example below to point to your merged example. The last parameter is the live example height, which you can change as needed. Change the link to point to your merged download version. Download the example Choices made Explain your decisions when creating the pattern. ...
Pagination - CSS: Cascading Style Sheets
This cookbook pattern demonstrates the navigation pattern used to display pagination, where the user can move between pages of content such as search results. Requirements The pagination pattern typically displays items in a row. To ensure that the pagination is understandable by people using a screenreader, we mark the items up as a list inside a <nav> element, and then use CSS to display the layout visually as a row. Typically, the pagination component will be centered horizontally underneath the content. Recipe Download this example Choices made This pattern is laid out using flexbox -- one flex container nested inside another. The <nav> element is designated a flex container in order that we can center the list inside using the justify-content property. The list itself also...
Sticky footers - CSS: Cascading Style Sheets
the content as normal. The recipe Download this example Note: In this example and the following one we are using a wrapper set to min-height: 100% in order that our live example works. You could also achieve this for a full page by setting a min-height of 100vh on the <body> and then using it as your grid container. Choices made In the above example we achieve the sticky footer using CSS Grid Layout. The .wrapper has a minimum height of 100% which means it is as tall as the container it is in. We then create a single column grid layout with three rows, one row for each part of our layout. Grid auto-placement will place our items in source order and so the header goes into the first auto sized track, the main content into the 1fr track and the footer into the final auto sized tra...
Privacy and the :visited selector - CSS: Cascading Style Sheets
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. ...
<angle-percentage> - CSS: Cascading Style Sheets
The <angle-percentage> CSS data type represents a value that can be either a <angle> or a <percentage>. Syntax Refer to the documentation for <angle> and <percentage> for details of the individual syntaxes allowed by this type. Use in calc() Where an <angle-percentage> is specified as an allowable type, this means that the percentage resolves to an angle and therefore can be used in a calc() expression. Specifications Specification Status Comment CSS Values and Units Module Level 4The definition of '<angle-percentage>' in that specification. Editor's Draft CSS Values and Units Module Level 3The definition of '<angle-percentage>' in that specification. Candidate Recommendation Defines <angle-percentage>. Adds calc() ...
background-blend-mode - 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. Blending modes should be defined in the same order as the background-image property. If the blending modes' and background images' list lengths are not equal, it will be repeated and/or truncated until lengths match. ...
box-flex-group - CSS: Cascading Style Sheets
/* <integer> values */ box-flex-group: 1; box-flex-group: 5; /* Global values */ box-flex-group: inherit; box-flex-group: initial; box-flex-group: unset; For flexible elements assigned to flex groups, the first flex group is 1 and higher values specify subsequent flex groups. The initial value is 1. When dividing up the box's extra space, the browser first considers all elements within the first flex group. ...
box-lines - CSS: Cascading Style Sheets
Web › CSS › box-lines
/* Keyword values */ box-lines: single; box-lines: multiple; /* Global values */ box-lines: inherit; box-lines: initial; box-lines: unset; By default a horizontal box will lay out its children in a single row, and a vertical box will lay out its children in a single column. This behavior can be changed using the box-lines property. ...
box-ordinal-group - CSS: Cascading Style Sheets
/* <integer> values */ box-ordinal-group: 1; box-ordinal-group: 5; /* Global values */ box-ordinal-group: inherit; box-ordinal-group: initial; box-ordinal-group: unset; Ordinal groups may be used in conjunction with the box-direction property to control the order in which the direct children of a box appear. ...
<display-listitem> - CSS: Cascading Style Sheets
ist-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. 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 ...
<display-outside> - CSS: Cascading Style Sheets
you specify an element to be block, you would expect that the children of that element would participate in block and inline normal flow layout. Examples In the following example, span elements (normally displayed as inline elements) are set to display: block and so break onto new lines and expand to fill their container in the inline dimension. HTML <span>span 1</span> <span>span 2</span> CSS span { display: block; border: 1px solid rebeccapurple; } Result Specifications Specification Status CSS Display Module Level 3The definition of 'display-outside' in that specification. Candidate Recommendation ...
blur() - CSS: Cascading Style Sheets
Its result is a <filter-function>. 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 blur(radius) Parameters radius The radius of the blur, specified as a <length>. It defines the value of the standard deviation to the Gaussian function, i.e., how many pixels on the screen blend into each other; thus, a larger value will create more blur. A value of 0 leaves the input unchanged. The lacuna value for interpolation is 0. ...
brightness() - CSS: Cascading Style Sheets
Its result is a <filter-function>. 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 brightness(amount) Parameters amount The brightness of the result, specified as a <number> or a <percentage>. A value under 100% darkens the image, while a value over 100% brightens it. A value of 0% will create an image that is completely black, while a value of 100% leaves the input unchanged. The lacuna value for interpolation is 1. ...
contrast() - CSS: Cascading Style Sheets
Its result is a <filter-function>. 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 contrast(amount) Parameters amount The contrast of the result, specified as a <number> or a <percentage>. A value under 100% decreases the contrast, while a value over 100% increases it. A value of 0% will create an image that is completely gray, while a value of 100% leaves the input unchanged. The lacuna value for interpolation is 1. ...
drop-shadow() - CSS: Cascading Style Sheets
Its result is a <filter-function>. 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 drop shadow is effectively a blurred, offset version of the input image's alpha mask, drawn in a specific color and composited below the image. Note: This function is somewhat similar to the box-shadow property. The box-shadow property creates a rectangular shadow behind an element's entire box, while the drop-shadow() filter function creates a shadow that conforms to the shape (alpha channel) of the image itself. ...
grayscale() - CSS: Cascading Style Sheets
Its result is a <filter-function>. 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 grayscale(amount) Parameters amount The amount of the conversion, specified as a <number> or a <percentage>. A value of 100% is completely grayscale, while a value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on the effect. Default value when omitted is 1. The initial value for interpolation is 0. ...
hue-rotate() - CSS: Cascading Style Sheets
Its result is a <filter-function>. 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 hue-rotate(angle) Parameters angle The relative change in hue of the input sample, specified as an <angle>. A value of 0deg leaves the input unchanged. A positive hue rotation increases the hue value, while a negative rotation decreases the hue value. The lacuna value for interpolation is 0. There is no minimum or maximum value; hue-rotate(Ndeg) evaluates to N modulo 360. ...
invert() - CSS: Cascading Style Sheets
Its result is a <filter-function>. 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 invert(amount) Parameters amount The amount of the conversion, specified as a <number> or a <percentage>. A value of 100% is completely inverted, while a value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on the effect. The lacuna value for interpolation is 0. ...
opacity() - CSS: Cascading Style Sheets
Its result is a <filter-function>. 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 function is similar to the more established opacity property. The difference is that with filters, some browsers provide hardware acceleration for better performance. Syntax opacity(amount) Parameters amount The amount of the conversion, specified as a <number> or a <percentage>. A value of 0% is completely transparent, while a value of 100% leaves the input unchanged. ...
saturate() - CSS: Cascading Style Sheets
Its result is a <filter-function>. 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 saturate(amount) Parameters amount The amount of the conversion, specified as a <number> or a <percentage>. A value under 100% desaturates the image, while a value over 100% super-saturates it. A value of 0% is completely unsaturated, while a value of 100% leaves the input unchanged. The lacuna value for interpolation is 1. ...
sepia() - CSS: Cascading Style Sheets
Its result is a <filter-function>. 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 sepia(amount) Parameters amount The amount of the conversion, specified as a <number> or a <percentage>. A value of 100% is completely sepia, while a value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on the effect. The lacuna value for interpolation is 0. ...
<flex> - CSS: Cascading Style Sheets
The <flex> CSS data type denotes a flexible length within a grid container. It is used in grid-template-columns, grid-template-rows and other related properties. Syntax The <flex> data type is specified as a <number> followed by the unit fr. The fr unit represents a fraction of the leftover space in the grid container. As with all CSS dimensions, there is no space between the unit and the number. Examples 1fr /* Using an integer value */ 2.5fr /* Using a float value */ Specifications Specification Status Comment CSS Grid LayoutThe definition of '<flex>' in that specification. Candidate Recommendation Initial definition. ...
margin-trim - CSS: Cascading Style Sheets
Editor's Draft ...
offset-position - CSS: Cascading Style Sheets
The offset-position CSS property defines the initial position of the offset-path. Syntax /* Keyword values */ offset-position: auto; offset-position: top; offset-position: bottom; offset-position: left; offset-position: right; offset-position: center; /* <percentage> values */ offset-position: 25% 75%; /* <length> values */ offset-position: 0 0; offset-position: 1cm 2cm; offset-position: 10ch 8em; /* Edge offsets values */ offset-position: bottom 10px right 20px; offset-position: right 3em bottom 10px; offset-position: bottom 10px right; offset-position: top right 10px; /* Global values */ offset-position: inherit; offset-position: initial; offset-position: unset; Values auto The initial position is the position of the box specified by the position property. <position>...
<ratio> - CSS: Cascading Style Sheets
Web › CSS › ratio
Syntax In Media Queries Level 3, the <ratio> data type consisted of a strictly positive <integer> followed by a forward slash ('/', Unicode U+002F SOLIDUS) and a second strictly positive <integer>. Spaces before and after the slash are optional. The first number represents the width, while the second represents the height. In Media Queries Level 4, the <ratio> date type is updated to consist of a strictly positive <number> followed by a forward slash ('/', Unicode U+002F SOLIDUS) and a second strictly positive <number>. In addition a single <number> as a value is allowable. ...
Resolved value - CSS: Cascading Style Sheets
The resolved value of a CSS property is the value returned by getComputedStyle(). 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. Specifications Specification Status Comment CSS Object Model (CSSOM)The definition of 'resolved value' in that specification. Working Draft Initial definition. ...
scroll-margin-block-end - CSS: Cascading Style Sheets
Candidate Recommendation Initial definition ...
scroll-margin-block-start - CSS: Cascading Style Sheets
Candidate Recommendation Initial definition ...
scroll-margin-bottom - CSS: Cascading Style Sheets
Candidate Recommendation Initial definition ...
scroll-margin-left - CSS: Cascading Style Sheets
Candidate Recommendation Initial definition ...
scroll-margin-right - CSS: Cascading Style Sheets
Candidate Recommendation Initial definition ...
scroll-margin-top - CSS: Cascading Style Sheets
Candidate Recommendation Initial definition ...
scroll-padding-block-end - CSS: Cascading Style Sheets
non-zero value is more appropriate. Formal definition Initial valueautoApplies toscroll containersInheritednoPercentagesrelative to the scroll container's scrollportComputed valueas specifiedAnimation typeby computed value type Formal syntax auto | <length-percentage>where <length-percentage> = <length> | <percentage> Specifications Specification Status Comment CSS Scroll Snap Module Level 1The definition of 'scroll-padding-block-end' in that specification. Candidate Recommendation Initial definition ...
scroll-padding-block-start - CSS: Cascading Style Sheets
non-zero value is more appropriate. Formal definition Initial valueautoApplies toscroll containersInheritednoPercentagesrelative to the scroll container's scrollportComputed valueas specifiedAnimation typeby computed value type Formal syntax auto | <length-percentage>where <length-percentage> = <length> | <percentage> Specifications Specification Status Comment CSS Scroll Snap Module Level 1The definition of 'scroll-padding-block-start' in that specification. Candidate Recommendation Initial definition ...
scroll-padding-bottom - CSS: Cascading Style Sheets
non-zero value is more appropriate. Formal definition Initial valueautoApplies toscroll containersInheritednoPercentagesrelative to the scroll container's scrollportComputed valueas specifiedAnimation typeby computed value type Formal syntax auto | <length-percentage>where <length-percentage> = <length> | <percentage> Specifications Specification Status Comment CSS Scroll Snap Module Level 1The definition of 'scroll-padding-bottom' in that specification. Candidate Recommendation Initial definition ...
scroll-padding-inline-end - CSS: Cascading Style Sheets
a non-zero value is more appropriate. Formal definition Initial valueautoApplies toscroll containersInheritednoPercentagesrelative to the scroll container's scrollportComputed valueas specifiedAnimation typeby computed value type Formal syntax auto | <length-percentage>where <length-percentage> = <length> | <percentage> Specifications Specification Status Comment CSS Scroll Snap Module Level 1The definition of 'scroll-padding-inline-end' in that specification. Candidate Recommendation Initial definition ...
scroll-padding-inline-start - CSS: Cascading Style Sheets
non-zero value is more appropriate. Formal definition Initial valueautoApplies toscroll containersInheritednoPercentagesrelative to the scroll container's scrollportComputed valueas specifiedAnimation typeby computed value type Formal syntax auto | <length-percentage>where <length-percentage> = <length> | <percentage> Specifications Specification Status Comment CSS Scroll Snap Module Level 1The definition of 'scroll-padding-inline-start' in that specification. Candidate Recommendation Initial definition ...
scroll-padding-left - CSS: Cascading Style Sheets
a non-zero value is more appropriate. Formal definition Initial valueautoApplies toscroll containersInheritednoPercentagesrelative to the scroll container's scrollportComputed valueas specifiedAnimation typeby computed value type Formal syntax auto | <length-percentage>where <length-percentage> = <length> | <percentage> Specifications Specification Status Comment CSS Scroll Snap Module Level 1The definition of 'scroll-padding-left' in that specification. Candidate Recommendation Initial definition ...
scroll-padding-right - CSS: Cascading Style Sheets
non-zero value is more appropriate. Formal definition Initial valueautoApplies toscroll containersInheritednoPercentagesrelative to the scroll container's scrollportComputed valueas specifiedAnimation typeby computed value type Formal syntax auto | <length-percentage>where <length-percentage> = <length> | <percentage> Specifications Specification Status Comment CSS Scroll Snap Module Level 1The definition of 'scroll-padding-right' in that specification. Candidate Recommendation Initial definition ...
scroll-padding-top - CSS: Cascading Style Sheets
non-zero value is more appropriate. Formal definition Initial valueautoApplies toscroll containersInheritednoPercentagesrelative to the scroll container's scrollportComputed valueas specifiedAnimation typeby computed value type Formal syntax auto | <length-percentage>where <length-percentage> = <length> | <percentage> Specifications Specification Status Comment CSS Scroll Snap Module Level 1The definition of 'scroll-padding-top' in that specification. Candidate Recommendation Initial definition ...
scroll-snap-align - CSS: Cascading Style Sheets
ap position in this axis. Safari currently has the two value syntax in the wrong order, the first value being inline the second block. See bug #191865. Formal definition Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax [ none | start | end | center ]{1,2} Specifications Specification Status Comment CSS Scroll Snap Module Level 1The definition of 'scroll-snap-align' in that specification. Candidate Recommendation Initial definition ...
scroll-snap-type-x - CSS: Cascading Style Sheets
Specifying any precise animations or physics used to enforce those snap points is not covered by this property but instead left up to the user agent. /* Keyword values */ scroll-snap-type-x: none; scroll-snap-type-x: mandatory; scroll-snap-type-x: proximity; /* Global values */ scroll-snap-type-x: inherit; scroll-snap-type-x: initial; scroll-snap-type-x: unset; Syntax Values none When the visual viewport of this scroll container is scrolled horizontally, it must ignore snap points. mandatory The visual viewport of this scroll container will rest on a snap point if it isn't currently scrolled horizontally. ...
scroll-snap-type-y - CSS: Cascading Style Sheets
Specifying any precise animations or physics used to enforce those snap points is not covered by this property but instead left up to the user agent. /* Keyword values */ scroll-snap-type-y: none; scroll-snap-type-y: mandatory; scroll-snap-type-y: proximity; /* Global values */ scroll-snap-type-y: inherit; scroll-snap-type-y: initial; scroll-snap-type-y: unset; Syntax Values none When the visual viewport of this scroll container is scrolled vertically, it must ignore snap points. mandatory The visual viewport of this scroll container will rest on a snap point if it isn't currently scrolled vertically. ...
user-modify - CSS: Cascading Style Sheets
read-only. read-write The user is able to read and write contents. read-write-plaintext-only Same as read-write, but rich text formatting will be lost. write-only The user is able to edit the content, but not to read it. Formal definition Value not found in DB! Formal syntax Syntax not found in DB! Examples HTML <div class="readwrite">The user is able to change this text.</div> CSS .readwrite { -moz-user-modify: read-write; -webkit-user-modify: read-write; } Specifications Not part of any standard. A similar property, user-focus, was proposed in early drafts of a predecessor of the CSS3 UI specification, but was rejected by the working group. ...
Index - Web APIs
Web › API › Index
on after first synchronizing its playback position. 82 AnimationEffect API, Animation, Experimental, Interface, Reference, Web Animations, web animations api The AnimationEffect interface of the Web Animations API defines current and future animation effects like KeyframeEffect, which can be passed to Animation objects for playing, and KeyframeEffectReadOnly (which is used by CSS Animations and Transitions). 83 AnimationEffect.getComputedTiming() API, Animation, Experimental, Method, Reference, getComputedTiming, waapi, web animations api The getComputedTiming() method of the AnimationEffect interface returns the calculated timing properties for this animation effect. 84 AnimationEffect.getTiming() API, Animation, Experimental, Method, ...
... waapi, web animations api The updateTiming() method of the AnimationEffect interface updates the specified timing properties for an animation effect. 86 AnimationEvent API, Experimental, Interface, Reference, Web Animations The AnimationEvent interface represents events providing information related to animations. ...
...ationEvent interface represents events providing information related to animations. 87 AnimationEvent() API, AnimationEvent, CSSOM, Constructor, Experimental, Reference, Web Animations The AnimationEvent() constructor returns a newly created AnimationEvent, representing an event in relation with an animation. 88 AnimationEvent.animationName API, AnimationEvent, CSSOM, Experimental, Property, Reference, Web Animations The AnimationEvent.animationName read-only property is a DOMString containing the value of the animation-name CSS property associated with the transition. ...
...And 320 more matches
Index - Archive of obsolete content
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 working with the application observer service. 109 sys...
...16 test/runner Sets up unit tests. 117 test/utils Helper methods used in the CommonJS Unit Testing suite. 118 ui/button/action Add a button to the Firefox user interface. 119 ui/button/toggle Add a toggle button to the Firefox user interface. 120 ui/frame Create HTML iframes, using bundled HTML, CSS and JavaScript, that can be added to a designated area of the Firefox user interface. 121 ui/id Create UI component IDs. 122 ui/sidebar Enables you to create sidebars. 123 ui/toolbar Add a toolbar to the Firefox user interface. 124 util/array Helper functions for working with arrays. 125 util/colle...
...aries provided by a third party). The Firefox extension system does not provide automatic support for loading these dependent libraries, but it is possible to load these libraries explicitly using a component stub. 307 Using the Stylesheet Service Add-ons, Extensions The stylesheet service allows extensions to manage user and UA stylesheets without having to touch userContent.css or userChrome.css files. The API is defined in nsIStyleSheetService.idl. 310 bookmarks.export() API, Add-ons, Bookmarks, Extensions, Method, Non-standard, Reference, WebExtensions, export Exports bookmarks to an HTML bookmark file. 311 bookmarks.import() API, Add-ons, Bookmarks, Extensions, Method, Non-standard, Reference, WebExtensions, import Imports bo...
...And 135 more matches
Index - Learn web development
Found 348 pages: # Page Tags and summary 1 Learn web development Beginner, CSS, HTML, Index, Intro, Landing, Learn, Web Welcome to the MDN learning area. This set of articles aims to provide complete beginners to web development with all that they need to start coding websites. 2 Accessibility ARIA, Accessibility, Articles, Beginner, CSS, CodingScripting, HTML, JavaScript, Landing, Learn, Module Learning some HTML, CSS, and JavaScript is useful if you want to become a web developer. Beyond mechanical use, it's important to learn how to use these technologies responsibly so that all readers might use your creations on the web. To help you achieve this, this module will cover general best practices (which are demonstrated through...
...We'll cover accessibility in special detail. ...
...3 Accessible multimedia Accessibility, Article, Audio, Beginner, CodingScripting, HTML, Images, JavaScript, Learn, Multimedia, Video, captions, subtitles, text tracks This chapter has provided a summary of accessibility concerns for multimedia content, along with some practical solutions. ...
...And 104 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
ructure, l10n:priority Ajax, which initially stood for Asynchronous JavaScript And XML, is a programming practice of building complex, dynamic webpages using a technology known as XMLHttpRequest. 15 Algorithm CodingScripting, Glossary An algorithm is a self-contained series of instructions to perform a function. ...
... 16 Alignment container Alignment container, CSS, Glossary, alignment The alignment container is the rectangle that the alignment subject is aligned within. This is defined by the layout mode; it is usually the alignment subject's containing block, and assumes the writing mode of the box establishing the containing block. 17 Alignment subject Alignment subject, CSS, Glossary, alignment In CSS Box Alignment the alignment subject is the thing (or things) being aligned by the property. 18 Alpha (alpha channel) Alpha, Alpha Channel, Drawing, Glossary, Graphics, Translucency, Translucent, Transparency, Transparent, WebGL, WebXR, channel, color, pixel Colors are represented in digital form as a collection of numbers, each representing t...
...r-second (Gbps). 27 Base64 Advanced, Base64, JavaScript, Typed Arrays, URI, URL, Unicode Problem, atob(), btoa() Base64 is a group of similar binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. The term Base64 originates from a specific MIME content transfer encoding. 28 Baseline CSS, Glossary, SVG, alignment, typography The baseline is a term used in European and West Asian typography meaning an imaginary line upon which the characters of a font rest. 29 BiDi Accessibility, Glossary BiDi (BiDirectional) refers to a document containing both right-to-left and left-to-right text. Even when both directionalities occur in the same paragraph, the text in...
...And 44 more matches
Theme changes in Firefox 2 - Archive of obsolete content
rticle called Updating themes for Firefox 2 that would serve as a how-to guide for updating themes. If anyone with theming experience would like to write one, please do! Browser changes requiring theme updates There are a number of changed and deleted files in the browser that may require you to make changes to your theme. The table lists both the changed XUL file and the theme's corresponding CSS file that you might need to update. Filename CSS File Details browser/base/searchDialog.xul browser/base/content/searchDialog.css Removed from Firefox 2. feeds/addFeedReader.xul feeds/addFeedReader.css New file that presents UI for adding a new feed reader. feeds/subscribe.xhtml feeds/subscribe.css New file that presents the UI for sub...
... toolkit/mozapps/preferences/fontscaling.xul - Removed from Firefox 2. ...
... toolkit/mozapps/preferences/fontscaling.xul - Removed from Firefox 2. ...
...And 27 more matches
Legacy layout methods - Learn web development
Previous Overview: CSS layout Next Grid systems are a very common feature used in CSS layouts, and before CSS Grid Layout they tended to be implemented using floats or other layout features. You imagine your layout as a set number of columns (e.g. 4, 6, or 12), and then fit your content columns inside these imaginary columns. In this article we'll explore how these older methods work, in order that you understand how they were used if you work on an older project. Prerequisites: HTML basics (study Introduction to HTML), and an idea of how CSS works (study Introduction to CSS and Styling boxes.) Objective: To understand the fundamental concepts behind the grid layout systems used prior to CSS Grid Layout being available in browsers. Layout and grid sys...
... understand how they were used if you work on an older project. Prerequisites: HTML basics (study Introduction to HTML), and an idea of how CSS works (study Introduction to CSS and Styling boxes.) Objective: To understand the fundamental concepts behind the grid layout systems used prior to CSS Grid Layout being available in browsers. Layout and grid systems before CSS Grid Layout It may seem surprising to anyone coming from a design background that CSS didn't have an inbuilt grid system until very recently, and instead we seemed to be using a variety of sub-optimal methods to create grid-like designs. ...
...S Grid Layout being available in browsers. Layout and grid systems before CSS Grid Layout It may seem surprising to anyone coming from a design background that CSS didn't have an inbuilt grid system until very recently, and instead we seemed to be using a variety of sub-optimal methods to create grid-like designs. We now refer to these as "legacy" methods. For new projects, in most cases CSS Grid Layout will be used in combination with one or more other modern layout methods to form the basis for any layout. You will however encounter "grid systems" using these legacy methods from time to time. It is worth understanding how they work, and why they are different to CSS Grid Layout. This lesson will explain how grid systems and grid frameworks based on floats and flexbox work. Having ...
...And 24 more matches
Style System Overview - Archive of obsolete content
Style System Style sheets & rules ? Rule tree ? ...
... Style System Style sheets & rules ? Rule tree ? ...
... Style System Style sheets & rules ? Rule tree ? ...
...And 21 more matches
Examples - Archive of obsolete content
Please refer to the article 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. ...
... 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 xmln...
...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>application/xhtml+xml</...
...And 21 more matches
Cascade and inheritance - Learn web development
We encourage you to work through this section carefully, and check that you understand the concepts before moving on. ...
...We encourage you to work through this section carefully, and check that you understand the concepts before moving on. ...
...han some other parts of the course, an understanding of these things will save you much pain later on! We encourage you to work through this section carefully, and check that you understand 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 th...
...And 21 more matches
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
irks. 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. ...
...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. ...
...le, 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. ...
...And 20 more matches
Introduction to automated testing - Learn web development
everal times per day, can get tedious, and time-consuming. To handle this efficiently, you should become familiar with automation tools. In this article, we look at what is available, how to use task runners, and how to use the basics of commercial browser test automation apps such as LambdaTest, Sauce Labs, BrowserStack, and TestingBot. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages; an idea of the high level principles of cross-browser testing. Objective: To provide an understanding of what automated testing entails, how it can make your life easier, and how to make use of some of the commercial products that make things easier. Automation makes things easy Throughout this module we have detailed loads of different ways in which...
... manually can be a real pain. Fortunately, there are tools to help us automate some of this pain away. There are two main ways in which we can automate the tests we've been talking about in this module: Use a task runner such as Grunt or Gulp, or npm scripts to run tests and clean up code during your build process. This is a great way to perform tasks like linting and minifying code, adding in CSS prefixes or transpiling nascent JavaScript features for maximum cross-browser reach, and so on. Use a browser automation system like Selenium to run specific tests on installed browsers and return results, alerting you to failures in browsers as they crop up. Commercial cross-browser testing apps like LambdaTest, Sauce Labs, BrowserStack, and TestingBot are based on Selenium, but allow you to ac...
... "main": "index.js", "scripts": { "test": "test" }, "author": "Chris Mills", "license": "MIT" } 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) us...
...And 19 more matches
reftest opportunities files - Archive of obsolete content
needs one or more reftests. If you create a reftest for any of these bugs please attach the reftest to the bug and ask for review from the assignee (or anyone else that seems appropriate judging from comments in the bug). Note that bugs with the testcase keyword already have one or more testcases attached to the bug that can be used when creating the reftest. ...
...reate a reftest for any of these bugs please attach the reftest to the bug and ask for review from the assignee (or anyone else that seems appropriate judging from comments in the bug). Note that bugs with the testcase keyword already have one or more testcases attached to the bug that can be used when creating the reftest. ...
...gs please attach the reftest to the bug and ask for review from the assignee (or anyone else that seems appropriate judging from comments in the bug). Note that bugs with the testcase keyword already have one or more testcases attached to the bug that can be used when creating the reftest. ...
...And 18 more matches
Styling tables - Learn web development
Previous Overview: Building blocks Next 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 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...
...<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. ...
...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 18 more matches
Implementing feature detection - Learn web development
rent code depending on whether it does (or doesn't), so that the browser can always provide a working experience rather than crashing/erroring in some browsers. This article details how to write your own simple feature detection, how to use a library to speed up implementation, and native features for feature detection such as @supports. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages; an idea of the high-level principles of cross-browser testing. Objective: To understand what the concept of feature detection is, and be able to implement suitable solutions in CSS and JavaScript. The concept of feature detection The idea behind feature detection is that you can run a test to determine whether a feature is supported in the current br...
...d like to say one thing upfront -- don't confuse feature detection with browser sniffing (detecting what 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...
...lexbox 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 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 ...
...And 18 more matches
Grids - Learn web development
What is grid layout? A grid is a collection of horizontal and vertical lines creating a pattern against which we can line up our design elements. ...
... What is grid layout? A grid is a collection of horizontal and vertical lines creating a pattern against which we can line up our design elements. ...
... What is grid layout? A grid is a collection of horizontal and vertical lines creating a pattern against which we can line up our design elements. ...
...And 17 more matches
Mozilla’s UAAG evaluation report
mmendation of UAAG 1.0. This may be different from the most recent version, check for updates on the User Agent Working Group home page. Look to the "techniques" document for real-world implementation examples of each checkpoint. This UAAG evaluation report covers nightly builds of the Mozilla web browser itself, running on Windows 2000, as of February 20, 2002. We are claiming to support HTML 4, CSS 2, PNG, JPG and GIF. This evaluation does not cover Mailnews or Composer. There may be accessibility and customizability features not listed here. A very good resource is The Customizing Document. When filing Mozilla bugs based on UAAG requirements, please use bug 24413 as the UAAG meta bug. Checkpoint Information (Same scaled used on W3C's UAAG implementation reports pages) Rating Scale...
...r: Cannot be activated with pointer 1.3 Provide text messages. (P1) C Status line and alert boxes used to convey messages and alerts Guideline 2. Ensure user access to all content. Checkpoint Title Status Notes/plans Checkpoint Title Status Notes/plans 2.1 Render content according to specification. (P1) VG Renders HTML, CSS, and a number of graphic image formats. Does not contradict current specifications for HTML and CSS rendering. 2.2 Provide text view. (P1) C Also known as view source. 2.3 Render conditional content. (P1) VG ALT for IMG: rendered when images turned off. See meta bug 41924 for open issues with the ALT attribute. TITLE for *any* element: rendered as tooltip LON...
...cValue not yet supported) 6.5 Programmatic alert of changes. (P1) G Uses Active Accessibility to generate change events to assistive technology 6.6 Conventional keyboard APIs. (P1) C Uses standard keyboard API, works with a number of assistive technologies 6.7 API character encodings. (P1) ? We use 16 bit strings, not sure about UTF-16 6.8 DOM CSS access. (P2) G The DOM is available in-process, but not via an out-of-process (COM) interface. Out-of-process access is needed for it to be truly useful for assistive technology 6.9 Timely access. (P2) NR Too vague to measure. Rating Scale C: Complete Implementation VG: Very Good Implementation, almost all requirements satisfied G: Good Im...
...And 17 more matches
Browser Detection and Cross Browser Support - Archive of obsolete content
oach to browser detection. Quick Tip If you must determine if a visitor is using a Gecko-based browser, simply test navigator.product == 'Gecko' or look for the string 'Gecko/' in the navigator.userAgent. Note that some other browsers such as Safari are reporting (like Gecko) in their user agent strings and can confuse simple tests. Introduction In an ideal world, we could author HTML, XML, CSS and JavaScript and only worry about the W3C and ECMA standards. However, we don't quite live in such a world yet. Due to bugs, incomplete implementations of the standards and legacy browsers, web developers must be able to determine which browser a visitor is using and provide the appropriate content and scripting code path. Although browser detection is perhaps the most common scripting task th...
...developers are aware of Firefox, Mozilla, and Netscape browsers, far fewer are aware that these browsers are members of an entire family of user agents based upon the Gecko layout engine which includes the commercial browser CompuServe 7, and open source browsers such as Epiphany, Galeon, Camino, Kmeleon, and SeaMonkey. Gecko was designed from the ground up to be compliant with the W3C HTML, W3C CSS, W3C XML, W3C DOM, and ECMAScript (JavaScript) standards. It also includes compatibility features which allow it to reasonably handle legacy content which was developed for earlier generations of browsers such as Netscape Navigator 4 as well as features which provide compatibility with Internet Explorer 5 and 6. Unlike other browsers, Gecko is truly cross platform and provides consistent behavior...
...lient side 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 existen...
...And 16 more matches
Supporting older browsers - Learn web development
Previous Overview: CSS layout Next In this module, we recommend using Flexbox and Grid as the main layout methods for your designs. However, there will be visitors to your site who use older browsers, or browsers which do not support the methods you have used. This will always be the case on the web -- as new features are developed, different browsers will prioritise different things. This article explains how to use modern web techniques without locking out users of older technology. Prerequisites: HTML basics (study Introduction to HTML), and an idea of how CSS works (study Introduction to CSS and Styling boxes.) Objective: To understand how to provide support for your layouts on older browsers that might not support the features you want to use. Wh...
...support for the features you want to use? Once you know the browsers that come to your site, you can assess any technology that you want to use against how well it is supported and how easily you can provide an alternative for visitors who do not have that technology available. We are trying to make this easy for you at MDN, by providing browser compatibility information on each page detailing a CSS property. For example, take a look at the page for grid-template-columns. At the bottom of this page is a table, which lists major browsers along with the version they began supporting this property. Another popular way to find out about how well a feature is supported is the Can I Use website. This site lists the majority of Web Platform features with information about their browser support s...
...ad it. Supporting everyone means serving a version of your content that is designed defensively, so that it will look great on modern browsers, but will still be usable 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 n...
...And 15 more matches
Gecko Compatibility Handbook - Archive of obsolete content
source project and based on W3 Standards rather than the proprietary approaches of the past. Adhering to web standards simplifies cross-browser web development and enables accessibility. 4.x vs. Gecko Since 1997, much of the Web's content has been developed for Microsoft Internet Explorer 4 or Netscape Navigator 4. ...
...d enables accessibility. 4.x vs. Gecko Since 1997, much of the Web's content has been developed for Microsoft Internet Explorer 4 or Netscape Navigator 4. These browsers were developed before the relevant W3C recommendations for HTML, CSS, and the DOM existed. These earlier, non-standards based browsers differed in several ways from Gecko: These browsers use proprietary (non-standard) HTML, CSS, and JavaScript. Internet Explorer 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 ...
...browser detection JavaScript detects Netscape 6.x but does not detect other Gecko-based browsers. Upgrade the browser detection JavaScript to detect "Gecko." (related article) Content differs in Gecko browsers and Internet Explorer Use of proprietary or invalid markup (such as is generated by some Microsoft Office applications). Use the W3 HTML and CSS Validator Tools to validate the web page. Correct any errors and replace proprietary code wherever possible. Upgrade web authoring tool to versions that support the W3 standards and Gecko browsers Content differs in Gecko browsers and Internet Explorer The JavaScript Console in Netscape 6.x and Netscape 7.x displays errors about document.all, document.layers, document.<p...
...And 14 more matches
nsIDOMWindowUtils
ze_is(count)] in PRUint32 aIdentifiers, [array, size_is(count)] in PRInt32 aXs, [array, size_is(count)] in PRInt32 aYs, [array, size_is(count)] in PRUint32 aRxs, [array, size_is(count)] in PRUint32 aRys, [array, size_is(count)] in float aRotationAngles, [array, size_is(count)] in float aForces, in PRUint32 count, in long aModifiers, [optional] in boolean aIgnoreRootScrollFrame); void setCSSViewport(in float aWidthPx, in float aHeightPx); void setDisplayPort(in float aXPx, in float aYPx, in float aWidthPx, in float aHeightPx); void setResolution(in float aXResolution, in float aYResolution); void startPCCountProfiling(); void stopPCCountProfiling(); void suppressEventHandling(in boolean aSuppress); void suspendTimeouts()...
...ID of the window's outer window. Read only. paintingSuppressed boolean true if painting is currently suppressed for this window; otherwise false. Read only. This is used on mobile, for example, to prevent attempts to render content until enough of the page has been loaded to avoid content bouncing around excessively as more content is loaded. screenPixelsPerCSSPixel float Returns the number of screen pixels per CSS pixel. Read only. audioMuted boolean With this it's possible to mute all the MediaElements in this window. We have audioMuted and audioVolume to preserve the volume across mute/umute. audioVolume float Range: greater or equal to 0. The real volume level is affected by the volume of all ancestor windows. ...
...Length 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 activateNativeMenuItemAt() See nsIWidget.ActivateNativeMenuIt...
...And 14 more matches
Using the Web Animations API - Web APIs
eb Animations API lets us construct animations and control their playback with JavaScript. This article will start you off in the right direction with fun demos and tutorials featuring Alice in Wonderland. Meet the Web Animations API The Web Animations API opens the browser's animation engine to developers and manipulation by JavaScript. 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. ...
...e 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 Web Animations API might be the perfect tool for the job. Let's see what it can do! Browser Support The basic Web Animations API ...
...ons, the Web Animations API might be the perfect tool for the job. Let's see what it can do! Browser Support The basic Web Animations API features discussed in this article are available by default in Firefox 48+ and Chrome 36+. Safari supports Web Animations in its Technology Preview version and there is also a handy polyfill that tests for feature support and adds it where necessary. ...
...And 14 more matches
Populating the page: how browsers work - Web Performance
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. Time to First Byte (TTFB...
... dropped. Meaning, there will be no acknowledgement. The server registers this as missing ACKs. Congestion control algorithms use this flow of sent packets and ACKs to determine a send rate. Parsing Once the browser receives the first chunk of data, it can begin parsing the information received. Parsing is the step the browser takes to turn the data it receives over the network into the DOM and CSSOM, which is used by the renderer to paint a page to the screen. The DOM is the internal representation of the markup for the browser. The DOM is also exposed, and can be manipulated through various APIs in JavaScript. Even if the request page's HTML is larger than the initial 14KB packet, the browser will begin parsing and attempting to render an experience based on the data it has. This is why...
...ed, and can be manipulated through various APIs in JavaScript. Even if the request page's HTML is larger than the initial 14KB packet, the browser will begin parsing and attempting to render an experience based on the data it has. This is why it's important for web performance optimization to include everything the browser needs to start rendering a page, or at least a template of the page - the CSS and HTML needed for the first render -- in the first 14 kilobytes. But before anything is rendered to the screen, the HTML, CSS, and JavaScript have to be parsed. Building the DOM tree We describe five steps in the critical rendering path. The first step is processing the HTML markup and building the DOM tree. HTML parsing involves tokenization and tree construction. HTML tokens include start ...
...And 14 more matches
The Box Model - Archive of obsolete content
following basic components: Boxes Text Images Alignment and flexibility Widths and heights Margins and paddings Menus, toolbar buttons, and even the most complex elements in XUL are composed of these simple ingredients. Complex elements are created from simpler ones through XBL, which will be covered later on. Once you grasp this simple idea, you'll be able to use the DOM Inspector and CSS to mold XUL elements and layouts with great precision and flexibility. Most of the examples shown in the rest of this section were generated using the XUL Box Alignment Example. We recommend you play around with it for a while to get an idea of how the basic parts of the box model work. In order to use this page, you'll need to install the Remote XUL Manager extension and add developer.mozilla.o...
...This is similarly the case for XUL, excep...
...ks on Mac OS (the black border was added for illustrative purposes, boxes don't have borders by default): If you use a vbox instead, it looks like this: The orientation of boxes (and most XUL elements) can be controlled using the orient attribute or the -moz-box-orient CSS property. With these you can make an hbox have vertical orientation and viceversa, although that isn't very useful. The CSS property may be useful on some occasions, but using the orient attribute is not recommended because it mixes content and presentation. Flexibility An HTML div is as big as its contents unless you override 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 t...
...And 13 more matches
Skinning XUL Files by Hand - Archive of obsolete content
manual interaction. This article can help you get started understanding skins and creating skins for XUL. 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. As you will see, CSS provides a lot of flexibility for defining styles to individual elements, to classes of elements, to pseudo-classes, and to anonymous classes. By the way, in contrast to the term skin, "chrome" refers to the skin and the content and whatever localization and platform-specific files are necessary for a particular part of the application or...
...refers to the skin and the content and whatever localization and platform-specific files are necessary for a particular part of the application or window. The skin is just the style or appearance of an interface, where the chrome is the style, content, and structure. 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. CSS2, for example, gives you control over the absolute positioning of any element within its parent element. Also, most of the behavior that buttons exhibit comes from styles and an event model based on JavaScript that dynamically switches between these styles. Mozilla's current global skin defines this basic behavior for several classes of button. A button is styled by the ...
...which styles for these several button classes and dozens of other elements are defined, is described in the following section. If you want to use the classes already defined in Mozilla's global skin to style your elements, you may do so. But you may also want to define new classes of buttons particular to your XUL file, in which case the style information will be wholly defined within your custom CSS file. Reading the Global Skin It's very important to familiarize yourself with the basic style definitions in the global skin before you set out creating your own stylesheet. CSS can quickly become complicated. The ability to apply styles to elements of a type, to specifically identified elements, and to classes of elements creates the potential for redundancies or conflicts in the style inform...
...And 13 more matches
Common Firefox theme issues and solutions - Archive of obsolete content
for solutions to this issue: http://forums.mozillazine.org/viewtopic.php?f=18&t=2131121 http://forums.mozillazine.org/viewtopic.php?f=18&t=1953371&start=60 Windows 7 Aero not going into full screen mode properly On Win7 with Aero Glass support Firefox doesn't always go to full screen mode from a normal window properly. The resolution to this issue is to add the following code to your browser.css file somewhere below where the main-window is made transparent to support Aero glass. @media all and (-moz-windows-compositor) { /* Make transition to Fullscreen mode seamlessly in Firefox 10+ */ #main-window[inFullscreen="true"] { -moz-appearance: none; background-color: -moz-dialog!important; } } For more information about this issue please see bug 732757 and bug 732757 and this...
...barbutton-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 issue is that Linux Firefox uses a different...
... 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 browsing mode When in private browsing mode there needs to be a visual difference to the Firefox app button that is displayed when ...
...And 13 more matches
The box model - Learn web development
Previous Overview: Building blocks Next Everything in CSS has a box around it, and understanding these boxes is key to being able to create layouts with CSS, or to align items with other items. In this lesson, we will take a proper look at the CSS Box Model so that you can build more complex layout tasks with an understanding of how it works and the terminology that relates to it. ...
... align items with other items. In this lesson, we will take a proper look at the CSS Box Model so that you can build more complex layout tasks with an understanding of how it works and the terminology that relates to it. 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 CSS Box Model, what makes up the box model and how to switch to the alternate model. Block and inline boxes In CSS we broadly have two types of boxes -- block boxes and inline boxes. These characteristics refer to how the box behaves in terms of page flow, and in relation to other boxes on the page: If a box is defi...
...ement, used for links, <span>, <em> and <strong> are all examples of elements that will display inline by default. The type of box applied to an element is defined by display property values such as block and inline, and relates to the outer value of display. Aside: Inner and outer display types At this point, we'd better also explain inner and outer display types. As mentioned above, boxes in CSS have an outer display type, which details whether the box is block or inline. Boxes also have an inner display type, however, which dictates how elements inside that box are laid out. By default, the elements inside a box are laid out in normal flow, which means that they behave just like any other block and inline elements (as explained above). We can, however, change the inner display type by...
...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 conten...
... like a series of inline 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. 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 exa...
...riate element (such as a <span> or <strong>), or use a text-specific pseudo-element like ::first-letter (selects the first letter of an element's text), ::first-line (selects the first line of an element's text), or ::selection (selects the text currently highlighted by the cursor.) Fonts Let's move straight on to look at properties for styling fonts. In this example we'll apply some different CSS properties to the same HTML sample, which looks like this: <h1>Tommy the cat</h1> <p>Well I remember it as though it were a meal ago...</p> <p>Said Tommy the Cat as he reeled back to clear whatever foreign matter may have nestled its way into his mighty throat. Many a fat alley rat had met its demise while staring point blank down the cavernous barrel of this awesome prowling machine. Truly ...
...And 13 more matches
Web fonts - Learn web development
Objective: To learn how to apply web fonts to a web page, using either a third party service, or by writing your own code. ...
... Objective: To learn how to apply web fonts to a web page, using either a third party service, or by writing your own code. ...
... Objective: To learn how to apply web fonts to a web page, using either a third party service, or by writing your own code. Font families recap As we looked at in Fundamental text and font styling, the fonts applied to your HTML can be controlled using the font-family property. ...
...And 13 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. ...
...These include: Elements involved in creating dropdown widgets, including <select>, <option>, <optgroup> and <datalist>. ...
...These include: Elements involved in creating dropdown widgets, including <select>, <option>, <optgroup> and <datalist>. ...
...And 13 more matches
Client-side form validation - Learn web development
mportant to ensure all required form controls are filled out, in the correct format. This is called client-side form validation, and helps ensure data submitted matches the requirements set forth in the various form controls. This article leads you through basic concepts and examples of client-side form validation. Prerequisites: Computer literacy, a reasonable understanding of HTML, CSS, and JavaScript. Objective: To understand what client-side form validation is, why it's important, and how to apply various techniques to implement it. Client-side validation is an initial check and an important feature of good user experience; by catching invalid data on the client-side, the user can fix it straight away. If it gets to the server and is then rejected, a notice...
...n email address, or some other specific preset type. 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. ...
... If the user tries to send the data, the browser will block the form and display an error message. ...
...And 13 more matches
Styling web forms - Learn web development
Previous Overview: Forms Next In the previous few articles we looked at all the HTML you'll need to create and structure your web forms. In this article we will move on to looking at how to use CSS to style your form controls. 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. Objective: To understand the issues behind styling forms, and learn some of the 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 specif...
... browsers give us more features to use. Prerequisites: Basic computer literacy, and a basic understanding of HTML and CSS. Objective: To understand the issues behind styling forms, and learn some of the basic styling techniques that will be useful to you. Why is styling form widgets challenging? ...
...learn some of the 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 s...
...And 13 more matches
Index - Firefox Developer Tools
Found 158 pages: # Page Tags and summary 1 Firefox Developer Tools Developing Mozilla, Guide, Tools, Web Development, Web Development:Tools, l10n:priority Firefox Developer Tools is a set of web developer tools built into Firefox. You can use them to examine, edit, and debug HTML, CSS, and JavaScript. 2 3D view HTML, Tools, Web Development, Web Development:Tools When you click on the 3D view button, the page goes into 3D view mode; in this mode, you can see your page presented in a 3D view in which nested blocks of HTML are increasingly "tall," projecting outward from the bottom of the page. This view makes it easy to visualize the nesting of your content. 3 Accessibility Inspector Accessibility, Accessibility in...
... Tools Over the course of DevTools development, we have added several experimental panels to try out new ideas. Not all of these have had wide adoption, and due to the cost of maintenance, seldom used panels are eventually removed. 29 DevTools API DevTools The DevTools API provides a way to register and access developer tools in Firefox. 30 DevToolsColors CSS This chart lists colors and CSS variables as implemented in the dark theme and light theme for developer tools. 31 Eyedropper Firefox, Tools, Web Development:Tools The Eyedropper tool enables you to select colors in the current page. It works like a magnifying glass over the page, enabling you to select with pixel precision. Underneath the magnifying glass it shows the ...
... help show you how 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. ...
...And 13 more matches
Overflowing content - Learn web development
Previous Overview: Building blocks Next Overflow is what happens when there is too much content to fit in a container. In this guide you will learn what overflow is and how to manage it. ...
... Previous Overview: Building blocks Next Overflow is what happens when there is too much content to fit in a container. In this guide you will learn what overflow is and how to manage it. ...
...ontainer. In this guide you will learn what overflow is and how to manage it. 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 overflow and how to manage it. What is overflow? Everything in CSS is a box. You can constrain the size of these boxes by assigning values of width and height (or inline-size and block-size). ...
...And 12 more matches
<link>: The External Resource Link element - HTML: Hypertext Markup Language
Web › HTML › Element › link
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 to the containing document. As you'll see from our Link types reference, there are many dif...
...type="image/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 th...
... values for this attribute and the elements or resources they apply to. Value Applies To audio <audio> elements document <iframe> and <frame> elements embed <embed> elements fetch fetch, XHR This value also requires <link> to contain the crossorigin attribute. ...
...And 12 more matches
Performance fundamentals - Web Performance
Firefox/Gecko contributes to performance generally, below the level of all applications. From a developer's or user's perspective, this answers the question, "What does the platform do for you?" Web technologies The Web platform provides many tools, some better suited for particular jobs than others. All application logic is written in JavaScript. To display graphics, developers can use HTML or CSS (i.e. high-level declarative languages), or use low-level imperative interfaces offered by the <canvas> element (which includes WebGL). Somewhere "in between" HTML/CSS and Canvas is SVG, which offers some benefits of both. HTML and CSS greatly increase productivity, sometimes at the expense of framerate or pixel-level control over rendering. Text and images reflow automatically, UI elements auto...
...iliar 2D drawing API, or WebGL, a "close to the metal" binding that mostly follows OpenGL ES 2.0. Gecko rendering The Gecko JavaScript engine supports just-in-time (JIT) compilation. This enables application logic to perform comparably to other virtual machines -- such as Java virtual machines -- and in some cases even close to "native code". The graphics pipeline in Gecko that underpins HTML, CSS, and Canvas is optimized in several ways. The HTML/CSS layout and graphics code in Gecko reduces invalidation and repainting for common cases like scrolling; developers get this support "for free". Pixel buffers painted by both Gecko "automatically" and applications to canvas "manually" minimize copies when being drawn to the display framebuffer. This is done by avoiding intermediate surfaces whe...
...ximum performance. To improve power usage, simple scenes are rendered using special dedicated composition hardware, while the GPU idles or turns off. Fully static content is the exception rather than the rule for rich applications. Rich applications use dynamic content with animation and transition effects. Transitions and animations are particularly important to applications: developers can use CSS to declare complicated behaviour with a simple, high-level syntax. In turn, Gecko's graphics pipeline is highly optimized to render common animations efficiently. Common-case animations are "offloaded" to the system compositor, which can render them in a performant, power-efficient fashion. An app's startup performance matters just as much as its runtime performance. Gecko is optimized to load a...
...And 12 more matches
Flexbox - Learn web development
These are fine and they work, but in some ways they are also rather limiting and frustrating. ...
...These are fine and they work, but in some ways they are also rather limiting and frustrating. ...
...These are fine and they work, but in some ways they are also rather limiting and frustrating. ...
...And 11 more matches
Practical positioning examples - Learn web development
This article shows how to build some real world examples to illustrate what kinds of things you can do with positioning. Prerequisites: HTML basics (study Introduction to HTML), and an idea of How CSS works (study Introduction to CSS.) Objective: To get an idea of the practicalities of positioning A tabbed info-box The first example we'll look at is a classic tabbed info box -- a very common feature used when you want to pack a lot of information into a small area. This includes information-heavy apps like strategy/war games, mobile versions of websites where the screen is narrow and space is limited, and compact information boxes where you might want to make lots of information available without having it fill the whole UI. Our simple example will look lik...
...tionality. 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 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...
...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. ...
...And 11 more matches
Responsive design - Learn web development
Previous Overview: CSS layout Next In the early days of web design, pages were built to target a particular screen size. If the user had a larger or smaller screen than the designer expected, results ranged from unwanted scrollbars to overly long line lengths, and poor use of space. As more diverse screen sizes became available, the concept of responsive web design (RWD) appeared, a set of practices that allows web pages to alter their layout and appearance to suit different screen widths, resolutions, etc. It is an idea that changed the way we design for a multi-device web, and in this article, we'll help you understand the main techniques you need to know to master it. ...
...RWD) appeared, a set of practices that allows web pages to alter their layout and appearance to suit different screen widths, resolutions, etc. It is an idea that changed the way we design for a multi-device web, and in this article, we'll help you understand the main techniques you need to know to master it. Prerequisites: HTML basics (study Introduction to HTML), and an idea of how CSS works (study CSS first steps and CSS building blocks.) Objective: To understand the fundamental concepts and history of responsive design. Historic website layouts At one point in history you had two options when designing a website: You could create a liquid site, which would stretch to fill the browser window or a fixed width site, which would be a fixed size in pixels. ...
...re responsive design A number of approaches were developed to try to solve the downsides of the liquid or fixed-width methods of building websites. In 2004 Cameron Adams wrote a post entitled Resolution dependent layout, describing a method of creating a design that could adapt to different screen resolutions. This approach required JavaScript to detect the screen resolution and load the correct CSS. Zoe Mickley Gillenwater was instrumental in her work to describe and formalize the different ways in which flexible sites could be created, attempting to find a happy medium between filling the screen or being completely fixed in size. Responsive design The term responsive design was coined by Ethan Marcotte in 2010 and described the use of three techniques in combination. The first was th...
...And 11 more matches
Getting started with Svelte - Learn web development
We will see how Svelte works and what sets it apart from the rest of the frameworks and tools we've seen so far. Then we will learn how to setup our development environment, create a sample app, understand the structure of the project, and see how to run it locally and build it for production. 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. Svelte is a compiler that generates minimal and highly optimized JavaScript code from our sources; you'll need a terminal with node + npm installed to compile and build your app. Objective: To setup a local Svelte development environment, create and build a starter app, and understand the basics of ho...
... a compile step that happens only when you build your app, producing highly-optimized vanilla JavaScript. The outcome of this approach is not only smaller application bundles and better performance, but also a developer experience that is more approachable for people that have limited experience of the modern tooling ecosystem. Svelte sticks closely to the classic web development model of HTML, CSS, and JS, just adding a few extensions to HTML and JavaScript. It arguably has fewer concepts and tools to learn than some of the other framework options. It's main current disadvantages are that it is a young framework -- its ecosystem is therefore more limited in terms of tooling, support, plugins, clear usage patterns, etc. than more mature frameworks, and there are also less job opportunities...
...interactive pages or complex visualizations: If you are building data-visualizations that need to display a large number of DOM elements, the performance gains that come from a framework with no runtime overhead will ensure that user interactions are snappy and responsive. Onboarding people with basic web development knowledge: Svelte has a shallow learning curve. Web developers with basic HTML, CSS, and JavaScript knowledge can easily grasp Svelte specifics in a short time and start building web applications. Moreover, with the help of Sapper (a framework based on Svelte), you can also develop applications with advanced features like server-side rendering, code splitting, file-based routing and offline support. And then there's also Svelte Native, which lets you build native mobile applic...
...And 11 more matches
Migrating from Firebug - Firefox Developer Tools
o the console is expanded in Firebug. The Web Console displays a preview within the Response tab. It is currently missing the preview for HTML, XML and SVG, though, which is tracked in bug 1247392 and bug 1262796, but when you click on the URL of the request you switch to the Network Monitor, which has a Preview tab. Inspector Firebug has an HTML panel, which allows to edit HTML/XML/SVG and the CSS related to it. Within the DevTools this functionality is served by the Page Inspector. Edit HTML Within the Page Inspector the tag attributes and the contents can be edited inline just like in Firebug. Beyond that it allows to edit the tag names inline. You can also edit the HTML directly. In Firebug you do this by right-clicking a node and clicking Edit HTML... in the context menu. In the Dev...
...licking a node and clicking Edit HTML... in the context menu. In the DevTools this option is also available via the context menu. There the option is called Edit As HTML. Only the live preview of changes is currently missing, which is tracked in bug 1067318 and bug 815464. Copy HTML and related information 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. Firebug has a Style side panel for this, the DevTools have a Rules side panel. In Firebug you add new rules by ...
...he node view in a similar way. Firebug has a Style side panel for this, the DevTools have a Rules side panel. In Firebug you add new rules by right-clicking and choosing Add Rule... from the context menu. The DevTools also have a context menu option for that named Add New Rule and additionally have a + button within the Rules panel's toolbar to create new rules. To edit element styles, i.e. ...
...And 11 more matches
Tutorials
h of the functionality you need for interacting with websites, e.g. 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. ...
...eracting with websites, e.g. 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. ...
...h websites, e.g. 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. ...
...And 11 more matches
Using your new knowledge - Learn web development
Previous Overview: First steps 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 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. Starting point You can work in the live editor below, or you can download the starting point to work with in your own editor. This is a single page with the HTML, plus the starting point CSS in the head of the document. If you prefer you could move this ...
...nding of HTML basics (study Introduction to HTML). Objective: To have a play with some CSS and test your new-found knowledge. Starting point You can work in the live editor below, or you can download the starting point to work with in your own editor. This is a single page with the HTML, plus the starting point CSS in the head of the document. If you 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. ...
...HTML, plus the starting point CSS in the head of the document. If you 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 cla...
...And 10 more matches
Styling links - Learn web development
ous 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, showing you...
...k when it has been focused (for example moved to by a keyboard user using the Tab key or similar, or programmatically focused using HTMLElement.focus()) -- this is styled using the :focus pseudo class. Active: A link when it is being activated (e.g. clicked on), styled using the :active pseudo class. Default styles The following example illustrates what a link will behave like by default (the CSS is simply enlarging and centering the text to make it stand out more.) <p><a href="#">A simple link</a></p> p { font-size: 2rem; text-align: center; } Note: All the links in the examples in this page are fake links -- a # (hash, or pound sign) is put in place of the real URL. This is because if the real links were included, clicking on them would break the examples (you'd end up with a...
...at all, just that you should not stray too far from the expected behaviour. You should at least: Use underlining for links, but not for other things. If you don't want to underline links, at least highlight them in some other way. Make them react in some way when hovered/focused, and in a slightly different way when activated. The default styles can be turned off/changed using the following CSS properties: color for the text color. cursor for the mouse pointer style -- you shouldn't turn this off unless you've got a very good reason. outline for the text outline (an outline is similar to a border, the only difference being that border takes up space in the box and an outline doesn't; it just sits over the top of the background). The outline is a useful accessibility aid, so think c...
...And 10 more matches
Handling common accessibility problems - Learn web development
Previous Overview: Cross browser testing Next Next we turn our attention to accessibility, providing information on common problems, how to do simple testing, and how to make use of auditing/automation tools for finding accessibility issues. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages; an idea of the high level principles of cross browser testing. Objective: To be able to diagnose common Accessibility problems, and use appropriate tools and techniques to fix them. What is accessibility? When we say accessibility in the context of web technology, most people immediately think of making sure websites/apps are usable by people with disabilities, for example: Visually impaired people using screen readers or magnificati...
... in many parts of the world to make web content accessible to people with disabilities. Read Accessibility guidelines and the law for more information. HTML Semantic HTML (where the elements are used for their correct purpose) is accessible right out of the box -- such content is readable by sighted viewers (provided you don't do anything silly like make the text way too small or hide it using CSS), but will also be usable by assistive technologies like screen readers (apps that literally read out a web page to their user), and confer other advantages too. Semantic structure The most important quick win in semantic HTML is to use a structure of headings and paragraphs for your content; this is because screen reader users tend to use the headings of a document as signposts to find the con...
...ragraph here too.</p> <h2>My subheading</h2> <p>This is the first subsection of my document. I'd love people to be able to find this content!</p> <h2>My 2nd subheading</h2> <p>This is the second subsection of my content. I think it is more interesting than the last one.</p> In addition, your content should make logical 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. 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 th...
...And 10 more matches
Experimental features in Firefox
y to block page rendering. Read Preloading content with rel="preload" for more details. For more details on the status of this feature, see bug 1639607. Release channel Version added Enabled by default? Nightly 78 Yes Developer Edition 78 Yes Beta 78 Yes Release 78 No Preference name network.preload CSS Display stray control characters in CSS as hex boxes This feature renders control characters (Unicode category Cc) other than tab (U+0009), line feed (U+000A), form feed (U+000C), and carriage return (U+000D) as a hexbox when they are not expected. See bug 1099557 for more details. Release channel Version added Enabled by default? Nightly 43 Yes De...
...other than tab (U+0009), line feed (U+000A), form feed (U+000C), and carriage return (U+000D) as a hexbox when they are not expected. See bug 1099557 for more details. Release channel Version added Enabled by default? Nightly 43 Yes Developer Edition 43 No Beta 43 No Release 43 No Preference name layout.css.control-characters.enabled or layout.css.control-characters.visible Property: initial-letter The initial-letter CSS property is part of the CSS Inline Layout specification and allows you to specify how dropped, raised, and sunken initial letters are displayed. See bug 1223880 for more details. Release channel Version added Enabled by default? Nightly 50 ...
...s part of the CSS Inline Layout specification and allows you to specify how dropped, raised, and sunken initial letters are displayed. See bug 1223880 for more details. Release channel Version added Enabled by default? Nightly 50 No Developer Edition 50 No Beta 50 No Release 50 No Preference name layout.css.initial-letter.enabled Conic gradients Conic gradients expand CSS gradients to allow the color transitions to be rendered circling around a center 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 ...
...And 10 more matches
Creating localizable web applications
mendations or for clarity. Cheatsheet Don't hardcode English text, formats (numbers, dates, addresses, etc.), word order or sentence structure. Don't put text or numbers in images. Don't forget about right-to-left locales. Take advantage of printf() (or equivalents) and use variables in the English strings. Write semantic code (e.g. don't use text and <img/> for decorations; instead, use CSS). Document your code so that localizers know what they're translating (e.g. in gettext use comments and contexts). App Logic Detect the locale correctly Be smart about detecting the user's locale correctly. You can use one or more of the following techniques: HTTP Accept-Language headers, the UA string, IP geolocation. See examples of the addons.mozillaorg code at /addons/trunk/site/a...
...calized, you may consider removing links to the English-only pages from the navigation (headers, footers, sidebars) in the localized versions. Define the locale and the direction in the HTML Generate the lang attribute dynamically, depending on the current locale. ...
...ers, footers, sidebars) in the localized versions. Define the locale and the direction in the HTML Generate the lang attribute dynamically, depending on the current locale. Use the dir attribute on the <html/> element and consider using a rtl class on <html/> or <body/> as well, in order to easily change CSS rules like in the example below. Snippet 1. Bad: <html lang="en"> Snippet 2. ...
...And 10 more matches
<tr>: The Table Row element - HTML: Hypertext Markup Language
Web › HTML › Element › tr
his uses the char and charoff to establish the alignment character (typically "." or "," when aligning numerical data) and the number of characters that should follow the alignment character. This alignment type was never widely supported. If no value is expressly set for align, the parent node's value is inherited. Instead of using the obsolete align attribute, you should instead use the CSS text-align property to establish left, center, right, or justify alignment for the row's cells. To apply character-based alignment, set the CSS text-align property to the alignment character (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...
...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 attempting to ...
...w'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 attempting to align numbers or monetary values. If align is not set to char, this attribute is ignored. This attribute is not only obsolete, but was rarely implemented anyway. To achieve the same effect as the char attribute, set the CSS text-align property to the same string you would specify for the char property, such as text-align: ".". charoffObsolete since HTML5 A DOMString indicating the number of characters on the tail end of the column's data should be displayed after the alignment character specified by the char attribute. For example, when displaying money values for currencies that use hundredths of a unit ...
...And 10 more matches
Critical rendering path - Web Performance
The browser engine combines the two to create the Render Tree. Layout determines the size and location of everything on the page. ...
...The browser engine combines the two to create the Render Tree. Layout determines the size and location of everything on the page. ...
...The browser engine combines the two to create the Render Tree. Layout determines the size and location of everything on the page. ...
...And 10 more matches
Advanced styling effects - Learn web development
Box shadows box-shadow allows you to apply one or more drop shadows to an element's box. ...
... Box shadows box-shadow allows you to apply one or more drop shadows to an element's box. ...
... your designs to make sure your content is legible without them. You can find the examples in this section at box-shadow.html (see the source code too). A simple box shadow Let's look at a simple example to get things started. ...
...And 9 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 r...
...erequisites: 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 replaced elements. This means that CSS cannot affect the internal layout of these elements -- only their position on the page amongst other elements. As we will see however, there are various things that CSS can do with an image. Certain replaced elements, such as images and video, are also described as having an aspect ratio. This means that it has a size in both the horizontal (x) and vertical (y) dimensions, and will be displayed ...
...If you place an image inside a box that is smaller or larger than the intrinsic dimensions of the image file in either direction, it will either appear smaller than the box, or overflow the box. You need to make a decision about what happens with the overflow. ...
...And 9 more matches
Handling common JavaScript problems - Learn web development
vious Overview: Cross browser testing Next Now we'll look at common cross-browser JavaScript problems and how to fix them. This includes information on using browser dev tools to track down and fix problems, using Polyfills and libraries to work around problems, getting modern JavaScript features working in older browsers, and more. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages; an idea of the high-level principles of cross browser testing. Objective: To be able to diagnose common JavaScript cross-browser problems, and use appropriate tools and techniques to fix them. The trouble with JavaScript Historically, JavaScript was plagued with cross-browser compatibility problems -- back in the 1990s, the main browser choices back ...
...owsers from running code they could otherwise use just fine. When developers make use of new/nascent JavaScript features (for example ECMAScript 6 / ECMAScript Next features, modern Web APIs...) in their code, and find that such features don't work in older browsers. We'll explore all these problems and more below. Fixing general JavaScript problems As we said in the previous article on HTML/CSS, you should make sure your code is working generally, before going on to concentrate on the cross-browser issues. If you are not already familiar with the basics of Troubleshooting JavaScript, you should study that article before moving on. There are a number of common JavaScript problems that you will want to be mindful of, such as: Basic syntax and logic problems (again, check out Troublesho...
...re the request is complete and the response has been returned before trying to use the response for anything. This kind of operation has been made easier to handle by the introduction of Promises to the JavaScript language. Note: Buggy JavaScript Code: The 10 Most Common Mistakes JavaScript Developers Make has some nice discussions of these common mistakes and more. Linters As with HTML and CSS, you can ensure better quality, less error-prone JavaScript code using a linter, which points out errors and can also flag up warnings about bad practices, etc., and be customized to be stricter or more relaxed in their error/warning reporting. The JavaScript/ECMAScript linters we'd recommend are JSHint and ESLint; these can be used in a variety of ways, some of which we'll detail below. Online ...
...And 9 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. ...
...tyle 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. (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...
... 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 pseudo-elements defined in the CSS specification (:before, :after, :first-line, :first-letter), but few of Mozilla's custom pseudo-elements, many of which are hacks for further formatting objects that we create. The pres context forwards these calls to its style set object (StyleSetImpl, interface nsIStyleSet), which does the real work (and also maintains the lists of stylesheets and owns the rule tree). These methods may all retu...
...And 9 more matches
inIDOMUtils
ass); void clearPseudoClassLocks(in nsIDOMElement aElement); [implicit_jscontext] jsval colorNameToRGB(in DOMString aColorName); nsIArray getBindingURLs(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 a...
...tional] 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 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 nsID...
...city(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 setContentState(in ns...
...And 9 more matches
The building blocks of responsive design - Progressive web apps (PWAs)
ens 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 inside their container's widths, no matter what. However, if they aren't as wide as their containers, they will not stretch to fill them. In the snapshot example, we ended up with slightly different code: x-card:nth-child(1) video, x-card:nth-child(2) img { width: 100%; ... } This is because in our...
...ssible to end up with a messy layout with different sized elements when using max-width: 100%, such as: Media queries Fluid grids are a great start, but you'll notice that at certain points (known as breakpoints) the layout starts to break down. At these points you'll want to change the layout to rectify 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...
...e 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. ...
...And 9 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 lis...
... 2D Graphics, Graphics, Icons, Images, Reference, Responsive Design, SVG, Scalable Graphics, Scalable Images, Vector Graphics, Web, l10n:priority Scalable Vector Graphics (SVG) are an XML-based markup language for describing two-dimensional based vector graphics.XML 2 Applying SVG effects to HTML content CSS, Guide, HTML, SVG Modern browsers support using SVG within CSS styles to apply graphical effects to HTML content. 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'...
...date, SVG Event attributes always have their name starting with "on" followed by the name of the event for which they are intended. They specifies some script to run when the event of the given type is dispatched to the element on which the attributes are specified. 17 SVG Presentation Attributes Attribute, Beginner, Draft, Reference, SVG SVG presentation attributes are CSS properties that can be used as attributes on SVG elements. 18 SVG Styling Attributes Attribute, Beginner, NeedsExample, Reference, SVG The SVG styling attributes are all the attributes that can be specified on any SVG element to apply CSS styling effects. 19 accent-height Deprecated, NeedsExample, SVG, SVG Attribute The accent-height attribute defines the...
...And 9 more matches
jspage - Archive of obsolete content
w;var k=f.document;a=a||f.event;if(a.$extended){return a;}this.$extended=true;var j=a.type; var g=a.target||a.srcElement;while(g&&g.nodeType==3){g=g.parentNode;}if(j.test(/key/)){var b=a.which||a.keyCode;var m=Event.Keys.keyOf(b);if(j=="keydown"){var d=b-111; if(d>0&&d<13){m="f"+d;}}m=m||String.fromCharCode(b).toLowerCase();}else{if(j.match(/(click|mouse|menu)/i)){k=(!k.compatMode||k.compatMode=="CSS1Compat")?k.html:k.body; var i={x:a.pageX||a.clientX+k.scrollLeft,y:a.pageY||a.clientY+k.scrollTop};var c={x:(a.pageX)?a.pageX-f.pageXOffset:a.clientX,y:(a.pageY)?a.pageY-f.pageYOffset:a.clientY}; if(j.match(/DOMMouseScroll|mousewheel/)){var h=(a.wheelDelta)?a.wheelDelta/120:-(a.detail||0)/3;}var e=(a.which==3)||(a.button==2);var l=null;if(j.match(/over|out/)){switch(j){case"mouseover":l=a.related...
...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,"<table><tbody><tr>","</tr></tbo...
...:"alpha(opacity="+a*100+")"; }this.style.opacity=a;this.store("opacity",a);},get:function(){return this.retrieve("opacity",1);}};Element.implement({setOpacity:function(a){return this.set("opacity",a,true); },getOpacity:function(){return this.get("opacity");},setStyle:function(b,a){switch(b){case"opacity":return this.set("opacity",parseFloat(a));case"float":b=(Browser.Engine.trident)?"styleFloat":"cssFloat"; }b=b.camelCase();if($type(a)!="string"){var c=(Element.Styles.get(b)||"@").split(" ");a=$splat(a).map(function(e,d){if(!c[d]){return"";}return($type(e)=="number")?c[d].replace("@",Math.round(e)):e; }).join(" ");}else{if(a==String(Number(a))){a=Math.round(a);}}this.style[b]=a;return this;},getStyle:function(g){switch(g){case"opacity":return this.get("opacity"); case"float":g=(Browser.Engine...
...And 8 more matches
Browser Feature Detection - Archive of obsolete content
efined for specific W3C DOM APIs and lists the percentage of names that your browser actually defines followed by a list of each of the API names tested along with an indication of whether the name was defined for your browser. It is clear from these test results that Netscape 7.0x and Mozilla Firefox have the greatest DOM support although Internet Explorer, Safari, and Opera have sufficient DOM CSS 1 and DOM Level 1 & 2 document property and method support to enable cross browser web development. Test Summary Standard Netscape 7.0x Firefox 1.5 Safari 2 Opera 7 / 8.5-9.0 Internet Explorer 6 / 7 DOM Core 1 100% 100% 100% 75% / 91% 75% / 75% DOM Core 2 100% 100% 100% 70% / 94% 58% / 58% DOM 1 HTML 100% ...
...rt to enable cross browser web development. ...
...ndard Netscape 7.0x Firefox 1.5 Safari 2 Opera 7 / 8.5-9.0 Internet Explorer 6 / 7 DOM Core 1 100% 100% 100% 75% / 91% 75% / 75% DOM Core 2 100% 100% 100% 70% / 94% 58% / 58% DOM 1 HTML 100% 100% 100% 100% / 100% 100% / 100% DOM CSS 1 100% 100% 100% 100% / 100% 96% / 96% DOM CSS 2 100% 98% 67% 71% / 83% 38% / 42% Test Results Cross Reference DOM Core Level 1 Support for properties/methods in document name Firefox 1.5 IE 6 & 7 Opera 8.54 - 9.01 Document.doctype true true true Document.implementation true true true Document.documentElement true true true Document.creat...
...And 8 more matches
HTML: A good basis for accessibility - Learn web development
accessibility As you learn more about HTML -- read more resources, look at more examples, etc. -- you'll keep seeing a common theme: the importance of using semantic HTML (sometimes called POSH, or Plain Old Semantic HTML). This means using the correct HTML elements for their intended purpose as much as possible. You might wonder why this is so important. After all, you can use a combination of CSS and JavaScript to make just about any HTML element behave in whatever way you want. For example, a control button to play a video on your site could be marked up like this: <div>Play video</div> But as you'll see in greater detail later on, it makes sense to use the correct element for the job: <button>Play video</button> Not only do HTML <button>s have some suitable styling applied by defaul...
...ersion 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 readers for whom the text...
...able to be looked at (although some screen readers can guess the difference between table layouts and data tables). You'll then likely (depending on which screen reader you're using) have to go down into the table as an object and look at its features separately, then get out of the table again to carry on navigating the content. Table layouts are a relic of the past -- they made sense back when CSS support was not widespread in browsers, but now they just create confusion for screen reader users. Additionally, their source code requires more markup, which makes them less flexible and more difficult to maintain. You can verify these claims by comparing your previous experience with a more modern website structure example, which could look something like this: <header> <h1>Header</h1> </he...
...And 8 more matches
HTML: A good basis for accessibility - Learn web development
accessibility As you learn more about HTML -- read more resources, look at more examples, etc. -- you'll keep seeing a common theme: the importance of using semantic HTML (sometimes called POSH, or Plain Old Semantic HTML). This means using the correct HTML elements for their intended purpose as much as possible. You might wonder why this is so important. After all, you can use a combination of CSS and JavaScript to make just about any HTML element behave in whatever way you want. For example, a control button to play a video on your site could be marked up like this: <div>Play video</div> But as you'll see in greater detail later on, it makes sense to use the correct element for the job: <button>Play video</button> Not only do HTML <button>s have some suitable styling applied by defaul...
...ersion 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 readers for whom the text...
...able to be looked at (although some screen readers can guess the difference between table layouts and data tables). You'll then likely (depending on which screen reader you're using) have to go down into the table as an object and look at its features separately, then get out of the table again to carry on navigating the content. Table layouts are a relic of the past -- they made sense back when CSS support was not widespread in browsers, but now they just create confusion for screen reader users. Additionally, their source code requires more markup, which makes them less flexible and more difficult to maintain. You can verify these claims by comparing your previous experience with a more modern website structure example, which could look something like this: <header> <h1>Header</h1> </he...
...And 8 more matches
Handling different text directions - Learn web development
Previous Overview: Building blocks Next Many of the properties and values that we have encountered so far in our CSS learning have been tied to the physical dimensions of our screen. We create borders on the top, right, bottom, and left of a box, for example. These physical dimensions map very neatly to content that is viewed horizontally, and by default the web tends to support left-to-right languages (e.g. English or French) better than right-to-left languages (such as Arabic). In recent years however, CSS has evolved in order to better support different directionality of content, including right-to-left but also top-to-bottom content (such as Japanese) -- these different directionalities are called writing modes. As you progress in your study and begin to work with layout...
...these different directionalities are called writing modes. As you progress in your study and begin to work with layout, an understanding of writing modes will be very helpful to you, therefore we will introduce them now. 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 importance of writing modes to modern CSS. What are writing modes? A writing mode in CSS refers to whether the text is running horizontally or vertically. The writing-mode property lets us switch from one writing mode to another. You don't need to be working in a language which uses a vertical writing mode to want to ...
...ng mode the block direction runs right-to-left horizontally. So the block dimension is always the direction blocks are displayed on the page in the writing mode in use. The inline dimension is always the direction a sentence flows. This figure shows the two dimensions when in a horizontal writing mode. This figure shows the two dimensions in a vertical writing mode. Once you start to look at CSS layout, and in particular the newer layout methods, this idea of block and inline becomes very important. We will revisit it later on. Direction In addition to writing mode we also have text direction. As mentioned above, some languages such as Arabic are written horizontally, but right-to-left. This is not something you are likely to use in a creative sense -- if you simply want to line someth...
...And 8 more matches
Beginner's guide to media queries - Learn web development
Media queries are a key part of responsive web design, as they allow you to create different layouts depending on the size of the viewport, but they can also be used to detect other things about the environment your site is running on, for example whether the user is using a touchscreen rather than a mouse. In this lesson you will first learn about the syntax used in media queries, and then move on to use them in a worked example showing how a simple design might be made responsive. ...
...ther things about the environment your site is running on, for example whether the user is using a touchscreen rather than a mouse. In this lesson you will first learn about the syntax used in media queries, and then move on to use them in a worked example showing how a simple design might be made responsive. ...
... the environment your site is running on, for example whether the user is using a touchscreen rather than a mouse. In this lesson you will first learn about the syntax used in media queries, and then move on to use them in a worked example showing how a simple design might be made responsive. ...
...And 8 more matches
Styling lists - Learn web development
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. ...
... 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. ...
... 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. ...
...And 8 more matches
Getting started with Ember - Learn web development
Previous Overview: Client-side JavaScript frameworks Next In our first Ember article we will look at how Ember works and what it's useful for, install the Ember toolchain locally, create a sample app, and then do some initial setup to get it ready for development. 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. 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 install Ember, and create a starter app. Introducing Ember Ember is a component-service framework that focuses on the overall web applica...
...ts: Add keyboard access to demos Re-enable Outline on focusable elements Ember has a strong commitment to being accessible by default and there is an entire section of the Ember Guides on accessibility on what it means for website / app design. That said, because this tutorial is a focus on the JavaScript side of making a small web application, TodoMVC's value comes from providing pre-made CSS and recommended HTML structure, which eliminates small differences between implementations, allowing for easier comparison. Later on in the tutorial, we'll focus on adding code to our application to fix some of TodoMVC's biggest faults. Installing the Ember tooling Ember uses a command-line interface (CLI) tool for building and scaffolding parts of your application. You'll need node and n...
...vironment that includes the following features by default: Development server with live reload. Plugin-architecture that allows for third-party packages to richly enhance your application. The latest JavaScript via Babel and Webpack integration. Automated testing environment that runs your tests in the browser, allowing you to test like a user. Transpilation, and minification, of both CSS and JavaScript for production builds. Conventions for minimizing the differences between applications (allowing easier mental context switching). Getting ready to build our Ember project You'll need a code editor before continuing to interact with your 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 th...
...And 8 more matches
Introducing a complete toolchain - Learn web development
he process of building up a sample case study toolchain. We'll go all the way from setting up a sensible development environment and putting transformation tools in place to actually deploying your app on Netlify. In this article we'll introduce the case study, set up our development environment, and set up our code transformation tools. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages. Objective: To solidify what we've learnt so far by working through a complete toolchain case study. There really are unlimited combinations of tools and ways to use them, what you see in this article and the next is only one way that the featured tools can be used for a project. Note: It's also worth repeating that not all of these tools need to be ...
... do things like defining component structures inside JavaScript. You won't need to know React to follow this tutorial, but we've included this to give you an idea of how a non-native web language could be integrated into a toolchain. The latest built-in JavaScript features (at time of writing), such as import. Useful development tools such as Prettier for formatting and eslint for linting. PostCSS to provide CSS nesting capabilities. Parcel to build and minify our code, and to write a bunch of configuration file content automatically for us. GitHub to manage our source code control. Netlify to automate our deployment process. You may not be familiar with all the above features and tools or what they are doing, but don't panic -- we'll explain each part as we move through this article.
...rly and consider if there's any upgrades or changes you should introduce, but this shouldn't be required too often. Your toolchain will depend on your own needs, but for this example of a (possible) complete toolchain, the tools that will be installed up front will be: Library installation tools -- for adding dependencies. Code revision control. Code tidying tools -- for tidying JavaScript, CSS, and HTML. Code linting tools -- for linting our code. Library installation tools We'll use npm to install our tools, which you first met in Chapter 2. You should have Node.js and npm installed already, but if not, refer back to that section. Note: Though it's not clear from the install process, installing npm also installs a complimentary tool called npx. We will use npx later on this chap...
...And 8 more matches
Client-side tooling overview - Learn web development
Overview: Understanding client-side tools Next In this article we provide an overview of modern web tooling, what kinds of tools are available and where you'll meet them in the lifecycle of web app development, and how to find help with individual tools. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages. Objective: To understand what types of client-side tooling there are, and how to find tools and get help with them. Overview of modern tooling Writing software for the web has become more sophisticated through the ages. Although it is still entirely reasonable to write HTML, CSS, and JavaScript "by hand" there is now a wealth of tools that developers can use to speed up the process of building a web site, or app. There are ...
...umber 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 their eslint configs. You can also find linting tools for other languages, such as csslint. Also well-worth looking at is webhint, a configurable, open-source linter for the web that surfaces best practices including approaches to accessibility, performance, cross-browser compatibility via MDN's browser compatibility data, security, testing for PWAs, and more. It is available as a Node.js command-line tool and a VS Code extension. Source code control Also known as version contro...
...ng" to make sure only the parts of your code libraries that you are actually using are put into your final production code, or "minifying" to remove all the whitespace in your production code, making it as small as possible before it is uploaded to a server. Parcel is a particularly clever tool that fits into this category -- it can do the above tasks, but also helps to package assets like HTML, CSS, and image files into convenient bundles that you can then go on to deploy, and also adds dependencies for you automatically whenever you try to use them. It can even handle some code transformation duties for you. Webpack is another very popular packaging tool that does similar things. Transformation This stage of your web app lifecycle typically allows you to code in either "future code" (su...
...And 8 more matches
Web Video Text Tracks Format (WebVTT) - Web APIs
ds can watch it with their parents. 1 00:02:15.000 --> 00:02:20.000 - Ta en kopp varmt te. - Det ar 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 the <b> element are colored "peachpuff". The HTML snippet below actually handles displayi...
...unds, 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. In this case, you insert your CSS rules into the file with each rule preceded by the string "STYLE" all by itelf on a line of text, as shown below: WEBVTT STYLE ::cue { background-image: linear-gradient(to bottom, dimgray, lightgray); color: papayawhip; } /* Style blocks cannot use blank lines nor "dash dash greater than" */ NOTE comment blocks can be used between style blocks. STYLE ::cue(b) { color: peachpuff; } 00:0...
...olor: peachpuff; } 00:00:00.000 --> 00:00:10.000 - Hello <b>world</b>. NOTE style blocks cannot appear after the first cue. We can also use identifiers inside WebVTT file, which can be used for defining a new style for some particular cues in the file. The example where we wanted the transcription text to be red highlighted and the other part to remain normal, we can define it as follows using CSS. ...
...And 8 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 s...
...seudo-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>. ...
...However, the two objects have different purposes: The object from getComputedStyle is read-only, and should be used to inspect the element's style -- including those set by a <style> element or an external stylesheet. The element.style object should be used to set styles on that element, or inspect styles directly ...
...And 8 more matches
HTML documentation index - HTML: Hypertext Markup Language
Web › HTML › Index
Found 237 pages: # Page Tags and summary 1 HTML: Hypertext Markup Language HTML, HTML5, Landing, Web, l10n:priority HTML (HyperText Markup Language) is the most basic building block of the Web. It defines the meaning and structure of web content. Other technologies besides HTML are generally used to describe a web page's appearance/presentation (CSS) or functionality/behavior (JavaScript). 2 Allowing cross-origin use of images and canvas Advanced, CORS, Canvas, HTML, Image, Reference, Security, 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 ...
...canvas Advanced, CORS, Canvas, HTML, Image, Reference, Security, 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 La...
...apitalize, Global attributes, HTML, Reference The autocapitalize global attribute is an enumerated attribute that controls whether and how text input is automatically capitalized as it is entered/edited by the user. 10 class Global attributes, HTML, Reference The class global attribute is a space-separated list of the case-sensitive classes of the element. Classes allow CSS and Javascript to select and access specific elements via the class selectors or functions like the DOM method document.getElementsByClassName. 11 contenteditable Editing, Global attributes, HTML, Reference, Text Editing, contenteditable, text entry, text input The contenteditable global attribute is an enumerated attribute indicating if the element should be editable by the ...
...And 8 more matches
Fills and Strokes - SVG: Scalable Vector Graphics
Fill and Stroke Attributes Painting Basic coloring can be done by setting two attributes on the node: fill and stroke. Using fill sets the color inside the object and stroke sets the color of the line drawn around the object. ...
... Fill and Stroke Attributes Painting Basic coloring can be done by setting two attributes on the node: fill and stroke. Using fill sets the color inside the object and stroke sets the color of the line drawn around the object. ...
...n, or an external CSS file. Most SVG you'll find around the web use inline CSS, but there are advantages and disadvantages associated with each type. Fill and Stroke Attributes Painting Basic coloring can be done by setting two attributes on the node: fill and stroke. Using fill sets the color inside the object and stroke sets the color of the line drawn around the object. You can use the same css color naming schemes that you use in HTML, whether that's color names (that is red), rgb values (that is rgb(255,0,0)), hex values, rgba values, etc. <rect x="10" y="10" width="100" height="100" stroke="blue" fill="purple" fill-opacity="0.5" stroke-opacity="0.8"/> In addition, you can specify the opacity of either the fill or stroke separately in SVG. These are controlled by the fill-o...
...And 8 more matches
panel - Archive of obsolete content
Creates transient dialogs to implement part of an add-on's user interface. Usage This module exports a single constructor function Panel() which constructs a new panel. A panel is a dialog. Its content is specified as HTML and you can execute scripts in it, so the appearance and behavior of the panel is limited only by what you can do using HTML, CSS, and JavaScript. The screenshot below shows a panel whose content is built from the list of currently open tabs: Panels are useful for presenting temporary interfaces to users in a way that is easier for users to ignore and dismiss than a modal dialog, since panels are hidden the moment users interact with parts of the application interface outside them. A panel's content is loaded as soon as it is created, before the panel is shown, a...
...tArea.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. ...
...alue = ''; } }, 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 7 more matches
Adding Toolbars and Toolbar Buttons - Archive of obsolete content
inside the window element in your overlay, some weird 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. ...
...This is very important because the toolbar customization dialog won't work correctly without this. ...
...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 current Firefox toolbars. In most cases this is not what you want as default behavior,...
...And 7 more matches
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
One of the Web's oldest news sites, Wired News draws between 20 and 25 million page views every month. On October 11, 2002, Wired launched a brand-new site design that uses validating XHTML for its structure and a small collection of CSS files for its layout. The new design clearly shows what some experts have been saying: that standards-based design can be visually compelling and preserve the interface conventions we've come to expect from Web pages. ...
...reserve the interface conventions we've come to expect from Web pages. The brains and primary driving force behind this compelling new design is Douglas Bowman, Network Design Manager for Terra Lycos, who graciously agreed to an interview and in the process shed a lot of light on what goes into a standards-based redesign. Wired News Redesign in a Nutshell Driven by XHTML 1.0 Transitional and CSS; Allows centralized control over layout and appearance for thousands of pages; Simple markup allows for rapid changes to templates; Average page weight dropped by almost half; Page layout accomplished with simple CSS positioning; Vastly increased accessibility without special coding or user agent detection. Why did you pursue a standards-based redesign of Wired News? As Network Design Man...
... So I'm very familiar with standards and the benefits of using them. With the Wired News design process, the scenario was reversed. As I was designing the product, I began discovering a broader set of Web standards, and was quickly swayed by the advantages I could see if we were to adopt them. It was a no-brainer to us that Wired News was a perfect candidate for the total conversion to XHTML and CSS. The content of the site tells the story of how technology affects our daily lives, especially in the realms of business, culture, and politics. Why not attempt to use technology standards for the Web to live out that story? The visual design of Wired News and the Vignette templates were all sorely stale, and we had no significant effort invested into either for more than two years. I think that ...
...And 7 more matches
Pseudo-classes and pseudo-elements - Learn web development
know how to use them, you can look at the list to see if there is something which works for the task you are trying to achieve. Once again the relevant MDN page for each selector is helpful in explaining browser support. 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 pseudo-class and pseudo-element selectors. What is a pseudo-class? A pseudo-class is a selector that selects elements that are in a specific state, e.g. they are the first element of their type, or they are being hovered over by the mouse pointer. They tend to act as if you had applied a class to some part of your do...
...o some part of your document, often helping you cut down on excess classes in your markup, and giving you more flexible, maintainable code. Pseudo-classes are keywords that start with a colon: :pseudo-class-name Simple pseudo-class example Let's look at a simple example. If we wanted to make the first paragraph in an article larger and bold, we could add a class to that paragraph and then add CSS to that class, as shown in the first example below: However, this could be annoying to maintain -- what if a new paragraph got added to the top of the document? We'd need to move the class over to the new paragraph. Instead of adding the class, we could use the :first-child pseudo-class selector -- this will always target the first child element in the article, and we will no longer need to ed...
...wrapped around that first formatted line, and updated each time the line length changed. You can see that this selects the first line of both paragraphs. Combining pseudo-classes and pseudo-elements If you wanted to make the first line of the first paragraph bold you could chain the :first-child and ::first-line selectors together. Try editing the previous live example so it uses the following CSS. We are saying that we want to select the first line, of the first <p> element, which is inside an <article> element. article p:first-child::first-line { font-size: 120%; font-weight: bold; } Generating content with ::before and ::after There are a couple of special pseudo-elements, which are used along with the content property to insert content into your document using CSS. You could us...
...And 7 more matches
Floats - Learn web development
Previous Overview: CSS layout Next Originally for floating images inside blocks of text, the float property became one of the most commonly used tools for creating multiple column layouts on webpages. With the advent of flexbox and grid it has now returned to its original purpose, as this article explains. Prerequisites: HTML basics (study Introduction to HTML), and an idea of How CSS works (study Introduction to CSS.) Objective: To learn how to create floated features on webpages, and to use the clear property and other methods of clearing floats. The background of floats The float property was introduced to allow web developers to implement simple layouts involving an image floating inside a column of text, with the text wrapping around the left or...
... sed est. Nam id risus quis 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. ...
...m. 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. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p> Now apply the following CSS to your HTML (using a <style> element or a <link> to a separate .css file -- your choice): body { width: 90%; max-width: 900px; margin: 0 auto; font: .9em/1.2 Arial, Helvetica, sans-serif } .box { width: 150px; height: 100px; border-radius: 5px; background-color: rgb(207,232,220); padding: 1em; } If you save and refresh now, you'll see something much like what you'd expect -- the box is sitting above the text, in normal flow. To float the text...
...And 7 more matches
What are browser developer tools? - Learn web development
This article explains how to use the basic functions of your browser's devtools. Note: Before you run through the examples below, open the Beginner's example site that we built during the Getting started with the Web article series. You should have this open as you follow the steps below. ...
...nces ? Advanced, and check the Show Develop menu in menu bar checkbox. Opera: Developer ? Developer tools Context menu: Press-and-hold/right-click an item on a webpage (Ctrl-click on the Mac), and choose Inspect Element from the context menu that appears. (An added bonus: this method straight-away highlights the code of the element you right-clicked.) The Inspector: DOM explorer and CSS editor The developer tools usually open by default to the inspector, which looks something like the following screenshot. This tool shows what the HTML on your page looks like at runtime, as well as what CSS is applied to each element on the page. It also allows you to instantly modify the HTML and CSS and see the results of your changes reflected live in the browser viewport. If you don't se...
...ected 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 HTML and see the results ...
...And 7 more matches
UI pseudo-classes - Learn web development
rious form controls, in a general manner. This included some usage of pseudo-classes, for example using :checked to target a checkbox only when 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. ...
... :focus: Selects an element only when it is focused (i.e. by being tabbed to via the keyboard). :active: selects an element only when it is being activated (i.e. ...
...eing 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 element only when it is being activated (i.e. while it is being clicked on, or when the Return/Enter key is being pressed down in the case of a keyboard activation). These basic pseudo-classes should be familiar to you now. More recently, the CSS Selector Level 3 and CSS Basic UI Level 3 added more pseudo-classes related to HTML forms that provide several other useful targetting conditions that you can take advantage of. We'll discuss these in more detail in the sections below, but briefly, the main ones we'll be looking at are: :required and :optional: Targets required or optional form controls. :valid and :invalid, and :in-range and...
...And 7 more matches
Images in HTML - Learn web development
ability to embed images (and other more interesting types of content) inside web pages was added. There are other types of multimedia to consider, but it is logical to start with the humble <img> element, used to embed a simple image in a webpage. In this article we'll look at how to use it in depth, including the basics, annotating it with captions using <figure>, and detailing how it relates to CSS background images. Prerequisites: Basic computer literacy, basic software installed, basic knowledge of working with files, familiarity with HTML fundamentals (as covered in Getting started with HTML.) Objective: To learn how to embed simple images in HTML, annotate them with captions, and how HTML images relate to CSS background images. How do we put an image on a...
...ch queries. Users have turned off images to reduce data transfer volume and distractions. This is especially common on mobile phones, and in countries where bandwidth is limited or expensive. What exactly should you write inside your alt attribute? It depends on why the image is there in the first place. In other words, what you lose if your image doesn't show up: Decoration. You should use CSS background images for decorative images, but if you must use HTML, add a blank alt="". If the image isn't part of the content, a screen reader shouldn't waste time reading it. Content. If your image provides significant information, provide the same information in a brief alt text - or even better, in the main text which everybody can see. Don't write redundant alt text. How annoying would it be...
...body, you can just use alt="". Link. If you put an image inside <a> tags, to turn an image into a link, you still must provide accessible link text. In such cases you may, either, write it inside the same <a> element, or inside the image's alt attribute - whichever works best in your case. Text. You should not put your text into images. If your main heading needs a drop shadow, for example, use CSS for that rather than putting the text into an image. However, If you really can't avoid doing this, you should supply the text inside the alt attribute. Essentially, the key is to deliver a usable experience, even when the images can't be seen. This ensures all users are not missing any of the content. Try turning off images in your browser and see how things look. You'll soon realize how helpf...
...And 7 more matches
What is JavaScript? - Learn web development
Overview: First steps Next Welcome to the MDN beginner's JavaScript course! In this article we will look at JavaScript from a high level, answering questions such as "What is it?" and "What can you do with it?", and making sure you are comfortable with JavaScript's purpose. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS. Objective: To gain familiarity with what JavaScript is, what it can do, and how it fits into a web site. A high-level definition JavaScript is a scripting or programming language that allows you to implement complex features on web pages -- every time a web page does more than just sit there and display static information for you to look at -- displaying timely content updates, interactive maps, animated...
...ement complex features on web pages -- every time a web page does more than just sit there and display static information for you to look at -- displaying timely content updates, interactive maps, animated 2D/3D graphics, scrolling video jukeboxes, etc. -- you can bet that JavaScript is probably involved. ...
...Script is probably involved. 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...
...And 7 more matches
Web Accessibility: Understanding Colors and Luminance - Accessibility
nsities 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 how that color is received by the viewer. How the viewer perceives color after it gets to his eyes is yet another matter, and can be affected by overall health. Luckily, CSS Media Queries Level 5 will be a game-changer in accessibility initiatives, because it will allow users to select settings that accomodate their needs best. Color, contrast, and luminance are among the most central and critical concepts to creating accessible web content with color. Luminance is of particular importance, however, because at the end of the day, understanding of what it is and how...
...t concepts. The "L" in the HSL color space is sometimes referred to as "luminosity," other times as "lightness." Even something seemingly simple like naming common colors can be open to debate. For example, the color "crimson red" may be described in hex values as #990000 by some and #DC143C by others. For the purposes of this document, we'll use terminlogy as it is defined in the W3C, in the CSS Color Module Level 3 When working with color, it's important to know which "color space" you are working in, as different color spaces map to different measurement systems. Currently, the RGB color space predominates as the space web developers work in. HEX, RGB and HSL color spaces all are measured differently. Conversions between the color spaces are usually needed. Because of the current do...
...ork in. HEX, RGB and HSL color spaces all are measured differently. Conversions between the color spaces are usually needed. Because of the current domination of the RGB color space in measuring color output, most calculations in this document are presumed to be in the RGB color space, and very specifically, in the sRGB color space. The sRGB color space The MDN document, <color> notes "The CSS data type represents a color in the sRGB color space." Color has many ways of being defined, including RGB, RGB decimal, RGB percent, HSL, CMYK among others. For digital concerns, much of the technology has historically resided in the RGB color space. This is because the companies behind the evolution of digital technology set the standards, and these standards still retain a powerful presence...
...And 7 more matches
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
Web › HTML › Element › input
submitted. The required attribute is supported text, search, url, tel, email, date, month, week, time, datetime-local, number, password, checkbox, radio, and file. See Client-side validation and the HTML attribute: required for more information. size Valid for email, password, tel, and text input types only. Specifies how much of the input is shown. Basically creates same result as setting CSS width property with a few specialities. The actual unit of the value depends on the input type. For password and text, it is a number of characters (or em units) with a default value of 20, and for others, it is pixels. CSS width takes precedence over size attribute. src Valid for the image input button only, the src is string specifying the URL of the image file to display to represent the g...
...isting content is affected. setSelectionRange() Selects the specified range of characters within a textual input element. Does nothing for inputs which aren't presented as text input fields. stepDown() Decrements the value of a numeric input by one, by default, or by the specified number of units. stepUp() Increments the value of a numeric input by one or by the specified number of units. CSS Inputs, being replaced elements, have a few features not applicable to non form elements. There are CSS selectors that can specification target form controls based on their UI features, also known as UI pseudo-classes. The input element can also be targeted by type with attribute selectors. There are some properties that are especially useful as well. UI pseudo-classes Captions super relevan...
... 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; font-weight: bold; } Attribute selectors It is possible to target different types of form controls based on their type using attribute selectors. CSS attribute selectors match elements based on either just the presence of a attribute or the value of a given attribute. /* matches 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 ...
...And 7 more matches
Progressive loading - Progressive web apps (PWAs)
to load, the bigger the chance they will leave before waiting for everything to finish. We should be able to show them at least the basic view of the page they want to see, with placeholders in the places more content will eventually be loaded. This could be achieved by progressive loading -- also known as Lazy loading. ...
...l 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. Render...
...e 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. Render-blocking resources Bundling is a problem, because the browser has to load the HTML, CSS, and JavaScript before it can paint their rendered results onto the screen. During the few seconds between initial 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...
...And 7 more matches
Media - Progressive web apps (PWAs)
This is the 14th and last section of Part I of the CSS Getting Started tutorial. Many pages in this tutorial focused on the CSS properties and values, as well as how you use these to specify the way that content displays. Information: Media The purpose of CSS is to specify how content is presented to the user. This presentation can take more than one form. For example, you are probably reading this on a device with a display. But you might also want to project it to a big screen for a large audience, or you might want to print it. These different media have different characteristics. CSS has the capacity to present content according to the media type. To specify rules that are specific to a type of media, use @media followed by the media type, followed by curly braces that enclose the ru...
...a type, followed by curly braces that enclose the rules. Example A document on a website has a navigation area that contains the primary site menu. In the markup language, the navigation area's parent element has the id nav-area. (In HTML5, this can be marked up with the <nav> element instead of <div> with an id attribute.) When printing the document, the navigation area has no purpose. This CSS (below) removes the navigation area when printing the document: @media print { #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 ...
... 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. ...
...And 7 more matches
Content type - SVG: Scalable Vector Graphics
s article lists these types along with their syntax and descriptions of what they're used for. Angle <angle> Angles are specified in one of two ways. When used in the value of a property in a stylesheet, an <angle> is defined as follows: angle ::= number (~"deg" | ~"grad" | ~"rad")? where deg indicates degrees, grad indicates grads and rad indicates radians. For properties defined in CSS2, an angle unit identifier must be provided. For angle values in SVG-specific properties and their corresponding presentation attributes, the angle unit identifier is optional. If not provided, the angle value is assumed to be in degrees. In presentation attributes for all properties, whether defined in SVG1.1 or in CSS2, the angle identifier, if specified, must be in lower case. When angles ar...
...10 seconds and 500 milliseconds Timecount values: 3.2h = 3.2 hours = 3 hours and 12 minutes 45min = 45 minutes 30s = 30 seconds 5ms = 5 milliseconds 12.467 = 12 seconds and 467 milliseconds Fractional values are just (base 10) floating point definitions of seconds. ...
... <color> The basic type <color> is a CSS2 compatible specification for a color in the sRGB color space. <color> applies to SVG's use of the color attribute and is a component of the definitions of attributes fill, stroke, stop-color, flood-color, and lighting-color, which also offer optional ICC-based color specifications. SVG supports all of the syntax alternatives for <color> defined in CSS2 syntax and basic data types, and (depend on the implementation) in the future CSS Color Module Level 3. A <color> is either a keyword or a numerical RGB specification. In addition to these color keywords, users may specify keywords that correspond to the colors used by objects in the user's environment. ...
...And 7 more matches
Examples and demos from articles - Archive of obsolete content
an image before uploading it. [article] Note: The FileReader() constructor was not supported by Internet Explorer for versions before 10. For a full compatibility code, see also our crossbrowser possible solution for image preview. Determine if an element has been totally scrolled [html] This example shows how to determine whether a user has completely scrolled an element or not. ...
...ore uploading it. [article] Note: The FileReader() constructor was not supported by Internet Explorer for versions before 10. For a full compatibility code, see also our crossbrowser possible solution for image preview. Determine if an element has been totally scrolled [html] This example shows how to determine whether a user has completely scrolled an element or not. ...
...ur crossbrowser possible solution for image preview. Determine if an element has been totally scrolled [html] This example shows how to determine whether a user has completely scrolled an element or not. [article] CSS Pure-CSS dropdown menu [html] With the :hover pseudo-class you can create complex cascade algorithms. This is a common technique used, for example, in order to create pure-CSS dropdown menus (that is only CSS, without using JavaScript). ...
...And 6 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
ions. <?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, 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 ...
... Before we look at the various interface objects, let's look at some of their common attributes, especially the frequently used ones. id and class The attributes id and class fill the same role that the XHTML attributes of the same names fill. id is used to define a unique name for an element, and class is used to classify elements; both of these provide convenient ways to refer to elements in CSS and JavaScript. There are also special kinds of element that only come into play after being referenced by another element. orient Whether a box's contents will be vertically or horizontally arrayed depends on the elements in their initial state. You can explicitly set or change this layout using the orient attribute, with options for horizontal and vertical. align and pack The align and pack...
...sing the width and height attributes, as shown in Listing 6. If you are creating elements that can grow using the flex attribute, you can also set minimums and maximums using minwidth, minheight, maxwidth, and maxheight. These all use pixels as the unit of size. <button label="Button" width="200" height="100"/> Listing 6: Setting the size of a button Also, as shown in Listing 7, you can embed CSS inline into elements via the style attribute, which allows you to set sizes using units other than pixels. <button label="Button" style="min-width: 10em;"/> Listing 7: Setting the size of a button using CSS markup hidden and collapsed The hidden and collapsed attributes act as switches to turn off the display of elements. Setting hidden="true" disables display of that element. This has the ...
...And 6 more matches
Appendix F: Monitoring DOM changes - Archive of obsolete content
ers AJAX-based page changes are almost universally tied to XMLHttpRequests. These requests can be tracked from chrome code using a variety of methods, including web progress listeners, HTTP observers, and content policies. While these are not exceptionally efficient (they run for every HTTP request, and considerably more often for some methods), they work very well for certain applications Pure CSS Pure CSS can be more powerful than most people suspect. It is often possible to do things for which people have traditionally resorted to JavaScript with CSS alone. In particular, the ::before and ::after pseudo-elements, and pseudo-classes like :hover and :active can be used to achieve extremely complex dynamic behavior. Late binding and event delegation Often times, it suffices to bind event...
...l function will be called, followed by your own doAwesomerDOMStuff() function, which can then further modify the DOM as needed. Variations on this method include modifying the arguments passed to the wrapped function, modifying its return value, and making changes both before and after the original method is called. This scheme is highly flexible and can be made to work under most circumstances. CSS animation events This technique, which works on Firefox 5+, has some particular advantages. Because it is based on CSS, it can be keyed to match new elements of any arbitrary CSS selector. And because it is CSS-based, and is triggered when CSS is being applied anyway, it does not slow DOM mutations. The technique was adapted from the method used by the X-Tag library. The code below contains an ...
... implementation will fire any time an element which previously did not match the given selector is changed so that it does (when a class is added, for instance), the fallback will only match nodes when they are inserted into the DOM tree. Minor changes are also required if one wishes to support other browsers, or to run in non-chrome-privileged scopes. /** * Watches for nodes matching the given CSS selector to become * available. * * @param {string} selector The CSS selector of nodes about which you * want to be notified. * @param {function(Event)} callback The function which is to be called * when matching nodes become available. * @param {Document} doc The document in which to watch for new nodes. * @optional @default document * * @returns {function} A function which...
...And 6 more matches
Using the Stylesheet Service - Archive of obsolete content
Replace it with the URL of the CSS file you want to load. ...
...Replace it with the URL of the CSS file you want to load. ...
...is defined in nsIStyleSheetService.idl. The stylesheets registered with this API apply to all documents; Firefox 18 extended nsIDOMWindowUtils with loadAdditionalStyleSheet() and removeAdditionalStyleSheet() to manage stylesheets for a specific document (bug 737003). 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. See the CSS Specification for more details. Note that UA stylesheets are allowed to do certain unsafe things that user stylesheets are not allowed to do. In particula...
...And 6 more matches
A XUL Bestiary - Archive of obsolete content
and in particular Mozilla's XML-based User Interface Language, XUL. Chrome Some of the most powerful and frequently misunderstood features of XUL and the Mozilla browser have to do with chrome. The term chrome is used in different contexts to mean different things. In general, chrome refers to a XUL interface and all of its supporting files; chrome means the XUL content and structure, plus the CSS skin, plus whatever localization and platform-specific files are part of that XUL interface. By contrast, the skin is just the CSS and referenced graphics for a XUL file, the localization 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...
...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/content/help.xul', ...
...is being used to point to a chrome within the package hierarchy of the Mozilla application. A Help chrome defined in mozilla/bin/chrome/help/ is being invoked from the Help menu. Note that when no file name is specified after the chrome directory path, a file name with the same name as the package is assumed. In other words, a chrome URL like the global pointer above picks up a file called global.css, and the help pointer above could also be written as chrome://help/content, because the name of the package itself is "help." Viewing Chromes Other Than Mozilla's There is a special flag you can use to start Mozilla with some chrome other than the default. When you invoke Mozilla from the command line with the -chrome flag, you can specify a chrome just as you would in the previous example: mo...
...And 6 more matches
Introduction to XUL - Archive of obsolete content
Having said that, the details of a particular application of XML; say, the syntax for specifying a toolbar, are left to separate documents describing those particular applications. Check the XPToolkit index for the most recent list. Since XUL is a language for describing window layout, there is some overlap in the topics covered by this document and a separate document des...
...ly. 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. ...
...e 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". You can load as many style sheets as you wish using repeated processing directives, although you should always make sure to load the xul.css file initially. And finally, any namespaces used in the document must be declared. So a XUL file will begin <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/xul.css" type="text/css"?> <!DOCTYPE window> <window xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> The HTML namespace is of course the standard one. The ...
...And 6 more matches
Creating a Skin - Archive of obsolete content
<< PreviousNext >> This documentation has not updated for Firefox Quantum. Modifying userChrome.css is not guaranteed to work between versions of Firefox and may lead to hard-to-diagnose bugs. Use at your own risk! This section describes how to create a simple skin. For simplicity, we'll only apply it to the find files dialog. A Simple Skin The image below shows the current find files dialog. Let's create a skin that we can apply to it. Normally, a skin would apply to the entire application, but we'll focus on just the find files dialog to make 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 ...
...mally, a skin would apply to the entire application, but we'll focus on just the find files dialog to make 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) ...
...y. Modify the references in the manifest file to a custom name for your skin. For example, change references of 'classic/1.0' to 'blueswayedshoes/1.0'. Add 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 st...
...And 6 more matches
Modifying the Default Skin - Archive of obsolete content
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. ...
...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. ...
...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. ...
...And 6 more matches
XUL element attributes - Archive of obsolete content
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 If true, then the element is collapsed and does not appear. It is equivalent to setting the CSS visibility property to collapse. container Type: boolean Set to true if the element is to act as a container which can have child elements. This would be used for folders. This will be set by the template builder as needed. containment Type: URI This attribute specifies RDF properties (an RDF predicate) that indicate that a resource is a container. When generating content from...
...ldren of the element equal in size. always For a horizontally oriented element, this will make all of its children have the width of the widest child. For a vertically oriented element, this will make its children all have the height of the tallest child. never All of the children are displayed at the size required by the content or as specified by the width and height attributes or the CSS width and height properties. flags Type: space-separated list of the values below A set of flags used for miscellaneous purposes. Two flags are defined, which may be the value of this attribute. dont-test-empty: For template generated content, the builder will not check that a container is empty. dont-build-content: This flag may be used on a tree to indicate that content eleme...
...g space in the box is divided among the flexible elements, according to their flex ratios. Specifying a flex value of 0 has the same effect as leaving the flex attribute out entirely. height Type: string (representing an integer) The preferred height of the element in pixels. The actual displayed height may be different if the element or its contents have a minimum or 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. in...
...And 6 more matches
Gecko FAQ - Gecko Redirect 1
Gecko is used in multiple browsers, including Mozilla Firefox, SeaMonkey, and others. Gecko is continuously under 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. ...
...ope-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 a specific level...
...e.toDateString and Date.toTimeString, which are not implemented Transfer protocols: HTTP 1.1 (including gzip compression), FTP SSL Unicode OJI (Open Java Interface) Image formats PNG GIF JPEG, PJPEG Does "full support" mean that Gecko has zero bugs today or will have zero bugs at some point in the future? Of course not. As Robert O'Callahan notes in bug 25707, "Full HTML4/CSS1 compliance can't mean '100% bug free'. If it does, no-one will ever ship a fully compliant browser." Because web pages can be arbitrarily long and complex and have arbitrarily deeply nested markup, it will always be possible to construct web pages that do not display in a given browser the way the specifications would recommend. So long as QA testing and test case development continues, there w...
...And 6 more matches
Backgrounds and borders - Learn web development
Previous Overview: Building blocks Next In this lesson, we will take a look at some of the creative things you can do with CSS backgrounds and borders. 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 pro...
...hard to understand as so many values can be passed in at once. .box { background: linear-gradient(105deg, rgba(255,255,255,.2) 39%, rgba(51,56,57,1) 96%) center center / 400px 200px no-repeat, url(big-star.png) center no-repeat, rebeccapurple; } We'll return to how the shorthand works later in the tutorial, but first let's have a look at the different things you can do with backgrounds in CSS, by looking at the individual background properties. Background colors The background-color property defines the background color on any element in CSS. The property accepts any valid <color>. A background-color extends underneath the content and padding box of the element. In the example below, we have used various color values to add a background color to the box, a heading, and a <span> ele...
...ion: 20px 10%; } You can also mix keyword values with lengths or percentages, for example: .box { background-image: url(star.png); background-repeat: no-repeat; background-position: top 20px; } Finally, you can also use a 4-value syntax in order to indicate a distance from certain edges of the box -- the length unit, in this case, is an offset from the value that precedes it. So in the CSS below we are positioning the background 20px from the top and 10px from the right: .box { background-image: url(star.png); background-repeat: no-repeat; background-position: top 20px right 10px; } Use the example below to play around with these values and move the star around inside the box. Note: background-position is a shorthand for background-position-x and background-position-y,...
...And 6 more matches
Positioning - Learn web development
We'd like you to follow along with the exercises on your local computer, if possible -- grab a copy of 0_basic-flow.html from our GitHub repo (source code here) and use that as a starting point. ...
...out Next Positioning allows you to take elements out of the normal document layout flow, and make them behave differently; for example sitting on top of one another, or always remaining in the same place inside the browser viewport. This article explains the different position values, and how to use them. Prerequisites: HTML basics (study Introduction to HTML), and an idea of How CSS works (study Introduction to CSS.) Objective: To learn how CSS positioning works. We'd like you to follow along with the exercises on your local computer, if possible -- grab a copy of 0_basic-flow.html from our GitHub repo (source code here) and use that as a starting point. Introducing positioning The whole idea of positioning is to allow us to override the basic document f...
...ing Static positioning is the default that every element gets -- it just means "put the element into its normal position in the document layout flow -- nothing special to see here." To demonstrate this, and get your example set up for future sections, first add a class of positioned to the second <p> in the HTML: <p class="positioned"> ... </p> Now add the following rule to the bottom of your CSS: .positioned { position: static; background: yellow; } If you now save and refresh, you'll see no difference at all, except for the updated background color of the 2nd paragraph. This is fine -- as we said before, static positioning is the default behavior! Note: You can see the example at this point live at 1_static-positioning.html (see source code). Relative positioning Relative pos...
...And 6 more matches
Tips for authoring fast-loading HTML pages - Learn web development
e visitors. It is just as important for broadband content and can lead to dramatic improvements even for your visitors with the fastest connections. Tips Reduce page weight Page weight is by far the most important factor in page-load performance. Reducing page weight through the elimination of unnecessary whitespace and comments, commonly known as minimization, and by moving inline script and CSS into external files, can improve download performance with minimal need for other changes in the page structure. Tools such as HTML Tidy can automatically strip leading whitespace and extra blank lines from valid HTML source. Other tools can "compress" JavaScript by reformatting the source or by obfuscating the source and replacing long identifiers with shorter versions. Minimize the number of ...
...-Modified-Since header for each referenced file, asking whether the file has been modified since the last time it was downloaded. Too much time spent querying the last modified time of the referenced files can delay the initial display of the web page, since the browser must check the modification time for each of these files, before rendering the page. If you use background images a lot in your CSS, you can reduce the number of HTTP lookups needed by combining the images into one, known as an image sprite. Then you just apply the same image each time you need it for a background and adjust the x/y coordinates appropriately. This technique works best with elements that will have limited dimensions, and will not work for every use of a background image. However, the fewer HTTP requests and si...
...o shorten the distance between the user and your website. CDNs store cached versions of your website and serve them to visitors via the network node closest to the user, thereby reducing latency. Further reading: Understanding CDNs Reduce domain lookups Since each separate domain costs time in a DNS lookup, the page load time will grow along with the number of separate domains appearing in CSS link(s) and JavaScript and image src(es). This may not always be practical; however, you should always take care to use only the minimum necessary number of different domains in your pages. Cache reused content Make sure that any content that can be cached, is cached, and with appropriate expiration times. In particular, pay attention to the Last-Modified header. It allows for efficient page ...
...And 6 more matches
Manipulating documents - Learn web development
s is usually done by using the Document Object Model (DOM), a set of APIs for controlling HTML and styling information that makes heavy use of the Document object. In this article we'll look at how to use the DOM in detail, along with some other interesting APIs that can alter your environment in interesting ways. Prerequisites: Basic computer literacy, a basic understanding of HTML, CSS, and JavaScript -- including JavaScript objects. Objective: To gain familiarity with the core DOM APIs, and the other APIs commonly associated with DOM and document manipulation The important parts of a web browser Web browsers are very complicated pieces of software with a lot of moving parts, many of which can't be controlled or manipulated by a web developer using JavaScrip...
...pt, this is represented by the Navigator object. You can use this object to retrieve things like the user's preferred language, 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 lo...
...the above example. Sibling nodes: Nodes that sit on the same level in the DOM tree. For example, IMG and P are siblings in the above example. Text node: A node containing a text string. It is useful to familiarize yourself with this terminology before working with the DOM, as a number of the code terms you'll come across make use of them. You may have also come across them if you have studied CSS (e.g. descendant selector, child selector). Active learning: Basic DOM manipulation To start learning about DOM manipulation, let's begin with a practical example. Take a local copy of the dom-example.html page and the image that goes along with it. Add a <script></script> element just above the closing </body> tag. To manipulate an element inside the DOM, you first need to select it and s...
...And 6 more matches
Getting started with React - Learn web development
evious Overview: Client-side JavaScript frameworks Next In this article we will say hello to React. We'll discover a little bit of detail about its background and use cases, set up a basic React toolchain on our local computer, and create and play with a simple starter app -- learning a bit about how React works in the process. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. React uses an HTML-in-JavaScript syntax called JSX (JavaScript and XML). Familiarity with both HTML and JavaScript will help you to learn JSX, and better identify whether bugs in your application are related to JavaScript or to the more specific domain of React. Objective: To set up a local React development e...
...browser tab. Your browser will display something like this: Application structure create-react-app gives us everything we need to develop a React application. Its initial file structure looks like this: moz-todo-react +-- README.md +-- node_modules +-- package.json +-- package-lock.json +-- .gitignore +-- public | +-- favicon.ico | +-- index.html | +-- manifest.json +-- src +-- App.css +-- App.js +-- App.test.js +-- index.css +-- index.js +-- logo.svg +-- serviceWorker.js The src directory is where we'll spend most of our time, as it's where the source code for our application lives. The public directory contains files that will be read by your browser while you're developing the app; the most important of these is index.html. React injects your code i...
...React, a component is a reusable module that renders a part of our app. These parts can be big or small, but they are usually clearly defined: they serve a single, obvious purpose. Let's open src/App.js, since our browser is prompting us to edit it. This file contains our first component, App, and a few other lines of code: import React from 'react'; import logo from './logo.svg'; import './App.css'; function App() { return ( <div className="App"> <header className="App-header"> <img src={logo} className="App-logo" alt="logo" /> <p> Edit <code>src/App.js</code> and save to reload. </p> <a className="App-link" href="https://reactjs.org" target="_blank" rel="noopener noreferrer" > ...
...And 6 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. ...
... sources of specified style data, and in the other half (the frontend) is the code that turns the specified values into computed values. ...
...resents 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. There is also a style rule processor for style attributes (which contain CSS declarations) and one for presentational attributes in HTML. The methods on nsIStyleRuleProcessor allow ...
...And 6 more matches
Element.getClientRects() - Web APIs
Each DOMRect object contains read-only left, top, right and bottom properties describing the border box, in pixels, with the top-left relative to the top-left of the viewport. For tables with captions, the caption is included even though it's outside the border box of the table. ...
...Each DOMRect object contains read-only left, top, right and bottom properties describing the border box, in pixels, with the top-left relative to the top-left of the viewport. For tables with captions, the caption is included even though it's outside the border box of the table. ...
...e table. When called on SVG elements other than an outer-<svg>, the "viewport" that the resulting rectangles are relative to is the viewport that the element's outer-<svg> establishes (and to be clear, the rectangles are also transformed by the outer-<svg>'s viewBox transform, if any). Originally, Microsoft intended this method to return a TextRectangle object for each line of text. However, the CSSOM working draft specifies that it returns a DOMRect for each border box. For an inline element, the two definitions are the same. But for a block element, Mozilla will return only a single rectangle. Firefox 3.5 note Firefox 3.5 adds width and height properties to the TextRectangle object. The amount of scrolling that has been done of the viewport area (or any other scrollable element...
...And 6 more matches
<input type="range"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › range
min to -10 and value to 1.5, then a step of 1 will allow only values such as 1.5, 2.5, 3.5,... in the positive direction and -0.5, -1.5, -2.5,... in the negative direction. See the HTML step attribute. Non Standard Attributes Attribute Description orient Sets the orientation of the range slider. Firefox only. orient Similar to the -moz-orient non-standard CSS property impacting the <progress> and <meter> elements, the orient attribute defines the orientation of the range slider. Values include horizontal, meaing the range is rendered horizontally, and vertical, where the range is rendered vertically. Note: The following input attributes do not apply to the input range: accept, alt, checked, dirname, formaction, formenctype, formmethod, formnovalida...
...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 implemented yet...
...eft 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 implemented yet by any of the major browsers. (See Firefox bug 981916, Chrome bug 341071). It also, perhaps, may still be under discussion. In the meantime, we can make the range vertical by rotating it using using CSS transforms, or, by targeting each browser engine with their own method, which includes setting the appearance to slider-vertical, by using a non-standard orient attribute in Firefox, or by changing the text direction for Internet Explorer and Edge. Consider this range control: <input type="range" id="volume" min="0" max="11" value="7" step="1"> ScreenshotLive sample This control is horizont...
...And 6 more matches
Authoring MathML - MathML
m has been developing TeXZilla, a Javascript Unicode LaTeX-to-MathML converter that is intended to be used in many scenarios described here. Of course, the list is by no means exhaustive and you are invited to check out the W3C MathML software list where you can find various other tools. Note that by design, MathML is well-integrated in HTML5 and in particular you can use usual Web features like CSS, DOM, Javascript or SVG. This is out of the scope of this document but anyone with basic knowledge of Web languages will easily be able to mix these features with MathML. Check out our demos and MathML references for more details. Using MathML MathML in HTML pages You can use Presentation MathML inside HTML5 documents: <!DOCTYPE html> <html> <head> <title>MathML in HTML5</title> </head> <bod...
...eet. 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. ...
...rs 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 feature detection of the mspace or mpadded elements (see the browser compatibility table on these pages). There is also a similar script t...
...And 6 more matches
Graphic design for responsive sites - Progressive web apps (PWAs)
each of these topics (the one you are currently in, and app layout.) In addition, these days there are so many more technologies to choose from than your humble BMPs, JPGs, GIFs and PNGs. But what should you choose? This really depends on what target devices you have to support, how complex the graphics need to be, and how much interactivity your graphics require. ...
...plex the graphics need to be, and how much interactivity your graphics require. Serving images selectively via CSS In general, you will use mostly the same graphical assets for different layouts in a responsive design, but you may well include slightly different ones dependant on context. For example, if your desktop layout includes a large header graphic and several programmatic graphics (e.g. CSS3 drop shadows and gradients), you may want to simplify or remove certain assets for the site's mobile layout, or even provide smaller assets to suit the smaller screen better. This is because in general mobile devices will have less processing power and bandwidth available, so you want to reduce the processing and downloads. In addition, mobile devices have smaller screen sizes, so it makes sense...
...simplify or remove certain assets for the site's mobile layout, or even provide smaller assets to suit the smaller screen better. This is because in general mobile devices will have less processing power and bandwidth available, so you want to reduce the processing and downloads. In addition, mobile devices have smaller screen sizes, so it makes sense to reduce visual clutter on a mobile layout. CSS media queries allow us to serve different CSS rules dependant on viewport dimensions, and you should consider using mobile first media queries where possible. This means that the default layout before any media queries are encountered in the CSS is the small screen/mobile layout, not the wide screen/desktop layout. So when the page is loaded on a mobile device, the mobile will only download the m...
...And 6 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. ...
... 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. ...
...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...
...And 6 more matches
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
uthored by Taiga (Gomita) Gomibuchi and was originally published in Japanese for the Firefox Developers Conference Summer 2007. Gomita-san won "Most Useful Upgraded Extension" award in Mozilla's 2006 "Extend Firefox" competition for ScrapBook, and was runner-up in the "Extend Firefox 2" contest for FireGestures. The chapters so far have each focused on technologies in isolation--XUL, JavaScript, CSS, and XPCOM. In this chapter, we'll discuss how to put them together to actually build an extension. An easier method of building a Firefox/Thunderbird Addon for developers who are well-acquainted with IDEs like Netbeans, Eclipse, etc. is to use Netbeans (IDE from Sun Microsystems) and Foxbeans (Plugin for Netbeans, by TeeSoft). Setting up your development environment In order to develop (and ...
...en the preferences window; find the preferences listed in Table 1 and double-click on them to set them accordingly. Some of these preferences do not exist--to create them, right-click, select "New>Boolean", and type in the name and set the value accordingly. Install the DOM Inspector The DOM Inspector is an extension that lets you examine HTML and XUL DOM tree structures, JavaScript objects and CSS properties, etc. This is not required for developing extensions, but it is handy to have around. Install extensions for Firefox from the Mozilla Add-ons website. Optional - Install Firebug and Chromebug Chromebug is used by the Firebug development team to develop Firebug. You can use it to help debug Firefox extensions as well as to inspect and learn how the Firefox UI (Chrome) is constructed...
...s icon.png and icon-small.png from the resources website and place them appropriately. FIXME: Figure 10: Directory structure with skin package added Add the skin package Update chrome.manifest with the contents of Listing 10. Listing 10: Additional content for chrome.manifest skin helloworld classic/1.0 skin/classic/ style chrome://browser/content/browser.xul chrome://helloworld/skin/overlay.css style chrome://global/content/customizeToolbar.xul chrome://helloworld/skin/overlay.css Register skin package (skin instruction) Line 1 beginning skin is used to register the skin package; helloworld is the package name; skin/classic/ is the relative path to the folder containing the source files; classic/1.0 indicates that this skin package is meant for the Firefox standard theme. Cross-pack...
...And 5 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 documen...
...for headings, paragraphs) inline Displayed like HTML's SPAN (for emphasis within text) Add your own style rules that specify the font, spacing and other details in the same way as for HTML. 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. Using CSS alone, the structure of the display must be the same as the structure of the document. Other technologies can modify the structure of the display--for example, XBL can add content, and JavaScript can modify the DOM. For more information about XML in Mozilla, see the XML page in this wiki. Action: An XML demonstration Make a new XML file, doc9.xml. Copy a...
...re of the display--for example, XBL can add content, and JavaScript can modify the DOM. For more information about XML in Mozilla, see the XML page in this wiki. Action: An XML demonstration Make a new XML file, doc9.xml. ...
...And 5 more matches
In-Depth - Archive of obsolete content
System Colours CSS2 defines colours which are the same as your operating systems theme. A list of the different operating system colours can be found on the W3C's web site. Mozilla CSS Properties Mozilla.org created their own CSS properties to allow them to use the technology for the UI of Mozilla. All of the properties follow the W3C's standards for vendor extensions, which is why they all begin with -moz. This is only a list of properties which may be useful to you; it is in no way all of the Mozilla specific properties available. Other sites which list Mozilla specific CSS properties XulPlanet.com [dead link, 26.03.13] Mozilla-prefixed properties on the standard track 26.03.13 -moz-appearance Makes a widget look like it's from your operating system. Possible are (This is probably a...
... 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 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 applie...
...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 image to the button (.toolbarButton-1). Look at the file column. It says that the file is located in chrome://navigator/skin/. This is a small problem with the display in Mozilla 1.2 what it means is \navigator\navigator.css (Most of the time it displays the file correctly, but sometimes, like in this case, it does not). Go into \mySkin\navigator and load navigator.css. You'll notice that the .toolbar-1 class is located here. Now you can point the image to wherever you like. The image that is listed there by default (chrome://navigator/skin/icons/btn1.gif) is actually a bunch of images grouped together in one file, s...
...And 5 more matches
Windows and menus in XULRunner - Archive of obsolete content
ues. Last time I installed XULRunner and built a very simple, bare-bones test application. This time I want to add some of the things common to a desktop application user interface: Windows and dialogs Menus and toolbars OS Common dialogs Controls or widgets Windows Each window or dialog should be created in its own XUL file. The XUL file 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="t...
... 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. The DTD is used to create entity references so strings for ...
...ments, just as it would in HTML. The DTD is used to create entity references so strings for titles and labels are not stored directly in the XUL file; this makes updating the text -- and localization of the application -- much easier. The window title is done this way in the above example. Also notice the <script> element which is used to include the window's JavaScript into the XUL file. Keeping CSS, DTD and Javascript out of the XUL file is considered a best practice. When you launch your XUL application, you'll notice that XULRunner gives your windows a default icon (top left corner on Windows). You'll most likely want to specify your own 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...
...And 5 more matches
WAI-ARIA basics - Learn web development
nd dynamic JavaScript-updated content can be difficult. WAI-ARIA is a technology that can help with such problems by adding in further semantics that browsers and assistive technologies can recognize and use to let users know what is going on. Here we'll show how to use it at a basic level to improve accessiblity. Prerequisites: Basic computer literacy, a basic understanding of HTML, CSS, and JavaScript, an understanding of the previous articles in the course. Objective: To gain familiarity with WAI-ARIA, and how it can be used to provide useful additional semantics to enhance accessibility where required. What is WAI-ARIA? Let's start by looking at what WAI-ARIA is, and what it can do for us. A whole new set of problems As web apps started to get more compl...
...nder 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 all, and their users just get told that they can see a jumble of elements with no semantics to describe what they mean. Enter WAI-ARIA WAI-ARIA (Web Accessibility Initiative - Accessible Rich Internet Applications) is a specification written by the W3C, defin...
...can change, generally programmatically via JavaScript. An important point about WAI-ARIA attributes is that they don't affect anything about the web page, except for the information exposed by the browser's accessibility APIs (where screenreaders get their information from). WAI-ARIA doesn't affect webpage structure, the DOM, etc., although the attributes can be useful for selecting elements by CSS. Note: You can find a useful list of all the ARIA roles and their uses, with links to futher information, in the WAI-ARIA spec -- see Definition of Roles. The spec also contains a list of all the properties and states, with links to further information -- see Definitions of States and Properties (all aria-* attributes). Where is WAI-ARIA supported? This is not an easy question to answer. It...
...And 5 more matches
Combinators - Learn web development
g blocks Next The final selectors we will look at are called combinators, because they combine other selectors in a way that gives them a useful relationship to each other and the location of content in the document. 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 different combinator selectors that can be used in CSS. Descendant combinator The descendant combinator -- typically represented by a single space ( ) character -- combines two selectors such that elements matched by the second selector are selected if they have an ancestor (parent, parent's parent, parent's parent's...
...lected if they have an ancestor (parent, parent's parent, parent's parent's parent, etc) element matching the first selector. Selectors that utilize a descendant combinator are called descendant selectors. body article p In the example below, we are matching only the <p> element which is inside an element with a class of .box. Child combinator The child combinator (>) is placed between two CSS selectors. It matches only those elements matched by the second selector that are the direct children of elements matched by the first. Descendent elements further down the hierarchy don't match. For example, to select only <p> elements that are direct children of <article> elements: article > p In this next example, we have an unordered list, nested inside of which is an ordered list. I am usi...
...selectors that we discovered in previous lessons with combinators in order to pick out part of your document. For example if we want to select list items with a class of "a", which are direct children of a <ul>, I could use the following. ul > li[class="a"] { } Take care however when creating big lists of selectors that select very specific parts of your document. It will be hard to reuse the CSS rules as you have made the selector very specific to the location of that element in the markup. It is often better to create a simple class and apply that to the element in question. That said, your knowledge of combinators will come in very useful if you need to get to something in your document and are unable to access the HTML, perhaps due to it being generated by a CMS. Test your skills! ...
...And 5 more matches
create fancy boxes - Learn web development
But beyond the technics its also all about unleashing your creativity. ...
...But beyond the technics its also all about unleashing your creativity. ...
...But beyond the technics its also all about unleashing your creativity. ...
...And 5 more matches
HTML forms in legacy browsers - Learn web development
input { /* This rule turns off the default rendering for the input types that have a border, including buttons defined with an input element */ border: 1px solid #CCC; } input[type="button"] { /* This does NOT resto...
... 1px solid #CCC; } input[type="button"] { /* This does NOT restore the default rendering */ border: none; } input[type="button"] { /* These don't either! Actually there is no standard way to do it in any browser */ border: auto; border: initial; } input[type="button"] { /* This will come the closest to restoring default rendering, when supported. */ border: revert; } See the global CSS revert value for more information. <button> The <button> element suffered from two issues that are now resolved: A bug in old versions of Internet Explorer sent the HTML content available between the starting and ending tag of the <button> element instead of the content of the value attribute when clicked. This was only an issue if that value needed to be sent, such as when data processing d...
...alue for the type attribute. While resolved in all modern browsers, it is still recommended to always set the type attribute on <button> elements. <!-- Clicking this button sent "<em>Do A</em>" instead of "A" in some cases --> <button type="submit" name="IWantTo" value="A"> <em>Do A</em> </button> Choosing one solution or the other is up to you based on your project's constraints. Let go of CSS One of the big issues with HTML Forms is styling form widgets with CSS. Form controls appearance is browser and operating system specific. For example, the input of color type looks different in Safari, Chrome and Firefox browser, but the color picker widget is the same in all browsers on a device as it opens up the operating system's native color picker. It's generally a good idea to not alter...
...And 5 more matches
How to build custom form controls - Learn web development
l be sent with the form data --> <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> Note the use of class names; these identify each relevant part regardless of the actual underlying HTML elements used. This is important to make sure that we don't bind our CSS and JavaScript to a strong HTML structure, so that we can make implementation changes later without breaking code that uses the control. For example, what if you wish 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. Cre...
...ML structure, so that we can make implementation changes later without breaking code that uses the control. For example, what if you wish 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. ...
... 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 { /* This will create a positioning context for the list of optio...
...And 5 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 HTM...
...ore this Go to the front page of The Mozilla Developer Network. View the page's source (Right/Ctrl + click on the page, choose View Page Source from the context menu.) Find the description meta tag. ...
... Data is a metadata protocol that Facebook invented to provide richer metadata for websites. In the MDN Web Docs sourcecode, you'll find this: <meta property="og:image" content="https://developer.cdn.mozilla.net/static/img/opengraph-logo.dc4e08e2f6af.png"> <meta property="og:description" content="The Mozilla Developer Network (MDN) provides information about Open Web technologies including HTML, CSS, and APIs for both Web sites and HTML5 Apps. It also documents Mozilla products, like Firefox OS."> <meta property="og:title" content="Mozilla Developer Network"> One effect of this is that when you link to MDN Web Docs on facebook, the link appears along with an image and description: a richer experience for users. Twitter also has its own similar proprietary metadata called Twitter Cards, w...
...And 5 more matches
Responsive images - Learn web development
timedia and embedding Next In this article, we'll learn about the concept of responsive images -- images that work well on devices with widely differing screen sizes, resolutions, and other such features -- and look at what tools HTML provides to help implement them. This helps to improve performance across different devices. Responsive images are just one part of responsive design, a future CSS topic for you to learn. Prerequisites: You should already know the basics of HTML and how to add static images to a web page. Objective: Learn how to use features like srcset and the <picture> element to implement responsive image solutions on websites. Why responsive images? Let's examine a typical scenario. A typical website may contain a header image and some ...
...bsite may contain a header image and some content images below the header. The header image will likely span the whole of the width of the header, and the content image will fit somewhere inside the content column. Here's a simple example: This works well on a wide screen device, such as a laptop or desktop (you can see the example live and find the source code on Github.) We won't discuss the CSS much in this lesson, except to say that: The body content has been set to a maximum width of 1200 pixels -- in viewports above that width, the body remains at 1200px and centers itself in the available space. In viewports below that width, the body will stay at 100% of the width of the viewport. The header image has been set so that its center always stays in the center of the header, no matt...
...Explorer.) How do you create responsive images? In this section, we'll look at the two problems illustrated above and show how to solve them using HTML's responsive image features. You should note that we will be focusing on the HTML <img>s for this section, as seen in the content area of the example above -- the image in the site header is only for decoration, and therefore implemented using CSS background images. CSS arguably has better tools for responsive design than HTML, and we'll talk about those in a future CSS module. Resolution switching: Different sizes So, what is the problem that we want to solve with resolution switching? We want to display identical image content, just larger or smaller depending on the device -- this is the situation we have with the second content image...
...And 5 more matches
Beginning our React todo list - Learn web development
ure and styling in place, ready for individual component definition and interactivity, which we'll add later. Note: If you need to check your code against our version, you can find a finished version of the sample React app code in our todo-react repository. For a running live version, see https://mdn.github.io/todo-react-build/. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Objective: To introduce our todo list case study, and get the basic App structure and styling in place. Our app's user stories In software development, a user story is an actionable goal from the perspective of the user. Defining user stories before we begin our work will help us focus our work. Our app sho...
...k, 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. ...
... 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. ...
...And 5 more matches
Deployment and next steps - Learn web development
e learning about Svelte's TypeScript support, and how to use it to make your application more robust. In this final article we will look at how to deploy your application and get it online, and also share some of the resources that you should go on to, to continue your Svelte learning journey. 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. Objective: Learn how to prepare our Svelte app for production, and what learning resources you should visit next. Note that our application is fully functional and porting it to TypeScript is completely optional. Th...
...wnload the folder's content: npx degit opensas/mdn-svelte-tutorial/08-next-steps Remember to run npm install && npm run dev to start your app in development mode. Compiling our app So far we've been running our app in development mode with npm run dev. As we saw earlier, this instruction tells Svelte to compile our components and JavaScript files into a public/build/bundle.js file and all the CSS sections of our components into public/build/bundle.css. It also starts a development server and watches for changes, recompiling the app and refreshing the page when a change occurs. Your generated bundle.js and bundle.css files will be something like this (file size on the left): 504 Jul 13 02:43 bundle.css 95981 Jul 13 02:43 bundle.js To compile our application for production we have to r...
...You might get a warning, but you can ignore this for now. Our whole app is now just 21 KB -- 8.3 KB when gzipped. ...
...And 5 more matches
Edit fonts - Firefox Developer Tools
he Font Editor will not be available). The Fonts tab The Fonts tab is located on the right-hand side of the Page Inspector when it is docked to the bottom of the screen. When it is docked to the right or left sides of the screen, the Fonts tab appears beneath the HTML pane. To access it: Open the Page Inspector. Select the Fonts tab; the last of the tabs shown in the right-hand side of the CSS pane. The Fonts tab has three major sections: "Fonts used" by the currently inspected element. The new Fonts Editor. In Firefox 61 and 62, this section does not exist. "All fonts on page" -- This section lists all of the fonts in use on the page. In Firefox 61 and 62, this area is labeled "Other fonts in page" and doesn't include the fonts mentioned in the "Fonts used" section. Fonts u...
...nspected element, grouped by font family. Fonts are considered "used" when there is text content in the inspected element that has the font applied to it. Empty elements will not have any fonts used and will display the message "No fonts were found for the current element." Fonts will be included in this section for one of the following reasons: They are listed in the element's font-family CSS declaration value. They are applied to the element as part of the browser's default styling (Times New Roman for most browsers), and no author-defined font has been supplied. They are used by a descendant of the inspected element, for example, when it is a container for other elements which have text content with fonts applied. They are system fallback fonts used when nothing from the font-fam...
...laration value. They are applied to the element as part of the browser's default styling (Times New Roman for most browsers), and no author-defined font has been supplied. They are used by a descendant of the inspected element, for example, when it is a container for other elements which have text content with fonts applied. They are system fallback fonts used when nothing from the font-family CSS declaration has been applied. Fonts Editor Firefox 63 adds the Font Editor -- a new area below "Fonts used" with additional controls for editing the fonts' characteristics. For standard (static) fonts, you will be able to change the settings listed below Size The font-size for the inspected element. This can be set using em, rem, %, px, vh, or vw units. You can select values using the ...
...And 5 more matches
Using dynamic styling information - Web APIs
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. ...
...e 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 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...
...rs 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.). Modify a stylesheet rule with CSSOM <html> <head> <title>Modifying a stylesheet rule with CSSOM</title> <style type="text/css"> body { background-color: red; } </style> <script type="text/javascript"> var stylesheet = document.styleSheets[0]; stylesheet.cssRules[0].style.backgroundColor="blue"; </script> </head> <body> The stylesheet declaration for the body's background color is modified via JavaScript. </body> </html> The ...
...And 5 more matches
Window.devicePixelRatio - Web APIs
This is useful when dealing with the difference between rendering on a standard display versus a HiDPI or Retina display, which use more screen pixels to draw the same objects, resulting in a sharper image. ...
... This is useful when dealing with the difference between rendering on a standard display versus a HiDPI or Retina display, which use more screen pixels to draw the same objects, resulting in a sharper image. ...
... This is useful when dealing with the difference between rendering on a standard display versus a HiDPI or Retina display, which use more screen pixels to draw the same objects, resulting in a sharper image. ...
...And 5 more matches
Block formatting context - Developer guides
It's the region in which the layout of block boxes occurs and in which floats interact with other elements. A block formatting context is created by at least one of the following: The root element of the document (<html>). Floats (elements where float isn't none). Absolutely positioned elements (elements where position is absolute or fixed). Inline-blocks (elements with display: inline-block). Table cells (elements with display: table-cell, which is the default for HTML table cells). Table captions (elements with display: table-caption, which is the default for HTML table captions). ...
...ass="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 { float: left; width: 200px; height: 100px; background-color: rgba(255, 255, 255, .5); border:1px solid black; padding: 10px; } Exclude external floats In the ...
... must not overlap the margin box of any floats in the same block formatting context as the element itself. ...
...And 5 more matches
HTML attribute reference - HTML: Hypertext Markup Language
tton>, <input>, <keygen>, <select>, <textarea> The element should be automatically focused after the page loaded. autoplay <audio>, <video> The audio or video should play as soon as possible. background <body>, <table>, <td>, <th> Specifies the URL of an image file. Note: Although browsers and email clients may still support this attribute, it is obsolete. Use CSS background-image instead. bgcolor <body>, <col>, <colgroup>, <marquee>, <table>, <tbody>, <tfoot>, <td>, <th>, <tr> Background color of the element. Note: This is a legacy attribute. Please use the CSS background-color property instead. border <img>, <object>, <table> The border width. Note: This is a legacy attribute. Pleas...
... buffered <audio>, <video> Contains the time range of already buffered media. ...
...d along 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 col...
...And 5 more matches
XUL user interfaces - Archive of obsolete content
erfaces: 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...
... 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. ...
...her 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 4 more matches
Layout System Overview - Archive of obsolete content
Layout's Job: Provide the Presentation Layout is primarily concerned with providing a presentation to an HTML or XML document. This presentation is typically formatted in accordance with the requirements of the CSS1 and CSS2 specifications from the W3C. Presentation formatting is also required to provide compatibility with legacy browsers (Microsoft Internet Explorer and Netscape Navigator 4.x). The decision about when to apply CSS-specified formatting and when to apply legacy formatting is controlled by the document's DOCTYPE specification. These layout modes are referred to as 'Standards' and 'NavQuirks' modes. (DOCTYPE and modes are explained in more detail in article Mozilla's DOCTYPE sniffing. Galley and Page Presentations: The presentation generally is constrained by the width of the w...
...ion and management of frames. Frames are an encapsulation of a region on the screen, a region that contains geometry (size and location, stacking order). Generally frames correspond to the content elements, though there is often a one-to-many correspondence between 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. 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. This causes th...
...cause it is needed for many other computations during the formatting of the frames. Once a frame is created for a content element, it must be formatted. We refer to this as 'laying out' the frame, or as 'reflowing' the frame. Each frame implements a Reflow method to compute its position and size, among other things. For more details on the Reflow mechanism, see the Reflow Overview document... The CSS formatting requirements present two distinct layout models: 1) the in-flow model, where the geometry of an element is influenced by the geometry of the elements that precede it, and 2) the positioned model, where the geometry of an element is not influenced by the geometry of the elements that precede it, or in any case, is influenced more locally. The in-flow case is considered the 'normal' case...
...And 4 more matches
SeaMonkey - making custom toolbar (SM ver. 1.x) - Archive of obsolete content
or 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. ...
...ave 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. ...
...t 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. 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. Paste it into the new file: #custom-button-1 {list-style-image: url("chrome://custombutton/content/button-1s.png");} /* common style for all custom buttons - modern */ #nav-bar .custombutton {-moz-image-region: rect( 0px 41px 39px 0px);} #nav-bar .custombutton:hover {-moz-image-region: rect( 0px 83px 39p...
...And 4 more matches
Custom toolbar button - Archive of obsolete content
ions 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. ...
...ory 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. ...
...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 4 more matches
Box Objects - Archive of obsolete content
the content or structure of the document. It's relatively simple to determine what kind of content tree node will be created for a given element. A XUL element, for example, 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 num...
...e 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, while others such as the button are used only to add extra mouse and key event handling. The layout object associated with an element can be removed and a completely different type of object created just by changing the CSS display property, among others. For example changing the display property of a button element to block will cause the button layout object to be deleted and a block object to be created instead. Naturally, this will change the appearance and function of the element. It isn't necessary to know the details of how the layout objects are constructed but it is quite useful to at least have at least th...
...es six read only properties, x, y, screenX, screenY, width and height, for determining the currently displayed position and size of an element. All values returned are in pixels. ...
...And 4 more matches
Building a Theme - Archive of obsolete content
ase. Themes are compatible by default, unless you set strict compatibility mode for your theme. If you get a message that the install.rdf is malformed, it is helpful to load it into firefox using the File->Open File command and it will report XML 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 brow...
...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, the easiest way to determine what CSS selectors you need to write is to use the DOM Inspector which you should have installed in the setup step. You can use this to inspect any element in a web page or an XUL document, which makes it invaluable for themes. Updating the toolbar's Styling Note In Firefox 4.0 and up, the highlight feature of DOM Inspector is broken. To workaround this, disable Hardware Acceleration in Firefox' Option...
...de finding tool (the arrow-plus-box in the top-left corner of the DOM Inspector), and click on any 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...
...And 4 more matches
Using the W3C DOM - Archive of obsolete content
ttributes, 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 get a reference to the element to which that style corresponds by using the DOM's getElementById or one of the other methods described in the DOM access section above. Deprecated coding practices Appropriate DOM 2 replacemen...
...Therefore, if you wish to read and write these properties from JavaScript through the DOM2, use one of these two appr...
...he W3C Recommendation, the values returned by the style property of an element reflect static settings in the element's STYLE attribute only, not the total "computed style" that includes any inherited style settings from parent elements. ...
...And 4 more matches
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
s already been done for you. All you need to do is implement the JavaScript. Let's take a closer look on the SpiderMonkey side with Jaxer. As stated earlier, Aptana Jaxer is built using the Mozilla Browser Engine engine that powers Mozilla Firefox, which includes SpiderMonkey as its JavaScript interpreter, but lots more features beyond SSJS alone such as DOM, DB, File IO, CSS, server sessions, E4X, etc...] This is a great advantage to the developer as it presents a consistent server-side and client-side development environment for both browser and server contexts that is centered on open source and Web standards. Also since you know which engine you're targeting, you're free to confidently use advanced built in controls such as XML processing via E4X, XPath, and XSLT.
...ch code is shared between the two, it'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. ...
...hared between the two, it'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. ...
...And 4 more matches
Fixing Table Inheritance in Quirks Mode - Archive of obsolete content
tance 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 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 pi...
..., 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. ...
...r 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 rules, and led many authors to create workarounds such as: <style type="text/css"> body, table, td {font-size: 11px;} </style> Recreating Legacy Behavior To avoid "breaking" older pages that were authored with old-browser behaviors in mind, Mozilla and related browsers will mimic old browsers when in "quirks" mode. To do this, the Gecko rendering engine uses the following rule in t...
...And 4 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. ...
...over 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. ...
...ce 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(R) 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 the three dynamic pseudo-classes (:hover, :active, and :focus) and then goes on to say: CSS doesn't define which elements may be in the above states, or how the states are entered and left. Scripting may change whether elements react to user ev...
...And 4 more matches
The Business Benefits of Web Standards - Archive of obsolete content
nding an unsuspected ally in the battle: Web Standards. 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. Storing CSS in a separate document (aka style 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 locati...
...e 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 conjunction with CSS. According to various reports, case studies, and Andy King, author of Speed Up Your Web Site: Web Site Optimization, CSS has made it possible to transform table-based layouts into CSS-based layouts. Typically this reduces page size by 25 to 50%. This translates into better user experience, according to Usability Guru Jakob Nielsen, who notes that users tend to close a web page when it takes more ...
...d so on gives proper structure to hypertext documents. Search engine agents crawl the web to index it, but for ranking and indexing purposes they can only process text. Dynamic effects such as those created by JavaScript are not taken into account, and text rendered with graphics cannot be read and parsed either. Separating presentation from content increases the information/markup ratio, making CSS-based documents more pertinent with regard to the search terms, which makes them rank higher in search results. Using CSS to render titles instead of graphics also helps in this regard. There are very significant differences in how search engines operate. Instead of worrying about each engine and attempting to artificially manipulate the results, Web Standards pages index and rank properly (wher...
...And 4 more matches
Document and website structure - Learn web development
imes used for SEO purposes, by providing links for quick access to popular content. A "typical website" could be structured something like this: HTML for structuring content The simple example shown above isn't pretty, but it is perfectly fine for illustrating a typical website layout example. Some websites have more columns, some are a lot more complex, but you get the idea. With the right CSS, you could use pretty much any elements to wrap around the different sections and get it looking how you wanted, but as discussed before, we need to respect semantics and use the right element for the right job. This is because visuals don't tell the whole story. We use color and font size to draw sighted users' attention to the most useful parts of the content, like the navigation menu and rela...
...xample Our example seen above is represented by the 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. ...
...n 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. ...
...And 4 more matches
HTML text fundamentals - Learn web development
ne 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 it appears as a h...
...t the correct meaning, function, or appearance. In this context the <h1> element is also 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, the browser will give it a large font size to make it look like a heading (although you could style it to look like anything you wanted using CSS). More importantly, its semantic value will be used in multiple ways, for example by search engines and screen readers (as mentioned above). 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; display: block;">Is this a top level heading?</span> This is a <span> element. It has no semantics. You use ...
...ll be used in multiple ways, for example by search engines and screen readers (as mentioned above). 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; display: block;">Is this a top level heading?</span> This is a <span> element. It has no semantics. You use it to wrap content when you want to apply CSS to it (or do something to it with JavaScript) without giving it any extra meaning. (You'll find out more about these later on in the course.) We've applied some CSS to it to make it look like a top level heading, but since it has no semantic value, it will not get any of the extra benefits described above. It is a good idea to use the relevant HTML element for the job. Lists Now let's turn our ...
...And 4 more matches
HTML table basics - Learn web development
Learn › HTML › Tables › Basics
data in an HTML table -- a successful HTML table should enhance the experience of sighted and visually impaired users alike. ...
... Table styling You can also have a look at the live example on GitHub! One thing you'll notice is that the table does look a bit more readable there -- this is because the table you see above on this page has minimal styling, whereas the GitHub version has more significant 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...
... HTML tables should be used for tabular data -- this is what they are designed for. Unfortunately, a lot of people used to use HTML tables to lay out web pages, e.g. one row to contain the header, one row to contain the content columns, one row to contain the footer, etc. You can find more details and an example at Page Layouts in our Accessibility Learning Module. This was commonly used because CSS support across browsers used to be terrible; table layouts are much less common nowadays, but you might still see them in some corners of the web. In short, using tables for layout rather than CSS layout techniques is a bad idea. The main reasons are as follows: Layout tables reduce accessibility for visually impaired users: Screenreaders, used by blind people, interpret the tags that exist i...
...And 4 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. ...
...ntent :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). Residual style tags' size info does not take precedence over heading tags' size (bug 77352). Use box-sizing:border-box for most INPUT types and TEXTAREA. Give FORM a margin-bottom:1em (bug 41806). ...
...oes not take precedence over heading tags' size (bug 77352). Use box-sizing:border-box for most INPUT types and TEXTAREA. Give FORM a margin-bottom:1em (bug 41806). In quirks mode CSS class and id names are case insensitive. In standards mode they are case sensitive. (This also applies to getElementsByClassName.) Stylesheets linked in the document with an advisory MIME type of text/css will still be treated as CSS even if the server gives a Content-Type header other than text/css. The CSS parser accepts colors not beginning with #, except in shorthands. The CSS parser interprets unitless numbers as px (except for line-height and any other properties where they have distinct meaning, and except in shorthands). In quirks mode, the CSS parser allows {} around the contents of st...
...And 4 more matches
nsIContentView
ee bug 618975 for details. Method overview void scrollBy(in float dxPx, in float dyPx); void scrollTo(in float xPx, in float yPx); void setScale(in float xScale, in float yScale); Attributes Attribute Type Description contentHeight float Read only. contentWidth float Dimensions of scrolled content in chrome-document CSS pixels. Read only. id nsContentViewId ID that can be used in conjunction with nsIDOMWindowUtils to change the actual document, instead of just how it is transformed; this is a 64-bit unsigned integer. Read only. scrollX float Horizontal scroll offset in chrome-document CSS pixels. When this view is active (that is it is being painted because it's in the vis...
...Fails if the view isn't valid. ...
...gion of the screen), this value is at first lined up with the content's scroll offset. Note: When this view becomes inactive, the new content view will have scroll values that are reset to the default. Read only. scrollY float Horizontal scroll offset in chrome-document CSS pixels. Read only. viewportHeight float Height of the viewport in chrome-document CSS pixels. Read only. ...
...And 4 more matches
Examine and edit HTML - Firefox Developer Tools
in the page. The breadcrumbs bar has its own keyboard shortcuts. Searching The Page Inspector's search box matches all markup in the current document and in any frames. To start searching the markup, click in the search box to expand it or press Ctrl + F , or Cmd + F on a Mac. There are three types of searches that are performed automatically depending on what you enter, a full text search, a CSS selector search, and an XPath search. Full text search The full text search will always be executed, independently of what you enter. That allows you to find CSS selectors and XPath expressions occurring within the text. CSS selector search You can search elements by entering a CSS selector. As you type, an autocomplete popup shows any class or ID attributes that match the current search ter...
... Add Attribute Copy Attribute Value Edit Attribute Remove Attribute Break on ... ...
...e Copy Attribute Value Edit Attribute Remove Attribute Break on ... ...
...And 4 more matches
Console messages - Firefox Developer Tools
cates that further information is available; clicking it displays or collapses that information. Message The message itself. Number of occurrences If a line that generates a warning or error is executed more than once, it is only logged once and this counter appears to indicate how many times it was encountered. Filename and line number For JavaScript, CSS and console API messages, the message can be traced to a specific line of code. The console then provides a link to the filename and line number that generated the message. By default, the console is cleared each time you navigate to a new page or reload the current page. To override this behavior, enable Persist Logs in the console settings menu (gear icon). The context menu options ...
...tion 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 show up in the Web Console...
... Then any messages or errors your source generates will show up in the Web Console with a link back to the original source, not the compressed version. Async stack frames Stack traces show stack frames for async functions separately from those for synchronous functions. When you run code containing an async function, its traces (console.trace or thrown error) are shown with an Async: prefix. CSS Note: CSS warnings and reflow messages are not shown by default, for performance reasons (see bug 1452143). Use the filtering feature to show them. Some CSS messages contain a disclosure triangle at the left of the message. Click it to view more information about the error, as well as which DOM nodes are affected by the error. Reflow events The Web Console also logs reflow events under th...
...And 4 more matches
Applying styles and colors - Web APIs
tyles, 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 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 fi...
...Each of the following examples describe the same color. ...
...lue must be between 0.0 (fully transparent) to 1.0 (fully opaque). This value is 1.0 (fully opaque) by default. The globalAlpha property can be useful if you want to draw a lot of shapes on the canvas with similar transparency, but otherwise it's generally more useful to set the transparency on individual shapes when setting their colors. Because the strokeStyle and fillStyle properties accept CSS rgba color values, we can use the following notation to assign a transparent color to them. // Assigning transparent colors to stroke and fill style ctx.strokeStyle = 'rgba(255, 0, 0, 0.5)'; ctx.fillStyle = 'rgba(255, 0, 0, 0.5)'; The rgba() function is similar to the rgb() function but it has one extra parameter. The last parameter sets the transparency value of this particular color. The va...
...And 4 more matches
Document - Web APIs
Web › API › Document
ment.fullscreenElementRead only 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. null if lock is pending, 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. Event handlers Document.onafterscriptexecute Represents the event handling code for the afterscriptexecute event. Document.onbeforescriptexecute Represents the event handling code for the beforescriptexecute event. Document.oncopy Represents the event handling code for the copy event. Document.on...
...epresenting the code to be called when the visibilitychange event is raised. The Document interface is extended with the GlobalEventHandlers interface: GlobalEventHandlers.onabort Is an EventHandler representing the code to be called when the abort event is raised. GlobalEventHandlers.onanimationcancel An EventHandler called when an animationcancel event is sent, indicating that a running CSS animation has been canceled. GlobalEventHandlers.onanimationend An EventHandler called when an animationend event is sent, indicating that a CSS animation has stopped playing. GlobalEventHandlers.onanimationiteration An EventHandler called when an animationiteration event has been sent, indicating that a CSS animation has begun playing a new iteration of the animation sequence. GlobalEve...
... GlobalEventHandlers.onauxclick An EventHandler called when an auxclick event is sent, indicating that a non-primary button has been pressed on an input device (e.g. a middle mouse button). GlobalEventHandlers.onblur Is an EventHandler representing the code to be called when the blur event is raised. ...
...And 4 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 e...
...In other bro...
...In other browsers you'll just see a link. Did you real...
...And 4 more matches
Web APIs
Web › API
available. Below 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. ...
...s 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. ...
...Is 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. ...
...And 4 more matches
Event reference
a couldn't be sent for example). close A WebSocket connection has been closed. Session History events Event Name Fired When pagehide A session history entry is being traversed from. pageshow A session history entry is being traversed to. popstate A session history entry is being navigated to (in certain cases). ...
.... Session History events Event Name Fired When pagehide A session history entry is being traversed from. pageshow A session history entry is being traversed to. popstate A session history entry is being navigated to (in certain cases). CSS Animation events Event Name Fired When animationstart A CSS animation has started. animationcancel A CSS animation has aborted. ...
...ry entry is being traversed from. pageshow A session history entry is being traversed to. popstate A session history entry is being navigated to (in certain cases). CSS Animation events Event Name Fired When animationstart A CSS animation has started. animationcancel A CSS animation has aborted. animationend A CSS animation has completed. animationiteration A CSS animation is repeated. CSS Transition events Event Name Fired When transitionstart A CSS transition has actually started (fired after any delay). transitioncancel A CSS transition has been cancelled. transitionend A CSS transition has completed. transitionrun A...
...And 4 more matches
Challenge solutions - Developer guides
This page provides solutions to the challenges posed in the CSS Getting Started tutorial. These are not the only possible solutions. The sections below correspond to the titles of the tutorial sections. Why use CSS Colors Challenge Without looking up a reference, find five more color names that work in your stylesheet. Solution CSS supports common color names like orange, yellow, blue, green, or black. It also supports some more exotic color names like chartreuse, fuschia, or burlywood. See CSS Color value for a complete list as well as other ways 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 t...
... 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. ...
...lution Move the declaration for underlining from the rule for <p> to the one for <strong>. The resulting file looks like this: p {color: blue; } strong {color: orange; text-decoration: underline;} Later sections of this tutorial describe style rules and declarations in greater detail. 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. Solution Add a rule with an ID selector of #second and a declaration color: blue;, as shown below: #second { color: blue; } A more specific selector, p#second also works. Both paragraphs blue Challenge Now change the rule you have just added (without changi...
...And 4 more matches
Introduction to Web development - Developer guides
web page -- the doctype and document 'tree' Fundamental HTML elements -- structural, head, list, form elements and more, explained by category. HTML beginners tutorial -- a tutorial and exercise that recap and take you through the basics you've learned above. ...
...t 'tree' Fundamental HTML elements -- structural, head, list, form elements and more, explained by category. HTML beginners tutorial -- a tutorial and exercise that recap and take you through the basics you've learned above. ...
...s -- structural, head, list, form elements and more, explained by category. HTML beginners tutorial -- a tutorial and exercise that recap and take you through the basics you've learned above. HTML elements reference guide -- a comprehensive guide to HTML elements with details on how browsers support them CSS Getting started with CSS -- an absolute beginners guide to CSS covers basic concepts and fundamentals CSS reference guide -- a complete guide to CSS with details on the level of Gecko/Firefox support for each. The W3C introduction to styling with CSS -- a brief guide to styling web pages for beginners. Common CSS questions -- common questions and answers for beginners Intermediate CSS concepts -- grouping, pseudo-classes and more. ...
...And 4 more matches
<details>: The Details disclosure element - HTML: Hypertext Markup Language
Web › HTML › Element › details
only the 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 cl...
...se 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. Fully standards-compliant implementations automatically apply the CSS display: list-item to the <summary> element. You can use this to customize its appearance further. See Customizing the disclosure widget for further details. Content categories Flow content, sectioning root, interactive content, palpable content. Permitted content One <summary> element followed by flow content. Tag omission None, both the starting and ending t...
... its open state, add the Boolean open attribute: <details open> <summary>System Requirements</summary> <p>Requires a computer running an operating system. The computer must have some memory and ideally some kind of long-term storage. ...
...And 4 more matches
Inline elements - HTML: Hypertext Markup Language
HTML (Hypertext Markup Language) elements historically were categorized as either "block-level" elements or "inline-level" elements. Since this is a presentational characteristic it is nowadays specified by CSS in the Flow Layout. Inline elements are those which only occupy the space bounded by the tags defining the element, instead of breaking the flow of the content. In this article, we'll examine HTML inline-level elements and how they differ from block-level elements. An inline element does not start on a new line and only takes up as much width as necessary. ...
... tags defining the element, instead of breaking the flow of the content. In this article, we'll examine HTML inline-level elements and how they differ from block-level elements. An inline element does not start on a new line and only takes up as much width as necessary. Inline vs. block-level elements: a demonstration This is most easily demonstrated with a simple example. ...
...line element</span>; its background has been colored to display both the beginning and end of the inline element's influence.</div> In this example, the <div> block-level element contains some text. Within that text is a <span> element, which is an inline element. ...
...And 4 more matches
Preloading content with rel="preload" - HTML: Hypertext Markup Language
fying resources 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. ...
...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): <head> <meta charset="utf-8"> <title>JS and CSS preload exampl...
...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 browser ...
...And 4 more matches
Web Performance
le and interactive as possible, as soon as possible, while asynchronously loading in the longer tail parts of the experience. There are tools, APIs, and best practices that help us measure and improve web performance. ...
...ence. There are tools, APIs, and best practices that help us measure and improve web performance. We cover them in this section: Key performance guides Animation performance and frame rateAnimation on the web can be done via SVG, JavaScript, including <canvas> and WebGL, CSS animation, <video>, animated gifs and even animated PNGs and other image types. The performance cost of animating a CSS property can vary from one property to another, and animating expensive CSS properties can result in jank as the browser struggles to hit a smooth frame rate.Critical rendering pathThe Critical Rendering Path is the sequence of steps the browser goes through to convert the HTML, CSS, and JavaScript into pixels on the screen. Optimizing the critical render path improves render performance.The crit...
... expensive CSS properties can result in jank as the browser struggles to hit a smooth frame rate.Critical rendering pathThe Critical Rendering Path is the sequence of steps the browser goes through to convert the HTML, 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.CSS and JavaScript animation performanceBrowsers are able to optimize rendering flows. In summary, we should always try to create our animations using CSS transitions/animations where possible. If your animations are really complex, you may have to rely on JavaScript-based animations instead.Lazy loadingLazy Loading is a strategy to identify resources ...
...And 4 more matches
Storing annotations - Archive of obsolete content
Annotations To prove that this works, let's implement the part of the add-on that displays all the previously entered annotations. This is implemented as a panel that's shown in response to the widget's right-click message. The panel has three new files associated with it: a content-script which builds the panel content a simple HTML file used as a template for the panel's content a simple CSS file to provide some basic styling. These three files can all go in a new subdirectory of data which we will call list. Annotation List Content Script Here's the annotation list's content script: self.on("message", function onMessage(storedAnnotations) { var annotationList = $('#annotation-list'); annotationList.empty(); storedAnnotations.forEach( function(storedAnnotation) { ...
...tionHtml); }); }); It builds the DOM for the panel from the array of annotations it is given. The user will be able to click links in the panel, but we want to open them in the 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. ...
...ather 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. ...
...And 3 more matches
Custom XUL Elements with XBL - Archive of obsolete content
UL is really just boxes, text and images. We'll look into XBL using a modified version of the Hello World extension. Download the Hello World XBL project, build it and test it for a while. You should see a new item in the Hello World menu, that opens a Binding Test window where you can add "Persons" to a list. XBL Basics In order to create an XBL binding you'll need 2 files: the XBL file and a CSS file that binds an element name to your XBL declaration. If you look into the content directory, you'll see both files: person.xml - this is the main binding file. It holds all the code necessary to control the new element we created. We'll look into the code throughout the rest of this section. For now, just notice the opening part of the binding element: <binding id="person">. bindings.css ...
...roughout the rest of this section. For now, just notice the opening part of the binding element: <binding id="person">. bindings.css - this 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. 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 el...
...d 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 elements are created and added to the DOM just like any other. addPerson : function(aEvent) { // ... let person = document.createElement("xshelloperson"); // ... person.s...
...And 3 more matches
Underscores in class and ID Names - Archive of obsolete content
It is a fairly common practice in many programming languages to use the underscore character (_) in the place of a "space" in variable and function names. ...
... It is a fairly common practice in many programming languages to use the underscore character (_) in the place of a "space" in variable and function names. ...
...s greatly improved since this article was originally published in 2001 and the following recommendation is no longer accurate for most circumstances. Summary: The use of the underscore character in CSS can lead to major display problems in multiple browsers. Learn why this is so, and how to keep your sites from being bitten by this problem. This technical note examines the use of underscores in CSS, and why they should be generally avoided in most circumstances. It is a fairly common practice in many programming languages to use the underscore character (_) in the place of a "space" in variable and function names. For example, a function whose job is to "get the length of a string" might be called get_string_length, and a variable representing the number of people who voted Republican migh...
...And 3 more matches
Images, Tables, and Mysterious Gaps - Archive of obsolete content
However, these techniques may be relevant when the developer cannot assume that users have a modern browser, such as for HTML-based e-mail messages. Almost no matter when you started creating Web pages, odds are pretty high you have one or more designs based on the classic "convoluted tables and lots of images" paradigm. Whether you've sliced up a logo so it fits in well with the design, or used tons of single-pixel spacer GIFs, the principles (and perils) remain largely the same. ...
... you've sliced up a logo so it fits in well with the design, or used tons of single-pixel spacer GIFs, the principles (and perils) remain largely the same. Back in the early days, this approach worked, because browsers would usually make a table cell exactly as wide and tall as an image it contained. Fast forward to 2001, and the rise of standards-based browsers that lay out pages using HTML and CSS instead of their own private layout algorithms. Thanks to an obscure corner of the CSS specification, every design based on a precise layout of small images in table cells have become visual disasters just waiting to happen. All it takes is a modern browser and the right DOCTYPE, and kaboom! The Components Let's take a close look at the breeding ground for trouble, and why this is a problem. We...
...e amount. The navbar images now have space appearing above them, and the red spacer got even bigger. It's difficult to avoid this, because the images are (in this approach) still inline and so still participate in the creation of a line box. If that line box gets tall enough, space will begin to appear around the images. Looking Forward To a Fix Thanks to Mozilla's thorough implementation of CSS2, the problem of inline images in table cells forcing open unwanted space has come to the attention of the CSS Working Group. There have been many proposals to fix the problem, but one of the most promising approaches is the property line-box-contain, which has been proposed for inclusion in CSS3. Should this property be adopted, then any browser supporting it could emulate traditional "shrinkwra...
...And 3 more matches
Binding Attachment and Detachment - Archive of obsolete content
Attachment using CSS Bindings can be attached to elements through CSS using the -moz-binding property. -moz-binding Value: none | [,]* <uri> | inherit Initial Value: none Applies to: all elements (not generated content or pseudo-elements) Inherited: no Percentages: N/A The value of the -moz-binding property is a set of URLs that identify specific bindings. An individual URL in the set consists of 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. ...
...s a set of URLs that identify specific bindings. An individual URL in the set consists of 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 ele...
...tyle 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 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. N...
...And 3 more matches
XML in Mozilla - Archive of obsolete content
support for XML. Several World Wide Web Consortium (W3C) Recommendations 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 lang...
...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 discussed in t...
...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. Specification or technology Status and/or further documentation XML 1.0 W3C Recommendation Namespaces in XML W3C Recommendation Associating Stylesheets with XML Documents W3C Recommendation Styling XML Documents with ...
...And 3 more matches
Creating toolbar buttons (Customize Toolbar Window) - Archive of obsolete content
We assume that you're also familiar with the basics of creating Firefox extensions and have the Hello World extension working. Another tutorial, which walks you through the entire process from the beginning, is also available. Creating an overlay The first step is to create an overlay for the document containing the toolbar you wish to enhance. ...
...To attach it t...
...To attach it to the overlay, put this processing ...
...And 3 more matches
Adding Style Sheets - Archive of obsolete content
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. ...
...hod has the disadvantage because it means your application will not be themeable. The second method involves placing your files as part of a theme. Let's assume that we are building the find files dialog for themeability, because the find files dialog can be referred to with the URL chrome://findfile/content/findfile.xul so the style sheet file will be stored in chrome://findfile/skin/findfile.css. All the XUL examples so far have actually been using a style sheet already. The second line has always been: <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> This line indicates that we want to use the style provided by chrome://global/skin/. In Mozilla, this will be translated as the file global.css, which contains default style information for XUL elements. You could leave the...
...t change the meaning of the element. However you should avoid this as much as possible. For installed files, you'll have to create or modify a manifest file and install the skin. Our Find Files Dialog Example Let's modify the find files dialog so that its style comes from a separate style file. First, the modifed lines of findfile.xul: <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <?xml-stylesheet href="findfile.css" type="text/css"?> ... <spacer class="titlespace"/> <groupbox orient="horizontal"> <caption label="Search Criteria"/> <menulist id="searchtype"> <menupopup> <menuitem label="Name"/> <menuitem label="Size"/> <menuitem label="Date Modified"/> </menupopup> </menulist> <spacer class="spring...
...And 3 more matches
Introduction to XBL - Archive of obsolete content
root element of an XBL file and contains one or more binding elements. Each binding element declares a single binding. The id attribute can be used to identify the binding, as in the example above. The template has two bindings, one called binding1 and the other called binding2. One might be attached to a scroll bar and the other to a menu. A binding can be attached to any XUL element. If you use CSS classes, you can use as many different bindings as you need. Note the namespace on the bindings element in the template above. This declares that we are using XBL syntax. You assign a binding to an element by setting the CSS property -moz-binding to the URL of the bindings file. For example: scrollbar { -moz-binding: url('chrome://findfile/content/findfile.xml#binding1'); } The URL points to...
...ding 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. ...
...o 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 3 more matches
window - Archive of obsolete content
window will have a platform-specific frame around it. To set an icon for the window, create a platform-specific icon file <windowid>.ico and/or <windowid>.xpm and place or install these files into the <mozilla-directory>/chrome/icons/default/ directory. The <windowid> is the value of the id attribute on the window. This allows you to have a different icon for each window. Without including the css file at "chrome://global/skin/", the window will not be stylized and will be invisible and glitchy when opened as a dialog. Note: Starting in Gecko 1.9.2, you can detect when a window is activated or deactivated by watching for the "activate" and "deactivate" events. See Window activation events. More information is available in the XUL tutorial. Attributes accelerated, chromemargin, disa...
... Window activation events. More information is available in the XUL tutorial. ...
...intitlebar, fullscreenbutton, height, hidechrome, id, lightweightthemes, lightweightthemesfooter, screenX, screenY, sizemode, title, width, windowtype Examples <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <!-- run this example using copy & paste in this live XUL editor: https://github.com/KM-200/xul --> <!-- Extremely recommended to keep this css include!! --> <window id="rootWnd" title="Register Online!" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <vbox> <hbox> <image src="application_form.png"/> <description>Register Online!</description> </hbox> <groupbox align="start"> <caption label="Your Information"/> <radiogroup> <vbox> <hbox> <l...
...And 3 more matches
Efficient animation for web games - Game development
There are several techniques worth knowing that will improve the performance of your game or application whilst also using less battery life, especially on low-end devices. ...
... There are several techniques worth knowing that will improve the performance of your game or application whilst also using less battery life, especially on low-end devices. ...
...sing less battery life, especially on low-end devices. It is worth documenting some of these things, as there is evidence to suggest (in popular and widely-used UI libraries, for example) that they aren't necessarily common knowledge. First off, let us discuss some basic ideas. ...
...And 3 more matches
Flex - MDN Web Docs Glossary: Definitions of Web-related terms
flex is a new value added to the CSS display property. Along with inline-flex it causes the element that it applies to to become a flex container, and the element's children to each become a flex item. The items then participate in flex layout, and all of the properties defined in the CSS Flexible Box Layout Module may be applied. The flex property is a shorthand for the flexbox properties flex-grow, flex-shrink and flex-basis. In addition <flex> can refer to a flexible length in CSS Grid Layout. ...
...yout Module may be applied. The flex property is a shorthand for the flexbox properties flex-grow, flex-shrink and flex-basis. In addition <flex> can refer to a flexible length in CSS Grid Layout. ...
...orthand for the flexbox properties flex-grow, flex-shrink and flex-basis. In addition <flex> can refer to a flexible length in CSS Grid Layout. ...
...And 3 more matches
Flexbox - MDN Web Docs Glossary: Definitions of Web-related terms
Flexbox is the commonly-used name for the CSS Flexible Box Layout Module, a layout model for displaying items in a single dimension -- as a row or as a column. In the specification, Flexbox is described as a layout model for user interface design. The key feature of Flexbox is the fact that items in a flex layout can grow and shrink. Space can be assigned to the items themselves, or distributed between or around the items. Flexbox also enables alignment of items on the main or cross axis, thus providing a high level of control over the size and alignment of a group of items. ...
...r distributed between or around the items. Flexbox also enables alignment of items on the main or cross axis, thus providing a high level of control over the size and alignment of a group of items. ...
...so enables alignment of items on the main or cross axis, thus providing a high level of control over the size and alignment of a group of items. ...
...And 3 more matches
Typesetting a community school homepage - Learn web development
ent we'll test your understanding of all the text styling techniques we've covered throughout this module by getting you to style the text for a community school's homepage. 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. ...
...style the text for a community school's homepage. 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. Starting point To get this assessment started, you should: Go and grab the HTML and CSS files for the exercise, and the provided external link icon. Make a copy of them on your local computer. ...
... Note: If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. ...
...And 3 more matches
Front-end web developer - Learn web development
new skills (or improving 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 know...
.... How will I know I'm ready to move on? The assessments in each module are designed to test your knowledge of the subject matter. Completing the assessments confirms that you are ready to move on to the next module. Modules Introduction to HTML (15-20 hour read/exercises) Multimedia and embedding (15-20 hour read/exercises) HTML tables (5-10 hour read/exercises) Styling and layout with CSS Time to complete: 90-120 hours Prerequisites It is recommended that you have basic HTML knowledge before starting to learn CSS. You should at least study Introduction to HTML first. How will I know I'm ready to move on? The assessments in each module are designed to test your knowledge of the subject matter. Completing the assessments confirms that you are ready to move on to the next modul...
...ete: 90-120 hours Prerequisites It is recommended that you have basic HTML knowledge before starting to learn CSS. You should at least study Introduction to HTML first. How will I know I'm ready to move on? The assessments in each module are designed to test your knowledge of the subject matter. Completing the assessments confirms that you are ready to move on to the next module. Modules CSS first steps (10-15 hour read/exercises) CSS building blocks (35-45 hour read/exercises) Styling text (15-20 hour read/exercises) CSS layout (30-40 hour read/exercises) Additional resources CSS layout cookbook Interactivity with JavaScript Time to complete: 135-185 hours Prerequisites It is recommended that you have basic HTML knowledge before starting to learn JavaScript. You should ...
...And 3 more matches
Adding vector graphics to the Web - Learn web development
ety 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 not suppor...
...e syntax with built-in text equivalent 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...
...nd 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 reference the SVG. ...
...And 3 more matches
Drawing graphics - Learn web development
(see first steps, building blocks, JavaScript objects), the basics of Client-side APIs Objective: To learn the basics of drawing on <canvas> elements using JavaScript. Graphics on the Web As we talked about in our HTML Multimedia and embedding module, the Web was originally just text, which was very boring, so images were introduced -- first via the <img> element and later via CSS properties such as background-image, and SVG. This however was still not enough. While you could use CSS and JavaScript to animate (and otherwise manipulate) SVG vector images -- as they are represented by markup -- there was still no way to do the same for bitmap images, and the tools available were rather limited. The Web still had no way to effectively create animations, games, 3D scenes, and...
...an 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 could become pixellated/distorted. Getting the canvas context and final setup We need to do one final thing before we can consider our canvas template finished. To draw onto the canvas we need to get a special reference to the drawing a...
...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. Add the following lines at the bottom of your JavaScript: ctx.fillStyle = 'rgb(0, 0, 0)'; ctx.fillRect(0, 0, width, height); Here we are setting a fill color using the canvas' fillStyle property (this takes color values just like CSS properties do), then drawing a rectangle that covers the entire area of the canvas with thefillRect method (the first two parameters are the coordinates of the rectangle's top left hand corner; the last two are the width and height you want the rectangle drawn at -- we told you those width and height variables would be useful)! OK, our template is done and it's time to move on. 2D canvas basics...
...And 3 more matches
Aprender y obtener ayuda - Learn web development
types of learning materials that are available, to see which ones are most effective for you to learn with. Textual articles You'll find a lot of written articles on the web to teach you about web design. Like most of this course, for example. ...
...les on the web to teach you about web design. Like most of this course, for example. Some of the articles will be tutorials, to teach you a certain technique or important concept (such as "learn how to create a video player" or "Learn the CSS box model"), and some of the articles will be reference material, to allow you to look up details you may have forgotten (such as "what is the syntax of the CSS background property"?) MDN Web Docs is very good for both types -- the area you are currently in is great for learning techniques and concepts, and we also have several giant reference sections allowing you to look up any syntax you can't remember. There are also several other great resources on the web, some of which we'll mention below. Note: The above text should have given you an importan...
... want to achieve through your learning. A goal statement It sounds silly, but why not start with a single sentence that says what you want to achieve? The following have different scopes, but are all realistic and achievable: I want to become a professional web developer in two years' time. I want to learn enough to build a website for my local amateur tennis club. I want to learn HTML and CSS so I can expand my job role to take over updating the content on our company website. The following are not quite as reasonable: I want to go from a complete beginner to becoming a senior web developer in three months. I want to start my own company and build a social network that will out-perform Facebook, in two years. What do you need to get there? Once you've worked out your goal, it...
...And 3 more matches
Getting started with Vue - Learn web development
Now let's introduce Vue, the third of our frameworks. In this article we'll look at a little bit of Vue background, learn how to install it and create a new project, study the high-level structure of the whole project and an individual component, see how to run the project locally, and get it prepared to start building our example. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Vue components are written as a combination of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to the underlying DOM structure. For installation, and to use some of the more advanced features of Vue (like Single File Components or render functions), you'll need a terminal with node + ...
...e your app should be attached to. This file is often where you register global components or additional Vue libraries. App.vue: this is the top-level component in your Vue app. See below for more explanation of Vue components. components: this directory is where you keep your components. Currently it just has one example component. assets: This directory is for storing static assets like CSS and images. Because these files are in the source directory, they can be processed by Webpack. This means you can use pre-processors like Sass/SCSS or Stylus. Note: Depending on the options you select when creating a new project, there might be other directories present (for example, if you choose a router, you will also have a views directory). .vue files (single file components) Like...
... blocks that can be created and managed separately, and transfer data between each other as required. These small blocks can help you reason about and test your code. While some frameworks encourage you to separate your template, logic, and styling code into separate files, Vue takes the opposite approach. Using Single File Components, Vue lets you group your templates, corresponding script, and CSS all together in a single file ending in .vue. These files are processed by a JS build tool (such as Webpack), which means you can take advantage of build-time tooling in your project. This allows you to use tools like Babel, TypeScript, SCSS and more to 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...
...And 3 more matches
Mozilla Web Developer FAQ
l documents are rendered in the Almost Standards mode when served as text/html under pretext of the Appendix C but in the Standards Mode when served as application/xhtml+xml. ...
...e or the Almost Standards mode in other browsers as well (using the above-mentioned exact doctypes) is the best way to get consistent CSS layout results across different browsers. On the other hand, the quirks implemented in the quirks modes of different browsers vary from browser to browser. Why are there gaps between image rows in tables when the layout engine is in the Standards mode? In the CSS2 box layout model the default vertical sizing of layout boxes and the default vertical alignment of images is different from the behavior of old browsers. These aspects of the layout can be changed by explicitly setting the display CSS property of the images (and possible surrounding <a> elements) to block. If the table cells that contain only an image are marked with <td class="imgcell">, the r...
...yout model the default vertical sizing of layout boxes and the default vertical alignment of images is different from the behavior of old browsers. These aspects of the layout can be changed by explicitly setting the display CSS property of the images (and possible surrounding <a> elements) to block. If the table cells that contain only an image are marked with <td class="imgcell">, the required CSS rule is: .imgcell img, .imgcell a { display: block; } Longer explanation... Why are there still gaps even between text rows in tables when the layout engine is in the Standards mode or in the Almost Standards mode? In the Standards mode and in the Almost Standards mode Mozilla does not suppress the default margins of the first and last child element in table cells. Therefore, the default margi...
...And 3 more matches
Building the WebLock UI
usbar of the 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 secti...
...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/>. The "shell" 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 t...
... the button children, and it orients them horizontally (in contrast to the <vbox/>, which orients its children vertically). Notice also that when it's clicked, the button executes a JavaScript function called addThisSite(), which we've already defined in the weblock.js file in Client Code Overview above. ...
...And 3 more matches
nsIAccessNode
rd 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. ...
...ccessNode 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. ...
...) Obsolete since Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Get the nth child of this node. nsIAccessNode getChildNodeAt( in long childNum ); Parameters childNum Zero-based child index. Return value The nth nsIAccessNode child. Exceptions thrown NS_ERROR_FAILURE Indicates that the access node is unattached from the accessible tree. ...
...And 3 more matches
Work with animations - Firefox Developer Tools
rs three tools you can use to visualize and edit animations: the animation inspector editing @keyframes editing timing functions Animation inspector The Page Inspector's Animations view displays animations in the page synchronized along a timeline, with a draggable widget you can use to move to any point in the timeline and see the page at that point. It displays animations created using CSS transitions, CSS @keyframes rules, or the Web Animations API. Starting in Firefox 48, it will show animations applied to the ::before and ::after pseudo-elements. To see how it works, we'll walk through an example. The box below contains a grayscale icon, representing Firefox Developer Edition. If you click the icon, it enlarges and changes to color, and the name of the browser appears. Click th...
... Animation bars Each animation or transition is shown as a horizontal bar laid across the timeline. The bar is: blue if a transition was used to animate a property orange if a @keyframes animation was used green if the Web Animations API was used The bar contains a lightning bolt icon if the property was animated using the compositor thread (see more about the cost of animating different CSS properties). The bar is shaped to reflect the easing effect used for the animation. In the example above you can see that the first bar is concave, representing ease-in, and the second is convex, representing ease-out. If the animation used CSS transitions, there is one bar for each property transitioned, and it is labeled with the name of the property being transitioned. If the animation used ...
... properties). The bar is shaped to reflect the easing effect used for the animation. In the example above you can see that the first bar is concave, representing ease-in, and the second is convex, representing ease-out. If the animation used CSS transitions, there is one bar for each property transitioned, and it is labeled with the name of the property being transitioned. If the animation used CSS @keyframes, there is one bar for each animation, labeled with its name. ...
...And 3 more matches
Style Editor - Firefox Developer Tools
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 it will offer you a list of suggestions. You can switch autocomplete off in the Style Editor settings. The ...
...ign View for creating and debugging responsive layouts: From Firefox 46 onwards, if an @media rule contains a screen size in a condition, then it is made clickable: clicking it then resizes the screen to that size using the Responsive Design View: Creating and importing style sheets You can create a new style sheet by clicking the New button in the toolbar. Then you can just start entering CSS into the new editor and watch as the new styles are applied in real time just like changes to the other sheets. You can load a style sheet from disk and apply it to the page by clicking the Import button. Source map support Web developers often create CSS files using a preprocessor like Sass, Less, or Stylus. These tools generate CSS files from a richer and more expressive syntax. If you do ...
...s are applied in real time just like changes to the other sheets. You can load a style sheet from disk and apply it to the page by clicking the Import button. Source map support Web developers often create CSS files using a preprocessor like Sass, Less, or Stylus. These tools generate CSS files from a richer and more expressive syntax. If you do this, being able to see and edit the generated CSS is not so useful, because the code you maintain is the preprocessor syntax, not the generated CSS. So you'd need to edit the generated CSS, then manually work out how to reapply that to the original source. Source maps enable the tools to map back from the generated CSS to the original syntax, so they can display, and allow you to edit, files in the original syntax. From Firefox 29 onwards, the ...
...And 3 more matches
CanvasRenderingContext2D.filter - Web APIs
Applies a Gaussian blur to the drawing. ...
...Applies a Gaussian blur to the drawing. ...
...lter property and accepts the same values. Syntax ctx.filter = "<filter-function1> [<filter-function2>] [<filter-functionN>]"; ctx.filter = "none"; Values The filter property accepts a value of "none" or one or more of the following filter functions in a DOMString. url() A CSS <url>. Takes an IRI pointing to an SVG filter element, which may be embedded in an external XML file. blur() A CSS <length>. Applies a Gaussian blur to the drawing. It defines the value of the standard deviation to the Gaussian function, i.e., how many pixels on the screen blend into each other; thus, a larger value will create more blur. A value of 0 leaves the input unchanged. brightness() A CSS <percentage>. Applies a linear multiplier to the drawing, making it appear brighter or darker. A value under 10...
...And 3 more matches
GlobalEventHandlers.onanimationend - Web APIs
The onanimationend property of the GlobalEventHandlers mixin is the EventHandler for processing animationend events. The animationend event fires when a CSS animation reaches the end of its active period (which is calculated as animation-duration * animation-iteration-count) + animation-delay). Syntax var animEndHandler = target.onanimationend; target.onanimationend = Function Value A Function to be called when an animationend event occurs indicating that a CSS animation has begun on the target, where the target object is an HTML element (HTMLElement), document (Document), or window (Window). The function receives as input a single parameter: an AnimationEvent object describing the event which occurred. Example HTML content <div class="main"> <div id="box"> <div id="text">Bo...
..., where the target object is an HTML element (HTMLElement), document (Document), or window (Window). The function receives as input a single parameter: an AnimationEvent object describing the event which occurred. ...
...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); he...
...And 3 more matches
GlobalEventHandlers.onanimationstart - Web APIs
An event handler for the animationstart event. This event is sent when a CSS Animation starts to play. Syntax var animStartHandler = target.onanimationstart; target.onanimationstart = Function Value A Function to be called when an animationstart event occurs indicating that a CSS animation has begun on the target, where the target object is an HTML element (HTMLElement), document (Document), or window (Window). The function receives as input a single parameter: an AnimationEvent object describing the event which occurred. ...
..., where the target object is an HTML element (HTMLElement), document (Document), or window (Window). The function receives as input a single parameter: an AnimationEvent object describing the event which occurred. ...
...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); he...
...And 3 more matches
HTMLElement - Web APIs
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 me...
... its offsetParent's top border. HTMLElement.offsetWidth Read only Returns a double containing the width of an element, relative to the layout. HTMLElement.properties Read only Returns a HTMLPropertiesCollection... HTMLElement.spellcheck Is a Boolean that controls spell-checking. It is present on all HTML elements, though it doesn't have an effect on all of them. HTMLElement.style Is a CSSStyleDeclaration, an object representing the declarations of an element's style attributes. HTMLOrForeignElement.tabIndex Is a long representing the position of the element in the tabbing order. HTMLElement.title Is a DOMString containing the text that appears in a popup box when mouse is over the element. HTMLElement.translate Is a Boolean representing the translation. Event handlers M...
...chEventHandlers.ontouchenter Returns the event handling code for the touchenter event. TouchEventHandlers.ontouchleave Returns the event handling code for the touchleave event. TouchEventHandlers.ontouchcancel Returns the event handling code for the touchcancel event. Methods Inherits methods from its parent, Element, and implements those from DocumentAndElementEventHandlers, ElementCSSInlineStyle, GlobalEventHandlers, HTMLOrForeignElement and TouchEventHandlers. HTMLElement.attachInternals() Attaches an ElementInternals instance to the custom element. HTMLOrForeignElement.blur() Removes keyboard focus from the currently focused element. HTMLElement.click() Sends a mouse click event to the element. HTMLOrForeignElement.focus() Makes the element the current keyboard f...
...And 3 more matches
HTMLImageElement - Web APIs
ded, it must be one of the possible permitted values: sync to decode the image synchronously, async to decode it asynchronously, or auto to indicate no preference (which is the default). Read the decoding page for details on the implications of this property's values. HTMLImageElement.height An integer value that reflects the height HTML attribute, indicating the rendered height of the image in CSS pixels. HTMLImageElement.isMap A Boolean that reflects the ismap HTML attribute, indicating that the image is part of a server-side image map. This is different from a client-side image map, specified using an <img> element and a corresponding <map> which contains <area> elements indicating the clickable areas in the image. The image must be contained within an <a> element; see the ismap page f...
...mage must be contained within an <a> element; see the ismap page for details. HTMLImageElement.loading A DOMString providing a hint to the browser used to optimize loading the document by determining whether to load the image immediately (eager) or on an as-needed basis (lazy). HTMLImageElement.naturalHeight Read only Returns an integer value representing the intrinsic height of the image in CSS pixels, if it is available; else, it shows 0. This is the height the image would be if it were rendered at its natural full size. HTMLImageElement.naturalWidth Read only An integer value representing the intrinsic width of the image in CSS pixels, if it is available; otherwise, it will show 0. This is the width the image would be if it were rendered at its natural full size. HTMLImageElement.
... page-local URL of the <map> element describing the image map to use. The page-local URL is a pound (hash) symbol (#) followed by the ID of the <map> element, such as #my-map-element. The <map> in turn contains <area> elements indicating the clickable areas in the image. HTMLImageElement.width An integer value that reflects the width HTML attribute, indicating the rendered width of the image in CSS pixels. HTMLImageElement.x Read only An integer indicating the horizontal offset of the left border edge of the image's CSS layout box relative to the origin of the <html> element's containing block. HTMLImageElement.y Read only The integer vertical offset of the top border edge of the image's CSS layout box relative to the origin of the <html> element's containing block. Obsolete propert...
...And 3 more matches
MouseEvent.pageX - Web APIs
Web › API › MouseEvent › pageX
he edge of the document as it is, this property takes into account any horizontal scrolling of the page. For example, if the page is scrolled such that 200 pixels of the left side of the document are scrolled out of view, and the mouse is clicked 100 pixels inward from the left edge of the view, the value returned by pageX will be 300. Originally, this property was defined as a long integer. The CSSOM View Module redefined it as a double float. See the Browser compatibility section for details. See Page in Coordinate systems for some additional information about coordinates specified in this fashion. Syntax var pageX = MouseEvent.pageX; Value A floating-point number of pixels from the left edge of the document at which the mouse was clicked, regardless of any scrolling or viewport posit...
...l information about coordinates specified in this fashion. Syntax var pageX = MouseEvent.pageX; Value A floating-point number of pixels from the left edge of the document at which the mouse was clicked, regardless of any scrolling or viewport positioning that may be in effect. This property was originally specified in the Touch Events specification as a long integer, but was redefined in the CSSOM View Module to be a double-precision floating-point number to allow for subpixel precision. Even though numeric types both are represented by Number in JavaScript, they may be handled differently internally in the browser's code, resulting in potential behavior differences. See Browser compatibility to learn which browsers have been updated to use the revised data type. Example More examples...
... <code>pageX</code>: <span id="x">n/a</span> </p> <p> <code>pageY</code>: <span id="y">n/a</span> </p> </div> The HTML is simple; the box we'll be watching for mouse events on is given the class "box". It has two <span> elements, one with the ID "x" and one with the ID "y". Those will be updated each time an event occurs to contain the latest mouse coordinates relative to the page. ...
...And 3 more matches
StylePropertyMapReadOnly - Web APIs
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). ...
...n 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. 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 fo...
...yMapReadOnly 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. Examples We have to have an element to observe: <p> This is a paragraph with some text. ...
...And 3 more matches
TextMetrics - Web APIs
The TextMetrics interface represents the dimensions of a piece of text in the canvas; a textMetrics() instance can be retrieved using the CanvasRenderingContext2D.measureText() method. Properties TextMetrics.width Read only Is a double giving the calculated width of a segment of inline text in CSS pixels. It takes into account the current font of the context. TextMetrics.actualBoundingBoxLeft Read only Is a double giving the distance from the alignment point given by the CanvasRenderingContext2D.textAlign property to the left side of the bounding rectangle of the given text, in CSS pixels. The distance is measured parallel to the baseline. TextMetrics.actualBoundingBoxRight Read only Is a double giving the distance from the alignment point given by the CanvasRenderingContext2D.te...
...CanvasRenderingContext2D.textAlign property to the left side of the bounding rectangle of the given text, in CSS pixels. The distance is measured parallel to the baseline. TextMetrics.actualBoundingBoxRight Read only Is a double giving the distance from the alignment point given by the CanvasRenderingContext2D.textAlign property to the right side of the bounding rectangle of the given text, in CSS pixels. The distance is measured parallel to the baseline. TextMetrics.fontBoundingBoxAscent Read only Is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline attribute to the top of the highest bounding rectangle of all the fonts used to render the text, in CSS pixels. TextMetrics.fontBoundingBoxDescent Read only Is a double giving th...
...sRenderingContext2D.textBaseline attribute to the top of the highest bounding rectangle of all the fonts used to render the text, in CSS pixels. TextMetrics.fontBoundingBoxDescent Read only Is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline attribute to the bottom of the bounding rectangle of all the fonts used to render the text, in CSS pixels. TextMetrics.actualBoundingBoxAscent Read only Is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline attribute to the top of the bounding rectangle used to render the text, in CSS pixels. TextMetrics.actualBoundingBoxDescent Read only Is a double giving the distance from the horizontal line indicated by the CanvasRenderingCont...
...And 3 more matches
Matrix math for the web - Web APIs
This article is also available as an MDN content kit. ...
...This article is also available as an MDN content kit. ...
... = 0; let translationMatrix = [ 1, 0, 0, 0, 0, 1, 0, 0, 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, c...
...And 3 more matches
Web audio spatialization basics - Web APIs
direction is coming from the boombox speaker at the front, so when we rotate it, we can alter the sound's direction -- i.e. make it project to the back when the boombox is rotated 180 degrees and facing away from us. We need to set up a few things for the interface. First, we'll get references to the elements we want to move, then we'll store references to the values we'll change when we set up CSS transforms to actually do the movement. Finally, we'll set some bounds so our boombox doesn't move too far in any direction: const moveControls = document.querySelector('#move-controls').querySelectorAll('button'); const boombox = document.querySelector('.boombox-body'); // the values for our css transforms let transform = { xAxis: 0, yAxis: 0, zAxis: 0.8, rotateX: 0, rotate...
... To start with let's take a look at our left, right, up and down values as these are pretty straightforward. We'll move the boombox along these axis and update the appropriate position. function moveBoombox(direction) { switch (direction) { case 'left': ...
...We need to change the x orientation and the z orientation of the panner coordinates, to move around the y-axis for our left rotation: case 'rotate-left'...
...And 3 more matches
Web accessibility for seizures and physical reactions - Accessibility
ent accessibile for those with vestibular disorders, and how to measure and prevent content leading to seizures and / or other physical reactions. Overview Seizures Seizures caused by light are known as photosensitive epilepsy. Content that flickers, flashes, or blinks can trigger photosensitive epilepsy. Web technologies that use video, animated gifs, animated pngs, animated SVGs, Canvas, and CSS or JavaScript animations are all capable of content that can induce seizures or other incapacitating physical reactions. Certain visual patterns, especially stripes, can also cause physical reactions even though they are not animated. Photosensitive epilepsy is actually a kind of "reflex epilepsy"--seizures occurring in response to a trigger. In the case of photosensitive epilepsy, seizures are t...
...) describes more of the details on refresh rates. A very old article, Tech Republic's Epilepsy and CRT/LCD screen flicker, had an interesting response concerning the refresh rates in Hz. "This effect is noticable, and documented, up to 70 Hz." "These studies would seem to indicate that you should stay away from refresh rates under 70 Hz, and use a rate not divisible by 10." Eric Bailey, of CSS-Tricks, found an innovative use the update feature which, used in combination with animation-duration or transition-duration, to conclude at a rate that is imperceptible to the human eye. In other words, Eric's techniques address the refresh-rate problem. The CSS below is from the article, CSS-TRICKS Revisiting prefers-reduced-motion, the reduced motion media query. @media screen and (prefers-re...
...ate that is imperceptible to the human eye. In other words, Eric's techniques address the refresh-rate problem. The CSS below is from the article, CSS-TRICKS Revisiting prefers-reduced-motion, the reduced motion media query. @media screen and (prefers-reduced-motion: reduce), (update: slow) { * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; /* Hat tip Nick/cssremedy (https://css-tricks.com/revisiting-prefers-reduced-motion-the-reduced-motion-media-query/#comment-1700170) */ transition-duration: 0.001ms !important; } } From W3.org's page on Media Queries 4: The update media feature is used to query the ability of the output device to modify the appearance of content once it has been rendered. It has the values of "none", "slow", and "fast". Deve...
...And 3 more matches
<input type="image"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › image
The encoding method to use when submitting the form data formmethod The HTTP method to use when submitting the form formnovalidate A Boolean which, if present, indicates that the form shouldn't be validated before submission formtarget A string indicating a browsing context from where to load the results of submitting the form height The height, in CSS pixels, at which to draw the image src The URL from which to load the image width The width, in CSS pixels, at which to draw the image alt The alt attribute provides an alternate string to use as the button's label if the image cannot be shown (due to error, a user agent that cannot or is configured not to show images, or if the user is using a screen reading devic...
... parent context, this behaves the same as _self. _top Loads the response into the top-level browsing context; this is the browsing context that is the topmost ancestor of the current context. If the current context is the topmost context, this behaves the same as _self. This attribute is also available on <input type="submit"> and <button> elements. height A number specifying the height, in CSS pixels, at which to draw the image specified by the src attribute. src A string specifying the URL of the image file to display to represent the graphical submit button. When the user interacts with the image, the input is handled like any other button input. width A number indicating the width at which to draw the image, in CSS pixels. Obsolete attributes The following attribute was define...
...maps instead usemap If usemap is specified, it must be the name of an image map element, <map>, that defines an image map to use with the image. This usage is obsolete; you should switch to using the <img> element when you want to use image maps. Using image inputs The <input type="image"> element is a replaced element (an element whose content isn't generated or directly managed by the CSS layer), behaving in much the same way as a regular <img> element, but with the capabilities of a submit button. Essential image input features Let's look at a basic example that includes all the essential features you'd need to use (These work exactly the same as they do on the <img> element.): <input id="image" type="image" width="100" height="30" alt="Login" src="/static/external/62/6...
...And 3 more matches
<tbody>: The Table Body element - HTML: Hypertext Markup Language
Web › HTML › Element › tbody
ent in the cell right, aligning the content to the right of the cell justify, inserting spaces into the textual content so that the content is justified in the cell char, aligning the textual content on a special character with a minimal offset, defined by the char and charoff attributes. If this attribute is not set, the left value is assumed. As this attribute is deprecated, use the CSS text-align property instead. Note: The equivalent text-align property for the align="char" is not implemented in any browsers yet. See the text-align's browser compatibility section for the <string> value. bgcolor The background color of the table. It is a 6-digit hexadecimal RGB code, prefixed by a '#'. One of the predefined color kewords can also be used. As this attribute is deprec...
...operty instead. Note: The equivalent text-align property for the align="char" is not implemented in any browsers yet. See the text-align's browser compatibility section for the <string> value. bgcolor The background color of the table. It is a 6-digit hexadecimal RGB code, prefixed by a '#'. One of the predefined color kewords can also be used. As this attribute is deprecated, use the CSS background-color property instead. char 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 is ignored. charoff This attribute is used to indicate the number of characters to offset the column data from the alignment...
...e baseline of the characters instead of the bottom of them. If characters are all of the size, this has the same effect as bottom. bottom, which will put the text as close to the bottom of the cell as it is possible; middle, which will center the text in the cell; and top, which will put the text as close to the top of the cell as it is possible. As this attribute is deprecated, use the CSS vertical-align property instead. Usage notes If the table includes a <thead> block (to semantically identify header rows), the <tbody> block must come after it. If you use <tbody>, you can't also have table rows (<tr> elements) which are direct children of the <table> but not included inside the <tbody>. All non-header and non-footer rows must be inside the <tbody> if one is used. When p...
...And 3 more matches
<th> - HTML: Hypertext Markup Language
Web › HTML › Element › th
char (with text only): The content is aligned to a character inside the <th> element with minimal offset. This character is defined by the char and charoff attributes. The default value when this attribute is not specified is left. Note: Do not use this attribute as it is obsolete in the latest standard. To achieve the same effect as the left, center, right or justify values, apply the CSS text-align property to the element. To achieve the same effect as the char value, give the text-align property the same value you would use for the char. Unimplemented in CSS3. axis Obsolete since HTML5 This attribute contains a list of space-separated strings. Each string is the id of a group of cells that this header applies to. Note: Do not use this attribute as it is obsolete in th...
...n = "#800000" navy = "#000080" red = "#FF0000" blue = "#0000FF" purple = "#800080" teal = "#008080" fuchsia = "#FF00FF" aqua = "#00FFFF" Note: Do not use this attribute, as it is non-standard and only implemented in some versions of Microsoft Internet Explorer: The <th> element should be styled using CSS. 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 same effec...
...e 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 same effect, you can specify the character as the first value of the text-align property, Unimplemented in CSS3. charoff Obsolete since HTML5 This attribute is used to shift column data to the right of the character specified by the char attribute. Its value specifies the length of this shift. Note: Do not use this attribute as it is obsolete in the latest standard. height Deprecated since HTML4, Obsolete since HTML5 This attribute is used to define a recommended cell height. Note: Do not use th...
...And 3 more matches
<u>: The Unarticulated Annotation (Underline) element - HTML: Hypertext Markup Language
Web › HTML › Element › u
The HTML Unarticulated Annotation 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 ...
...echnical terms, transliterations, thoughts, or names of vessels in Western texts To provide textual annotations (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. ...
...This is a common styling for spelling errors. Another common style can be presented using red dashed underline. ...
...And 3 more matches
Animation performance and frame rate - Web Performance
Animation on the web can be done via SVG, JavaScript, including <canvas> and WebGL, CSS animation, <video>, animated gifs and even animated PNGs and other image types. The performance cost of animating a CSS property can vary from one property to another, and animating expensive CSS properties can result in jank as the browser struggles to hit a smooth frame rate. For animated media, such as video and animated gifs, the main performance concern is file size - downloading the file size fast enough to not negatively impact performance is the greatest issue. Code based animations, be it CSS, SVG, <canvas>, webGL or other JavaScript animations, can cause performance issues even if the bandwidth footprint is small. These animations can consume CPU and/or cause jank. While performance is sensi...
... how we can use browser tools to inspect the frame rate. We'll also discuss some tips to create and maintain a fast and steady frame rate. The developer tool's frame rate and waterfall charts provide insight into the work the browser is performing to animate code. Using these tools you can measure an application's animation frame rate, and diagnose performance bottlenecks if any are found. With CSS animations you specify a number of keyframes, each of which uses CSS to define the appearance of the element at a particular stage of the animation. The browser creates the animation as a transition from each keyframe to the next. Compared with animating elements using JavaScript, CSS animations can be easier to create. They can also give better performance, as they give the browser more control...
...t at a particular stage of the animation. The browser creates the animation as a transition from each keyframe to the next. Compared with animating elements using JavaScript, CSS animations can be easier to create. They can also give better 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. ...
...And 3 more matches
Progressive web app structure - Progressive web apps (PWAs)
that makes the website experience better, but it's still perfectly usable without it. Responsive: Responsive web design also applies to progressive web apps, as both are mainly for mobile devices. There are so many varied devices with browsers -- it's important to prepare your website so it works on different screen sizes, viewports or pixel densities, using technologies like viewport meta tag, CSS media queries, Flexbox, and CSS Grid. Different concept: streams An entirely different approach to server- or client-side rendering can be achieved with the Streams API. With a little help from service workers, streams can greatly improve the way we parse content. The app shell model requires all the resources to be available before the website can start rendering. It's different with HTML, a...
...y available in 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 c...
... 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 href="http://js13kgame...
...And 3 more matches
Mobile first - Progressive web apps (PWAs)
<li><a href="#">Work</a></li> <li><a href="#">About</a></li> <li><a href="#">Contact</a></li> </ul> </nav> <header> <a id="top" href="#bottom">Jump to menu</a> <h1>My article</h1> </header> <div class="main"> <p>Lorem ipsum ... </p> <a id="bottom" href="#top">Back to top</a> </div> </article> <button id="install-btn">Install</button> Default mobile CSS For the CSS, I first added some styles into our app.css stylesheet to provide a reasonable narrow-screen layout. 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-capti...
...And it works in IE8+. display: table makes the <article> and its children display in a table layout, without abusing table markup. ...
... The second one sets the width of the content at 600px and centers it in the space available, then adds in a gradient and a nice background image for the wider l...
...And 3 more matches
Structural overview of progressive web apps - Progressive web apps (PWAs)
t makes the website experience better, but it's still perfectly usable without it. Responsive: Responsive web design also applies to progressive web apps, as both are mainly for mobile devices. There are so many varied devices with browsers -- it's important to prepare your website so it works on different screen sizes, viewports or pixel densities, using technologies like the viewport meta tag, CSS media queries, Flexbox, and CSS Grid. Another approach: Streams An entirely different approach to server- or client-side rendering can be achieved with the Streams API. With a little help from service workers, streams can greatly improve the way we parse content. The app shell model requires all the resources to be available before the website can start rendering. It's different with HTML, as...
...ported by any of the major 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 r...
... 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 href="http://js13kgame...
...And 3 more matches
SVG Presentation Attributes - SVG: Scalable Vector Graphics
SVG presentation attributes are CSS properties that can be used as attributes on SVG elements. alignment-baseline baseline-shift clip clip-path clip-rule color color-interpolation color-interpolation-filters color-profile color-rendering cursor direction display dominant-baseline enable-background fill fill-opacity fill-rule filter flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-orientation-horizontal glyph-orientation-vertical image-rendering kerning letter-spacing lighting-color marker-end marker-mid marker-start mask opacity overflow pointer-events shape-rendering solid-color solid-opacity stop-color stop-opacity stroke stroke-dasharray stroke-dashoffset stroke-li...
...uto|optimizeSpeed|optimizeQuality|inherit; Animatable: Yes cursor It specifies the mouse cursor displayed when the mouse pointer is over an element. Value: <FuncIRI>|<keywords>|inherit; Animatable: Yes direction It specifies the base writing direction of text. Value: ltr|rtl|inherit; Animatable: Yes display It allows to control the rendering of graphical or container elements. Value: see css display; Animatable: Yes dominant-baseline It defines the baseline used to align the box's text and inline-level contents. Value: auto|text-bottom|alphabetic|ideographic|middle|central| mathematical|hanging|text-top; Animatable: Yes enable-background Deprecated since SVG 2 It tells the browser how to manage the accumulation of the background image. Value: accumulate|new|inherit; Animatable:...
... defined through the <feFlood> or <feDropShadow> element. Value: <color>; Animatable: Yes flood-opacity It indicates the opacity value to use across the current filter primitive subregion defined through the <feFlood> or <feDropShadow> element. Value: <number>|<percentage>; Animatable: Yes font-family It indicates which font family will be used to render the text of the element. Value: see css font-family; Animatable: Yes font-size It specifies 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. Val...
...And 3 more matches
fill - SVG: Scalable Vector Graphics
Web › SVG › Attribute › fill
from="0" to="40" dur="5s" fill="freeze" /> </circle> </svg> altGlyph Warning: As of SVG2 <altGlyph> is deprecated and shouldn't be used. For <altGlyph>, fill is a presentation attribute that defines the color of the glyph. Value <paint> Default value black Animatable Yes Note: As a presentation attribute fill can be used as a CSS property. animate For <animate>, fill defines the final state of the animation. Value freeze (Keep the state of the last animation frame) | remove (Keep the state of the first animation frame) Default value remove Animatable No animateColor Warning: As of SVG Animation 2 <animateColor> is deprecated and shouldn't be used. Use <animate> instead. For ...
...e state of the last animation frame) | remove (Keep the state of the first animation frame) Default value remove Animatable No circle For <circle>, fill is a presentation attribute that defines the color of the circle. Value <paint> Default value black Animatable Yes Note: As a presentation attribute fill can be used as a CSS property. ellipse For <ellipse>, fill is a presentation attribute that defines the color of the ellipse. Value <paint> Default value black Animatable Yes Note: As a presentation attribute fill can be used as a CSS property. path For <path>, fill is a presentation attribute that defines the color of the interior of the shape. (Interior is define by t...
... Animatable Yes Note: As a presentation attribute fill can be used as a CSS property. path For <path>, fill is a presentation attribute that defines the color of the interior of the shape. (Interior is define by the fill-rule attribute) Value <paint> Default value black Animatable Yes Note: As a presentation attribute fill can be used as a CSS property. polygon For <polygon>, fill is a presentation attribute that defines the color of the interior of the shape. (Interior is define by the fill-rule attribute) Value <paint> Default value black Animatable Yes Note: As a presentation attribute fill can be used as a CSS property. polyline For <polyline>, fill is a presentation attribute that de...
...And 3 more matches
Customizing the download progress bar - Archive of obsolete content
ou can add a new stylesheet. ...
... stylesheet. ...
...nsion/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-specific directives, as we will see. ...
...And 2 more matches
Chapter 2: Technologies used in developing extensions - Archive of obsolete content
nologies widely used on the web. Its structure is similar to that of the dynamic HTML used on some web pages, or the HTML applications used on Windows. If you've had experience developing with dynamic HTML, you'll probably find it relatively easy to pick up the knowledge you'll need to develop Firefox extensions. The role of each technology Firefox is largely built using four technologies: XUL, CSS, JavaScript, and XPCOM. Extensions are also built using these four technologies. Figure 1: role of each technology in Firefox In addition to these technologies, extension development will require you to learn about how to confer privileges to overcome security restrictions on code that you write, and how to embed your code into the Firefox UI. These issues are discussed in Chapter 5. The mi...
...ge required In the interest of brevity, I will omit explanations of widely understood technologies, and focus instead on introducing new technologies you will need to understand in order to develop for Firefox. I will assume that you have experience developing with dynamic HTML, as well as the topics below. For more information on these technologies, please refer to other sources. XML coding CSS coding Basic JavaScript syntax XML: A text-based structural language Extensible Markup Language (XML) is a meta-language for expressing various kinds of data. It was specified in 1998 by W3C, the organization that sets standards for web-related technologies. It has a number of useful qualities: it is generic, extensible, and easy to validate as well-formed. Some examples of XML-based markup ...
...languages 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". 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, indica...
...And 2 more matches
Making it into a static overlay - Archive of obsolete content
hich 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. ...
... 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 element will be added as the last child of statusbar, usually before the resizer grippy. We could instead have used an insertafter attribute to place the element after another. To use this overlay instead of our changes to navigator.xul we need to remove our changes, then add a reference to the overlay to the top of navigator.xul: ... ...
...And 2 more matches
XUL Structure - Archive of obsolete content
me 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 are some featu...
...extension, unless reading files from the file system, but you should use the .xul extension for all XUL files. You can load XUL files from your own machine by opening them in the browser, or by double-clicking the file in your file manager. Remember that remote XUL will have significant restrictions on what it can do, and DOES NOT WORK WITH CURRENT FIREFOX VERSIONS! Document types: HTML XML XUL CSS Mozilla uses a distinctly different kind of document object (DOM) for HTML and XUL, although they share much of the same functionality. There are three main types of document in Mozilla: HTML, XML, and XUL. Naturally, the HTML document is used for HTML documents, the XUL document is used for XUL documents, and the XML document is used for other types of XML documents. Since XUL is also XML, the ...
...ssible to use many XUL features in HTML or XML documents since they aren't document type specific; however other features require the right kind of document. For instance, you can use the XUL layout types in other documents since they don't rely on the XUL document type to function. To summarize the points made above: Mozilla renders both HTML and XUL using the same underlying engine and uses CSS to specify their presentation. XUL may be loaded from a remote site, from the local file system, or installed as a package and accessed using a chrome URL. This last option is what browser extensions do. Chrome URLs may be used to access installed packages and open them with enhanced privileges. HTML, XML, and XUL each have a different document type. Some features may be used in any document t...
...And 2 more matches
Using the standard theme - Archive of obsolete content
he standard theme (the theme currently chosen by the user in the Theme Selector), or even the default theme delivered with your the base application. Applying the standard theme In order to use the theme currently chosen by the user of the base application (the so called "Global Skin"), you have to add the following line to your XUL file: <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> This imports the styles found in the <tt>global/skin</tt> chrome directory and will make the standard XUL widgets of your application use the selected chosen theme. You do not have to specify a specific file; Mozilla will determine by its own which files in the directory it needs to use. If you are only going to use these global style sheets, you of course do not need a <tt>skin</tt> director...
...in in the <tt>chrome.manifest</tt>. Note that you can also mix these two approaches, although it makes your code more readable when sticking to only one way. ...
...these two approaches, although it makes your code more readable when sticking to only one way. ...
...And 2 more matches
XUL accessibility guidelines - Archive of obsolete content
ns By default, toolbar buttons cannot receive focus with a keyboard. The recommended way of fixing this is that all functionality associated with a toolbar be duplicated elsewhere in the application, such as in a menu item or context menu. In cases where duplication of functionality is not possible (such as a window without a menu bar), toolbar buttons can be made focusable by adding the special CSS rule -moz-user-focus: normal. (Firefox's "Print Preview" window uses this fallback technique.) This should only be used as a last resort, and it should be consistent throughout a window (that is either all toolbar buttons are tabbable or none of them are). Keyboard shortcuts Keyboard shortcuts are very useful to users needing keyboard access. There are many ways to provide keyboard shortcuts. T...
...ionality associated with mouse events such as onmouseover, onmousemove, and ondrag can only be activated with the use of the mouse. Provide keyboard-accessible alternative access points for this functionality. Consider using context menu items or other XUL elements along with keyboard shortcuts. Scrolling Ensure that scrolling is keyboard accessible. Many XUL elements can be set to scroll using CSS. Other elements, such as arrowscrollbox 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 elemen...
...use} keep until {pause} they expire {pause} one of three {pause} combobox." If the screen reader only read the label, then the user would have to guess what the "exceptions" button or the "keep until" combobox was referring to. Groupboxes are essential for radiogroups or groups of checkboxes with a similar theme (e.g. check all that apply). If you find nested groupboxes visually unappealing, use CSS to hide the border of the inner groupbox so that it can remain in the code to benefit users of assistive technologies. Complex forms sometimes require a more advanced labeling system than is possible with the standard XUL attributes. For example, the first item in the privacy panel in the Firefox option dialog (discussed and shown above) is [checkbox] Remember visited pages for the last [textbox...
...And 2 more matches
treecol - Archive of obsolete content
e 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 style MUST come before treechildren::-moz-tree-checkbox(checked) otherwise it won't take effect. */ list-style-image: none; } treechildren::-moz-tree-checkbox(checked){ /* css for checked cells. cbox-check.gif isn't available in Firefox 1, 2, and 3 on 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"); } For example: Create a CSS file. Copy and paste the code above and link the CSS file to your XUL file. Reload the page to see the checkbox. If you want...
...sn't available in Firefox 1, 2, and 3 on 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"); } For example: Create a CSS file. Copy and paste the code above and link the CSS file to your XUL file. Reload the page to see the checkbox. If you want, you can also style the tree using CSS. 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 it...
...n its left side. right The text will be cropped on its right side. center The text will be cropped in the middle, showing both the start and end of the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can a...
...And 2 more matches
Theme changes in Firefox 3.5 - Archive of obsolete content
Draft This page is not complete. This article covers the changes that need to be made to update a Firefox theme to work properly in Firefox 3.5. Core, browser and toolkit changes requiring theme updates There are a number of changes in the browser that may require you to make changes to your theme. ...
...If your theme uses native checkboxes or radiobuttons (-moz-appearance: radio / checkbox), this can result in distorted controls. You might have to set the width and height of .checkbox-check and .radio-check to 16px to avoid that problem. ...
...ripper> element was removed from the scrollbar thumb button by bug 448704. For the Windows and Linux native default themes, the gripper is now drawn as a part of the background of the scrollbar thumb widget. Third-party themes can still draw a gripper for the scrollbar thumb button by applying a centered background image to the scrollbar's thumb button. global/checkbox.css, global/radio.css Since bug 394892, radio buttons and checkboxes no longer have a minimum size on Mac OS X. If your theme uses native checkboxes or radiobuttons (-moz-appearance: radio / checkbox), this can result in distorted controls. You might have to set the width and height of .checkbox-check and .radio-check to 16px to avoid that problem. Look at the patch to see what was changed for Pinstripe. ...
...And 2 more matches
Theme changes in Firefox 4 - Archive of obsolete content
iimized, some zip utilities don't work with it. Controlling the actual icon size used by add-on toolbar buttons The iconsize attribute of the browser's toolbar elements now has a different default value on each toolbar independently. The value does not necessarily reflect the user preference in the toolbar customization palette anymore. The theme can now override the value by setting a special CSS property on the toolbar. The iconsize attribute of the toolbox 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 ...
...ce. Bookmarks toolbar #PersonalToolbar small Tab bar #TabsToolbar small Add-on bar #addon-bar small Custom toolbars Some other value small or large depending on user preference. ...
...lbar small Tab bar #TabsToolbar small Add-on bar #addon-bar small Custom toolbars Some other value small or large depending on user preference. Overriding the default values Themes can override the value of the iconsize attribute on each toolbar by specifying a special value for the counter-reset CSS property on the toolbar itself. ...
...And 2 more matches
:-moz-system-metric() - Archive of obsolete content
ated because a user created a sub-page to this page. Note: Since Firefox 58, this pseudo-class is no longer available to web content -- it is only available internally (e.g. to XUL / chrome code). See bug 1396066 for more details. ...
... CSS pseudo-class matches an element if the computer's user interface supports images in menus.:-moz-system-metric(mac-graphite-theme):-moz-system-metric(mac-graphite-theme) will match an element if the user has chosen the "Graphite" appearance in the "Appearance" prefpane of the Mac OS X System Preferences.:-moz-system-metric(scrollbar-end-backward)The :-moz-system-metric(scrollbar-end-backward) CSS pseudo-class will match an element if the computer's user interface includes a backward arrow button at the end of scrollbars.:-moz-system-metric(scrollbar-end-forward)The :-moz-system-metric(scrollbar-end-forward) CSS pseudo-class will match an element if the computer's user interface includes a forward arrow button at the end of scrollbars.:-moz-system-metric(scrollbar-start-backward)The :-moz-...
...he computer's user interface includes a backward arrow button at the end of scrollbars.:-moz-system-metric(scrollbar-end-forward)The :-moz-system-metric(scrollbar-end-forward) CSS pseudo-class will match an element if the computer's user interface includes a forward arrow button at the end of scrollbars.:-moz-system-metric(scrollbar-start-backward)The :-moz-system-metric(scrollbar-start-backward) CSS pseudo-class will match an element if the computer's user interface includes a backward arrow button at the start of scrollbars.:-moz-system-metric(scrollbar-start-forward)The :-moz-system-metric(scrollbar-start-forward) CSS pseudo-class will match an element if the computer's user interface includes a forward arrow button at the start of scrollbars.:-moz-system-metric(scrollbar-thumb-proportiona...
...And 2 more matches
XForms Custom Controls - Archive of obsolete content
rms controls like input, output, trigger, etc. We will also show you how to create custom controls that work with the XForms model and are automatically updated just like XForms controls. The purpose of this article is to give you enough background information so that you'll be able to get a good start. To really grasp the following information, a good understanding of XForms, XBL, JavaScript and CSS is needed. XPCOM knowledge will certainly not hurt. But even if you are only comfortable with a couple of these technologies, we hope that the possibilities outlined below will inspire you to learn more where you need to. Implementation Status The framework we use in the Mozilla XForms processor is very much a "work in progress". Please keep in mind that just about everything we mention here may ...
...the appearance attribute can be used to influence the look and feel of a control even when all other conditions remain constant. For example, in the Mozilla XForms extension we will render a combobox widget when appearance='minimal' on a select1 control. Should the form author instead choose to use appearance='compact' on this control, we would render a listbox widget. Here is a snippet from our .css file to show the type of CSS rule we would use to make such a determination. xf|select1[appearance="compact"] { -moz-binding: url('chrome://xforms/content/select-xhtml.xml#xformswidget-select1-compact'); } The mediatype attribute can be used by the form author to align the type of presentation with the type of data that the bound instance node contains. For example, if mediatype='image/*' then...
...Forms implementation and its URI is http://www.mozilla.org/projects/xforms/2005/type. For example, if a control is bound to a node of type xsd:integer then the typelist attribute will be "http://www.w3.org/2001/XMLSchema#integer http://www.w3.org/2001/XMLSchema#decimal". This is because xsd:integer is inherited from the xsd:decimal data type. We recommend that you use this attribute to create the CSS binding rule for your custom control. This will allow you to bind your custom control for the data type that you are targeting AND any type derived from that target type. So if you want an input bound to an instance node of type integer (and all types derived from integer), you would use: @namespace xf url(http://www.w3.org/2002/xforms); @namespace mozType url(http://www.mozilla.org/projects/xfor...
...And 2 more matches
XForms Styling - Archive of obsolete content
Processors such as Chiba create "old-style" HTML forms from XForms documents, and must be styled accordingly. ...
...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. ...
...ce after processing of your XForms document, and map the old styles to the new elements. ...
...And 2 more matches
MDN Web Docs Glossary: Definitions of Web-related terms
PN API Apple Safari Application Context Argument ARIA ARPA Arpanet Array ASCII Asynchronous ATAG Attribute B Bandwidth Base64 Baseline beacon Bezier curve BiDi BigInt Blink Block Block (CSS) Block (scripting) Block cipher mode of operation Boolean Boot2Gecko Bootstrap Bounding Box Breadcrumb Brotli Browser Browsing context buffer C Cache Cacheable CalDAV Call stack Callback function Canonical order Canvas ...
...nstructor Continuous Media Control flow Cookie Copyleft CORS CORS-safelisted request header CORS-safelisted response header Crawler CRLF Cross Axis Cross-site scripting CRUD Cryptanalysis Cryptographic hash function Cryptography CSP CSRF CSS CSS Object Model (CSSOM) CSS pixel CSS preprocessor D Data structure Decryption Delta Denial of Service Descriptor (CSS) Deserialization Developer Tools DHTML Digest Digital certificate Distributed Denial of Service DMZ DNS Doctyp...
...d LGPL Ligature Local scope Local variable Locale Localization Long task Loop Lossless compression lossy compression LTR (Left To Right) M Main Axis Main thread markup MathML Media Media (Audio-visual presentation) Media (CSS) Metadata Method Microsoft Edge Microsoft Internet Explorer Middleware mime MIME type minification MitM Mixin Mobile First Modem Modern web apps Modularity Mozilla Firefox Mutable MVC N Namespace NaN NAT...
...And 2 more matches
Assessment: Accessibility troubleshooting - Learn web development
Previous Overview: Accessibility In the assessment for this module, we present to you a simple site with a number of accessibility issues that you need to diagnose and fix. Prerequisites: Basic computer literacy, a basic understanding of HTML, CSS, and JavaScript, an understanding of the previous articles in the course. Objective: To test basic knowledge of accessibility fundamentals. Starting point To get this assessment started, you should go and grab the ZIP 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 o...
...s assessment started, you should go and grab the ZIP 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 probl...
...port on what happens when 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 alternati...
...And 2 more matches
Type, class, and ID selectors - Learn web development
Previous Overview: Building blocks Next In this lesson we will take a look at the simplest selectors that are available, which you will probably use the most in your work. 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 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 there...
... 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). ...
...e to add a class to the element rather than use an ID, however if using the ID is the only way to target the element -- perhaps because you do not have access to the markup and so cannot edit it -- this will work. In the next article We'll continue exploring selectors by looking at attribute selectors. ...
...And 2 more matches
Normal Flow - Learn web development
And, as we began to discover, you can change how elements behave either by adjusting their position in that normal flow, or removing them from it altogether. ...
...And, as we began to discover, you can change how elements behave either by adjusting their position in that normal flow, or removing them from it altogether. ...
...And, as we began to discover, you can change how elements behave either by adjusting their position in that normal flow, or removing them from it altogether. ...
...And 2 more matches
How can we design for all types of users? - Learn web development
which exceeds the minimum standard (4.5:1) and should enable many visually-impaired people to read this page. Font size You can specify font size on a website either through relative units or absolute units. Absolute units Absolute units are not proportionally calculated but refer to a size set in stone, so to speak, and are expressed most of the time in pixels (px). For instance, if in your CSS you declare this: body { font-size:16px; } ... you are telling the browser that whatever happens, the font size must be 16 pixels. Modern browsers get around this rule by pretending that you're asking for "16 pixels when the user sets a zoom factor of 100%". Yet, for many years Internet Explorer adamantly displayed 16 pixels as 16 pixels. In this case, zooming did nothing, even as late as Inte...
... find a span with the subheading class, it too must be rendered at the default font size (usually 16px). ...
...f the body, thus 32 pixels */ span.subheading { font-size:0.5em; } /* half the size of the h1, thus 16 pixels to come back to the original size */ As you can see, the math quickly gets daunting when you have to keep track of the parent, the parent's parent, the parent's parent's parent, and so on. ...
...And 2 more matches
Common questions - Learn web development
How the Web works This section covers Web mechanics --questions relating to general knowledge of the Web ecosystem and how it works. How does the Internet work? The Internet is the backbone of the Web, the technical infrastructure that makes the Web possible. ...
... your costs may go through the roof. In this article we discuss how much everything costs and what you get for what you pay (or don't pay). What text editors are available? In this article we highlight some things to think about when choosing and installing a text editor for Web development. What are browser developer tools? Every browser features a set of devtools for debugging HTML, CSS, and other Web code. This article explains how to use the basic functions of your browser's devtools. How do you make sure your website works properly? So you've published your website online -- very good! But are you sure it works properly? This article provides some basic troubleshooting steps. How do you set up a local testing server? This article explains how to set up a simpl...
...b accessibility. How can we design for all types of users? This article provides basic techniques to help you design websites for any kind of user -- quick accessibility wins, and other such things. ...
...And 2 more matches
JavaScript basics - Learn web development
se-driven 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 s...
...pects of the core language, and offers an opportunity to play with a few browser API features too. Have fun! A Hello world! example JavaScript is one of the most popular modern web technologies! As your JavaScript skills grow, your websites will enter a new dimension of power and creativity. However, getting comfortable with JavaScript is more challenging than getting comfortable with HTML and CSS. You may have to start small, and progress gradually. To begin, let's examine how to add JavaScript to your page for creating a Hello world! example. (Hello world! is the standard for introductory programming examples.) Important: If you haven't been following along with the rest of our course, download this example code and use it as a starting point. Go to your test site and create a new ...
...ur course, download this example code and use it as a starting point. Go to your test site and create a new folder named scripts. Within the scripts folder, create a new file called main.js, and save it. In your index.html file, enter this code on a new line, just before the closing </body> tag: <script src="scripts/main.js"></script> This is doing the same job as the <link> element for CSS. It applies the JavaScript to the page, so it can have an effect on the HTML (along with the CSS, and anything else on the page). Add this code to the main.js file: const myHeading = document.querySelector('h1'); myHeading.textContent = 'Hello world!'; Make sure the HTML and JavaScript files are saved. Then load index.html in your browser. You should see something like this: Note: The re...
...And 2 more matches
The web and web standards - Learn web development
's a very simple summary of what happened, but I did promise you a brief summary. One last significant data point to share is that in 1994, TimBL founded the World Wide Web Consortium (W3C), an organization that brings together representatives from many different technology companies to work together on the creation of web technology specifications. After that other technologies followed such as CSS and JavaScript, and the web started to look more like the web we know today. Web standards Web standards are the technologies we use to build web sites. These standards exist as long technical documents called specifications, which detail exactly how the technology should work. These documents are not very useful for learning how to use the technologies they describe (this is why we have sites ...
...to communicate with web servers (where web sites are stored). A typical conversation goes something like "Hello web server. Can you give me the files I need to render bbc.co.uk"? "Sure thing web browser -- here you go" [Downloads files and renders web page] The actual syntax for HTTP messages (called requests and responses) is not that human-readable, but this gives you the basic idea. HTML, CSS, and JavaScript HTML, CSS, and JavaScript are the main three technologies you'll use to build a website: Hypertext markup language, or HTML, is a markup language consisting of different elements 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="ca...
...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 look nice. ...
...And 2 more matches
Using data attributes - Learn web development
the part of the attribute name after data- (note that dashes are converted to camelCase). const article = document.querySelector('#electric-cars'); article.dataset.columns // "3" article.dataset.indexNumber // "12314" article.dataset.parent // "cars" Each property is a string and can be read and written. In the above case setting article.dataset.columns = 5 would change that attribute to "5". ...
...ticle = document.querySelector('#electric-cars'); article.dataset.columns // "3" article.dataset.indexNumber // "12314" article.dataset.parent // "cars" Each property is a string and can be read and written. In the above case setting 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. ...
....dataset.indexNumber // "12314" article.dataset.parent // "cars" Each property is a string and can be read and written. In the above case setting 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 ...
...And 2 more matches
HTML table advanced features and accessibility - Learn web development
more structural definition. One clear way to do this is by using <thead>, <tfoot>, and <tbody>, which allow you to mark up a header, footer, and body section for the table. These elements don't make the table any more accessible to screenreader users, and don't result in any visual enhancement on their own. They are however very useful for styling and layout -- acting as useful hooks for adding CSS to your table. To give you some interesting examples, in the case of a long table you could make the table header and footer repeat on every printed page, and you could make the table body display on a single page and have the contents available by scrolling up and down. To use them: The <thead> element must wrap the part of the table that is the header -- this is usually the first row contai...
...our browser developer tools -- you will see that the browser has added this tag for you. You might wonder why you ought to bother including it at all -- you should, because it gives you more control over your table structure and styling. Active learning: Adding table structure Let's put these new elements into action. First of all, make a local copy of spending-record.html and minimal-table.css in a new folder. Try opening it in a browser -- You'll see that it looks OK, but it could stand to be improved. The "SUM" row that contains a summation of the spent amounts seems to be in the wrong place, and there are some details missing from the code. Put the obvious headers row inside a <thead> element, the "SUM" row inside a <tfoot> element, and the rest of the content inside a <tbody> ele...
...ave and refresh, and you'll see that adding the <tfoot> element has 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 sa...
...And 2 more matches
Video and Audio APIs - Learn web development
, but it does have advantages. One big issue with the native browser controls is that they are different in each browser -- not very good for cross-browser support! Another big issue is that the native controls in most browsers aren't very keyboard-accessible. You can solve both these problems by hiding the native controls (by removing the controls attribute), and programming your own with HTML, CSS, and JavaScript. In the next section we'll look at the basic tools we have available to do this. The HTMLMediaElement API Part of the HTML5 spec, the HTMLMediaElement API provides features to allow you to control video and audio players programmatically -- for example HTMLMediaElement.play(), HTMLMediaElement.pause(), etc. This interface is available to both <audio> and <video> elements, as the...
...will report the elapsed time when the video is playing. Just for fun, we are providing two reporting mechanisms -- a <span> containing the elapsed time in minutes and seconds, and an extra <div> that we will use to create a horizontal indicator bar that gets longer as the time elapses. To get an idea of what the finished product will look like, check out our finished version. Exploring the CSS Now open the CSS file and have a look inside. The CSS for the example is not too complicated, but we'll highlight the most interesting bits here. First of all, notice the .controls styling: .controls { visibility: hidden; opacity: 0.5; width: 400px; border-radius: 10px; position: absolute; bottom: 20px; left: 50%; margin-left: -200px; background-color: black; box-shadow: 3px...
...This is an icon font -- all the characters of the alphabet equate to common icons you might want to use in an application. Next we use generated content to display an icon on each button: We use the ::before selector to display the content before each <button> element. We use the content property to set the content to be displayed in eac...
...And 2 more matches
Client-Server Overview - Learn web development
404 Not Found" if the resource cannot be found, "403 Forbidden" if the user isn't authorised to see the resource, etc). The body of a successful response to a GET request would contain the requested resource. When an HTML page is returned it is rendered by the web browser. As part of processing the browser may discover links to other resources (e.g. an HTML page usually references JavaScript and CSS pages), and will send separate HTTP Requests to download these files. Both static and dynamic websites (discussed in the following sections) use exactly the same communication protocol/patterns. GET request/response example You can make a simple GET request by clicking on a link or searching on a site (like a search engine homepage). For example, the HTTP request that is sent when you perform ...
...! The request Each line of the request contains information about it. ...
...1lu21b1t136rhbv7ezngie; csrftoken=zIPUJsAZv6pcgCBJSCj1zU6pQZbfMUAT; dwf_section_edit=False; dwf_sg_task_completion=False; _gat=1; _ga=GA1.2.1688886003.1471911953; ffo=true The first and second lines contain most of the information we talked about above: The type of request (GET). The target resource URL (/search). The URL parameters (q=client%2Bserver%2Boverview&topic=apps&topic=html&topic=css&topic=js&topic=api&topic=webdev). The target/host website (developer.mozilla.org). The end of the first line also includes a short string identifying the specific protocol version (HTTP/1.1). The final line contains information about the client-side cookies -- you can see in this case the cookie includes an id for managing sessions (Cookie: sessionid=6ynxs23n521lu21b1t136rhbv7ezngie; ...). T...
...And 2 more matches
Starting our Svelte Todo list app - Learn web development
hich 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 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. Objective: To learn how to create a Svelte component, render it inside another component, pass data into it using props, and save its state. Code along with us Git Clone the github repo (if you haven't already don...
... <span>All</span> <span 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 fo...
...ttps://udn.realityripple.com/samples/b0/98dase3c7d.png"> Note: With VSCode you can automatically add this ignore comment by clicking on the Quick fix... link or pressing Ctrl + +. If you want to globally disable this warning you can add this onwarn handler to your rollup.config.js file inside the configuration for the Svelte plugin, like this: plugins: [ svelte({ dev: !production, css: css => { css.write('public/build/bundle.css'); }, // Warnings are normally passed straight to Rollup. You can // optionally handle them here, for example to squelch // warnings with a particular code onwarn: (warning, handler) => { // e.g. I don't care about screen readers -> please DON'T DO THIS!!! if (warning.code === 'a11y-missing-attribute') return; ...
...And 2 more matches
Introduction to cross browser testing - Learn web development
Objective: To gain an understanding of the high-level concepts involved in cross browser testing. What is cross browser testing? Cross browser testing is the practice of making sure that the web sites and web apps you create work across an acceptable number of web browsers. As a web developer, it is your responsibility to make sure that not only do y...
...bility to make sure that not only do your projects work, but they work for all your users, no matter what browser, device, or additional assistive tools they are using. You need to think about: Different browsers other than the one or two that you use regularly on your devices, including slightly older browsers that some people might still be using, which don't support all the latest, shiniest CSS and JavaScript features. Different devices with different capabilities, from the latest greatest tablets and smartphones, through smart TVs, right down to cheap tablets and even older feature phones that may run browsers with limited capabilities. People with disabilities, who use the Web with the aid of assistive technologies like screenreaders, or don't use a mouse (some people use only the k...
...coding later in the module too. Why do cross browser issues occur? There are many different reasons why cross browser issues occur, and note that here we are talking about issues where things behave different across different browsers / devices / browsing preferences. Before you even get to cross browser issues, you should have already fixed out bugs in your code (see Debugging HTML, Debugging CSS, and What went wrong? Troubleshooting JavaScript from previous topics to refresh your memory if needed). Cross browser issues commonly occur because: sometimes browsers have bugs, or implement features differently. This situation is a lot less bad than it used to be; back when IE4 and Netscape 4 were competing to be the dominant browser in the 1990s, browser companies deliberately implemented...
...And 2 more matches
Using the viewport meta tag to control layout on mobile browsers
wsers in A Tale of Two Viewports at quirksmode.org. Viewport basics A typical mobile-optimized site contains something like the following: <meta name="viewport" content="width=device-width, initial-scale=1"> The width property controls the size of the viewport. It can be set to a specific number of pixels like width=600 or to the special value device-width, which is the width of the screen in CSS pixels at a scale of 100%. (There are corresponding height and device-height values, which may be useful for pages with elements that change size or position based on the viewport height.) The initial-scale property controls the zoom level when the page is first loaded. The maximum-scale, minimum-scale, and user-scalable properties control how users are allowed to zoom the page in or out. Usag...
...ixel is not a pixel In recent years, screen resolutions have risen to the size that individual pixels are hard to distinguish with the human eye. For example, recent smartphones generally have a 5-inch screens with resolutions upwards of 1920--1080 pixels (~400 dpi). Because of this, many browsers can display their pages in a smaller physical size by translating multiple hardware pixels for each CSS "pixel". Initially this caused usability and readability problems on many touch-optimized web sites. Peter-Paul Koch wrote about this problem in A pixel is not a pixel. On high dpi screens, pages with initial-scale=1 will effectively be zoomed by browsers. Their text will be smooth and crisp, but their bitmap images will probably not take advantage of the full screen resolution. To get sharper i...
...not a pixel. On high dpi screens, pages with initial-scale=1 will effectively be zoomed by browsers. Their text will be smooth and crisp, but their bitmap images will probably not take advantage of the full screen resolution. To get sharper images on these screens, web developers may want to design images - or whole layouts - at a higher scale than their final size and then scale them down using CSS or viewport properties. This is consistent with the CSS 2.1 specification, which says: If the pixel density of the output device is very different from that of a typical computer display, the user agent should rescale pixel values. It is recommended that the pixel unit refer to the whole number of device pixels that best approximates the reference pixel. It is recommended that the reference pix...
...And 2 more matches
Scroll-linked effects
ition, for example updating a positioning property with the aim of producing a parallax scrolling effect. This article discusses scroll-linked effects, their effect on performance, related tools, and possible mitigation techniques. Scrolling effects explained Often scrolling effects are implemented by listening for the scroll event and then updating elements on the page in some way (usually the CSS position or transform property.) You can find a sampling of such effects at CSS Scroll API: Use Cases. These effects work well in browsers where the scrolling is done synchronously on the browser's main thread. However, most browsers now support some sort of asynchronous scrolling in order to provide a consistent 60 frames per second experience to the user. In the asynchronous scrolling model, t...
...ng, the event handler will be delayed relative 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 implementati...
...ithin 200 pixels of the top of the "snaptarget" div. If it is, then it triggers an animation to "snap" the scroll position to the top of the div. As this animation is driven by JavaScript on the browser's main thread, it can be interrupted by other JavaScript running in other tabs or other windows. Therefore, the animation can end up looking janky and not as smooth as intended. Instead, using the CSS snap-points property will allow the browser to run the animation asynchronously, providing a smooth visual effect to the user. <body style="height: 5000px"> <style> body, /* blink currently has bug that requires declaration on `body` */ html { scroll-snap-type: y proximity; } .snaptarget { scroll-snap-align: start; position: relative; top: 200px; he...
...And 2 more matches
All keyboard shortcuts - Firefox Developer Tools
shortcuts work when the breadcrumbs bar is focused. ...
...bar is focused. ...
... Move to the previous element in the breadcrumbs bar Left arrow Left arrow Left arrow Move to the next element in the breadcrumbs bar Right arrow Right arrow Right arrow Focus the HTML pane Shift + Tab Shift + Tab Shift + Tab Focus the CSS pane Tab Tab Tab CSS pane These shortcuts work when you're in the Inspector's CSS pane. ...
...And 2 more matches
How to - Firefox Developer Tools
Links for various HOW TO's can be found here. These links describe in depth the HOW TO techniques. ...
... Links for various HOW TO's can be found here. These links describe in depth the HOW TO techniques. ...
... Links for various HOW TO's can be found here. These links describe in depth the HOW TO techniques. ...
...And 2 more matches
Page inspector keyboard shortcuts - Firefox Developer Tools
shortcuts work when the breadcrumbs bar is focused. ...
...bar is focused. ...
... Move to the previous element in the breadcrumbs bar Left arrow Left arrow Left arrow Move to the next element in the breadcrumbs bar Right arrow Right arrow Right arrow Focus the HTML pane Shift + Tab Shift + Tab Shift + Tab Focus the CSS pane Tab Tab Tab CSS pane These shortcuts work when you're in the Inspector's CSS pane. ...
...And 2 more matches
UI Tour - Firefox Developer Tools
It links to various how to guides for the details of how to work with the Inspector. Select element button The Inspector gives you detailed information about the currently selected element. ...
...bar, so it's immediately accessible from any tool, not just the Inspector. To learn how to select an element, see the guide to selecting an element. HTML pane The Inspector is split into two or three sections, depending on your settings. You can toggle the 3-pane view of the Inspector. The following image shows the 2-pane layout: In 2-pane mode, the Inspector includes the HTML Pane, and the CSS Pane, which can contain one of six tools: Rules view Layout view Computed view Changes view Compatibility view (Firefox Developer Edition 77 and later) Fonts view Animations view The following image shows the 3-pane mode (available from Firefox 62 onwards) which moves the CSS Rules view into a separate pane in the center of the Inspector. The following image shows 3-pane mode: As yo...
...n contain one of six tools: Rules view Layout view Computed view Changes view Compatibility view (Firefox Developer Edition 77 and later) Fonts view Animations view The following image shows the 3-pane mode (available from Firefox 62 onwards) which moves the CSS Rules view into a separate pane in the center of the Inspector. The following image shows 3-pane mode: As you can see, the CSS pane has moved into the center of the Inspector. To learn more about the structure of the HTML pane, see the guide to examining and editing HTML. Rules view The Rules view lists all the rules that apply to the selected element, ordered from most-specific to least-specific. See above. See Examine and edit CSS for more details. Layout view The Layout view displays the box model of the page. ...
...And 2 more matches
Page Inspector - Firefox Developer Tools
Use the Page Inspector to examine and modify the HTML and CSS of a page. You can examine pages loaded in the local copy of Firefox or in a remote target such as Firefox for Android. See remote debugging to learn how to connect the developer tools to a remote target. User Interface Tour To find your way around the Inspector, here's a quick tour of the UI. You can split the Rules view out into its own pane, separate from the other tabs on the CSS pane -- this is called 3-pane mode. How to To find out what you can do with the Inspector, see the following how to guides: Open the Inspector Examine and edit HTML Examine and edit the box model Inspect and select colors Reposition elements in the page Edit fonts Visualize transforms Use the Inspector API Select an element Examin...
... separate from the other tabs on the CSS pane -- this is called 3-pane mode. ...
...called 3-pane mode. ...
...And 2 more matches
Waterfall - Firefox Developer Tools
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 "reflow". Paint Drawing pixels to the screen. Garbage Collection Garbage colle...
...e performance problems. 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...
...s sequence needs to fit into a single frame, since the screen isn't updated until it is complete. It's commonly accepted that 60 frames per second 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. Importantly for responsiveness, the browser doesn't always have to go through every step: CSS animations update the page without having to run any JavaScript. Not all CSS property changes cause a reflow. Changing properties that can alter an object's geometry and position, such as width, display, font-size, or top, will cause a reflow. However, changing properties that don't alter geometry or position, such as color or opacity, will not. Not all CSS property changes cause a repaint. In ...
...And 2 more matches
FontFace - Web APIs
Web › API › FontFace
ontrol of the source of the font face, being a URL to an external resource, or a buffer; it also allows control of when the font face is loaded and its current status. Constructor FontFace() Constructs and returns a new FontFace object, built from an external resource described by an URL or from an ArrayBuffer. Properties This interface doesn't inherit any property. FontFace.display A CSSOMString that determines how a font face is displayed based on whether and when it is downloaded and ready to use. FontFace.family A CSSOMString that retrieves or sets the family of the font. It is equivalent to the font-family descriptor. FontFace.featureSettings A CSSOMString that retrieves or sets infrequently used font features that are not available from a font's variant properties. It is...
...to the font-feature-settings descriptor. FontFace.loaded Read only Returns a Promise that resolves with the current 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. Font...
...It is equivalent to the font-weight descriptor. Methods This interface doesn't inherit any method. ...
...And 2 more matches
GlobalEventHandlers.onanimationcancel - Web APIs
The onanimationcancel property of the GlobalEventHandlers mixin is the EventHandler for processing animationcancel events. An animationcancel event is sent when a CSS animation unexpectedly aborts, that is, any time it stops running without sending an animationend event. This can happen, for example, when the animation-name is changed such that the animation is removed, or when the animating node is hidden--either directly or because any of its containing nodes are hidden--using CSS. ...
...his can happen, for example, when the animation-name is changed such that the animation is removed, or when the animating node is hidden--either directly or because any of its containing nodes are hidden--using CSS. Syntax var animCancelHandler = target.onanimationcancel; target.onanimationcancel = Function Value A Function to be called when an animationcancel event occurs indicating that a CSS animation has begun on the target, where the target object is an HTML element (HTMLElement), document (Document), or window (Window). The function receives as input a single parameter: an AnimationEvent object describing the event which occurred. Example HTML <div class="main"> <div id="box" onanimationcancel="handleCancelEvent(event);"> <div id="text">Box</div> </div> </div> <div cla...
...ement (HTMLElement), document (Document), or window (Window). The function receives as input a single parameter: an AnimationEvent object describing the event which occurred. ...
...And 2 more matches
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. ...
...And 2 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 2 more matches
ValidityState - Web APIs
d input that the browser is unable to convert. customError Read only A Boolean indicating whether the element's custom validity message has been set to a non-empty string by calling the element's setCustomValidity() method. patternMismatch Read only A Boolean that is true if the value does not match the specified pattern, and false if it does match. If true, the element matches the :invalid CSS pseudo-class. rangeOverflow Read only A Boolean that is true if the value is greater than the maximum specified by the max attribute, or false if it is less than or equal to the maximum. If true, the element matches the :invalid and :out-of-range and CSS pseudo-classes. rangeUnderflow Read only A Boolean that is true if the value is less than the minimum specified by the min attribute, or f...
...ied by the max attribute, or false if it is less than or equal to the maximum. If true, the element matches the :invalid and :out-of-range and CSS pseudo-classes. rangeUnderflow Read only A Boolean that is true if the value is less than the minimum specified by the min attribute, or false if it is greater than or equal to the minimum. If true, the element matches the :invalid and :out-of-range CSS pseudo-classes. stepMismatch Read only A Boolean that is true if the value does not fit the rules determined by the step attribute (that is, it's not evenly divisible by the step value), or false if it does fit the step rule. If true, the element matches the :invalid and :out-of-range CSS pseudo-classes. tooLong Read only A Boolean that is true if the value exceeds the specified maxlength f...
...classes. tooLong Read only A Boolean that is true if the value exceeds the specified maxlength for HTMLInputElement or HTMLTextAreaElement objects, or false if its length is less than or equal to the maximum length. Note: This property is never true in Gecko, because elements' values are prevented from being longer than maxlength. If true, the element matches the the :invalid and :out-of-range CSS pseudo-classes. tooShort Read only A Boolean that is true if the value fails to meet the specified minlength for HTMLInputElement or HTMLTextAreaElement objects, or false if its length is greater than or equal to the minimum length. If true, the element matches the :invalid and :out-of-range CSS pseudo-classes. typeMismatch Read only A Boolean that is true if the value is not in the require...
...And 2 more matches
Window.getDefaultComputedStyle() - Web APIs
The object is of the same type as the object returned by Window.getComputedStyle(), but only takes into account user-agent and user rules. ...
... 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. Example Simple example var elem1 = document.getElementById("elemId"); var style = window.getDefaultComputedStyle(elem1); Longer example <style> #elem-container { position: absolute; left: 100px; top: 200px; height...
...les. Example Simple example var elem1 = document.getElementById("elemId"); var style = window.getDefaultComputedStyle(elem1); Longer example <style> #elem-container { position: absolute; left: 100px; top: 200px; height: 100px; } </style> <div id="elem-container">dummy</div> <div id="output"></div> <script> var elem = document.getElementById("elem-container"); var theCSSprop = window.getDefaultComputedStyle(elem).position; document.getElementById("output").innerHTML = theCSSprop; // Will output "static" </script> Use with pseudo-elements The getDefaultComputedStyle() method can pull style info from pseudo-elements (e.g., ::before or ::after). <style> h3:after { content: ' rocks!'; } </style> <h3>generated content</h3> <script> var h3 = documen...
...And 2 more matches
Worklet - Web APIs
Web › API › Worklet
to specific use cases; they cannot be used for arbitrary computations like Web Workers. The Worklet interface abstracts properties and methods common to all kind of worklets, and cannot be created directly. ...
...mputations like Web Workers. The Worklet interface abstracts properties and methods common to all kind of worklets, and cannot be created directly. Instead, you can use one of the following classes: Name Description Location Specification PaintWorklet For programmatically generating an image where a CSS property expects a file. Access this interface through CSS.paintWorklet. ...
...and methods common to all kind of worklets, and cannot be created directly. Instead, you can use one of the following classes: Name Description Location Specification PaintWorklet For programmatically generating an image where a CSS property expects a file. Access this interface through CSS.paintWorklet. Chrome: Main thread Gecko: Paint thread CSS Painting API AudioWorklet For audio processing with custom AudioNodes. ...
...And 2 more matches
Adding captions and subtitles to HTML5 video - Developer guides
format. The WebVTT specification is still being worked on, but major parts of it are stable so we can use it today. Video providers (such as the Blender Foundation) provide captions and subtitles in a text format with their videos, but they're usually in the SubRip Text (SRT) format. These can be easily converted to WebVTT using an online converter such as srt2vtt. Modifications to the HTML and CSS This section summarises the modifications made to the previous article's code in order to facilitate the addition of subtitles to the video. If you are not interested in this, and just want to get straight into the JavaScript and more relevant CSS, skip to the Subtitle implementation section. In this example we are using a different video, Sintel, as it actually has some speech in it and ther...
... 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; ...
...e 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 what we do to access the video subtitles revolves around JavaScript. Similar to the video controls, if a browser supports HTML5 video subtitles, there will be a button provided within the native control set to access them. However, since...
...And 2 more matches
HTML5 - Developer guides
Web › Guide › HTML › HTML5
which the browser runs changes orientation. 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, mul...
...e 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. 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. ...
... Typography improvement Authors have better control to reach better typography. ...
...And 2 more matches
Mobile Web Development - Developer guides
Web › Guide › Mobile
e either not supported on desktops or are much less useful, and these APIs give mobile users new ways to interact with your site. Working with small screens Responsive Web Design is a term for a set of techniques that enables your web site to adapt its layout as its viewing environment -- most obviously, the size and orientation of the screen -- changes. It includes techniques such as: fluid CSS layouts, to make the page adapt smoothly as the browser window size changes the use of media queries to conditionally include CSS rules appropriate for the device screen width and height The viewport meta tag instructs the browser to display your site at the appropriate scale for the user's device. Working with touch screens To use a touch screen you'll need to work with DOM Touch events. Yo...
...adapt smoothly as the browser window size changes the use of media queries to conditionally include CSS rules appropriate for the device screen width and height The viewport meta tag instructs the browser to display your site at the appropriate scale for the user's device. Working with touch screens To use a touch screen you'll need to work with DOM Touch events. You won't be able to use the CSS :hover pseudo-class, and will need to design clickable items like buttons to respect the fact that fingers are fatter than mouse pointers. See this article on designing for touch screens. You can use the pointer or any-pointer media query to load different CSS on a touch-enabled device. Optimizing images To help users whose devices have low or expensive bandwidth, you can optimize images by lo...
...ect the fact that fingers are fatter than mouse pointers. See this article on designing for touch screens. You can use the pointer or any-pointer media query to load different CSS on a touch-enabled device. Optimizing images To help users whose devices have low or expensive bandwidth, you can optimize images by loading images appropriate to the device screen size and resolution. You do this in CSS by querying for screen height, width, and pixel ratio. You can also make use of CSS properties to implement visual effects like gradients and shadows without images. Mobile APIs Finally, you can take advantage of the new possibilities offered by mobile devices, such as orientation and geolocation. Cross-browser development Write cross-browser code To create web sites that will work acceptab...
...And 2 more matches
<a>: The Anchor element - HTML: Hypertext Markup Language
Web › HTML › Element › a
When href attribute is not present: any DOM interface HTMLAnchorElement Examples Linking to an absolute URL HTML <a href="https://www.mozilla.com"> Mozilla </a> Result Linking to relative URLs HTML <a href="//example.com">Scheme-relative URL</a> <a href="/docs/Web/HTML">Origin-relative URL</a> <a href="./p">Directory-relative URL</a> CSS a { display: block; margin-bottom: 0.5em } Result Linking to an element on the same page <!-- <a> element links to the section below --> <p><a href="#Section_further_down"> Jump to the heading below </a></p> <!-- Heading to link to --> <h2 id="Section_further_down">Section further down</h2> Note: You can use href="#top" or the empty fragment (href="#") to link to the top of the curre...
...download attribute to save a <canvas> as a PNG To save a <canvas> element's contents as an image, you can create a link with a download attribute and the canvas data as a data: URL: Example painting app with save link HTML <p>Paint by holding down the mouse button and moving it. ...
...ile)" src="ppt-icon.svg"> </a> WebAIM: Links and Hypertext - Hypertext Links MDN / Understanding WCAG, Guideline 3.2 G200: Opening new windows and tabs from a link only when necessary G201: Giving users advanced warning when opening a new window Skip links A skip link is a link placed as early as possible in <body> content that points to the beginning of the page's main content. Usually, CSS hides a skip link offscreen until focused. <body> <a href="#content">Skip to main content</a> <header> ... </header> <main id="content"> <!-- The skip link jumps to here --> .skip-link { position: absolute; top: -3em; background: #fff; } .skip-link:focus { top: 0; } Skip links let keyboard users bypass content repeated throughout multiple pages, such as header navigation...
...And 2 more matches
<input type="number"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › number
mals to two decimal places). Here's a simple example: <input type="number" placeholder="1.0" step="0.01" min="0" max="10"> See that this example allows any value between 0.0 and 10.0, with decimals to two places. For example, "9.52" is valid, but "9.521" is not. Controlling input size <input> elements of type number don't support form sizing attributes such as size. ...
...to CSS to change the size of these controls. For example, to adjust the width of the input to be only as wide as is needed to enter a three-digit number, we can change our HTML to include an id and to shorten our placeholder since the field will be too narrow for the text we have been using so far: <input type="number" placeholder="x10" step="10" min="0" max="100" id="number"> Then we add some CSS to narrow the width of the element with the id selector #number: #number { width: 3em; } The result looks like this: Offering suggested values You can provide a list of default options from which the user can select by specifying the list attribute, which contains as its value the id of a <datalist>, which in turn contains one <option> element per suggested value. Each option's value is t...
... You can use the required attribute to make an empty entry invalid. (In other words, the input must be filled in.) You can use the step attribute to constrain valid values to a certain set of steps (e.g., multiples of 10). You can use the min and max attributes to constrain valid values to lower and upper bounds. ...
...And 2 more matches
Content Security Policy (CSP) - HTTP
Web › HTTP › CSP
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: 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 mistake? Stylesheets are allowed to be loaded only from cdn.example.com, yet the website tries to load one from its own origin (http://example.com). A browser capable of enforcing CSP would send the following violation report as a POST request to http://example.com/_/csp-reports, when the document is visited: ...
... only from cdn.example.com, yet the website tries to load one from its own origin (http://example.com). ...
... cdn.example.com, yet the website tries to load one from its own origin (http://example.com). ...
...And 2 more matches
CSP: style-src - HTTP
eading 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. ...
...e 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. ...
...cript-src for external scripts. ...
...And 2 more matches
Mapping the width and height attributes of media container elements to their aspect-ratio - Web media technologies
Read on to find out more. ...
...ut. This wasn't an attractive thing for your users to see, and could also result in performance issues due to the repainting required after each image loads, hence adding the attributes being a good idea. Let's move forward a few years to the era of responsive design. To keep images from breaking out of their containers when the container becomes narrower than the image, developers started using CSS like the following: img { max-width: 100%; height: auto; } This is really useful for responsive layouts, but unfortunately it causes the jank problem to return -- the above CSS overrides the width and height attribute information, meaning that if the image has not loaded for some reason, its height will be set to 0. When the image finally loads, the same jank will occur as the page layout i...
...age has not loaded for some reason, its height will be set to 0. When the image finally loads, the same jank will occur as the page layout is shifted to make space for it. A new way of sizing images before loading completes Recognizing the problem, a WICG community group formed to propose an intrinsicsize attribute. Folks from Mozilla then expanded on this thinking, working on a proposal in the CSS Box Sizing Level 4 draft to define an aspect-ratio property and propose the idea of using the width and height attributes to compute layout. Fantasai & Jen Simmons collaborated with Emilio, who worked on an experimental implementation to prove it would work. Mozilla then brought the idea up in the WICG community group and discussed it further until representatives from Chrome were onboard with t...
...And 2 more matches
clip-path - SVG: Scalable Vector Graphics
The clip-path presentation attribute defines or associates a clipping path with the element it is related to. Note: As a presentation attribute clip-path can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has noticeable effects mostly on the following nineteen elements: <a>, <circle>, <clipPath>, <ellipse>, <g>, <glyph>, <image>, <line>, <marker>, <mask>, <path>, <pattern>, <polygon>, <polyline>, <rect>, <svg>, <symbol>, <text>, <use> html,body,svg { height:100% } <svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> <clipPath id="myClip" clipPathUnits="objectBoundingBox"> <circle cx=".5" cy=".5" r=".5" /> </clipPath> <!-- Top-left: Apply a custom defined clipping path --> <rect x="1" y="1" width="8" height="8" strok...
...This is the same as having a custom clipping path with a clipPathUnits set to objectBoundingBox --> <rect x="11" y="1" width="8" height="8" stroke="green" clip-path="circle() fill-box" /> <!-- Bottom-left --> <rect x="1" y="11" width="8" height="8" stroke="green" clip-path="circle() stroke-box" /> <!-- Bottom-right: Apply...
...sic shape on a fill-box geometry. This is the same as having a custom clipping path with a clipPathUnits set to objectBoundingBox --> <rect x="11" y="1" width="8" height="8" stroke="green" clip-path="circle() fill-box" /> <!-- Bottom-left --> <rect x="1" y="11" width="8" height="8" stroke="green" clip-path="circle() stroke-box" /> <!-- Bottom-right: Apply a CSS basic shape on a view-box geometry. This is the same as having a custom clipping path with a clipPathUnits set to userSpaceOnUse --> <rect x="11" y="11" width="8" height="8" stroke="green" clip-path="circle() view-box" /> </svg> Usage notes Value <url> | [ <basic-shape> || <geometry-box> ] | none Default value none Animatable Yes ...
...And 2 more matches
visibility - SVG: Scalable Vector Graphics
t graphics element is invisible. Note: If the visibility attribute is set to hidden on a text element, then the text is invisible but still takes up space in text layout calculations. Depending on the value of attribute pointer-events, graphics elements which have their visibility attribute set to hidden still might receive events. Note: As a presentation attribute, visibility can be used as a CSS property. See the css visibility property for more information. As a presentation attribute, it can be applied to any element but it has effect only on the following nineteen elements: <a>, <altGlyph>, <audio>, <canvas>, <circle>, <ellipse>, <foreignObject>, <iframe>, <image>, <line>, <path>, <polygon>, <polyline>, <rect>, <text>, <textPath>, <tref>, <tspan>, <video> html, body, svg { heigh...
...ates that the element will not be painted. Though it is still part of the rendering tree, i.e. it may receive pointer events depending on the pointer-events attribute, may receive focus depending on the tabindex attribute, contributes to bounding box calculations and clipping paths, and does affect text layout. collapse This value is equal to hidden. Example The following example toggles the CSS visibility of the SVG image path. HTML <button id="nav-toggle-button" > <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="button-icon"> <path d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z" /> <path d="M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z" class="invisible" /> <path d="M0 0h24v24H0z" fill="none" /> </svg> <span> click me ...
... image path. ...
...And 2 more matches
x - SVG: Scalable Vector Graphics
Web › SVG › Attribute › x
e <length> | <percentage> Default value -10% Animatable Yes foreignObject For <foreignObject>, x defines the x coordinate of the uper left corner of its viewport. Value <length> | <percentage> Default value 0 Animatable Yes Note: Starting with SVG2, x is a Geometry Property meaning this attribute can also be used as a CSS property for <foreignObject>. glyphRef Warning: As of SVG2 <glyphRef> is deprecated and shouldn't be used. For <glyphRef>, x defines the x-axis coordinate of the glyph. Value <number> Default value 0 for the first glyphRef, and the end x coordinate of the previous <glyphRef> for all subsequent sibling <glyphRef>. Animatable Yes image For <image>, x ...
...x coordinate of the previous <glyphRef> for all subsequent sibling <glyphRef>. Animatable Yes image For <image>, x defines the x coordinate of the uper left corner of the image. Value <length> | <percentage> Default value 0 Animatable Yes Note: Starting with SVG2, x is a Geometry Property meaning this attribute can also be used as a CSS property for images. mask For <mask>, x defines the x coordinate of the uper left corner of its area of effect. The exact effect of this attribute is influenced by the maskUnits attribute. Value <length> | <percentage> Default value -10% Animatable Yes pattern For <pattern>, x defines the x coordinate of the uper left corner of the tile pattern. Th...
...ernTransform attributes. Value <length> Default value 0 Animatable Yes rect For <rect>, x defines the x coordinate of the uper left corner of the shape. Value <length> | <percentage> Default value 0 Animatable Yes Note: Starting with SVG2, x is a Geometry Property meaning this attribute can also be used as a CSS property for rectangles. svg For <svg>, x defines the x coordinate of the uper left corner of its viewport. Value <length> | <percentage> Default value 0 Animatable Yes Note: Starting with SVG2, x is a Geometry Property meaning this attribute can also be used as a CSS property for <svg>. text For <text>, if it contain a single value, x defines the ...
...And 2 more matches
y - SVG: Scalable Vector Graphics
Web › SVG › Attribute › y
ue <length> | <percentage> Default value -10% Animatable Yes foreignObject For <foreignObject>, y defines the y coordinate of the uper left corner of its viewport. Value <length> | <percentage> Default value 0 Animatable Yes Note: Starting with SVG2, y is a Geometry Property meaning this attribute can also be used as a CSS property for <foreignObject>. glyphRef Warning: As of SVG2 <glyphRef> is deprecated and shouldn't be used. For <glyphRef>, y defines the y-axis coordinate of the glyph. Value <number> Default value none Animatable Yes image For <image>, y defines the y coordinate of the uper left corner of the image. Value <length> | <percentage> ...
...dinate of the glyph. Value <number> Default value none Animatable Yes image For <image>, y defines the y coordinate of the uper left corner of the image. Value <length> | <percentage> Default value 0 Animatable Yes Note: Starting with SVG2, y is a Geometry Property meaning this attribute can also be used as a CSS property for images. mask For <mask>, y defines the y coordinate of the uper left corner of its area of effect. The exact effect of this attribute is influenced by the maskUnits attribute. Value <length> | <percentage> Default value -10% Animatable Yes pattern For <pattern>, y defines the y coordinate of the uper left corner of the tile pattern. The ...
...ternTransform attributes. Value <length> Default value 0 Animatable Yes rect For <rect>, y defines the y coordinate of the uper left corner of the shape. Value <length> | <percentage> Default value 0 Animatable Yes Note: Starting with SVG2, y is a Geometry Property meaning this attribute can also be used as a CSS property for rectangles. svg For <svg>, y defines the y coordinate of the uper left corner of its viewport. Value <length> | <percentage> Default value 0 Animatable Yes Note: Starting with SVG2, y is a Geometry Property meaning this attribute can also be used as a CSS property for <svg>. text For <text>, if it contain a single value, y defines the y...
...And 2 more matches
Web Components
nged. Extensions for creating custom built-in elements The is global HTML attribute: Allows you to specify that a standard HTML element should behave like a registered custom built-in element. The "is" option of the Document.createElement() method: Allows you to create an instance of a standard HTML element that behaves like a given registered custom built-in element. ...
...reate an instance of a standard HTML element that behaves like a given registered custom built-in element. CSS pseudo-classes Pseudo-classes relating specifically to custom elements: :defined: Matches any element that is defined, including built in elements and custom elements defined with CustomElementRegistry.define()). :host: Selects the shadow host of the shadow DOM containing the CSS it is used inside. :host(): Selects the 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. ...
...t: Selects the shadow host of the shadow DOM containing the CSS it is used inside. :host(): Selects the 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. :host-context(): Selects the 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. ...
...And 2 more matches
page-mod - Archive of obsolete content
consists only of a static string, don't use contentScript: if you do, you may have problems getting your add-on approved 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. Name: contentScriptWhen Type: string By default, content scripts are attached after all the content (DOM, JS, CSS, images) for the document has been loaded, at the time the window.onload event fires. Using this option you can customize this behavior. The option takes a single string that may take any one of the following values: "start": Load content scripts immediately after the document element is inserted into the DOM, but before the DOM content itself has been loaded "ready": Load content scripts on...
.... ...
... Each stylesheet is supplied as a separate file under your add-on's "data" directory, and is specified by a URL typically constructed using the url() method of the self module's data object. To add multiple stylesheet files, pass an array of URLs. ...
...der your add-on's "data" directory, and is specified by a URL typically constructed using the url() method of the self module's data object. To add multiple stylesheet files, pass an array of URLs. var data = require("sdk/self").data; var pageMod = require("sdk/page-mod"); pageMod.PageMod({ include: "*.org", contentStyleFile: data.url("style.css") }); From Firefox 34, you can use "./style.css" as an alias for the resource:// URL pointing to the stylesheet in your "data" directory. So you can rewrite the code above like this: var pageMod = require("sdk/page-mod"); pageMod.PageMod({ include: "*.org", contentStyleFile: "./style.css" }); Content styles specified by this option are loaded before those specified by the contentStyle option. In earlier versions of this module, you c...
dev/panel - Archive of obsolete content
Developer Tools are hosted in a UI component called the Toolbox. Individual built-in tools, such as the JavaScript Debugger or the Web Console, occupy "panels" in the toolbox. With the dev/panel module, you can create your own panels in the Toolbox: The panel gets a tab in the Toolbox toolbar which enables the user to open it: You specify the panel's content and behavior using HTML, CSS, and JavaScript. When the panel's created, the framework passes it a debuggee: this is a MessagePort object that you can use to exchange JSON messages with the browser that the developer tools are currently debugging. The messages follow the remote debugging protocol. For a simple walkthrough of using the dev/panel API to add a new tool, see Adding a panel to the toolbox. Basic usage Defining ...
...However, i...
...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 w...
...n.js which 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. ...
Creating annotations - Archive of obsolete content
annotation. The matched element is highlighted and has a click handler bound to it which sends a message to the main add-on code. The selector page mod can be switched on and off using a message from the main add-on code. It is initially off: var matchedElement = null; var originalBgColor = null; var active = false; function resetMatchedElement() { if (matchedElement) { (matchedElement).css('background-color', originalBgColor); (matchedElement).unbind('click.annotator'); } } self.on('message', function onMessage(activation) { active = activation; if (!active) { resetMatchedElement(); } }); This selector listens for occurrences of the jQuery mouseenter event. When a mouseenter event is triggered the selector checks whether the element is eligible for annotation. An...
...message called show back to the main add-on code. The show message contains: the URL for the page, the ID attribute value, and the text content of the page element. ...
...ode. The show message contains: the URL for the page, the ID attribute value, and the text content of the page element. ...
.... 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 content script In t...
Modifying Web Pages Based on URL - Archive of obsolete content
page contents with a message pageMod.PageMod({ include: "*.org", contentScriptFile: self.data.url("my-script.js"), // Send the content script a message inside onAttach onAttach: function(worker) { worker.port.emit("replacePage", "Page matches ruleset"); } }); 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. 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 soli...
...ut 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: "*", 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: "*", co...
...ry; 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 any tabs that are already open when the page-mod is created, and are attached to iframes as well as top-level documents. To control this behavior use the attachTo optio...
... By default, content scripts are not attached to any tabs that are already open when the page-mod is created, and are attached to iframes as well as top-level documents. To control this behavior use the attachTo option. Define read-only values accessible to content scripts using the contentScriptOptions option. By default, content scripts are attached after all the content (DOM, JS, CSS, images) for the page has been loaded, at the time the window.onload event fires. To control this behavior, use contentScriptWhen option. To learn more about content scripts in general, see content scripts guide. ...
Scrollbar - Archive of obsolete content
This example shows how to style the scrollbars in your xul application. Scrollbars inside browser elements will be styled to. Tested on windows xp. ...
... This example shows how to style the scrollbars in your xul application. Scrollbars inside browser elements will be styled to. Tested on windows xp. ...
...ser elements will be styled to. 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. So to make this work with osx, make an extra override: override chrome://global/skin/nativescrollbars.css chrome://app-global/skin/scrollbars.css Change some color values inside the app/chrome/skin/global/scrollbars.css to test that the css is used. Example xul window: <?xml ...
... windows xp, and nativescrollbars.css on osx. So to make this work with osx, make an extra override: override chrome://global/skin/nativescrollbars.css chrome://app-global/skin/scrollbars.css Change some color values inside the app/chrome/skin/global/scrollbars.css to test that the css is used. ...
JavaScript Daemons Management - Archive of obsolete content
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-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 on...
...rn; } this.clock = 0; oLetter.elem.textContent = nIndex / nLength - oLetter.index / this.numletters >= 0 ? ...
...oLetter.elem.style.position = "relative"; this.appendChild(oSpan); } } var nMaxDist = 25, aLetters = [], sText = "Do you feel lucky, punk?", oRecompose = new Daemon.safe(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.safe(<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> <butt...
...rn; } this.clock = 0; oLetter.elem.textContent = nIndex / nLength - oLetter.index / this.numletters >= 0 ? ...
Adding sidebars - Archive of obsolete content
u can use those for initialization and clean up . Another, more important difference to take into account is that users can resize the sidebar to their liking, and in most cases, the sidebar is going to be fairly narrow. You should design the content of your sidebar carefully, so that it is usable and appealing regardless of width. There are ways to limit the size boundaries of your sidebar with CSS or even disable resizing altogether, but none of those are good practices. Forcing sidebars to have a fixed size can cause accessibility and usability problems. You can still have plenty of content available in your sidebar, you just need to organize it in a way that doesn't take too much space. For this purpose we'll also look at some handy XUL elements in this section. They allow you to stack ...
...tent 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="xulschoolhello-tabbox"> <tabs> <tab label="&xulschoolhello.mainTab.label;" /> <ta...
...on use for a stack is to have an image background that stretches horizontally and vertically depending on the size of the foreground object: <stack> <hbox flex="1"> <image src="chrome://xulschoolhello/skin/stack-bg.png" flex="1" /> </hbox> <hbox> <!-- Some content here. --> </hbox> </stack> This workaround is necessary because you can't have an background image stretch using CSS. A less common use for the stack element is to use the left and top attributes on its children in order to have absolute positioning for the content on the layers. This kind of positioning can be useful for various artistic effects, as well as some type of desktop-like or Dashboard-like interface, where items are located in positions determined by the user, and they can overlap with each other. ...
...ome 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. ...
Setting Up a Development Environment - Archive of obsolete content
online are merely templates that generate the folder structure for the project, and that's not much help. We recommend Komodo Edit. It's free, open source, and cross-platform. It's based on the Mozilla XULRunner platform, so it has support for some of the particularities in Firefox extension development. Komodo Edit has automatic completion for XUL tags and attributes, and it supports Mozilla's CSS extensions (CSS values and properties beginning with "-moz"). It has an add-on system similar to the one in Firefox, and there are some Komodo extensions that provide additional help in extension development. That is more than what you can get with most other editors, so we recommend you to give it a try. All of our examples are handled with Komodo Edit, so if you see a .kpf or .komodoproject fil...
...and navigate to the src directory in your project. Run the following command: make That's it. If everything went well, you should see an output similar to this: Creating XPI file. adding: install.rdf (deflated 50%) adding: chrome.manifest (deflated 50%) adding: content/browserOverlay.js (deflated 42%) adding: content/browserOverlay.xul (deflated 69%) adding: skin/browserOverlay.css (stored 0%) adding: locale/browserOverlay.dtd (deflated 52%) adding: locale/browserOverlay.properties (stored 0%) Creating XPI file. Done! Build finished successfully. If you inspect the bin directory, you should see the xulschoolhello2.xpi file. If you run make again, you'll only see the last line of the build process. That is because make can tell that the file in the bin directory is...
...elopment and overlap with the add-ons listed. In this section we'll cover a few that we have found to be very useful. DOM Inspector The DOM Inspector used to be part of Firefox as an installer option, but since Firefox 3 it has been separated 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, attri...
...School. Make sure you can open and close your XUL School Firefox without 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 r...
The Essentials of an Extension - Archive of obsolete content
efined in a separate directory. Since most other systems are Unix-based, the "unix" skin is the default, with no flags. The Chrome As mentioned earlier, the chrome is composed of 3 sections: content, locale and skin. The content is the most important section, holding user interface (XUL) and script (JS) files. The skin section has the files that define most of the look and feel of the UI (using CSS and images, just like web pages). Finally, the locale section holds all text used in the extension, in DTD and properties files. This division allows other developers to create themes that replace skins, and translators to create localizations in different languages, all of this without having to change your extension or your code. This gives Firefox extensions a great deal of flexibility. Chrom...
... 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 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 th...
...er refine this last example to handle different types of 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...
...At any rate it's better to always include it. This way it's harder to make the mistake of not including it. You can enter the chrome path in the location bar and inspect the file if you're curious. This covers all of the files in the Hello World extension. ...
Making it into a dynamic overlay and packaging it up for distribution - Archive of obsolete content
or the chrome registry and an install.js script to perform the installation. Finally we'll zip the files into an archive. Start out by creating a directory called tinderstatus-installer. Create a tinderstatus subdirectory in it and a content sub-subdirectory in that subdirectory. ...
...tatus.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. ...
....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. ...
...ster/gatekeeper/there.is.only.xul"> <script type="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...
Getting Started - Archive of obsolete content
directory you'll also notice that there are classic.jar and modern.jar files. For this tutorial we are going to use the Classic skin as a base. Extract classic.jar into \classic (\mozilla\chrome\classic), but make sure to keep the directory structure. Remember if at any point you wish to revert back to the original code again, just extract this jar over top of what you've modified. Now all of the CSS and images are extracted, but if you make some changes and run Mozilla as it is, you will not see them because it's still set to look at the files in the Jar files. To point Mozilla at the correct files we need to open up \mozilla\chrome\installed-chrome.txt in a text editor. You should probably make a backup of this file now, just in case you make a mistake. In the file you'll see a list. Do a s...
...al/ Modified skin,install,url,resource:/chrome/classic/skin/classic/global/ Once you have made these modifications, save them and run mozilla. If mozilla runs fine, that means that it worked. If it doesn't appear as you expected, then go back into the installed-chrome.txt file and double check that you modified the lines correctly. Changing Borders and Colours This is the part where knowing CSS comes in handy. To find all of the CSS files that we're going to be modifying, we must first understand the directory structure. Directories In \mozilla\chrome\classic\skin\classic there are a number of different directories which contain the skin information for the default packages that come with Mozilla. The most important directory is \global. The default Widgets are defined here, and anythin...
... 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 controls, where to put the images, what border and padding it should put around them, etc. For this next part, let's modify the standard button. Go into \mozilla\chrome\classic\skin\classic\global and open button.css in your favourite text editor. Scroll down to button {. This section defines the normal...
...t selected). Change the background-color: to DarkBlue and the color: to White. Save the file and run Mozilla. When the browser pops up, you probably won't be able to see much. Open the preferences dialog box and take a look at all of the buttons in there. They should all be blue with white text. Changing Images The images used on buttons in the interface are located in the same directories as the CSS files. To make a change, just replace one of the images with one of your own. It should probably be of the same size, but it doesn't have to be. If you do need to change the size, also make sure to change any CSS that may be affected by that change. After you've changed the images, launch Mozilla and you should see them. Creating the Install Script Getting it ready for the installation Before we ...
Mozilla Application Framework in Detail - Archive of obsolete content
icle should be 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-languag...
...dget set we provide, nor limited to the "look and feel" of the native OS. You can create applications using our framework that either have a native look and feel for each OS, or one which is identical on Macs, PC's or Unix operating systems. You may also further enhance the user interface by allowing 3rd parties to develop "themes" for your application. Themes are simply collections of images and CSS which can augment or replace your current UI elements. XUL provides an excellent answer for organizations with heterogeneous computing environments. Customized XUL applications with significant business logic can be written once, and used on the range of platforms that exist within the organization. In addition, if the organization maintains sophisticated, interactive websites, it will alr...
...rowser technology 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 Interne...
...t browser technology to fully implement the latest W3C standards and enables developers to build rich, dynamic web pages and web-based applications that look and run as intended across a variety of platforms and devices. This saves developers time and money while allowing them to deliver state-of-the-art content and web applications. Gecko features full support for open Internet standards such as CSS1, HTML 4.0, DOM1, RDF, XML and JavaScript. Modular, Embeddable: Gecko's modular architecture enables developers to add or remove modules with little effort, fitting the software to the available hardware and adjusting functionality to match product requirements. Gecko is implemented as a collection of XPCOM components that can be easily added or removed. Flexible programming interfaces such as t...
Anonymous Content - Archive of obsolete content
For example, if the user has already focused 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...
...ted for the textfield, followed by a mouseover of the button. Since neither of these events constitutes a mouseover or mouseout of the file control itself, the events are not allowed to flow to the file control. If the user continues moving to the right and leaves the button, then the mouseout generated will be retargeted, since the file control will also have been exited. Anonymous content and CSS Selectors and scopes Bindings can interleave anonymous elements between the bound element and its explicit children. See Insertion Points for more information. In this situation, a new tree emerges that is different from the explicit content node tree. In addition to having a single explicit parent (the bound element) the explicit children also have an arbitrary set of anonymous parents (create...
... this situation, a new tree emerges that is different from the explicit content node tree. In addition to having a single explicit parent (the bound element) the explicit children also 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. ...
...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. Binding stylesheets A binding file can load stylesheets using the stylesheet element. ...
XBL 1.0 Reference - Archive of obsolete content
ible 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 that is insert...
...ogress: 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. ...
... This example is targeted to demonstrate the XBL usage rather than to be a practically useful application. For this reason it contains many comme...
...ementations Event Handlers Example - Sticky Notes Updated and adjusted for the current Firefox implementation. 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 more compact solution yet used here for demonstration purposes. ...
Building accessible custom components in XUL - Archive of obsolete content
<code> @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); grid.spreadsheet { border: thin solid; } grid.spreadsheet label { border-bottom: 1px solid black; border-left: 1px solid black; margin: 0; padding: 3px; } grid.spreadsheet description { color: black; background-color: whi...
...echnology. Further reading Table of supported roles and states in Firefox Focus Issues Download stage-3.zip install stage-3.xpi The next step on the road to an accessible spreadsheet is the focus problem. In HTML documents, you can make any element focusable with the tabindex attribute. In XUL, there is no tabindex attribute; to make a XUL element focusable, you need to use a Mozilla-specific CSS property, -moz-user-focus: normal. <code> grid.spreadsheet { border: thin solid; -moz-user-focus: normal; } </code> In HTML documents, Firefox draws a focus rectangle around the currently focused element. In XUL, we will need to handle this ourselves, again with CSS rules. You might initially think of using the CSS border property, but that will add width and height to the focused cell. A bet...
... normal. <code> grid.spreadsheet { border: thin solid; -moz-user-focus: normal; } </code> In HTML documents, Firefox draws a focus rectangle around the currently focused element. In XUL, we will need to handle this ourselves, again with CSS rules. You might initially think of using the CSS border property, but that will add width and height to the focused cell. A better approach is to use the CSS outline property, which does maintains the element's dimensions. (Technically, it draws the border inside the element instead of outside.) <code> grid.spreadsheet description:focus, grid.spreadsheet label:focus { outline: 1px dotted black; outline-offset: -2px; } </code> However, neither of those are our biggest problem. We want this collection of XUL elements to act like a single control, a ...
...Wh...
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 sortDirectio...
...provide details about implementing and working with toolbars. 956 Creating toolbar buttons (Customize Toolbar Window) Add-ons, Extensions, Firefox 3, Toolbars, XUL This article explains how to add a toolbar button to a Toolkit application (such as Firefox, Thunderbird, or Kompozer) using overlays. Its intended audience is extension developers with a basic knowledge of XUL and CSS. 957 Custom toolbar button Add-ons, Extensions, SeaMonkey, Toolbars, XUL, thunderbird This page tells you step-by-step how to make a custom toolbar button in Firefox, SeaMonkey 2.0, Thunderbird or Sunbird. (For SeaMonkey 1.x, see the page Custom Toolbar Button:SeaMonkey.) 958 Code Samples Add-ons, Extensions This page contains sample code that you can use...
...Toolkit API, XPInstall, XUL Starting with Firefox 1.5, Thunderbird 1.5, and XULRunner 1.8, you can specify an icon for a XUL window by putting files named mywindow.ico (for Windows) and mywindow.xpm or mywindow16.xpm (Linux), where mywindow is the id of the <window> you want to attach the icon to, in the chrome/icons/default subfolder of your bundle. 973 Writing Skinnable XUL and CSS CSS, XUL No summary! 974 XML XUL No summary! 975 XUL Accesskey FAQ and Policies XUL An accesskey is an underlined letter in a web page, menu or dialog that indicates to a user a quick, keyboard method of simulating a click on that element. For example, an Apply button may have the letter A underlined. On Windows and UNIX, pressing ALT+A is a con...
...we'll find out how to add custom methods to XBL-defined elements. 1008 Adding Properties to XBL-defined Elements Tutorials, XBL, XUL, XUL_Tutorial Next, we'll find out how to add custom properties to XBL-defined elements. 1009 Adding Style Sheets Tutorials, XUL, XUL_Tutorial We have hardly modified the look of the elements we have created so far. XUL uses CSS (Cascading Style Sheets) to customize elements. 1010 Adding more elements Tutorials, XUL, XUL_Tutorial We will conclude the discussion of boxes by adding some boxes to the find files dialog. 1011 Additional Install Features Tutorials, XUL, XUL_Tutorial This section describes some more specifics of installers. 1012 Advanced Rules Tutorials, ...
Building Trees - Archive of obsolete content
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 above to change the appearance. In the example above, it changes the height of a row to 150 pixels. You may want to change the syntax to refer to a speci...
... changed, we can see the full photos. Note: If you want to have the state of the disclosure triangles ("twisties") be persistent, be sure to 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. F...
... 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 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 ...
... << PreviousNext >> ...
Complete - Archive of obsolete content
this 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: ...
...hemes, 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/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 c...
...n 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 theme has its own directory there. In each theme's directory, there is an allcustom directory. This is usef...
...e: button-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 re...
Anonymous Content - Archive of obsolete content
g"> <content> <xul:scrollbarbutton type="decrement"/> <xul:slider flex="1"> <xul:thumb/> </xul:slider> <xul:scrollbarbutton type="increment"/> </content> </binding> </bindings> This file contains a single binding, declared with the binding element. The id attribute should be set to the identifier of the binding. ...
...ier of the binding. This way it can be referred to through the CSS -moz-binding property. The content tag is used to declare anonymous content that will be added to the scroll bar. All of the elements inside the content tag will be added inside the element that the binding is bound to. Presumably this binding would be bound to a scroll bar, although it doesn't have to be. Any element that has its CSS -moz-binding property set to the URI of the binding will use it. The result of using the above binding is that the line of XUL below will be expanded as follows, assuming that the scrollbar is bound to the XBL above: <scrollbar/> expands to: <scrollbar> <xul:scrollbarbutton type="decrement"/> <xul:slider flex="1"> <xul:thumb/> </xul:slider> <xul:scrollbarbutton type="increment...
...splayed. You can do this by using the children element. The children added in the XUL are added in place of the children element. This is handy when creating custom menu widgets. For example, a simplified version of an editable menulist element, might be created as follows: XUL: <menu class="dropbox"> <menupopup> <menuitem label="1000"/> <menuitem label="2000"/> </menupopup> </menu> CSS: menu.dropbox { -moz-binding: url('chrome://example/skin/example.xml#dropbox'); } XBL: <binding id="dropbox"> <content> <children/> <xul:textbox flex="1"/> <xul:button src="chrome://global/skin/images/dropbox.jpg"/> </content> </binding> This example creates an input field with a button beside it. The menupopup will be added to the content in the location specified by the...
..."/> </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 one child, the children tag. This is an important distinction when using the DOM with XBL. This also applies to CSS selector rules. Multiple Children Elements You can also use multiple children elements and have certain elements be placed in one location and other elements placed in another. By adding a includes attribute and setting it to a vertical bar-separated list of tags, you can make only elements in that list be placed at that location. For example, the following XBL will cause text labels and buttons ...
Creating Dialogs - Archive of obsolete content
e 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. ...
...ancel, 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. ...
... 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. ...
...utton 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. ...
Using Remote XUL - Archive of obsolete content
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 want. Part of...
...well. Note: The downside to using XUL is that it only works with browsers that understand it. This isn't a problem inside an organization that uses Mozilla-based browsers exclusively, but for other sites you may need to provide another form of navigation as well. Prerequisites To understand this tutorial you should have experience with tag-based languages like HTML along with basic JavaScript, CSS, and the DOM. Knowledge of XML and its syntax is useful but not required. You also need a text editor and a web browser that can render XUL, like Mozilla, or Firefox. If you build a XUL file along with this tutorial and put it onto a web server, you need to configure your web server to specify the content type of XUL files as application/vnd.mozilla.xul+xml. For Apache, you can do this by adding...
...we have to reference a stylesheet with rules for styling menus. We could write one ourselves, but we'll make our lives easier and use one of the stylesheets that comes with Mozilla-based browsers. In this case, we'll reference the default application stylesheet--the one used by the browser to style its own interface. <?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"> ... </window> The xml-stylesheet processing instruction references a stylesheet, applying its rules to the widgets in the XUL document into which it is placed. It is similar to the link ref="stylesheet" element in HTML. The URL we use, chrome://global/skin/, is a reference to the default application stylesheet ...
...r So far, so good. We have a menu bar with menus and buttons, and we can press the buttons, open the menus, and select their items. The interface is in place, but it doesn't do anything. We want it to load URLs in the iframe when we press the buttons or select the menu items. For that we need to add JavaScript code. <?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"> <script type="application/javascript"> function loadURL(event) { var contentFrame = document.getElementById("contentFrame"); var url = event.target.getAttribute("value"); if (url) contentFrame.setAttribute("src", url); } </script> ... </window> The code to load the URLs is simple...
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. ...
... << 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. ...
...n its left side. right The text will be cropped on its right side. center The text will be cropped in the middle, showing both the start and end of the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can a...
... Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } description Type: string Descriptive text to appear in addition to the dialog title. title Type: string The text to appear in the title bar of the window. Properties Inherited Properties align, , allowEvents, , boxObject, builder, , , , className, , , , , colla...
tooltip - Archive of obsolete content
n its left side. right The text will be cropped on its right side. center The text will be cropped in the middle, showing both the start and end of the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can a...
... Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } default Type: boolean If true, the tooltip is used as the default popup for displaying tooltips in the window. 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 attribut...
... for position are: before_start, before_end, after_start, after_end, start_before, start_after, end_before, end_after, overlap, and after_pointer. Check Positioning of the Popup Guide for a precise description of the effect of the different values. x, y For an anchored popup, the x and y arguments may be used to offset the popup from its anchored position by some number, measured in CSS pixels. An unanchored popup appears at the position specified by x and y, relative to the viewport of the document containing the popup node. In this case, the position and attributesOverride arguments are ignored. isContextMenu The isContextMenu argument should be true for context menus and false for all other types of popups. It affects menu item highlighting; that is, while a con...
... The event that triggered the popup (such as a mouse click, if the user clicked something to open the popup). openPopupAtScreen( x, y, isContextMenu ) Return type: no return value Open the popup at a specific screen position specified by x and y. This position may be adjusted if it would cause the popup to be off of the screen. The x and y coordinates are measured in CSS pixels. showPopup( element, x, y, popupType, anchor, align ) Deprecated since Gecko 1.9 Return type: no return value Deprecated in favor of openPopup and openPopupAtScreen Opens a popup element. There are two ways of specifying where the popup appears, either at a specific screen position, or relative to some element in the window. If either x or y are set to values, the popup will appear at...
tree - Archive of obsolete content
Archive › Mozilla › XUL › tree
umn (for example column 'age') from the currently focused row in the tree: var t = document.getElementById('mytree'); document.title = t.view.getCellText(t.currentIndex,t.columns.getNamedColumn('age')); To select the checkbox and display the cell's text value, you can use code like the following. ...
...ntly focused row in the tree: var t = document.getElementById('mytree'); document.title = t.view.getCellText(t.currentIndex,t.columns.getNamedColumn('age')); To select the checkbox and display the cell's text value, you can use code like the following. ...
... in the tree: var t = document.getElementById('mytree'); document.title = t.view.getCellText(t.currentIndex,t.columns.getNamedColumn('age')); To select the checkbox and display the cell's text value, you can use code like the following. ...
...This style MUST come before treechildren::-moz-tree-checkbox(checked) otherwise it won't take effect. */ list-style-image: url("") } 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 ...
Extentsions FAQ - Archive of obsolete content
en of tab closing. You can get the tab that is being closed. This should be enough for you. Is it possible to fix the size exactly at 16x16 pixels avoiding any resize? Simply position the image and it will no longer be stretched to the size of the stack. <image left="0" top="0"> would seem to suffice. ...
...in the CSS file have to be in any particular order (if two rules match, 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. //setting the state document.getElementById("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 ...
...top) How to get a refenece to the sidebar window Assuming you have chrome privileges, this should work: var Ci = Components.interfaces; var topLevelWindow = window.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIWebNavigation) .QueryInterface(Ci.nsIDocShellTreeItem) .
...top) How to get a refenece to the sidebar window Assuming you have chrome privileges, this should work: var Ci = Components.interfaces; var topLevelWindow = window.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIWebNavigation) .QueryInterface(Ci.nsIDocShellTreeItem) .rootTreeItem .QueryInterfac...
Theme changes in Firefox 3 - Archive of obsolete content
rticle called Updating themes for Firefox 3 that would serve as a how-to guide for updating themes. If anyone with theming experience would like to write one, please do! Browser changes requiring theme updates There are a number of changed and deleted files in the browser that may require you to make changes to your theme. The table lists both the changed XUL file and the theme's corresponding CSS file that you might need to update. Filename CSS File Details Changes to the default theme The table below lists changes made in the default theme for Firefox 3; you can use this information as a starting point for figuring out the changes you need to make. All file list All platforms File Description of change browser/themes/*/...
...ight need to update. Filename CSS File Details Changes to the default theme The table below lists changes made in the default theme for Firefox 3; you can use this information as a starting point for figuring out the changes you need to make. All file list All platforms File Description of change browser/themes/*/browser/browser.css The width of the drag and drop indicator is no longer calculated during the drag (tabbrowser.xml). Instead a '-moz-margin-start' property must be added to .tab-drop-indicator-bar, with a value that is half of the width of the indicator image. Also, the visibility of the indicator is now controlled by setting collapsed in tabbrowser.xml. As a result, the 'display' property should be removed fro...
...perty should be removed from .tab-drop-indicator-bar (including for dragging="true"). Mac OS X File Description of change browser/themes/pinstripe/browser/tabbrowser/tabDragIndicator.png Removed superfluous blank pixels from the edges, so that the image is smaller. May or may not affect other Mac themes that use it. browser/themes/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 elemen...
... chrome://global/skin/icons/information-16.png Used when presenting information notices. chrome://global/skin/icons/warning-16.png Used when displaying warnings. Images to remove The following images were removed: chrome://mozapps/skin/extensions/question.png No longer used. Mac OS X Mac OS X themes for Firefox 3 should add these two rules to the end of chrome://global/skin/wizard.css: .wizard-buttons-btm { padding:Xpx; } .wizard-label-box { display: none; } The numeric value ofX, the number of pixels of padding in .wizard-buttons-btm, should be the same as the value of the margin for .wizard-buttons-box-2. Image Changes chrome://global/skin/icons/loading_16.gif was replaced with chrome://global/skin/icons/loading_16.png . Changes in mozapps See also Theme chang...
References - Archive of obsolete content
The...
...The webpage explains and propos...
...The webpage explains and proposes with small examples the best coding practices and mo...
... Itoh Preparing for standard-compliant browsers, Part 2 from Makiko Itoh Javascript Best Practices lists 15 of the most frequent coding practices which create problems for javascript and DHTML-driven webpages. The webpage explains and proposes with small examples the best coding practices and most recommendable ways of developing problem-free javascript code. From Matt Kruse Debugging HTML and CSS is a well designed website explaining well the how, why and where of HTML validation, CSS validation and debugging tools. We highly recommend this site. It is also available in French. From Dan. <- Previous section: Summary of Changes ...
Summary of Changes - Archive of obsolete content
This section outlines all of the element and practice updates described in this article. For a complete discussion of these items, see the sections in which they are described. ...
...section outlines all of the element and practice updates described in this article. For a complete discussion of these items, see the sections in which they are described. ...
...these items, see the sections in which they are described. ...
... W3C Feature or Recommended Replacement deprecated FONT HTML 4.01 SPAN plus CSS1 color: ; font-family: ; font-size: ; deprecated CENTER or align="center" CSS1 text-align: center; for in-line elements like text or image deprecated CENTER or align="center" CSS1 margin-left: auto; margin-right: auto; for block-level elements deprecated bgcolor CSS1 background-color: ; non-standard EMBED HTML 4.01 OBJECT deprecated APPLET HTML 4.01 OBJECT non-standard MARQUEE HTML 4.01 DIV plus scripting non-standard BGSOUND HTML 4.01 OBJECT Proprietary or Deprecated Feature W3C Feature or Recommended Replacement IE5+ id_attribute_value document.all.id_attribute_value document...
-ms-high-contrast-adjust - Archive of obsolete content
Formal syntax auto | none Specifications Not part of any specification. ...
... Formal syntax auto | none Specifications Not part of any specification. ...
... Formal syntax auto | none Specifications Not part of any specification. ...
... Formal syntax auto | none Specifications Not part of any specification. ...
Styling the Amazing Netscape Fish Cam Page - Archive of obsolete content
gendary status in your mind. It's like a SCUBA enthusiast getting to join Jacques Cousteau on a dive, even down to the required time travel. I dove right in and decided to have some fun with with the redesign, which is why I rather like the final result. To share the joy, I herein present a look into just one piece of the redesign, and how I accomplished certain effects using simple HTML and some CSS. Marking Up the Fish In the old Fish Cam page, there was a table that contained the pictures and descriptions of the fish. Well, I couldn't letthat continue--fish are flexible, slippery things, and tables are very much not. So I decided to break up the content so that there is a self-contained bit of markup for each fish, and then get down to styling. Here's what one of those bits looks like on...
...Up the Fish In the old Fish Cam page, there was a table that contained the pictures and descriptions of the fish. Well, I couldn't letthat continue--fish are flexible, slippery things, and tables are very much not. So I decided to break up the content so that there is a self-contained bit of markup for each fish, and then get down to styling. Here's what one of those bits looks like once all the CSS has been applied. In order to make the Fish Cam page as agile as the fish themselves, it was necessary to strip out all of the tables, font tags, and other non-validating stuff. At the end of it, there were a series of div elements that contained a picture of the fish, the name of the fish, and one or more paragraphs of text about the fish. Here's a typical (and short) example. <div class="ca...
...xed; color: #339;} Finishing the Style Adding the background to the heading containing the name of the fish created three problems: The double border was completely covered up by the image. The text of the h3 was basically touching the right side of the floated image... ...or it would have been, except in some browsers the heading was drawn over the floated image, in contradiction to the CSS specification. Getting the image back on top of the heading turned out to be a matter of relatively positioning the floated image, and then giving it a z-index value. In order to create visual appeal, I decided to offset the top let corners of the fish image and fish name. With just a few simple margin and padding changes, this was possible. div.card {float: left; width: 45%; margin: 1em 2% 0 ...
...rgin: 0.5em 0.5em 0.5em 160px;} And voila! The cards are done. Conclusion Redesigning a classic is something like being asked to reviseMoby Dick for modern audiences: you're thrilled at the opportunity, but afraid of doing injustice to the original. I'd like to think that the final result was in keeping with the original spirit of the Amazing Netscape Fish Cam page while giving it a nice new CSS-driven look. I hope that our little cruise through this aspect of the redesign has gotten you hooked on the idea of using simple markup and CSS to create interesting effects, if you weren't already. With just the few elements I had available in this example, there were any number of possibilities for design effects, and I think you'll find the same to be true for your own designs if you just giv...
background-size - Archive of obsolete content
consistency. Feel free to put it inside, nothing is set in stone. Konqueror's global market share is 0.05%, (< 5% of Linux users). Given the fact that this reference has serious shortcomings in many places and few contributors, I think spending much time here is not effective. People especially interested in this browser are welcome to contribute. It's hard to get reliable information about its CSS support without having this browser (read: multiple versions of this browser) installed. Are you able and willing to do that for all CSS properties? If so, feel free to change the en/CSS_Reference/Property_Template and all CSS property pages ; ) Start with -webkit-background-size and investigate support of contain and cover keywords and "omitted second value" behavior. [I assume it's the same a...
...ere anyway to have the -moz-border-image only apply if -moz-background-size is not supported? I'm guessing not, just asking because having both rules in for 3.6 creates a strange effect: -moz-border-image gets inherited by every element on the page User:robertc 2009-08-08 -moz-border-image should not inherit. Some example code? User:Jurgen Jeka 2009-08-09 OK, here's a page with both rules - the CSS is derived from the code on the page here, this is what it looks like in 3.6a2pre on Linux, the background image appears on the whole page, and then again behind 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 ext...
...ed from the code on the page here, this is what it looks like in 3.6a2pre on Linux, the background image appears on the whole page, and then again behind 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 ...
..., 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:Jurgen Jeka 2009-08-12 OK, probably my understanding of CSS inheritance isn't all it should be. I tried locating the part of the spec about <body>'s background extending to <html> but it didn't seem to be explicitly mentioned in the Cascading and Inheritance section and both the background-image and border-image say 'inherited: no'. And anyway, it's more the -moz-border-image that seems to be the problem - that gets inherited even if I add in -moz-borde...
Web Standards - Archive of obsolete content
roprietary markup and technologies, can contribute to a company's business goals. Community View Mozilla forums... Mailing list Newsgroup RSS feed The Web Standards Project WebDev FeedHouse Other community links... ...
... Mailing list Newsgroup RSS feed The Web Standards Project WebDev FeedHouse Other community links... ...
... RSS feed The Web Standards Project WebDev FeedHouse Other community links... ...
...House Other community links... Tools Firebug extension Web Developer extension Markup validation service (W3C) CSS validation service (W3C) Examples Mozilla 1.0 Demos - showing off what can be done with Web standards. ...
Crisp pixel art look with image-rendering - Game development
h making sure the pixel art does not look blurry. Developers have been manually scaling up graphics so they are shown with blocks that represent pixels. Two downsides to this method are larger file sizes and compression artifacts. ...
...lopers have been manually scaling up graphics so they are shown with blocks that represent pixels. Two downsides to this method are larger file sizes and compression artifacts. original size 4x size 4x size (scaled with an image editor) none vendor's algorithm nearest-neighbor algorithm A CSS-based solution The good news is that you can use CSS to automatically do the up-scaling, which not only solves the blur problem, but also allows you to use the images in their original, smaller size, thus saving download time. Also, some game techniques require algorithms that analyse images, which also benefit from working with smaller images. The CSS property to achieve this scaling is image-rendering. It is still experimental, but there is part...
...me game techniques require algorithms that analyse images, which also benefit from working with smaller images. The CSS property to achieve this scaling is image-rendering. It is still experimental, but there is partial support in most browsers. The steps to achieve this effect are: Create a <canvas> element and set its width and height attributes to the original, smaller resolution. Set its CSS width and height properties to be 2x or 4x the value of the HTML width and height. If the canvas was created with a 128 pixel width, for example, we would set the CSS width to 512px if we wanted a 4x scale. Set the <canvas> element's image-rendering CSS property to some value that does not make the image blurry. Either crisp-edges or pixelated will work. Check out the image-rendering article for...
... Either crisp-edges or pixelated will work. Check out the image-rendering article for more information on the differences between these values, and which prefixes to use depending on the browser. An example Let's have a look at an example. ...
Grid Axis - MDN Web Docs Glossary: Definitions of Web-related terms
CSS Grid Layout is a two-dimensional layout method enabling the laying out of content in rows and columns. Therefore in any grid we have two axes. The block or column axis, and the inline or row axis. It is along these axes that items can be aligned and justified using the properties defined in the Box Alignment specification. In CSS the block or column axis is the axis used when laying out blocks of text. If you have two paragraphs and are working in a right to left, top to bottom language they lay out one below the other, on the block axis. The inline or row axis runs across the Block Axis and is the direction along which regular text flows. These are our rows in CSS Grid Layout. The physical direction of these axes can change according to the writing mode of the document. ...
...o paragraphs and are working in a right to left, top to bottom language they lay out one below the other, on the block axis. The inline or row axis runs across the Block Axis and is the direction along which regular text flows. These are our rows in CSS Grid Layout. ...
...o bottom language they lay out one below the other, on the block axis. The inline or row axis runs across the Block Axis and is the direction along which regular text flows. These are our rows in CSS Grid Layout. The physical direction of these axes can change according to the writing mode of the document. ...
...n the block axis. The inline or row axis runs across the Block Axis and is the direction along which regular text flows. These are our rows in CSS Grid Layout. The physical direction of these axes can change according to the writing mode of the document. ...
Accessibility - Learn web development
We'll cover accessibility in special detail. Overview When someone describes a site as "accessible," they mean that any user can use all its features and content, regardless of how the user accesses the web -- even and especially users with physical or mental impairments. ...
...We'll cover accessibility in special detail. Overview When someone describes a site as "accessible," they mean that any user can use all its features and content, regardless of how the user accesses the web -- even and especially users with physical or mental impairments. ...
...ility issues on web pages. The following video provides a nice introduction to it: 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 To get the most out of this module, it would be a good idea to either work through at least the first two modules of the HTML, CSS, and JavaScript topics, or perhaps even better, work through the relevant parts of the accessibility module as you work through the related technology topics. Note: If you are working on a computer/tablet/other devices where you don't have the ability to create your own files, you can try out most of the code examples in an online coding program such as JSBin or Glitch. Guides What is acce...
...why, what tools different people use to interact with the web, and how we can make accessibility part of our web development workflow. HTML: A good basis for accessibility A great deal of web content can be made accessible just by making sure the correct HTML elements are always used for the correct purpose . This article looks in detail at how HTML can be used to ensure maximum accessibility. CSS and JavaScript accessibility best practices CSS and JavaScript, when used properly, also have the potential to allow for accessible web experiences, but if misused they can significantly harm accessibility. This article outlines some CSS and JavaScript best practices that should be considered to ensure that even complex content is as accessible as possible. WAI-ARIA basics Following on from th...
A cool-looking box - Learn web development
In this assessment, you'll get some more practice in creating cool-looking boxes by trying to create an eye-catching box. Prerequisites: 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. ...
... an eye-catching box. Prerequisites: 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...
... Styling the box We'd like you to style the provided <p>, giving it the following: A reasonable width for a large button, say around 200 pixels. A reasonable height for a large button, centering the text vertically in the process. Centered text. A slight increase in font size, to around 17-18 pixel computed style. Use rems. ...
... Styling the box We'd like you to style the provided <p>, giving it the following: A reasonable width for a large button, say around 200 pixels. A reasonable height for a large button, centering the text vertically in the process. Centered text. ...
Attribute selectors - Learn web development
Previous Overview: Building blocks Next As you know from your study of HTML, elements can have attributes that give further detail about the element being marked up. In CSS you can use attribute selectors to target elements with certain attributes. This lesson will show you how to use these very useful selectors. 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 what attribute selectors are and how to use them. Presence and value selectors These selectors enable the selection of an element based on the presence of an attribute alone (for example href), or on various different...
...ching in contexts where matching is normally case-insensitive, however this is less well supported in browsers and isn't very useful in an HTML context. Next steps Now we are done with attribute selectors, you can continue on to the next article and read about pseudo-class and pseudo-element selectors. ...
... pseudo-class and pseudo-element selectors. ...
...ew: Building blocks Next In this module Cascade and inheritance CSS selectors Type, class, and ID selectors Attribute selectors Pseudo-classes and pseudo-elements Combinators The box model Backgrounds and borders Handling different text directions Overflowing content Values and units Sizing items in CSS Images, media, and form elements Styling tables Debugging CSS Organizing your CSS ...
Test Your Skills: Fundamental layout comprehension - Learn web development
If you have worked through this module then you will have already covered the basics of what you need to know to do CSS layout today, and to work with older CSS as well. This task will test some of your knowledge by way of developing a simple webpage layout using a variety of techniques. 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. 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 ca...
... Save the HTML document and stylesheet into a directory on your computer, and add the images into a folder named images. ...
...aside> elements should display as a two column layout. The columns should be a flexible size so that if the browser window shrinks smaller the columns become narrower. The photographs should display as a two column grid with a 1 pixel gap between the images. You will not need to edit the HTML in order to achieve this layout and the techniques you should use are: Positioning Float Flexbox CSS Grid Layout There are a few ways in which you could achieve some of these tasks, and there often isn't a single right or wrong way to do things. Try a few different approaches and see which works best. Make notes as you experiment. Assessment or further help You can practice these examples in the Interactive Editors mentioned above. If you would like your work assessed, or are stuck and want...
...t an assessment. A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). ...
Multiple-column layout - Learn web development
Previous Overview: CSS layout Next The multiple-column layout specification gives you a method of laying content out in columns, as you might see in a newspaper. This article explains how to use this feature. Prerequisites: HTML basics (study Introduction to HTML), and an idea of How CSS works (study Introduction to CSS.) Objective: To learn how to create multiple-column layout on webpages, such as you might find in a newspaper. A basic example We will now explore how to use multiple-column layout, often referred to as multicol. You can follow along by downloading the multicol starting point file and adding the CSS into the appropriate places. At the bottom of the section you can see a live example of what the final code should look like. Our starti...
... Our starting 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 mul...
...onsectetur 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. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p> </div> .container { column-count: 3; } Change your CSS to use column-width as follows: .container { column-width: 200px; } The browser will now give you as many columns as it can of the size that you specify; any remaining space is then shared between the existing columns. This means that you will not get exactly the width that you specify, unless your container is exactly divisible by that width. column-width example body { width: 90%; ...
...et. Sed auctor cursus massa at porta. Integer ligula ipsum, tristique sit amet orci vel, viverra egestas ligula.</p> </div> </div> .container { column-width: 250px; column-gap: 20px; } .card { background-color: rgb(207, 232, 220); border: 2px solid rgb(79, 185, 227); padding: 10px; margin: 0 0 1em 0; } To control this behavior we can use properties from the CSS Fragmentation specification. This specification gives us properties to control breaking of content in multicol and in paged media. For example, add the property break-inside with a value of avoid to the rules for .card. This is the container of the heading and text, and therefore we do not want to fragment this box. At the present time it is also worth adding the older property page-break-inside...
What is a URL? - Learn web development
works on the Web. Summary With Hypertext and HTTP, URL is one of the key concepts of the Web. It is the mechanism used by browsers to retrieve any published resource on the web. URL stands for Uniform Resource Locator. A URL is nothing more than the address of a given unique resource on the Web. In theory, each valid URL points to a unique resource. Such resources can be an HTML page, a CSS document, an image, etc. In practice, there are some exceptions, the most common being a URL pointing to a resource that no longer exists or that has moved. As the resource represented by the URL and the URL itself are handled by the Web server, it is up to the owner of the web server to carefully manage that resource and its associated URL. Active Learning There is no active learning available...
... with the <iframe> element. Note: When specifying URLs to load resources as part of a page (such as when using the <script>, <audio>, <img>, <video>, and the like), you should generally only use HTTP and HTTPS URLs, with few exceptions (one notable one being data:; see Data URLs). Using FTP, for example, is not secure and is no longer supported by modern browsers. Other technologies, such as CSS or JavaScript, use URLs extensively, and these are really the heart of the Web. Absolute URLs vs relative URLs What we saw above is called an absolute URL, but there is also something called a relative URL. Let's examine what that distinction means in more detail. The required parts of a URL depend to a great extent on the context in which the URL is used. In your browser's address bar, a URL ...
...docs/Learn Sub-resources Skills/Infrastructure/Understanding_URLs Because that URL does not start with /, the browser will attempt to find the document in a sub-directory of the one containing the current resource. ...
... we really want to reach this URL: https://developer.mozilla.org/docs/Learn/Skills/Infrastructure/Understanding_URLs Going back in the directory tree ../CSS/display In this case, we use the ../ writing convention -- inherited from the UNIX file system world -- to tell the browser we want to go up from one directory. Here we want to reach this URL: https://developer.mozilla.org/docs/Learn/../CSS/display, which can be simplified to: https://developer.mozilla.org/docs/CSS/display Semantic URLs Despite their very technical flavor, URLs represent a human-readable entry point for a Web site. They can be memorized, and anyone can enter them into a browser's address bar. People are at the core of the Web, and so it is considered best practice to build what is called semantic URLs. Semantic...
Web forms — Working with user data - Learn web development
e 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 the HTML, CSS, and JavaScript topic areas -- form elements are more complex than most other HTML elements, and they also require a close marriage of related CSS and JavaScript techniques to get the most out of them. Note: If you are wo...
...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. Introductory guides Your first form The first article in our series provides your very first experience of creating a web form, including designing a simple form, implementing it using the right HTML elements, adding some very simple styling via CSS, and how data is sent to a server. How to structure a web form With the basics out of the way, we now look in more detail at the elements used to provide structure and meaning to the different parts of a form. The different form controls Basic native form controls We start off this section by looking at the functionality of the the original HTML <input> types in detail, looking at what op...
...5 was released, and the various UI controls and data collection enhancements they provide. Additionally, we look at the <output> element. Other form controls Next we take a look at all the non-<input> form controls and associated tools, 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. Validatin...
...how you'd do this and the considerations you need to be aware of when doing so, with a practical case study. Sending forms through JavaScript This article looks at ways to use a form to assemble an HTTP request and send it via custom JavaScript, rather than standard form submission. It also looks at why you'd want to do this, and the implications of doing so. (See also Using FormData objects.) CSS property compatibility table for form controls This last article provides a handy reference allowing you to look up what CSS properties are compatible with what form elements. ...
Getting started with HTML - Learn web development
m> or <strong>. Consider the following example: <em>first</em><em>second</em><em>third</em> <p>fourth</p><p>fifth</p><p>sixth</p> <em> is an inline element. As you see below, the first three elements sit on the same line, with no space in between. On the other hand, <p> is a block-level element. Each p element appears on a new line, with space above and below. (The spacing is due to default CSS styling that the browser applies to paragraphs.) Note: HTML5 redefined the element categories: see Element content categories. While these definitions are more accurate and less ambiguous than their predecessors, the new definitions are a lot more complicated to understand than block and inline. This article will stay with these two terms. Note: The terms block and inline, as used in this ...
... Note: HTML5 redefined the element categories: see Element content categories. While these definitions are more accurate and less ambiguous than their predecessors, the new definitions are a lot more complicated to understand than block and inline. This article will stay with these two terms. Note: The terms block and inline, as used in this article, should not be confused with the types of CSS boxes that have the same names. While the names correlate by default, changing the CSS display type doesn't change the category of the element, and doesn't affect which elements it can contain and which elements it can be contained in. One reason HTML5 dropped these terms was to prevent this rather common confusion. Note: Find useful reference pages that include lists of block and inline eleme...
...need to know! <html></html>: The <html> element. This element wraps all the content on the page. It is sometimes known as the root element. <head></head>: The <head> element. This element acts as a container for everything you want to include on the HTML page, that isn't the content the page will show to viewers. This includes keywords and a page description that would appear in search results, CSS to style content, character set declarations, and more. You'll learn more about this in the next article of the series. <meta charset="utf-8">: This element specifies the character set for your document to UTF-8, which includes most characters from the vast majority of human written languages. With this setting, the page can now handle any textual content it might contain. There is no reason not...
... point, you should understand what HTML looks like, and how it works at a basic level. You should also be able to write a few elements and attributes. The subsequent articles of this module go further on some of the topics introduced here, as well as presenting other concepts of the language. Note: As you start to learn more about HTML, consider learning the basics of Cascading Style Sheets, or CSS. CSS is the language used to style web pages. (for example, changing fonts or colors, or altering the page layout) HTML and CSS work well together, as you will soon discover. ...
Structuring a page of content - Learn web development
Prerequisites: Before attempting this assessment you should have already worked through the rest of the course, 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. ...
... course, 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 homep...
...ars below those two items. A main content area containing two columns -- a main block to contain the welcome text, and a sidebar to contain image thumbnails. A footer containing copyright information and credits. You need to add a suitable wrapper for: The header The navigation menu The main content The welcome text The image sidebar The footer You should also: Apply the provided CSS to the page by adding another <link> element just below the existing one provided at the start. Hints and tips Use the W3C Nu HTML Checker to catch unintended mistakes in your HTML, CSS, and SVG -- mistakes you might have otherwise missed -- so that you can fix them. You don't need to know any CSS to do this assessment; you just need to put the provided CSS inside an HTML element. The prov...
...he page by adding another <link> element just below the existing one provided at the start. Hints and tips Use the W3C Nu HTML Checker to catch unintended mistakes in your HTML, CSS, and SVG -- mistakes you might have otherwise missed -- so that you can fix them. You don't need to know any CSS to do this assessment; you just need to put the provided CSS inside an HTML element. The provided CSS is designed so that when the correct structural elements are added to the markup, they will appear green in the rendered page. If you are getting stuck and can't envisage what elements to put where, draw out a simple block diagram of the page layout, and write on the elements you think should wrap each block. This is extremely helpful. Example The following screenshot shows an example of what...
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
t to start the process off. At the end of the function block you call requestAnimationFrame() with the function reference passed as the parameter, and this instructs the browser to call the function again on the next display repaint. This is then run continuously, as the code is calling requestAnimationFrame() recursively. Note: If you want to perform some kind of simple constant DOM animation, CSS Animations are probably faster. They are calculated directly by the browser's internal code, rather than JavaScript. If, however, you are doing something more complex and involving objects that are not directly accessible inside the DOM (such as 2D Canvas API or WebGL objects), requestAnimationFrame() is the better option in most cases. How fast does your animation run? The smoothness of your...
...d to support older versions of IE, there is little reason to not use requestAnimationFrame(). A simple example Enough with the theory! Let's build your own personal requestAnimationFrame() example. You're going to create a simple "spinner animation"--the kind you might see displayed in an app when it is busy connecting to the server, etc. Note: In a real world example, you should probably use CSS animations to run this kind of simple animation. However, this kind of example is very useful to demonstrate requestAnimationFrame() usage, and you'd be more likely to use this kind of technique when doing something more complex such as updating the display of a game on each frame. Grab a basic HTML template (such as this one). Put an empty <div> element inside the <body>, then add a...
...tionFrame() usage, and you'd be more likely to use this kind of technique when doing something more complex such as updating the display of a game on each frame. Grab a basic HTML template (such as this one). Put an empty <div> element inside the <body>, then add a ? character inside it. This circular arrow character will act as our spinner for this example. Apply the following CSS to the HTML template (in whatever way you prefer). This sets a red background on the page, sets the <body> height to 100% of the <html> height, and centers the <div> inside the <body>, horizontally and vertically. html { background-color: white; height: 100%; } body { height: inherit; background-color: red; margin: 0; display: flex; justify-content: center; align-items: center...
... is pressed, a spinner like the one we saw earlier is displayed for a random amount of time between 5 and 10 seconds. After that time, a message will appear saying "PLAYERS GO!!" -- once this happens, the first player to press their control button will win the game. Let's work through this: First of all, download the starter file for the app. This contains the finished HTML structure and CSS styling, giving us a game board that shows the two players' information (as seen above), but with the spinner and results paragraph displayed on top of one another. You just have to write the JavaScript code. Inside the empty <script> element on your page, start by adding the following lines of code that define some constants and variables you'll need in the rest of the code: const spinn...
Build your own function - Learn web development
Previous Overview: Building blocks Next With most of the essential theory dealt with in the previous article, this article provides practical experience. Here you will get some practice building your own, custom function. Along the way, we'll also explain some useful details of dealing with functions. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, JavaScript first steps, Functions -- reusable blocks of code. Objective: To provide some practice in building a custom function, and explain a few more useful associated details. Active learning: Let's build a function The custom function we are going to build will be called displayMessage(). It will display a custom message box on a web page and will act as a customized repl...
...For function 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...
...ther 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 to do this as the element we created w...
...and a different background color. First of all, download the icons needed for this exercise (warning and chat) from GitHub. Save them in a new folder called icons in the same location as your HTML file. Note: The warning and chat icons were originally found on iconfinder.com, and designed by Nazarrudin Ansyari -- Thanks! (The actual icon pages were since moved or removed.) Next, find the CSS inside your HTML file. We'll make a few changes to make way for the icons. First, update the .msgBox width from: width: 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. A...
Image gallery - Learn web development
. Objective: To test comprehension of JavaScript loops, functions, conditionals, and events. Starting point To get this assessment started, you should go 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. ...
...point To get this assessment started, you should go 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. ...
... to write the necessary JavaScript to turn this into a working program. The HTML body looks like this: <h1>Image gallery example</h1> <div class="full-img"> <img class="displayed-img" src="images/pic1.jpg"> <div class="overlay"></div> <button class="dark">Darken</button> </div> <div class="thumb-bar"> </div> The example looks like this: The most interesting parts of the example's CSS file: It absolutely positions the three elements inside the full-img <div> -- the <img> in which the full-sized image is displayed, an empty <div> that is sized to be the same size as the <img> and put right over the top of it (this is used to apply a darkening effect to the image via a semi-transparent background color), and a <button> that is used to control the darkening effect. It sets th...
...e 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 include: A descriptive title such as "Assessment wanted for Image gallery". ...
Client-side storage - Learn web development
ke, getting you to build it up for yourself and explaining the most fundamental parts of IDB as we go along. The app looks something like this: Each note has a title and some body text, each individually editable. The JavaScript code we'll go through below has detailed comments to help you understand what's going on. Getting started First of all, make local copies of our index.html, style.css, and index-start.js files into a new directory on your local machine. Have a look at the files. You'll see that the HTML is pretty simple: a web site with a header and footer, as well as a main content area that contains a place to display notes, and a form for entering new notes into the database. The CSS provides some simple styling to make it clearer what is going on. The JavaScript file cont...
...document.createElement('source'); source2.src = webmURL; source2.type = 'video/webm'; ... } Offline asset storage The above example already shows how to create an app that will store large assets in an IndexedDB database, avoiding the need to download them more than once. This is already a great improvement to the user experience, but there is still one thing missing -- the main HTML, CSS, and JavaScript files still need to be downloaded each time the site is accessed, meaning that it won't work when there is no network connection. This is where Service workers and the closely-related Cache API come in. A service worker is a JavaScript file that, simply put, is registered against a particular origin (web site, or part of a web site at a certain domain) when it is accessed by a...
...upported in most modern browsers now. At the time of writing, Safari was still busy implementing it, but it should be there soon. A service worker example Let's look at an example, to give you a bit of an idea of what this might look like. We have created another version of the video store example we saw in the previous section -- this functions identically, except that it also saves the HTML, CSS, and JavaScript in the Cache API via a service worker, allowing the example to run offline! See IndexedDB video store with service worker running live, and also see the source code. Registering the service worker The first thing to note is that there's an extra bit of code placed in the main JavaScript file (see index.js). First we do a feature detection test to see if the serviceWorker member...
... Responding to further requests With the service worker registered and installed against our HTML page, and the relevant assets all added to our cache, we are nearly ready to go. There is only one more thing to do, write some code to respond to further network requests. This is what the second bit of code in sw.js does. We add anoth...
Web performance resources - Learn web development
e more information about each topic. Best practices Start with learning the critical rendering path of the browser. Knowing this will help you understand how to improve the performance of the site. Using resource hints such as rel=preconnect, rel=dns-prefetch, rel=prefetch, and rel=preload Keep the size of Javascript to a minimum. Only use as much Javascript as needed for the current page. CSS performance factors Use HTTP/2 on your server (or CDN). Use a CDN for resources which can reduce load times significantly. Compress your resources using gzip, Brotli, and Zopfli. Image optimization (use CSS animation, or SVG if possible). Lazy loading parts of your application outside the viewport. If you do, have a backup plan for SEO (e.g render full page for bot traffic); for example, by ...
...e optimization (use CSS animation, or SVG if possible). Lazy loading parts of your application outside the viewport. If you do, have a backup plan for SEO (e.g render full page for 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. As we learned in the critical rendering path document, linking CSS with a tradional 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 fo...
...eet" 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. <link rel="stylesheet" href="/path/to/my.css" media="print" onload="this.media='all'"> <noscript><link rel="stylesheet" href="/path/to/my.css"></noscript> The downside with this approach is the flash of unstyled text (FOUT.) The simplist way to address this is by inlining CSS that is required for any content that is rendered above the fold, or what you see in the browser viewport before scrolling. These styles will improve perceived perfo...
..." onload="this.media='all'"> <noscript><link rel="stylesheet" href="/path/to/my.css"></noscript> The downside with this approach is the flash of unstyled text (FOUT.) The simplist way to address this is by inlining CSS that is required for any content that is rendered above the fold, or what you see in the browser viewport before scrolling. These styles will improve perceived performance as the CSS does not require a file request. <style type="text/css"> // Insert your CSS here </style> Javascript Avoid Javascript blocking by using the async or defer attributes, or link javascript assets after the page's DOM elements. Javascript only block rendering for elements that appear after the script tag in the DOM tree. Web Fonts EOT and TTF formats are not compressed by default. Apply compres...
Web performance - Learn web development
Building websites requires HTML, CSS, and JavaScript. To build websites and applications people want to use, which attract and retain users, you need to create a good user experience. Part of good user experience is ensuring the content is quick to load and responsive to user interaction. This is known as web performance, and in this module you'll focus on the fundamentals of how to create performant websites. The rest of our beginner's learning material tried to stick to web best practices such as performance and accessibility as much as possible, however, it is good to focus specifically on such topics too, and make sure you are familiar with them. ...
...nown as web performance, and in this module you'll focus on the fundamentals of how to create performant websites. The rest of our beginner's learning material tried to stick to web best practices such as performance and accessibility as much as possible, however, it is good to focus specifically on such topics too, and make sure you are familiar with them. Learning pathway While knowing HTML, CSS, and JavaScript is needed for implementing many web performance improvement recommendations, knowing how to build applications is not a necessary pre-condition for understanding and measuring web performance. We do however recommend that before you work through this module, you at least get a basic idea of web development by working through our Getting started with the web module. It would also ...
...owing how to build applications is not a necessary pre-condition for understanding and measuring web performance. We do however recommend that before you work through this module, you at least get a basic idea of web development by working through our Getting started with the web module. It would also be helpful to go a bit deeper into these topics, with modules such as: Introduction to HTML CSS first steps JavaScript first steps Once you've worked through this module, you'll probably be excited to go deeper into web performance -- you can find a lot of further teachings in our main MDN Web performance section, including overviews of performance APIs, testing and analysis tools, and performance bottleneck gotchas. Guides This topic contains the following guides. The following is a s...
...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 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 ...
Properly configuring server MIME types - Learn web development
hich respect the MIME 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. ...
... to process content as expected even though the web server is misconfigured, e.g. displays an image which is reported to be plain text. Serving content using the correct MIME type can also be 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.
... 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 reported MIME type, web administrators a...
...r('Content-Type: text/html'); before any other output lines. For ASP, you should have the line response.ContentType = "text/html"; before any other output lines. For a Java servlet, you should have the line response.setContentType("text/html"); at the top of your doGet or doPost method, where response is a reference to the HttpServletResponse. ...
Ember app structure and componentization - Learn web development
Previous Overview: Client-side JavaScript frameworks Next In this article we'll get right on with planning out the structure of our TodoMVC Ember app, adding in the HTML for it, and then breaking that HTML structure into components. 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. 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 proje...
... 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}} <Wel...
... in the image) The mark-all-complete button, explicitly highlighted for reasons given below (yellow in the image) Each todo is an individual component (green in the image) The footer (blue in the image) Something odd to note is that the mark-all-complete checkbox (marked in yellow), while in the "main" section, is rendered next to the "new-todo" input. This is because the default CSS absolutely positions the checkbox + label with negative top and left values to move it next to the input, rather than it being inside the "main" section. Using the CLI to create our components for us So to represent our app, we want to create 4 components: Header List Individual Todo Footer To create a component, we use the ember generate component command, followed by the name of the...
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
Working with Svelte stores - Learn web development
ing with DOM nodes, and exposing component functionality. In this article we will show another way to handle state management in Svelte -- Stores. Stores are global global data repositories that hold values. Components can subscribe to stores and receive notifications when their values change. 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. Objective: Learn how to use Svelte stores Using stores we will create an Alert component that shows notifications on screen, which can receive messages from any component. In this case, the Alert component is indepe...
... the update of 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 com...
...lize the fly function is not being used and the bundle.js file size will drop down to just 18KB. This is just the tip of the iceberg. Svelte has lots of options for dealing with animations and transitions. Svelte also supports specifying different transitions to apply when the element is added or removed from the DOM with the in:fn/out:fn directives, and it also allows you to define your custom CSS and JavaScript transitions. It also has several easing functions to specify the rate of change over time. Have a look at the ease visualizer to explore the various ease functions available. The code so far Git To see the state of the code as it should be at the end of this article, access your copy of our repo like this: cd mdn-svelte-tutorial/07-next-steps Or directly download the folder's ...
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
Strategies for carrying out testing - Learn web development
Objective: To gain an understanding of the high-level concepts involved in cross-browser testing. Gotta test 'em all? When doing cross-browser testing, you need to work out a list of browsers you will need to test on to start with. There is no way you can test on every combination of brow...
...animate smoothly as it appears/disappears. The gradient and text shadow should appear to enhance the look of the box. You may notice from the text in the example that it won't work in IE8 -- this is a problem according to our support chart, which you'll have to work on, perhaps by using a feature detection library to implement the functionality in a different way if the browser doesn't support CSS transitions (see Implementing feature detection, later on in the course). You might also notice that the button isn't usable using only the keyboard -- this also needs to be remedied. Maybe we could use some JavaScript to implement a keyboard control for the toggle, or use some other method entirely? These test criteria are useful, because: They give you a set of steps to follow when you are...
...ut the need for a separate development server. An example is Django Waffle Flags. Summary After reading this article you should now have a good idea of what you can do to identify your target audience/target browser list, and then effectively carry out cross-browser testing on that list. Next we'll turn our attention to the actual code issues your testing might uncover, starting with HTML and CSS. ...
...fy your target audience/target browser list, and then effectively carry out cross-browser testing on that list. Next we'll turn our attention to the actual code issues your testing might uncover, starting with HTML and CSS. ...
Setting up your own test automation environment - Learn web development
testing In this article, we will teach you how to install your own automation environment and run your own tests using Selenium/WebDriver and a testing library such as selenium-webdriver for Node. We will also look at how to integrate your local testing environment with commercial tools like the ones discussed in the previous article. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages; an idea of the high-level principles of cross browser testing, and automated testing. Objective: To show how to set up a Selenium testing environment locally and run tests with it, and how to integrate it with tools like LambdaTest, Sauce Labs, and BrowserStack. Selenium Selenium is the most popular browser automation tool. There are other ways, but ...
... a specific element to test something about. You can select UI elements in many ways in WebDriver, including by ID, class, element name, etc. The actual selection is done by the findElement() method, which accepts as a parameter a selection method. For example, to select an element by ID: const element = driver.findElement(By.id('myElementId')); One of the most useful ways to find an element by CSS -- the By.css method allows you to select an element using a CSS selector Enter the following at the bottom of your quick_test.js code now: const button = driver.findElement(By.css('button:nth-of-type(1)')); Testing your element There are many ways to interact with your web documents and elements on them. You can see useful common examples starting at Getting text values on the WebDriver doc...
...n at Test Design Considerations. In general, you should make sure that your tests are: Using good locator strategies: When you are Interacting with the document, make sure that you use locators and page objects that are unlikely to change -- if you have a testable element that you want to perform a test on, make sure that it has a stable ID, or position on the page that can be selected using a CSS selector, which isn't going to just change with the next site iteration. You want to make your tests as non-brittle as possible, i.e. they won't just break when something changes. Write atomic tests: Each test should test one thing only, making it easy to keep track of what test file is testing which criterion. As an example, the google_test.js test we looked at above is pretty good, as it just ...
...automation then you can use Endtest. ...
Deploying our app - Learn web development
Previous Overview: Understanding client-side tools In the final article in our series, we take the example toolchain we built up in the previous article and add to it so that we can deploy our sample app. We push the code to GitHub, deploy it using Netlify, and even show you how to add a simple test into the process. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages. Objective: To finish working through our complete toolchain case study, focusing on deploying the app. Post development There's potentially a large range of problems to be solved in this section of the project's lifecycle. As such, it's important to create a toolchain that handles these problems in a way that requires as little manual intervention as possible. H...
...Our next step is to push the project to GitHub. Committing changes to GitHub T...
...Our next step is to push the project to GitHub. Committing changes to GitHub This section will get you over the line to storing ...
...of code still work when connected to another block?" Unit testing, where small and specific bits of functionality are tested to see if they do what they are supposed to do. And many more types. Also see our cross browser testing module for a bunch of useful testing information Remember also that tests are not limited to JavaScript; tests can be run against the rendered DOM, user interactions, CSS, and even how a page looks. However, for this project we're going to create a small test that will check the third-party NASA data feed and ensure it's in the correct format. If not, the test will fail and will prevent the project from going live. To do anything else would be beyond the scope of this module -- testing is a huge subject that really requires its own separate module. We are hoping ...
Gecko info for Windows accessibility vendors
upport, 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 SDK 1.3. (I re...
...ox 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, 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 fo...
...If a given node's get_nodeType method returns NODETYPE_DOCUMENT,...
...orms: XForms is the future of online forms as envisioned by the W3C. Drawing on other W3C standards like XML Schema, XPath, and XML Events, XForms tries to address some of the limitations with the current HTML forms model. One of the key features of XForms is accessibility. XUL: 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. In the future more standalone applications will use XUL via Xulrunner. Questions or Comments? Please contact the Mozilla Accessibility Community. ...
Contributing to the Mozilla code base
ject and we are thrilled to have contributors with very diverse skills Below is a table with our currently available projects to contribute to, along with the skills needs and links to their documentation. ...
...able with our currently available projects to contribute to, along with the skills needs and links to their documentation. ...
...he skills needs and links to their documentation. ...
...If getting involved in design, support, translation, testing, or other types of contributions sparks your interest please see community webiste. Perhaps you do not know programming yet, but you want to start learning? There are ...
overflow-clip-box-block
/* Keyword 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. ...
... This keyword makes the clipping be related to the padding box. content-box This keyword makes the clipping be related to the content box. ...
... ...
... ...
overflow-clip-box-inline
/* Keyword values */ 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. ...
... This keyword makes the clipping be related to the padding box. content-box This keyword makes the clipping be related to the content box. ...
... ...
... ...
overflow-clip-box
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 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. /* Keyword values */ overflow-clip-box: padding-box; overflow-clip-box: content-box; /* Two values */ overflow-clip-box: padding-box content-box; overflow-clip-box: content-box content-box; /* Global values */ overflow-clip-box: inherit; overflow-clip-box: initial; overflow-clip-box: unset; No...
...his keyword makes the clipping be related to the padding box. content-box This keyword makes the clipping be related to the content box. ...
... ...
... ...
Fonts for Mozilla 2.0's MathML engine
forms where the instructions above do not work: install the MathML-fonts add-on. This requires Gecko 15.0 (Firefox 15.0 / Thunderbird 15.0 / SeaMonkey 2.12) or higher. Overview Mathematical formulas make use of various symbols represented by specific Unicode characters. Mozilla can display any of these symbols provided suitable Unicode fonts are installed. Furthermore, in accordance with the W3C CSS2 recommendation on fonts, authors can specify an ordered list of particular fonts which they prefer (using the font-family property of CSS), with the assurance that Mozilla's font engine will hunt for alternate fonts whenever their specified fonts are not found on a particular user's system. If no appropriate font is ultimately found for a given character, Mozilla will instead display a box conta...
...is on systems without the associated product. Reset old preferences If users have previously changed the "font.mathfont-family" preference for a previous version of Mozilla, then it is best to reset this to the default value. To do this, enter the URL "about:config", "Filter" for "mathfont", and "Reset" to the default value through the context menu on the preference. ...
...tch 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 u...
... ...
Midas
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 inserts a...
...ll 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 for subse...
... ...
...k If the insertion point is 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. ...
Gecko object attributes
ject. 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,...
...essibleTableCell instead. Applied to ROLE_CELL Hypertext attributes formatting "block" if the object uses block formatting, and thus starts on a new line and ends with a hard line break that is not visible in the actual text. For example, a heading, paragraph, or list item is typically formatted as a block, but there is no requirement to do so. Their formatting may have been changed with CSS. An example of this is often horizontal navigation bars with list items that are formatted with CSS display: inline. Applied to: any object that supports the hypertext interface Note: deprecated, use display attribute instead line-number The current line number of the caret, whether simply because the "browse with caret" option is on, or the caret used for editing text. The line number is rel...
...the "browse with caret" option is on, or the caret used for editing text. The line number is relative to the top of the currently focused area (the document, a rich text editable area, or an input control). Applied to: any focusable accessible text object margin-bottom Specifies how much vertical space there will be after the bottom of the last line of content in a text accessible (see the CSS margin-bottom property). margin-left Specifies how much horizontal space there will be before the beginning of each line of content in a text accessible (see the CSS margin-left property). margin-right Specifies how much horizontal space there will be after the end of each line of content in a text accessible (see the CSS margin-right property). margin-top Specifies how much vertical spa...
...before the beginning of each line of content in a text accessible (see the CSS margin-left property). margin-right Specifies how much horizontal space there will be after the end of each line of content in a text accessible (see the CSS margin-right property). margin-top Specifies how much vertical space there will be before the top of the first line of content in a text accessible (see the CSS margin-top property). text-align Specifies how lines of text are aligned with each other (see CSS text-align property). text-indent Specifies how much horizontal space should be left before beginning of the first line of the text content of an text accessible (see the CSS text-indent property). Value attributes valuetext A text equivalent to the current value, such as "High" in a slider...
nsIHTMLEditor
ntentFilter inFilter); void removeList(in AString aListType); void replaceHeadContentsWithHTML(in AString aSourceToInsert); void selectElement(in nsIDOMElement aElement); void setBackgroundColor(in AString aColor); void setBodyAttribute(in AString aAttr, in AString aValue); void setCaretAfterElement(in nsIDOMElement aElement); void setCSSInlineProperty(in nsIAtom aProperty, in AString aAttribute, in AString aValue); void setDocumentTitle(in AString aTitle); void setInlineProperty(in nsIAtom aProperty, in AString aAttribute, in AString aValue); void setParagraphFormat(in AString aParagraphFormat); void updateBaseURL(); Attributes Attribute Type Description isCSSEna...
... void setDocumentTitle(in AString aTitle); void setInlineProperty(in nsIAtom aProperty, in AString aAttribute, in AString aValue); void setParagraphFormat(in AString aParagraphFormat); void updateBaseURL(); Attributes Attribute Type Description isCSSEnabled boolean A boolean which is true is the HTMLEditor has been instantiated with CSS knowledge and if the CSS pref is currently checked. 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 ...
...ment() boolean isAnonymousElement( in nsIDOMElement aElement ); Parameters aElement Return value makeOrChangeList() void makeOrChangeList( in AString aListType, in boolean entireList, in AString aBulletType ); Parameters aListType 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() Rebui...
...of the attribute. setCaretAfterElement() Create a collapsed selection just after aElement. The selection is set to parent-of-aElement with an offset 1 greater than aElement's offset but it enforces the HTML 4.0 DTD "CanContain" rules, so it should be useful for other elements. void setCaretAfterElement( in nsIDOMElement aElement ); Parameters aElement An element in the document. setCSSInlineProperty() SetInlineProperty() sets the aggregate properties on the current selection. void setCSSInlineProperty( in nsIAtom aProperty, in AString aAttribute, in AString aValue ); Parameters aProperty The property to set on the selection. aAttribute The attribute of the property, if applicable. May be null. Example: aProperty="font", aAttribute="color" aValue If aAttribute ...
Mozilla
a that software (among other things) should be designed to be usable and, as much as possible, 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 cov...
...atabase)' pulldown, click 'Go', select one of the tables listed in the left column and see the current contents of the database in the 'Browse & Search' tab.) Gecko Gecko is the name of the layout engine developed by the Mozilla Project. It was originally named NGLayout. Gecko's function is to render web content, such as HTML, CSS, XUL, JavaScript, and render it on the user's screen or print it. In XUL-based applications Gecko also renders the application's user interface. Gecko's "Almost Standards" Mode "Almost standards" rendering mode is exactly the same as "standards" mode in all details save one, where it works like "quirks" mode: the height calculations for l...
...s two separate representations of a document in memory: the content tree and the frame tree. Changes to a document originate in the content tree (from DOM modification by scripting, insertion of elements from the parser, etc.) and are propogated to the layout tree through magic that primarily resides in //github.com/RealityRipple/UXP/blob/master/layout/base/nsCSSFrameConstructor.cpp Getting Started with Chat Note that on 2nd March 2020, Mozilla moved away from IRC to Matrix for its public channels, the IRC server was shut down. Git Moved here: https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html Hacking with Bonsai ...
... 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 t...
Plug-in Basics - Plugins
is created by using the hidden attribute of the embed element. Here's an example: <embed src="audiplay.aiff" type="audio/x-aiff" hidden="true"> Note: Whether a plug-in is windowed or windowless is not meaningful if the plug-in is invoked with the hidden attribute. You can also create hidden plug-ins using the object element. ...
...ortant; 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="audio/x-aiff" class="hiddenObject"></object> A full-page plug-in is a visible plug-in that is not part of an HTML page. The server looks for the media (MIME) type registered by a plug-in, based on the file extension, and starts sending the file to the browser. Gecko looks u...
...ion 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. ...
...ting with JavaScript. For example, this embed element loads a picture with the imaginary data type dgs: <embed src="mypic.dgs" width="320" height="200" border="25" align="right"> Gecko interprets the attributes as follows: src: Load the data file and determine the MIME type of the data. width and height: Set the area of the page handled by the plug-in to 320 by 200 pixels. In general, use CSS to control the size and location of elements within an HTML page. border: Draw a border 25 pixels wide around the plug-in. align: Align the plug-in at the right side of the web page. The following example shows an embed element nested within an object element, which is necessary for browsers that do not support the embed element. Example 2: embed within object <object classid="clsid:D27CDB6...
Page inspector 3-pane mode - Firefox Developer Tools
This article explains 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. ...
... This article explains 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. ...
...ed, 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. The other CSS related features -- such as Computed styles view, Animations view, and Fonts view -- in tabs on the right hand side, as usual. Note: At narrower browser window widths, the tabs appear below the CSS Rules pane. Having the CSS Rules in their own pane is very useful because it allows you to not only inspect your HTML and edit the CSS applied to it, but also see the effect this has on CSS features such as computed styles and grids in real time. 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 ...
...es such as computed styles and grids in real time. 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. With the 3-pane mode enabled, you can observe live changes in CSS features as you edit the rules applied to the page. For example, you could edit a CSS Grid property and observe the change immediately in the Grid Inspector. Enabling the 3-pane inspector pre-Firefox 62 In earlier versions of Firefox (since Firefox 59/60), you can enable 3 pane mode in Release/Beta by going to about:config and flipping the following prefs to true: devtools.inspector.split-ru...
Web Console remoting - Firefox Developer Tools
cache and should clear the page errors cache - see bug 717611. Network logging The networkEvent packet Whenever a new network request starts being logged the networkEvent packet is sent: { "from": "conn0.console10", "type": "networkEvent", "eventActor": { "actor": "conn0.netEvent14", "startedDateTime": "2012-09-17T19:50:03.699Z", "url": "http://localhost/~mihai/mozilla/test2.css", "method": "GET" "isXHR": false, "private": false } } This packet is used to inform the Web Console of a new network event. For each request a new NetworkEventActor instance is created. The isXHR flag indicates if the request was initiated via an XMLHttpRequest instance, that is: the nsIHttpChannel's notification is of an nsIXMLHttpRequest interface. The private flag tells if th...
... The getRequestHeaders and other packets To get more details about a network event you can use the following packet requests (and replies). The getRequestHeaders packet: { "to": "conn0.netEvent15", "type": "getRequestHeaders" } { "from": "conn0.netEvent15", "headers": [ { ...
...using too much of the network bandwidth. The getRequestPostData packet: { "to": "conn0.netEvent15", "type": "getRequestPostData" } { "from": "conn0.netEvent15", "postData": { text: "foobar" }, "postDataDiscarded": false } The getResponseContent packet: { "to": "conn0.netEvent15", "type": "getResponseContent" } { "from": "conn0.netEvent15", "content": { "mimeType": "text/css", "text": "\n@import \"test.css\";\n\n.foobar { color: green }\n\n" }, "contentDiscarded": false } The request and response content text value is most commonly sent using a LongStringActor grip. For very short request/response bodies we send the raw text. Starting with Firefox 19: for non-text response types we send the content in base64 encoding (again, most likely a LongStringActor ...
... Firefox 19: bug 787981 - added LongStringActor usage in several places. Firefox 20: bug 792062 - removed locationChanged packet and updated the tabNavigated packet for tab actors. Firefox 23: bug 783499 - removed the WebConsoleObjectActor. Now the Web Console uses the JavaScript debugger API and the ObjectActor.
CanvasRenderingContext2D.drawImage() - Web APIs
f the Canvas 2D API provides different ways to draw an image onto the canvas. Syntax void ctx.drawImage(image, dx, dy); void ctx.drawImage(image, dx, dy, dWidth, dHeight); void ctx.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight); Parameters image An element to draw into the context. The specification permits any canvas image source (CanvasImageSource), specifically, a CSSImageValue, an HTMLImageElement, an SVGImageElement, an HTMLVideoElement, an HTMLCanvasElement, an ImageBitmap, or an OffscreenCanvas. sx Optional The x-axis coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context. sy Optional The y-axis coordinate of the top left corner of the sub-rectangle of the source image to draw into the destinatio...
...it is given a width of 87 and a height of 104. const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); const image = document.getElementById('source'); image.addEventListener('load', e => { ctx.drawImage(image, 33, 71, 104, 124, 21, 20, 87, 104); }); Result Understanding source element size The drawImage() method uses the source element's intrinsic size in CSS pixels when drawing. For example, if you load an Image and specify the optional size parameters in its constructor, you will have to use the naturalWidth and naturalHeight properties of the created instance to properly calculate things like crop and scale regions, rather than element.width and element.height. The same goes for videoWidth and videoHeight if the element is a <video> element, and s...
...oes for videoWidth and videoHeight if the element is a <video> element, and so on. ...
....getElementById('canvas'); const ctx = canvas.getContext('2d'); const image = new Image(60, 45); // Using optional size for image image.onload = drawImageActualSize; // Draw when image has loaded // Load an image of intrinsic size 300x227 in CSS pixels image.src = 'https://udn.realityripple.com/samples/db/f374e9c6fc.jpg'; function drawImageActualSize() { // Use the intrinsic size of image in CSS pixels for the canvas element canvas.width = this.naturalWidth; canvas.height = this.naturalHeight; // Will draw the image as 300x227, ignoring the custom size of 60x45 // given in the constructor ctx.drawImage(this, 0, 0); // To use the custom size we'll have to specify the scale parameters // using the element's width and height properties - lets draw one // on top in the corn...
Document.mozSetImageElement() - Web APIs
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. ...
... 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. ...
...e 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.setAttribute("width", 10...
... and height set to 100 pixels, then draws into it a 50 by 50 pixel square. Each time the function is called, the square is a different color (its red component is increased each time), so each time the user clicks the element, the background is filled with a brighter and brighter pattern of red tiles. Once the canvas is drawn, document.mozSetImageElement() is called to set the background for any CSS using the ID "canvasbg" as its background element ID to be our new canvas. Specifications Not part of any specification. ...
Document.querySelector() - Web APIs
eturned. Note: The matching is done using depth-first pre-order traversal of the document's nodes starting with the first element in the document's markup and iterating through sequential nodes by order of the number of child nodes. Syntax element = document.querySelector(selectors); Parameters selectors A DOMString containing one or more selectors to match. This string must be a valid CSS selector string; if it isn't, a SYNTAX_ERR exception is thrown. See Locating DOM elements using selectors for more about selectors and how to manage them. Note: Characters that are not part of standard CSS syntax must be escaped using a backslash character. Since JavaScript also uses backslash escaping, be especially careful when writing string literals using these characters. See Escaping spe...
... If you need a list of all elements matching the specified selectors, you should use querySelectorAll() instead. Exceptions SYNTAX_ERR The syntax of the specified selectors is invalid. ...
...ectors, or null is returned if there are no matches. If you need a list of all elements matching the specified selectors, you should use querySelectorAll() instead. Exceptions SYNTAX_ERR The syntax of the specified selectors is invalid. Usage notes If the specified selector matches an ID that is incorrectly used more than once in the document, the first element with that ID is returned. CSS pseudo-elements will never return any elements, as specified in the Selectors API. Escaping special characters To match against an ID or selectors that do not follow standard CSS syntax (by using a colon or space inappropriately, for example), you must escape the character with a backslash ("\"). As the backslash is also an escape character in JavaScript, if you are entering a literal string, y...
... A more complex selector Selectors can also be really powerful, as demonstrated in the following example. Here, the first <input> element with the name "login" (<input name="login"/>) located inside a <div> whose class is "user-panel main" (<div class="user-panel main">) in the document is returned: var el = document.querySelector("div.user-panel.main input[name='login']"); Negation As all CSS selector strings are valid, you can also negate selectors: var el = document.querySelector("div.user-panel:not(.main) input[name='login']"); This will select an input with a parent div with the user-panel class but not the main class. Specifications Specification Status Comment DOMThe definition of 'document.querySelector()' in that specification. Living Standar...
Element - Web APIs
Web › API › Element
turns 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 active on the element. Element.getAttribute() Retrieves the value of the named attribute from the current ...
...rtAdjacentHTML() Parses the text as HTML or XML and inserts the resulting nodes into the tree in the position given. Element.insertAdjacentText() Inserts a given text node at a given position relative to the element it is invoked upon. Element.matches() Returns a Boolean indicating whether or not the element would be selected by the specified selector string. Element.pseudo() Returns a CSSPseudoElement representing the child pseudo-element matched by the specified pseudo-element selector. Element.querySelector() Returns the first Node which matches the specified selector string relative to the element. Element.querySelectorAll() Returns a NodeList of nodes which match the specified selector string relative to the element. Element.releasePointerCapture() Releases (stops) point...
... from the touch surface. Also available via the ontouchend property touchmove Fired when one or more touch points are moved along the touch surface. Also available via the ontouchmove property touchstart Fired when one or more touch points are placed on the touch surface. Also available via the ontouchstart property Specifications Specification Status Comment CSS Pseudo-Elements Level 4The definition of 'Element' in that specification. Working Draft Added the pseudo() method. Web Animations Working Draft Added the getAnimations() method. UndoManager and DOMTransactionThe definition of 'Element' in that specification. Editor's Draft Added the undoScope and undoManager properties. Pointer Events - Level 2The defi...
...ed the requestPointerLock() method. Fullscreen APIThe definition of 'Element' in that specification. Living Standard Added the requestFullscreen() method. DOM Parsing and SerializationThe definition of 'Element' in that specification. Working Draft Added the following properties: innerHTML, and outerHTML. Added the following method: insertAdjacentHTML(). CSS Object Model (CSSOM) View ModuleThe definition of 'Element' in that specification. Working Draft Added the following properties: scrollTop, scrollLeft, scrollWidth, scrollHeight, clientTop, clientLeft, clientWidth, and clientHeight. Added the following methods: getClientRects(), getBoundingClientRect(), scroll(), scrollBy(), scrollTo() and scrollIntoView(). Element Traversal Sp...
Using files from web applications - Web APIs
, a <label> element can be used. Note that in this case the input element must not be hidden using display: none (nor visibility: hidden), otherwise the label would not be keyboard-accessible. Use the visually-hidden technique instead. ...
...t will be displayed. const reader = new FileReader(); reader.onload = (function(aImg) { return function(e) { aImg.src = e.target.result; }; })(img); reader.readAsDataURL(file); } } Here our loop handling the user-selected files looks at each file's type attribute to see if its MIME type begins with the string "image/"). For each file that is an image, we create a new img element. CSS can be used to establish any pretty borders or shadows and to specify the size of the image, so that doesn't need to be done here. Each image has the CSS class obj added to it, making it easy to find in the DOM tree. We also add a file attribute to each image specifying the File for the image; this will let us fetch the images for actual upload later. We use Node.appendChild() to add the new thu...
... above: Example: Uploading a user-selected file Another thing you might want to do is let the user upload the selected file or files (such as the images selected using the previous example) to a server. This can be done asynchronously very easily. Creating the upload tasks Continuing with the code that built the thumbnails in the previous example, recall that every thumbnail image is in the CSS class obj with the corresponding File attached in a file attribute. This allows us to select all of the images the user has chosen for uploading using Document.querySelectorAll(), like this: function sendFiles() { const imgs = document.querySelectorAll(".obj"); for (let i = 0; i < imgs.length; i++) { new FileUpload(imgs[i], imgs[i].file); } } Line 2 fetches a NodeList, called imgs, ...
...ed in a file attribute. This allows us to select all of the images the user has chosen for uploading using Document.querySelectorAll(), like this: function sendFiles() { const imgs = document.querySelectorAll(".obj"); for (let i = 0; i < imgs.length; i++) { new FileUpload(imgs[i], imgs[i].file); } } Line 2 fetches a NodeList, called imgs, of all the elements in the document with the CSS class obj. In our case, these will be all of the image thumbnails. Once we have that list, it's trivial to go through it and create a new FileUpload instance for each. Each of these handles uploading the corresponding file. Handling the upload process for a file The FileUpload function accepts two inputs: an image element and a file from which to read the image data. function FileUpload(img, f...
GlobalEventHandlers.onanimationiteration - Web APIs
The onanimationiteration property of the GlobalEventHandlers mixin is the EventHandler for processing animationiteration events. The animationiteration event is sent when a CSS animation reaches the end of an iteration. An iteration ends when a single pass through the sequence of animation instructions is completed by executing the last animation step. Syntax var animIterationHandler = target.onanimationiteration; target.onanimationiteration = Function Value A Function to be called when an animationiteration event occurs indicating that a CSS animation has reached the end of an iteration while running on the target, where the target object is an HTML element (HTMLElement), document (Document), or window (Window). The function receives as input a single parameter: an Animatio...
...s create an animation which automatically pauses at the end of each iteration, allowing the user to choose whether or not to start the next iteration. Much of this code is the same as in other examples of animation events, so it may look familiar. ...
...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); he...
...ox 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 next iteration. Specification Specification Status Comment CSS AnimationsThe definition of 'onanimationiteration' in that specification. Working Draft ...
GlobalEventHandlers.ontransitioncancel - Web APIs
The ontransitioncancel property of the GlobalEventHandlers mixin is an EventHandler that processes transitioncancel events. The transitioncancel event is sent when a CSS transition is cancelled. The transition is cancelled when: The value of the transition-property property that applies to the target is changed The display property is set to "none". The transition is stopped before it has run to completion, e.g. by moving the mouse off a hover-transitioning element. ...
...property that applies to the target is changed The display property is set to "none". The transition is stopped before it has run to completion, e.g. by moving the mouse off a hover-transitioning element. Syntax var transitionCancelHandler = target.ontransitioncancel; target.ontransitioncancel = Function Value A Function to be called when a transitioncancel event occurs indicating that a CSS transition has been cancelled on the target, where the target object is an HTML element (HTMLElement), document (Document), or window (Window). The function receives as input a single parameter: a TransitionEvent object describing the event which occurred; the event's TransitionEvent.elapsedTime property's value should be the same as the value of transition-duration. Note: elapsedTime does not ...
...o 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. 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. .box { margin-left: 70px; margin-top: 30px; border-style: solid; border-width: 1px; display: block; width: 100px;...
... Working Draft ...
GlobalEventHandlers.ontransitionend - Web APIs
The ontransitionend property of the GlobalEventHandlers mixin is an EventHandler that processes transitionend events. The transitionend event is sent to when a CSS transition completes. If the transition is removed from its target node before the transition completes execution, the transitionend event won't be generated. One way this can happen is by changing the value of the transition-property attribute which applies to the target. Another is if the display attribute is set to none. ...
...cution, the transitionend event won't be generated. One way this can happen is by changing the value of the transition-property attribute which applies to the target. Another is if the display attribute is set to none. Syntax var transitionEndHandler = target.ontransitionend; target.ontransitionend = Function Value A Function to be called when a transitionend event occurs indicating that a CSS transition has completed on the target, where the target object is an HTML element (HTMLElement), document (Document), or window (Window). The function receives as input a single parameter: a TransitionEvent object describing the event which occurred; the event's TransitionEvent.elapsedTime property's value should be the same as the value of transition-duration. elapsedTime does not include tim...
...ich 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. 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. .box { margin-left: 70px; margin-top: 30px; border-style: solid; border-width: 1px; display: block; width: 100px;...
...s. let box = document.querySelector(".box"); box.ontransitionrun = function(event) { box.innerHTML = "Zooming..."; } box.ontransitionend = function(event) { box.innerHTML = "Done!"; } Result The resulting content looks like this: Notice what happens when you hover your mouse cursor over the box, then move it away. Specification Specification Status Comment CSS TransitionsThe definition of 'ontransitionend' in that specification. Working Draft ...
GlobalEventHandlers - Web APIs
dlers are defined on the GlobalEventHandlers mixin, and implemented by HTMLElement, Document, Window, as well as by WorkerGlobalScope for Web Workers. GlobalEventHandlers.onabort Is an EventHandler representing the code to be called when the abort event is raised. GlobalEventHandlers.onanimationcancel An EventHandler called when an animationcancel event is sent, indicating that a running CSS animation has been canceled. GlobalEventHandlers.onanimationend An EventHandler called when an animationend event is sent, indicating that a CSS animation has stopped playing. GlobalEventHandlers.onanimationiteration An EventHandler called when an animationiteration event has been sent, indicating that a CSS animation has begun playing a new iteration of the animation sequence. GlobalEve...
... GlobalEventHandlers.onauxclick An EventHandler called when an auxclick event is sent, indicating that a non-primary button has been pressed on an input device (e.g. a middle mouse button). GlobalEventHandlers.onblur Is an EventHandler representing the code to be called when the blur event is raised. ...
...end event is raised. GlobalEventHandlers.ontouchmove Is an EventHandler representing the code to be called when the touchmove event is raised. GlobalEventHandlers.ontouchstart Is an EventHandler representing the code to be called when the touchstart event is raised. GlobalEventHandlers.ontransitioncancel An EventHandler called when a transitioncancel event is sent, indicating that a CSS transition has been cancelled. GlobalEventHandlers.ontransitionend An EventHandler called when a transitionend event is sent, indicating that a CSS transition has finished playing. GlobalEventHandlers.ontransitionrun An EventHandler called when a transitionrun event is sent, indicating that a CSS transition is running, though not nessarilty started. GlobalEventHandlers.ontransitionstart An ...
... GlobalEventHandlers.onwaiting Is an EventHandler representing the code to be called when the waiting event is raised. Methods This interface defines no methods. ...
HTMLElement: animationcancel event - Web APIs
Therefore, either directly or because any of its containing nodes are hidden. An event handler for this event can be added by setting the onanimationcancel property, or using addEventListener(). ...
...Therefore, either directly or because any of its containing nodes are hidden. An event handler for this event can be added by setting the onanimationcancel property, or using addEventListener(). ...
...ed'); 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 solid black; margin: 0.2rem; padding: 0.2rem; } .animation.active { animation-duration: 2s; animation-name: slidein; animation-iteration-count: 2; } @keyframes slidein { from { transform: translateX(100%) scaleX(3); } to { transform: translateX(0) scaleX(1); } } JS const anim...
...'click', () => { animation.classList.toggle('active'); animationEventLog.textContent = ''; iterationCount = 0; let active = animation.classList.contains('active'); if (active) { applyAnimation.textContent = "Cancel animation"; } else { applyAnimation.textContent = "Activate animation"; } }); Result Specifications Specification Status Comment CSS Animations Working Draft Initial definition ...
HTMLImageElement.x - Web APIs
e row) element's cells property to get a list of the cells in that row. The third cell is taken from that row (once again, specifying 2 as the zero-based offset). From there, we can get the <img> element itself from the cell by calling querySelector() on the HTMLTableCellElement representing that cell. Finally, we can look up and display the values of the HTMLImageElement's x and y properties. ...
...ement's cells property to get a list of the cells in that row. The third cell is taken from that row (once again, specifying 2 as the zero-based offset). From there, we can get the <img> element itself from the cell by calling querySelector() on the HTMLTableCellElement representing that cell. Finally, we can look up and display the values of the HTMLImageElement's x and y properties. ...
... Working Draft 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. DesktopMobileChromeEdgeFirefoxInternet ExplorerOpera...
... Working Draft 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. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webv...
HTMLImageElement.y - Web APIs
e row) element's cells property to get a list of the cells in that row. The third cell is taken from that row (once again, specifying 2 as the zero-based offset). From there, we can get the <img> element itself from the cell by calling querySelector() on the HTMLTableCellElement representing that cell. Finally, we can look up and display the values of the HTMLImageElement's x and y properties. ...
...ement's cells property to get a list of the cells in that row. The third cell is taken from that row (once again, specifying 2 as the zero-based offset). From there, we can get the <img> element itself from the cell by calling querySelector() on the HTMLTableCellElement representing that cell. Finally, we can look up and display the values of the HTMLImageElement's x and y properties. ...
... Working Draft 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. DesktopMobileChromeEdgeFirefoxInternet ExplorerOpera...
... Working Draft 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. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webv...
Timing element visibility with the Intersection Observer API - Web APIs
evenues. Without 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. ...
...l> </nav> </aside> <main> </main> </div> This is the framework for the entire site. At the 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-co...
...s: auto minmax(min-content, 1fr); max-width: 700px; margin: 0 auto; background-color: aliceblue; } The site's <body> is configured here to use one of a number of common sans-serif fonts, and to use "aliceblue" as the background color. Then the "wrapper" class is defined; it wraps the entire blog, including the header, sidebar, and body content (articles and ads). The wrapper establishes a CSS grid with two columns and two rows. The first column (sized automatically based on its content) is used for the sidebar and the second column (which will be used for body content) is sized to be at least the width of the contents of the column and at most all remaining available space. The first row will be used specially for the site header. The rows are sized the same way as the columns: the f...
...rder-color: #555; border-style: solid; border-width: 1px; } .ad:not(:last-child) { margin-bottom: 8px; } .ad h2 { margin-top: 0; } .ad div { position: relative; float: right; padding: 0 4px; height: 20px; width: 120px; font-size: 14px; bottom: 30px; border: 1px solid black; background-color: rgba(255, 255, 255, 0.5); } There's nothing magic in here. It's fairly basic CSS. Tying it together with JavaScript That brings us to the JavaScript code which makes everything work. Let's start with the global variables: let contentBox; let nextArticleID = 1; let visibleAds = new Set(); let previouslyVisibleAds = null; let adObserver; let refreshIntervalID = 0; These are used as follows: contentBox A reference to the <main> element's HTMLElement object in the DOM. ...
Using the MediaStream Recording API - Web APIs
To demonstrate basic usage of the MediaRecorder API, we have built a web-based dictaphone. It allows you to record snippets of audio and then play them back. It even gives you a visualization of your device's sound input, using the Web Audio API. We'll concentrate on the recording and playback functionality for this article. You can see this demo running live, or grab the source code on GitHub. CSS goodies The HTML is pretty simple in this app, so we won't go through it here; there are a couple of slightly more interesting bits of CSS worth mentioning, however, so we'll discuss them below. If you are not interested in CSS and want to get straight to the JavaScript, skip to the Basic app setup section. Keeping the interface constrained to the viewport, regardless of device height, with cal...
... For example, in Web Dictaphone we have three main UI areas, stacked vertically. ...
... For example, in Web Dictaphone we have three main UI areas, stacked vertically. ...
... For example, in Web Dictaphone we have three main UI areas, stacked vertically. ...
PaintWorklet.registerPaint - Web APIs
The PaintWorklet.registerPaint() method of the PaintWorklet interface registers a class programmatically generate an image where a CSS property expects a file. Syntax registerPaint(name, class); Parameters name The name of the worklet class to register. class A reference to the class that implements the worklet. Return value undefined Exceptions TypeError Thrown when one of the arguments is invalid or missing. InvalidModificationError Thrown when the a worklet already exists with the specified name. Examples The following shows registering an example worklet module. This should be in a separate js file. ...
...ndefined Exceptions TypeError Thrown when one of the arguments is invalid or missing. InvalidModificationError Thrown when the a worklet already exists with the specified name. Examples The following shows registering an example worklet module. This should be in a separate js file. Note that registerPaint() is called without a reference to PaintWorklet. The file itself is loaded through CSS.paintWorklet.addModule() (documented here on the parent class of PaintWorklet, at Worklet.addModule(). /* 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++)...
... 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. ...
...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> CSS.paintWorklet.addModule('checkboardWorklet.js'); </script> You can then use the paint() CSS function in your CSS anywhere an <image> value is valid. li { background-image: paint(checkerboard); } Specifications Specification Status Comment CSS Painting API Level 1The definition of 'PaintWorklet.registerPaint' in that specification. Working Draft Initial definiti...
Screen.availHeight - Web APIs
This can be no larger than the value of window.screen.height, and will be less if the device or user agent reserves any vertical space for itself. ...
...able for Web content on the screen. Since Screen is exposed on the Window interface's window.screen property, you access availHeight using window.screen.availHeight. You can similarly use Screen.availWidth to get the number of pixels which are horizontally available to the browser for its use. ...
... Example If your web application needs to open a new window, such as a tool palette which can contain multiple panels, and wants to position it so that it occupies the entire vertical space available, you can do so using code similar to what's seen here. ...
...to the below. Note the Panels window filling all available vertical space at the left of the screen. On a Windows system, this would function similarly, by opening the window and sizing it vertically so it uses all available vertical space, leaving room for the taskbar and any other interface elements that reserve space. Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Screen.availHeight' in that specification. Working Draft Initial definition. ...
VisualViewport - Web APIs
that's useful. For an <iframe>, visual viewport metrics like VisualViewport.width always correspond to layout viewport metrics like document.documentElement.clientWidth. Properties VisualViewport also inherits properties from its parent, EventTarget. VisualViewport.offsetLeft Read only Returns the offset of the left edge of the visual viewport from the left edge of the layout viewport in CSS pixels. VisualViewport.offsetTop Read only Returns the offset of the top edge of the visual viewport from the top edge of the layout viewport in CSS pixels. VisualViewport.pageLeft Read only Returns the x coordinate of the visual viewport relative to the initial containing block origin of the top edge in CSS pixels. VisualViewport.pageTop Read only Returns the y coordinate of the visual ...
... VisualViewport.scale Read only Returns the pinch-zoom scaling factor applied to the visual viewport. ...
... VisualViewport.scale Read only Returns the pinch-zoom scaling factor applied to the visual viewport. ...
... VisualViewport.scale Read only Returns the pinch-zoom scaling factor applied to the visual viewport. Events Listen to these events using addEventListener() or by assigning an event listener to the relevant oneventname property of this interface. resize Fired when the visual viewport is resized. ...
Boilerplate 1 - Web APIs
<< PreviousNext >> This example describes repeated pieces of code that will be hidden from now on, as well as defining a JavaScript utility function to make WebGL initialization easier. Boilerplate code for setting up WebGL rendering context By now you are quite used to seeing the same pieces of HTML, CSS, and JavaScript repeated again and again. So we are going to hide them from now on. ...
... In following examples, we will use a JavaScript helper function, getRenderingContext(), to initialize the WebGL rendering context. By now, you should be able to understand what the function does. ...
... we are going to hide them from now on. This would allow us to focus on the interesting pieces of code that are most relevant for learning WebGL. Specifically, the HTML has a <p> element that contains some descriptive text about the page and may also hold error messages; a <canvas> element; and optionally a <button>. The CSS contains rules for body, canvas, and button. Any additional non-trivial CSS and HTML will be displayed on the pages of specific examples. In following examples, we will use a JavaScript helper function, getRenderingContext(), to initialize the WebGL rendering context. By now, you should be able to understand what the function does. Basically, it gets the WebGL rendering context from the canvas element, initializes the drawing buffer, clears it black, and returns the ini...
... error message and returns null. Finally, all JavaScript code will run within an immediate function, which is a common JavaScript technique (see Function). The function declaration and invocation will also be hidden. HTML <p>[ Some descriptive text about the example. ]</p> <button>[ Optional button element. ...
Window.screenLeft - Web APIs
Web › API › Window › screenLeft
Examples In our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. ...
... Examples In our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. ...
... Working Draft Initial definition. ...
... Working Draft Initial definition. ...
Window.screenTop - Web APIs
Web › API › Window › screenTop
Examples In our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. ...
... Examples In our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. ...
... Working Draft Initial definition. ...
... Working Draft Initial definition. ...
An overview of accessible web applications and widgets - Accessibility
Since the HTML4 specification doesn't provide built-in tags that semantically describe these kinds of widgets, developers typically resort to using generic elements such as <div> and <span>. ...
...h2Panel" role="tabpanel" aria-labelledby="ch2Tab">Chapter 2 content goes here</div> <div id="quizPanel" role="tabpanel" aria-labelledby="quizTab">Quiz content goes here</div> </div> ARIA is well supported by all major browsers, including Firefox, Safari, Opera, Chrome, and Internet Explorer, and many assistive technologies. Presentational changes Dynamic presentational changes include using CSS to change the appearance of content (such as a red border around invalid data, or changing the background color of a checked checkbox), as well as showing or hiding content. State changes ARIA provides attributes for declaring the current state of a UI widget. Examples include (but are certainly not limited to): aria-checked: indicates the state of a checkbox or radio button aria-disabled: ...
...ndicates the state of a checkbox or radio button aria-disabled: indicates that an element is visible, but not editable or otherwise operable aria-grabbed: indicates the 'grabbed' state of an object in a drag-and-drop operation (For a full list of ARIA states, consult the ARIA list of states and properties.) Developers should use ARIA states to indicate the state of UI widget elements and use CSS attribute selectors to alter the visual appearance based on the state changes (rather than using script to change a class name on the element). Visibility changes When content visibility is changed (i.e., an element is hidden or shown), developers should change the aria-hidden property value. The techniques described above should be used to declare CSS to visually hide an element using display:...
...2a. HTML for a tooltip <div class="text"> <label id="tp1-label" for="first">First Name:</label> <input type="text" id="first" name="first" size="20" aria-labelledby="tp1-label" aria-describedby="tp1" aria-required="false" /> <div id="tp1" class="tooltip" role="tooltip" aria-hidden="true">Your first name is optional</div> </div> The CSS for this markup is shown in Example 2b. Note that there is no custom classname used, only the status of the aria-hidden attribute on line 1. Example 2b. Attribute-based selector for indicating state div.tooltip[aria-hidden="true"] { display: none; } The JavaScript to update the aria-hidden property has the form shown in Example 2c. Note that the script only updates the aria-hidden attribute...
Operable - Accessibility
a Practical resource 2.4.1 Bypass blocks (A) A mechanism should be provided that allows the user to skip straight to the main content or functionality available on the page, past the repeated features (such as the company logo or navigation). This is often achieved using "skip links" -- links put at the top of the page source that link to the main content and are hidden by CSS. If a proper structure of headings and semantic containers is provided to navigate with (for example <section>, <aside>, etc.), then an added "skip link" is not needed. Need to add a section on "skip links". 2.4.2 Include page title (A) Each web page should include an informative <title>, the content of which describes the page's content/purpose. See Adding a title. ...
...title. 2.4.3 Logical focus order (A) The "tabbing order" of focusable page features (e.g. links, buttons, form inputs) makes logical sense, meaning that the page is still usable by non-sighted/keyboard users. See UI controls for general advice on tabbing to controls. If you need to place elements in an unusual layout, it is better to make sure the source order is sensible, then use CSS features like positioning to handle the layout. 2.4.4 Link purpose (in context) (A) The purpose/destination of a link can be determined from the link text, or from its surroundings (e.g. the surrounding text). Exceptions are where the link purpose is ambiguous to all users (see ambiguous to users in general for a useful explanation of this). See Meaningful text labels. Also note t...
...the structure allows you to differentiate between them easily. 2.4.7 Visible focus for focusable elements (AA) When tabbing through focusable elements such as links or form inputs, there should be a visual indicator to show you which element currently has focus. This is usually a dotted or blue outline by default (depending on browser, platform, etc.), but this can be overidden by CSS. See Using native keyboard accessibility. 2.4.8 Location within site (AAA) When on a page inside a complex site or set of steps, the user should be given an indicator of where they are in the site, for example a breadcrumb trail, sitemap or text such as "Form page 2 of 10". 2.4.9 Link purpose (link only) (AAA) This criterion builds on 2.4.4, stating that to conform ...
...ng) or b) user gestures detected by device sensors (including a camera) that both of the following are true: 1) motion actuation can be disabled, and 2) the functionality can be operated without using device motion or user gestures. Exceptions exist. Understanding Motion Actuation 2.5.5 Target Size (AAA) added in 2.1 The size of an actionable item's touch target must be at least 44 CSS pixels in both width and height. Exceptions exist. Understanding Target Size 2.5.6 Concurrent Input Mechanisms (AAA) added in 2.1 Make sure people can use and switch between different modes of input when interacting with digital content including touchscreen, keyboard, mouse, voice commands, or alternative input devices. An essential exception exists. Understanding Concurrent...
Creating a cross-browser video player - Developer guides
<li><button id="fs" type="button">Fullscreen</button></li> </ul> Each button is given an id so it can be easily accessed with JavaScript. The span within the <progress> element is for browsers that do not support the progress element and will be updated at the same time as progress (this span element won't be visible on browsers that support progress). The controls are initially hidden with a CSS display:none and will be enabled with JavaScript. Again if a user has JavaScript disabled, the custom control set will not appear and they can use the browser's default control set unhindered. Of course this custom control set is currently useless and doesn't do a thing: Let's improve the situation with JavaScript. Using the Media API HTML5 comes with a JavaScript Media API that allows develop...
...deo.currentTime / video.duration) * 100) + '%'; }); As the timeupdate event is raised, the progress element's value attribute is set to the video's currentTime. The <span> element mentioned earlier, for browsers that do not support the <progress> element (e.g. Internet Explorer 9), is also updated at this time, setting its width to be a percentage of the total time played. This span has a solid CSS background colour, which helps it provide the same visual feedback as a <progress> element. Coming back to the video.duration problem mentioned above, when the timeupdate event is raised, in most mobile browsers the video's duration attribute should now have the correct value. This can be taken advantage of to set the progress element's max attribute if it is currently not set: video.addEventLi...
...as any HTML element can request fullscreen mode, here the videoContainer is used as it also contains the custom controls which should also appear with the video in fullscreen mode. The exception to this is Safari 5.1, which will only allow webkitRequestFullScreen to be called on the <video> element. ...
... more advanced WebKit browsers such as Chrome and the latest Opera. Another user defined function -- setFullscreenData() -- is also called, which simply sets the value of a data-fullscreen attribute on the videoContainer (this makes use of data-states). var setFullscreenData = function(state) { videoContainer.setAttribute('data-fullscreen', !!state); } This is used simply to set some basic CSS to improve the styling of the custom controls when they are in fullscreen (see the sample code for further details). When a video goes into fullscreen mode, it usually displays a message indicating that the user can press the Esc key to exit fullscreen mode, so the code also needs to listen for relevant events in order to call the setFullscreenData() function to ensure the control styling is corr...
Constraint validation - Developer guides
ociated DOM interface, (HTMLInputElement, HTMLSelectElement, HTMLButtonElement, HTMLOutputElement or HTMLTextAreaElement), which evaluates the constraints only on this element, allowing a script to get this information. The checkValidity() method returns a Boolean indicating whether the element's value passes its constraints. (This is typically done by the user-agent when determining which of the CSS pseudo-classes, :valid or :invalid, applies.) In contrast, the reportValidity() method reports any constraint failures to the user. By a call to the checkValidity() or reportValidity() method on the HTMLFormElement interface. By submitting the form itself. Calling checkValidity() is called statically validating the constraints, while calling reportValidity() or submitting the form is called i...
...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. ...
...yId("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. ...
...opers 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 :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 in...
<body>: The Document Body element - HTML: Hypertext Markup Language
Web › HTML › Element › body
Permitted ARIA roles No role permitted DOM interface HTMLBodyElement The <body> element exposes the HTMLBodyElement interface. You can access the <body> element through the document.body property. Attributes This element includes the global attributes. alink Color of text for hyperlinks when selected. This method is non-conforming, use CSS color property in conjunction with the :active pseudo-class instead. background URI of a image to use as a background. This method is non-conforming, use CSS background property on the element instead. bgcolor Background color for the document. This method is non-conforming, use CSS background-color property on the element instead. bottommargin The margin of the bottom of the body. Th...
...th the :active pseudo-class instead. background URI of a image to use as a background. This method is non-conforming, use CSS background property on the element instead. bgcolor Background color for the document. This method is non-conforming, use CSS background-color property on the element instead. bottommargin The margin of the bottom of the body. This method is non-conforming, use CSS margin-bottom property on the element instead. leftmargin The margin of the left of the body. This method is non-conforming, use CSS margin-left property on the element instead. link Color of text for unvisited hypertext links. This method is non-conforming, use CSS color property in conjunction with the :link pseudo-class instead. onafterprint Function to call after the user has printe...
...rward in undo transaction history. onresize Function to call when the document has been resized. onstorage Function to call when the storage area has changed. onundo Function to call when the user has moved backward in undo transaction history. onunload Function to call when the document is going away. rightmargin The margin of the right of the body. ...
...to call when the storage area has changed. onundo Function to call when the user has moved backward in undo transaction history. onunload Function to call when the document is going away. rightmargin The margin of the right of the body. This method is non-conforming, use CSS margin-right property on the element instead. text Foreground color of text. This method is non-conforming, use CSS color property on the element instead. topmargin The margin of the top of the body. This method is non-conforming, use CSS margin-top property on the element instead. vlink Color of text for visited hypertext links. This method is non-conforming, use CSS color property in conjunction with the :visited pseudo-class instead. Example <html> <head> <title>Document title</title> </h...
<button>: The Button element - HTML: Hypertext Markup Language
Web › HTML › Element › button
The source for this interactive example is stored in a GitHub repository. ...
.... To give an icon button an accessible name, put text in the <button> element that concisely describes the button's functionality. Example <button name="favorite"> <svg aria-hidden="true" viewBox="0 0 10 10"><path d="M7 9L5 8 3 9V6L1 4h3l1-3 1 3h3L7 6z"/></svg> Add to favorites </button> If you want to visually hide the button's text, an accessible way to do so is to use a combination of CSS properties to remove it visually from the screen, but keep it parseable by assistive technology. However, it is worth noting that leaving the button text visually apparent can aid people who may not be familiar with the icon's meaning or understand the button's purpose. This is especially relevant for people who are not technologically sophisticated, or who may have different cultural interpreta...
...explanations Understanding Success Criterion 4.1.2 | W3C Understanding WCAG 2.0 Size and Proximity Size Interactive elements such as buttons should provide an area large enough that it is easy to activate them. This helps a variety of people, including people with motor control issues and people using non-precise forms of input such as a stylus or fingers. A minimum interactive size of 44x44 CSS pixels is recommended. Understanding Success Criterion 2.5.5: Target Size | W3C Understanding WCAG 2.1 Target Size and 2.5.5 | Adrian Roselli Quick test: Large touch targets - The A11Y Project Proximity Large amounts of interactive content -- including buttons -- placed in close visual proximity to each other should have space separating them. This spacing is beneficial for people who are...
....5 | Adrian Roselli Quick test: Large touch targets - The A11Y Project Proximity Large amounts of interactive content -- including buttons -- placed in close visual proximity to each other should have space 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 ...
<col> - HTML: Hypertext Markup Language
Web › HTML › Element › col
column within a table and is used for defining common semantics on all common cells. It is generally found within a <colgroup> 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. <col> allows styling columns using CSS, but only a few properties will have an effect on the column (see the CSS 2.1 specification for a list). Content categories None. Permitted content None, it is an empty element. Tag omission It must have start tag, but must not have an end tag. Permitted parents <colgroup> only, though it can be implicitly defined as its start tag is not mandatory.
...t belongs too. If there are none, the left value is assumed. Note: To achieve the same effect as the left, center, right or justify values: Do not try to set the text-align property on a selector giving a <col> element. Because <td> elements are not descendant of the <col> element, they won't inherit it. If the table doesn't use a colspan attribute, use the td:nth-child(an+b) CSS selector. Set a to zero and b to the position of the column in the table, e.g. td:nth-child(2) { text-align: right; } to right-align the second column. If the table does use a colspan attribute, the effect can be achieved by combining adequate CSS attribute selectors like [colspan=n], though this is not trivial. bgcolor The background color of the table. It is a 6-digit hex...
... char 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 is ignored. ...
...le; middle, which will center the text in the cell; and top, which will put the text as close to the top of the cell as it is possible. Note: Do not try to set the vertical-align property on a selector giving a <col> element. Because <td> elements are not descendant of the <col> element, they won't inherit it. If the table doesn't use a colspan attribute, use the td:nth-child(an+b) CSS selector where a is the total number of the columns in the table and b is the ordinal position of the column in the table. Only after this selector the vertical-align property can be used. If the table does use a colspan attribute, the effect can be achieved by combining adequate CSS attribute selectors like [colspan=n], though this is not trivial. width This attribute specifies a def...
<colgroup> - HTML: Hypertext Markup Language
Web › HTML › Element › colgroup
le permitted DOM interface HTMLTableColElement Attributes This element's attributes include the global attributes. span This attribute contains a positive integer indicating the number of consecutive columns the <colgroup> element spans. If not present, its default value is 1. Note: This attribute is applied on the attributes of the column group, it has no effect on the CSS styling rules associated with it or, even more, to the cells of the column's members of the group. The span attribute is not permitted if there are one or more <col> elements within the <colgroup>. Deprecated attributes The following attributes are deprecated and should not be used. They are documented below for reference when updating existing code and for historical interest only. ...
...ttribute is not set, the left value is assumed. The descendant <col> elements may override this value using their own align attribute. Note: Do not try to set the text-align property on a selector giving a <colgroup> element. Because <td> elements are not descendant of the <colgroup> element, they won't inherit it. If the table doesn't use a colspan attribute, use one td:nth-child(an+b) CSS selector per column, where a is the total number of the columns in the table and b is the ordinal position of this column in the table. Only after this selector the text-align property can be used. If the table does use a colspan attribute, the effect can be achieved by combining adequate CSS attribute selectors like [colspan=n], though this is not trivial. bgcolor The background co...
... char This attribute specifies the alignment of the content in a column group to a character. Typical values for this include a period (.) when attempting to align numbers or monetary values. ...
...e, which will center the text in the cell; and top, which will put the text as close to the top of the cell as it is possible. Note: Do not try to set the vertical-align property on a selector giving a <colgroup> element. Because <td> elements are not descendant of the <colgroup> element, they won't inherit it. If the table doesn't use a colspan attribute, use the td:nth-child(an+b) CSS selector per column, where a is the total number of the columns in the table and b is the ordinal position of the column in the table. Only after this selector the vertical-align property can be used. If the table does use a colspan attribute, the effect can be achieved by combining adequate CSS attribute selectors like [colspan=n], though this is not trivial. Examples Please see the <...
<div>: The Content Division element - HTML: Hypertext Markup Language
Web › HTML › Element › div
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. ...
...ndatory. Permitted parents Any element that accepts flow content. Or (in WHATWG HTML): <dl> element. Implicit ARIA role No corresponding role Permitted ARIA roles Any DOM interface HTMLDivElement Attributes This element includes the global attributes. Note: The align attribute is obsolete; do not use it anymore. Instead, you should use CSS 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...
...ts 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. ...
...&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; padding: 8px 12px; background-image: linear-gradient(180deg, #fff, #ddd 40%, #ccc); } Result Specifications Specification Status Comment HTML Living StandardThe definition of '<div>' in that specification. Living Standard No changes since the latest snapshot H...
<img>: The Image Embed element - HTML: Hypertext Markup Language
Web › HTML › Element › img
a source of 1000px width, if the viewport is not higher than 500px. Source size values specify the intended display size of the image. User agents use the current source size to select one of the sources supplied by the srcset attribute, when those sources are described using width (w) descriptors. The selected source size affects the intrinsic size of the image (the image's display size if no CSS styling is applied). If the srcset attribute is absent, or contains no values with a width descriptor, then the sizes attribute has no effect. src The image URL. Mandatory for the <img> element. On browsers supporting srcset, src is treated like a candidate image with a pixel density descriptor 1x, unless an image with this pixel density descriptor is already defined in srcset, or unless srcs...
.... width The intrinsic width of the image in pixels. Must be an integer without a unit. usemap The partial URL (starting with #) of an image map associated with the element. Note: You cannot use this attribute if the <img> element is inside an <a> or <button> element. Deprecated attributes align Aligns the image with its surrounding context. Use the float and/or vertical-align CSS properties instead of this attribute. Allowed values: top Equivalent to vertical-align: top or vertical-align: text-top middle Equivalent to vertical-align: -moz-middle-with-baseline bottom The default, equivalent to vertical-align: unset or vertical-align: initial left Equivalent to float: left right Equivalent to float: right border The width of a border around t...
...is attribute. Allowed values: top Equivalent to vertical-align: top or vertical-align: text-top middle Equivalent to vertical-align: -moz-middle-with-baseline bottom The default, equivalent to vertical-align: unset or vertical-align: initial left Equivalent to float: left right Equivalent to float: right border The width of a border around the image. Use the border CSS property instead. hspace The number of pixels of white space on the left and right of the image. Use the margin CSS property instead. longdesc A link to a more detailed description of the image. Possible values are a URL or an element id. Note: This attribute is mentioned in the latest W3C version, HTML 5.2, but has been removed from the WHATWG's HTML Living Standard. It has an uncerta...
...Note: This attribute is mentioned in the latest W3C version, HTML 5.2, but has been removed from the WHATWG's HTML Living Standard. It has an uncertain future; authors should use a WAI-ARIA alternative such as aria-describedby or aria-details. name A name for the element. Use the id attribute instead. vspace The number of pixels of white space above and below the image. Use the margin CSS property instead. Styling with CSS <img> is a replaced element; it has a display value of inline by default, but its default dimensions are defined by the embedded image's intrinsic values, like it were inline-block. You can set properties like border/border-radius, padding/margin, width, height, etc. on an image. <img> has no baseline, so when images are used in an inline formatting context ...
Standard metadata names - HTML: Hypertext Markup Language
Web › HTML › Element › meta › name
ally inserting <meta name="referrer"> (with document.write() or appendChild()) makes the referrer behaviour unpredictable. When several conflicting policies are defined, the no-referrer policy is applied. theme-color: indicates a suggested color that user agents should use to customize the display of the page or of the surrounding user interface. The content attribute contains a valid CSS <color>. Standard metadata names defined in other specifications The CSS Color Adjustment specification defines the following metadata name: color-scheme: specifies one or more color schemes with which the document is compatible. The browser will use this information in tandem with the user's browser or device settings to determine what colors to use for everything from background and...
...ment to render in dark mode when it isn't truly compatible with it can result in unreadable content; all major 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. Val...
...icle. Accessibility concerns with viewport scaling Disabling zooming capabilities by setting user-scalable to a value of no prevents people experiencing low vision conditions from being able to read and understand page content. MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.4 | W3C Understanding WCAG 2.0 See also The @viewport CSS at-rule. Other metadata names The WHATWG Wiki MetaExtensions page contains a large set of non-standard metadata names that have not been formally accepted yet; however, some of the names included there are already used quite commonly in practice -- including the following: creator: the name of the creator of the document, such as an organization or institution. If there are more than one,...
...cases the robot's behaviour is undefined and may vary between them. Some crawler robots, like Google, Yahoo and Bing, support the same values for the HTTP header X-Robots-Tag; this allows non-HTML documents like images to use these rules. Specifications Specification HTML Living StandardThe definition of 'standard metadata names' in that specification. CSS Color Adjustment Module Level 1The definition of 'the "color-scheme" metadata name' in that specification. CSS Device AdaptationThe definition of 'the "viewport" metadata name' in that specification. Referrer PolicyThe definition of 'the "referrer" metadata name' in that specification. ...
<pre>: The Preformatted Text element - HTML: Hypertext Markup Language
Web › HTML › Element › pre
arents Any element that accepts flow content. Implicit ARIA role No corresponding role Permitted ARIA roles Any DOM interface HTMLPreElement Attributes This element only includes the global attributes. cols Contains the preferred count of characters that a line should have. It was a non-standard synonym of width. ...
... element only includes the global attributes. cols Contains the preferred count of characters that a line should have. It was a non-standard synonym of width. To achieve such an effect, use CSS width instead. width Contains the preferred count of characters that a line should have. Though technically still implemented, this attribute has no visual effect; to achieve such an effect, use CSS width instead. wrap Is a hint indicating how the overflow must happen. ...
...The alternate description should clearly and concisely describe the image or diagram's content. ...
...red count of characters that a line should have. Though technically still implemented, this attribute has no visual effect; to achieve such an effect, use CSS width instead. wrap Is a hint indicating how the overflow must happen. In modern browser this hint is ignored and no visual effect results in its present; to achieve such an effect, use CSS white-space instead. Example HTML <p>Using CSS to change the font color is easy.</p> <pre> body { color: red; } </pre> Result Accessibility concerns It is important to provide an alternate description for any images or diagrams created using preformatted text. The alternate description should clearly and concisely describe the image or diagram's content. People experiencing low vision conditions and browsing with the aid of assistive...
<style>: The Style Information element - HTML: Hypertext Markup Language
Web › HTML › Element › 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. 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. ...
... elements can include media attributes that contain media queries, allowing you to selectively apply internal stylesheets to your document depending on media features such as viewport width. Attributes This element includes the global attributes. type This attribute defines the styling language as a MIME type (charset should not be specified). This attribute is optional and defaults to text/css if it is not specified; values other than the empty string or text/css are not used. Note: There is very little reason to include this attribute in modern web documents. media This attribute defines which media the style should be applied to. Its value is a media query, which defaults to all if the attribute is missing. nonce A cryptographic nonce (number used once) used to whitelist inline s...
...cy. It is critical to provide a nonce that cannot be guessed as bypassing a resource's policy is otherwise trivial. title This attribute specifies alternative style sheet sets. Deprecated attributes scoped This attribute specifies that the styles only apply to the elements of its parent(s) and children. This attribute may be re-introduced in the future per https://github.com/w3c/csswg-drafts/issues/3547. If you want to use the attribute now, you can use a polyfill. Examples A simple stylesheet In the following example, we apply a very simple stylesheet to a document: <!doctype html> <html> <head> <style> p { color: red; } </style> </head> <body> <p>This is my paragraph.</p> </body> </html> Multiple style elements In this example we've include...
...style> <style media="all and (max-width: 500px)"> p { color: blue; background-color: yellow; } </style> </head> <body> <p>This is my paragraph.</p> </body> </html> Technical summary Content categories Metadata content, and if the scoped attribute is present: flow content. Permitted content Text content matching the type attribute, that is text/css. Tag omission Neither tag is omissible. Permitted parents Any element that accepts metadata content. Implicit ARIA role No corresponding role Permitted ARIA roles No role permitted DOM interface HTMLStyleElement Specifications Specification Status Comment HTML Living StandardThe definition of 'style' in th...
<td>: The Table Data Cell element - HTML: Hypertext Markup Language
Web › HTML › Element › td
so that it covers its entire width. char (with text only): The content is aligned to a character inside the <th> element with minimal offset. This character is defined by the char and charoff attributes Unimplemented (see bug 2212). The default value when this attribute is not specified is left. Note: To achieve the same effect as the left, center, right or justify values, apply the CSS text-align property to the element. To achieve the same effect as the char value, give the text-align property the same value you would use for the char. Unimplemented in CSS3. axis This attribute contains a list of space-separated strings. Each string is the id of a group of cells that this header applies to. bgcolor This attribute defines the background color of each cell in a...
... char 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. charoff This attribute is used to shift column data to the right of the character specified by the char attribute. ...
...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. charoff This attribute is used to shift column data to the right of the character specified by the char attribute. Its value specifies the length of this shift. height This attribute is used to define a recommended cell height. Use the CSS height property instead. scope This enumerated attribute defines the cells that the header (defined in the <th>) element relates to. Only use this attribute with the <th> element to define the row or column for which it is a header. valign This attribute specifies how a text is vertically aligned inside a cell. Possible values for this attribute are: baseline: Positions the text near ...
... near the bottom of the cell and aligns it with the baseline of the characters instead of the bottom. If characters don't descend below the baseline, the baseline value achieves the same effect as bottom. bottom: Positions the text near the bottom of the cell. middle: Centers the text in the cell. and top: Positions the text near the top of the cell. To achieve a similar effect, use the CSS vertical-align property. width This attribute is used to define a recommended cell width. Use the CSS width property instead. Examples See <table> for examples on <td>. Specifications Specification Status Comment HTML Living StandardThe definition of 'td element' in that specification. Living Standard HTML5The definition of 'td element' in th...
<tfoot>: The Table Foot element - HTML: Hypertext Markup Language
Web › HTML › Element › tfoot
cell char, aligning the textual content on a special character with a minimal offset, defined by the char and charoff attributes Unimplemented (see bug 2212). If this attribute is not set, the left value is assumed. Note: Do not use this attribute as it is obsolete (not supported) in the latest standard. To achieve the same effect as the left, center, right or justify values, use the CSS text-align property on it. To achieve the same effect as the char value, in CSS3, you can use the value of the char as the value of the text-align property Unimplemented. bgcolor This attribute defines the background color of each cell of the column. It is one of the 6-digit hexadecimal code as defined in sRGB, prefixed by a '#'. One of the sixteen predefined color strings may be u...
...800000" navy = "#000080" red = "#FF0000" blue = "#0000FF" purple = "#800080" teal = "#008080" fuchsia = "#FF00FF" aqua = "#00FFFF" Usage note: Do not use this attribute, as it is non-standard and only implemented some versions of Microsoft Internet Explorer: the <tfoot> element should be styled using CSS. 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 char, this att...
...e 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 char, this attribute is ignored. Note: Do not use this attribute as it is obsolete (and not supported) in the latest standard. To achieve the same effect as the char, in CSS3, you can use the character set using the char attribute as the value of the text-align property Unimplemented. charoff Deprecated since HTML4Obsolete since HTML5 This attribute is used to indicate the number of characters to offset the column data from the alignment characters specified by the char attribute. Note: Do not use this attribute as it is obsolete (and not supported) in the la...
...ters are all of the size, this has the same effect as bottom. bottom, which will put the text as close to the bottom of the cell as it is possible; middle, which will center the text in the cell; and top, which will put the text as close to the top of the cell as it is possible. Note: Do not use this attribute as it is obsolete (and not supported) in the latest standard: instead set the CSS vertical-align property on it. Examples Please see the <table> page for examples on <tfoot>. Specifications Specification Status Comment HTML Living StandardThe definition of 'tfoot element' in that specification. Living Standard HTML5The definition of 'tfoot element' in that specification. Recommendation ...
<thead>: The Table Head element - HTML: Hypertext Markup Language
Web › HTML › Element › thead
cell char, aligning the textual content on a special character with a minimal offset, defined by the char and charoff attributes Unimplemented (see bug 2212). If this attribute is not set, the left value is assumed. Note: Do not use this attribute as it is obsolete (not supported) in the latest standard. To achieve the same effect as the left, center, right or justify values, use the CSS text-align property on it. To achieve the same effect as the char value, in CSS3, you can use the value of the char as the value of the text-align property Unimplemented. bgcolor This attribute defines the background color of each cell of the column. It is one of the 6-digit hexadecimal code as defined in sRGB, prefixed by a '#'. One of the sixteen predefined color strings may be u...
...000" navy = "#000080" red = "#FF0000" blue = "#0000FF" purple = "#800080" teal = "#008080" fuchsia = "#FF00FF" aqua = "#00FFFF" Usage note: Do not use this attribute, as it is non-standard and only implemented in some versions of Microsoft Internet Explorer: the <thead> element should be styled using CSS. 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 is ignored. ...
...har 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 is ignored. Note: Do not use this attribute as it is obsolete (and not supported) in the latest standard. To achieve the same effect as the char, in CSS3, you can use the character set using the char attribute as the value of the text-align property Unimplemented. charoff in HTML 4, in HTML5 This attribute is used to indicate the number of characters to offset the column data from the alignment characters specified by the char attribute. Note: Do not use this attribute as it is obsolete (and not supported) in the latest standard. ...
...aracters are all of the size, this has the same effect as bottom. bottom, which will put the text as close to the bottom of the cell as it is possible; middle, which will center the text in the cell; top, which will put the text as close to the top of the cell as it is possible. Note: Do not use this attribute as it is obsolete (and not supported) in the latest standard: instead set the CSS vertical-align property on it. Examples See <table> for examples on <thead>. Specifications Specification Status Comment HTML Living StandardThe definition of 'thead element' in that specification. Living Standard HTML5The definition of 'thead element' in that specification. Recommendation ...
Global attributes - HTML: Hypertext Markup Language
(all letters default to lowercase) on or sentences, the first letter of each sentence defaults to a capital letter; all other letters default to lowercase words, the first letter of each word defaults to a capital letter; all other letters default to lowercase characters, all letters should default to uppercase class A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method Document.getElementsByClassName(). contenteditable An enumerated attribute indicating if the element should be editable by the user. If so, the browser modifies its widget to allow editing. The attribute must take one of the following values: true or the empty string, which indicates t...
... elements of the page that can't be used until the login process has been completed. The browser won't render such elements. This attribute must not be used to hide content that could legitimately be shown. id Defines a unique identifier (ID) which must be unique in the whole document. Its purpose is to identify the element when linking (using a fragment identifier), scripting, or styling (with CSS). inputmode Provides a hint to browsers as to the type of virtual keyboard configuration to use when editing this element or its contents. Used primarily on <input> elements, but is usable on any element while in contenteditable mode. is Allows you to specify that a standard HTML element should behave like a registered custom built-in element (see Using custom elements for more details). N...
... an element: the 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 er...
...se 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 sequential keyb...
attributeType - SVG: Scalable Vector Graphics
XML This value specifies that the value of attributeName is the name of an XML attribute defined as animatable in the default XML namespace for the target element. auto This value specifies that the implem...
... XML This value specifies that the value of attributeName is the name of an XML attribute defined as animatable in the default XML namespace for the target element. auto This value specifies that the implementation should match the attributeName to an attribute for the target element. Use...
..."http://www.w3.org/2000/svg"> <rect x="50" y="50" width="100" height="100"> <animate attributeType="XML" attributeName="y" from="0" to="50" dur="5s" repeatCount="indefinite"/> </rect> </svg> Usage notes Value CSS | XML | auto Default value auto Animatable No CSS This value specifies that the value of attributeName is the name of a CSS property defined as animatable. ...
... Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'attributeType' in that specification. ...
font-family - SVG: Scalable Vector Graphics
See the css font-family property for more information. ...
... The font-family attribute indicates which font family will be used to render the text, specified as a prioritized list of font family names and/or generic family names. Note: As a presentation attribute, font-family can be used as a CSS property. See the css font-family property for more information. As a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <altGlyph>, <text>, <textPath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewBox="0 0 200 30" xmlns="http://www.w3.org/2000/svg"> <text y="20" font-family="Arial, Helvetica, sans-serif">Sans serif</text> <text x="100" y="20" font-family="monospace">Monospace</text> </svg> Usage notes Value [ <family-name> | <generic-family> ]#where ...
... Candidate Recommend...
... Value [ <family-name> | <generic-family> ]#where <family-name> = <string> | <custom-ident>+<generic-family> = serif | sans-serif | cursive | fantasy | monospace Default value Depends on user agent Animatable Yes For a description of the values, please refer to the CSS font-family property. Specifications Specification Status Comment CSS Fonts Module Level 4The definition of 'generic font families' in that specification. Working Draft Adds new generic font families, specifically: system-ui, emoji, math, and fangsong. CSS Fonts Module Level 3The definition of 'font-family' in that specification. Candidate Recommendation No significant change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The defin...
font-size - SVG: Scalable Vector Graphics
See the css font-size property for more information. ...
... The font-size attribute refers to the size of the font from baseline to baseline when multiple lines of text are set solid in a multiline layout environment. Note: As a presentation attribute, font-size can be used as a CSS property. See the css font-size property for more information. As a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <altGlyph>, <text>, <textPath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewBox="0 0 200 30" xmlns="http://www.w3.org/2000/svg"> <text y="20" font-size="smaller">smaller</text> <text x="100" y="20" font-size="2em">2em</text> </svg> Usage notes Value <absolute-size> | <relative-size> | <length-percentage> Default value medium ...
... Candidate Recommendation No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'font-size' in that specification. Recommendation Initial definition ...
...ont-size="smaller">smaller</text> <text x="100" y="20" font-size="2em">2em</text> </svg> Usage notes Value <absolute-size> | <relative-size> | <length-percentage> Default value medium Animatable Yes For a description of the values, please refer to the CSS font-size property. Specifications Specification Status Comment CSS Fonts Module Level 3The definition of 'font-size' in that specification. Candidate Recommendation No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'font-size' in that specification. Recommendation Initial definition ...
font-style - SVG: Scalable Vector Graphics
See the css font-style property for more information. ...
... 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. 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 th...
... Candidate Recommendation No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The defi...
...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 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 Browse...
font-variant - SVG: Scalable Vector Graphics
See the css font-variant property for more information. ...
... The font-variant attribute indicates whether the text is to be rendered using variations of the font's glyphs. Note: As a presentation attribute, font-variant can be used as a CSS property. See the css font-variant property for more information. As a presentation attribute, it can be applied to any element but it has effect only on the following eight 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-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> || <context...
... Candidate Recommendation Added many more keywords for different types of variations. Sca...
...meric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero || <east-asian-variant-values> || <east-asian-width-values> || ruby ] Default value normal Animatable Yes For a description of the values, please refer to the CSS font-variant property. Specifications Specification Status Comment CSS Fonts Module Level 4The definition of 'font-variant' in that specification. Working Draft No change CSS Fonts Module Level 3The definition of 'font-variant' in that specification. Candidate Recommendation Added many more keywords for different types of variations. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'font-variant' in that specificatio...
font-weight - SVG: Scalable Vector Graphics
See the css font-weight property for more information. ...
... The font-weight attribute refers to the boldness or lightness of the glyphs used to render the text, relative to other fonts in the same font family. Note: As a presentation attribute, font-weight can be used as a CSS property. See the css font-weight property for more information. As a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <altGlyph>, <text>, <textPath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewBox="0 0 200 30" xmlns="http://www.w3.org/2000/svg"> <text y="20" font-weight="normal">Normal text</text> <text x="100" y="20" font-weight="bold">Bold text</text> </svg> Usage notes Value normal | bold | bolder | lighter | <number> Default value normal An...
... Candidate Recommendation No change Scal...
...weight="normal">Normal text</text> <text x="100" y="20" font-weight="bold">Bold text</text> </svg> Usage notes Value normal | bold | bolder | lighter | <number> Default value normal Animatable Yes For a description of the values, please refer to the CSS font-weight property. Specifications Specification Status Comment CSS Fonts Module Level 4The definition of 'font-weight' in that specification. Working Draft Defines font-weight to accept any numbers between 1 and 1000. CSS Fonts Module Level 3The definition of 'font-weight' in that specification. Candidate Recommendation No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'font-weight' in that specification...
height - SVG: Scalable Vector Graphics
Web › SVG › Attribute › height
lue 120% Animatable Yes foreignObject For <foreignObject>, height defines the vertical length for the rendering area for the referenced document. Value auto | <length> | <percentage> Default value auto (treated as 0) Animatable Yes Note: Starting with SVG2, height is a Geometry Property meaning this attribute can also be used as a CSS property for <foreignObject>. image For <image>, height defines the vertical length for the image. Value auto | <length> | <percentage> Default value auto (treated as the intrinsic height of the image) Animatable Yes Note: Starting with SVG2, height is a Geometry Property meaning this attribute can also be used as a CSS property for images. mask For...
...butes. Value <length> Default value 0 Animatable Yes rect For <rect>, height defines the vertical length for the rectangle. Value auto | <length> | <percentage> Default value auto (treated as 0) Animatable Yes Note: Starting with SVG2, height is a Geometry Property meaning this attribute can also be used as a CSS property for rectangles. svg For <svg>, height defines the vertical length for the rendering area of the SVG viewport. Note: In an HTML document if both the viewBox and height attributes are omitted, the svg element will be rendered with a height of 150px Value auto | <length> | <percentage> Default value auto (treated as 100%) Animatable Yes Not...
...ea of the SVG viewport. Note: In an HTML document if both the viewBox and height attributes are omitted, the svg element will be rendered with a height of 150px Value auto | <length> | <percentage> Default value auto (treated as 100%) Animatable Yes Note: Starting with SVG2, height is a Geometry Property meaning this attribute can also be used as a CSS property for <svg>. use For <use>, height defines the vertical length for the referenced element. Value auto | <length> | <percentage> Default value auto (treated as 0) Animatable Yes Note: Starting with SVG2, height is a Geometry Property meaning this attribute can also be used as a CSS property for used elements. Specifications Specificat...
... Candidate Recommendation Definition for <mask> Scalable Vector Graphics (SVG) 2The definition of 'height' in that specification. Candidate Recommendation Definition as a geometry property Scalable Vector Graphics (SVG) 2The definition of 'height' in that specification. ...
image-rendering - SVG: Scalable Vector Graphics
See the css image-rendering property for more information. ...
... The image-rendering attribute provides a hint to the browser about how to make speed vs. quality tradeoffs as it performs image processing. The resampling is always done in a truecolor (e.g., 24-bit) color space even if the original data and/or the target device is indexed color. Note: As a presentation attribute, image-rendering can be used as a CSS property. See the css image-rendering property for more information. As a presentation attribute, it can be applied to any element but it has effect only on the following element: <image> 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 ...
... that the user agent shall make appropriate tradeoffs to balance speed and quality, but quality shall be given more importance than speed. optimizeSpeed Indicates that the user agent shall emphasize rendering speed over quality. optimizeQuality Indicates that the user agent shall emphasize quality over rendering speed. ...
...an speed. optimizeSpeed Indicates that the user agent shall emphasize rendering speed over quality. optimizeQuality Indicates that the user agent shall emphasize quality over rendering speed. Specifications Specification Status Comment CSS Images Module Level 3The definition of 'image-rendering' in that specification. Candidate Recommendation Definition in CSS Scalable Vector Graphics (SVG) 2The definition of 'image-rendering' in that specification. Candidate Recommendation No significant change, only added a reference to CSS Images 3 Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'image-rendering' in that specification. Recommendation Initial definition ...
opacity - SVG: Scalable Vector Graphics
Web › SVG › Attribute › opacity
See the css opacity property for more information. ...
... The opacity attribute specifies the transparency of an object or of a group of objects, that is, the degree to which the background behind the element is overlaid. Note: As a presentation attribute, opacity 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 elements: <a>, <audio>, <canvas>, <circle>, <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" ...
...> </svg> Usage notes Default value 1 Value <alpha-value> Animatable Yes <alpha-value> The uniform opacity setting to be applied across an entire object, as a <number>. Any values outside the range 0.0 (fully transparent) to 1.0 (fully opaque) will be clamped to this range. Specifications Specification Status Comment CSS Color Module Level 4The definition of 'opacity' in that specification. Working Draft Defines in more detail what this attribute applies to. CSS Color Module Level 3The definition of 'opacity' in that specification. Recommendation Defines in more detail what this attribute applies to. Scalable Vector Graphics (SVG) 2The definition of 'opacity' in that specification. ...
...fication. Working Draft Defines in more detail what this attribute applies to. CSS Color Module Level 3The definition of 'opacity' in that specification. Recommendation Defines in more detail what this attribute applies to. Scalable Vector Graphics (SVG) 2The definition of 'opacity' in that specification. Candidate Recommendation References the specification in CSS Color 3 and notes that there are some related attributes. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'opacity' in that specification. Recommendation Initial definition ...
overflow - SVG: Scalable Vector Graphics
If the overflow property has the value hidden or scroll, a clip of the exact size of the SVG viewport is applied. When scroll is 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. ...
...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 elements: <foreignObject>, <iframe>, <image>, <marker>, <pattern>, <symbol>, <svg>, and <text> html, body, svg { height: 100%; } <svg viewBox="0 0 200 30" xmlns="http://www.w3.org/2000/svg" overflow="auto"> <text y="20">...
... 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 a...
..." overflow="auto"> <text y="20">This text is wider than the SVG, so there should be a scrollbar shown.</text> </svg> Usage notes Value visible | hidden | scroll | auto Default value visible Animatable Yes For a description of the values, please see the css overflow 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 'o...
transform - SVG: Scalable Vector Graphics
As a presentation attribute, transform can be used by any element (in SVG 1.1, only these 16 elements were allowed to use it: <a>, <circle>, <clipPath>, <defs>, <ellipse>, <foreignObject>...
... skewX(40) scale(1 0.5)"> <path id="heart" d="M 10,30 A 20,20 0,0,1 50,30 A 20,20 0,0,1 90,30 Q 90,60 50,90 Q 10,60 10,30 z" /> </g> <use xlink:href="#heart" fill="none" stroke="red"/> </svg> Note: As of SVG2, transform is a presentation attribute, meaning it can be used as a CSS property. However, be aware that there are some difference in syntax between the CSS property and the attribute. See the documentation for the CSS property transform for the specific syntax to use in that case. As a presentation attribute, transform can be used by any element (in SVG 1.1, only these 16 elements were allowed to use it: <a>, <circle>, <clipPath>, <defs>, <ellipse>, <foreignObject>, <g>, <image>, <line>, <path>, <polygon>, <polyline>, <rect>, <switch>, <text>, and ...
...ansform attribute, and <pattern> supports the patternTransform attribute, both of which act exactly like the transform attribute. Value <transform-list> Default value none Animatable Yes Transform functions The following transform functions can be used by the transform attribute <transform-list> Warning: As per the spec, you should be able to also use CSS transform functions. However, the compatibility isn't guaranteed. Matrix The matrix(<a> <b> <c> <d> <e> <f>) transform function specifies a transformation in the form of a transformation matrix of six values. matrix(a,b,c,d,e,f) is equivalent to applying the transformation matrix:(acebdf001)\begin{pmatrix} a & c & e \\ b & d & f \\ 0 & 0 & 1 \end{pmatrix} which maps coordinates from a previous ...
...form function specifies a skew transformation along the y axis by a degrees. Example html,body,svg { height:100% } <svg viewBox="-5 -5 10 10" xmlns="http://www.w3.org/2000/svg"> <rect x="-3" y="-3" width="6" height="6" /> <rect x="-3" y="-3" width="6" height="6" fill="red" transform="skewY(30)" /> </svg> Specification Specification Status Comment CSS Transforms Level 2The definition of 'transform' in that specification. Editor's Draft CSS Transforms Level 1The definition of 'transform' in that specification. Working Draft Scalable Vector Graphics (SVG) 2The definition of 'transform' in that specification. Candidate Recommendation Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition ...
width - SVG: Scalable Vector Graphics
Web › SVG › Attribute › width
lue 120% Animatable Yes foreignObject For <foreignObject>, width defines the horizontal length for the rendering area for the referenced document. Value auto | <length> | <percentage> Default value auto (treated as 0) Animatable Yes Note: Starting with SVG2, width is a Geometry Property meaning this attribute can also be used as a CSS property for <foreignObject>. image For <image>, width defines the horizontal length for the image. Value auto | <length> | <percentage> Default value auto (treated as the intrinsic width of the image) Animatable Yes Note: Starting with SVG2, width is a Geometry Property meaning this attribute can also be used as a CSS property for images. mask For ...
...butes. Value <length> Default value 0 Animatable Yes rect For <rect>, width defines the horizontal length for the rectangle. Value auto | <length> | <percentage> Default value auto (treated as 0) Animatable Yes Note: Starting with SVG2, width is a Geometry Property meaning this attribute can also be used as a CSS property for rectangles. svg For <svg>, width defines the horizontal length for the rendering area of the SVG viewport. Note: In an HTML document if both the viewBox and width attributes are omitted, the svg element will be rendered with a width of 300px Value auto | <length> | <percentage> Default value auto (treated as 100%) Animatable Yes Note: St...
...ring area of the SVG viewport. Note: In an HTML document if both the viewBox and width attributes are omitted, the svg element will be rendered with a width of 300px Value auto | <length> | <percentage> Default value auto (treated as 100%) Animatable Yes Note: Starting with SVG2, width is a Geometry Property meaning this attribute can also be used as a CSS property for <svg>. use For <use>, width defines the horizontal length for the referenced element. Value auto | <length> | <percentage> Default value auto (treated as 0) Animatable Yes Note: Starting with SVG2, width is a Geometry Property meaning this attribute can also be used as a CSS property for used elements. Specifications Specificat...
... Candidate Recommendation Definition for <mask> Scalable Vector Graphics (SVG) 2The definition of 'width' in that specification. Candidate Recommendation Definition as a geometry property Scalable Vector Graphics (SVG) 2The definition of 'width' in that specification. ...
<use> - SVG: Scalable Vector Graphics
Web › SVG › Element › use
those 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. ...
... 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. ...
...ibutes override those set 'earlier' in the cascade). Only the attributes x, y, width, height and href on the use element will override those set on the referenced element. However, any other attributes not set on the referenced element will be applied to the use element. Since the cloned nodes are not exposed, care must be taken when using CSS to style a use element and its cloned descendants. 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. There is currently no defined way to set a cross-origin policy for use elements. Since SVG 2, the xlink:href attribute is depreca...
...height The height of the use element. Value type: <length> ; Default value: 0; Animatable: yes Note: width, and height have 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. 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...
SVG as an Image - SVG: Scalable Vector Graphics
External resources (e.g. ...
... External resources (e.g. ...
... External resources (e.g. ...
...ons are specific to image contexts; they don't apply when SVG content is viewed directly, or when it's embedded as a document via the <iframe>, <object>, or <embed> elements. Specifications Specification Status Comment HTML5The definition of 'SVG within <img> element' in that specification. Recommendation Defines the usage of SVG within <img> elements. CSS Backgrounds and Borders Module Level 3The definition of 'SVG within 'background-image' CSS property' in that specification. Candidate Recommendation Defines the usage of SVG within the background-image property. ...
SVG fonts - SVG: Scalable Vector Graphics
an id attribute, to enable it to be referenced via a URI (see below). The horiz-adv-x attribute 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...
...You can point to external sources for font declarations by means of its children <font-face-name> and <font-face-uri>. The above example states that if the renderer has a local font available named "Super Sans Bold", it should use this instead. ...
...ther your font declaration as described above, you can just use a simple font-family attribute to actually apply the font to some SVG text: <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. ...
...ce 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. ...
SVG: Scalable Vector Graphics
Web › SVG
Getting Started This tutorial will help get you started using SVG. Scalable Vector Graphics (SVG) are an XML-based markup language for describing two-dimensional based vector graphics. As such, it's a text-based, open Web standard for describing images that can be rendered cleanly at any size and are designed specifically to work well with other web standards including CSS, DOM, JavaScript, and SMIL. SVG is, essentially, to graphics what HTML is to text. SVG images and their related behaviors are defined in XML text files, which means they can be searched, indexed, scripted, and compressed. Additionally, this means they can be created and edited with any text editor or with drawing software. Compared to classic bitmapped image formats such as JPEG or PNG, SVG-format vector images can be r...
...n be localized on-the-fly. SVG has been developed by the World Wide Web Consortium (W3C) since 1999. Documentation SVG element reference Details about each SVG element. SVG attribute reference Details about each SVG attribute. SVG DOM interface reference Details about the SVG DOM API, for interaction with JavaScript. ...
...e reference Details about the SVG DOM API, for interaction with JavaScript. Applying SVG effects to HTML content SVG works together with HTML, CSS and JavaScript. Use SVG to enhance a regular HTML page or web application. View All... Community View Mozilla forums... Mailing list Newsgroup RSS feed Tools SVG Test Suite Markup Validator More Tools... ...
...active photos manipulation HTML transformations using SVG's foreignObject Mapping, charting, games & 3D experiments While a little SVG can go a long way to enhanced web content, here are some examples of heavy SVG usage. Connect 4 jVectorMap (interactive maps for data visualization) JointJS (JavaScript diagramming library) D3 ( JavaScript library for visualizing data with HTML, SVG, and CSS ) ...
Using custom elements - Web Components
calling super() so that the 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 i...
...ed attribute or default icon const img = icon.appendChild(document.createElement('img')); img.src = this.hasAttribute('img') ? ...
...e('img') ? ...
...ent, but it is perfectly possible to do it by referencing an external stylesheet from a <link> element instead. For example, take a look at this code from our popup-info-box-external-stylesheet example (see the source code): // Apply external styles to the shadow dom const linkElem = document.createElement('link'); linkElem.setAttribute('rel', 'stylesheet'); linkElem.setAttribute('href', 'style.css'); // Attach the created element to the shadow dom shadow.appendChild(linkElem); Note that <link> elements do not block paint of the shadow root, so there may be a flash of unstyled content (FOUC) while the stylesheet loads. Many modern browsers implement an optimization for <style> tags either cloned from a common node or that have identical text, to allow them to share a single backing style...
Web technology for developers
The open Web presents incredible opportunities for developers. To take full advantage of these technologies, you need to know how to use them. Below you'll find links to our Web technology documentation. Documentation for Web developers Web Developer Reference A list of all references for Web technologies, including those for HTML, CSS, and so on. Web Developer Guide The Web Developer Guide provides useful how-to content to help you actually use Web technologies to do what you want or need to do. Tutorials for Web developers A list of tutorials to take you step-by-step through learning APIs, technologies, or broad topic areas. Developing Web applications Documentation for Web application developers; Web apps are true write-once, deploy anywhere apps for mobile, desktop, a...
...l as in actual 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 ...
...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 help keep track of things while organization work is ongoing. Pay it no mind. ...
...cribe 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 help keep track of things while organization work is ongoing. Pay it no mind. ...
2015 MDN Fellowship Program - Archive of obsolete content
the network. They enable the creation of effective offline experiences and wiill also allow access to push notifications and background sync APIs. Activities and Deliverables Write a demonstration web application (new or existing) to showcase Service Worker functionality. Provide detailed API descriptions. Required skills and experience Experienced Web developer with expertise in JavaScript, CSS, HTML as well as with efficient network interaction (queuing resource fetching, etc.). Self-starter and autonomous worker Mentor information Brittany Storoz, Mozilla Apps Engineering. GitHub: brittanystoroz Twitter: @brittanystoroz WebGL Brief Project Description WebGL is the latest incarnation of the OpenGL family of real time rendering immediate mode graphics APIs. WebGL is getting so...
...essing performance bottlenecks depends on tooling the browser networking and rendering but also, often more important, user perception. Activities and Deliverables Help us develop a curriculum on MDN for teaching developers to master performance tooling and to develop web apps with performance as a feature. Required skills and experience Experienced Web developer with expertise in JavaScript, CSS, HTML. Knowledge of server-side development, caching and network layers preferred. Mentor information Harald Kirschner, Web Craftsman. GitHub: digitarald Twitter: @digitarald Curriculum Development Brief Project Description MDN serves as a trusted resource for literally millions of developers on a regular basis. In 2015, MDN will expand the impact of this content by developing Kits of k...
...earning materials, including such elements as code samples, videos and other elements being finalized. Activities and Deliverables Act as lead curator for technical curriculum addressing a key web technology, developing code samples, videos, interactive exercises and other components to be determined. You may propose your own subject area (examples: virtual reality on the web, network security, CSS, etc.) or we will work with you to match you to the best subject based on your background and Mozilla priorities. Required skills and experience Experienced Web developer with expertise in JavaScript, CSS, HTML and/or other key technologies. Proficient in written and spoken English. Mentor information Chris Mills, Senior Technology Writer, Mozilla Developer Network. GitHub: ChrisDavidMills ...
widget - Archive of obsolete content
scripts. This may take one of the following values: "start": load content scripts immediately after the document element for the widget is inserted into the DOM, but before the DOM content itself has been loaded "ready": load content scripts once DOM content has been loaded, corresponding to the DOMContentLoaded event "end": load content scripts once all the content (DOM, JS, CSS, images) for the widget has been loaded, at the time the window.onload event fires This property is optional and defaults to "end". contentScriptOptions object Read-only value exposed to content scripts under self.options property. Any kind of jsonable value (object, array, string, etc.) can be used here. Optional. Widget Represents a widget obje...
...oad the content scripts. This may have one of the following values: "start": load content scripts immediately after the document element for the widget is inserted into the DOM, but before the DOM content itself has been loaded "ready": load content scripts once DOM content has been loaded, corresponding to the DOMContentLoaded event "end": load content scripts once all the content (DOM, JS, CSS, images) for the widget has been loaded, at the time the window.onload event fires contentScriptOptions Read-only value exposed to content scripts under self.options property. Any kind of jsonable value (object, array, string, etc.) can be used here. Optional. port Object that allows you to: send events to the content script using the port.emit function receive events from the content s...
...he content scripts. This may have one of the following values: "start": load content scripts immediately after the document element for the widget view is inserted into the DOM, but before the DOM content itself has been loaded "ready": load content scripts once DOM content has been loaded, corresponding to the DOMContentLoaded event "end": load content scripts once all the content (DOM, JS, CSS, images) for the widget view has been loaded, at the time the window.onload event fires contentScriptOptions Read-only value exposed to content scripts under self.options property. Any kind of jsonable value (object, array, string, etc.) can be used here. Optional. port Object that allows you to: send events to the content script using the port.emit function receive events from the cont...
ui/button/action - Archive of obsolete content
the Firefox toolbar: However, users can move it to the Firefox menu panel using the toolbar customization feature: Badged buttons New in Firefox 36. You can add a "badge" to a button using its badge property. This can be a number or a string, and you can update it at any time. ...
...appear disabled in the UI, and do not respond to clicks. Defaults to false. onClick function Click handler for the button. badge Number or String New in Firefox 36. Badge to attach to the button. The badge can contain as many characters (or digits) as you like, but only the first four will be displayed. badgeColor CSS <color> value New in Firefox 36. Color for the badge. If badgeColor is omitted and badge is specified, then the badge is red. ActionButton Methods click() Click the button. This will cause the button to generate the click event: var { ActionButton } = require('sdk/ui/button/action'); var button = ActionButton({ id: "my-button", label: "my button", icon...
...ct containing a set of key-value pairs. disabled Boolean property indicating whether or not the button is disabled. badge New in Firefox 36. Value to attach to the button as a badge. May be a number or a string. The badge can contain as many characters (or digits) as you like, but only the first four will be displayed. badgeColor New in Firefox 36. Color for the badge, specified as a CSS <color> value. Events click This event is emitted when a user clicks the button or your add-on calls the button's click() method. Arguments state : The button's state. This contains all the button's properties. ...
ui/button/toggle - Archive of obsolete content
By default, the button appears in the Firefox toolbar: However, users can move it to the Firefox menu panel: Badged buttons New in Firefox 36. You can add a "badge" to a button using its badge property. This can contain a number or a string, and you can update it at any time. ...
...e. onChange function Change handler for the button. onClick function Click handler for the button. badge Number or String New in Firefox 36. Badge to attach to the button. The badge can contain as many characters (or digits) as you like, but only the first four will be displayed. badgeColor CSS <color> value New in Firefox 36. Color for the badge. If badgeColor is omitted and badge is specified, then the badge is red. ToggleButton Methods click() Click the button. This will cause the button to generate the click event: var { ToggleButton } = require('sdk/ui/button/toggle'); var button = ToggleButton({ id: "my-button", label: "my button", icon...
...en flipped, on a per-window basis, whenever the user clicks the button or when the button's click() method is called. badge New in Firefox 36. Value to attach to the button as a badge. May be a number or a string. The badge can contain as many characters (or digits) as you like, but only the first four will be displayed. badgeColor New in Firefox 36. Color for the badge, specified as a CSS <color> value. Events click This event is emitted when a user clicks the button or your add-on calls the button's click() method. Arguments state : The button's state. This includes all the button's properties. change This event is emitted when a user clicks the button or your add-on calls the button's click() method. This event is emitted at the same time as click and its listener receive...
ui/frame - Archive of obsolete content
Experimental Create HTML iframes, using bundled HTML, CSS and JavaScript, that can be added to a designated area of the Firefox user interface. At the moment you can only add frames to a toolbar. Usage This module exports the Frame constructor, which can be used to create frame components. Right now it can be used in conjunction with a Toolbar: you 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. ...
...a Toolbar: you 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. ...
...ructing frames The Frame constructor takes one mandatory option, which is a url pointing to an HTML document supplied under your add-ons "data" directory. ...
QuerySelector - Archive of obsolete content
...
... ...
...of type ID in XML, though it is in HTML and XUL), nor will it work with xml:id. However, it will work with attribute selectors that target non-prefixed attributes (such as 'id', but not xml:id: http://www.w3.org/TR/selectors-api/#resolving) (even though CSS3 does support namespaced attribute selectors: http://www.w3.org/TR/css3-selectors/#attrnmsp and potentially xml:id as #: http://www.w3.org/TR/css3-selectors/#id-selectors ). ...
Adding windows and dialogs - Archive of obsolete content
tion 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();" ...
... understand: it groups a series of XUL controls together. It's a box container with styling that is usually a visible border around its contents, so that it's clear what is being grouped together. It is frequently used with the caption element to associate the grouped elements with a title. The groupbox 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 f...
...ab focus advances in the order the items are found in the XUL document. If you have a very complex layout, or need customized tabbing behavior, you can set the tabindex attribute in the controls. You can also use the focus function to focus an element depending on events such as window load. You should do this carefully, to avoid having inaccessible controls. You can also use the -moz-user-focus CSS property to enable focusing of elements that typically wouldn't receive focus. Again, this should be used sparingly. << PreviousNext >> This tutorial was kindly donated to Mozilla by Appcoast. ...
Case Sensitivity in class and id Names - Archive of obsolete content
Summary: Although CSS is itself case-insensitive, class and ID names are defined to be case-sensitive in HTML 4.01. Find out how this wrinkle can affect your site design and best practices to avoid any problems. In the authoring of both CSS and JavaScript/DOM (otherwise known as DHTML) routines, it is a near-certainty that class and id names will be used to identify elements. We have discovered, however, that many authors are running into trouble with class and id names because they're used to the bugs of browsers that don't fully support open standards. The most common case is where the name uses different case in the document source than is found in the CSS or JavaScript. ...
...nty that class and id names will be used to identify elements. We have discovered, however, that many authors are running into trouble with class and id names because they're used to the bugs of browsers that don't fully support open standards. The most common case is where the name uses different case in the document source than is found in the CSS or JavaScript. For example, there might be this CSS: p.Warning {color: red; background: yellow;} ...coupled with this HTML: <p class="warning">WARNING!</p> In Netscape 6, the paragraph in question will have neither red text nor a yellow background. As far as Netscape 6 is concerned, Warning and warning are two different identifiers, because HTML 4.01 defines class and id names to be case-sensitive. (For a detailed explanation of what HTML 4.01 s...
...cerned, Warning and warning are two different identifiers, because HTML 4.01 defines class and id names to be case-sensitive. (For a detailed explanation of what HTML 4.01 says, see the following section, "Why So Case-Sensitive?") The only way to avoid this particular problem is to make sure that your class and id names have consistent case throughout the entire document, and with respect to your CSS and JavaScript. It is also important to avoid using class or id names which are a case-insensitive match within the same document. For example, you would not want to do something like: .Urgent {color: purple;} .urgent {color: yellow;} Even though these are technically two distinct class names, browsers other than Netscape 6 will treat them as though they are the same thing. Therefore, authors sh...
List of Mozilla-Based Applications - Archive of obsolete content
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 Seeming...
...Ape embedding tool Uses Mozilla SpiderMonkey Splashtop Web Browser browser Part of instant-on operating system sqlite-manager database manager Standalone version of add-on StealthSurfer secure Internet tools on USB key Uses Firefox and Thunderbird StreamBase complex event processing platform Seems to use XULRunner Stylizer CSS Editor CSS editor CSS Editor with built-in Firebug-like diagnostics and Gecko 1.8 preview Sun Java Enterprise System server products Uses NSS Sundial browser with advanced domain name technology Based on Firefox SurfEasy private and secure web browsing Sweet16 Apple II computer emulator Uses SpiderMonkey as a scriptable debugger f...
...ULRunner 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 XULRunner Hall of Fame but ha...
Creating a Firefox sidebar extension - Archive of obsolete content
andkey "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. ...
...el"> 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. ...
...ent 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. ...
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. ...
... Now that we have defined a panel in which to display an icon, we use CSS to specify which icon to display. ...
.../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 stylesheet in a file called tinderstatus.css in the same directory as navigator.xul and reference it at the top of that file right under the global stylesheet reference: <?xml-stylesheet href="chrome://navigator/skin/" type="text/css"?> <?xml-stylesheet href="chrome://navigator/content/tinderstatus.css" type="text/css"?> Our CSS rules use the list-style-image property to define an image to appear when our status bar panel, iden...
Menu - Archive of obsolete content
Archive › Mozilla › Jetpack › UI › Menu
es can also be defined on a ContextMenuSet: beforeHide beforeShow Note that a jetpack.Menu object is passed to beforeHide and beforeShow, since they are called during a context menu's invocation. They may then modify the menu. Individual menus are drawn from the set using on(): on(selector) Returns a new ContextMenuSet whose context menus are those that arise from nodes that match the given CSS selector(s). The selector must be a true CSS selector, not a jQuery or other type of pseudo-selector. Note: Selectors don't automatically include the children of nodes they match. For example, jetpack.menu.context.page.on("a[href]") does not match images contained in links. To match links and all elements contained in links, use jetpack.menu.context.page.on("a[href], a[href] *"). A future ver...
...e, jetpack.menu.context.page.on("a[href]") does not match images contained in links. To match links and all elements contained in links, use jetpack.menu.context.page.on("a[href], a[href] *"). A future version of Jetpack may change this behavior; see bug 527924. What do you think? Leave a comment on that bug or send a message to the mailing list. Parameters selector One or more CSS selectors. A string. Examples: "a[href]", "a[href] > img", "a[href], img". Return value A new ContextMenuSet object. jetpack.menu.context The feature's context menu. All of the feature's context menus are exposed through jetpack.menu.context, including slidebar, panel, toolbar, and status bar item context menus. A ContextMenuSet object. jetpack.menu.context.browser The chrome context menu. Thi...
...nuitem.label) }); Add an item to the hyperlink context menu that tweets the link: jetpack.menu.context.page.on("a").add(function (context) { return { label: "Tweet", command: function () jetpack.lib.twitter.statuses.update({ status: context.node.href }) }; )); Add an item to the page's context menu depending on some complex criteria that can't be completely expressed via a CSS selector: jetpack.menu.context.page.beforeShow = function (menu, context) { menu.reset(); if (matchesMyCriteria(context)) menu.add("Match!"); }; Add an item to both the hyperlink context menu and the image context menu: jetpack.menu.context.page.on("a, img").set("A Link or Image"); Add an item to the image context menu, but only for images contained in hyperlinks: jetpack.menu.context.p...
Styling - Archive of obsolete content
This allows Prism webapps to take on an OS-specific look. ...
... 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 Lin...
...ecific 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 - linux The folder names are pulled from Mozilla and are the same as those used in other Mozilla projects, such as extension and XUL applications. NOTE: you can also include a root level webapp.css which will be used if a platform-specific version is not found. ...
Priority Content - Archive of obsolete content
Started: Using Mozilla in Testing and Debugging Web Sites Original: Using Mozilla in Testing and Debugging Web Sites Wiki Locati...
... Started: Using Mozilla in Testing and Debugging Web Sites Original: Using Mozilla in Testing and Debugging Web Sites Wiki Location: Using Mozilla in Testing a...
...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 Location: SOAP in Gecko-based Browsers Migrators: Doron Rosenberg In progress: CSS Support Charts Original: CSS Support Charts and Archive.org mirror Wiki Location: CSS Support Charts Migrators: Serge K. Keller Licensing: These CSS charts appear to be under a CC:By-NC-SA license, please make note of that on the page when you do the migration. Started: Using Mozilla in Testing and Debugging Web Sites Original: Using Mozilla in Testing and Debugging Web Sites Wiki Location: Using Mozilla in Testing and Debugging Web Sites Migrators: Serge K. Keller NOTE: ...
Hacking wiki - Archive of obsolete content
To be able to hack the MDC wiki software, you'll need a local webserver install, which can run MediaWiki. Checking out First, check out the <tt>developer.mozilla.org</tt> project from SVN. For anonymous access use: svn co http://svn.mozilla.org/projects/deve...lla.org/trunk/ To see the skins properly, you'll need to also check out <tt>mozilla-org/css</tt> to get the CSS files needed: export CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/www cvs login cvs co mozilla-org/css (when prompted to enter a password, type <tt>anonymous</tt>) Setting up Copy the contents of the <tt>trunk</tt> folder and the <tt>css</tt> folder (Note: the folder itself) into the <tt>www</tt> directory on your server. The contents of the <tt>trunk</tt> directory you just checked out is a slightly m...
...It's done by navigating to <tt>/config/index.php</tt> in your web browser. Polvi claims that you'll have it, but in case you don't, you can copy one from the MediaWiki tarball. ...
...It's done by navigating to <tt>/config/index.php</tt> in your web browser. Polvi claims that you'll have it, but in case you don't, you can copy one from the MediaWiki tarball. ...
Elements - Archive of obsolete content
itionally declare other namespace prefixes used in your binding. bindings contains zero or more binding elements as children. 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). helloworld.html: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <head> <title>Hello world!</title> <style type="text/css"> p { -moz-binding: url(hello.xml#default); } #p03 { -moz-binding: url(hello.xml#hello2); } </style> </head> <body> <p>Default content</p> <p>Default content</p> <p id="p03">Default content</p> </body> </html> hello.xml: <?xml version="1.0"?> <...
...D display CDATA #IMPLIED inheritstyle true #IMPLIED > The binding element describes a single XBL binding. A XBL binding can add anonymous content, fields, properties, methods, and event handlers to HTML/XML elements. A single XBL binding can be attached to an element by using style sheets or by scripting. (See bug 83830 for <table> specifics). ...
... extension). Note: The normal same-origin policy is used for web sites; they can only link to XBL files on the same domain, or within the chrome. For clarity's sake, here's what the embedded XML in the previous example looks like: <?xml version="1.0"?> <bindings id="xbltestBindings" xmlns="http://www.mozilla.org/xbl"> <binding id="xbltest"><content>PASS</content></binding> </bindings> Only CSS declarations provide an easy way to attach bindings to any set of elements. It also makes your binding partially functional if scripting is disabled. In the latter case all methods and handlers will be blocked, but the anonymous content and styling will be still used. Given that the CSS declarations should be always used - unless you need to add bindings at runtime to individual elements. A bind...
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...
...inding id="default"> <!-- A separate binding. You add a binding file using -moz-binding style rule and you address a particular binding by its ID: -moz-binding: url(notes.xml#default) This ID is local within the binding file (not visible in the target document DOM tree). --> <resources> <!-- Obtaining the stylesheet we'll use to (re)style the bound element. --> <stylesheet src="notes.css"/> </resources> <content> <!-- This SVG graphics will be added automatically around each bound element. The position of the original content is indicated by <children/> tag. --> <svg:svg width="60px" height="60px"> <svg:g fill-opacity="0.6" stroke="#FFFFFF" stroke-width="1px"> <svg:circle cx="25px" cy="12px" r="12" fill="#FF0000" transform="translate(0,0)"/> <svg:circle cx="25px" cy...
...'\n\n'; str+= ('On ' + event.type + ' priority set to: ' + this.priority); window.alert(str); ]]></handler> <handler event="mouseover"><![CDATA[ this.$bg = this.style.backgroundColor || '#FFFF00'; this.style.backgroundColor = '#FFCC00'; ]]></handler> <handler event="mouseout"><![CDATA[ this.style.backgroundColor = this.$bg; ]]></handler> </handlers> </binding> </bindings> notes.css .sticker { position: relative; left: 0px; right: 0px; float: left; clear: none; width: 10em; height: 10em; overflow: visible; margin: 1em 1em; padding: 0.5em 0.5em; border: 2px solid blue; background-color: yellow; font: 1em normal "Times New Roman",serif; font-style: italic; cursor: default; } View this example ...
Creating XPI Installer Modules - Archive of obsolete content
les by default, a new way to aggregate and distribute the files has improved performance, made the UI components more portable and easier to install, and made the installation process a much easier one. However, this new arrangement does not make things much easier for the web or user interface developer. The relatively simple process of finding the appropriate resources (i.e. XUL, JavaScript, or CSS files) in the chrome subdirectories and editing them with a text editor has been replaced by something a lot of developers find more confusing and esoteric. This article describes the new packaging scheme of Mozilla and offers a tutorial for creating a new package that can then be redistributed, installed, and made available to users. The XPI Packaging Scheme A complete description of the new pac...
...bed 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. ...
....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 you are developing these resources and before you have made them a package of their own, you can test the basic layo...
The Joy of XUL - Archive of obsolete content
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 of the most c...
...pling of user interface elements with client application logic. This poses a significant problem in team environments because the skills required to develop these two parts are often satisfied by different people. XUL provides a clear separation among the client application definition and programmatic logic ("content" consisting of XUL, XBL, and JavaScript), presentation ("skin" consisting of CSS and images), and language-specific text labels ("locale" consisting of DTDs and string bundles in .properties files). The layout and appearance of XUL applications can be altered independently of the application definition and logic. Further, the application can be localized for different languages and regions independently of its logic or presentation. This degree of separation results in a...
...d of a XUL front end and an XPCOM component that leverages libical, a native library written in C, for date operations and calendar data storage. The Calendar was initially developed exclusively for Linux but was successfully ported to both Macintosh and Windows within a week. XUL provides a rich set of UI components.The user interface for the Calendar is written entirely in XUL, JavaScript, and CSS, which is a testament to the power and flexibility of this application building framework. It uses simple XUL components like boxes, grids, and stacks to compose views for the weeks, days, and months. The initial implementation of Calendar did not exploit XBL because the developers involved were not experienced with this complementary technology. But future plans for the Calendar include converti...
Tree Widget Changes - Archive of obsolete content
checkbox column by setting the type attribute of a column to checkbox. <treecol type="checkbox"> You can then set or clear the checkbox for a particular cell in that column by setting the value attribute to true, or leaving out the attribute. Note that it's the value attribute you use, not the label attribute. ...
...hen set or clear the checkbox for a particular cell in that column by setting the value attribute 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 chan...
...he 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: 1px; border-top: 1px solid ThreeDShadow; border-left: 1px solid...
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 force the win...
...ot 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.css file is selected. This file contains all the d...
... << PreviousNext >> ...
Element Positioning - Archive of obsolete content
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 property. height This specifies the height of the element. By setting eithe...
...an set this by using four attributes: minwidth; This specifies the minimum width that the element can be. minheight This specifies the minimum height that the element can be. maxwidth This specifies the maximum width that the element can be. maxheight This specifies the maximum height that the element can be. The values are always measured in pixels. You can also use the corresponding CSS properties, min-width, min-height, max-width and max-height. These properties are only useful for flexible elements. By setting a maximum height, for example, a stretchy button will only grow to a certain maximum height. You will still be able to resize the window beyond that point but the button will stop growing in size. The box the button is inside will also continue to grow, unless you set a...
...attribute, the align attribute applies to the box containing the elements to be aligned, not to the elements themselves. For example, the first box below will have its children stretch, because that is the default. The second box has an align attribute, so its children will be placed centered. ...
Localization - Archive of obsolete content
he 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. ...
...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. ...
...ccess 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. ...
Stacks and Decks - Archive of obsolete content
out all on top of each other. The first child of the stack is drawn underneath, the second child is drawn next, followed by the third and so on. Any number of elements may be stacked up in a stack. The orient property has little meaning on a stack as children are laid out above each other rather than from side to side. The size of the stack is determined by its largest child, but you can use the CSS properties width, height, min-width and other related properties on both the stack and its children. The stack element might be used for cases where a status indicator needs to be added over an existing 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 emul...
...h, height, min-width and other related properties on both the stack and its children. The stack element might be used for cases where a status indicator needs to be added over an existing 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 fi...
...ext '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 style="background-color: #C0C0C0"> <description value="Disabled" style="color: white; padding-left: 1px; padding-top: 1px;"/> <description value="Disabled" style="color: grey;"/> </...
listcell - Archive of obsolete content
n its left side. right The text will be cropped on its right side. center The text will be cropped in the middle, showing both the start and end of the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can a...
... Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled Type: boolean Indicates whether the element is disabled or not. 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 ...
...ibute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Style classes 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. Tips If you need to right-align a cell's contents, you can do so like this: cell = document.createElement("listcell"); cell.setAttribute("label", "This is the cell's label"); cell.setAttribute("style", "text-align:right"); Related Elements listbox, listcol, listcols, listhead, listheader, listitem ...
Archived Mozilla and build documentation - Archive of obsolete content
s, to get the status of the code. Creating a Skin for Firefox/Getting 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 speci...
...s. As you will see in this article, working with XPCOM objects in Java is not that much different than doing so in C++. Error Console The Error Console is a tool available in most Mozilla-based applications that is used for reporting errors in the application chrome and in web pages user opens. It reports JavaScript-related errors and warnings, CSS errors and arbitrary messages from chrome code. In Firefox, the Error Console can be opened from the tools menu or by Ctrl-Shift-J. Exception logging in JavaScript Technical review completed. Existing Content This is a list of existing mozilla.org documentation. It needs to be checked, prioritized, and migrated. Extension Frequen...
... 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 is implemented in BasicTableLayoutStrategy.cpp the fixed-layout in FixedTableLayoutStrategy.cpp. All these files are in the layout/html/table/src subdirectory. Tamarin The Download Manager schema The Download Manager uses a...
Sunbird Theme Tutorial - Archive of obsolete content
: A jar tool or zip tool An editor for plain text files Software for creating and editing images Note: Some zip tools only work with files whose names have <tt>.zip</tt> at the end. You can use this kind of zip tool if you rename each file before and after using the tool. You also need knowledge of: Using your operating system to create files and directories Using the tools listed above CSS Graphic design Knowledge of XUL, XBL and JavaScript is useful for advanced themes. Making a theme A theme consists of: A unique identifier A file containing information about the theme A file that registers the theme with Sunbird Some files containing the theme itself Set up your theme in Sunbird's profile directory. For information on how to find the profile directory, see the Mozilla...
...ry there. Copy the <tt>calendar</tt> directory that you find there. In your theme directory, create a new directory named <tt>chrome</tt>. Paste the copied <tt>calendar</tt> directory, together with all its contents, into your new <tt>chrome</tt> directory. Now you have a theme, although it looks exactly the same as Sunbird's classic theme. Modifying your theme To modify your theme, change the CSS and image files in any way you like. For testing purposes, go to the <tt>calendar</tt> directory that you have just pasted. Edit the file <tt>calendar.css</tt> there. Add this line at the end: label {color: red;} Save the file. Fixing bug 320823 If you are using the Sunbird 0.3a1 release, or a test build before 2005-12-21, then you must apply a fix for bug 320823 to allow Sunbird to use them...
...bird. Note: Sunbird's views changed at the end of December 2005. So do not waste time styling the old views. Work with a recent test build so that your theme will be compatible with the next release. Testing further changes When you make further changes to your theme, test them by restarting Sunbird. To detect errors, choose Tools - JavaScript Console... The JavaScript Console window displays CSS errors, not just JavaScript errors. Making an icon and preview The Themes window can display an icon and a preview graphic. You normally make these after you have designed the rest of your theme. Make an image file 32 by 32 pixels, and save it as <tt>icon.png</tt> in your theme directory. Make an image file about 200 by 100 pixels, and save it as <tt>preview.png</tt> in your theme directory. ...
-ms-filter - Archive of obsolete content
Warning: Not to be confused with the standard filter property, as the two are fundamentally incompatible with each other. Important: As of Windows Internet Explorer 9 this feature was deprecated. As of Internet Explorer 10 this feature was removed and should no longer be used. ...
...et to a non-zero value to make the gradient horizontal (equivalent to linear-gradient(to right, ...)) StartColor The end color, supports only opaque colors in the #RRGGBB notation. StartColorStr The end color, supports both opaque colors (#RRGGBB) and colors with alpha opacity using the #AARRGGBB notation. ...
...When you use -ms-filter, enclose the progid in single quotes (') or double quotes ("). Use commas (,) to separate multiple values, as shown in the Examples section. An object must have layout for the filter to render. A simple way to accomplish this is to give the element a specified height and width, or both. The shadow filter can...
::-ms-browse - Archive of obsolete content
Other properties are ignored. ...
...Other properties are ignored. ...
... Browser compatibility Historically supported in Internet Explorer and Edge before version 79. ...
::-ms-check - Archive of obsolete content
Other properties are ignored. ...
...Other properties are ignored. ...
...*/ color: red; /* This will make the circle red when the button is checked. */ } input[type=checkbox]::-ms-check { border-color: green; /* This will make the box green when the button is checked. */ color: green; /* This will make the checkm...
::-ms-clear - Archive of obsolete content
The ::-ms-clear CSS pseudo-element creates a clear button at the edge of an <input type="text"> text control that clears the current value. This pseudo-element is non-standard, supported only in Internet Explorer 10, Internet Explorer 11, and Microsoft Edge. The clear button is only shown on focused, non-empty text controls. This includes inputs that appear text-like or fall back to type="text". ...
...udes inputs that appear text-like or fall back to type="text". Such inputs include: <input type="color"> <input type="date"> <input type="datetime"> <input type="datetime-local"> <input type="email"> <input type="month"> <input type="number"> <input type="search"> <input type="tel"> <input type="time"> <input type="url"> <input type="week"> Allowable Properties Only the following CSS properties can be used in a rule with ::-ms-clear in its selector. Other properties are ignored. -ms-high-contrast-adjust background-clip background-color background-image background-origin 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 ...
...*/ /* The cross can be hidden by setting the display attribute as "none" */ } Result The following screenshot shows what the feature will look like: Specifications Not part of any specification. ...
::-ms-fill-upper - Archive of obsolete content
Other properties are ignored. ...
...Other properties are ignored. ...
...-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width Syntax ::-ms-fill-upper Specifications Not part of any specification. Browser compatibility Historically supported in Internet Explorer and Edge before version 79. See also ::-ms-fill-lower ::-ms-track ::-ms-thumb ::-moz-range-progress CSS-Tricks: Styling Cross-Browser Compatible Range Inputs with CSS QuirksMode: Styling and scripting sliders ...
::-ms-fill - Archive of obsolete content
This pseudo-element is available only in Internet Explorer 10, Internet Explorer 11, and Microsoft Edge. All allowable properties except animation-name apply to a determinate progress bar. Only animation-name applies to an indeterminate one. (A progress bar is determinate if it has a value attribute set; otherwise it is indeterminate. An indeterminate progress bar can be selected with the :indeterminate pseudo-class.) By default, Internet Explorer and Edge display a moving dots animation for an indeterminate progress bar. ...
...e progress bar. By setting animation-name on ::-ms-fill, you can change the animation, as shown in this table: Value Description none Turns off the animation so that no dots are displayed. -ms-bar Shows animated dots that flow in a bar pattern. -ms-ring Shows animated dots that flow in a ring pattern. Allowable Properties Only the following CSS properties can be used in a rule with ::-ms-fill in its selector. Other properties are ignored. animation-name background-clip, background-color, background-image, background-origin, background-repeat, and background-size border border-radius box-shadow box-sizing color cursor display (values block, inline-block, none) font height margin -ms-background-position-x -ms-background-po...
...rder border-radius box-shadow box-sizing color cursor display (values block, inline-block, 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: ...
::-ms-thumb - Archive of obsolete content
Other properties are ignored. ...
...Other properties are ignored. ...
...ition-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width Syntax ::-ms-thumb Specifications Not part of any specification. See also ::-ms-track ::-ms-fill-upper ::-ms-fill-lower ::-webkit-slider-thumb ::-moz-range-thumb CSS-Tricks: Styling Cross-Browser Compatible Range Inputs with CSS QuirksMode: Styling and scripting sliders ...
::-ms-track - Archive of obsolete content
Other properties are ignored. ...
...r property within the ::-ms-track selector affects the tick marks inside the track area. 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. Allowable Properties Only the following CSS properties can be used in a rule with ::-ms-track in its selector. Other properties are ignored. 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-col...
...n-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-top transform transform-origin visibility width Syntax ::-ms-track See also ::-ms-thumb ::-ms-fill-upper ::-ms-fill-lower ::-webkit-slider-runnable-track ::-moz-range-track CSS-Tricks: Styling Cross-Browser Compatible Range Inputs with CSS QuirksMode: Styling and scripting sliders ...
Writing JavaScript for XHTML - Archive of obsolete content
se 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[ ... ...
.../*]]>*/--></style> See this document for more on the issues related to application/xhtml+xml and text/html (at least as far as XHTML 1.* and HTML 4; HTML5 addresses many of these problems). ...
...ends with its requests: Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Further Reading You will find several useful articles in the developer wiki: XML in Mozilla DOM XML Introduction XML Extras DOM 2 methods you will need are: DOM:document.createElementNS DOM:document.getElementsByTagNameNS See also Properly Using CSS and JavaScript in XHTML Documents ...
Fixing Incorrectly Sized List Item Markers - Archive of obsolete content
e smaller. See bug 110360, which explains the problem and shows when the fix was applied. In addition, when a document is displayed in "quirks" mode in Mozilla 0.9.4 and later, the markers of lists will not use the font size of the list item text, but will instead stay the same as the user's default font size. See bug 97351 for more details. The Solution Fortunately, there are Mozilla-specific CSS-like rules that can be used to correct both problems. 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 no...
...les that can be used to correct both problems. 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 a...
...e 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 (C) 2001-2003 Netscape. All rights reserved. Note: This reprinted article was originally part of the DevEdge site. ...
Cross Axis - MDN Web Docs Glossary: Definitions of Web-related terms
the cross axis is achieved with the align-items property on the flex container or align-self property on individual items. ...
...s property on the flex container or align-self property on individual items. ...
... on individual items. In the case of a multi-line flex container, with additional space on the cross axis, you can use align-content to control the spacing of the rows. ...
Flex Item - MDN Web Docs Glossary: Definitions of Web-related terms
The direct children of a Flex Container (elements with display: flex or display: inline-flex set on them) become flex items. ...
... The direct children of a Flex Container (elements with display: flex or display: inline-flex set on them) become flex items. ...
...The direct children of a Flex Container (elements with display: flex or display: inline-flex set on them) become flex items. ...
Houdini - MDN Web Docs Glossary: Definitions of Web-related terms
Houdini is a set of low level APIs that give developers the power to extend CSS, providing the ability to hook into the styling and layout process of a browser's rendering engine. Houdini gives developers access to the CSS Object Model (CSSOM), enabling developers to write code the browser can parse as CSS. The benefit of Houdini is that developers can create CSS features without waiting 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. ...
...Houdini code doesn't wait for that first rendering cycle to be complete. ...
...ut, 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 ...
Main Axis - MDN Web Docs Glossary: Definitions of Web-related terms
block direction. On the main axis you can control the sizing of flex items by adding any available space to the items themselves, by way of flex properties on the items. ...
...control the sizing of flex items by adding any available space to the items themselves, by way of flex properties on the items. ...
...e space to the items themselves, by way of flex properties on the items. Or, you can control the space between and around items by using the justify-content property. ...
Style origin - MDN Web Docs Glossary: Definitions of Web-related terms
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. ...
...es 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. 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 f...
... 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 information CSS Cascading and Inheritance: Cascading Origins ...
Accessible multimedia - Learn web development
Previous Overview: Accessibility Next Another category of content that can create accessibility problems is multimedia -- video, audio, and image content need to be given proper textual alternatives so they can be understood by assistive technologies and their users. This article shows how. Prerequisites: Basic computer literacy, a basic understanding of HTML, CSS, and JavaScript, an understanding of what accessibility is. Objective: To understand the accessibility issues behind multimedia, and how to overcome them. Multimedia and accessibility So far in this module we have looked at a variety of content and what needs to be done to ensure its accessibility, ranging from simple text content to data tables, images, native controls such as form element...
...trols. 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, grab a copy of our custom-controls-start.html, custom-controls.css, rabbit320.mp4, and rabbit320.webm files and save them in a new directory on your hard drive. Create a new file called main.js and save it in the same directory. First of all, let's look at the HTML for the video player, in the HTML: <section class="player"> <video controls> <source src="rabbit320.mp4" type="video/mp4"> <source src="rabbit320.webm" type="video/webm"> <p>Your brow...
...e. If you haven't already, go and try out the assessments at Test your skills: HTML images and Test your skills: Multimedia and embedding. ...
Creating fancy letterheaded paper - Learn web development
If you want to make the right impression, writing a letter on nice letterheaded paper can be a really good start. In this assessment we'll challenge you to create an online template to achieve such a look. 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. Starting point To get this assessment started, you should: Make local copies of the HTML and CSS -- save them as index.html and style.css in a new directory. Save local copies of the top, bottom and logo images in the same directory as your code files. Alternatively, you could use a site like JSBin or Glitch to do your...
...ackgrounds. Starting point To get this assessment started, you should: Make local copies of the HTML and CSS -- save them as index.html and style.css in a new directory. Save local copies of the top, bottom and logo images in the same directory as your code files. 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 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 ...
... Add a background declaration to the letter that: Fixes the top image to the top of the letter Fixes the bottom image to the bottom of the letter Adds a semi-transparent gradient over the top of both of the previous backgrounds that gives the letter a bit of texture. ...
Test your skills: Selectors - Learn web development
Give h2 headings a blue background and white text. Cause text wrapped in a span to have a font-size of 200%. ...
... Give h2 headings a blue background and white text. Cause text wrapped in a span to have a font-size of 200%. ...
...ws an h2 element red. Remove the bullets and add a 1px grey bottom border only to list items that are a direct child of the ul with a class of list. 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 Five In this final task add CSS using attribute selectors to do the following: Target the <a> element with a title attribute and make the border pink (border-color: pink). Target the <a> element with an href attribute that contains the word contact somewhere in its value and make the border orange (border-color: orange). Target the <a> element with an href value starting with https and give it a green border (border-color:...
Styling text - Learn web development
With the basics of the CSS language covered, the next CSS topic for you to concentrate on 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. 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 already have basic familiarity with HTML, as discussed in the Introduction to HTML module, and be comfortable with CSS fundamentals, as discussed in Introduction t...
...links. 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 already have basic familiarity with HTML, as discussed in the Introduction to HTML module, and be comfortable with CSS fundamentals, as discussed in Introduction to CSS. 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, 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 ...
...ill 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 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 ar...
What text editors are available? - Learn web development
erent, incompatible packaging systems. That means, if you've set your heart on an obscure text editor, you may have to compile it from source yourself (not for the faint-hearted). What kind of technologies do I want to manipulate? Generally speaking, any text editor can open any text file. That works great for writing notes to yourself, but when you're doing web development and writing in HTML, CSS, and JavaScript, you can produce some pretty large, complex files. Make it easier on yourself by choosing a text editor that understands the technologies you're working with. Many text editors help you out with features like: Syntax highlighting. Make your file more legible by color-coding keywords based on the technology you're using. Code completion. Save you time by auto-completing recurri...
...choosing a text editor that understands the technologies you're working with. Many text editors help you out with features like: Syntax highlighting. Make your file more legible by color-coding keywords based on the technology you're using. Code completion. Save you time by auto-completing recurring structures (for example, automatically close HTML tags, or suggesting valid values for a given CSS property). Code snippets. As you saw when starting a new HTML document, many technologies use the same document structure over and over. Save yourself the hassle of retyping all this by using a code snippet to pre-fill your document. Most text editors now support syntax highlighting, but not necessarily the other two features. Make sure in particular that your text editor supports highlighting...
... Code snippets. As you saw when starting a new HTML document, many technologies use the same document structure over and over. Save yourself the hassle of retyping all this by using a code snippet to pre-fill your document. Most text editors now support syntax highlighting, but not necessarily the other two features. Make sure in particular that your text editor supports highlighting for HTML, CSS, and JavaScript. What kind of basic features do I expect from my text editor? It depends on your needs and plans. These functionalities are often helpful: Search-and-replace, in one or multiple documents, based on regular expressions or other patterns as needed Quickly jump to a given line View two parts of a large document separately View HTML as it will look in the browser Select text ...
Example 1 - Learn web development
This is the first example of code that explains how to build a custom form widget. ...
... } .select .highlight { background: #000; color: #FFFFFF; } Result for basic state Active state HTML <div class="select active"> <span class="value">Cherry</span> <ul class="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> 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 .highlight { background: #000; color: #FFFFFF; } Result for active state Open state HTML <div class="select active"> <span class="value">Cherry</span> <ul class="optList"> <li class="option highlight">Cherry</li> <li class="option">Lemon</li> <li class="option">Banana</li> <li class="option">Strawberry</li> <li class="option">Apple</li> </ul> </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 */ ...
How to structure a web form - Learn web development
that you may not yet understand. Don't worry about this for now; you'll find out how they work in the next article (Basic native form controls). For now, read the descriptions carefully 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. ...
...ind out how they work in the next article (Basic native form controls). For now, read the descriptions carefully 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. ...
...ptions carefully 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. ...
Other form controls - Learn web development
be included when the data is submitted. <textarea> also takes a closing tag, and any default text you want it to contain should be put between the opening and closing tags. In contrast, the <input> is an empty element with no closing tag -- any default value is put inside the value attribute. Note that even though you can put anything inside a <textarea> element (including other HTML elements, CSS, and JavaScript), because of its nature, it is all rendered as if it was plain text content. (Using contenteditable on non-form controls provides an API for capturing HTML/"rich" content instead of plain text). Visually, the text entered wraps and the form control is by default resizable. Modern browsers provide a drag handle that you can drag to increase/decrease the size of the text area. The...
...er in the first article of the series (see the source code also). Controlling multi-line rendering <textarea> accepts three attributes to control its rendering across several lines: cols Specifies the visible width (columns) of the text control, measured in average character widths. This is effectively the starting width, as it can be changed by resizing the <textarea>, and overriden using CSS. The default value if none is specified is 20. rows Specifies the number of visible text rows for the control. This is effectively the starting height, as it can be changed by resizing the <textarea>, and overriden using CSS. The default value if none is specified is 2. wrap Specifies how the control wraps text. The values are soft (the default value), which means the text submitted is not wr...
...s text. The values are soft (the default value), which means the text submitted is not wrapped but the text rendered by the browser is wrapped; hard (the cols attribute must be specified when using this value), which means both the submitted and rendered texts are wrapped, and off, which stops wrapping. Controlling textarea resizability The ability to resize a <textarea> is controlled with the CSS resize property. Its possible values are: both: The default -- allows resizing horizontally and vertically. horizontal: Allows resizing only horizontally. vertical: Allows resizing only vertically. none: Allows no resizing. block and inline: Experimental values that allow resizing in the block or inline direction only (this varies depending on the directionality of your text; read Handling...
Your first form - Learn web development
We'll expand on each of these subtopics in more detail later on in the module. Prerequisites: Basic computer literacy, and a basic understanding of HTML. ...
...ooking 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). Forms are notoriously tricky to style nicely. ...
...- 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. ...
Add a hitmap on top of an image - Learn web development
d 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 text is ma...
... 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 text is mandatory, of course, but many people never see it. The image must clearly indicate where hotspots begin and end. Hotspots must be large enough to tap comfortably, at any viewport size. How large is large enough? 72 x 72 CSS pixels is a good minimum, with additional generous gaps between touch targets. The map of the world at 50languages.com (as of time of writing) illustrates the problem perfectly. It's much easier to tap Russia or North America than Albania or Estonia. You insert your image much the same way as always (with an <img> element and alt text). If the image is only present as a navigation device, you m...
...e shape you choose determines the coordinate information you'll need to provide in coords. For a circle, provide the center's x and y coordinates, followed by the length of the radius. For a rectangle, provide the x/y coordinates of the upper-left and bottom-right corners. For a polygon, to provide the x/y coordinates of each corner (so, at least six values). Coordinates are given in CSS pixels. In case of overlap, source order carries the day. href The URL of the resource you're linking to. You may leave this attribute blank if you don't want the current area to link anywhere (say, if you're making a hollow circle.) alt A mandatory attribute, telling people where the link goes or what it does. alt text only displays when the image is unavailable. Please refer to our gu...
Marking up a letter - Learn web development
ttempting 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...
...he address should sit on a new line, but not be in a new paragraph. Inline semantics The names of the sender and receiver (and Tel and Email) should be marked up with strong importance. The four dates in the document should be have appropriate elements containing machine-readable dates. The first address and first date in the letter should have a class attribute value of sender-column. The CSS you'll add later will cause these to be right aligned, as it should be in the case in a classic letter layout. Mark up the five acronyms/abbreviations in the main text of the letter to provide expansions of each acronym/abbreviation. The six sub/superscripts should be marked up appropriately -- in the chemical formulae, and the numbers 103 and 104 (they should be 10 to the power of 3 and 4, re...
... appropriate links with titles. For the location that the links point to, you may use http://example.com as the URL. Mark up the university motto quote and citation with appropriate elements. The head of the document The character set of the document should be set as utf-8 using the appropriate meta tag. The author of the letter should be specified in an appropriate meta tag. The provided CSS should be included inside an appropriate tag. Hints and tips Use the W3C HTML validator to validate your HTML. Award yourself bonus points if it validates. You don't need to know any CSS to do this assignment. You just need to put the provided CSS inside an HTML element. Example The following screenshot shows an example of what the letter might look like after being marked up. Assess...
Introduction to web APIs - Learn web development
Overview: Client-side web APIs Next First up, we'll start by looking at APIs from a high level -- what are they, how do they work, how to use them in your code, and how are they structured? We'll also take a look at what the different main classes of APIs are, and what kind of uses they have. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, JavaScript basics (see first steps, building blocks, JavaScript objects). Objective: To gain familiarity with APIs, what they can do, and how you can use them in your code. What are APIs? Application Programming Interfaces (APIs) are constructs made available in programming languages to allow developers to create complex functionality more easily. They abstract more complex code away f...
...ay your latest Tweets on your web page). JavaScript libraries -- Usually one or more JavaScript files containing custom functions that you can attach to your web page to speed up or enable writing common functionality. Examples include jQuery, Mootools and React. JavaScript frameworks -- The next step up from libraries, JavaScript frameworks (e.g. Angular and Ember) tend to be packages of HTML, CSS, JavaScript, and other technologies that you install and then use to write an entire web application from scratch. The key difference between a library and a framework is "Inversion of Control". When calling a method from a library, the developer is in control. With a framework, the control is inverted: the framework calls the developer's code. What can APIs do? There are a huge number of APIs...
...hings in your code. You can see this by taking a look at the MDN APIs index 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 se...
A first splash into JavaScript - Learn web development
Previous Overview: First steps Next Now you've learned something about the theory of JavaScript, and what you can do with it, we are going to give you a crash course in the basic features of JavaScript via a completely practical tutorial. Here you'll build up a simple "Guess the number" game, step by step. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, an understanding of what JavaScript is. Objective: To have a first bit of experience at writing some JavaScript, and gain at least a basic understanding of what writing a JavaScript program involves. You won't be expected to understand all of the code in detail immediately -- we just want to introduce you to the high-level concepts for now, and give you an idea of how JavaScri...
...articular case, we first created a guessField constant that stores a reference to the text input form field in our HTML -- the following line can be found amongst our declarations near the top of the code: const guessField = document.querySelector('.guessField'); To get this reference, we used the querySelector() method of the document object. querySelector() takes one piece of information -- a CSS selector that selects the element you want a reference to. Because guessField now contains a reference to an <input> element, it now has access to a number of properties (basically variables stored inside objects, some of which can't have their values changed) and methods (basically functions stored inside objects). One method available to input elements is focus(), so we can now use this line t...
...his: guesses.textContent = 'Where is my paragraph?'; Now for some fun stuff. Try entering the below lines, one by one: guesses.style.backgroundColor = 'yellow'; guesses.style.fontSize = '200%'; guesses.style.padding = '10px'; guesses.style.boxShadow = '3px 3px 6px black'; Every element on a page has a style property, which itself contains an object whose properties contain all the inline CSS styles applied to that element. This allows us to dynamically set new CSS styles on elements using JavaScript. Finished for now... So that's it for building the example. You got to the end -- well done! Try your final code out, or play with our finished version here. If you can't get the example to work, check it against the source code. Previous Overview: First steps Next In this mo...
Perceived performance - Learn web development
instead of a passive wait can make it feel faster. There are tips and tricks to follow. Some of these quick tips have full articles if you want to dive deeper. Displaying content, or at least some part of the page with an indication that content is loading, as quickly as possible, is essential to improving perceived performance. For example, because page render is blocked by loading and parsing CSS and JavaScript, minimizing the amount of CSS and JS that needs to be loaded on initially will have a major impact on improving perceived performance. Even though the bytes might be the same, not blocking the page from rendering makes the load feel faster. Here are a few tips and tricks to help improve performance: Minimize initial load To improve perceived performance, minimize the original pa...
...s 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 when they take more than 50ms to react. They feel that a page is janky when content repaints slower than 16.67ms (or 60 frames per second) or repaints at uneven intervals. Make things like type-ahead a progressive enhancement: use css to display input modal, JS to add typeahead/autocomplete as it is available Make task initiators appear more interactive Making a content request on keydown rather than waiting for keyup can shave 200ms off the perceived load of the content. Adding an interesting but unobtrusive 200ms animation to that keyup even can reduce another 200ms of the perceived load. You're not saving 400ms of time, b...
...e know what we should be speeding up, let's take a look at some metrics and learn how we can measure these events. Previous Overview: Performance Next In this module The "why" of web performance What is web performance? How do users perceive performance? Measuring performance Multimedia: images Multimedia: video JavaScript performance best practices. HTML performance features CSS performance features Fonts and performance Mobile performance Focusing on performance ...
The "why" of web performance - Learn web development
ase in sessions per user. Rebuilding Pinterest pages for performance resulted in a 40% decrease in wait time, a 15% increase in SEO traffic and a 15% increase in conversion rate to signup. To build websites and applications people want to use; to attract and retain site visitors, you need to create an accessible site that provides a good user experience. Building websites requires HTML, CSS, and JavaScript, typically including binary file types such as images and video. The decisions you make and the tools you choose as you build your site can greatly affect the performance of the finished work. Good performance is an asset. Bad performance is a liability. Site speed directly affects bounce rates, conversion, revenue, user satisfaction, and search engine ranking. Performant sites h...
...ly affects bounce rates, conversion, revenue, user satisfaction, and search engine ranking. Performant sites have been shown to increase visitor retention and user satisfaction. Slow content has been shown to lead to site abandonment, with some visitors leaving to never return. Reducing the amount of data that passes between the client and the server lowers the costs to all parties. Reducing HTML/CSS/JavaScript and media file sizes reduces both the time to load and a site's power consumption (see performance budgets). Tracking performance is important. Multiple factors, including network speed and device capabilities affect performance. There is no single performance metric; and differing business objectives may mean different metrics are more relavant to the goals of the site or the organiz...
...y to user experience, as well as the overall effectiveness of most sites. ...
Introduction to client-side frameworks - Learn web development
verview: Client-side JavaScript frameworks Next We begin our look at frameworks with a general overview of the area, looking at a brief history of JavaScript and frameworks, why frameworks exist and what they give us, how to start thinking about choosing a framework to learn, and what alternatives there are to client-side frameworks. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages. Objective: To understand how client-side JavaScript frameworks came to exist, what problems they solve, what alternatives there are, and how to go about choosing one. A brief history When JavaScript debuted in 1996, it added occasional interactivity and excitement to a web that was, up until then, composed of static documents. The web became not just...
...d no, these projects are not related!), FastBoot for Ember, and Angular Universal for Angular. Note: Some SSR solutions are written and maintained by the community, whereas some are "official" solutions provided by the framework's maintainer. Static site generators Static site generators are programs that dynamically generate all the webpages of a multi-page website -- including any relevant CSS or JavaScript -- so that they can be published in any number of places. The publishing host could be a GitHub pages branch, a Netlify instance, or any private server of your choosing, for example. There are a number of advantages of this approach, mostly around performance (your user's device isn't building the page with JavaScript; it's already complete) and security (static pages have fewer att...
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
Framework main features - Learn web development
ript frameworks Next Each major JavaScript framework has a different approach to updating the DOM, handling browser events, and providing an enjoyable developer experience. This article will explore the main features of "the big 4" frameworks, looking at how frameworks tend to work from a high level, and the differences between them. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages. Objective: To understand the main code features of frameworks. Domain-specific languages All of the frameworks discussed in this module are powered by JavaScript, and all allow you to use domain-specific languages (DSLs) in order to build your applications. In particular, React has popularized the use of JSX for writing its components, while Ember ut...
...ent 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 mechanisms for handling dependencies -- using components inside other components, sometimes with multiple hierarchy levels. As with other features, the exact mechanism will differ between frameworks, but the end result is the same. Components tend to import components into other components using the standard JavaScript...
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
Componentizing our React app - Learn web development
ipt frameworks Next At this point, our app is a monolith. Before we can make it do things, we need to break it apart into manageable, descriptive components. React doesn't have any hard rules for what is and isn't a component - that's up to you! In this article we will show you a sensible way to break our app up into components. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Objective: To show a sensible way of breaking our todo list app into components. Defining our first component Defining a component can seem tricky until you have some practice, but the gist is: If it represents an obvious "chunk" of your app, it's probably a component If it gets reused often, it's proba...
...pdate to show only Eat being checked: If you change each <Todo /> component's completed prop, your browser will check or uncheck the equivalent rendered checkboxes accordingly. Gimme some id, please Right now, our <Todo /> component gives every task an id attribute of todo-0. This is bad HTML because id attributes must be unique (they are used as unique identifiers for document fragments, by CSS, JavaScript, etc.). This means we should give our component an id prop that takes a unique value for each Todo. To follow the same pattern we had initially, let's give each instance of the <Todo /> component an ID in the format of todo-i, where i gets larger by one every time: <Todo name="Eat" completed={true} id="todo-0" /> <Todo name="Sleep" completed={false} id="todo-1" /> <Todo name="Repeat...
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
React resources - Learn web development
Previous Overview: 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 examp...
... 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.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 applic...
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
TypeScript support in Svelte - Learn web development
in Svelte applications. First we'll learn what TypeScript is and what benefits it can bring us. Then we'll see how to configure our project to work with TypeScript files. Finally we will go over our app and see what modifications we have to make to fully take advantage of TypeScript features. 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. Objective: Learn how to configure and use TypeScript when developing Svelte applications. Note that our application is fully functional and porting it to TypeScript is completely optional. There are different opinio...
...ng that is not a number it will complain about it: The application template has a validate script configured that runs svelte-check against your code. This package allows you to detect errors and warnings normally displayed by a code editor from the command line, which makes it pretty useful for running it in a continuous integration (CI) pipeline. Just run npm run validate to check for unused CSS, and return A11y hints and TypeScript compile errors. In this case, if you run npm run validate (either in the VS Code console or terminal) you will get the following error: Even better, if you run it from the VS Code integrated terminal (you can open it with the Ctrl + ` keyboard shortcut), Cmd/Ctrl + clicking on the file name will take you to the line containing the error. You can also run...
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
Componentizing our Svelte app - Learn web development
he last article we started developing our Todo list app. The central objective of this article is to look at how to break our app into manageable components and share information between them. We'll componentize our app, then add more functionality to allow users to update existing components. 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. Objective: To learn how to break our app into components and share information among them. Code along with us Git Clone the github repo (if you haven't already done it) with: git clone https://github.com/opensas/...
...our-app Remember to run npm install && npm run dev to start your app in development mode. REPL To code along with us using the REPL, start at https://svelte.dev/repl/99b9eb228b404a2f8c8959b22c0a40d3?version=3.23.2 Breaking the app into components In Svelte, an application is composed from one or more components. A component is a reusable, self-contained block of code that encapsulates HTML, CSS and JavaScript that belong together, written into a .svelte file. Components can be big or small, but they are usually clearly defined: the most effective components serve a single, obvious purpose. The benefits of defining components are comparable to the more general best practice of organizing your code into manageable pieces. It will help you understand how they relate to each other, it will...
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
Cross browser testing - Learn web development
ferent types of code and how to mitigate them, what tools are most useful in helping you test and fix problems, and how to use automation to speed up testing. 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 really learn the basics of the core HTML, CSS, and JavaScript languages first before attempting to use the tools detailed here. Guides Introduction to cross browser testing This article starts the module off by providing an overview of the topic of cross browser testing, answering questions such as "what is cross browser testing?", "what are the most common types of problems you'll encounter?", and "what are the main approaches for test...
...ll down into carrying out testing, looking at identifying a target audience (e.g. what browsers, devices, and other segments should you make sure are tested), lo-fi testing strategies (get yourself a range of devices and some virtual machines and do ad-hoc tests when needed), higher tech strategies (automation, using dedicated testing apps), and testing with user groups. ...
...you make sure are tested), lo-fi testing strategies (get yourself a range of devices and some virtual machines and do ad-hoc tests when needed), higher tech strategies (automation, using dedicated testing apps), and testing with user groups. Handling common HTML and CSS problems With the scene set, we'll now look specifically at the common cross-browser problems you will come across in HTML and CSS code, and what tools can be used to prevent problems from happening, or fix problems that occur. This includes linting code, handing CSS prefixes, using browser dev tools to track down problems, using polyfills to add support into browsers, tackling responsive design problems, and more. Handling common JavaScript problems Now we'll look at common cross-browser JavaScript problems and how to fix...
Command line crash course - Learn web development
cess you'll undoubtedly be required to run some command in the terminal (or on the "command line" -- these are effectively the same thing). This article provides an introduction to the terminal, the essential commands you'll need to enter into it, how to chain commands together, and how to add your own command line interface (CLI) tools. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages. Objective: To understand what the terminal/command line is, what basic commands you should learn, and how to install new command line tools. Welcome to the terminal The terminal is a text interface for executing text-based programs. If you're running any tooling for web development there's a near-guaranteed chance that you'll have to pop open the com...
...Omitting the leading slash like we've done above makes the path relative to the your present working directory. This is exactly the same as you would see with URLs in your web browser. A leading slash means "at the root of the web...
...e'll err on the side of simplicity and install globally to keep things simple. We'll look 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 c...
Learn web development
ial information you need to work towards your goal. Get started Where to start Complete beginner: If you are a complete beginner to web development, we'd recommend that you start by working through our Getting started with the web module, which provides a practical introduction to web development. Beyond the basics: If you have a bit of knowledge already, the next step is to learn HTML and CSS in detail: start with our Introduction to HTML module and move on to our CSS first steps module. Moving onto scripting: If you are comfortable with HTML and CSS already, or you are mainly interested in coding, you'll want to move on to JavaScript or server-side development. Begin with our JavaScript first steps and Server-side first steps modules. Frameworks and tooling: After mastering the ess...
... Note: Our glossary provides terminology definitions. ...
... Topics covered The following is a list of all the topics we 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 a...
Accessibility information for UI designers and developers
lored 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 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 ...
...rough 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 line height (leading) to at least 1.5 times the font size set spacing following paragraphs to at least ...
... 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. See also: Understanding Success Criterion 2.3.3: Animation from Interactions Content on hover or focus If content is revealed on hover or focus, for example in tooltips, there are some things to keep in mind: if the extra content obscures existing content, there should be a way to close it without moving focus if the extra content is opened on hove...
Chrome registration
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 provides mappings from chrome package names to the physical location of chrome packages on disk. This chrome registry is configurable and persistent, and thus a user can install different chrom...
...kage 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 chrome registration manifest ...
..."override" instructions: override chrome://package/type/original-uri.whatever new-resolved-URI [flags] Note: overrides are not recursive (so overriding chrome://foo/content/bar/ with file:///home/john/blah/ will not usually do what you want or expect it to do). Also, the path inside overridden files is relative to the overridden path, not the original one (this can be annoying and/or useful in CSS files, for example). Note: There was a bug in Gecko 1.8.1.5 (Firefox 2.0.0.5) and earlier where you could not use a relative URL for the new-resolved-URI parameter. You needed to provide an absolute URL. See bug 323455. resource Aliases can be created using the resource instruction: resource aliasname uri/to/files/ [flags] This will create a mapping for resource://<aliasname>/ URIs to t...
SVG Guidelines
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 of a file with offscreen shapes. On the other hand, the uncolored ones are easier to spot, since they usually come ...
...g to avoid duplicating those attributes Avoid introducing variants of the same file (color/style variants), and use sprites instead (with class names) Default style values There's usually no need to set the default style value unless you're overriding a style. Here are some commonly seen examples: style="display: none;" on <defs> elements (a <defs> element is hidden by default) type="text/css" on <style> elements stroke: none or stroke-width: 0 SVG grouping Style grouping Group similarly styled shapes under one <g> tag; this avoids having to set the same class/styles on many shapes. Avoid excessive grouping Editors can sometimes do excessive grouping while exporting SVGs. This is due to the way editors work. Nested groups Avoid multiple-level nesting of groups, these make the...
...ing basic algebra, for example: <g transform="translate(-62, -310)"><shape transform="translate(60, 308)"/></g> can be cut down to: <shape transform="translate(-2,-2)"/> because: -62+60 = -310+308 = -2 Performance tips These rules are optional, but they help speeding up the SVG. Avoid using a <use> tag when that <use> tag is being referenced only once in the whole file. Instead of using CSS/SVG transforms, apply directly the transform on the path/shape definition. Tools Tools can help to clean SVG files. Note, however that some of the rules stated above can be hard to detect with automated tools since they require too much context-awareness. To this date, there doesn't seem to be a tool that handles all of the above. However, there are some utilities that cover parts of this doc...
Displaying Places information using views
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 required by the views. It also contains the built-in ...
...to be styled in the same manner that Firefox styles its uses of the view, you should include the following stylesheet. Note that this stylesheet is different from the one given above, which must be included if you use a built-in Places view. The following stylesheet is optional and only applies styles and icons to the built-in tree view: <?xml-stylesheet href="chrome://browser/skin/places/places.css" ?> For examples of instantiating a tree view from JavaScript rather than XUL, see Programmatic generation of the built-in tree view. Column binding The built-in tree view makes it easy to hook up specific columns of your tree to specific properties of the result. It does so by recognizing certain magic values of the id attribute on your treecol elements. A property in the result is bound to ...
...isplays dates or other data. Inserting information into the display that is not determined by the underlying data. Displaying Places information in an element not covered by one of the built-in views. Potentially bad reasons for creating a custom view might include (but are not limited to): Changing only the superficial appearance of a built-in view rather than the content it displays. Try CSS here. Hiding columns of the built-in tree view. Just leave out the treecol elements you want to hide. Managing how the view responds to clicks, commands, and other user interaction. Don't break the separation of concerns here. Views are for displaying data, controllers for logic. You can hook up a built-in view to the standard Places commands and context menu, or you can create a custom control...
mozbrowserasyncscroll
String The type of event. bubbles Read only Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. ...
...rmally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: top The scroll top position in CSS pixels of the document within the browser <iframe>. left The scroll left position in CSS pixels of the document within the browser <iframe>. ...
...he event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: top The scroll top position in CSS pixels of the document within the browser <iframe>. left The scroll left position in CSS pixels of the document within the browser <iframe>. width The width in CSS pixels of the visible part of the document within the browser <iframe>. height The height in CSS pixels of the visible part of the document within the browser <iframe>. scrollWidth The total content width in CSS pixels of the document within the browser <iframe>. scrollHeight The total content height in CSS pixels of the document within the browser <iframe>. Note: top + height may be lar...
CustomizableUI.jsm
absWindow.alert('alert from html window of selected tab'); thisDOMWindow.alert('alert from xul window'); } }); //end - use CustomizableUI.jsm to create the widget //start - use style sheet service to style our widget to give it an icon Cu.import('resource://gre/modules/Services.jsm'); var sss = Cc['@mozilla.org/content/style-sheet-service;1'].getService(Ci.nsIStyleSheetService); var css = ''; css += '@-moz-document url("chrome://browser/content/browser.xul") {'; css += ' #id_of_my_widget_within_customizableui_AND_dom {'; css += ' list-style-image: url("chrome://branding/content/icon16.png")'; //a 16px x 16px icon for when in toolbar css += ' }'; css += ' #id_of_my_widget_within_customizableui_AND_dom[cui-areatype="menu-panel"],'; css += ' toolbarpaletteite...
...) {'; css += ' #id_of_my_widget_within_customizableui_AND_dom {'; css += ' list-style-image: url("chrome://branding/content/icon16.png")'; //a 16px x 16px icon for when in toolbar css += ' }'; css += ' #id_of_my_widget_within_customizableui_AND_dom[cui-areatype="menu-panel"],'; css += ' toolbarpaletteitem[place="palette"] > #id_of_my_widget_within_customizableui_AND_dom {'; css += ' list-style-image: url("chrome://branding/content/icon32.png");'; //a 32px x 32px icon for when in toolbar css += ' }'; css += '}'; var cssEnc = encodeURIComponent(css); var newURIParam = { aURL: 'data:text/css,' + cssEnc, aOriginCharset: null, aBaseURI: null } var cssUri = Services.io.newURI(newURIParam.aURL, newURIParam.aOriginCharset, newURIParam.aBaseURI); //store t...
...32px icon for when in toolbar css += ' }'; css += '}'; var cssEnc = encodeURIComponent(css); var newURIParam = { aURL: 'data:text/css,' + cssEnc, aOriginCharset: null, aBaseURI: null } var cssUri = Services.io.newURI(newURIParam.aURL, newURIParam.aOriginCharset, newURIParam.aBaseURI); //store this in a global var so you can call it when removing the widget sss.loadAndRegisterSheet(cssUri, sss.AUTHOR_SHEET); /**************/ // When you want to remove this widget run this code: // sss.unregisterSheet(cssUri, sss.AUTHOR_SHEET); //remove the style sheet we applied // CustomizableUI.destroyWidget('id_of_my_widget_within_customizableui_AND_dom'); //remove the widget /**************/ CreateWidget - Custom Type - Simple This shows a simple example of how to make a widget with type...
Mozilla DOM Hacking Guide
ed. The relevant code is at nsDOMClassInfo.cpp, around line 4520. These two examples demonstrate the power of the DOM combined with XPConnect and the JavaScript engine. The possibilities are endless. "What do you want to code today?" ;-) All the DOM classes are listed in an enum defined in nsIDOMClassInfo.h, nsDOMClassInfoID. There are classes for the DOM0, Core DOM, HTML, XML, XUL, XBL, range, css, events, etc... The array sClassInfoData, defined in nsDOMClassInfo.cpp, maps each DOM class to its helper class and to the interfaces that are exposed to JavaScript. It is an array of type nsDOMClassInfoData, which is a structure defined in nsIDOMClassInfo.h. The array uses two macros to define its items: NS_DEFINE_CLASSINFO_DATA and NS_DEFINE_CLASSINFO_DATA_WITH_NAME. The first one calls the s...
...e. The interesting part is in nsDOMClassInfo::Init(). There we have a long list of macros. There is one set of macros per DOM class. There you can see, for each object, what interfaces are part of the "flattened" set. As an example, on the window object, we can call all the methods defined on the following interfaces: nsIDOMWindow, nsIDOMJSWindow, nsIDOMEventReciever, nsIDOMEventTarget, nsIDOMViewCSS, and nsIDOMAbstractView. Again, without caring on what interface the method is defined. See Section 1.5 for more information about the Init() method. For the W3C DOM (Level 1, 2, 3) objects, for each object there is one "standards-compliant" interface, which is exactly the same as the W3C one, named nsIDOM<ObjectName>.idl, and a mozilla-specific extension interface, named nsIDOMNS<ObjectName>.id...
... how to specify the interfaces available from JavaScript for a particular DOM class. #define DOM_CLASSINFO_MAP_ENTRY(_if) &NS_GET_IID(_if), The array of pointers interface_list is filled with the addresses of the IID's of all the interfaces passed as arguments to the macro. In our Window example, the interfaces are nsIDOMWindow, nsIDOMJSWindow, nsIDOMEventReciever, nsIDOMEventTarget, nsIDOMViewCSS, and nsIDOMAbstractView. Please see Section 1.2 on interface flattening for an explanation of the use of these interfaces. The initialization for a class is finished by the DOM_CLASSINFO_MAP_END macro. #define DOM_CLASSINFO_MAP_END nsnull }; d.mInterfaces = interface_list; } The interface_list array is terminated by a null pointer. The line d.mInterfaces = interface_list assigns to mInterfaces...
nsIIOService
esired 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 ad...
...systemPrincipal 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...
.... aProxyFlags Flags from nsIProtocolProxyService to use when resolving proxies for this new 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 ) then pass in the Document node instead. For loads that are not related to any document, such as loads coming from ad...
Building an Account Manager Extension
rome 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. ...
...d 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. ...
...countManager.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. ...
nsIParserUtils
rAllowStyle (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. ...
...). 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 forms and form controls (excluding <fieldset> and...
...g to an HTTP server potentially controlled by a third party is not removed. To avoid ambient information leakage upon loading the sanitized content, use the SanitizerInternalEmbedsOnly flag. In that case, <a> links (and similar) to other content are preserved, 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. To preserve <style> elements and style attributes on other elements, use SanitizerAllowStyle. -moz-binding is removed from <style> elements and style attribu...
nsITreeView
in long orientation, in nsIDOMDataTransfer dataTransfer ); Parameters row The index of the row. orientation The position around the given row. Defined in constants. dataTransfer This parameter, added in Gecko 1.9.2, provides the data that has been dropped. getCellProperties() An atomized list of properties for a given cell. Each property, x, that the view gives back will cause the CSS ::moz-tree-cell-*(x) pseudoelement to be matched on the treechildren element. See getRowProperties() for an example. AString getCellProperties( in long row, in nsITreeColumn col, in nsISupportsArray properties ); Parameters row The index of the row. col The current column. properties An array of the cell's current properties. Obsolete since Gecko 22 Return value A string of s...
...ext. AString getCellValue( in long row, in nsITreeColumn col ); Parameters row The index of the row. col The column of the cell. (Note that this is not the column index.) Return value The value of the cell. getColumnProperties() Called to get properties to paint a column background. For shading the sort column, and so on. Each property, x, that the view gives back will cause the CSS ::moz-tree-column(x) to be matched on the treechildren element. See getRowProperties() for an example. void getColumnProperties( in nsITreeColumn col, in nsISupportsArray properties ); Parameters col The current column. properties An array of the column's current properties. Obsolete since Gecko 22 Return value A string of space-separated property names. getImageSrc() The ima...
...alled for columns of type progressmeter. See the constants section for possible modes. long getProgressMode( in long row, in nsITreeColumn col ); Parameters row The index of the row. col The index of the column. Return value The progress mode for the cell. getRowProperties() An atomized list of properties for a given row. Each property, x, that the view gives back will cause the CSS ::moz-tree-row(x) pseudoelement to be matched on the treechildren element. void getRowProperties( in long index, in nsISupportsArray properties ); Parameters index The index of the row. properties An array of the row's current properties. Obsolete since Gecko 22 Return value A string of space-separated property names. Example Your function will not be provided with a propertie...
Thunderbird Configuration Files
nge its value. To do add a new preference, open the context menu (right-click) on any existing preference, go to the New menu, and select the type of preference. Some preferences may require that you restart Thunderbird in order to take effect. Configuration Files Some tips and tricks require that you edit configuration files manually. There are three files you should know about: userChrome.css Used to change the appearance of the browser. userContent.css Used to change the appearance of web pages. user.js Used to change various preferences. All these files are plain text files you need to create in your profile folder and can be edited using a standard text editor, such as Notepad on Windows and gedit or kate on Linux. Locate your profile folder Before the configuration files ...
...er Name]\Application Data on Windows XP/2000, C:\users\[User Name]\AppData\Roaming on Windows Vista. Thunderbird is capable of handling more than one user and thus, more than one profile. The path examples above refers to the default profile that is automatically created when you start Thunderbird for the first time. You can manage any number of profiles by using the Profile Manager. ...
... Thunderbird for the first time. You can manage any number of profiles by using the Profile Manager. userChrome.css This file sets the display rules for various elements in the Thunderbird user interface and is located in the sub-folder called chrome in your profile folder. This folder does not exist by default, so you need to create it before you can start adding your preferences. userContent.css This file sets the display rules for web content and is located in the sub-folder called chrome in your profile folder. As with userChrome.css, this folder does not exist by default, so you need to create it before you can start adding your preferences. user.js This is the additional preferences file for Thunderbird and is located in your profile folder. The file does not exist by default, so ...
DOM Inspector FAQ - Firefox Developer Tools
re they there, and how can I get rid of them? Those text nodes are actually the newlines and spacing between the elements. Please see bug 26179 for a lengthy discussion of why they are there. The good news is, you can hide these whitespace nodes in inspector by unchecking the View > Show Whitespace Nodes menu item. Note that not all empty text nodes will be hidden. Those nodes whose white-space CSS property value prevents the user-agent from collapsing sequences of whitespace will not be hidden. I'm having trouble finding a specific node in the DOM tree. Isn't there is a faster way to find it than navigating the tree? Sure. You can do a search via the node's name, id, or an attribute/value pair. Choose the Find Nodes... menu item from the Edit menu in an inspector window that is inspectin...
...tab$" will return only nodes whose names are exactly "tab". Or, if you do not know anything about the node, you can try to select it by clicking on it. Scroll the node into view, choose the select-by-click toolbar button, and then click on the element you wish to inspect. The Edit menu also includes a Select Element by Click menu item. How do I inspect pseudo-classes and pseudo-elements in the CSS Rules viewer? DOM Inspector allows you to force the :hover, :active, and :focus pseudo-classes to apply to a given node. 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 fo...
...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 (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
Intensive JavaScript - Firefox Developer Tools
The demo website looks like this: It has three controls: a radio button group to control how to run the JavaScript: as a single blocking operation in the main thread, as a series of smaller operations in the main thread using requestAnimationFrame(), or in another thread using a worker. a button to run the JavaScript, labeled "Do pointless computations!". a button to start and stop some CSS animations. This just gives the browser some background tasks to perform. Leaving the radio button set to "Use blocking call in main thread", make a recording: press the "Start animations" button start recording a performance profile press "Do pointless computations!" two or three times stop recording the profile Exactly what you see will vary from one machine to another, but it will be...
..."Do pointless computations!" two or three times stop recording the profile Exactly what you see will vary from one machine to another, but it will be something like this: The top half of this is the waterfall overview. It gives us a compressed view of the Waterfall, which tells us what kinds of operations the browser is doing during the recording. The pink says that we are mostly performing CSS calculations and possibly reflow: this is the CSS animation that's running throughout the profile. Then there are three solid blocks of orange, representing JavaScript execution, one for each time we pressed the button. The bottom half, which is correlated with the timeline summary in time, shows frame rate. We can see that frame rate is pretty healthy for most of the recording, but collapses co...
...at we might have expected to see. Instead of a single solid orange block, each button-press shows up as a long sequence of very short orange blocks. The orange blocks appear one frame apart, and each one represents one of the functions called from requestAnimationFrame(). Note that there are only two button-presses in this profile. The function calls are interleaved with the pink blocks from the CSS animation, and each function is short enough that the browser can handle it without the overall frame rate dropping. Using requestAnimationFrame worked to solve the responsiveness problem here, but there are a couple of potential problems with it: it can be difficult to split up a long-running function into separate self-contained functions. Even this very simple case produced more complex co...
Web Console Helpers - Firefox Developer Tools
The commands The JavaScript command line provided by the Web Console offers a few built-in helper functions that make certain tasks easier. $(selector, element) Looks up a CSS selector string selector , returning the first node descended from element that matches. If unspecified, element defaults to document. Equivalent to document.querySelector() or calls the $ function in the page, if it exists. See the QuerySelector code snippet. $$(selector, element) Looks up a CSS selector string selector, returning an array of DOM nodes descended from element that match. If unspecified, element defaults to document. This is like for document.querySelectorAll(), but returns an array instead of a NodeList. $0 The currently-inspected element in the page. $_ Stores the result of the last e...
... The name to use in saving the file. The file should have a ".png" extension. --fullpage boolean If included, the full webpage will be saved. With this parameter, even the parts of the webpage which are outside the current bounds of the window will be included in the screenshot. When used, "-fullpage" will be appended to the file name. --selector string The CSS query selector for a single element on the page. When supplied, only this element will be included in the screenshot. :unblock (Starting in Firefox 80) Followed by an unquoted string, removes blocking for URLs containing that string. In the Network Monitor, the string is removed from the Request Blocking sidebar. No error is given if the string was not previously blocked. values() ...
...OM node Let's say you have a DOM node with the ID "title". In fact, this page you're reading right now has one, so you can open up the Web Console and try this right now. Let's take a look at the contents of that node by using the $() and inspect() functions: inspect($("#title")) This automatically generates rich output for the object, showing you the contents of the DOM node that matches the CSS selector "#title", which is of course the element with ID "title". You can use the up- and down-arrow keys to navigate through the output, the right-arrow key to expand an item, and the left-arrow key to collapse it. ...
The JavaScript input interpreter - Firefox Developer Tools
tatement. Working with iframes If a page contains embedded iframes, you can use the cd() function to change the console's scope to a specific iframe, and then you can execute functions defined in the document hosted by that iframe. ...
...ad> <body> </body> </html> You can switch context to the iframe like this: cd("#frame1"); Now you'll see that the global window's document is the iframe: And you can call the function defined in the iframe: Helper commands The JavaScript command line provided by the Web Console offers a few built-in helper functions that make certain tasks easier. $(selector, element) Looks up a CSS selector string selector , returning the first node descended from element that matches. If unspecified, element defaults to document. Equivalent to document.querySelector() or calls the $ function in the page, if it exists. See the QuerySelector code snippet. $$(selector, element) Looks up a CSS selector string selector, returning an array of DOM nodes descended from element that match. If...
... The name to use in saving the file. The file should have a ".png" extension. --fullpage boolean If included, the full webpage will be saved. With this parameter, even the parts of the webpage which are outside the current bounds of the window will be included in the screenshot. When used, "-fullpage" will be appended to the file name. --selector string The CSS query selector for a single element on the page. When supplied, only this element will be included in the screenshot. Please refer to the Console API for more information about logging from content. ...
Using images - Web APIs
ur code. var img = new Image(); // Create new img element img.src = 'data:image/gif;base64,R0lGODlhCwALAIAAAAAA3pn/ZiH5BAEAAAEALAAAAAALAAsAAAIUhA+hkcuO4lmNVindo7qyrIXiGBYAOw=='; One advantage of data URLs is that the resulting image is available immediately without another round trip to the server. Another potential advantage is that it is also possible to encapsulate in one file all of your CSS, JavaScript, HTML, and images, making it more portable to other locations. Some disadvantages of this method are that your image is not cached, and for larger images the encoded url can become quite long. Using frames from a video You can also use frames from a video being presented by a <video> element (even if the video is not visible). For example, if you have a <video> element with the ID ...
... 33, 71, 104, 124, 21, 20, 87, 104); // Draw frame ctx.drawImage(document.getElementById('frame'), 0, 0); } We took a different approach to loading the images this time. Instead of loading them by creating new HTMLImageElement objects, we included them as <img> tags directly in our HTML source and retrieved the images from those. The images are hidden from output by setting the CSS property display to none for those images. ScreenshotLive sample The script itself is very simple. Each <img> is assigned an ID attribute, which makes them easy to select using document.getElementById(). We then simply use drawImage() to slice the rhino out of the first image and scale him onto the canvas, then draw the frame on top using a second drawImage() call. Art gallery example In the ...
...ps://udn.realityripple.com/samples/a5/a82eed408d.jpg"></td> <td><img src="https://udn.realityripple.com/samples/6e/d8d545e955.jpg"></td> <td><img src="https://udn.realityripple.com/samples/b7/86ecdc3e8d.jpg"></td> </tr> </table> <img id="frame" src="https://udn.realityripple.com/samples/57/952c634159.png" width="132" height="150"> </body> </html> And here's some CSS to make things look nice: body { background: 0 -100px repeat-x url(https://mdn.mozillademos.org/files/5415/bg_gallery.png) #4F191A; margin: 10px; } img { display: none; } table { margin: 0 auto; } td { padding: 15px; } Tying it all together is the JavaScript to draw our framed images: function draw() { // Loop through all images for (var i = 0; i < document.images.length; i+...
DataTransfer.clearData() - Web APIs
aTransfer object's getData(), setData() and clearData() methods. HTML <span class="tweaked" id="source" draggable="true"> Select this element, drag it to the Drop Zone and then release the selection to move the element. ...
... Living Standard HTML 5.1The definition of 'DataTransfer.c...
... Living Standard HTML 5.1The definition of 'DataTransfer.clearData()' in that specification. Recommenda...
Document.execCommand() - Web APIs
UI 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 authentication c...
...ion, identical to hitting the Delete key on a Windows keyboard. heading Adds a heading element around a selection or insertion point line. Requires the tag-name string as a value argument (i.e. "H1", "H6"). (Not supported by Internet Explorer and Safari.) hiliteColor Changes the background color for the selection or at the insertion point. Requires a color value string as a value argument. useCSS must be true for this to function. (Not supported by Internet Explorer.) increaseFontSize Adds a <big> tag around the selection or at the insertion point. (Not supported by Internet Explorer.) indent Indents the line containing the selection or insertion point. In Firefox, if the selection spans multiple lines at different levels of indentation, only the least indented lines in the selection ...
... the selection or at the insertion point. subscript Toggles subscript on/off for the selection or at the insertion point. superscript Toggles superscript on/off for the selection or at the insertion point. underline Toggles underline on/off for the selection or at the insertion 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 ge...
Document.readyState - Web APIs
case "interactive": // 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. ...
...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. ...
... 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. ...
DocumentFragment.querySelector() - Web APIs
es the specified group of selectors. If the selector matches an ID and this ID is erroneously used several times in the document, it returns the first matching element. If the selectors specified in parameter are invalid a DOMException with a SYNTAX_ERR value is raised. ...
...d a DOMException with a SYNTAX_ERR value is raised. Syntax element = documentfragment.querySelector(selectors); Parameters selectors Is a DOMString containing one or more CSS selectors separated by commas. Examples Basic example In this basic example, the first element in the DocumentFragment with the class "myclass" is returned: var el = documentfragment.querySelector(".myclass"); CSS syntax and the method's argument The string argument pass to querySelector must follow the CSS syntax. ...
...containing one or more CSS selectors separated by commas. Examples Basic example In this basic example, the first element in the DocumentFragment with the class "myclass" is returned: var el = documentfragment.querySelector(".myclass"); CSS syntax and the method's argument The string argument pass to querySelector must follow the CSS syntax. ...
Examples of web and XML development using the DOM - Web APIs
In this case, you are manipulating the individual styles directly. In the next example (see Example 4), you can use stylesheets and their rules to change styles for whole documents. <!DOCTYPE html> <html lang="en"> <head> <title>Changing color and font-size example</title> <script> function changeText() { var p = document.getEleme...
...cation.href = 'http://www.cnn.com/';">linker</p> <form> <p><input value="rec" type="button" onclick="changeText();" /></p> </form> </body> </html> Example 4: Using Stylesheets The styleSheets property on the document object returns a list of the stylesheets that have been loaded on that document. You can access these stylesheets and their rules individually using the stylesheet, style, and CSSRule objects, as demonstrated in this example, which prints out all of the style rule selectors to the console. var ss = document.styleSheets; for(var i = 0; i < ss.length; i++) { for(var j = 0; j < ss[i].cssRules.length; j++) { dump( ss[i].cssRules[j].selectorText + "\n" ); } } For a document with a single stylesheet in which the following three rules are defined: body { background-co...
...</body> </html> Example 6: getComputedStyle This example demonstrates how the window.getComputedStyle method can be used to get the styles of an element that are not set using the style attribute or with JavaScript (e.g., elt.style.backgroundColor="rgb(173, 216, 230)"). These latter types of styles can be retrieved with the more direct elt.style property, whose properties are listed in the DOM CSS Properties List. getComputedStyle() returns a ComputedCSSStyleDeclaration object, whose individual style properties can be referenced with this object's getPropertyValue() method, as the following example document shows. <!DOCTYPE html> <html lang="en"> <head> <title>getComputedStyle example</title> <script> function cStyles() { var RefDiv = document.getElementById("d1"); var txtHeight = ...
EffectTiming.fill - Web APIs
Web › API › EffectTiming › fill
ML content The HTML is pretty simple. We have a <div> named "main" which is a container for the element we'll be animating, which is a <div> with the ID "box". Below that, another <div> serves as a button that will trigger the animation to begin. ...
...-size: 16px; text-align: center; margin-top: 0px; padding-top: 2px; padding-bottom: 4px; color: white; background-color: darkgreen; font: 14px "Open Sans", "Arial", sans-serif; } #text { width: 160px; padding: 10px; position: relative; text-align: center; align-self: center; color: white; font: bold 2em "Lucida Grande", "Open Sans", sans-serif; } While there's other CSS involved in this example, the part that really matters for our purposes is the CSS that styles the "box" element that we'll be animating. 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 th...
... { transform: 'translateY(100%)' } ], { duration: 3000, fill: 'forwards' } ); // Set up the rabbit's animation to play on command by calling rabbitDownAnimation.play() later var rabbitDownAnimation = new Animation(rabbitDownKeyframes, document.timeline); 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 ...
Element.getBoundingClientRect() - Web APIs
e viewport. The element's size is equal to its width/height + padding + border-width in the case that the standard box model is being used, or width/height only if box-sizing: border-box has been set on it. Syntax domRect = element.getBoundingClientRect(); Value The returned value is a DOMRect object which is the union of the rectangles returned by getClientRects() for the element, i.e., the CSS border-boxes associated with the element. The result is the smallest rectangle which contains the entire element, with read-only left, top, right, bottom, x, y, width, and height properties describing the overall border-box in pixels. Properties other than width and height are relative to the top-left of the viewport. Empty border-boxes are completely ignored. If all the element's border-boxes...
...ottom, x, y, width, and height properties describing the overall border-box in pixels. Properties other than width and height are relative to the top-left of the viewport. Empty border-boxes are completely ignored. If all the element's border-boxes are empty, then a rectangle is returned with a width and height of zero and where the top and left are the top-left of the border-box for the first CSS box (in content order) for the element. The amount of scrolling that has been done of the viewport area (or any other scrollable element) is taken into account when computing the bounding rectangle. This means that the rectangle's boundary edges (top, right, bottom, left) change their values every time the scrolling position changes (because their values are relative to the viewport and not abso...
...: ${ rect[key] }`; document.body.appendChild(para); } } Notice how the width/height are equal to the equal to its width/height + padding. Also note how the values of x/left, y/top, right, and bottom are equal to the absolute distance from the relevant edge of the viewport to that side of the element, in each case. Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Element.getBoundingClientRect()' in that specification. Working Draft Initial definition Notes The returned DOMRect object can be modified in modern browsers. This was not true with older versions which effectively returned DOMRectReadOnly. With IE and Edge, not being able to add missing properties to their returned ClientRect, obje...
Element.scrollHeight - Web APIs
reet nisi a odio ornare non congue turpis eleifend. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Cras vulputate libero sed arcu iaculis nec lobortis orci fermentum. ...
... Working Draft Initial definition ...
... Working Draft Initial definition ...
FontFace.display - Web APIs
Web › API › FontFace › display
When this property is used, font loading has a timeline with three periods. The lengths of the first two periods depend on the value of the property and the user agent. (See below.) block period The browser invisibly prepares a fallback font. If the font face loads during this time, it's used to display the text and display is complete. ...
... to display the text and display is complete. swap period If the font face is still not loaded, the fallback font will be shown. When the font face loads, the fallback will be swaped for the downloaded font. failure period If the font face still is not loaded, the fallback font will be shown and no swap will occur. Syntax var display = FontFace.display FontFace.display = display Value A CSSOMString with one of the following values. 'auto': Use the font display strategy provided by the user agent. 'block': Gives the font face a short block period and an infinite swap period. The spec recommends 3 seconds for the block period, though this may vary from browser to browser. 'fallback': Gives the font face a short block period and a short swap period. The spec recommends 100 ms or l...
...d and 3 seconds for the swap period, though these values may vary from browser to browser. 'optional': Gives the font face a short block period and no swap period. The spec recommends 100 ms or less, though this may vary from browser to browser. 'swap': Gives the font face a 0 second block period and an infinite swap period. Specifications Specification Status Comment CSS Font Loading Module Level 3The definition of 'display' in that specification. Working Draft Initial definition. CSS Fonts Module Level 4The definition of 'font-display' in that specification. Working Draft Defines the values for the display property. (They are the same as for font-display.) Browser Compatibility The compatibility table on this page is generated from ...
HTMLCanvasElement - Web APIs
Properties Inherits properties from its parent, HTMLElement. HTMLCanvasElement.height The height HTML attribute of the <canvas> element is a positive integer reflecting the number of logical pixels (or RGBA values) going down one column of the canvas. When the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 150 is used. If no [separate] CSS height is assigned to the <canvas>, then this value will also be used as the height of the canvas in the length-unit CSS Pixel. HTMLCanvasElement.width The width HTML attribute of the <canvas> element is a positive integer reflecting the number of logical pixels (or RGBA values) going across one row of the canvas. When the attribute is not specified, or if it is set to an invalid value, like a ...
... HTMLCanvasElement.mozOpaque Is a Boolean reflecting the moz-opaque HTML attribute of the <canvas> element. It lets the canvas know whether or not translucency will be a factor. ...
... HTMLCanvasElement.mozOpaque Is a Boolean reflecting the moz-opaque HTML attribute of the <canvas> element. ...
HTMLElement: animationend event - Web APIs
If the animation aborts before reaching completion, such as if the element is removed from the DOM or the animation is removed from the element, the animationend event is not fired. ...
...mated = document.querySelector('.animated'); animated.onanimationend = () => { console.log('Animation ended'); }; 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 solid black; margin: .2rem; padding: .2rem; } .animation.active { animation-duration: 2s; animation-name: slidein; animation-iteration-count: 2; } @keyframes slidein { from { margin-left: 100%; width: 300%; } to { margin-left: 0%; width: 100%; } } JS const animation ...
...'click', () => { animation.classList.toggle('active'); animationEventLog.textContent = ''; iterationCount = 0; let active = animation.classList.contains('active'); if (active) { applyAnimation.textContent = "Cancel animation"; } else { applyAnimation.textContent = "Activate animation"; } }); Result Specifications Specification Status Comment CSS Animations Working Draft Initial definition ...
HTMLElement: animationiteration event - Web APIs
This event does not occur at the same time as the animationend event, and therefore does not occur for animations with an animation-iteration-count of one. ...
...onanimationiteration = () => { iterationCount++; console.log(`Animation iteration count: ${iterationCount}`); }; 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 solid black; margin: 0.2rem; padding: 0.2rem; } .animation.active { animation-duration: 2s; animation-name: slidein; animation-iteration-count: 2; } @keyframes slidein { from { transform: translateX(100%) scaleX(3); } to { transform: translateX(0) scaleX(1); } } JS const anim...
...'click', () => { animation.classList.toggle('active'); animationEventLog.textContent = ''; iterationCount = 0; let active = animation.classList.contains('active'); if (active) { applyAnimation.textContent = "Cancel animation"; } else { applyAnimation.textContent = "Activate animation"; } }); Result Specifications Specification Status Comment CSS Animations Working Draft Initial definition ...
HTMLElement: animationstart event - Web APIs
If there is an animation-delay, this event will fire once the delay period has expired. A negative delay will cause the event to fire with an elapsedTime equal to the absolute value of the delay (and, correspondingly, the animation will begin playing at that time index into the sequence). ...
... = document.querySelector('.animated'); animated.onanimationstart = () => { console.log('Animation started'); }; 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 solid black; margin: 0.2rem; padding: 0.2rem; } .animation.active { animation-duration: 2s; animation-name: slidein; animation-iteration-count: 2; } @keyframes slidein { from { transform: translateX(100%) scaleX(3); } to { transform: translateX(0) scaleX(1); } } JS const anim...
...'click', () => { animation.classList.toggle('active'); animationEventLog.textContent = ''; iterationCount = 0; let active = animation.classList.contains('active'); if (active) { applyAnimation.textContent = "Cancel animation"; } else { applyAnimation.textContent = "Activate animation"; } }); Result Specifications Specification Status Comment CSS Animations Working Draft Initial definition ...
HTMLElement.offsetHeight - Web APIs
Floated elements extending below other linear content are ignored. ...
...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. ...
...ndow. However, non-scrollable elements may have large offsetHeight values, much larger than the visible content. These elements are typically contained within scrollable elements; consequently, these non-scrollable elements may be completely or partly invisible, depending on the scrollTop setting of the scrollable container. Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'offsetHeight' in that specification. Working Draft Notes offsetHeight is a property of the DHTML object model which was first introduced by MSIE. It is sometimes referred to as an element's physical/graphical dimensions, or an element's border-box height. ...
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. ...
.... For compatibility (or perhaps other) reasons, you can use the older properties instead (or in addition): border-top-width, border-right-width, border-bottom-width, and border-left-width. Syntax htmlImageElement.border = thickness; let thickness = htmlImageElement.border; Value A DOMString containing an integer value specifying the thickness of the border that should surround the image, in CSS pixels. A value of 0, or an empty string, indicates that there should 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 appearan...
...A value of 0, or an empty string, indicates that there should 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. ...
HTMLImageElement.naturalHeight - Web APIs
The HTMLImageElement interface's naturalHeight property is a read-only value which returns the intrinsic (natural), density-corrected height of the image in CSS pixels. This is the height the image is if drawn with nothing constraining its height; if you don't specify a height for the image, or place the image inside a container that either limits or expressly specifies the image height, it will be rendered this tall. Syntax let naturalHeight = htmlImageElement.naturalHeight; Value An integer value indicating the intrinsic height, in CSS pixels, of the image. This is the height at which the image is naturally drawn when no constraint or specific value is established for the image. This natural height is corrected for the pixel density of the device on which it's being presented, unlike h...
...n which it's being presented, unlike height. If the intrinsic height is not available--either because the image does not specify an intrinsic height or because the image data is not available in order to obtain this information, naturalHeight returns 0. ...
...formation, naturalHeight returns 0. Example This example simply displays both the natural, density-adjusted size of an image as well as its rendered size as altered 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.addEve...
HTMLImageElement.naturalWidth - Web APIs
The HTMLImageElement interface's read-only naturalWidth property returns the intrinsic (natural), density-corrected width of the image in CSS pixels. This is the width the image is if drawn with nothing constraining its width; if you neither specify a width for the image nor place the image inside a container that limits or expressly specifies the image width, this is the number of CSS pixels wide the image will be. The corresponding naturalHeight method returns the natural height of the image. Syntax let naturalWidth = htmlImageElement.naturalWidth; Value An integer value indicating the intrinsic width of the image, in CSS pixels. This is the width at which the image is naturally drawn when no constraint or specific value is established for the image. This natural width is corrected fo...
...t's being presented, unlike the value of width. If the intrinsic width is not available--either because the image does not specify an intrinsic width or because the image data is not available in order to obtain this information, naturalWidth returns 0. ...
...nformation, naturalWidth returns 0. Example This example simply displays both the natural, density-adjusted size of an image as well as its rendered size as altered 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.addEve...
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. ...
...operty 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. ...
HTMLTextAreaElement - Web APIs
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. Examples Autogrowing textarea example Make a textarea autogrow while typing: JavaScript function autoGrow (oField) { if (oField.scrollHeight > oField.clientHeight) { oField.style.height = oField.scrollHeight + "px"; } } CSS textarea.noscrollbars { overflow: hidden; width: 300px; height: 100px; } HTML <form> <fieldset> <legend>Your comments</legend> <p><textarea class="noscrollbars" onkeyup="autoGrow(this);"></textarea></p> <p><input type="submit" value="Send" /></p> </fieldset> </form> Insert HTML tags example Insert some HTML tags or smiles or any custom text in a textarea. JavaScript...
...ut.selectionEnd, sOldText = oMsgInput.value; oMsgInput.value = sOldText.substring(0, nSelStart) + (bDouble ? sStartTag + sOldText.substring(nSelStart, nSelEnd) + sEndTag : sStartTag) + sOldText.substring(nSelEnd); oMsgInput.setSelectionRange(bDouble || nSelStart === nSelEnd ? nSelStart + sStartTag.length : nSelStart, (bDouble ? ...
...lectionEnd, sOldText = oMsgInput.value; oMsgInput.value = sOldText.substring(0, nSelStart) + (bDouble ? sStartTag + sOldText.substring(nSelStart, nSelEnd) + sEndTag : sStartTag) + sOldText.substring(nSelEnd); oMsgInput.setSelectionRange(bDouble || nSelStart === nSelEnd ? nSelStart + sStartTag.length : nSelStart, (bDouble ? ...
Ajax navigation example - Web APIs
It is shared between all ajax ...
...It is shared between all ajax pages.</p>...
...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("Unknown error."); ...
MouseEvent.clientX - Web APIs
n the application's client area at which the event occurred (as opposed to the coordinate within the page). For example, clicking on the left edge of the client area will always result in a mouse event with a clientX value of 0, regardless of whether the page is scrolled horizontally. Syntax var x = instanceOfMouseEvent.clientX Return value A double floating point value, as redefined by the CSSOM View Module. Originally, this property was defined as a long integer. See the "Browser compatibility" section for details. Example This example displays your mouse's coordinates whenever you trigger the mousemove event. HTML <p>Move your mouse to see its position.</p> <p id="screen-log"></p> JavaScript let screenLog = document.querySelector('#screen-log'); document.addEventListener('mouse...
... Working Draft Redefines MouseEvent from long to double. Document Object Model (DOM) Level 3 Events SpecificationThe definition of 'MouseEvent.clientX' in that specification. Obsolete No change from Document Object Model (DOM) Level 2 Events Specification. Document Object Model (DOM) Le...
... Working Draft Redefines MouseEvent from long to double. Document Object Model (DOM) Level 3 Events SpecificationThe definition of 'MouseEvent.clientX' in that specification. Obsolete No change from Document Object Model (DOM) Level 2 Events Specification. Document Object Model (DOM) Level 2 Events Speci...
MouseEvent.clientY - Web APIs
thin the application's client area at which the event occurred (as opposed to the coordinate within the page). For example, clicking on the top edge of the client area will always result in a mouse event with a clientY value of 0, regardless of whether the page is scrolled vertically. Syntax var y = instanceOfMouseEvent.clientY Return value A double floating point value, as redefined by the CSSOM View Module. Originally, this property was defined as a long integer. See the "Browser compatibility" section for details. Example This example displays your mouse's coordinates whenever you trigger the mousemove event. HTML <p>Move your mouse to see its position.</p> <p id="screen-log"></p> JavaScript let screenLog = document.querySelector('#screen-log'); document.addEventListener('mouse...
... Working Draft Redefines MouseEvent from long to double. Document Object Model (DOM) Level 3 Events SpecificationThe definition of 'MouseEvent.clientY' in that specification. Obsolete No change from Document Object Model (DOM) Level 2 Events Specification. Document Object Model (DOM) Le...
... Working Draft Redefines MouseEvent from long to double. Document Object Model (DOM) Level 3 Events SpecificationThe definition of 'MouseEvent.clientY' in that specification. Obsolete No change from Document Object Model (DOM) Level 2 Events Specification. Document Object Model (DOM) Level 2 Events Speci...
MouseEvent - Web APIs
Working Draft Redefines MouseEvent from long to double. This means that a PointerEvent whose pointerType is mouse will be a double. Pointer LockThe definition of 'MouseEvent' in that specification. Candidate Recommendation From Document Object Model (DOM) Level 3 Events Specification, added ...
... Working Draft Redefines MouseEvent from long to double. This means that a PointerEvent whose pointerType is mouse will be a double. Pointer LockThe definition of 'MouseEvent' in that specification. Candidate Recommendation From Document Object Model (DOM) Level 3 Events Specification, added movementX and move...
...on of 'MouseEvent' in that specification. Working Draft Redefines MouseEvent from long to double. This means that a PointerEvent whose pointerType is mouse will be a double. Pointer LockThe definition of 'MouseEvent' in that specification. Candidate Recommendation From Document Object Model (DOM) Level 3 Events Specification, added movementX and movementY properties. CSS Object Model (CSSOM) View ModuleThe definition of 'MouseEvent' in that specification. Working Draft From Document Object Model (DOM) Level 3 Events Specification, added offsetX and offsetY, pageX and pageY, x, and y properties. Redefined screen, page, client, and coordinate (x and y) properties as double from long. UI EventsThe definition of 'MouseEvent' in that specification. W...
PaintWorklet - Web APIs
The PaintWorklet interface of the CSS Painting API programmatically generates an image where a CSS property expects a file. Access this interface through CSS.paintWorklet. Properties PaintWorklet.devicePixelRatio Returns the current device's ratio of physical pixels to logical pixels. Event handlers None. Methods This interface inherits methods from Worklet. PaintWorklet.registerPaint() Registers a class programmatically generate an image where a CSS property expects a file. CSS.PaintWorklet.addModule() The addModule() method, inhertied from the Worklet interface loads the module in the given JavaScript file and adds it to the current PaintWorklet. Examples The following three examples go together to show creating, loading, and using a PaintWorklet. Create a PaintWorkle...
....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.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 @s...
...implest 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 Status Comment CSS Painting API Level 1The definition of 'PaintWorkletGlobalScope' in that specification. Working Draft Initial definition. ...
Range.getBoundingClientRect() - Web APIs
getBoundingClientRect() for details on the returned value. Syntax boundingRect = range.getBoundingClientRect() Example HTML <div id="highlight"></div> <p>This example positions a "highlight" rectangle behind the contents of a range. The range's content <b>starts here</b> and continues on until it <b>ends here</b>. ...
... Working Draft Initial specification. ...
... Working Draft Initial specification. ...
SVGSVGElement - Web APIs
osition and size values are unitless values in the coordinate system of the parent element. If no parent element exists (i.e., <svg> element represents the root of the document tree), if this SVG document is embedded as part of another document (e.g., via the HTML <object> element), then the position and size are unitless values in the coordinate system of the parent document. ...
...rent element. If no parent element exists (i.e., <svg> element represents the root of the document tree), if this SVG document is embedded as part of another document (e.g., via the HTML <object> element), then the position and size are unitless values in the coordinate system of the parent document. (If the parent uses CSS or XSL layout, then unitless values represent pixel units for the current CSS or XSL viewport.) SVGSVGElement.pixelUnitToMillimeterX A float representing the size of the pixel unit (as defined by CSS2) along the x-axis of the viewport, which represents a unit somewhere in the range of 70dpi to 120dpi, and, on systems that support this, might actually match the characteristics of the target medium. On systems where it is impossible to know the size of a pixel, a suitabl...
...s id. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'SVGSVGElement' in that specification. Candidate Recommendation Replaced the inheritance from SVGElement by SVGGraphicsElement, removed the implemented interfaces SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGStylable, SVGLocatable, DocumentEvent, ViewCSS, and DocumentCSS and added implemented interface WindowEventHandlers. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGSVGElement' in that specification. Recommendation Initial definition ...
ScrollToOptions - Web APIs
A ScrollToOptions dictionary can be provided as a parameter for the following methods: Window.scroll() Window.scrollBy() Window.scrollTo() Element.scroll() Element.scrollBy() Element.scrollTo() Properties ScrollToOptions.top Specifies the number of pixels along the Y axis to scroll the window or element. ScrollToOptions.left Specifies the number of pixels along the X axis to scroll the window or element. ScrollToOptions.behavior Specifies whether the scrolling should animate smoothly, or happen instantly in a single jump. ...
... Working Draft ...
... Working Draft ...
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. <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/StylePropertyMap" target="_top"><rect x="1" y="1" width="160" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="81" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">StylePropertyM...
...-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">StylePropertyMap</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties Inherits properties from its parent, StylePropertyMapReadOnly. Methods Inherits methods from its parent, StylePropertyMapReadOnly. ...
...r-events: all;} Properties Inherits properties from its parent, StylePropertyMapReadOnly. Methods Inherits methods from its parent, StylePropertyMapReadOnly. StylePropertyMap.append() Adds a new CSS declaration to the StylePropertyMap with the given property and value. StylePropertyMap.clear() Removes all declarations in the StylePropertyMap. StylePropertyMap.delete() Removes the CSS declaration with the given property. StylePropertyMap.set() Changes the CSS declaration with the given property. Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'StylePropertyMap' in that specification. Working Draft Initial definition. ...
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. ...
...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. Let's start by creating 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.querySele...
...t stylesList = document.querySelector('#regurgitation'); // Retrieve all computed styles with computedStyleMap() const styleMap = myElement.computedStyleMap(); // array of properties we're interested in const ofInterest = ['font-weight', 'border-left-color', 'color', '--colour']; // iterate thru our properties of interest for ( let i = 0; i < ofInterest.length; i++ ) { // properties const cssProperty = document.createElement('dt'); cssProperty.appendChild(document.createTextNode(ofInterest[i])); stylesList.appendChild(cssProperty); // values const cssValue = document.createElement('dd'); cssValue.appendChild(document.createTextNode( styleMap.get(ofInterest[i]))); stylesList.appendChild(cssValue); } Specifications Specification Status Comment C...
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 ...
... Working Draft ...
... Working Draft ...
TransitionEvent - Web APIs
The TransitionEvent interface represents events providing information related to transitions. Constructor TransitionEvent() Creates a TransitionEvent event with the given parameters. Properties Also inherits properties from its parent Event. TransitionEvent.propertyName Read only Is a DOMString containing the name CSS property associated with the transition. TransitionEvent.elapsedTime Read only Is a float giving the amount of time the transition has been running, in seconds, when this event fired. This value is not affected by the transition-delay property. TransitionEvent.pseudoElement Read only Is a DOMString, starting with ::, containing the name of the pseudo-element the animation runs on. If the transition doesn't run on a pseudo-element but on the element,...
... in seconds, when this event fired. This value is not affected by the transition-delay property. TransitionEvent.pseudoElement Read only Is a DOMString, starting with ::, containing the name of the pseudo-element the animation runs on. If the transition doesn't run on a pseudo-element but on the element, an empty string: ''. Types of TransitionEvent transitioncancel An Event fired when a CSS transition has been cancelled. transitionend An Event fired when a CSS transition has finished playing. transitionrun An Event fired when a CSS transition is created, when it is added to a set of running transitions, though not nessarilty started transitionstart An Event fired when a CSS transition has started transitioning. Methods Also inherits properties from its parent Event. Tran...
..., though not nessarilty started transitionstart An Event fired when a CSS transition has started transitioning. Methods Also inherits properties from its parent Event. TransitionEvent.initTransitionEvent() Initializes a TransitionEvent created using the deprecated Document.createEvent("TransitionEvent") method. Specifications Specification Status Comment CSS TransitionsThe definition of 'TransitionEvent' in that specification. Working Draft Initial definition. ...
Web Animations API Concepts - Web APIs
engine and describes how animations should be implemented across browsers. This article will introduce you to the important concepts behind the WAAPI, providing you with a theoretical understanding of how it works so you can use it effectively. To learn how to put the API to use, check out its sister article, Using the Web Animations API. The Web Animations API fills the gap between declarative CSS animations and transitions, and dynamic JavaScript animations. This means we can use it to create and manipulate CSS-like animations that go from one pre-defined state to another, or we can use variables, loops, and callbacks to create interactive animations that adapt and react to changing inputs. History Over a decade ago, Synchronized Multimedia Integration Language, or SMIL (pronounced "smi...
...loops, and callbacks to create interactive animations that adapt and react to changing inputs. History Over a decade ago, Synchronized Multimedia Integration Language, or SMIL (pronounced "smile"), brought animation to SVG. Back then it was the only animation engine browsers had to worry about. While four out of five browsers supported SMIL, it only animated SVG elements, could not be used from CSS, and was very complex -- often leading to inconsistent implementations. Ten years later, the Safari team introduced the CSS Animations and CSS Transitions specs. The Internet Explorer team requested an animations API to consolidate and normalize animation functionality across all browsers, and thus efforts began in earnest among Mozilla Firefox and Google Chrome developers to create the one anim...
... We can assemble all these pieces together to create a working animation with the Animation() Constructor or we can use the Element.animate() shortcut function. (Read more about how to use Element.animate() in Using the Web Animations API.) Uses The API allows for the creation of dynamic animations that can be updated on the fly as well as more straightforward, declarative animations like those CSS creates. It can be used in automated tests to ensure that your UI animations are running correctly. It opens up the browser's rendering engine for building animation development tools like timelines. It is also a performant base on which to build a custom or commercial animation library. (See Animating like you just don't care with Element.animate.) In some instances, it may negate the need for a...
Using the Web Speech API - Web APIs
in a supporting desktop browser, or navigate to the live demo URL in a supporting mobile browser like Chrome. Browser support Support for Web Speech API speech recognition is curently limited to Chrome for Desktop and Android -- Chrome has supported it since around version 33 but with prefixed interfaces, so you need to include prefixed versions of them, e.g. webkitSpeechRecognition. ...
...esktop browser, or navigate to the live demo URL in a supporting mobile browser like Chrome. Browser support Support for Web Speech API speech recognition is curently limited to Chrome for Desktop and Android -- Chrome has supported it since around version 33 but with prefixed interfaces, so you need to include prefixed versions of them, e.g. webkitSpeechRecognition. HTML and CSS The HTML and CSS for the app is really trivial. We simply have a title, instructions paragraph, and a div into which we output diagnostic messages. <h1>Speech color changer</h1> <p>Tap/click then say a color to change the background color of the app.</p> <div> <p class="output"><em>...diagnostic messages</em></p> </div> The CSS provides a very simple responsive styling so that it looks ok across devices. Jav...
...ollowing: Firefox desktop and mobile support it in Gecko 42+ (Windows)/44+, without prefixes, and it can be turned on by flipping the media.webspeech.synth.enabled flag to true in about:config. Firefox OS 2.5+ supports it, by default, and without the need for any permissions. Chrome for Desktop and Android have supported it since around version 33, without prefixes. HTML and CSS The HTML and CSS are again pretty trivial, simply containing a title, some instructions for use, and a form with some simple controls. The <select> element is initially empty, but is populated with <option>s via JavaScript (see later on.) <h1>Speech synthesiser</h1> <p>Enter some text in the input below and press return to hear it. change voices using the dropdown menu.</p> <form> <input ty...
Window.pageYOffset - Web APIs
ment. By doing so, we set the vertical scrolling position of the frame's document so that it's the same as the top edge of the target element. This will automatically set the scrolling position to the maximum possible value if the attempted scroll would exceed the maximum. This prevents us from falling off the edge of the document. Nobody wants to know what's out there. There might be dragons. CSS iframe { width: 620px; height: 450px; border: 1px solid black; } #info { margin-top: 20px; font: 16px "Open Sans", "Helvetica", "Arial"; } Result The result follows. Note that the frame's contents have been scrolled to show the section named "Overview", and that the value of the pageYOffset property is shown with the corresponding value. Specification Specification ...
... Working Draft ...
... Working Draft ...
Window.screenX - Web APIs
Web › API › Window › screenX
Examples In our screenleft-screentop (source code) example, you'll see a canvas onto which has been drawn a circle. ...
... Examples In our screenleft-screentop (source code) example, you'll see a canvas onto which has been drawn a circle. ...
...sitionElem); These work in exactly the same way as screenX/screenY. Also in the code we include a snippet that detects whether screenLeft is supported, and if not, polyfills in screenLeft/screenTop using screenX/screenY. if(!window.screenLeft) { window.screenLeft = window.screenX; window.screenTop = window.screenY; } Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Window.screenX' in that specification. Working Draft Initial definition. ...
Window.screenY - Web APIs
Web › API › Window › screenY
Examples In our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. ...
... Examples In our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. ...
...sitionElem); These work in exactly the same way as screenX/screenY. Also in the code we include a snippet that detects whether screenLeft is supported, and if not, polyfills in screenLeft/screenTop using screenX/screenY. if(!window.screenLeft) { window.screenLeft = window.screenX; window.screenTop = window.screenY; } Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Window.screenY' in that specification. Working Draft Initial definition. ...
Window.scrollY - Web APIs
Web › API › Window › scrollY
Y property: window.pageYOffset === window.scrollY; // always true For cross-browser compatibility, use window.pageYOffset instead of window.scrollY. Additionally, older versions of Internet Explorer (< 9) do not support either property and must be worked around by checking other non-standard properties. ...
...llY; // always true For cross-browser compatibility, use window.pageYOffset instead of window.scrollY. Additionally, older versions of Internet Explorer (< 9) do not support either property and must be worked around by checking other non-standard properties. ...
...ageYOffset instead of window.scrollY. Additionally, older versions of Internet Explorer (< 9) do not support either property and must be worked around by checking other non-standard properties. A fully compatible example: var supportPageOffset = window.pageXOffset !== undefined; var isCSS1Compat = ((document.compatMode || "") === "CSS1Compat"); var x = supportPageOffset ? window.pageXOffset : isCSS1Compat ? document.documentElement.scrollLeft : document.body.scrollLeft; var y = supportPageOffset ? window.pageYOffset : isCSS1Compat ? document.documentElement.scrollTop : document.body.scrollTop; Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'window.scrollY' in that specification. Working Draft ...
Window - Web APIs
Web › API › Window
y be accessed by the origin that created it. Window.menubar Read only Returns the menubar object, whose visibility can be toggled in the window. Window.messageManager Returns the message manager object for this window. Window.mozInnerScreenX Read only Returns the horizontal (X) coordinate of the top-left corner of the window's viewport, in screen coordinates. This value is reported in CSS pixels. See mozScreenPixelsPerCSSPixel in nsIDOMWindowUtils for a conversion factor to adapt to screen pixels if needed. Window.mozInnerScreenY Read only Returns the vertical (Y) coordinate of the top-left corner of the window's viewport, in screen coordinates. This value is reported in CSS pixels. See mozScreenPixelsPerCSSPixel for a conversion factor to adapt to screen pixels if needed. W...
...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 representing the specified media query string. Window.maximize() FIXME: NeedsContents Window.minimize() (t...
..., regardless of whether or not there is a handler in place to catch the rejection. Also available through the onrejectionhandled event handler property. unhandledrejection Sent when a JavaScript Promise is rejected but there is no handler in place to catch the rejection. Also available using the onunhandledrejection event handler property. Transition events transitioncancel Fired when a CSS transition is canceled. Also available via the ontransitioncancel property. transitionend Fired when a CSS transition has completed. Also available via the ontransitionend property. transitionrun Fired when a CSS transition is first created. Also available via the ontransitionrun property. transitionstart Fired when a CSS transition has actually started. Also available via the ontransit...
WindowOrWorkerGlobalScope.setInterval() - Web APIs
this.rate = nRate || 100; this.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...
...= 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-size: 12px; text-...
...unction regardless of the fact that the end has been reached or not. In any case the internal INDEX property is increased/decreased (depending on the actual direction of the process). ...
Worklet.addModule() - Web APIs
Web › API › Worklet › addModule
one of the following errors to the rejection handler. AbortError The specified script is invalid or could not be loaded. SyntaxError The specified moduleURL is invalid. ...
...r The specified script is invalid or could not be loaded. SyntaxError The specified moduleURL is invalid. ...
...e specified moduleURL is invalid. Examples AudioWorklet example const audioCtx = new AudioContext(); const audioWorklet = audioCtx.audioWorklet; await audioWorklet.addModule('modules/bypassFilter.js', { credentials: 'omit', }); PaintWorklet example CSS.paintWorklet.addModule('https://mdn.github.io/houdini-examples/cssPaint/intro/worklets/hilite.js'); Once a paintWorklet is included, the CSS paint() function can be used to include the image created by the worklet: @supports (background-image: paint(id)) { h1 { background-image: paint(hollowHighlights, filled, 3px); } } Specifications Specification Status Comment Worklets Level 1The definition of 'addModule()' in that specification. Working Draft ...
ARIA: button role - Accessibility
aria-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...
...new name to the list of names. Try the example by adding a name to the text box. The button will cause the name to be added to a list. ...
...ype="button" onclick="handleBtnClick()" onKeyDown="handleBtnKeyDown()"> Mute Audio </button> <span role="button" tabindex="0" aria-pressed="false" onclick="handleBtnClick(event)" onKeyDown="handleBtnKeyDown(event)"> Mute Audio </span> <audio id="audio" src="https://udn.realityripple.com/samples/41/191d072707.mp3"> Your browser does not support the <code>audio</code> element. ...
Text labels and names - Accessibility
frame in order to understand what it contains, which can be difficult and confusing. The <frame> element is no longer part of the HTML specification as of HTML5. Support for it may be dropped by browsers in the future. In addition, it is difficult for screen readers to navigate pages with <frame> elements. For best accessibility and future maintenance, redesign any pages that use frames to use CSS to achieve a similar layout. As a best practice, also provide a <title> for the document that is enclosed in the frame, with content identical to the frame's title attribute. (This assumes that the enclosed document is under your control; if not, try to match the frame's title attribute to the document's title.) Some screen readers replace the contents of the title attribute with the contents of...
...element an alt attribute containing a name that describes the symbol. Since mglyph elements are used for non-standard symbols without Unicode definitions, screen readers won't automatically be able to name them. Alternative text helps users of screen readers understand the symbol. Headings must be labeled Make sure that your headings have non-empty text content, and are not hidden, such as with CSS display:none or aria-hidden=true. Users of screen readers rely on headings to understand the structure and content of a document. Also, be sure you are using heading elements only for actual section headings, and not as a shortcut way to make text stand out. Screen reader users typically "skim" a page's headings, much like sighted users; non-heading text that is marked-up with heading elements c...
...sing heading elements only for actual section headings, and not as a shortcut way to make text stand out. Screen reader users typically "skim" a page's headings, much like sighted users; non-heading text that is marked-up with heading elements can cause confusion. Headings should have visible text content Make sure that your headings have non-empty text content, and are not hidden, such as with CSS display:none or aria-hidden=true. Users of screen readers rely on headings to understand the structure and content of a document. Do not use heading elements to mark up images or other graphical content. Use title attribute to describe <iframe> content Make sure that <iframe> elements have a title attribute to describe the contents of the frame. Without a title, users of assistive technologies ...
Guide to Web APIs - Developer guides
Web › Guide › API
can be used 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. ...
...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. ...
...creasingly 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. ...
Video player styling basics - Developer guides
This has now been changed to use a data-state attribute, which this code already uses to handle its fullscreen implementation. This "data-state" idea is also used for setting the current state of buttons within the video control set, which allows specific state styling. Java...
...bove, 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, which is given a maximum width and height (based on the dimensions of the video used) and centered within the page: figure { max-width:64rem; width:100%; max-height:30.8...
...There is a reason for this! Even though the browser's default video control set has been turned off, many browsers make them accessible b...
Index - Developer guides
Web › Guide › Index
(Mozilla experimental) DOM The experimental touch events API described on this page was available from Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) to Gecko/Firefox 17. You should instead use the standard touch events API, supported since Gecko/Firefox 6 with multi-touch support added in Gecko/Firefox 12. 26 Using device orientation with 3D transforms Advanced, CSS, DOM, NeedsUpdate, Orientation, Transforms This article provides tips on how to use device orientation information in tandem with CSS 3D transforms. 27 Graphics on the Web 2D, 3D, Canvas, Graphics, HTML5, SVG, Web, WebGL, WebRTC Websites and applications often need to present graphics, such as images.These articles provide insight into how you can accomplish this. ...
...can be used 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. 29 Index Guide, Index Found 31 pages: 30 Introduction to Web development Beginner, CSS, CodingScripting, Development, HTML, JavaScript, Web Whether you're just getting started with Web development, or are just expanding your horizons into new realms of Web awesomeness, the links here should help you get started. 31 Localizations and character encodings Character encodings, HTML, Localization, NeedsMarkupWork Browsers process text as Unicode internally. Ho...
...ns for managing user input and implementing controls in open web apps, along with FAQs, real-world examples, and links to further information for anyone needing more detailed information on the underlying technologies. Relevant APIs and events include touch events, Pointer Lock API, Screen Orientation API, Fullscreen API, Drag & Drop and more. 43 Writing forward-compatible websites CSS, Compatibility, DOM, HTML, JavaScript, Web Development This page explains how to write websites that do not break when new browser versions are released. This is especially important for intranets and other non-public websites; if we can't see your code, we can't see that it broke. It's not always possible to follow all of these, but following as many of them as possible will help future...
Writing forward-compatible websites - Developer guides
the site. Don't use vendor-prefixed features except to target old buggy versions Vendor-prefixed features can change behavior in future releases. Once a browser has shipped 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 unprefixe...
...as 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 can still change in unexpected ways. Most especially, don't use the unprefixed version if no browser actually supports it. You can't assume that the syntax of the final version will be the same as the syntax of any of the prefixed versions. ...
...work for a bit, then break if a specification attaches a meaning to that attribute. Here's an example that works in browsers without HTML5 support but breaks in a browser supporting HTML5: <form action="http://www.example.com"> <input type="submit" value="Submit the form" </form> due to the missing > on the input tag. Don't leave experiments that didn't work in your code If you try using a CSS property to do something you want, but it has no effect, remove it. It might start doing something you don't expect in the future ...
<iframe>: The Inline Frame element - HTML: Hypertext Markup Language
Web › HTML › Element › iframe
gacy attribute and redefined as allow="fullscreen". allowpaymentrequest Set to true if a cross-origin <iframe> should be allowed to invoke the Payment Request API. This attribute is considered a legacy attribute and redefined as allow="payment". csp A Content Security Policy enforced for the embedded resource. See HTMLIFrameElement.csp for details. height The height of the frame in CSS pixels. Default is 150. importance The download priority of the resource in the <iframe>'s src attribute. Allowed values: auto (default) No preference. The browser uses its own heuristics to decide the priority of the resource. high The resource should be downloaded before other lower-priority page resources. low The resource should be downloaded after other higher-priority page...
...ramatically removing an <iframe>'s src attribute (e.g. via Element.removeAttribute()) causes about:blank to be loaded in the frame in Firefox (from version 65), Chromium-based browsers, and Safari/iOS. srcdoc Inline HTML to embed, overriding the src attribute. If a browser does not support the srcdoc attribute, it will fall back to the URL in the src attribute. width The width of the frame in CSS pixels. Default is 300. Deprecated attributes These attributes are deprecated and may no longer be supported by all user agents. You should not use them in new content, and try to remove them from existing content. align The alignment of this element with respect to the surrounding context. frameborder The value 1 (the default) draws a border around this frame. The value 0 removes th...
...ributes are deprecated and may no longer be supported by all user agents. You should not use them in new content, and try to remove them from existing content. align The alignment of this element with respect to the surrounding context. frameborder The value 1 (the default) draws a border around this frame. The value 0 removes the border around this frame, but you should instead use the CSS property border to control <iframe> borders. longdesc A URL of a long description of the frame's content. Due to widespread misuse, this is not helpful for non-visual browsers. marginheight The amount of space in pixels between the frame's content and its top and bottom borders. marginwidth The amount of space in pixels between the frame's content and its left and right borders. scro...
<input type="checkbox"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › checkbox
ox is available that "owns" a number of sub-options (which are also checkboxes). If all of the sub-options are checked, the owning checkbox is also checked, and if they're all unchecked, the owning checkbox is unchecked. If any one or more of the sub-options have a different state than the others, the owning checkbox is in the indeterminate state. This can be seen in the below example (thanks to CSS Tricks for the inspiration). In this example we keep track of the ingredients we are collecting for a recipe. When you check or uncheck an ingredient's checkbox, a JavaScript function checks the total number of checked ingredients: If none are checked, the recipe name's checkbox is set to unchecked. If one or two are checked, the recipe name's checkbox is set to indeterminate. If all three a...
...t is not checked, then ValidityState.valueMissing will be true. Examples The following example is an extended version of the "multiple checkboxes" example we saw above -- it has more standard options, plus an "other" checkbox that when checked causes a text field to appear to enter a value for the "other" option. This is achieved with a simple block of JavaScript. The example also includes some CSS to improve the styling. HTML <form> <fieldset> <legend>Choose your interests</legend> <div> <input type="checkbox" id="coding" name="interest" value="coding"> <label for="coding">Coding</label> </div> <div> <input type="checkbox" id="music" name="interest" value="music"> <label for="music">Music</label> </div> <div> <input type="checkbox" id...
...nput type="checkbox" id="cooking" name="interest" value="cooking"> <label for="cooking">Cooking</label> </div> <div> <input type="checkbox" id="other" name="interest" value="other"> <label for="other">Other</label> <input type="text" id="otherValue" name="other"> </div> <div> <button type="submit">Submit form</button> </div> </fieldset> </form> CSS html { font-family: sans-serif; } form { width: 600px; margin: 0 auto; } div { margin-bottom: 10px; } fieldset { background: cyan; border: 5px solid blue; } legend { padding: 10px; background: blue; color: cyan; } JavaScript var otherCheckbox = document.querySelector('input[value="other"]'); var otherText = document.querySelector('input[id="otherValue"]'); otherText.styl...
<input type="color"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › color
color names, functional notations and a hexadecimal format with an alpha channel. ...
...acter string specifying an RGB color in hexadecimal format. While you can input the color in either upper- or lower-case, it will be stored in lower-case form. The value is never in any other form, and is never empty. Note: Setting the value to anything that isn't a valid, fully-opaque, RGB color in hexadecimal notation will result in the value being set to #000000. In particular, you can't use CSS's standardized color names, or any CSS function syntax, to set the value. This makes sense when you keep in mind that HTML and CSS are separate languages and specifications. In addition, colors with an alpha channel are not supported; specifying a color in 9-character hexadecimal notation (e.g. #009900aa) will also result in the color being set to #000000. Note: Any web browser that doesn't su...
... and the color picker (if any) will also default to that color: <input type="color" value="#ff0000"> If you don't specify a value, the default is #000000, which is black. The value must be in seven-character hexadecimal notation, meaning the "#" character followed by two digits each representing red, green, and blue, like this: #rrggbb. If you have colors that are in any other format (such as CSS color names or CSS color functions such as rgb() or rgba()), you'll have to convert them to hexadecimal before setting the value. Tracking color changes As is the case with other <input> types, there are two events that can be used to detect changes to the color value: input and change. input is fired on the <input> element every time the color changes. The change event is fired when the user d...
<kbd>: The Keyboard Input element - HTML: Hypertext Markup Language
Web › HTML › Element › kbd
ther 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> elements, with an outer <kbd> element representing the overall input and each individual keystroke or component of the input enclosed within it...
...g; 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. Depending on your style sheet, though, you may find it useful to do this kind of nesting. ...
... 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. Depending on your style sheet, though, you may find it useful to do this kind of nesting. ...
<p>: The Paragraph element - HTML: Hypertext Markup Language
Web › HTML › Element › p
t. This is the first paragraph of text. This is the first paragraph of text.</p> <p>This is the second paragraph. This is the second paragraph. This is the second paragraph. This is the second paragraph.</p> Result Styling paragraphs By default, browsers separate paragraphs with a single blank line. Alternate separation methods, such as first-line indentation, can be achieved with CSS: HTML <p>Separating paragraphs with blank lines is easiest for readers to scan, but they can also be separated by indenting their first lines. This is often used to take up less space, such as to save paper in print.</p> <p>Writing that is intended to be edited, such as school papers and rough drafts, uses both blank lines and indentation for separation. In finished works, combining both is co...
...ntation for separation. In finished works, combining both is considered redundant and amateurish.</p> <p>In very old writing, paragraphs were separated with a special character: ?, the <i>pilcrow</i>. ...
...like how white space lets visual users skip around. Using empty <p> elements to add space between paragraphs is problematic for people who navigate with screen-reading technology. Screen readers may announce the paragraph's presence, but not any content contained within it -- because there is none. This can confuse and frustrate the person using the screen reader. If extra space is desired, use CSS properties like margin to create the effect: p { margin-bottom: 2em; // increase white space after a paragraph } Specifications Specification Status Comment HTML Living StandardThe definition of '<p>' in that specification. Living Standard No change since the latest W3C snapshot HTML5 HTML5The definition of '<p>' in that specification. Recommend...
<samp>: The Sample Output element - HTML: Hypertext Markup Language
Web › HTML › Element › samp
t Phrasing content. 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 HTMLElement Attributes This element only includes the global attributes. ...
...asing content. Implicit ARIA role No corresponding role Permitted ARIA roles Any DOM interface HTMLElement Attributes This element only includes the global attributes. Usage notes You can use a CSS rule to override the browser's default font face for the <samp> element; however, it's possible that the browser's preferences may take precedence over any CSS you specify. The CSS to override the default font face would look like this: samp { font-family: "Courier"; } If you need an element which will serve as a container for output generated by your website or app's JavaScript code, you should instead use the <output> element. Examples Basic example In this simple example, a paragraph includes an example of the output of a program. <p>When ...
...bd> MD5 ("Hello world") = 3e25960a79dbc69b674cd4ec67a72c62 <span class="prompt">mike@interwebz:~$</span> <span class="cursor">?</span></samp></pre> Note the use of <span> to allow customization of the appearance of specific portions of the sample text such as the shell prompts and the cursor. Note also the use of <kbd> to represent the command the user entered at the prompt in the sample text. CSS The CSS that achieves the appearance we want is: .prompt { color: #b00; } samp > kbd { font-weight: bold; } .cursor { color: #00b; } This simply gives the prompt and cursor fairly subtle colorization and emboldens the keyboard input within the sample text. Result The resulting output is this: Specifications Specification Status Comment HTML Living Stan...
<tt>: The Teletype Text element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › tt
de>, <kbd>, <samp>, or <var> elements for inline text that needs to be presented in monospace type, or the <pre> tag for content that should be presented as a separate block. If none of the semantic elements are appropriate for your use case (for example, if you simply need to show some content in a non-proportional font), you should consider using the <span> element, styling it as desired using CSS. The font-family property is a good place to start. 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. Permitted ARIA roles Any DOM interface HT...
...his example uses <tt> to show text entered into, and output by, a terminal application. <p>Enter the following at the telnet command prompt: <code>set localecho</code><br /> The telnet client should display: <tt>Local Echo is on</tt></p> Result Overriding the default font You can override the browser's default font--if the browser permits you to do so, which it isn't required to do--using CSS: CSS tt { font-family: "Lucida Console", "Menlo", "Monaco", "Courier", monospace; } HTML <p>Enter the following at the telnet command prompt: <code>set localecho</code><br /> The telnet client should display: <tt>Local Echo is on</tt></p> Result Usage notes The <tt> element is, by default, rendered using the browser's default non-proportional font. You can override this...
... tt { font-family: "Lucida Console", "Menlo", "Monaco", "Courier", monospace; } HTML <p>Enter the following at the telnet command prompt: <code>set localecho</code><br /> The telnet client should display: <tt>Local Echo is on</tt></p> Result Usage notes The <tt> element is, by default, rendered using the browser's default non-proportional font. You can override this using CSS by creating a rule using the tt selector, as seen in the example Overriding the default font above. User-configured changes to the default monospace font setting may take precedence over your CSS. Although this element wasn't officially deprecated in HTML 4.01, its use was discouraged in favor of the semantic elements and/or CSS. The <tt> element is obsolete in HTML 5. Specifications ...
<ul>: The Unordered List element - HTML: Hypertext Markup Language
Web › HTML › Element › ul
p, 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 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: tr...
...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 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. T...
...e-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, unordered-list items are displayed with a bullet, which can be of several forms, like a dot, a circle, or a square. The bullet style is not defined in the HTML description of the page, but in its associated CSS, using the list-style-type property. 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. They differ in that, with the <ol> element, the order is meaningful. As a rule of thumb to determine which one to use, try changing the order of the list ...
<var>: The Variable element - HTML: Hypertext Markup Language
Web › HTML › Element › var
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 example, using <var> to denote variable names in a mathematical equation. <p>A simple equatio...
...st 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 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. ...
...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> This HTML uses <var> to enclose the names of two variables. Result Specifications Specification Status Comment HTML Living StandardThe ...
<video>: The Video Embed element - HTML: Hypertext Markup Language
Web › HTML › Element › video
alue which indicates the duration (total length) of the media in seconds, on the media's timeline. If no media is present on the element, or the media is not valid, the returned value is NaN. If the media has no known end (such as for live streams of unknown duration, web radio, media incoming from WebRTC, and so forth), this value is +Infinity. height The height of the video's display area, in CSS pixels (absolute values only; no percentages.) intrinsicsize This attribute tells the browser to ignore the actual intrinsic size of the image and pretend it's the size specified in the attribute. Specifically, the image would raster at these dimensions and naturalWidth/naturalHeight on images would return the values specified in this attribute. Explainer, examples loop A Boolean attribute;...
...specified, the browser would obviously need to start downloading the video for playback. The specification does not force the browser to follow the value of this attribute; it is a mere hint. src The URL of the video to embed. This is optional; you may instead use the <source> element within the video block to specify the video to embed. width The width of the video's display area, in CSS pixels (absolute values only; no percentages). Events Event Name Fired When audioprocess The input buffer of a ScriptProcessorNode is ready to be processed. canplay The browser can play the media, but estimates that not enough data has been loaded to play the media up to its end without having to stop for further buffering of content. canplayth...
...ul if, for example, you need to perform audio with a WebVTT transcript, since the <audio> element doesn't allow captions using WebVTT. To test the fallback content on browsers that support the element, you can replace <video> with a non-existing element like <notavideo>. A good general source of information on using HTML <video> is the Video and audio content beginner's tutorial. Styling with CSS The <video> element is a replaced element -- its display value is inline by default, but its default width and height in the viewport is defined by the video being embedded. There are no special considerations for styling <video>; a common strategy is to give it a display value of block to make it easier to position, size, etc., and then provide styling and layout information as required. Video...
dir - HTML: Hypertext Markup Language
parses the characters inside the element until it finds a character with a strong directionality, then applies that directionality to the whole element. Usage notes: This attribute is mandatory for the <bdo> element where it has a different semantic meaning. This attribute is not inherited by the <bdi> element. If not set, its value is auto. This attribute can be overridden by the CSS properties direction and unicode-bidi, if a CSS page is active and the element supports these properties. As the directionality of the text is semantically related to its content and not to its presentation, it is recommended that web developers use this attribute instead of the related CSS properties when possible. That way, the text will display correctly even on a browser that doesn't su...
... The auto value should be used for data with an unknown directionality, like data coming from user input, eventually stored in a database. Browsers might allow users to change the directionality of <input> and <textarea>s in order to assist with authoring content. ...
... The auto value should be used for data with an unknown directionality, like data coming from user input, eventually stored in a database. Browsers might allow users to change the directionality of <input> and <textarea>s in order to assist with authoring content. ...
Browser detection using the user agent - HTTP
back to checking the user agent screen only if (!("maxTouchPoints" in navigator)) { /*Code here*/}. Using this information of whether the device has a touchscreen, do not change the entire layout of the website just for touch devices: you will only create more work and maintenance for yourself. Rather, add in touch conveniences such as bigger, more easily clickable buttons (you can do this using CSS by simply increasing the font size). Here is an example of code that increases the padding of #exampleButton to 1em on mobile devices. var hasTouchScreen = false; if ("maxTouchPoints" in navigator) { hasTouchScreen = navigator.maxTouchPoints > 0; } else if ("msMaxTouchPoints" in navigator) { hasTouchScreen = navigator.msMaxTouchPoints > 0; } else { var mQ = window.matchMedia && mat...
... screen size dependent things*/ }). 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 on smaller screens while having more columns with a shorter page on larger screen sizes. This effect can be easily achieved using CSS flexboxes, sometimes with floats as a partial fallback. Also try to move less relevant/important information down to the bottom and group the page's content together meaningfully. Although it is off-topic, perhaps the following detailed example might give you insights and ideas that persuade you to forgo user agent sniffing. Let us imagine a page composed of boxes of information; each box is abo...
...e is using user agent sniffing as a fallback when detecting if the device has a touch screen. See the Mobile Device Detection section for more information. Another such case is for fixing bugs in browsers that do not automatically update. Internet Explorer (on Windows) and Webkit (on iOS) are two perfect examples. Prior to version 9, Internet Explorer had unbelievable issues with rendering bugs, CSS bugs, API bugs, and so forth. However, Internet Explorer was such a special little wasp exception prior to version 9 that it was very easy to detect the browser based upon the browser-specific features available. Webkit is a bit worse because Apple forces all of the browsers on IOS to use Webkit internally, thus the user has no way to get a better more updated browser on older devices. Most bugs ...
HTTP caching - HTTP
Web › HTTP › Caching
he-Control: private Cache-Control: public Expiration The most important directive here is "max-age=<seconds>" which is the maximum amount of time a resource will be considered fresh. Contrary to Expires, this directive is relative to the time of the request. For the files in the application that will not change, you can usually add aggressive caching. This includes static files such as images, CSS files and JavaScript files, for example. For more details, see also the Freshness section below. Cache-Control: max-age=31536000 Validation When using the "must-revalidate" directive, the cache must verify the status of the stale resources before using it and expired ones should not be used. For more details, see the Validation section below. Cache-Control: must-revalidate The Pragma header...
...es as far in the future as possible. This is possible on resources that are regularly updated, or often, but is problematic for resources that are rarely and infrequently updated. They are the resources that would benefit the most from caching resources, yet this makes them very difficult to update. This is typical of the technical resources included and linked from each Web pages: JavaScript and CSS files change infrequently, but when they change you want them to be updated quickly. Web developers invented a technique that Steve Souders called revving[1]. Infrequently updated files are named in a specific way: in their URL, usually in the filename, a revision (or version) number is added. That way each new revision of this resource is considered as a resource on its own that never changes a...
... they 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 documen...
List of default Accept values - HTTP
ic values. 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 ...
...ment, most browsers use specific values. ...
...ccept Header (IEInternals' MSDN blog) Internet Explorer 9 text/css See Fiddler is better with Internet Explorer 9 (IEInternals' MSDN blog) Safari, Chrome text/css,*/*;q=0.1 source Opera 11.10 text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1 Konqueror 4.6 text/css,*/*;q=0.1 ...
Content-Security-Policy-Report-Only - HTTP
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 document is visited: ...
...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 document is visited: { "csp-report": { "document-uri": "http://example.com/signup.html", "referrer": "", "blocked-uri": "http://example.com/css/style.css", "violated-directive": "style-src cdn.example.com", "original-policy": "default-src 'none'; style-src cdn.example.com; report-uri /_/csp-reports", "disposition": "report" } } As you can see, the report includes the full path to the violating resource in blocked-uri. This is not always the case. For example, when the signup.html would attempt to load CSS from http://anoth...
...rective": "style-src cdn.example.com", "original-policy": "default-src 'none'; style-src cdn.example.com; report-uri /_/csp-reports", "disposition": "report" } } As you can see, the report includes the full path to the violating resource in blocked-uri. This is not always the case. For example, when the signup.html would attempt to load CSS from http://anothercdn.example.com/stylesheet.css, the browser would not include the full path but only the origin (http://anothercdn.example.com). This is done to prevent leaking sensitive information about cross-origin resources. Specifications Specification Status Comment Content Security Policy Level 3 Working Draft No changes. Content Security Policy Level 2 Recommendation Initial definitio...
Referrer-Policy - HTTP
For <style> elements or style attributes, the owner document's referrer policy is used. Examples Policy Do...
... For <style> elements or style attributes, the owner document's referrer policy is used. Examples Policy Documen...
...attribute 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) ...
HTTP headers - HTTP
Web › HTTP › Headers
HTML5]). Accept-CH-Lifetime Servers can ask the client to remember the set of Client Hints that the server supports for a specified period of time, to enable delivery of Client Hints on subsequent requests to the server's origin ([RFC6454]). Early-Data Indicates that the request has been conveyed in early data. Content-DPR A number that indicates the ratio between physical pixels over CSS pixels of the selected image response. DPR A number that indicates the client's current Device Pixel Ratio (DPR), which is the ratio of physical pixels over CSS pixels (Section 5.2 of [CSSVAL]) of the layout viewport (Section 9.1.1 of [CSS2]) on the device. Device-Memory Technically a part of Device Memory API, this header represents an approximate amount of RAM client has. Save-Data ...
...The provided pixel value is a number rounded to the smallest following integer (i.e. ceiling value). If Viewport-Width occurs in a message more than once, the last value overrides all previous occurrences. Width The Width request header field is a number that indicates the desired resource width in physical pixels (i.e. intrinsic size of an image). ...
... the Connection header field with the upgrade option specified. For details on the Connection header field please see section 6.1 of the aforementioned RFC. X-DNS-Prefetch-Control Controls DNS prefetching, a feature by which browsers proactively perform domain name resolution on both links that the user may choose to follow as well as URLs for items referenced by the document, including images, CSS, JavaScript, and so forth. X-Firefox-Spdy ... X-Pingback ... X-Requested-With ... X-Robots-Tag The X-Robots-Tag HTTP header is used to indicate how a web page is to be indexed within public search engine results. The header is effectively equivalent to <meta name="robots" content="...">. X-UA-Compatible Used by Internet Explorer to signal which document mode to use. ...
HTTP Index - HTTP
Web › HTTP › Index
r 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 ...
...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. 113 DPR Client hints, HTTP, HTTP Header The DPR header is a Client Hints headers which represents the client device pixel ratio (DPR), which is the the number of physical device pixels corresponding to every CSS pixel. 114 Date General Header, HTTP, Reference, header The Date general HTTP header contains the date and time at which the message was originated. 115 Device-Memory Client hints, Device Memory API, HTTP, HTTP Header The Device-Memory header is a Device Memory API header that works like Client Hints header which represents the approximate amount of RAM c...
...t the webmasters knew what they were doing. 199 X-DNS-Prefetch-Control DNS, HTTP, X-DNS-Prefetch-Control, header The X-DNS-Prefetch-Control HTTP response header controls DNS prefetching, a feature by which browsers proactively perform domain name resolution on both links that the user may choose to follow as well as URLs for items referenced by the document, including images, CSS, JavaScript, and so forth. 200 X-Forwarded-For HTTP, HTTP Header, Non-standard, Reference, Request header, header The X-Forwarded-For (XFF) header is a de-facto standard header for identifying the originating IP address of a client connecting to a web server through an HTTP proxy or a load balancer. When traffic is intercepted between clients and servers, server access logs c...
Using images in HTML - Web media technologies
Web › Media › images
HTML <img> The HTML <img> element is used to embed an image in a webpage. ...
...es that control how the image behaves and allows you to add important information like alt text for people who don't see the image. <picture> The HTML <picture> element contains zero or more <source> elements and one <img> element which provides versions of an image for different display/device scenarios. The browser considers each child <source> element and chooses the best match among them. CSS object-fit The object-fit CSS property sets how the content of a replaced element, such as an <img> or <video>, should be resized to fit its container. object-position The object-position CSS property specifies the alignment of content in a selected replaced element within the element's box. Areas of the box which aren't covered by the replaced element's object will show the element's backg...
... Guides These articles provide guidance on selecting and configuring image types. ...
Lazy loading - Web Performance
from ~250KB to ~900KB on desktop and ~100KB to ~850KB on mobile. One of the methods we can use to tackle this problem is to shorten the Critical Rendering Path length by lazy loading resources that are not critical for the first render to happen. A practical example would be when, you land on the home page of an e-commerce site which has a link to a cart page/section and all its resources (JS, CSS, images...) are downloaded only when the user navigates to that cart page. Strategies Lazy loading can be applied to multiple resources and through multiple strategies. General Code splitting JavaScript, CSS and HTML can be split into smaller chunks. This enables sending the minimal code required to provide value upfront, improving page-load times. The rest can be loaded on demand. ...
...l code required to provide value upfront, improving page-load times. The rest can be loaded on demand. Entry point splitting: separates code by entry point(s) in the app Dynamic splitting: separates code where dynamic import() statements are used JavaScript Script 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"> <lin...
...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 default behaviour and preload web font resources using <link rel="preload">, the CSS font-display property, and the Font Loading API. ...
alignment-baseline - SVG: Scalable Vector Graphics
t. This property specifies which baseline of this element is to be aligned with the corresponding baseline of the parent. For example, this allows alphabetic baselines in Roman text to stay aligned across font size changes. It defaults to the baseline with the same name as the computed value of the alignment-baseline property. Note: As a presentation attribute alignment-baseline can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following four elements: <tspan>, <tref>, <altGlyph>, and <textPath> Usage notes Value auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | top | center | bottom Default val...
...rcle cx="60" cy="10" r="3" fill="red" /> <circle cx="60" cy="65" r="3" fill="red" /> <circle cx="60" cy="110" r="3" fill="red" /> <style><![CDATA[ text{ font: bold 36px Verdana, Helvetica, Arial, sans-serif; } ]]></style> </svg> For object alignment in other elements (such as <text>), see dominant-baseline. ...
...ther elements (such as <text>), see dominant-baseline. 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 Recommendation Refers to the definition in CSS Inline Layout and notes the changes to auto, before-edge, after-edge, text-before-edge, and text-after-edge Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'alignment-baseline' in that specification. Recommendation Initial definition Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute...
baseline-shift - SVG: Scalable Vector Graphics
Note: This property is going to be deprecated and authors are advised to use vertical-align instead. ...
... A length value raises (positive value) or lowers (negative value) the dominant-baseline of the parent text content element by the specified length. A percentage value raises (positive value) or lowers (negative value) the dominant-baseline of the parent text content element by the specified percentage of the line-height. ...
... Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'alignment-baseline' in that specification. Recommendation Initial definition Browser compatibility The compatibility table on this page is generated from structured data. ...
direction - SVG: Scalable Vector Graphics
rectional Unicode algorithm produces the desired result automatically, so this attribute doesn't need to be specified in those cases. For other cases, such as when using right-to-left languages, it may be sufficient to add the direction attribute to the outermost <svg> element, and allow that direction to inherit to all text elements: Note: As a presentation attribute, direction can be used as a CSS property. See css direction for further information. As a presentation attribute, it can be applied to any element but it only has effect on shapes and text context elements, including: <altGlyph>, <textPath>, <text>, <tref>, and <tspan>. html, body, svg { height: 100%; } <svg viewBox="0 0 600 72" xmlns="http://www.w3.org/2000/svg" direction="rtl" lang="fa"> <text x="300" y="50" tex...
... Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definiti...
..." text-anchor="middle" font-size="36">?????? SVG 1.1 SE ???? ?? ???.</text> </svg> Usage notes Value ltr | rtl Default value ltr Animatable Yes Specifications Specification Status Comment CSS Writing Modes Module Level 3The definition of 'direction' in that specification. Proposed Recommendation Definition in CSS Scalable Vector Graphics (SVG) 2The definition of 'direction' in that specification. Candidate Recommendation Refers to the CSS Writing Modes specification of the direction property. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'direction' in that specification. Recommendation Initial definition ...
display - SVG: Scalable Vector Graphics
Web › SVG › Attribute › display
o offscreen canvases, such as occurs with masks or clip paths. Thus, setting display="none" on a child of a <mask> will prevent the given child element from being rendered as part of the mask. Similarly, setting display="none" on a child of a <clipPath> element will prevent the given child element from contributing to the clipping path. Note: As a presentation attribute, display can be used as a CSS property. See css display for further information. As a presentation attribute, it can be applied to any element. html, body, svg { height: 100%; } <svg viewBox="0 0 220 100" xmlns="http://www.w3.org/2000/svg"> <!-- Here the yellow rectangle is displayed --> <rect x="0" y="0" width="100" height="100" fill="skyblue"></rect> <rect x="20" y="20" width="60" height="60" fill="yellow"></r...
... Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'display' in that specification. Candidate Recommendation Refers to the CSS 2 specification of the display property, but outlines the differences regarding SVG. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'display' in...
...lay-legacy> = inline-block | inline-list-item | inline-table | inline-flex | inline-grid Animatable Yes For a description of the values, please refer to the css display property. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'display' in that specification. Candidate Recommendation Refers to the CSS 2 specification of the display property, but outlines the differences regarding SVG. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'display' in that specification. Recommendation Initial definition ...
font-size-adjust - SVG: Scalable Vector Graphics
See the css font-size-adjust property for more information. ...
... << SVG Attribute reference home 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. Note: As a presentation attribute, font-size-adjust can be used as a CSS property. See the css font-size-adjust property for more information. As a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <altGlyph>, <text>, <textPath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg width="600" height="80" viewBox="0 0 500 80" xmlns="http://www.w3.org/2000/svg"> <text y="20" font-family="Times, serif" font-size="10px"> This text uses the Times font (10px), which is hard to read in small sizes. </text>...
...font-size. The number specified should generally be the aspect ratio (ratio of x-height to font size) of the first choice font-family. This means that the first-choice font, when available, will appear the same size in browsers, whether or not they support font-size-adjust. 0 yields text of zero height (hidden text). Specifications Specification Status Comment CSS Fonts Module Level 3The definition of 'font-size-adjust' in that specification. Candidate Recommendation No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'font-size-adjust' in that specification. Recommendation Initial definition ...
font-stretch - SVG: Scalable Vector Graphics
See the css font-stretch property for more information. ...
... The font-stretch attribute indicates the desired amount of condensing or expansion in the glyphs used to render the text. Note: As a presentation attribute, font-stretch can be used as a CSS property. See the css font-stretch property for more information. As a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <altGlyph>, <text>, <textPath>, <tref>, and <tspan> Usage notes Value <font-stretch-absolute>where <font-stretch-absolute> = normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | <percentage> Default value normal Animatable Yes Specifications Specification Status Comment ...
...th>, <tref>, and <tspan> Usage notes Value <font-stretch-absolute>where <font-stretch-absolute> = normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | <percentage> Default value normal Animatable Yes Specifications Specification Status Comment CSS Fonts Module Level 4The definition of 'font-stretch' in that specification. Working Draft Adds the <percentage> syntax for variable fonts. CSS Fonts Module Level 3The definition of 'font-stretch' in that specification. Candidate Recommendation Initial definition of font-stretch in CSS Fonts Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'font-st...
letter-spacing - SVG: Scalable Vector Graphics
he kerning attribute. If the attribute value is a unitless number (like 128), the browser processes it as a <length> in the current user coordinate system. If the attribute value has a unit identifier, such as .25em or 1%, then the browser converts the <length> into its corresponding value in the current user coordinate system. Note: As a presentation attribute, letter-spacing can be used as a CSS property. See the css letter-spacing property for more information. As a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <altGlyph>, <text>, <textPath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewBox="0 0 400 30" xmlns="http://www.w3.org/2000/svg"> <text y="20" letter-spacing="2">Bigger letter-spacing</...
... Scalable Vector Graphics (SVG) 1.1 (Second Edition)The defini...
...g="-0.5">Smaller letter-spacing</text> </svg> Usage notes Value normal | <length> Default value normal Animatable Yes For a description of the values, please refer to the CSS letter-spacing property. Prior to Firefox 72 Firefox ignored letter-spacing and renders text without. Specifications Specification Status Comment CSS Text Module Level 3The definition of 'letter-spacing' in that specification. Working Draft SVG 2 just refers to the definition in CSS Text 3. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'letter-spacing' in that specification. Recommendation Initial definition ...
mask - SVG: Scalable Vector Graphics
Web › SVG › Attribute › mask
The mask attribute is a presentation attribute mainly used to bind a given <mask> element with the element the attribute belongs to. Note: As a presentation attribute mask can be used as a CSS property. html,body,svg { height:100% } <svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg"> <mask id="myMask" maskContentUnits="objectBoundingBox"> <rect fill="white" x="0" y="0" width="100%" height="100%" /> <polygon fill="black" points="0.5,0.2 0.68,0.74 0.21,0.41 0.79,0.41 0.32,0.74" /> </mask> <!-- Punch a hole in a shape of a star inside the red circle, revealing the yellow circle underneath --> <circle cx="50" cy="50" r="20" fill="yellow" /> <circle cx="50" cy="50" r="45" fill="red" mask="url(#myMask)"/> </svg> Since SVG2, the mask attrib...
... As a presentation attribute, it can be applied to any element but it has noticeable effects mostly on the following nineteen elements: <a>, <circle>, <clipPath>, <ellipse>, <g>, <glyph>, <image>, <line>, <marker>, <mask>, <path>, <patter...
... mask-clip, mask-origin, mask-size, and mask-composite. As a presentation attribute, it can be applied to any element but it has noticeable effects mostly on the following nineteen elements: <a>, <circle>, <clipPath>, <ellipse>, <g>, <glyph>, <image>, <line>, <marker>, <mask>, <path>, <pattern>, <polygon>, <polyline>, <rect>, <svg>, <symbol>, <text>, <use> Usage notes Value See the CSS property mask Default value none Animatable Yes Specifications Specification Status Comment CSS Masking Module Level 1The definition of 'mask' in that specification. Candidate Recommendation Extends its usage to HTML elements. Extends its syntax by making it a shorthand for the new mask-* properties defined in that specificatio...
pointer-events - SVG: Scalable Vector Graphics
html,body,svg { height:100% } <svg viewBox="0 0 20 10" xmlns="http://www.w3.org/2000/svg"> <!-- The circle will always intercept the mouse event. ...
...er you are clicking on the circle or the rect itself --> <rect x="10" y="0" height="10" width="10" fill="black" /> <circle cx="15" cy="5" r="4" fill="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>, <mark...
... 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. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSa...
text-decoration - SVG: Scalable Vector Graphics
le properties. 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. See the css text-decoration property for more information. As a presentation attribute, it can be applied to any element but it has effect only on the following five elements: <altGlyph>, <text>, <textPath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewBox="0 0 250 50" xmlns="http://www.w3.org/2000/svg"> <text y="20" text-decoration="underline">Underlined tex...
... 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 'tex...
...ugh">Struck-through text</text> </svg> Usage notes Value <'text-decoration-line'> || <'text-decoration-style'> || <'text-decoration-color'> Default value See individual properties 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 C...
word-spacing - SVG: Scalable Vector Graphics
unit identifier (e.g. an unqualified number such as 128), the browser processes the <length> as a width value in the current user coordinate system. If a <length> is provided with one of the unit identifiers (e.g. .25em or 1%), then the browser converts the <length> into a corresponding value in the current user coordinate system. Note: As a presentation attribute, word-spacing can be used as a CSS property. See the css word-spacing property for more information. As a presentation attribute, it can be applied to any element but it has effect only on the following five elements: <altGlyph>, <text>, <textPath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewBox="0 0 250 50" xmlns="http://www.w3.org/2000/svg"> <text y="20" word-spacing="2">Bigger spacing between words...
... Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definit...
...Smaller spacing between words</text> </svg> Usage notes Value normal | <length> Animatable Yes Default values normal For a description of the values, please refer to the CSS letter-spacing property. Prior to Firefox 72 Firefox ignored word-spacing and renders text without. Specifications Specification Status Comment CSS Text Module Level 3The definition of 'word-spacing' in that specification. Working Draft SVG 2 just refers to the definition in CSS Text 3. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'word-spacing' in that specification. Recommendation Initial definition ...
writing-mode - SVG: Scalable Vector Graphics
ft, or top-to-bottom. The writing-mode attribute applies only to <text> elements; the attribute is ignored for <tspan>, <tref>, <altGlyph> and <textPath> sub-elements. (Note that the inline-progression-direction can change within a <text> element due to the Unicode bidirectional algorithm and properties direction and unicode-bidi.) Note: As a presentation attribute, writing-mode can be used as a CSS property. See the css writing-mode property for more information. As a presentation attribute, it can be applied to any element but it has effect only on the following five elements: <altGlyph>, <text>, <textPath>, <tref>, and <tspan> Usage notes Default value horizontal-tb Value horizontal-tb | vertical-rl | vertical-lr Animatable Yes horizontal-tb...
...th the writing mode and the typographic mode are horizontal. vertical-rl This value defines a right-to-left block flow direction. Both the writing mode and the typographic mode are vertical. vertical-lr This value defines a left-to-right block flow direction. Both the writing mode and the typographic mode are vertical. ...
...Both the writing mode and the typographic mode are vertical. vertical-lr This value defines a left-to-right block flow direction. Both the writing mode and the typographic mode are vertical. Specifications Specification Status Comment CSS Writing Modes Module Level 3The definition of 'writing-mode' in that specification. Proposed Recommendation Definition in CSS Writing Modes 3 Scalable Vector Graphics (SVG) 2The definition of 'writing-mode' in that specification. Candidate Recommendation Mainly refers to the definition in CSS Writing Modes 3 and defines a mapping between the deprecated SVG 1.1 values and the new values. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'writing-mode' in that specification. R...
Gradients in SVG - SVG: Scalable Vector Graphics
1" 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> ScreenshotLive ...
...100" height="100" fill="url(#Gradient2)"/> </svg> ScreenshotLive sample Above is an example of a linear gradient being applied to a <rect> element. Inside the linear gradient are several <stop> nodes. These nodes tell the gradient what color it should be at certain positions by specifying an offset attribute for the position, and a stop-color attribute. This can be assigned directly or through CSS. The two methods have been intermixed for the purposes of this example. For instance, this one tells the gradient to start at the color red, change to transparent-black in the middle, and end at the color blue. You can insert as many stop colors as you like to create a blend that's as beautiful or hideous as you need, but the offsets should always increase from 0% (or 0 if you want to drop the % ...
... furthest down the XML tree. Also, like with fill and stroke, you can specify a stop-opacity attribute to set the opacity at that position (again, in FF3 you can also use rgba values to do this). <stop offset="100%" stop-color="yellow" stop-opacity="0.5"/> To use a gradient, we have to reference it from an object's fill or stroke attributes. This is done the same way you reference elements in CSS, using a url. In this case, the url is just a reference to our gradient, which I've given the creative ID, "Gradient". To attach it, set the fill to url(#Gradient), and voila! Our object is now multicolored. You can do the same with stroke. The <linearGradient> element also takes several other attributes, which specify the size and appearance of the gradient. The orientation of the gradient is c...
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. Source Here is the source to 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> ...
...When the user enters something incorrect into the form, the script sets the invalid attribute on the <body>, and a style rul...
...When the user enters something incorrect into the form, the script sets the invalid attribute on the <body>, and a style rule changes the gradient end-stop color to red. ...
context-menu - Archive of obsolete content
l: "My Menu Item", context: cm.URLContext("*.mozilla.org") }); Constructor Description PageContext() The page context. SelectionContext() This context occurs when the menu is invoked on a page in which the user has made a selection. SelectorContext(selector) This context occurs when the menu is invoked on a node that either matches selector, a CSS selector, or has an ancestor that matches. selector may include multiple selectors separated by commas, e.g., "a[href], img". URLContext(matchPattern) This context occurs when the menu is invoked on pages with particular URLs. matchPattern is a match pattern string or an array of match pattern strings. When matchPattern is an array, the context occurs when the menu is invoked on a pa...
...ntent script calls self.postMessage. It will be passed the data that was passed to postMessage. Separator() Creates a menu separator. PageContext() Creates a page context. See Specifying Contexts above. SelectionContext() Creates a context that occurs when a page contains a selection. See Specifying Contexts above. SelectorContext(selector) Creates a context that matches a given CSS selector. See Specifying Contexts above. Parameters selector : string A CSS selector. URLContext(matchPattern) Creates a context that matches pages with particular URLs. See Specifying Contexts above. Parameters matchPattern : string,array A match pattern string, regexp or an array of match pattern strings or regexps. PredicateContext(predicateFunction) New in Firefox 29 Creates a co...
page-worker - Archive of obsolete content
t scripts. This may take one of the following values: "start": load content scripts immediately after the document element for the page is inserted into the DOM, but before the DOM content itself has been loaded "ready": load content scripts once DOM content has been loaded, corresponding to the DOMContentLoaded event "end": load content scripts once all the content (DOM, JS, CSS, images) for the page has been loaded, at the time the window.onload event fires This property is optional and defaults to "end". contentScriptOptions object Read-only value exposed to content scripts under self.options property. Any kind of jsonable value (object, array, string, etc.) can be used here. Optional. onMessage function Us...
... load the content scripts. This may have one of the following values: "start": load content scripts immediately after the document element for the page is inserted into the DOM, but before the DOM content itself has been loaded "ready": load content scripts once DOM content has been loaded, corresponding to the DOMContentLoaded event "end": load content scripts once all the content (DOM, JS, CSS, images) for the page has been loaded, at the time the window.onload event fires contentScriptOptions Read-only value exposed to content scripts under self.options property. Any kind of jsonable value (object, array, string, etc.) can be used here. Optional. Events message If you listen to this event you can receive message events from content scripts associated with this page worker. When...
tabs - Archive of obsolete content
ts 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. ...
...t uses a toggle button to attach a stylesheet to the active tab, and detach it again. The stylesheet is called "style.css" and is located in the add-on's "data" directory: var tabs = require("sdk/tabs"); var { attach, detach } = require('sdk/content/mod'); var { Style } = require('sdk/stylesheet/style'); var { ToggleButton } = require("sdk/ui/button/toggle"); var style = Style({ uri: './style.css' }); var button = ToggleButton({ id: "stylist", label: "stylist", icon: "./icon-16.png", onChange: function(state) { if (state.checked) { attach(style, tabs.activeTab); } else { detach(style, tabs.activeTab); } } }); Private windows If your add-on has not opted into private browsing, then you won't see any tabs that are hosted by private browser windows. ...
ui - Archive of obsolete content
and the icon gets a "pressed" look when the button is checked. It's otherwise identical to the action button. Attaching panels to buttons is only supported from Firefox 30 onwards. From Firefox 30 onwards, you can attach panels to toggle buttons, by passing the button into the panel's constructor or its show() method: Frame A frame enables you to create an HTML iframe, using bundled HTML, CSS and JavaScript. This can then be added to a designated area of the Firefox user interface. At the moment you can only add frames to a toolbar. You initialize a frame with a URL pointing to an HTML document supplied under your add-on's "data" directory. This document can refer to bundled CSS and JavaScript files, and your main add-on can communicate with a frame script using message passing. Once...
...r.html" }); var toolbar = ui.Toolbar({ title: "Player", items: [previous, next, play, frame] }); The toolbar appears just above the content window: Sidebar A sidebar gives you a vertical strip of space for presenting complex user interfaces. You initialize a sidebar with a URL pointing to an HTML document supplied under your add-on's "data" directory. This document can refer to bundled CSS and JavaScript files, and your main add-on can communicate with a frame script using message passing. var ui = require("sdk/ui"); var sidebar = ui.Sidebar({ id: 'my-sidebar', title: 'My sidebar', url: require("sdk/self").data.url("sidebar.html") }); It appears on the left of the content window: ...
content/symbiont - Archive of obsolete content
t scripts. This may take one of the following values: "start": load content scripts immediately after the document element for the page is inserted into the DOM, but before the DOM content itself has been loaded "ready": load content scripts once DOM content has been loaded, corresponding to the DOMContentLoaded event "end": load content scripts once all the content (DOM, JS, CSS, images) for the page has been loaded, at the time the window.onload event fires This property is optional and defaults to "end". contentScriptOptions object Read-only value exposed to content scripts under self.options property. Any kind of jsonable value (object, array, string, etc.) can be used here. Optional. allow object Permissi...
... load the content scripts. This may have one of the following values: "start": load content scripts immediately after the document element for the page is inserted into the DOM, but before the DOM content itself has been loaded "ready": load content scripts once DOM content has been loaded, corresponding to the DOMContentLoaded event "end": load content scripts once all the content (DOM, JS, CSS, images) for the page has been loaded, at the time the window.onload event fires contentScriptOptions Read-only value exposed to content scripts under self.options property. Any kind of jsonable value (object, array, string, etc.) can be used here. Optional. contentURL The URL of the content loaded. allow Permissions for the content, with a single boolean key called script which defaults ...
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...
...ose 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 the sheet. If no type is provided in constructor's option, it r...
ui/sidebar - Archive of obsolete content
Usage Creating, showing, and hiding sidebars You construct a Sidebar object using the Sidebar() constructor. Once you've done that, you can show the sidebar by calling the Sidebar's show() method. ...
...r({ id: 'my-sidebar', title: 'My sidebar', url: require("sdk/self").data.url("sidebar.html") }); From Firefox 34, you can use "./sidebar.html" as an alias for self.data.url("sidebar.html"). So you can rewrite the above 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...
Low-Level APIs - Archive of obsolete content
ox. 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 runtime environment. system/unload Register callbacks tha...
...ess setup and execution. test/httpd An HTTP server for the Mozilla platform, which can be used in unit tests. test/runner Sets up unit tests. test/utils Helper methods used in the CommonJS Unit Testing suite. ui/button/action Add a button to the Firefox user interface. ui/button/toggle Add a toggle button to the Firefox user interface. ui/frame Create HTML iframes, using bundled HTML, CSS and JavaScript, that can be added to a designated area of the Firefox user interface. ui/id Create UI component IDs. ui/sidebar Enables you to create sidebars. ui/toolbar Add a toolbar to the Firefox user interface. util/array Helper functions for working with arrays. util/collection A simple list-like class and utilities for using it. util/deprecate Functions to deprecate code. util...
Displaying annotations - Archive of obsolete content
also listens for the window's unload event and on unload sends a detach message to the main module, so the add-on can clean it up. ...
...mple 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.on('message', function(mess...
Localization - Archive of obsolete content
See Limitations below. ...
...ed "Update l10n" next to each add-on you've installed: Click the button and you'll be prompted for a new .properties file for that add-on. If you provide a new file, the add-on's locale data will be updated with the new file. Limitations The current localization support is a first step towards full support, and contains a number of limitations. There's no support for content scripts or CSS files: at the moment, you can only localize strings appearing in JavaScript files that can require() SDK modules and in HTML. See bug 787351. The set of locale files is global across an add-on. This means that a module isn't able to override a more general translation: so a module informal.js can't specify that "hello_id" occurring in its code should be localized to "Hi!". The SDK too...
Boxes - Archive of obsolete content
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. ...
...TT"/> <label value="UUU"/> <label value="VVV"/> <label value="WWW"/> <label value="XXX"/> <label value="YYY"/> <label value="ZZZ"/> </hbox> </window> Images If you put IMAGE in the contents, you should probably add align="start" attribute to the BOX. ...
Dialogs and Prompts - Archive of obsolete content
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 they return anything but false, the dialog wil...
...ues 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. Example: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" ondialogaccept="alert('ok!');"> <hbox> <label value="Hey!"/> <spacer flex="1"/> <vbox> <button dlgtype="accept"/> <button dlgtype="cancel"/> </vbox> </hbox> </dialog> Default button Since Firefox 1.5, there are defaultButton attributes and properties on the <dialog> element bug 284776. The...
Forms related code snippets - Archive of obsolete content
indow.addEventListener ? addEventListener("load", buildCalendars, false) : window.attachEvent ? attachEvent("onload", buildCalendars) : (onload = buildCalendars); document.addEventListener ? document.addEventListener("mousedown", onDocClick, false) : document.attachEvent ? ...
...p-empty-cell">&nbsp;</td> <td class="zdp-empty-cell">&nbsp;</td> <td class="zdp-empty-cell">&nbsp;</td> <td class="zdp-empty-cell">&nbsp;</td> </tr> </tbody> </table> Editable <select> fields The content of the <select> element is actually static and not editable. If you want to emulate an editable select through a <fieldset> of radioboxes and textboxes (written in pure CSS, without JavaScript), please see this example. Autogrowing <textarea> This example shows how to make a textarea really autogrowing during a typing. Insert some custom text in a <textarea> This example shows how to insert some HTML tags or smiles or any custom text in a textarea. Image preview before upload The FileReader.prototype.readAsDataURL() method can be useful, for example, to get a ...
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
You also have to make one small change to the makefile in the same directory, adding the following line: USE_EXTENSION_MANIFEST = 1 This tells make ...
...You also have to make one small change to the makefile in the same directory, adding the following line: USE_EXTENSION_MANIFEST = 1 This tells make to create a single manifest file ...
Extension Theming Guidelines - Archive of obsolete content
Custom themes may then register a replacement for your skin package allowing them to provide their own styles for all of your content. ...
... 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. While it may be tempting to use the same stylesheet in multiple places try to avoid this so that themes can correctly target the right windows. CSS Selectors When writing stylesheet rules for windows that you are overlaying always try to be specific with the css selector. If you are not then you run a risk of conflicting with content that other extensions add to the window. XUL guidelines XBL Bindings XBL bindings are applied using style rules. However these are rarely part of the style of the widgets but more about adding custom widgets. I...
Chapter 1: Introduction to Extensions - Archive of obsolete content
s 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 userChrome.js to add functionality throug...
... or "bookmarklets." 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. ...
User Notifications and Alerts - Archive of obsolete content
refox 3 on Ubuntu Linux, but we haven't tested all distributions and Firefox versions. Because of the inconsistent support and temporary nature of these alerts, we don't recommend using this service to show information the user needs to know and can't get in any other way. Custom alerts Creating custom solutions for alerting the user is not complicated, given the advantages of XUL overlays and CSS positioning. However, these solutions are prone to be buggy and have accessibility issues. You should use the 2 alternatives mentioned above whenever possible. If none of those fit your needs then this is an acceptable solution. An easy way to display alerts is to include a hidden box in your overlay, which you can fill with any content you need before removing the hidden attribute so that it is...
...played to the user. The best locations for this kind of box are above and below the tab browser. Below is preferrable because it only cuts the bottom part of the current page, as opposed to pushing down all tabs and content. Notification boxes are a good guideline to what you should aim for: thin, informative and easy to dismiss. Another option is to also add a hidden box to the overlay, but use CSS positioning to locate it where you want. This usually means that the box will be hovering on top of the page's content, and there are a few things you must know about this. First of all, switching tabs will probably make your alert disappear. This is probably due to the fact that the browser tab box uses a deck internally, and that affects z-indexing. You'll have to code around this using tab eve...
Beginner tutorials - Archive of obsolete content
This page includes archived beginners tutorials, from various places around MDN. Creating reusable content with CSS and XBLThis page illustrates how you can use CSS in Mozilla to improve the structure of complex applications, making code and resources more easily reusable.Underscores in class and ID NamesSummary: The use of the underscore character in CSS can lead to major display problems in multiple browsers. Learn why this is so, and how to keep your sites from being bitten by this problem. ...
...an use CSS in Mozilla to improve the structure of complex applications, making code and resources more easily reusable.Underscores in class and ID NamesSummary: The use of the underscore character in CSS can lead to major display problems in multiple browsers. Learn why this is so, and how to keep your sites from being bitten by this problem. This technical note examines the use of underscores in CSS, and why they should be generally avoided in most circumstances.XML dataThis page contains an example of how you can use CSS with XML data.XUL user interfacesThis page illustrates Mozilla's specialized language for creating user interfaces. ...
Index of archived content - Archive of obsolete content
t Iterator LiveConnect LiveConnect Overview LiveConnect Reference JSException JSObject MSX Emulator (jsMSX) Old Proxy API ParallelArray Properly Using CSS and JavaScript in XHTML Documents Examples Reference Server-Side JavaScript Back to the Server: Server-Side JavaScript On The Rise Sharp variables in JavaScript Standards-Compliant Authoring Tools StopIteration Styling the Amazing Ne...
...ting XForms Forms Using XForms and PHP XForms API Reference XForms Config Variables XForms Custom Controls XForms Custom Controls Examples XForms Styling background-size forEach Beginner tutorials Creating reusable content with CSS and XBL Underscores in class and ID Names XML data XUL user interfaces Case Sensitivity in class and id Names Creating a dynamic status bar extension Creating a status bar extension Element title Gecko Compatibility Handbook Getting the page URL in NPAP...
Inner-browsing extending the browser navigation paradigm - Archive of obsolete content
ort for recent IE versions and Gecko-based browsers. The following XML datasources are used in this sample: http://web.archive.org/web/20090624020048/http://devedge-temp.mozilla.org/central/dom/catalog-new_en.xml http://web.archive.org/web/20090218052509/http://devedge-temp.mozilla.org/central/xml/catalog-new_en.xml http://web.archive.org/web/20100913225355/http://devedge-temp.mozilla.org/central/css/catalog-new_en.xml http://web.archive.org/web/20090218052536/http://devedge-temp.mozilla.org/viewsource/catalog-new_en.xml Data Binder Component This procedure traverses the DOM that was returned via XMLHTTPRequest and generates markup based on the data provided in the DOM nodes. When the markup is ready, it copies the markup into the container element, which is a DIV element. The following code ...
...bject("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',this);return false;\" title=\"XML articles\">XML</a> <a href=\"javascript:\" class=\"tab\" onclick=\"callDevEdge('/central/dom/catalog-new_en.xml ',this);return false;\" title=\"DOM articles\">DOM</a></span>"); } </script> <!-- *...
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
815 extra bytes at beginning or within zipfile (attempting to process anyway) error [/usr/lib/firefox/browser/omni.ja]: reported length of central directory is -3598815 bytes too long (Atari STZip zipfile? J.H.Holm ZIPSPLIT 1.1 zipfile?). Compensating... ...
...y) error [/usr/lib/firefox/browser/omni.ja]: reported length of central directory is -3598815 bytes too long (Atari STZip zipfile? J.H.Holm ZIPSPLIT 1.1 zipfile?). Compensating... ...
Adding the structure - Archive of obsolete content
n 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. ...
...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 depending on the value of that attribute. All XUL elements can be given custom attributes in addition to the ones the XUL rendering engine recognizes which get ignored by the engine, so adding this custom attribute does not create any problems or modify the way the widget is displayed (except for the ways we explicitly specify with CSS). << Previ...
Getting Started - Archive of obsolete content
kin simply contains another directory, classic which holds all the good stuff. skin\classic classic contains the following directories. skin\classic\communicator communicator contains all the toolbar icons, as well as the icons 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 bro...
...:id> <em:minVersion>Min_SM_Version</em:minVersion> <em:maxVersion>Max_SM_Version</em:maxVersion> </Description> </em:targetApplication> Establishing both minimum and maximum compatible versions lets you avoid conflicts with versions of SeaMonkey your theme wasn't designed for -- or wasn't tested on. See Install Manifests for the reference information about the install.rdf file. CSS Files The CSS files in these directories tell the browser how to display the buttons and other controls, where to put the images, what border and padding it should put around them, and so on. As an example, let's change the standard button. Go into the global directory and open button.css in your favorite text editor. Scroll down to button {. This section defines the normal button in its basic st...
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). If you want to change the functionality of Mozilla, you'll have to look into modifying the chrome. ...
...nge the look of the right click menu (Make it blue with pink polka dots, for example). If you want to change the functionality of Mozilla, you'll have to look into modifying the chrome. That is beyond the scope of this document. ...
Creating a Skin for Firefox/Getting Started - Archive of obsolete content
classic which holds all the good stuff. skin\classic classic contains the following directories. skin\classic\browser browser contains all the toolbar icons, as well as the icons for the bookmark manager and the preferences window. 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 Firef...
...id> <em:minVersion>Min_FF_Version</em:minVersion> <em:maxVersion>Max_FF_Version</em:maxVersion> </Description> </em:targetApplication> Establishing both minimum and maximum compatible versions lets you avoid conflicts with versions of Firefox your theme wasn't designed for -- or wasn't tested on. See Install Manifests for the reference information about the install.rdf file. CSS Files The CSS files in these directories tell the browser how to display the buttons and other controls, where to put the images, what border and padding it should put around them, and so on. As an example, let's change the standard button. Go into the global global directory and open button.css in your favorite text editor. Scroll down to "button {". This section defines the normal button in ...
Error Console - Archive of obsolete content
and is now only made available if you set the devtools.errorconsole.enabled preference to true. Use the Web Console instead, for web content, or the Browser Console for chrome content. The Error Console is a tool available in most Mozilla-based applications that is used for reporting errors in the application chrome and in web pages user opens. It reports JavaScript-related errors and warnings, CSS errors and arbitrary messages from chrome code. In Firefox, the Error Console can be opened from the tools menu or by Ctrl-Shift-J. For information about what JavaScript exceptions get logged into the Error Console, and how to make all exceptions get logged, read the article Exception logging in JavaScript. See Setting up extension development environment#Development preferences for the preferen...
... browser or mail window, use the function toJavaScriptConsole(). ...
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. 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. ...
...d 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. 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 r...
Documentation for BiDi Mozilla - Archive of obsolete content
ts). 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 frame has the same directionality. Fram...
... nsIBidiKeyboard widget/public/nsIBidiKeyboard.idl widget/src/%platform%/nsBidiKeyboard.cpp Sets and queries the directionality of the current keyboard language. ...
New Skin Notes - Archive of obsolete content
Devmo has a new skin that is ready for testing. If you go to your user preferences, you can change the skin to "Devmo". This is currently just a preview, but we would appreciate help with testing. Please add any feedback to this page. Thanks! Feedback Fix weird width bug on Preferences page. --dria CSS classes for Feature and Subfeature boxes, including required graphics. -- dria When will these fixes be on the live site? --Nickolay 10:38, 31 Aug 2005 (PDT) Existing fixes should be on test/docs/ now. --dria Stuff That's Been Fixed Note that while I've made these fixes, they haven't necessarily been checked in yet. Edit page textarea needs to 'scale' better with page width (so large whitespace area's are non-existant), suggest min-width:some-em-size; width: 88%; and max...
...rs. Yay! --dria 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 m...
Space Manager High Level Design - Archive of obsolete content
el Class/Component Diagram nsSpaceManager: The central point of management of the space taken up by floats in a block nsBandData: Provides information about the frames occupying a band of occupied or available space nsBlockBandData: A specialization of nsBandData that is used by nsBlockReflowState to determine the available space, float impacts, and where floats are cleared. Essentially a CSS-specific wrapper for generic nsBandData. BandRect: Keeps the bounds of a band, along with the frames associated with the band. BandRects are a linked list (provided by PRCListStr super-class) and also provide some geometry-management methods (SplitVertically, SplitHorizontally) and some methods that query or manipulate the frames associated with the band (IsOccupiedBy, AddFrame, RemoveFrame). B...
...th nsBlockReflowState::GetAvailableSpace); The float frame that is get from the passed nsFloatCache argument is reflowed and its rect is retrieved with GetRect; The floats margins are added; Check if the float can be placed in the actual band: if not advance to the next band; Check the float type and if it can be added to the space manager; Align the float to its containing block top if rule CSS2/9.5.1/4 is not respected; Add the float using nsSpaceManager::AddRectRegion Compare the area that the float used to occupy with the area that it now occupies: if different, record the vertically affected interval using nsSpaceManager::IncludeInDamage Use Case 3: Space Manager is used to find available space to reflow into The nsBlockFrame makes use of the Space Manager indirectly to get the...
Mozilla Web Developer Community - Archive of obsolete content
Get news from developer.mozilla.org and connect with developers involved in cross-browser, standards-based web development. ...
... Get news from developer.mozilla.org and connect with developers involved in cross-browser, standards-based web development. ...
crop - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › crop
n its left side. right The text will be cropped on its right side. center The text will be cropped in the middle, showing both the start and end of the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can a...
... Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. ...
style - Archive of obsolete content
Syntax is as in the HTML style attribute. ...
...Syntax is as in the HTML style attribute. ...
XUL Events - Archive of obsolete content
This event is sent when a user enters text in a textbox. This event is only called when the text displayed would change, thus it is not called when the user presses non-displayable keys. attribute: oninput overflow This event is only sent to a box or other layout element with a CSS overflow property set to a value other than 'visible'. When there is not enough space to display the contents of the element at full size, the overflow event will be fired. Depending on the value of the overflow property, scrollbars may have appeared. For example, if a box has a maximum size of 100 pixels, and only enough space for 80 pixels is available, the overflow event will be sent to the bo...
...ax. The script may return a value to set the preference to a specific value rather than the value of the element. attribute: onsynctopreference underflow This event is sent to an element when there becomes enough space to display it at full size. This applies to boxes and other layout elements with a CSS overflow property other than 'visible'. The underflow event can be used to indicate that a scrolling mechanism is no longer necessary. attribute: onunderflow DOMMenuItemActive This event is sent when a menu or menuitem is hovered over, or highlighted. This event bubbles. ...
Box Model Details - Archive of obsolete content
lexibility 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 horizontal box with two buttons in it, contained inside a flexible box. The box has the pack attribute which is used to center the buttons horizontally. The align attribute aligns the buttons verticall...
...orizontally. The align attribute aligns the buttons vertically. The result is that the buttons will be centered in the box in both directions. This example will work with a vertical box as well, although the second button will be underneath the first one, instead of beside it. ...
Styling a Tree - Archive of obsolete content
hose with a custom view. Let's say we want a particular row to have a blue background color. This would be used to implement Mozilla Mail's labels feature. We'll use a property called 'makeItBlue'. You can use whatever name you want. You can set multiple properties by separating them with spaces. Set the property on a row or cell, as in the following example: <treerow properties="makeItBlue"> CSS Selectors for the Tree The style sheet can take this property and use it to change the appearance of the row for unread messages or labels. You can think of the properties as functioning much like style classes, although they require a somewhat more complex syntax to use in a style sheet. This is because you can specify the style for a number of parts of the cell individually. You can style not ...
...ax that needs to be used: treechildren::-moz-tree-row(makeItBlue) { background-color: blue; } This style which has a complex selector is used to style the background color of rows that have the 'makeItBlue' property. This special syntax is needed because the cells themselves are not separate elements. All of the content inside the tree's body is rendered by the treechildren element. However, CSS has a concept to access parts of elements considering them to be pseudo-elements. This selector matches some tree rows inside the treechildren element as pseudo-elements. The style sets style rules for particular parts of what it displays. This style rule means, inside a treechildren element, set the background color to blue for all tree rows that have the 'makeItBlue' property. The text '::-moz...
Trees - Archive of obsolete content
Archive › Mozilla › XUL › Tutorial › Trees
ay. 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 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...
...Text 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. However, there are special wa...
XBL Attribute Inheritance - Archive of obsolete content
beside it) out of a label and a textbox element, the label will need to inherit its text from the value attribute and the textbox will also need to inherit its default value from the value attribute as well. To solve this, we will need to use a different attribute and map it to the same one. The following demonstrates this: XUL: <box class="labeledtextbox" title="Enter some text:" value="OK"/> CSS: box.labeledtextbox { -moz-binding: url('chrome://example/skin/example.xml#labeledtextbox'); } XBL: <binding id="labeledtextbox"> <content> <xul:label xbl:inherits="value=title"/> <xul:textbox xbl:inherits="value"/> </content> </binding> The textbox inherits the value attribute directly. To set the value attribute on the label, we need to use a different attribute name and map...
...d to use a different attribute name and map it to the value. The inherits attribute on the label grabs the title attribute from the labeledtextbox and maps it to the value attribute of the label element. The syntax <inner attribute>=<outer attribute> is used to map one attribute to another. Here is another example: XUL: <box class="okcancel" oktitle="OK" canceltitle="Cancel" image="happy.png"/> CSS: box.okcancel { -moz-binding: url('chrome://example/skin/example.xml#okcancel'); } XBL: <binding id="okcancel"> <content> <xul:button xbl:inherits="label=oktitle,image"/> <xul:button xbl:inherits="label=canceltitle"/> </content> </binding> The value of the oktitle attribute is mapped to the label attribute of the first button. The canceltitle attribute is mapped to the label a...
XUL Questions and Answers - Archive of obsolete content
ontent in a new window using "window.open" and send titlebar="no" as one of the flags in the 3rd argument. Is it possible to have checkbox support for multi column lists? The current issue is a person exploring if it is possible to have checkbox support for multi column lists. ...
...Gecko MinVersion requirement not met. Visit http://developer.mozilla.org/en/docs...pplication.ini to find out how to properly set up the application.ini file. How can i use other fonts on XULRunner applications which are not installed on the current machine? In order to do this, you must first attach the font file as a bundle with the XULRunner application as a bundle. You also have to write CSS code to refer to which element(s) you wish to apply this font to. someelement { font-family: "My Font", "Trebuchet MS"; } For more information about platform specific questions, please visit mozilla.dev.platform ...
The Implementation of the Application Object Model - Archive of obsolete content
, and the other for describing documents that can be used by those applications. It does not make sense to confuse or obscure the purpose of HTML by adding in a whole slew of new functionality that hasnothing to do with the display of Web pages. What content developers want from the next release of Mozilla is a standards-compliant browser. If we ship a browser that does not have 100% support for CSS2, for example, but we've extended HTML by adding 20-30 new tags, people are going to put down their blinders and see only the fact that we were off adding a whole slew of new stuff to HTML when we could have been firming up our standards story. By making XUL a separate beast, this is less of an issue. Since an AOM tree cannot be placed inside a DOM tree, XUL applications don't ever occur inside W...
... using native widgetry (unless you're willing to design an HTML dialog system, which still wouldn't cut it without extending HTML), and Communicator would have to ship with both widget sets. The native widgets would also be an issue for something like a gfx-toolbar, which would need to contain the native widgets and still look consistent on all platforms. The native widgets also wouldn't be fully CSS responsive, which would mean they might look strange when placed in a dialog or on a toolbar with a rendered background. Of course you could always say that toolbars and dialogs just wouldn't be able to have backgrounds with different colors, but that leads into the next point. A staggering loss of functionality. An incredible array of features would be lost. Yes, you'd probably ship a browser s...
button - Archive of obsolete content
n its left side. right The text will be cropped on its right side. center The text will be cropped in the middle, showing both the start and end of the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can a...
... Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } dir Type: one of the values below The direction in which the child elements of the element are placed. normal For scales, the scale's values are ordered from left to right (for horizontal scales) or from top to bottom (for vertical scales) For other elements, the elemen...
caption - Archive of obsolete content
n its left side. right The text will be cropped on its right side. center The text will be cropped in the middle, showing both the start and end of the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can a...
... Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } 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 thi...
checkbox - Archive of obsolete content
n its left side. right The text will be cropped on its right side. center The text will be cropped in the middle, showing both the start and end of the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can a...
... Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled Type: boolean Indicates whether the element is disabled or not. 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 ...
description - Archive of obsolete content
n its left side. right The text will be cropped on its right side. center The text will be cropped in the middle, showing both the start and end of the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can a...
... Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled Type: boolean Indicates whether the element is disabled or not. 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 ...
label - Archive of obsolete content
Archive › Mozilla › XUL › label
n its left side. right The text will be cropped on its right side. center The text will be cropped in the middle, showing both the start and end of the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can a...
... Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled Type: boolean Indicates whether the element is disabled or not. 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 ...
listitem - Archive of obsolete content
n its left side. right The text will be cropped on its right side. center The text will be cropped in the middle, showing both the start and end of the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can a...
... Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } current Type: boolean This attribute will be set to true if the listitem is the current item. This is typically used by a theme to customize the focus ring. To change the currently selected item in a listbox, use the listbox property selectedItem. disabled Type: boolean ...
menu - Archive of obsolete content
Archive › Mozilla › XUL › menu
n its left side. right The text will be cropped on its right side. center The text will be cropped in the middle, showing both the start and end of the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can a...
... Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled Type: boolean Indicates whether the element is disabled or not. 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 c...
menuitem - Archive of obsolete content
n its left side. right The text will be cropped on its right side. center The text will be cropped in the middle, showing both the start and end of the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can a...
... Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } description Type: string Descriptive text to appear in addition to the dialog title. disabled Type: boolean Indicates whether the element is disabled or not. If this attribute is set, the element is disabled. Disabled elements are usually drawn with grayed-out text. If ...
menulist - Archive of obsolete content
n its left side. right The text will be cropped on its right side. center The text will be cropped in the middle, showing both the start and end of the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can a...
... Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disableautoselect Type: boolean If this attribute is true or omitted, the selected item on the menu will update to match what the user entered in the textbox. If the text does not match any of the items in the list, the menu selection is cleared. If this attribute is false, the...
menupopup - Archive of obsolete content
for position are: before_start, before_end, after_start, after_end, start_before, start_after, end_before, end_after, overlap, and after_pointer. Check Positioning of the Popup Guide for a precise description of the effect of the different values. x, y For an anchored popup, the x and y arguments may be used to offset the popup from its anchored position by some number, measured in CSS pixels. An unanchored popup appears at the position specified by x and y, relative to the viewport of the document containing the popup node. In this case, the position and attributesOverride arguments are ignored. isContextMenu The isContextMenu argument should be true for context menus and false for all other types of popups. It affects menu item highlighting; that is, while a con...
... The event that triggered the popup (such as a mouse click, if the user clicked something to open the popup). openPopupAtScreen( x, y, isContextMenu ) Return type: no return value Open the popup at a specific screen position specified by x and y. This position may be adjusted if it would cause the popup to be off of the screen. The x and y coordinates are measured in CSS pixels. showPopup( element, x, y, popupType, anchor, align ) Deprecated since Gecko 1.9 Return type: no return value Deprecated in favor of openPopup and openPopupAtScreen Opens a popup element. There are two ways of specifying where the popup appears, either at a specific screen position, or relative to some element in the window. If either x or y are set to values, the popup will appear ...
menuseparator - Archive of obsolete content
n its left side. right The text will be cropped on its right side. center The text will be cropped in the middle, showing both the start and end of the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can a...
... Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled Type: boolean Indicates whether the element is disabled or not. 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 ...
panel - Archive of obsolete content
Archive › Mozilla › XUL › panel
for position are: before_start, before_end, after_start, after_end, start_before, start_after, end_before, end_after, overlap, and after_pointer. Check Positioning of the Popup Guide for a precise description of the effect of the different values. x, y For an anchored popup, the x and y arguments may be used to offset the popup from its anchored position by some number, measured in CSS pixels. An unanchored popup appears at the position specified by x and y, relative to the viewport of the document containing the popup node. In this case, the position and attributesOverride arguments are ignored. isContextMenu The isContextMenu argument should be true for context menus and false for all other types of popups. It affects menu item highlighting; that is, while a con...
... The event that triggered the popup (such as a mouse click, if the user clicked something to open the popup). openPopupAtScreen( x, y, isContextMenu ) Return type: no return value Open the popup at a specific screen position specified by x and y. This position may be adjusted if it would cause the popup to be off of the screen. The x and y coordinates are measured in CSS pixels. sizeTo( width, height ) Return type: no return value Changes the current size of the popup to the new width and height. Related Interfaces nsIAccessibleProvider, nsIDOMXULPopupElement ...
radio - Archive of obsolete content
Archive › Mozilla › XUL › radio
n its left side. right The text will be cropped on its right side. center The text will be cropped in the middle, showing both the start and end of the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can a...
... Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled Type: boolean Indicates whether the element is disabled or not. 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 ...
splitter - Archive of obsolete content
For: <vbox></vbox> <splitter/> <vbox></vbox> ...the splitter will not move, unless there is a collapse attribute on the splitter, which will cause it to collapse as soon as it is dragged. For: <vbox/> <splitter/> <vbox height="500"> <vbox height="1...
...ragged down below the 100px intrinsic height of the lower box, causing the child box to overflow, until reaching the min-height, at which point it will stop or collapse. That should also work with a minheight attribute specifying a value less than the intrinsic height. (However, because of bug 513597, only specifying both minheight and minwidth attributes, or specifying min-height or min-width in CSS, actually works to allow overflow.) ...
<statusbarpanel> - Archive of obsolete content
n its left side. right The text will be cropped on its right side. center The text will be cropped in the middle, showing both the start and end of the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can a...
... Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } 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 ...
tab - Archive of obsolete content
Archive › Mozilla › XUL › tab
n its left side. right The text will be cropped on its right side. center The text will be cropped in the middle, showing both the start and end of the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can a...
... Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled Type: boolean Indicates whether the element is disabled or not. 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 ...
toolbarbutton - Archive of obsolete content
n its left side. right The text will be cropped on its right side. center The text will be cropped in the middle, showing both the start and end of the text normally. none The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment. Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can a...
... Depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. If you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } dir Type: one of the values below The direction in which the child elements of the element are placed. normal For scales, the scale's values are ordered from left to right (for horizontal scales) or from top to bottom (for vertical scales) For other elements, the element...
Making sure your theme works with RTL locales - Archive of obsolete content
pointed right will have to point left and vice versa, and so on. A screenshot of Firefox 2 in Hebrew What you need to do At this stage you might ask yourself, "How would I know what language is my theme installed on? Should I make a special theme for these locales?" Don't despair: making a theme RTL-compatible is fairly easy! Gecko 1.9.2 and later Gecko 1.9.2 introduced the :-moz-locale-dir CSS pseudoclass, which matches based on whether the user interface is being rendered left-to-right or right-to-left: :-moz-locale-dir(ltr) matches if the user interface is being rendered left to right. :-moz-locale-dir(rtl) matches if the user interface is being rendered right to left. Example toolbar[iconsize="large"][mode="icons"] #back-button { -moz-image-region: rect(0px 396px 34px 360px...
...ir(rtl) { -moz-image-region: rect(0px 516px 34px 480px); } This specifies the default, left-to-right version of the button, then offers an override if the user's interface is being rendered in right-to-left mode. Gecko 1.9.1 (Firefox 3.5) and earlier The chromedir attribute Firefox, Thunderbird and SeaMonkey expose an attribute named chromedir on certain elements. All you have to do is add CSS rules to your theme that test for the value of this attribute, and use that to apply any RTL-specific rules that you may have. That's how the default theme works, so you can use it as an example. toolbar[iconsize="large"][mode="icons"] #back-button { -moz-image-region: rect(0px 398px 34px 360px); } toolbar[iconsize="large"][mode="icons"] #back-button[chromedir="rtl"] { -moz-image-region: re...
-moz-border-bottom-colors - Archive of obsolete content
This eliminates the need for nested boxes. ...
...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. ...
-moz-border-left-colors - Archive of obsolete content
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. ...
...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. ...
-moz-border-right-colors - Archive of obsolete content
This eliminates the need for nested boxes. ...
...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. ...
-moz-border-top-colors - Archive of obsolete content
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. ...
...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. ...
-moz-window-shadow - Archive of obsolete content
Initial valuedefaultApplies toall elements that create native windows, e.g. ...
...shadow. It only works on Mac OS X. This property is not standard and from Firefox 44 onwards cannot be used on websites anymore. Firefox 3 added support for transparent windows on Mac OS X. However, for these windows shadows were turned off and there was no way to turn them on. In Firefox 3.5 the default changed, with all windows having a shadow. This version introduced the -moz-window-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. men...
-ms-accelerator - Archive of obsolete content
Initial valuefalseApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax /* The object is not a keyboard shortcut (the default) */ -ms-accelerator: false /* The object is a keyboard shortcut */ -ms-accelerator: true Values false The object is not a keyboard shortcut. true The object is a keyboard shortcut. Formal syntax false | true Examples This example uses the -ms-accelerator attribute in a <u> element to specify that the "N" in the <label> element is a keyboard shortcut. ...
...cators for menu items and controls until the Alt key is pressed. An access key is a single character used as a keyboard shortcut for selecting an object. The user presses the Alt key and holds it while pressing the character to move input focus to the object, and to invoke the default event associated with the object. In Internet Explorer 8 (IE8) the -ms-accelerator attribute is an extension to CSS, and can be used as a synonym for accelerator in IE8 Standards mode. ...
-ms-block-progression - Archive of obsolete content
Initial valuetbApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values tb Default. Top-to-bottom block flow. Layout is horizontal. rl Right-to-left block flow. Layout is vertical. bt Bottom-to-top block flow. Layout is horizontal. lr Left-to-right block flow. Layout is vertical. Formal syntax tb | rl | bt | lr Specifications Not part of any specification. Remarks In vertical layout, text lines are rotated 90? clockwise. Images are not rotated, but tables are. ...
...ut, text lines are rotated 90? clockwise. Images are not rotated, but tables are. Box layout in vertical orientations is exactly analogous to layout in the horizontal orientation: width, height, top, bottom, right, and left do not rotate with the text. Only one block progression is active at a time; these values cannot be combined. This property is based on the block-progression property of the CSS3 Text Layout module. ...
-ms-hyphenate-limit-zone - Archive of obsolete content
Negative values are not allowed. ...
...discrete Syntax Values <percentage> An integer followed by a percent sign (%), which specifies the width of the hyphenation zone, calculated with respect to the line box. Negative values are not allowed. <length> A floating-point number, followed by a relative units designator, that indicates the width of the hyphenation zone. For more information about supported length units, see CSS basic data types. Negative values are not allowed. Formal syntax <percentage> | <length> Specifications Not part of any specification. Remarks The -ms-hyphenate-limit-zone property enables you to control the amount of trailing whitespace permitted during hyphenation. The hyphenation zone is always at the logical right side of the padding box. A word is considered for hyphenation on...
-ms-scroll-translation - Archive of obsolete content
Initial valuenoneApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete Syntax Values vertical-to-horizontal Vertical to horizontal translation, as described in Remarks, will take place when appropriate. none No scroll wheel translation takes place. inherit The initial value. The value is inherited from the element's parent element. Formal syntax none | vertical-to-horizontal Specifications Not part of any specification. Remarks This property requires Windows 8 or later. ...
...for vertical scroll events. By setting the -ms-scroll-translation property to vertical-to-horizontal, you are specifying that vertical scroll events should be interpreted as their corresponding horizontal scroll events. This property's initial value is inherit on all elements, except the <html> element, where it defaults to none. This property has no effect on keyboard interaction. The default CSS templates for Windows apps using JavaScript, "ui-light.css" and "ui-dark.css", set this property to vertical-to-horizontal by default on the <html> element. ...
-ms-text-autospace - Archive of obsolete content
Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values none No effect takes place; that is, no extra space is added. This is the default value. ideograph-alpha Creates extra spacing between runs of ideographic and non-ideographic text, such as Latin-based, Cyrillic, Greek, Arabic, or Hebrew text. ideograph-numeric Creates extra spacing between runs of ideographic text and numeric characters. ideograph-parenthesis Creates extra spacing between a normal (non-wide) parenthesis and an ideograph. ...
...g between a normal (non-wide) parenthesis and an ideograph. ideograph-space Extends the width of the space character when it is adjacent to ideographs. Formal syntax none | ideograph-alpha | ideograph-numeric | ideograph-parenthesis | ideograph-space Specifications Not part of any specification. Remarks This property requires Windows 8 or later. This property is an extension to CSS, and can be used as a synonym for text-autospace in IE8 standards Mode. An ideograph is a character in an Asian writing system that represents a concept or an idea, but not a particular word or pronunciation. ...
-ms-wrap-flow - Archive of obsolete content
Initial valueautoApplies toblock-level elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values auto For floated elements, an exclusion is created; for all other elements, an exclusion is not created. both Inline flow content can flow on all sides of the exclusion. start Inline flow content can wrap on the start edge of the exclusion area but must leave empty the area after the end edge of the exclusion area. end Inline flow content can wrap after the end edge of the exclusion area but must leave empty the area before the start edge of the exclusion area. ...
... ...
-ms-wrap-through - Archive of obsolete content
Initial valuewrapApplies toblock-level elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values wrap The exclusion element inherits its parent node's wrapping context. Its descendant inline content wraps around exclusions defined outside the element. none The exclusion element does not inherit its parent node's wrapping context. Its descendants are only subject to exclusion shapes defined inside the element. Formal syntax wrap | none Specifications Not part of any specification. ...
...intersect the same exclusion element. The wrapping context of a box is a collection of exclusion areas contributed by its associated exclusion boxes. The inline flow content of a box is placed in the area that corresponds to the subtraction of its wrapping context from its own content area. For more information about exclusion elements' impact on content flow, see the Terminology section of the CSS Exclusions Module Level 1 specification. ...
:-moz-system-metric(windows-default-theme) - Archive of obsolete content
This will exclude Windows Classic themes as well as third-party themes. This selector is intended for use mainly by theme developers. Note: Since Firefox 58, this pseudo-class is no longer available to web content -- it is only available internally (e.g. to XUL / chrome code). See bug 1396066 for more details. Example HTML Content <p id="defaultThemes"> This paragraph should have a green background with Luna/Royale/Zune/Aero Windows themes and red with other themes. ...
... more details. Example HTML Content <p id="defaultThemes"> This paragraph should have a green background with Luna/Royale/Zune/Aero Windows themes and red with other themes. </p> <p id="nonDefaultThemes"> This paragraph should have a green background with Windows Classic or third-party themes and red with other themes. ...
::-ms-expand - Archive of obsolete content
Other properties are ignored. ...
...Other properties are ignored. ...
::-ms-fill-lower - Archive of obsolete content
Other properties are ignored. ...
...Other properties are ignored. ...
::-ms-reveal - Archive of obsolete content
Other properties are ignored. ...
...is used to display a password reveal button for use with a password field created by <input type="password">. The user presses the button to reveal the actual field value rather than asterisks. The password reveal button is usually displayed at the edge of the password field. The ::-ms-reveal pseudo-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. 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-co...
::-ms-ticks-after - Archive of obsolete content
Other properties are ignored. ...
...cks 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. Allowable Properties Only the following CSS properties can be used in a rule with ::-ms-ticks-after in its selector. Other properties are ignored. 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-rig...
::-ms-ticks-before - Archive of obsolete content
Other properties are ignored. ...
...cks 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. Allowable Properties Only the following CSS properties can be used in a rule with ::-ms-ticks-before in its selector. Other properties are ignored. 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-ri...
::-ms-tooltip - Archive of obsolete content
Other properties are ignored. ...
...Other properties are ignored. ...
::-ms-value - Archive of obsolete content
Other properties are ignored. ...
...Other properties are ignored. ...
azimuth - Archive of obsolete content
Archive › Web › CSS › azimuth
This is important in that it provides a natural way to tell several voices apart, as each can be positioned to originate at a different location on the sound stage. Stereo output produce a lateral sound stage, while binaural headphones and multi-speaker setups allow for a fully three-dimensional stage. ...
...ckwise by 20 degrees, relative to the current angle. rightwards: Moves the sound clockwise by 20 degrees, relative to the current angle. Examples h1 { azimuth: 30deg; } td.a { azimuth: far-right; } /* 60deg */ #12 { azimuth: behind far-right; } /* 120deg */ p.comment { azimuth: behind; } /* 180deg */ Specifications Specification Status Comment CSS Level 2 (Revision 1)The definition of 'azimuth' in that specification. Recommendation Initial definition. ...
display-inside - Archive of obsolete content
/* Keyword values */ display-inside: auto; display-inside: block; display-inside: table; display-inside: flex; display-inside: grid; display-inside: ruby; /* Global values */ display-inside: inherit; display-inside: initial; display-inside: unset; Value not found in DB! Syntax One of the keyword values listed below. Values auto If the element's computed <display-outside> value is inline-level, the element is an inline element, and lays out its contents using inline layout. ...
... lays out its contents using block layout. table The element lays out its contents using table layout. flex The element lays out its contents using flex layout. grid The element lays out its contents using grid layout. ruby The element lays out its contents using ruby layout. Formal syntax Syntax not found in DB! Specifications Specification Status Comment CSS Display Module Level 3The definition of 'display-inside' in that specification. Candidate Recommendation Initial specification Browser compatibility Not supported in any browser. ...
display-outside - Archive of obsolete content
The display-outside CSS property specifies the outer display type of the box generated by an element, dictating how the element participates in its parent formatting context. /* Keyword values */ display-outside: block-level; display-outside: inline-level; display-outside: run-in; display-outside: contents; display-outside: none; display-outside: table-row-group; display-outside: table-header-group; display-outside: table-footer-group; display-outside: table-row; display-outside: table-cell; display-outside: table-column-group; display-outside: table-column; display-outside: table-caption; display-outside: ruby-base; display-outside: ruby-text; display-outside: ruby-base-container; display-outside: ruby-text-container; /* Global values */ display-outside: inherit; display-outside...
...cell boxes. layout-specific leaf types These display types require their parent to be of a particular display type, but can accept any display-inside value. For example, a table-caption box must have a table parent, but can establish any kind of formatting context for its children. Formal syntax Syntax not found in DB! Specifications Specification Status Comment CSS Display Module Level 3The definition of 'display-outside' in that specification. Candidate Recommendation Initial definition ...
Mozilla XForms Specials - Archive of obsolete content
le to mix repeats with either table or ul. That means that it is not possible to do: <table> <xf:repeat ...> <tr> ... </tr> </xf:repeat> </table> or <ul> <xf:repeat ...> <li> ... </li> </xf:repeat> </ul> Section 9.3.2 states that mixing with table will probably never work. Mixing with ul might suffer from the same limitation. Pseudo-class support We currently support all the CSS pseudo-classes in XForms (:enabled, :disabled, etc. ), except for :read-only and :read-write, because of non-specified behaviour of these for (X)HTML. Instead you have to use :-moz-read-only and :-moz-read-write for now. (limitation tracked in bug 313111)Pseudo element support There is no support for the pseudo elements (::value, ::repeat-item, and ::repeat-index ). Instead you will have to use t...
...ment support There is no support for the pseudo elements (::value, ::repeat-item, and ::repeat-index ). Instead you will have to use the following normal classes instead: xf-value xf-repeat-item xf-repeat-index For example, to target the value element of an input control use: @namespace xf url("http://www.w3.org/2002/xforms"); xf|input .xf-value { ... } The pseudo elements are defined in the CSS3 Basic User Interface specification . (limitation tracked in bug 271724) Optional parameters in XPath functions Optional parameters in XPath functions are not supported, you will have to specify all parameters when calling a function. This affects functions like hmac() or digest(). Instead of using digest('abc', 'SHA-1') explicitly use the third parameter (the results are equal): digest('abc',...
Archived open Web documentation - Archive of obsolete content
to detect user agents is crucial to creating maintainable, cross browser web content. This article reviews several approaches to browser detection, their usefulness in specific circumstances to arrive at a common sense approach to browser detection. Browser Feature Detection An experimental approach to discovering degree of support for Standards CSS Obsolete CSS features Displaying notifications (deprecated) Firefox offers support for "desktop notifications"; these are notifications that are displayed to the user outside the context of the web content, using the standard notification system provided by the operating system. E4X ECMAScript for XML (E4X) is a ...
... functions available on ParallelArray attempted to execute in parallel, though they may fall back to sequential execution if necessary. To ensure that your code executes in parallel, it is suggested that the functions should be limited to the parallelizable subset of JS that Firefox supports. Properly Using CSS and JavaScript in XHTML Documents XHTML(TM) 1.0 The Extensible HyperText Markup Language (Second Edition) defines XHTML to be a reformulation of HTML 4 as an XML 1.0 application. Talk:JavaScript Reference The guide section links to an interesting document discussing how to create and use private variables in objects, which is great ...
Archive of obsolete content
u switch to a stock other than one of the ones included in the popup menu. An Interview With Douglas Bowman of Wired News One of the Web's oldest news sites, Wired News draws between 20 and 25 million page views every month. On October 11, 2002, Wired launched a brand-new site design that uses validating XHTML for its structure and a small collection of CSS files for its layout. The new design clearly shows what some experts have been saying: that standards-based design can be visually compelling and preserve the interface conventions we've come to expect from Web pages. API Archived documentation about obsolete web standards APIs. Archived Mozilla and build documentation These articles are archived,...
...on Concepts covered in the previous sample won't be reiterated 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 ...
Index - Game development
to navigate. We often need to decide which audio parts are essential to our games' experience and which are nice to have but not essential, and devise a strategy accordingly. This article provides a detailed guide to implementing audio for web games, looking at what works currently across as wide a range of platforms as possible. 27 Crisp pixel art look with image-rendering 2D, 3D, CSS, Canvas, Games, JavaScript, WebGL, image-rendering, pixel This article discusses a useful technique for giving your canvas/WebGL games a crisp pixel art look, even on high definition monitors. 28 Efficient animation for web games Animation, Games, JavaScript This article covers techniques and advice for creating efficient animation for web games, with a slant towards su...
... This article discusses a useful technique for giving your canvas/WebGL games a crisp pixel art look, even on high definition monitors. 28 Efficient animation for web games Animation, Games, JavaScript This article covers techniques and advice for creating efficient animation for web games, with a slant towards supporting lower end devices such as mobile phones. We touch on CSS transitions and CSS animations, and JavaScript loops involving window.requestAnimationFrame. 29 Implementing controls using the Gamepad API Controls, Gamepad API, Gamepads, Games, JavaScript, controllers The Gamepad API is very easy to develop with. Now it's easier than ever to deliver a console-like experience to the browser without the need for any plugins. You can play the...
Introduction to game development for the Web - Game development
Let's look at how the Web can help you. The reach of the Web is enormous; it's everywhere. Games built with HTML5 work on smartphones, tablets, PCs and Smart TVs. Marketing and discover...
...PIs the Web brings to the table that cater to game developers. 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...
Building up a basic demo with Three.js - Game development
The first <script> element includes the Three.js library in the page, and we will write our example code inside the second. There are two helper variables already included, which store the window's width and height. Before reading further, copy this code...
...inside the second. There are two helper variables already included, which store the window's width and height. Before reading further, copy this code to a new text file, and save it in your working directory as index.html. Renderer A renderer is a tool which displays scenes right in your browser. There are a few different renderers: WebGL is the default, and others you can use are Canvas, SVG, CSS, and DOM. They differ in how everything is rendered, so the WebGL implementation will implement differently than the CSS one. Despite the variety of ways they achieve the goal, the experience will look the same for the user. Thanks to this approach, a fallback can be used, if a desired technology is not supported by the browser. var renderer = new THREE.WebGLRenderer({antialias:true}); renderer.
GLSL Shaders - Game development
The <script> element in the <head> includes the Three.js library in the page; we will write our code into three script tags in the <body> tag: The first one will contain the vertex shader. The second one will contain the fragment shader. The third one will contain th...
...Our example doesn't do much but there are many more cool things you can do with shaders -- check out some really cool ones on ShaderToy for inspiration and to learn from their sources. ...
Create the Canvas and draw on it - Game development
The body contains <canvas> and <script> elements -- we will render the game inside the first one and write the JavaScript code that controls it in the second one. The <canvas> element has an id of myCanvas to allow us to easily grab a reference to it, and it is 480 pixels wide and 320 pixels high. All the JavaScript code we will write in this tutorial will go between the opening <s...
...bove is the arc() method. It takes six parameters: x and y coordinates of the arc's center arc radius start angle and end angle (what angle to start and finish drawing the circle, in radians) direction of drawing (false for clockwise, the default, or true for anti-clockwise.) This last parameter is optional. The fillStyle property looks different than before. This is because, just as with CSS, color can be specified as a hexadecimal value, a color keyword, the rgba() function, or any of the other available color methods. Instead of using fill() and filling the shapes with colors, we can use stroke() to only colour the outer stroke. Try adding this code to your JavaScript too: ctx.beginPath(); ctx.rect(160, 10, 100, 40); ctx.strokeStyle = "rgba(0, 0, 255, 0.5)"; ctx.stroke(); ctx.clo...
Visual typescript game engine - Game development
mon. I just like it like that. ...
...h other hybrid frameworks or custom implementation throw the native mobile application web control (Chrome implementation usually tested). npm run broadcaster Documentation : Beta version for documentation. API Documentation If you wanna generate doc you will need manual remove the comment from plugin section in webpack.config.js. Restart 'npm run dev' Best way to fully healthy build. HTML/CSS is not prior to this project. If you wanna insert some new HTML page just define it intro webpack.config.js : plugins : [ new HtmlWebpackPlugin({ filename: '/templates/myGameLobby.html', template: 'src/html-components/myGameLobby.html' }), ... See register and login example. Code format : npm run fix npm run tslint or use : tslint -c tslint.
Alignment subject - MDN Web Docs Glossary: Definitions of Web-related terms
For justify-self and align-self, the alignment subject is the margin box of the box the property is set on, using the writing mode of that box. For justify-content and align-content, the writing mode of the box is also used. The definition of the alignment subject depends on the layout mode being used. Block containers (including table cells) The entire content of the block as a single unit. Multicol containers The column boxes, with any spacing inserted between column boxes added to the relevant column gaps. Flex containers For justify-content, the flex items in each flex line. For align-content, the flex lines. ...
...n gaps. ...
Canonical order - MDN Web Docs Glossary: Definitions of Web-related terms
It is defined by the formal syntax of the property and normally refers to the order in which longhand values should be specified as part of a single shorthand value. For example, background shorthand property values are made up of several background-* longhand properties. ...
...nd-position background-size background-repeat background-attachment background-origin background-clip background-color Furthermore, its syntax defines, that if a value for the background-size is given, it must be specified after the value for the background-position, separated by a slash. Other values may appear in any order. Learn more What does "canonical order" mean with respect to CSS properties? on Stack Overflow provides useful further discussion. The description of the formal syntax used for CSS values on MDN ...
Fallback alignment - MDN Web Docs Glossary: Definitions of Web-related terms
In CSS Box Alignment, a fallback alignment is specified in order to deal with cases where the requested alignment cannot be fullfilled. For example, if you specify justify-content: space-between there must be more than one alignment subject. If there is not, the fallback alignment is used. This is specified per alignment method, as detailed below. ...
...xample, if you specify justify-content: space-between there must be more than one alignment subject. If there is not, the fallback alignment is used. This is specified per alignment method, as detailed below. First baseline start Last baseline safe end Baseline start Space-between flex-start (start) Space-around center Space-evenly center Stretch flex-start (start) Learn more CSS Box Alignment ...
Flex Container - MDN Web Docs Glossary: Definitions of Web-related terms
flex container. ...
...matting context for the element, which is similar to a block formatting context in that floats will not intrude into the container, and the margins on the container will not collapse with those of the items. Learn more Property reference align-content align-items flex flex-direction flex-flow flex-wrap justify-content Further reading CSS Flexbox Guide: Basic Concepts of Flexbox CSS Flexbox Guide: Aligning items in a flex container CSS Flexbox Guide: Mastering wrapping of flex items ...
Grid Cell - MDN Web Docs Glossary: Definitions of Web-related terms
It is the space between four intersecting grid lines and conceptually much like a table cell. If you do not place items using one of the grid placement methods, direct children of the grid container will be placed one into each individual grid cell by the auto-placement algorithm. Additional row or column tracks will be created to create enough cells to hold all items. In the example we have created a three column track grid. The five items are placed into grid cells working along an initial row of three grid cells, then creating a new row for the remaining two. ...
... padding: 1em; color: #d9480f; } .wrapper { display: grid; grid-template-columns: repeat(3,1fr); grid-auto-rows: 100px; } <div class="wrapper"> <div>One</div> <div>Two</div> <div>Three</div> <div>Four</div> <div>Five</div> </div> Learn More Property reference grid-template-columns grid-template-rows grid-auto-rows grid-auto-columns Further reading CSS Grid Layout Guide: Basic concepts of grid layout Definition of Grid Cells in the CSS Grid Layout specification ...
Grid Column - MDN Web Docs Glossary: Definitions of Web-related terms
A grid column is a vertical track in a CSS Grid Layout, and is the space between two vertical grid lines. It is defined by the grid-template-columns property or in the shorthand grid or grid-template properties. In addition, columns may be created in the implicit grid when items are placed outside of columns created in the explicit grid. These columns will be auto-sized by default, or can have a size specified with the grid-auto-columns property. When working with alignment in CSS Grid Layout, the axis down which columns run is known as the block, or column, axis. ...
... outside of columns created in the explicit grid. These columns will be auto-sized by default, or can have a size specified with the grid-auto-columns property. When working with alignment in CSS Grid Layout, the axis down which columns run is known as the block, or column, axis. ...
Grid container - MDN Web Docs Glossary: Definitions of Web-related terms
Using the value grid or inline-grid on an element turns it into a grid container using CSS Grid Layout, and any direct children of this element become grid items. When an element becomes a grid container it establishes a grid formatting context. The direct children can now lay themselves out on any explicit grid defined using grid-template-columns and grid-template-rows, or on the implicit grid created when an item is placed outside of the explicit grid. ...
...hes a grid formatting context. ...
Grid Lines - MDN Web Docs Glossary: Definitions of Web-related terms
In the following example there is a grid with three column tracks and two row tracks. This gives us 4 column lines and 3 row lines. ...
...nd]; grid-template-rows: [row1-start] 100px [row2-start] 100px [rows-end]; } .item { grid-column-start: col1-start; grid-column-end: col3-start; grid-row-start: row1-start; grid-row-end: rows-end; } Learn more Property reference grid-template-columns grid-template-rows grid-column-start grid-column-end grid-column grid-row-start grid-row-end grid-row Further reading CSS Grid Layout Guide: Basic concepts of grid layout CSS Grid Layout Guide: Line-based placement with CSS Grid CSS Grid Layout Guide: Layout using named grid lines CSS Grid Layout Guide: CSS Grids, Logical Values and Writing Modes Definition of Grid Lines in the CSS Grid Layout specification ...
Grid Row - MDN Web Docs Glossary: Definitions of Web-related terms
A grid row is a horizontal track in a CSS Grid Layout, that is the space between two horizontal grid lines. It is defined by the grid-template-rows property or in the shorthand grid or grid-template properties. In addition, rows may be created in the implicit grid when items are placed outside of rows created in the explicit grid. These rows will be auto sized by default, or can have a size specified with the grid-auto-rows property. When working with alignment in CSS Grid Layout, the axis along which rows run is known as the inline, or row, axis. ...
...en items are placed outside of rows created in the explicit grid. These rows will be auto sized by default, or can have a size specified with the grid-auto-rows property. ...
Gutters - MDN Web Docs Glossary: Definitions of Web-related terms
In the example below we have a three-column and two-row track grid, with 20-pixel gaps between column tracks and 20px-gaps between row tracks. ...
...argins, padding or the use of the space distribution properties in Box Alignment can all contribute to the visible gap - therefore the grid-gap properties should not be seen as equal to "the gutter size" unless you know that your design has not introduced any additional space with one of these methods. Learn More Property reference grid-column-gap grid-row-gap grid-gap Further reading CSS Grid Layout Guide: Basic concepts of grid layout Definition of gutters in the CSS Grid Layout specification ...
RGB - MDN Web Docs Glossary: Definitions of Web-related terms
represents colors as mixtures of three underlying components (or channels), namely, red, green, and blue. Each color is described by a sequence of three numbers (typically between 0.0 and 1.0, or between 0 and 255) that represent the different intensities (or contributions) of red, green, and blue, in determining the final color. There are many ways to describe the RGB components of a color. In CSS they can be represented as a single 24-bit integer in hexadecimal notation (for example, #add8e6 is light blue), or in functional notation as three separate 8-bit integers (for example, rgb(46, 139, 87) is sea green). In OpenGL, WebGL, and GLSL the red-green-blue components are fractions (floating-point numbers between 0.0 and 1.0), although in the actual color buffer they are typically stored ...
...en-blue components are fractions (floating-point numbers between 0.0 and 1.0), although in the actual color buffer they are typically stored as 8-bit integers. Graphically, a color can be represented as a point in a three-dimensional grid or cube, where each dimension (or axis) corresponds to a different channel. Learn more General knowledge RGB color model on Wikipedia Learn about it CSS data type: <color> ...
Semantics - MDN Web Docs Glossary: Definitions of Web-related terms
"what purpose or role does that HTML element have" (rather than "what does it look like?".) Semantics in JavaScript In JavaScript, consider a function that takes a string parameter, and returns an <li> element with that string as its textContent. Would you need to look at the code to understand what the function did if it was called build('Peach'), or createLiWithContent('Peach')? Semantics in CSS In CSS, consider styling a list with li elements representing different types of fruits. Would you know what part of the DOM is being selected 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>...
...is 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 use the right HTML element for the right job. HTML should be coded to represent the data that will be populated and not based on its default presentation styling. Presentation (how it should look), is the sole responsibility of CSS. Some of the benefits from writing semantic markup are as follows: Search engines will consider its contents as important keywords to influence the page's search rankings (see SEO) Screen readers can use it as a signpost to help visually impaired users navigate a page Finding blocks of meaningful code is significantly easier than searching though endless divs with or without semantic or nam...
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. ...
...b 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. Learn more General knowledge CSS first steps Stylesheets on Wikipedia ...
Vendor Prefix - MDN Web Docs Glossary: Definitions of Web-related terms
Developers should wait to include the unprefixed property until browser behavior is standardized. Browser vendors are working to stop using vendor prefixes for experimental features. Web developers have been using them on production Web sites, despite their experimental nature. ...
...e difficult for browser vendors to ensure compatibility and to work on new features; it's also been harmful to smaller browsers who wind up forced to add other browsers' prefixes in order to load popular web sites. Lately, the trend is to add experimental features behind user-controlled flags or preferences, and to create smaller specifications which can reach a stable state much more quickly. ...
Mobile accessibility - Learn web development
Accessibility Next With web access on mobile devices being so popular and renowned platforms such as iOS and Android having full-fledged accessibility tools, it is important to consider the accessibility of your web content on these platforms. This article looks at mobile-specific accessibility considerations. Prerequisites: Basic computer literacy, a basic understanding of HTML, CSS, and JavaScript, and an understanding of the previous articles in the course. Objective: To understand what problems exist with accessibility on mobile devices, and how to overcome them. Accessibility on mobile devices The state of accessibility -- and support for web standards in general -- is good in modern mobile devices. Long gone are the days when mobile devices ran compl...
...on the page. Language: Move between different translations, if they are available. Select Headings. Now you'll be able to swipe up and down to move between headings on the page. Note: For a more complete reference covering the VoiceOver gestures available and other hints on accessibility testing on iOS, see Test Accessibility on Your Device with VoiceOver. Control mechanisms In our CSS and JavaScript accessibility article, we looked at the idea of events that are specific to a certain type of control mechanism (see Mouse-specific events). To recap, these cause accessibility issues because other control mechanisms can't activate the associated functionality. As an example, the click event is good in terms of accessibility -- an associated event handler can be invoked by clickin...
What is accessibility? - Learn web development
view: Accessibility Next This article starts the module off with a good look at what accessibility is -- this overview includes what groups of people we need to consider and why, what tools different people use to interact with the web, and how we can make accessibility part of our web development workflow. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS. Objective: To gain familiarity with accessibility, including what it is, and how it affects you as a web developer. So what is accessibility? Accessibility is the practice of making your websites usable by as many people as possible. We traditionally think of this as being about people with disabilities, but the practice of making sites accessible also benefits other groups s...
... why it's important, and looked at how you can fit it into your workflow. ...
Test your skills: The Box Model - Learn web development
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. The Box Model One With the two boxes below, one is using the standard box model, the other the alternate box model. Change the width of the second box by adding rules to the .alternate class, so that it matches the visual width of the first box. Your final result will look like the image below. ...
...em. Try updating the live code below to recreate the example as displayed in the image: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. The Box Model Three In this example the inline element has a margin, padding and border however the lines above and below are overlapping it. What can you add to your CSS to cause the size of the margin, padding, and border to be respected by the other lines, while still keeping the element inline? 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. Assessment or further help You can practice these examples ...
Test your skills: values and units - Learn web development
The aim of this task is to help you check your understanding of some of the values and units that we looked at in the lesson on CSS Values and Units. 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 One In this task, the first list item has been given a background color using hex color codes. Your task is to complete the CSS using the same color in different formats, plus a final list item where you should make the background semi-opaque. The second list item should use RGB color. The third should use HSL color. The f...
... 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. Task Two In this task you need to set the size of various items of text. The <h1> should be 50 pixels. The <h2> should be 2em. ...
Test your skills: Grid Layout - Learn web development
You will be working through three small tasks which use different elements of the material you have just covered. 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. Grid Layout One In this task you should create a grid into which the four child elements will auto-place. ...
...have three columns sharing the available space equally, and a 20-pixel gap between the column and row tracks. 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. Grid Layout Two In this example we already have a grid defined. By editing the CSS rules for the two child elements, cause them to span over several grid tracks each; the second item should overlay the first as in the image below. Try updating the live code below to recreate the finished example: Additional questions: Can you now cause the first item to display on top without changing the order of items in the source? For assessment or further work purposes, downloa...
How do you make sure your website works properly? - Learn web development
t that we made a typo in our HTML code: unicorn_pics.png rather than unicorn_pic.png. So correct the typo in your code editor by changing the image's src attribute: Save, push to the server, and reload the page in your browser: There you go! Let's look at the HTTP statuses again: 200 for / and for unicorn_pic.png means that we succeeded in reloading the page and the image. 304 for basic.css means that this file has not changed since the last request, so the browser can use the file in its cache rather than receiving a fresh copy. So we fixed the error and learned a few HTTP statuses along the way! Frequent errors The most frequent errors that we find are these: Typos in the address We wanted to type http://demozilla.examplehostingprovider.net/ but typed too fast and forgot an ...
... ...
How much does it cost to do something on the Web? - Learn web development
ollars, depending on the plan you purchase. Some of them, like Microsoft Visual Studio, can cost hundreds, or thousands of dollars; though Visual Studio Express is free for individual developers or open source projects. Often, for-pay editors will have a trial version. To start, we suggest trying out several editors, to get a sense of which works best for you. If you're only writing simple HTML, CSS, and Javascript, go with a simple editor. Price does not reliably reflect a text editor's quality or usefulness. You have to try it for yourself and decide if it meets your needs. For example, Sublime Text is cheap, but comes with many free plugins that can greatly extend its functionality. Image editors Your system likely includes a simple image editor, or viewer: Paint on Windows, Eye of Gno...
...o files. You need to upload content to a remote server (see Hosting below), so you need a modem. Your ISP can rent Internet connectivity to you for a few dollars per month, though your budget might vary, depending on your location. ISP access Make sure that you have sufficient bandwidth: Low-bandwidth access may be adequate to support a 'simple' website: reasonably-sized images, texts, some CSS and JavaScript. That will likely cost you a few dozen dollars, including the rent for the modem. On the other hand, you'll need a high-bandwidth connection, such as DSL, cable, or fiber access, if you want a more advanced website with hundreds of files, or if you want to deliver heavy video/audio files directly from your web server. It could cost the same as low-bandwidth access, upwards to seve...
What is a web server? - Learn web development
b server, 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 ...
...webpage, 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...
Example 2 - Learn web development
>Banana</option> <option>Strawberry</option> <option>Apple</option> </select> <div class="select"> <span class="value">Cherry</span> <ul class="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 : 1...
...n>Banana</option> <option>Strawberry</option> <option>Apple</option> </select> <div class="select"> <span class="value">Cherry</span> <ul class="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; } Result for No JS ...
Test your skills: Form validation - Learn web development
ing asked for. Give the "User name" field a required length of between 5 and 20 characters, the "Phone number" field a maximum length of 15 characters, and the "Comment" field a maximum length of 200 characters. Try submitting your form -- it should refuse to submit until the above constaints are followed, and give suitable error messages. To help, you might want to consider adding some simple CSS to show when a form field is valid or invalid. Download the starting point for this task to work in your own editor or in an online editor. Form validation 2 Now we want you to take the same form you saw in the previous task (use your previous answer if you want to), and add some more specific pattern validation to the first three fields using regular expressions. All of the user names in...
...her spaces, dashes, or dots. Note: Regular expressions are really challenging if you are new to them, but don't despair -- have a go and see where you get to; there is no shame in asking for some help. You can find everything you need to answer these questions at our regular expression reference, and by searching on Stack Overflow. Again, to help you might want to consider adding some simple CSS to show when a form field is valid or invalid. Download the starting point for this task to work in your own editor or in an online editor. Form validation 3 In our final task for this set, we are providing you with a similar example to what you saw in the accompanying article -- a simple email address entry input. We would like you to use the constraint validation API, plus some form valida...
Dealing with files - Learn web development
in 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-site folder. Note: On Windows computers, y...
...TML -- even if you are developing your website on Windows, you should still use forward slashes in your code. What else should be done? That is about it for now. Your folder structure should look something like this: Previous Overview: Getting started with the web Next In this module Installing basic software What will your website look like? Dealing with files HTML basics CSS basics JavaScript basics Publishing your website How the web works ...
HTML basics - Learn web development
l> element. 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></titl...
...lso view it here): If you get stuck, you can always compare your work with our finished example code on GitHub. Here, we have only really scratched the surface of HTML. To find out more, go to our Learning HTML topic. Previous Overview: Getting started with the web Next In this module Installing basic software What will your website look like? Dealing with files HTML basics CSS basics JavaScript basics Publishing your website How the web works ...
Installing basic software - Learn web development
s (Git is increasingly replacing FTP for this purpose). There are loads of (S)FTP programs available including Cyberduck, Fetch and FileZilla. An automation system, like Webpack, Grunt, or Gulp to automatically perform repetitive tasks, such as minifying code and running tests. Libraries, frameworks, etc., to speed up writing common functionality. A library tends to be an existing JavaScript or CSS file that provides ready-rolled functionality for you to make use of in your code. A framework tend to take this idea further, offering a complete system with some custom syntaxes for you to write a web app on top of. More tools besides! What tools do I actually need, right now? That looks like a scary list, but fortunately, you can get started in web development without knowing anything abou...
...es run into a project that requires support for it. ...
Publishing your website - Learn web development
whether you need to build a multi-tiered web application from scratch or host a static website. See How do you host your website on Google App Engine? for more information. These options are usually free, but you may outgrow the limited feature-set. Using a web-based IDE such as CodePen There are a number of web apps that emulate a website development environment, allowing you to enter HTML, CSS and JavaScript, and then display the result of that code as a website -- all in one browser tab. Generally speaking, these tools are relatively easy, great for learning, good for sharing code (for example, if you want to share a technique with or ask for debugging help from colleagues in a different office), and free (for basic features). They host your rendered page at a unique web address. Howe...
...n the web? ...
Define terms with HTML - Learn web development
descriptions. If two or more terms occur in a row, the following description applies to all of them. If two or more descriptions occur in a row, they all apply to the last given term. ...
...rms occur in a row, the following description applies to all of them. If two or more descriptions occur in a row, they all apply to the last given term. ...
Debugging HTML - Learn web development
This webpage takes an HTML document as an input, goes through it, and gives you a report to tell you what is wrong with your HTML. To specify the HTML to validate, you can provide a web address, upload an HTML file, or directly input some HTML code. Active learning: Validating an HTML document Let's try this with our sample document. First, load the Markup Val...
...t. Sometimes fixing an earlier error will also get rid of other error messages -- several errors can often be caused by a single problem, in a domino effect. You will know when all your errors are fixed when you see the following banner in your output: Summary So there we have it, an introduction to debugging HTML, which should give you some useful skills to count on when you start to debug CSS, JavaScript, and other types of code later on in your career. This also marks the end of the Introduction to HTML module learning articles -- now you can go on to testing yourself with our assessments: the first one is linked below. Previous Overview: Introduction to HTML Next In this module Getting started with HTML What's in the head? Metadata in HTML HTML text fundamentals Crea...
From object to iframe — other embedding technologies - Learn web development
set, the <iframe> is able to be placed in fullscreen mode using the Full Screen API (somewhat beyond scope for this article.) frameborder If set to 1, this tells the browser to draw a border between this frame and other frames, which is the default behaviour. 0 removes the border. Using this isn't really recommended any more, as the same effect can be better achieved using border: none; in your CSS. src This attribute, as with <video>/<img>, contains a path pointing to the URL of the document to be embedded. width and height These attributes specify the width and height you want the iframe to be. Fallback content In the same way as other similar elements like <video>, you can include fallback content between the opening and closing <iframe></iframe> tags that will appear if the browse...
...em in case you come across them in certain circumstances like intranets, or enterprise projects. ...
Video and audio content - Learn web development
ideo files are much larger than text or even images.) In the early days, native web technologies such as HTML didn't have the ability to embed video and audio on the Web, so proprietary (or plugin-based) technologies like Flash (and later, Silverlight) became popular for handling such content. This kind of technology worked ok, but it had a number of problems, including not working well with HTML/CSS features, security issues, and accessibility issues. A native solution would solve much of this if implemented correctly. Fortunately, a few years later the HTML5 specification had such features added, with the <video> and <audio> elements, and some shiny new JavaScript APIs for controlling them. We'll not be looking at JavaScript here -- just the basic foundations that can be achieved with HTML...
...ter="poster.png"> <source src="rabbit320.mp4" type="video/mp4"> <source src="rabbit320.webm" type="video/webm"> <p>Your browser doesn't support HTML video. Here is a <a href="rabbit320.mp4">link to the video</a> instead.</p> </video> The resulting UI looks something like this: The new features are: width and height You can control the video size either with these attributes or with CSS. In both cases, videos maintain their native width-height ratio -- known as the aspect ratio. If the aspect ratio is not maintained by the sizes you set, the video will grow to fill the space horizontally, and the unfilled space will just be given a solid background color by default. autoplay Makes the audio or video start playing right away, while the rest of the page is loading. You are advis...
Multimedia and Embedding - Learn web development
es which will take you through all the fundamentals of embedding multimedia on webpages. Images in HTML There are other types of multimedia to consider, but it is logical to start with the humble <img> element used to embed a simple image in a webpage. In this article we'll look at how to use it in more depth, including basics, annotating it with captions using <figure>, and how it relates to CSS background images. Video and audio content Next, we'll look at how to use the HTML5 <video> and <audio> elements to embed video and audio on our pages, including basics, providing access to different file formats to different browsers, adding captions and subtitles, and how to add fallbacks for older browsers. From <object> to <iframe> -- other embedding technologies At this point we'd like t...
... web pages. Responsive images In this article, we'll learn about the concept of responsive images -- images that work well on devices with widely differing screen sizes, resolutions, and other such features -- and look at what tools HTML provides to help implement them. This helps to improve performance across different devices. Responsive images are just one part of responsive design, a future CSS topic for you to learn. Assessments The following assessments will test your understanding of the HTML basics covered in the guides above: Mozilla splash page In this assessment, we'll test your knowledge of some of the techniques discussed in this module's articles, getting you to add some images and video to a funky splash page all about Mozilla! ...
Assessment: Structuring planet data - Learn web development
planets in our solar system, and get you to structure it into an HTML table. Prerequisites: Before attempting this assessment you should have already worked through all the articles in this module. Objective: To test comprehension of HTML tables and associated features. Starting point To start the assessment, make local copies of blank-template.html, minimal-table.css, and planets-data.txt in a new directory in your local computer. 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 separ...
...ata.txt in a new directory in your local computer. 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 ...
Introduction to events - Learn web development
ample, if the user selects a button on a webpage, you might want to respond to that action by displaying an information box. In this article, we discuss some important concepts surrounding events, and look at how they work in browsers. This won't be an exhaustive study; just what you need to know at this stage. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, JavaScript first steps. Objective: To understand the fundamental theory of events, how they work in browsers, and how events may differ in different programming environments. A series of fortunate events As mentioned above, events are actions or occurrences that happen in the system you are programming -- the system produces (or "fires") a signal of some kind when an event oc...
...ss="hidden"> <video> <source src="rabbit320.mp4" type="video/mp4"> <source src="rabbit320.webm" type="video/webm"> <p>Your browser doesn't support HTML5 video. Here is a <a href="rabbit320.mp4">link to the video</a> instead.</p> </video> </div> When the <button> is selected, the video is displayed, by changing the class attribute on the <div> from hidden to showing (the example's CSS contains these two classes, which position the box off the screen and on the screen, respectively): btn.onclick = function() { videoBox.setAttribute('class', 'showing'); } We then add a couple more onclick event handlers -- the first one to the <div> and the second one to the <video>. Now, when the area of the <div> outside the video is selected, the box should be hidden again and when the vi...
Third-party APIs - Learn web development
nd, are located 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(...
....nytimes.com/get-started. Let's request a key for the Article Search API -- create a new app, selecting this as the API you want to use (fill in a name and description, toggle the switch under the "Article Search API" to the on position, and then click "Create"). Get the API key from the resulting page. Now, to start the example off, make copies of nytimes_start.html and nytimes.css in a new directory on your computer. If you've already cloned the examples repository, you'll already have a copy of these files, which you can find in the javascript/apis/third-party-apis/nytimes directory. Initially the <script> element contains a number of variables needed for the setup of the example; below we'll fill in the required functionality. The app will end up allowing you to type...
Basic math in JavaScript — numbers and operators - Learn web development
Objective: To gain familiarity with the basics of math in JavaScript. Everybody loves math Okay, maybe not. ...
...ber of decimal places). We even have different types of number systems! Decimal is base 10 (meaning it uses 0-9 in each column), but we also have things like: Binary -- The lowest level language of computers; 0s and 1s. Octal -- Base 8, uses 0-7 in each column. Hexadecimal -- Base 16, uses 0-9 and then a-f in each column. You may have encountered these numbers before when setting colors in CSS. Before you start to get worried about your brain melting, stop right there! For a start, we are just going to stick to decimal numbers throughout this course; you'll rarely come across a need to start thinking about other types, if ever. The second bit of good news is that unlike some other programming languages, JavaScript only has one data type for numbers, both integers and decimals -- you...
Silly story generator - Learn web development
dule. 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, f...
...ld 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 to put it inline in a <script> element 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 raw HTML/CSS and a few text strings and JavaScript functions; you need to write the necessary JavaScript to turn this into a working program, which does the following: Generates a silly story when the "Generate random story" button is pressed. Replaces the default name "Bob" in the story with a custom name, only if a custom name is entered into the "Enter custom name" text field before the generate button...
Handling text — strings in JavaScript - Learn web development
t Next, we'll turn our attention to strings -- this is what pieces of text are called in programming. In this article, we'll look at all the common things that you really ought to know about strings when learning JavaScript, such as creating strings, escaping quotes in strings, and joining strings together. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, an understanding of what JavaScript is. Objective: To gain familiarity with the 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...
... To gain familiarity with the 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 w...
What went wrong? Troubleshooting JavaScript - Learn web development
iew: First steps Next When you built up the "Guess the number" game in the previous article, you may have found that it didn't work. Never fear -- this article aims to save you from tearing your hair out over such problems by providing you with some tips on how to find and fix errors in JavaScript programs. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, an understanding of what JavaScript is. Objective: To gain the ability and confidence to start fixing problems in your own code. Types of error Generally speaking, when you do something wrong in code, there are two main types of error that you'll come across: Syntax errors: These are spelling errors in your code that actually cause the program not to run at all, or stop wo...
...the console as soon as we have tried to set it in line 48. Save and refesh, and you should now see the console.log() result in your console. Sure enough, lowOrHi's value is null at this point, so there is definitely a problem with line 48. Let's think about what the problem could be. Line 48 is using a document.querySelector() method to get a reference to an element by selecting it with a CSS selector. Looking further up our file, we can find the paragraph in question: <p class="lowOrHi"></p> So we need a class selector here, which begins with a dot (.), but the selector being passed into the querySelector() method in line 48 has no dot. This could be the problem! Try changing lowOrHi to .lowOrHi in line 48. Try saving and refreshing again, and your console.log() statement shoul...
Adding features to our bouncing balls demo - Learn web development
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. Objective: To test comprehension of JavaScript objects and object-oriented constructs Starting point To get this assessment started, make a local copy of index-finished.html, style.css, and main-finished.js from our last article in a new directory in 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 separate JavaScript/CSS panels, feel free to put them inline <script>/<style> elements inside the HTML p...
... make it so that these functions are only called if the current ball exists. Call the evil ball instance's draw(), checkBounds(), and collisionDetect() methods on every iteration of the loop. Implementing the score counter To implement the score counter, follow the following steps: In your HTML file, add a <p> element just below the <h1> element containing the text "Ball count: ". In your CSS file, add the following rule at the bottom: p { position: absolute; margin: 0; top: 35px; right: 5px; color: #aaa; } In your JavaScript, make the following updates: Create a variable that stores a reference to the paragraph. Keep a count of the number of balls on screen in some way. Increment the count and display the updated number of balls each time a ball is added to...
Working with JSON - Learn web development
pplications (e.g., sending some data from the server to the client, so it can be displayed on a web page, or vice versa). You'll come across it quite often, so in this article we give you all you need to work with JSON using JavaScript, including parsing JSON so you can access data within it, and creating JSON. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, familiarity with JavaScript basics (see First steps and Building blocks) and OOJS basics (see Introduction to objects). Objective: To understand how to work with data stored in JSON, and create your own JSON objects. No, really, what is JSON? JSON is a text-based data format following JavaScript object syntax, which was popularized by Douglas Crockford. Even though it closely...
...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 header = ...
Object building practice - Learn web development
erview: Objects Next In previous articles we looked at all the essential JavaScript object theory and syntax details, giving you a solid base to start from. In this article we dive into a practical exercise, giving you some more practice in building custom JavaScript objects, with a fun and colorful result. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, familiarity with JavaScript basics (see First steps and Building blocks) and OOJS basics (see Introduction to objects). Objective: To get some practice with using objects and object-oriented techniques in a real world context. Let's bounce some balls In this article we will write a classic "bouncing balls" demo, to show you how useful objects can be in JavaScript. Our little ...
...se 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). 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). ...
Multimedia: Images - Learn web development
tion beyond 2x DPI, which means you don't need to serve images resolving higher than 2x. Controlling the priority (and ordering) of downloading images Getting the most important images in front of visitors sooner than the less important can deliver improved perceived performance. The first thing to check is that your content images use <img> elements and your background images are defined in CSS with background-image -- images referenced in <img> elements are assigned a higher loading priority than background images. Secondly, with the adoption of Priority Hints, you can control the priority further by adding an importance attribute to your image tags. An example use case for priority hints on images are carousels where the first image is a higher priority than the subsequent images. R...
...d slowing down page load. ...
What is web performance? - Learn web development
s the site to get to a usable start after it has started loading is called time to interactive. Smoothness and interactivity: Does the application feel reliable and pleasurable to use? Is the scrolling smooth? Are buttons clickable? Are pop-ups quick to open up, and do they animate smoothly as they do so? There are a lot of best practices to consider in making apps feel smooth, for example using CSS animations rather than JavaScript for animation, and minimizing the number of repaints the UI requires due to changes in the DOM. Perceived performance: How fast a website seems to the user has a greater impact on user experience than how fast the website actually is. How a user perceives your performance is as important, or perhaps more important, than any objective statistic, but it's subjecti...
... techniques to make some unavoidable performance hits appear less severe to the user, or disguise them completely. Previous Overview: Performance Next In this module The "why" of web performance What is web performance? How do users perceive performance? Measuring performance Multimedia: images Multimedia: video JavaScript performance best practices. HTML performance features CSS performance features Fonts and performance Mobile performance Focusing on performance ...
Learning area release notes - Learn web development
g the articles. April 2020 Our new Understanding client-side web development tools module has been released! Learn the essentials of web development tooling, including what kind of tools exist, the command line, package managers, and how to assemble your own functioning tool chain. ...
...ML topic area to recognise that it covers more than just HTML form elements -- it also covers styling, validation, the basics of how to send data and process it on the server, and more besides. It has new examples available and techniques covered. It has a new structure to make for a more effective learning experience. More "Test your skills" sections have been added. You can see these on: CSS layout: Flexbox CSS layout: Grids CSS layout: Floats December 2019 We are adding a new type of assessment article to the learning area -- "Test your skills" -- which will offer several short questions aimed at rapidly testing whether you understood what is going on. This is in addition to the longer Assessment articles that you'll find in some of the learning modules already. You will find t...
Introduction to the server side - Learn web development
(or sometimes "back-end scripting"). The diagram below shows a simple architecture for a dynamic website. As in the previous diagram, browsers send HTTP requests to the server, then the server processes the requests and returns appropriate HTTP responses. Requests for static resources are handled in the same way as for static sites (static resources are any files that don't change --typically: CSS, JavaScript, Images, pre-created PDF files etc). Requests for dynamic resources are instead forwarded (2) to server-side code (shown in the diagram as a Web Application). For "dynamic requests" the server interprets the request, reads required information from the database (3), combines the retrieved data with HTML templates (4), and sends back a response containing the generated HTML (5,6). ...
... layouts, navigation, form validation, etc. By contrast, server-side website programming mostly involves choosing which content is returned to the browser in response to requests. The server-side code handles tasks like validating submitted data and requests, using databases to store and retrieve data and sending the correct data to the client as required. Client-side code is written using HTML, CSS, and JavaScript -- it is run inside a web browser and has little or no access to the underlying operating system (including limited access to the file system). Web developers can't control what browser every user might be using to view a website -- browsers provide inconsistent levels of compatibility with client-side code features, and part of the challenge of client-side programming is handli...
Server-side web frameworks - Learn web development
ve database ORM. Database agnostic schema migrations. Robust background job processing. Real-time event broadcasting. Laravel is accessible, yet powerful, providing tools needed for large, robust applications. ASP.NET ASP.NET is an open source web framework developed by Microsoft for building modern web applications and services. With ASP.NET you can quickly create web sites based on HTML, CSS, and JavaScript, scale them for use by millions of users and easily add more complex capabilities like Web APIs, forms over data, or real time communications. One of the differentiators for ASP.NET is that it is built on the Common Language Runtime (CLR), allowing programmers to write ASP.NET code using any supported .NET language (C#, Visual Basic, etc.). Like many Microsoft products it benefit...
...nt, form validation, testing framework, static file server, CGI/PSGI detection, and first-class Unicode support. A full-stack HTTP and WebSocket client/server implementation with IPv6, TLS, SNI, IDNA, HTTP/SOCKS5 proxy, UNIX domain socket, Comet (long polling), keep-alive, connection pooling, timeout, cookie, multipart, and gzip compression support. JSON and HTML/XML parsers and generators with CSS selector support. Very clean, portable and object-oriented pure-Perl API with no hidden magic. Fresh code based upon years of experience, free and open-source. Spring Boot (Java) Spring Boot is one of a number of projects provided by Spring. It is a good starting point for doing server-side web development using Java. Although definitely not the only framework based on Java it is easy to us...
Ember Interactivity: Footer functionality, conditional rendering - Learn web development
do counter to update to show the correct number of todos still to complete, and correctly apply styling to completed todos (i.e. where the checkbox has been checked). We'll also wire up our "Clear completed" button. Along the way, we'll learn about using conditional rendering in our templates. 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. 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 continue our learning about components classes, start looking at conditional rendering, and wire up some of our footer functionality. ...
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
Ember interactivity: Events, classes and state - Learn web development
ome interactivity to our app, providing the ability to add and display new todo items. Along the way, we'll look at using events in Ember, creating component classes to contain JavaScript code to control interactive features, and setting up a service to keep track of the data state of our app. 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. 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 create component classes and use events to control interactivity, and keep track of app state using a service. Adding ...
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
Ember resources and troubleshooting - Learn web development
Previous Overview: Client-side JavaScript frameworks Next Our final Ember article provides you with a list of resources that you can use to go further in your learning, plus some useful troubleshooting and other information. 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. 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 provide further resource links and troubleshooting information. Further resources Ember.JS Guides Tutorial: Super Rentals Ember.JS API Documentation Ember.JS Discord...
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
Routing in Ember - Learn web development
Previous Overview: Client-side JavaScript frameworks Next In this article we learn about routing, or URL-based filtering as it is sometimes referred to. We'll use it to provide a unique URL for each of the three todo views -- "All", "Active", and "Completed". 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. 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 about implementing routing in Ember. URL-based filtering Ember comes with a routing system that has a tight integration with the browser URL.
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
Accessibility in React - Learn web development
Previous Overview: Client-side JavaScript frameworks Next In our final tutorial article, we'll focus on (pun intended) accessibility, including focus management in React, which can improve usability and reduce confusion for both keyboard-only and screenreader users. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Objective: To learn about implementing keyboard accessibility in React. Including keyboard users At this point, we've accomplished all of the features we set out to implement. A user can add a new task, check and uncheck tasks, delete tasks, or edit task names. And they can filter their task list by all, active, or completed tasks. Or, at least: they can do all o...
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
React interactivity: Events and state - Learn web development
ent plan worked out, it's now time to start updating our app from a completely static UI to one that actually allows us to interact and change things. In this article we'll do this, digging into events and state along the way, and ending up with an app in which we can successfully add and delete tasks, and toggle tasks as completed. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Objective: To learn about handling events and state in React, and use those to start making the case study app interactive. Handling events If you've only written vanilla JavaScript before now, you might be used to having a separate JavaScript file, where you query for some DOM nodes and attach listeners to...
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
React interactivity: Editing, filtering, conditional rendering - Learn web development
As we near the end of our React journey (for now at least), we'll add the finishing touches to the main areas of functionality in our Todo list app. This includes allowing you to edit existing tasks, and filtering the list of tasks between all, completed, and incomplete tasks. We'll look at conditional UI rendering along the way. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Objective: To learn about conditional rendering in React, and implementing list filtering and an editing UI in our app. Editing the name of a task We don't have a user interface for editing the name of a task yet. We'll get to that in a moment. To start with, we can at least implement an editTask() function...
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
and further componentize our app. We will learn how to deal with reactivity issues related to updating objects and arrays. To avoid common pitfalls, we'll have to dig a little deeper into Svelte's reactivity system. We'll also look at solving some accessibility focus issues, and more besides. 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. Objective: Learn some advanced Svelte techniques involving solving reactivity issues, keyboard accessibility problems to do with component lifecycle, and more. We'll focus on some accessibility issues involving focu...
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
Dynamic behavior in Svelte: working with variables and props - Learn web development
Next 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, 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. Objective: Learn and put into practice some basic Svelte concepts, like creating components, passing data using props, render JavaScript expressions into our markup, modify the components state and iterating over lists. ...
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
Using Vue computed properties - Learn web development
Previous Overview: Client-side JavaScript frameworks Next In this article we'll add a counter that displays the number of completed todo items, using a feature of Vue called computed properties. These work similarly to methods, but only re-run when one of their dependencies changes. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Vue components are written as a combination of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to the underlying DOM structure. For installation, and to use some of the more advanced features of Vue (like Single File Components or render functions), you'll need a terminal with node + npm installed. Objective: ...
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
Vue conditional rendering: editing existing todos - Learn web development
ssing -- the ability to edit existing todo items. To do this, we will take advantage of Vue's conditional rendering capabilities -- namely v-if and v-else -- to allow us to toggle between the existing todo item view, and an edit view where you can update todo item labels. We'll also look at adding functionality to delete todo items. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Vue components are written as a combination of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to the underlying DOM structure. For installation, and to use some of the more advanced features of Vue (like Single File Components or render functions), you'll need a terminal with node + ...
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
Creating our first Vue component - Learn web development
concepts such as calling components inside other components, passing data to them via props, and saving data state. Note: If you need to check your code against our version, you can find a finished version of the sample Vue app code in our todo-vue repository. For a running live version, see https://mdn.github.io/todo-vue/dist/. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Vue components are written as a combination of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to the underlying DOM structure. For installation, and to use some of the more advanced features of Vue (like Single File Components or render functions), you'll need a terminal with node + ...
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
Adding a new todo form: Vue events, methods, and models - Learn web development
What we really need next is the ability to allow our users to enter their own todo items into the app, and for that we'll need a text <input>, an event to fire when the data is submitted, a method to fire upon submission to add the data and rerender the list, and a model to control the data. This is what we'll cover in this article. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Vue components are written as a combination of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to the underlying DOM structure. For installation, and to use some of the more advanced features of Vue (like Single File Components or render functions), you'll need a terminal with node + ...
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
Focus management with Vue refs - Learn web development
focus management, or put another way, how we can improve our app's keyboard accessibility. We'll look at using Vue refs to handle this -- an advanced feature that allows you to have direct access to the underlying DOM nodes below the virtual DOM, or direct access from one component to the internal DOM structure of a child component. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Vue components are written as a combination of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to the underlying DOM structure. For installation, and to use some of the more advanced features of Vue (like Single File Components or render functions), you'll need a terminal with node + ...
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
Rendering a list of Vue components - Learn web development
ide JavaScript frameworks Next At this point we've got a fully working component; we're now ready to add multiple ToDoItem components to our App. In this artcle we'll look at adding a set of todo item data to our App.vue component, which we'll then loop through and display inside ToDoItem components using the v-for directive. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Vue components are written as a combination of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to the underlying DOM structure. For installation, and to use some of the more advanced features of Vue (like Single File Components or render functions), you'll need a terminal with node + ...
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
Vue resources - Learn web development
Previous Overview: Client-side JavaScript frameworks Next Now we'll round off our study of Vue by giving you a list of resources that you can use to go further in your learning, plus some other useful tips. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Vue components are written as a combination of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to the underlying DOM structure. For installation, and to use some of the more advanced features of Vue (like Single File Components or render functions), you'll need a terminal with node + npm installed. Objective: To learn where to go to find further information on Vue, to continue your le...
... componentization Ember interactivity: Events, classes and state Ember Interactivity: Footer functionality, conditional rendering Routing in Ember Ember resources and troubleshooting Vue Getting started with Vue Creating our first Vue component Rendering a list of Vue components Adding a new todo form: Vue events, methods, and models Styling Vue components with CSS Using Vue computed properties Vue conditional rendering: editing existing todos Focus management with Vue refs Vue resources Svelte Getting started with Svelte Starting our Svelte Todo list app Dynamic behavior in Svelte: working with variables and props Componentizing our Svelte app Advanced Svelte: Reactivity, lifecycle, accessibility Working with Svelte s...
Understanding client-side JavaScript frameworks - Learn web development
er depth yourself. We want you to go forward and learn about frameworks in a pragmatic way that doesn't forget about web platform fundamental best practices such as accessibility. Get started now, with "Introduction to client-side frameworks" Prerequisites You should really learn the basics of the core web languages first before attempting to move on to learning client-side frameworks -- HTML, CSS, and especially JavaScript. Your code will be richer and more professional as a result, and you'll be able to troubleshoot problems with more confidence if you understand the fundamental web platform features that the frameworks are building on top of. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work toward...
...t inside a ToDoItem in our app. What we really need next is the ability to allow our users to enter their own todo items into the app, and for that, we'll need a text <input>, an event to fire when the data is submitted, a method to fire upon submission to add the data and rerender the list, and a model to control the data. This is what we'll cover in this article. 5. Styling Vue components with CSS The time has finally come to make our app look a bit nicer. In this article, we'll explore the different ways of styling Vue components with CSS. 6. Using Vue computed properties In this article we'll add a counter that displays the number of completed todo items, using a feature of Vue called computed properties. These work similarly to methods but only re-run when one of their dependencies c...
Tools and testing - Learn web development
As your web projects become larger and more complex, you'll want to start taking advantage of some of these tools, working out a reliable toolchain to give your development process superpowers. ...
...they work and have good industry support. In most cases there are other tools available, old ones will go out of fashion, and new ones will no doubt appear. 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 really learn the basics of the core HTML, CSS, and JavaScript languages first before attempting to use many the tools detailed here. For example, you'll need to know the fundamentals of these languages before you start debugging problems in complex web code, making effective use of JavaScript frameworks, or writing tests and running them against your code using test runners. In addition, you should start with the first module in this topic,...
Accessibility API cross-reference
The little piece of help text that comes up when you put your mouse over something TOOLTIP TOOL_TIP TOOL_TIP tooltip A grid whose rows can be expanded and collapsed in the same manner as for a tree. n/a n/a treegrid If you're using more than one consecutive whitespace element in HTML, you're doing it wrong. (Use CSS instead). Screen readers often announce this as "blank" or similar, which is usually noise, rather than content. WHITESPACE FILLER FILLER n/a &nbsp; <br> An interactive component of a graphical user interface. n/a n/a widget (abstract role) A window WINDOW WINDOW WINDOW window (abstract role) ...
...ARIA permits this only with button role PRESSED PRESSED PRESSED aria-pressed=true For passwords PROTECTED n/a PASSWD_TEXT password role slated for ARIA 2.0 A portion of quoted content which is brief enough to appear 'inline'. (Compare with blockquote).
Accessibility Features in Firefox
s and sizes currently being used in your desktop. 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 t...
...anager in the Tools menu. Here are some examples 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 Ma...
MozBeforePaint
Usage outline In order to time your animation, the first thing you need to know is the time base; that is, the time at which your animation sequence started. You can determine this value by looking at window.mozAnimationStartTime. This new property indicates the time, in milliseconds since epoch, at which all animations started in the specified window during the current refresh interval should be considered to have started running. ...
... window.requestAnimationFrame() method. Once you've called this, the MozBeforePaint event will be fired one time, when it's time for animations to be updated for the window's next animation frame. The timeStamp property of this event will be set to the time when the animation frame is sampled; this is relevant when trying to synchronize mozRequestAnimationFrame animations with SMIL animations or CSS transitions. This allows multiple animations to remain in sync with one another within the context of a given window. Frame rate control MozBeforePaint won't fire more than a fixed number of times per second, e.g. 50 or 60. This 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, ...
Getting from Content to Layout
Gecko maintains two separate representations of a document in memory: the content tree and the frame tree. Changes to a document originate in the content tree (from DOM modification by scripting, insertion of elements from the parser, etc.) and are propogated to the layout tree through magic that primarily resides in //github.com/RealityRipple/UXP/blob/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. The frame constructor takes these notifications and does the following: Dispatches "restyle events" which trigger the reproces...
... 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. ...
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 View ...
...ew to the frame; invokes nsIFrame::Paint for each layer Incrementalism Single-threaded Simple (no locking) Can't leave event queue unattended Content construction unwinds "at will" Parser and content sink do some buffering Content sink has "notification limits" Efficiency vs. responsiveness trade-off Frame construction runs to completion CSS parsing runs to completion Reflow runs to completion (mostly) Painting runs to completion Future (?) Tech Talks Content model and DOM - jst, jkeiser Parser and content sink (esp. invalid content) - harishd Events - saari, joki Block-and-line reflow - waterson, dbaron Table reflow - karnaze Form controls - rods, bryner Style resolution and rule tree - dbaron Views, widgets, ...
source-editor.jsm
SIZE "devtools.editor.tabsize" 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 th...
...the breakpoints. tabSize Number A number indicating how many spaces each tab character should occupy. This default can be overridden by the user preference named by SourceEditor.PREFS.TAB_SIZE. theme String A string indicating the default syntax highlighting theme to use; you may use one of the predefined values listed in Theme constants, or you may provide your own CSS file reference. undoLimit Number A number indicating how many steps the undo stack should hold. See Configuration defaults constants for a list of the default values for these configuration options. Events There are a number of events that can be sent by the source editor, as listed in Event name constants. This section provides details on each of those events and their pr...
Basics
InvisibleTimes;</mo> <msup> <mi>x</mi> <mn>2</mn> </msup> <mo>&InvisibleTimes;</mo> <msup> <mi>y</mi> <mn>3</mn> </msup> </mrow> <mo>+</mo> <mrow> <mn>5</mn> <mo>&InvisibleTimes;</mo> <mi>x</mi> <mo>&InvisibleTimes;</mo> <msup> <mi>y</mi> <mn>4</mn> </msup> </mrow> <mo>+</mo> <msup> <mi>y</mi> <mn>5</mn> </msup> </mrow> </maction> </mtd> </mtr> </mtable> </mtd> </mtr> </mtable> </math> </div> CSS Content .control { text-decoration: none; font-weight: bold; font-size: 200%; } input { color: red; } [class="inputmath"] { border: 1px dotted; } JavaScript Content function setSelection(id,value) { document.getElementById(id).setAttribute("selection",value); } function expand() { setSelection("a11","2"); setSelection("a12","2"); setSelection("a13","2"); setSelection("a21","2"); set...
...;</mo> <mi>C</mi> </msub> <mfrac> <mrow> <mi>f</mi> <mo stretchy='false'>(</mo> <mi>i</mi> <mi>z</mi> <mo stretchy='false'>)</mo> <msup> <mrow> <mo>(</mo> <mo>-</mo> <mi>z</mi> <mo>)</mo> </mrow> <mi>&alpha;</mi> </msup> </mrow> <mrow> <msup> <mi>e</mi> <mrow> <mn>2</mn> <mi>&pi;</mi> <mi>z</mi> </mrow> </msup> <mo>-</mo> <mn>1</mn> </mrow> </mfrac> </mrow> <mi>d</mi> <mi>z</mi> </mrow> </math> CSS Content [class="background"] { background-image: url(http://www.mozilla.org/images/mozilla-banner.gif); opacity: 0.2; position: absolute; left: 0; width: 100%; height: 58px; } ...
Extras
For example with the style rule: <code style="white-space: nowrap;">*[title] { color: blue; }</code> <math class="cue" display="block"> <mrow> <mrow> <msub title="Base-a log"> <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...
...tle] { color: blue; }</code> <math class="cue" display="block"> <mrow> <mrow> <msub title="Base-a log"> <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> </p> CSS Content math.cue *[title] { color: blue; } Mixing with other markups HTML Content <math display="block"> <mrow> <mi>A</mi> <mo>=</mo> <mo>[</mo> <mtable> <mtr> <mtd><mn>1</mn></mtd> <mtd> <mtext> <img width="16" height="16" src="https://udn.realityripple.com/samples/3f/9341cbddc0.png" alt="mozilla-16" /> </mtext> </mtd> </mtr> <mtr> <mtd> <mtext><input value="type" size="4"/></mtext> </m...
Fonts for Mozilla's MathML engine
ic Mathematical 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...
...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. ...
NSS 3.15.3.1 release notes
ewer. NSS 3.15.3.1 source distributions are also available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_15_3_1_RTM/src/ Security Advisories The following security-relevant bugs have been resolved in NSS 3.15.3.1. Users are encouraged to upgrade immediately. ...
...to upgrade immediately. Bug 946351 - Misissued Google certificates from DCSSI New in NSS 3.15.3.1 New Functionality No new major functionality is introduced in this release. This is a patch release to revoke trust of a subordinate CA certificate that was mis-used to generate a certificate used by a network appliance. Bugs fixed in NSS 3.15.3.1 Bug 946351 - Misissued Google certificates from DCSSI A complete list of all bugs resolved in this release can be obtained at https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&classification=Components&query_format=advanced&target_milestone=3.15.3.1&product=NSS Compatibility NSS 3.15.3.1 shared libraries are backward compatible with all older NSS 3.x shared libraries. A program linked with older NSS 3.x shared libraries will work with NSS...
WebReplayRoadmap
will update the console whenever the log point's location executes in the future. In a recording tab, however, this will update the console with messages for every time the location has ever been hit. This requires scanning the recording and the console will not update immediately. These messages will show up on the timeline and can be seeked to in the same way as other console messages. DOM/CSS Integration (partially implemented) When paused, the Inspector panel can be used to inspect the DOM and CSS state of the page. New features are possible with time travel, though, which would be nice to support: Supporting the debugger's event breakpoints would allow searching the recording for places where particular DOM events occur, and -- in the same manner as logpoints -- logging them to...
...ints would allow searching the recording for places where particular DOM events occur, and -- in the same manner as logpoints -- logging them to the console and allowing them to be seeked to later. Similarly, when the debugger supports DOM mutation breakpoints (bug 1547692), the recording can be searched for DOM mutations, and mutations can be logged to the console and seeked to later. Allowing CSS to be changed while paused somewhere in the recording and update graphics with the effects of those changes. Object Watching (not yet implemented) It would be nice to log the changes to a specific object or one of its properties, so that the points of those changes can be seeked to later. Bookmarks (not yet implemented) It would be nice to be able to bookmark points in the recording so that ...
Secure Development Guidelines
ialize your variables! ...
...(p == NULL) { /* handle error */ } Memory Leaks: Prevention Tools like Valgrind can help detect memory leaks Writing Secure Code: Object Management Reference Counting Issues Real-life example (bug 440230) void AddRef() { ++mRefCnt; NS_LOG_ADDREF(this, mRefCnt, "nsCSSValue::Array", sizeof(*this)); } void Release() { --mRefCnt; NS_LOG_RELEASE(this, mRefCnt, "nsCSSValue::Array"); if (mRefCnt == 0) delete this; } Reference Counting Issues: Prevention Use the largest data type available on your platform for your reference counter Use a hard limit Constructor/Destructor Issues If a constructor fails the destructor never gets called This can lead to memory leaks Constructor/Destructor Issues Example class foo { private: ...
nsIBoxObject
moveProperty(in wstring propertyName); void setProperty(in wstring propertyName, in wstring propertyValue); void setPropertyAsSupports(in wstring propertyName, in nsISupports value); Attributes Attribute Type Description element nsIDOMElement Read only. firstChild nsIDOMElement The first child of the box, in box-ordinal-group order. Read only. height long The height of the box, in CSS pixels. Read only. lastChild nsIDOMElement The last child of the box, in box-ordinal-group order. Read only. layoutManager nsIBoxLayoutManager Obsolete since Gecko 1.9 nextSibling nsIDOMElement The next sibling of the box, in box-ordinal-group order. Read only. paintManager nsIBoxPaintManager Obsolete since Gecko 1.9 parentBox nsIDOMElement The parent of the box, in box-ordinal-group or...
... of the box, in box-ordinal-group order. Read only. previousSibling nsIDOMElement The previous sibling of the box, in box-ordinal-group order. Read only. screenX long The x coordinate of the box relative to the screen origin, in device pixels. Read only. screenY long The y coordinate of the box relative to the screen origin, in device pixels. Read only. width long The width of the box, in CSS pixels. Read only. x long The x coordinate of the box, in CSS pixels. Read only. y long The y coordinate of the box, in CSS pixels. Read only. Methods getLookAndFeelMetric() Obsolete since Gecko 1.9 (Firefox 3) wstring getLookAndFeelMetric( in wstring propertyName ); Parameters propertyName Return value getProperty() wstring getProperty( in wstring proper...
nsIChromeRegistry
ome URL into a canonical representation by ensuring that the filename portion of the URL is included, as in chrome://package/provider/file. This is useful because chrome URLs are allowed to be specified in "shorthand", leaving the "file" portion off. In that case, the URL is expanded to chrome://package/provider/package.ext. The extension, ext, is one of: xul For a "content" package. css For a "skin" package. dtd For a "locale" package. void canonify( in nsIURI aChromeURL ); Parameters aChromeURL The URL that is to be canonified. checkForNewChrome() Refreshes the chrome list at runtime, looking for new packages and so forth. void checkForNewChrome(); Parameters None. convertChromeURL() Resolves a chrome URL to an loadable URI using the information in ...
...eft unmodified. This lets you take a non-canonical chrome URI, such as chrome://package/provider/file, and convert it into a canonical one. This is useful because chrome URLs are allowed to be specified in "shorthand", leaving the "file" portion off. In that case, the URL is expanded to chrome://package/provider/package.ext. The extension, ext, is one of: xul For a "content" package. css For a "skin" package. dtd For a "locale" package. nsIURI convertChromeURL( in nsIURI aChromeURL ); Parameters aChromeURL The URL that is to be converted. Return value A new nsIURI object containing the loadable URI for the specified chrome URL. Violates the XPCOM interface guidelines wrappersEnabled() Returns whether XPCNativeWrappers are enabled for the specifi...
nsIDOMFontFace
Indicates whether or not the font was located in a font group. Read only. fromLanguagePrefs boolean Indicates whether or not the font was located using language preferences. Read only. fromSystemFallback boolean Indicates whether or not the font is the system fallback font. Read only. Attributes available for all fonts These attributes are always available. Attribute Type Description CSSFamilyName DOMString A family name that could be used in CSS font-family (not necessarily the actual name that was used, due to aliases, generics, localized names, and so on). Read only. name DOMString Full font name as obtained from the font resource. Read only. Attributes only available when specified with @font-face These attributes only have meaningful values when the font is a user font ...
.... Read only. Attributes only available when specified with @font-face These attributes only have meaningful values when the font is a user font defined using @font-face. Attribute Type Description format DOMString The font format. Read only. localName DOMString null if not a src:local(...) rule. Read only. metadata DOMString XML metadata from WOFF file(if any). Read only. rule nsIDOMCSSFontFaceRule null if no associated @font-face rule. Read only. srcIndex long Index in the rule's src list, -1 if no @font-face rule. Read only. URI DOMString null if not a downloaded font, that is local. Read only. See also nsIDOMFontFaceList ...
nsIDOMWindow
iginates 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. ...
...aScript. 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 The nsISelection object for the window. scrollBy() Scroll...
nsIScriptError
t error). As Addon author I would recommend using "chrome javascript" for logging exceptions caused by addon code. ...
...ddon author I would recommend using "chrome javascript" for logging exceptions caused by addon code. ...
XUL Overlays
Mozilla › Tech › XUL › Overlays
-based applications also support loading overlays on-the-fly via the document.loadOverlay() function. TODO: elaborate Overlays and skins Warning: Always load master skins from base files. Never load master skins from overlays. 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 unfortunat...
...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 bookmarks.css, and is located in the skin/default subdirectory. Overlaying attributes In addition to new elements and subtrees, you can also overlay attributes into existing elements. In XUL, attributes control important features of the skin like image sources, as in the following example, ...
Tips and Tricks from the newsgroups
Load an extension in its own tab Run shell scripts from an extension (for example, to create a symlink) Get extension metadata Call Java from Thunderbird extensions (also an example here, written for Firefox but compatible with Thunderbird 3.x) Define a custom protocol handler to call an external program Save Attachment and send it Repeat image display using CSS sprites Messages Use ReminderFox to open a message in the default Thunderbird message window (when messageUri, folderUri and gDBView are unknown) Determine whether a message has been flagged as junk IMAP: Getting message key of copied message by nsIMsgCopyService::CopyFileMessage Access the plain text content of the email body Get information about attachment without selecting message...
...inderFox to open a message in the default Thunderbird message window (when messageUri, folderUri and gDBView are unknown) Determine whether a message has been flagged as junk IMAP: Getting message key of copied message by nsIMsgCopyService::CopyFileMessage Access the plain text content of the email body Get information about attachment without selecting message Repeat image display using CSS sprites Scan for new messages at startup and manually scan a folder initiated by user Force listeners to run consecutively to prevent POP messages from getting garbled during message retrieval ...
Using popup notifications
} }, null /* secondary action */ ); In this case, we aren't providing any secondary actions; that 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. ...
...ur 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. ...
DOM Inspector internals - Firefox Developer Tools
lset and panels function like a frameset and frames. This comparison turns out to be quite apt, since each panel actually contains an anonymous browser, and individual viewers exist in separate documents loaded in the browser. This separation allows for viewers to be self-contained, with a viewer's XUL defined in its own document and loaded in its own scope, without fear of collisions in the XUL, CSS, or JS. Another convenient consequence of this is that if you use a properly set up development profile, then for the most part, the effects of development changes can be seen by simply switching away from the current viewer and back. Knowing this about the way viewers are written, we should now be at a place where we can look at the way the DOM Inspector source is organized. Source code organi...
...in install.rdf jar.mn Makefile.in makefiles.sh Almost all the interesting stuff is in resources/content/. Its contents should resemble the following: extensions/ ... jsutil/ ... prefs/ ... res/ ... tests/ ... viewers/ ... ...
Introduction to DOM Inspector - Firefox Developer Tools
ke the "search-go-button" node, you can select any one of several viewers to display information about that node in the object pane of the DOM Inspector application window, all of which are available 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 fo...
...f text nodes, comments, and processing instructions. The attributes and text contents may also be edited. The Box Model 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 Ob...
Browser Console - Firefox Developer Tools
However, rather than logging this information for a single content tab, it logs information for all content tabs, for add-ons, and for the browser's own code. ...
...from scripts in all the opened pages) by setting or clearing the checkbox labeled Show Content Messages. The following image shows the browser console focused on the same page as above after clicking on the Show Content Messages checkbox. Browser Console logging The Browser console logs the same sorts of messages as the Web Console: HTTP requests Warnings and errors (including JavaScript, CSS, security warnings and errors, and messages explicitly logged by JavaScript code using the console API). Input/output messages: commands send to the browser via the command line, and the result of executing them. However, it displays such messages from: web content hosted by all browser tabs the browser's own code add-ons. Messages from add-ons The Browser Console displays messages log...
Network request list - Firefox Developer Tools
block URLs from the Web Console, using the :block and :unblock helper commands. These accept any string, and affect any URL containing the string. Filtering requests You can filter requests by content type, by whether they are XMLHttpRequests or WebSocket requests, or by request properties. Filter type How to apply Content type Use the buttons in the toolbar (HTML, CSS, JS). XHR requests Use the XHR button in the toolbar. WebSocket connections Use the WS button in the toolbar. You can filter by plain text (in which case the text is used to find partial matches; entering "for" will match any message that contains the word "for") or--as of Firefox 75--using regular expressions (by writing the regexp bracketed within slashes; "/.+Corp.*/" w...
...it 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-binary For multi...
Select an element - Firefox Developer Tools
The selected element is the element in the page that the Inspector is currently focused on. The selected element is shown in the HTML pane and its CSS is displayed in the CSS pane. The highlighted element is the element that's overlaid in the page with a graphic showing the box model, and a tooltip showing its tag and size: With the context menu To open the Inspector and select an element immediately, activate the context menu over the element in the page and select "Inspect Element": With the HTML pane When the inspector is open, as you move the mouse around the elements listed in the HTML pane, the corresponding elements are highlighted in the page. Click an element in the HTML pane to select it: You can also use the arrow keys to move around the DOM with the keyboard. ...
... ...
Paint Flashing Tool - Firefox Developer Tools
for example, the user moving the mouse or scrolling. With the help of this tool you can figure out whether your website is causing the browser to repaint more than it needs to. Because repaints can be performance-intensive operations, eliminating unnecessary repaints can improve your website's responsiveness. Repaints and responsiveness When the browser renders a web page it parses the HTML 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. ...
...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. The example below shows two different ways to move an element using a CSS transition. The first way applies the transition to the element's margin-left, while the second way moves the element using the transform property. <body> <div id="container"> <div class="moving-box" id="moving...
Firefox Developer Tools
This section contains detailed guides to all of the tools as well as information on how to debug Firefox for Android, how to extend DevTools, and how to debug the browser as a whole. If you have any feedback on DevTools, or want to contribute to the project, you can join the DevTools community. Note: If you are just getting started with web development and using developer tools, our learning docs will help you -- see Getting started with the Web and What are browser developer tools? for good starting points. ...
...lso 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 Connecting the Developer Tools ...
AnimationEvent() - Web APIs
pseudoElement: aPseudoElementName}); Parameters The AnimationEvent() constructor also inherits arguments from Event(). type A DOMString representing the name of the type of the AnimationEvent. It is case-sensitive and can be: 'animationstart', 'animationend', or 'animationiteration'. animationName Optional A DOMString containing the value of the animation-name CSS property associated with the transition. It defaults to "". elapsedTime Optional A float giving the amount of time the animation has been running, in seconds, when this event fired, excluding any time the animation was paused. For an "animationstart" event, elapsedTime is 0.0 unless there was a negative value for animation-delay, in which case the event will be fired with elapsedTime containing...
... Working Draft Initial definition. ...
Background Tasks API - Web APIs
and cancelIdleCallback() methods. Example In this example, we'll take a look at how you can use requestIdleCallback() to run time-consuming, low-priority tasks during time the browser would otherwise be idle. In addition, this example demonstrates how to schedule updates to the document content using requestAnimationFrame(). Below you'll find only the HTML and JavaScript for this example. The CSS is not shown, since it's not particularly crucial to understanding this functionality. HTML content In order to be oriented about what we're trying to accomplish, let's have a look at the HTML. This establishes a box (ID "Container") that's used to present the progress of an operation (because you never know how long decoding "quantum filament tachyon emissions" will take, after all) as well as...
... <div class="logBox"> <div class="logHeader"> Log </div> <div id="log"> </div> </div> The progress box uses a <progress> element to show the progress, along with a label with sections that are changed to present numeric information about the progress. In addition, there's a "Start" button (creatively given the ID "startButton"), which the user will use to start the data processing. ...
Managing screen orientation - Web APIs
is something slightly different than device orientation. Even if a device doesn't have the capacity to detect its own orientation, a screen always has one. And if a device is able to know its orientation, it's good to have the ability to control the screen orientation in order to preserve or adapt the interface of a web application. There are several ways to handle screen orientation, both with CSS and JavaScript. The first is the orientation media query. This lets content adjust its layout using CSS, based on whether the browser window is in landscape mode (that is, its width is greater than its height) or portrait mode (its height is greater than its width). The second way is the JavaScript Screen orientation API that can be used to get the current orientation of the screen itself and ev...
...example with the following HTML code <ul id="toolbar"> <li>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. ...
CanvasRenderingContext2D.drawWindow() - Web APIs
(window, x, y, w, h, bgColor [, flags]); Parameters window The Window to render. x The x-axis coordinate of the window. y The y-axis coordinate of the window. w The width of the window. h The height of the window. bgColor A DOMString that specifies the color the canvas is filled with before the window is rendered into it. This color may be transparent/translucent. It is given as a CSS color string (for example, rgb() or rgba()). Notes: If "rgba(0,0,0,0)" is used for the background color, the drawing will be transparent wherever the window is transparent. Top-level browsed documents are usually not transparent because the user's background-color preference is applied, but iframes are transparent if the page doesn't set a background. If an opaque color is used for the b...
...s would 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. ...
Basic usage of canvas - Web APIs
the <img> element, with the only clear difference being that it doesn't have the src and alt attributes. Indeed, the <canvas> element has only two attributes, width and height. These are both optional and can also be set using DOM properties. When no width and height attributes are specified, the canvas will initially be 300 pixels wide and 150 pixels high. The element can be sized arbitrarily by CSS, but during rendering the image is scaled to fit its layout size: if the CSS sizing doesn't respect the ratio of the initial canvas, it will appear distorted. Note: If your renderings seem distorted, try specifying 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 att...
...ide 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 using window.se...
Drawing text - Web APIs
anvas" 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 alphabetic. direction = value Directionality. Possible values: ltr, rtl, inhe...
...e 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 alphabetic. direction = value Directionality. Possible values: ltr, rtl, inherit. The default value is inherit. These properties might be familiar to you, if you have worked with CSS before. The following diagram from the WHATWG demonstrates the various baselines supported by the textBaseline property. A textBaseline example Edit the code below and see your changes update live in the canvas: ctx.font = '48px serif'; ctx.textBaseline = 'hanging'; ctx.strokeText('Hello world', 0, 100); Playable code <canvas id="canvas" width="400" height="200" class="playable-canvas"></...
Optimizing canvas - Web APIs
The best case is to not scale the canvas, or have a ...
...vas> </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 canvas, or have a smaller canvas and scale up rather than a bigger canvas and scale down. var scaleX = window.innerWidth / canvas.width; var s...
DOMMatrixReadOnly - Web APIs
g-point numbers in column-major (colexographical access access or "colex") order. (In other words, down the first column from top to bottom, then the second column, and so forth.) DOMMatrixReadOnly.toJSON() Returns a JSON representation of the DOMMatrixReadOnly object. DOMMatrixReadOnly.toString() Creates and returns a DOMString object which contains a string representation of the matrix in CSS matrix syntax, using the appropriate CSS matrix notation. See the matrix() CSS function for details on this syntax. For a 2D matrix, the elements a through f are listed, for a total of six values and the form matrix(a, b, c, d, e, f). For a 3D matrix, the returned string contains all 16 elements and takes the form matrix3d(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42,...
... Throws an InvalidStateError exception if any of the elements in the matrix are non-finite (even if, in the case of a 2D matrix, the non-finite values are in elements not used by the 2D matrix representation). ...
Document: animationcancel event - Web APIs
Therefore, either directly or because any of its containing nodes are hidden. Bubbles Yes Cancelable No Interface AnimationEvent Event handler property onanimationcancel The original target for this event is the Element that had the animation applied. You can listen for this event on the Document interface to handle it in the capture or bubbling phases. ...
...ener to the animationcancel event. ...
Document: animationend event - Web APIs
If the animation aborts before reaching completion, such as if the element is removed from the DOM or the animation is removed from the element, the animationend event is not fired. Bubbles Yes Cancelable No Interface AnimationEvent Event handler property onanimationend The original target for this event is the Element that had the animation applied. You can listen for this event on the Document interface to handle it in the capture or bubbling phases. For full details on this event please see the page on HTMLElement: animationend. ...
...nend. ...
Document: animationiteration event - Web APIs
This event does not occur at the same time as the animationend event, and therefore does not occur for animations with an animation-iteration-count of one. Bubbles Yes Cancelable No Interface AnimationEvent Event handler property onanimationiteration The original target for this event is the Element that had the animation applied. You can listen for this event on the Document interface to handle it in the capture or bubbling phases. For full details on this event please see the page on HTMLElement: animationiteration. ...
...; console.log(`Animation iteration count: ${iterationCount}`); }); The same, but using the onanimationiteration event handler property: let iterationCount = 0; document.onanimationiteration = () => { iterationCount++; console.log(`Animation iteration count: ${iterationCount}`); }; See a live example of this event. Specifications Specification Status Comment CSS Animations Working Draft Initial definition ...
Document: animationstart event - Web APIs
If there is an animation-delay, this event will fire once the delay period has expired. A negative delay will cause the event to fire with an elapsedTime equal to the absolute value of the delay (and, correspondingly, the animation will begin playing at that time index into the sequence). Bubbles Yes Cancelable No Interface AnimationEvent Event handler property onanimationstart The original target for this event is the Element that had the animation applied. You can listen for this event on the Document interface to handle it in the capture or bubbling phases. ...
... This listens for the animationstart event and logs a message when it is fired: document.addEventListener('animationstart', () => { console.log('Animation started'); }); The same, but using onanimationstart: document.onanimationstart = () => { console.log('Animation started'); }; See a live example of this event. Specifications Specification Status Comment CSS Animations Working Draft Initial definition ...
Document.fonts - Web APIs
Web › API › Document › fonts
document. The FontFaceSet interface is useful for loading new fonts, checking the status of previously loaded fonts etc. Examples Doing operation after all fonts are loaded document.fonts.ready.then(function() { // Any operation that needs to be done only after all the fonts // have finished loading can go here. }); Specifications Specification Status Comment CSS Font Loading Module Level 3The definition of 'FontFaceSet' in that specification. Working Draft 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://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet Explore...
...To change preferences in Firefox, visit about:config.IE No support NoOpera Full support 47Safari Full support 10WebView Android Full support 60Chrome Androi...
Document.querySelectorAll() - Web APIs
ns a static (not live) NodeList representing a list of the document's elements that match the specified group of selectors. Note: This method is implemented based on the ParentNode mixin's querySelectorAll() method. Syntax elementList = parentNode.querySelectorAll(selectors); Parameters selectors A DOMString containing one or more selectors to match against. This string must be a valid CSS selector string; if it's not, a SyntaxError exception is thrown. See Locating DOM elements using selectors for more information about using selectors to identify elements. Multiple selectors may be specified by separating them using commas. Note: Characters which are not part of standard CSS syntax must be escaped using a backslash character. Since JavaScript also uses backslash escaping, spec...
...JavaScript also uses backslash escaping, special care must be taken when writing string literals using these characters. See Escaping special characters for more information. Return value A non-live NodeList containing one Element object for each element that matches at least one of the specified selectors or an empty NodeList in case of no matches. Note: If the specified selectors include a CSS pseudo-element, the returned list is always empty. Exceptions SyntaxError The syntax of the specified selectors string is not valid. Examples Obtaining a list of matches To obtain a NodeList of all of the <p> elements in the document: var matches = document.querySelectorAll("p"); This example returns a list of all <div> elements within the document with a class of either note or alert...
Document: transitioncancel event - Web APIs
See GlobalEventHandlers.ontransitioncancel for more information. Bubbles Yes Cancelable No Interface TransitionEvent Event handler property GlobalEventHandlers.ontransitioncancel The original target for this event is the Element that had the transition applied. You can listen for this event on the Document interface to handle it in the capture or bubbling phases. For full details on this event please see the page on HTMLElement: transitioncancel. ...
... Working Draft Initial definition. ...
Document: transitionend event - Web APIs
In the case where a transition is removed before completion, such as if the transition-property is removed or display is set to none, then the event will not be generated. Bubbles Yes Cancelable Yes Interface TransitionEvent Event handler property ontransitionend The transitionend event is fired in both directions - as it finishes transitioning to the transitioned state, and when it fully reverts to the default or non-transitioned state. If there is no transition delay or duration, if both are 0s or neither is declared, there is no transition, and none of the transition events are fired. ...
... Working Draft Initial definition. ...
Document: transitionrun event - Web APIs
before any transition-delay has begun. Bubbles Yes Cancelable No Interface TransitionEvent Event handler property ontransitionrun The original target for this event is the Element that had the transition applied. You can listen for this event on the Document interface to handle it in the capture or bubbling phases. For full details on this event please see the page on HTMLElement: transitionrun. ...
... Working Draft Initial definition. ...
Document: transitionstart event - Web APIs
The difference is transitionstart and transitionrun is that transitionrun fires when the transition is created (i.e. at the start of any delay) and transitionstart fires when the actual animation has begun (i.e. at the end of any delay). Bubbles Yes Cancelable No Interface TransitionEvent Event handler property GlobalEventHandlers.ontransitionstart The original target for this event is the Element that had the transition applied. You can listen for this event on the Document interface to handle it in the capture or bubbling phases. ...
... Working Draft Initial definition. ...
DocumentOrShadowRoot.caretPositionFromPoint() - Web APIs
Working Draft Initial definition. ...
... Working Draft Initial definition. ...
DocumentOrShadowRoot.elementFromPoint() - Web APIs
Working Draft ...
... Working Draft ...
DocumentOrShadowRoot.elementsFromPoint() - Web APIs
Working Draft ...
... Working Draft ...
Locating DOM elements using selectors - Web APIs
You may find examples and details by reading the documentation for the Element.querySelector() and Element.querySelectorAll() methods, as well as in the article Code snippets for querySelector. Selectors The selector methods accept one or more comma-separated selectors to determine what element or elements should be returned. ...
... in a document whose CSS class is either warning or note, you can do the following: var special = document.querySelectorAll( "p.warning, p.note" ); You can also query by ID. For example: var el = document.querySelector( "#main, #basic, #exclamation" ); After executing the above code, el contains the first element in the document whose ID is one of main, basic, or exclamation. You may use any CSS selectors with the querySelector() and querySelectorAll() methods. ...
Document Object Model (DOM) - Web APIs
nt containing 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 SVG...
...Enumeration SVGAnimatedInteger SVGAnimatedLength SVGAnimatedLengthList SVGAnimatedNumber SVGAnimatedNumberList SVGAnimatedPathData SVGAnimatedPoints SVGAnimatedPreserveAspectRatio SVGAnimatedRect SVGAnimatedString SVGAnimatedTransformList SMIL-related interfaces ElementTimeControl TimeEvent Other SVG interfaces GetSVGDocument ShadowAnimation SVGColorProfileRule SVGCSSRule SVGDocument SVGException SVGExternalResourcesRequired SVGFitToViewBox SVGLangSpace SVGLocatable SVGRenderingIntent SVGStylable SVGTests SVGTransformable SVGUnitTypes SVGUseElementShadowRoot SVGURIReference SVGViewSpec SVGZoomAndPan SVGZoomEvent Specifications Specification Status Comment DOM 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) DOMTokenListProto.item = f...
...ototype, freezing the visible object, and overwritting native property methods. However, such actions would not work in IE6-IE8 and, in IE9, slow the performance of the entire webpage to a snail's crawl, making these modifications completely impractical for this polyfill. A minor note is that in IE6-7, this polyfill uses the window[" uCL"] property on the window object for communicating with the CSS expressions, the x-uCLp css property on all elements, and the element[" uCL"] property on all elements to allow garbage collection and boost performance. In all polyfilled browsers (IE6-9), an additional element[" uCLp"] property is added to element to ensure standards compliant prototyping, and a DOMTokenList[" uCL"] property is added to each element["classList"] object to ensure that the DOMTok...
Element.clientHeight - Web APIs
When clientHeight is used on the root element (the <html> element), (or on <body> if the document is in quirks mode), the viewport's height (excluding any scrollbar) is returned. This is a special case of clientHeight. Note: This property will round the value to an integer. If you need a fractional value, use element.getBoundingClientRect(). ...
... Note: This property will round the value to an integer. If you need a fractional value, use element.getBoundingClientRect(). Syntax var intElemClientHeight = element.clientHeight; intElemClientHeight is an integer corresponding to the clientHeight of element in pixels. The clientHeight property is read-only. Example Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'clientHeight' in that specification. Working Draft Notes clientHeight is a property introduced in the Internet Explorer object model. ...
Element.clientWidth - Web APIs
It includes padding but excludes borders, margins, and vertical scrollbars (if present). When clientWidth is used on the root element (the <html> element), (or on <body> if the document is in quirks mode), the viewport's width (excluding any scrollbar) is returned. This is a special case of clientWidth. Note: This property will round the value to an integer. If you need a fractional value, use element.getBoundingClientRect(). ...
...dth. Note: This property will round the value to an integer. If you need a fractional value, use element.getBoundingClientRect(). Syntax var intElemClientWidth = element.clientWidth; intElemClientWidth is an integer corresponding to the clientWidth of element in pixels. The clientWidth property is read-only. Example Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'clientWidth' in that specification. Working Draft Notes clientWidth was first introduced in the MS IE DHTML object model. ...
Element: mouseenter event - Web APIs
is canceled by a handler or reaches the root. With deep hierarchies, the number of mouseenter events sent can be quite huge and cause significant performance problems. In such cases, it is better to listen for mouseover events. Combined with the corresponding mouseleave (which is fired at the element when the mouse exits its content area), the mouseenter event acts in a very similar way to the CSS :hover pseudo-class. Examples The mouseover documentation has an example illustrating the difference between mouseover and mouseenter. mouseenter The following trivial example uses the mouseenter event to change the border on the div when the mouse enters the space alloted to it. It then adds an item to the list with the number of the mouseenter or mouseleave event. HTML <div id='mouseTarge...
...ample illustrating the difference between mouseover and mouseenter. mouseenter The following trivial example uses the mouseenter event to change the border on the div when the mouse enters the space alloted to it. It then adds an item to the list with the number of the mouseenter or mouseleave event. HTML <div id='mouseTarget'> <ul id="unorderedList"> <li>No events yet!</li> </ul> </div> CSS Styling the div to make it more visible. #mouseTarget { box-sizing: border-box; width:15rem; border:1px solid #333; } JavaScript var enterEventCount = 0; var leaveEventCount = 0; const mouseTarget = document.getElementById('mouseTarget'); const unorderedList = document.getElementById('unorderedList'); mouseTarget.addEventListener('mouseenter', e => { mouseTarget.style.border = '5px d...
Element.querySelector() - Web APIs
The querySelector() method of the Element interface returns the first element that is a descendant of the element on which it is invoked that matches the specified group of selectors. Syntax element = baseElement.querySelector(selectors); Parameters selectors A group of selectors to match the descendant elements of the Element baseElement against; this must be valid CSS syntax, or a SyntaxError exception will occur. The first element found which matches this group of selectors is returned. Return value The first descendant element of baseElement which matches the specified group of selectors. The entire hierarchy of elements is considered when matching, including those outside the set of elements including baseElement and its descendants; in other words, selectors is first applied...
...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. 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> <...
Element.querySelectorAll() - Web APIs
of elements matching the specified group of selectors which are descendants of the element on which the method was called. Note: This method is implemented based on the ParentNode mixin's querySelectorAll() method. Syntax elementList = parentNode.querySelectorAll(selectors); Parameters selectors A DOMString containing one or more selectors to match against. This string must be a valid CSS selector string; if it's not, a SyntaxError exception is thrown. See Locating DOM elements using selectors for more information about using selectors to identify elements. Multiple selectors may be specified by separating them using commas. Note: Characters which are not part of standard CSS syntax must be escaped using a backslash character. Since JavaScript also uses backspace escaping, spec...
...using a backslash character. Since JavaScript also uses backspace escaping, special care must be taken when writing string literals using these characters. See Escaping special characters for more information. Return value A non-live NodeList containing one Element object for each descendant node that matches at least one of the specified selectors. Note: If the specified selectors include a CSS pseudo-element, the returned list is always empty. Exceptions SyntaxError The syntax of the specified selectors string is not valid. Examples dataset selector & attribute selectors <section class="box" id="sect1"> <div class="funnel-chart-percent1">10.900%</div> <div class="funnel-chart-percent2">3700.00%</div> <div class="funnel-chart-percent3">0.00%</div> </section> // dataset...
Element.scrollIntoView() - Web APIs
Working Draft Initial definition ...
... Working Draft Initial definition ...
Element.scrollLeft - Web APIs
ft is set to 0. If specified as a value less than 0 (greater than 0 for right-to-left elements), scrollLeft is set to 0. If specified as a value greater than the maximum that the content can be scrolled, scrollLeft is set to the maximum. ...
...on> CSS #container { width: 100px; height: 100px; border: 1px solid #ccc; overflow-x: scroll; } #content { width: 250px; background-color: #ccc; } JavaScript const button = document.getElementById('slide'); button.onclick = function () { document.getElementById('container').scrollLeft += 20; }; Result Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'scrollLeft' in that specification. Working Draft ...
Element.scrollWidth - Web APIs
Working Draft Initial definition ...
... Working Draft Initial definition ...
FontFace.FontFace() - Web APIs
Web › API › FontFace › FontFace
Working Draft Initial definition ...
... Working Draft Initial definition ...
FontFaceSet.check() - Web APIs
Web › API › FontFaceSet › check
"italic bold 16px Roboto" text: limit the font faces to those whose Unicode range contains at least one of the characters in text. ...
... whose Unicode range contains at least one of the characters in text. This does not check for individual glyph coverage. Examples document.fonts.check("12px courier"); // returns true if the font courier is available at 12px document.fonts.check("12px MyFont", "ss"); // returns true if the font 'MyFont' has a ss character. Specifications Specification Status Comment CSS Font Loading Module Level 3The definition of 'check' in that specification. Working Draft Initial definition ...
FontFaceSet.load() - Web APIs
Web › API › FontFaceSet › load
The load() method of the FontFaceSet forces all the fonts given in parameters to be loaded. Syntax result = aFontFaceSet.load(font); result = aFontFaceSet.load(font, text); Returns A Promise of an Array of FontFace loaded. The promise is fulfilled when all the fonts are loaded; it is rejected if one of the fonts failed to load. Parameters font: a font specification using the CSS value syntax, e.g. "italic bold 16px Roboto" text: limit the font faces to those whose Unicode range contains at least one of the characters in text. This does not check for individual glyph coverage. Examples // returns a promise that will be fulfilled or rejected according the success to load MyFont // The code in 'then' can assume the availability of that font. document.fonts.load("12px MyFont", "...
... range contains at least one of the characters in text. This does not check for individual glyph coverage. Examples // returns a promise that will be fulfilled or rejected according the success to load MyFont // The code in 'then' can assume the availability of that font. document.fonts.load("12px MyFont", "ss").then(...); Specifications Specification Status Comment CSS Font Loading Module Level 3The definition of 'load' in that specification. Working Draft Initial definition ...
FontFaceSet - Web APIs
Properties FontFaceSet.status Read only Indicates the font-face's loading status. It will be one of 'loading' or 'loaded'. FontFaceSet.ready Read only Promise which resolves once font loading and layout operations have completed. Events FontFaceSet.onloading An EventListener called whenever an event of type loading is fired, indicating a font-face set has started loading. FontFaceSet.onloadingdone An EventListener called whenever an event of type loadingdone is fired, indicating that a font face set has finished loading. ...
...ingerror An EventListener called whenever an event of type loadingerror is fired, indicating that an error occurred whilst loading a font-face set. Methods FontFaceSet.add() Adds a font to the font set. FontFaceSet.check() A Boolean that indicates whether a font is loaded, but doesn't initiate a load when it isn't. FontFaceSet.clear() Removes all manually-added fonts from the font set. CSS-connected fonts are unaffected. FontFaceSet.delete() Removes a manually-added font from the font set. CSS-connected fonts are unaffected. FontFaceSet.load() Returns a Promise which resolves to a list of font-faces for a requested font. Specifications Specification Status Comment CSS Font Loading Module Level 3The definition of 'FontFaceSet' in that specification. ...
Guide to the Fullscreen API - Web APIs
an put that video into full-screen mode as follows: var elem = document.getElementById("myvideo"); if (elem.requestFullscreen) { elem.requestFullscreen(); } This code checks for the existence of the requestFullscreen() method before calling it. ...
...e here between the Gecko and WebKit implementations at this time: Gecko automatically adds CSS rules to the element to stretch it to fill the screen: "width: 100%; height: 100%". WebKit doesn't do this; instead, it centers the fullscreen element at the same size in a screen that's otherwise black. To get the same fullscreen behavior in WebKit, you need to add your own "width: 100%; height: 100%;" CSS rules to the element yourself: #myvideo:-webkit-full-screen { width: 100%; height: 100%; } On the other hand, if you're trying to emulate WebKit's behavior on Gecko, you need to place the element you want to present inside another element, which you'll make fullscreen instead, and use CSS rules to adjust the inner element to match the appearance you want. Notification When fullscreen mod...
GeometryUtils - Web APIs
The GeometryUtils interface provides different utility function to retrieve geometry information about DOM nodes. GeometryUtils is a raw interface and no object of this type can be created; it is implemented by Text, Element, CSSPseudoElement, and Document objects. Properties This interface does not implement any properties. Methods GeometryUtils.getBoxQuads() Returns a list of DOMQuad objects representing the CSS fragments of the node. ...
...operties. Methods GeometryUtils.getBoxQuads() Returns a list of DOMQuad objects representing the CSS fragments of the node. GeometryUtils.convertQuadFromNode() FIXME: Needs a description GeometryUtils.convertRectFromNode() FIXME: Needs a description GeometryUtils.convertPointFromNode() FIXME: Needs a description Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'GeometryUtils' in that specification. Working Draft Initial definition ...
HTMLElement.hidden - Web APIs
The hidden property applies to all presentation modes and should not be used to hide content that is meant to be directly accessible to the user. ...
..."OK" button in the welcome 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 ...
HTMLElement.offsetLeft - Web APIs
Working Draft ...
... Working Draft ...
HTMLElement.offsetWidth - Web APIs
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. ...
...lemOffsetWidth = 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(). Example Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'offsetWidth' in that specification. Working Draft Notes offsetWidth is a property of the DHTML object model which was first introduced by MSIE. It is sometimes referred to as an element's physical/graphical dimensions, or an element's border-box width. ...
HTMLElement: transitioncancel event - Web APIs
See GlobalEventHandlers.ontransitioncancel for more information. ...
...ither direction after the transitionrun event occurs and before the transitionend is fired. If there is no transition delay or duration, if both are 0s or neither is declared, there is no transition, and none of the transition events are fired. If the transitioncancel event is fired, the transitionend event will not fire. Specifications Specification Status Comment CSS TransitionsThe definition of 'transitioncancel' in that specification. Working Draft Initial definition. ...
HTMLElement: transitionend event - Web APIs
In the case where a transition is removed before completion, such as if the transition-property is removed or display is set to none, then the event will not be generated. Bubbles Yes Cancelable Yes Interface TransitionEvent Event handler property ontransitionend The transitionend event is fired in both directions - as it finishes transitioning to the transitioned state, and when it fully reverts to the default or non-transitioned state. If there is no transition delay or duration, if both are 0s or neither is declared, there is no transition, and none of the transition events are fired. ...
...ons: when the box finishes turning and the opacity hits 0 or 1, depending on the direction. If there is no transition delay or duration, if both are 0s or neither is declared, there is no transition, and none of the transition events are fired. If the transitioncancel event is fired, the transitionend event will not fire. Specifications Specification Status Comment CSS TransitionsThe definition of 'transitionend' in that specification. Working Draft Initial definition. ...
HTMLElement: transitionrun event - Web APIs
before any transition-delay has begun. ...
...the start of any delay). transitionstart fires when the actual animation has begun (i.e. at the end of any delay). The transitionrun will occur even if the transition is canceled before the delay expires. If there is no transition delay or if transition-delay is negative, both transitionrun and transitionstart are fired. Specifications Specification Status Comment CSS TransitionsThe definition of 'transitionrun' in that specification. Working Draft ...
HTMLElement: transitionstart event - Web APIs
The transitionstart event is fired when a CSS transition has actually started, i.e., after any transition-delay has ended. Bubbles Yes Cancelable No Interface TransitionEvent Event handler property ontransitionstart 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> .
... Working Draft Initial definition. ...
Image() - Web APIs
The Image() constructor creates a new HTMLImageElement instance. It is functionally equivalent to document.createElement('img'). Disambiguation: image(), the CSS function notation. Syntax var htmlImageElement = new Image(width, height); Parameters width The width of the image (i.e., the value for the width attribute). height The height of the image (i.e., the value for the height attribute). Usage note The entire bitmap is loaded regardless of the sizes specified in the constructor. ...
...e for the width attribute). height The height of the image (i.e., the value for the height attribute). Usage note The entire bitmap is loaded regardless of the sizes specified in the constructor. The size specified in the constructor is reflected through the properties HTMLImageElement.width and HTMLImageElement.height of the resulting instance. The intrinsic width and height of the image in CSS pixels are reflected through the properties HTMLImageElement.naturalWidth and HTMLImageElement.naturalHeight. If no size is specified in the constructor both pairs of properties have the same values. Examples var myImage = new Image(100, 200); myImage.src = 'picture.jpg'; document.body.appendChild(myImage); This would be the equivalent of defining the following HTML tag inside the <body>: <im...
HTMLImageElement.align - Web APIs
The obsolete align property of the HTMLImageElement interface is a string which indicates how to position the image relative to its container. You should instead use the CSS propertiy vertical-align, which does in fact also work on images despite its name. You can also use the float property to float the image to the left or right margin. The align property reflects the HTML align content attribute. Syntax htmlImageElement.align = alignMode; alignMode = htmlImageElement.align; Value A DOMString specifying one of the following strings which set the alignment mode for the image. Baseline alignment These three values specify the alignment of the element relative to the text baseline. These should be replaced by using the CSS vertical-align property. bottom The bottom edge of the i...
...noting that vertical-align offers several additional options for its value; you may wish to consider these when changing your code to use it. Floating images horizontally The left and right properties don't affect the baseline-relative alignment. Instead, they cause the image to "float" to the left or right margin, allowing the following text to flow around the image. You should instead use the CSS float property, specifying as the value either left or right. left Floats the image over to place the left edge flush against the curent margin. Any text that follows will flow against the image's right edge. right Floats the image to place its right edge flush against the right margin. Subsequent text will flow along the image's left edge. Specifications Specification Status...
HTMLImageElement.alt - Web APIs
psum dolor sit amet, consectetur adipiscing elit. 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 wil...
...orem ipsum dolor sit amet, consectetur adipiscing elit. 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> CSS The main feature of the CSS here is the use of clip-path and shape-outside to wrap the text around the icon in an appealing way. .container { max-width: 500px; } .pageinfo-badge { width: 9em; padding-right: 1em; float: left; clip-path: polygon(100% 0, 100% 50%, 90% 70%, 80% 80%, 70% 90%, 50% 100%, 0 100%, 0 0); shape-outside: polygon(100% 0, 100% 50%, 90% 70%, 80% 80%,...
HTMLImageElement.sizes - Web APIs
s of a media condition as defined by the media queries standard. Because a source size descriptor is used to specify the width to use for the image during layout of the page, the media condition is typically (but not necessarily) based entirely on width information. See Syntax in Using media queries for details on how to construct a media condition. Source size values The source size value is a CSS length. It may be specified using font-relative units (such as em or ex), absolute units (such as px or cm), or the vw unit, which lets you specify the width as a percentage of the viewport width (1vw being 1% of the viewport width). Note: The source size value must not be specified as a percentage of the container size; that is, lengths such as 50% or 100% are not allowed, as there would be un...
...kyline-tall.jpg 1060w" sizes="((min-width: 50em) and (max-width: 60em)) 50em, ((min-width: 30em) and (max-width: 50em)) 30em, (max-width: 30em) 20em"> <p>Then there's even more amazing stuff to say down here. ...
HTMLMarqueeElement - Web APIs
om 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 of 'HTMLMarqueeElement' in that specification. Recommendation No changes. HTML 5.1The definition of 'HTMLMarqueeElement' in that specification. Recommendation No changes. HTML5The definition of 'HTMLMarqueeElement' in that specification. Recommendation Made obsolete in ...
...ne its expected behavior for backward compatibility. HTML 5.2The definition of 'HTMLMarqueeElement' in that specification. Recommendation No changes. HTML 5.1The definition of 'HTMLMarqueeElement' in that specification. Recommendation No changes. HTML5The definition of 'HTMLMarqueeElement' in that specification. Recommendation Made obsolete in favor of CSS but define its expected behavior for backward compatibility. ...
HTMLObjectElement - Web APIs
Boolean that reflects the declare HTML attribute, indicating that this is a declaration, not an instantiation, of the object. HTMLObjectElement.form Read only Retuns a HTMLFormElement representing the object element's form owner, or null if there isn't one. HTMLObjectElement.height Returns a DOMString that reflects the height HTML attribute, specifying the displayed height of the resource in CSS pixels. HTMLObjectElement.hspace Is a long representing the horizontal space in pixels around the control. HTMLObjectElement.name Returns a DOMString that reflects the name HTML attribute, specifying the name of the browsing context. HTMLObjectElement.standby Is a DOMString that reflects the standby HTML attribute, specifying a message to display while the object loads. HTMLObjectEleme...
...alidate is false), or it satisfies its constraints. HTMLObjectElement.validity Read only Returns a ValidityState with the validity states that this element is in. HTMLObjectElement.vspace Is a long representing the horizontal space in pixels around the control. HTMLObjectElement.width Is a DOMString that reflects the width HTML attribute, specifying the displayed width of the resource in CSS pixels. HTMLObjectElement.willValidate Read only Returns a Boolean that indicates whether the element is a candidate for constraint validation. Always false for HTMLObjectElement objects. Methods Inherits methods from its parent, HTMLElement. HTMLObjectElement.checkValidity() Retuns a Boolean that always is true, because object objects are never candidates for constraint validation. HT...
HTMLVideoElement.videoHeight - Web APIs
If the element's readyState is HTMLMediaElement.HAVE_NOTHING, then the value of this property is 0, because neither video nor poster frame size information is yet available. ...
...If the element's readyState is HTMLMediaElement.HAVE_NOTHING, then the value of this property is 0, because neither video nor poster frame size information is yet available. ...
HTMLVideoElement.videoWidth - Web APIs
If the element's readyState is HTMLMediaElement.HAVE_NOTHING, then the value of this property is 0, because neither video nor poster frame size information is yet available. ...
...If the element's readyState is HTMLMediaElement.HAVE_NOTHING, then the value of this property is 0, because neither video nor poster frame size information is yet available. ...
HTMLVideoElement - Web APIs
" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">HTMLVideoElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties Inherits properties from its ancestor interfaces, HTMLMediaElement, and HTMLElement. HTMLVideoElement.height Is a DOMString that reflects the height HTML attribute, which specifies the height of the display area, in CSS pixels. HTMLVideoElement.poster Is a DOMString that reflects the poster HTML attribute, which specifies an image to show while no video data is available. HTMLVideoElement.videoHeight Read only Returns an unsigned integer value indicating the intrinsic height of the resource in CSS pixels, or 0 if no media is available yet. HTMLVideoElement.videoWidth Read only Returns an unsigned integer...
...flects the poster HTML attribute, which specifies an image to show while no video data is available. HTMLVideoElement.videoHeight Read only Returns an unsigned integer value indicating the intrinsic height of the resource in CSS pixels, or 0 if no media is available yet. HTMLVideoElement.videoWidth Read only Returns an unsigned integer value indicating the intrinsic width of the resource in CSS pixels, or 0 if no media is available yet. HTMLVideoElement.width Is a DOMString that reflects the width HTML attribute, which specifies the width of the display area, in CSS pixels. Gecko-specific properties HTMLVideoElement.mozParsedFrames Read only Returns an unsigned long with the count of video frames that have been parsed from the media resource. HTMLVideoElement.mozDecodedFrames...
Using IndexedDB - Web APIs
="Clear the whole store" class="destructive" /> </div> </form> <form id="search-form"> <div class="button-pane"> <input type="button" id="search-list-button" value="List database content" /> </div> </form> <div> <div id="pub-msg"> </div> <div id="pub-viewer"> </div> <ul id="pub-list"> </ul> </div> CSS Content body { font-size: 0.8em; font-family: Sans-Serif; } form { background-color: #cccccc; border-radius: 0.3em; display: inline-block; margin-bottom: 0.5em; padding: 1em; } table { border-collapse: collapse; } input { padding: 0.3em; border-color: #cccccc; border-radius: 0.3em; } .required:after { content: "*"; color: red; } .button-pane { margin-top: 1em; } ...
...{ var img_id = 'image-' + key; var img = $('<img id="' + img_id + '"/>'); $(this).contents().find('body').html(img); var obj_url = window.URL.createObjectURL(blob); $(this).contents().find('#' + img_id).attr('src', obj_url); window.URL.revokeObjectURL(obj_url); }); } else if (blob.type == 'application/pdf') { $('*').css('cursor', 'wait'); var obj_url = window.URL.createObjectURL(blob); iframe.load(function() { $('*').css('cursor', 'auto'); }); iframe.attr('src', obj_url); window.URL.revokeObjectURL(obj_url); } else { iframe.load(function() { $(this).contents().find('body').html("No view available"); }); } }); } /** ...
IntersectionObserver.rootMargin - Web APIs
Each side of the rectangle represented by rootMargin is added to the corresponding side in the root element's bounding box before the intersection test is performed. This lets you, for example, adjust the bounds outward so that the target element is considered 100% visible even if a certain number of pixels worth of width or height is clipped away, or treat the target as partially hidden if an edge is too close to the edge of the root's bounding box. ...
...dth or height is clipped away, or treat the target as partially hidden if an edge is too close to the edge of the root's bounding box. See The root element and root margin in Intersection Observer API for a more in-depth look at the root margin and how it works with the root's bounding box. Syntax var marginString = IntersectionObserver.rootMargin; Value A string, formatted similarly to the CSS margin property's value, which contains offsets for one or more sides of the root's bounding box. These offsets are added to the corresponding values in the root's bounding box before the intersection between the resulting rectangle and the target element's bounds. The string returned by this property may not match the one specified when the IntersectionObserver was instantiated. The browser is ...
Intersection Observer API - Web APIs
ntersectionObserver() constructor let you control the circumstances under which the observer's callback is invoked. It has the following fields: root The element that is used as the viewport for checking visibility of the target. Must be the ancestor of the target. Defaults to the browser viewport if not specified or if null. rootMargin Margin around the root. Can have values similar to the CSS margin property, e.g. "10px 20px 30px 40px" (top, right, bottom, left). The values can be percentages. This set of values serves to grow or shrink each side of the root element's bounding box before computing intersections. Defaults to all zeros. threshold Either a single number or an array of numbers which indicate at what percentage of the target's visibility the observer's callback should be...
...ents (such as ads) are visible to the user and to react to that information by recording statistics or by updating elements.. HTML The HTML for this example is very short, with a primary element which is the box that we'll be targeting (with the creative ID "box") and some contents within the box. <div id="box"> <div class="vertical"> Welcome to <strong>The Box!</strong> </div> </div> CSS The CSS isn't terribly important for the purposes of this example; it lays out the element and establishes that the background-color and border attributes can participate in CSS transitions, which we'll use to affect the changes to the element as it becomes more or less obscured. #box { background-color: rgba(40, 40, 190, 255); border: 4px solid rgb(20, 20, 120); transition: background-co...
KeyboardEvent.code - Web APIs
layout. To determine what character corresponds with the key event, use the KeyboardEvent.key property instead. Code values The code values for Windows, Linux, and macOS are list on the KeyboardEvent: code values page. ...
...ackward, and right. This will use the same four keys physically regardless of what the actual corresponding characters are, such as if the user is using an AZERTY keyboard. HTML <p>Use the WASD (ZQSD on AZERTY) keys to move and steer.</p> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="world"> <polygon id="spaceship" points="15,0 0,30 30,30"/> </svg> <script>refresh();</script> CSS .world { margin: 0px; padding: 0px; background-color: black; width: 400px; height: 400px; } #spaceship { fill: orange; stroke: red; stroke-width: 2px; } JavaScript The first section of the JavaScript code establishes some variables we'll be using. shipSize contains the size of the ship the player is moving around, for convenience. position is used to track the position of the ...
KeyframeEffect.setKeyframes() - Web APIs
keyframe), and the browser will infer the other end of the animation if it is able to. For example, consider this simple animation -- the Keyframe object looks like so: let rotate360 = [ { transform: 'rotate(360deg)' } ]; We have only specified the end state of the animation, and the beginning state is implied. Attributes Keyframes may specify property-value pairs for any of the animatable css properties. The property names are specified using camel-case so for example background-color becomes backgroundColor and background-position-x becomes backgroundPositionX. Shorthand values such as margin are also permitted. Two exceptional CSS properties are: float, which must be written as cssFloat since "float" is a reserved word in JavaScript. It's just for reference here, this will have ...
...case so for example background-color becomes backgroundColor and background-position-x becomes backgroundPositionX. Shorthand values such as margin are also permitted. Two exceptional CSS properties are: float, which must be written as cssFloat since "float" is a reserved word in JavaScript. It's just for reference here, this will have no effect on animation 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 ...
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. ...
...nherited 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. Obsolete Initial definition ...
MathMLElement - Web APIs
The MathMLElement interface represents any MathML element. ...
... The MathMLElement interface represents any MathML element. ...
MediaList - Web APIs
Web › API › MediaList
diaText 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. 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 Spec...
...ext, 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
Working Draft Initial definition ...
... Working Draft Initial definition ...
MediaQueryList.matches - Web APIs
Working Draft Initial definition ...
... Working Draft Initial definition ...
MediaQueryList.onchange - Web APIs
Working Draft Initial definition ...
... Working Draft Initial definition ...
MediaQueryList.removeListener() - Web APIs
Working Draft Initial definition ...
... Working Draft Initial definition ...
MediaQueryList - Web APIs
Working Draft Initial definition ...
... Working Draft Initial definition ...
MediaQueryListEvent.matches - Web APIs
Working Draft Initial definition ...
... Working Draft Initial definition ...
MediaQueryListEvent.media - Web APIs
Working Draft Initial definition ...
... Working Draft Initial definition ...
MediaQueryListEvent - Web APIs
Working Draft Initial definition ...
... Working Draft Initial definition ...
MediaStreamConstraints.audio - Web APIs
lean value In this example, we provide a simple value of true for the audio property. This tells getUserMedia() that we require an audio track, but we don't care about any specifics beyond that. ...
...ent once the stream is returned. ...
MediaStreamConstraints.video - Web APIs
this example, we provide a simple value of true for the video property. This tells getUserMedia() that we require a video track, but we don't care about any specifics beyond that. ...
...eam is returned. ...
Recording a media element - Web APIs
element which will be used to play back the recorded video. Notice that the playback panel doesn't have autoplay set (so the playback doesn't start as soon as media arrives), and it has controls set, which tells it to show the user controls to play, pause, and so forth. Below the playback element is a button for downloading the recorded video. ...
...error to the logging area by calling our log() function. Handling the stop button The last bit of code adds a handler for the click event on the stop button using addEventListener(): stopButton.addEventListener("click", function() { stop(preview.srcObject); }, false); This simply calls the stop() function we covered earlier. Result When put all together with the rest of the HTML and the CSS not shown above, it looks and works like this: You can take a look at all the code, including the parts hidden above because they aren't critical to the explanation of how the APIs are being used. ...
Capabilities, constraints, and settings - Web APIs
. Example: Constraint exerciser In this example, we create an exerciser which lets you experiment with media constraints by editing the source code describing the constraint sets for audio and video tracks. You can then apply those changes and see the result, including both what the stream looks like and what the actual media settings are set to after applying the new constraints. The HTML and CSS for this example are pretty simple, and aren't shown here. You can look at the complete example by clicking here. HTML content <p>Experiment with media constraints! Edit the constraint sets for the video and audio tracks in the edit boxes on the left, then click the "Apply Constraints" button to try them out. The actual settings the browser selected and is using are shown in the boxes...
...or" cols=32 rows=8></textarea> </div> <div class="rightside"> <h3>Actual audio settings:</h3> <textarea id="audioSettingsText" cols=32 rows=8 disabled></textarea> </div> </div> <div class="button" id="applyButton"> Apply Constraints </div> </div> <video id="video" autoplay></video> <div class="button" id="stopButton"> Stop Video </div> <div id="log"> </div> CSS content body { font: 14px "Open Sans", "Arial", sans-serif; } video { margin-top: 20px; border: 1px solid black; } .button { cursor: pointer; width: 150px; border: 1px solid black; font-size: 16px; text-align: center; padding-top: 2px; padding-bottom: 4px; color: white; background-color: darkgreen; } .wrapper { margin-bottom: 10px; width: 600px; } .trackrow { he...
MouseEvent.screenX - Web APIs
Working Draft Redefines MouseEvent from long to double. Document Object Model (DOM) Level 3 Events SpecificationThe definition of 'MouseEvent.screenX' in that specification. Obsolete No change from Document Object Model (DOM) Level 2 Events Specification. Document Object Model (DOM) Le...
... Working Draft Redefines MouseEvent from long to double. Document Object Model (DOM) Level 3 Events SpecificationThe definition of 'MouseEvent.screenX' in that specification. Obsolete No change from Document Object Model (DOM) Level 2 Events Specification. Document Object Model (DOM) Level 2 Events Speci...
MouseEvent.screenY - Web APIs
Working Draft Redefines MouseEvent from long to double. Document Object Model (DOM) Level 3 Events SpecificationThe definition of 'MouseEvent.screenY' in that specification. Obsolete No change from Document Object Model (DOM) Level 2 Events Specification. Document Object Model (DOM) Le...
... Working Draft Redefines MouseEvent from long to double. Document Object Model (DOM) Level 3 Events SpecificationThe definition of 'MouseEvent.screenY' in that specification. Obsolete No change from Document Object Model (DOM) Level 2 Events Specification. Document Object Model (DOM) Level 2 Events Speci...
Using Navigation Timing - Web APIs
gationStart; document.querySelector(".output").innerText = loadingTime + " ms"; }, false); This code, executed when the load event occurs, subtracts from the current time the time at which the navigation whose timing was recorded began (performance.timing.navigationStart), and outputs that information to the screen by inserting it into an element. HTML <div class="output"> </div> CSS .output { border: 1px solid #bbb; font: 16px "Open Sans", "Helvetica", "Arial", sans-serif; } In tandem with appropriate HTML and CSS, the result is: The values listed are for the <iframe> in which the sample is presented above. For a list of the available timing values you can look for in PerformanceTiming, see the PerformanceTiming interface's Properties section. Determining navigat...
...ind of load operation took place: a navigation, a reload, or a shift through the browser's history. We also obtain the number of redirects that were incurred during the navigation from performance.navigation.redirectCount. This information is output to the screen just like the page load time was previously: by inserting it into the element with class "output". HTML <div class="output"> </div> CSS .output { border: 1px solid #bbb; font: 16px "Open Sans", "Helvetica", "Arial", sans-serif; } With this code in place, the result looks like this: The values listed are for the <iframe> in which the sample is presented. ...
ParentNode.querySelector() - Web APIs
taining one or more selectors to match against. This string must be a valid compound selector list supported by the browser; if it's not, a SyntaxError exception is thrown. See Locating DOM elements using selectors for more information about using selectors to identify elements. Multiple selectors may be specified by separating them using commas. Note: Characters which are not part of standard CSS syntax must be escaped using a backslash character. Since JavaScript also uses backspace escaping, special care must be taken when writing string literals using these characters. See Escaping special characters for more information. Return value The first Element that matches at least one of the specified selectors or null if no such element is found. Note: If the specified selectors include...
...ntax must be escaped using a backslash character. Since JavaScript also uses backspace escaping, special care must be taken when writing string literals using these characters. See Escaping special characters for more information. Return value The first Element that matches at least one of the specified selectors or null if no such element is found. Note: If the specified selectors include a CSS pseudo-element, the returned value is always null. Exceptions SyntaxError The syntax of the specified selectors string is not valid. Specifications Specification Status Comment DOMThe definition of 'ParentNode.querySelector()' in that specification. Living Standard Living standard Selectors API Level 2The definition of 'ParentNode.querySelector(...
ParentNode.querySelectorAll() - Web APIs
d. If you need only a single result, consider the querySelector() method instead. Note: This method is implemented as Element.querySelectorAll(), Document.querySelectorAll(), and DocumentFragment.querySelectorAll() Syntax elementList = parentNode.querySelectorAll(selectors); Parameters selectors A DOMString containing one or more selectors to match against. This string must be a valid CSS selector string; if it's not, a SyntaxError exception is thrown. See Locating DOM elements using selectors for more information about using selectors to identify elements. Multiple selectors may be specified by separating them using commas. Note: Characters which are not part of standard CSS syntax must be escaped using a backslash character. Since JavaScript also uses backslash escaping, spec...
...using a backslash character. Since JavaScript also uses backslash escaping, special care must be taken when writing string literals using these characters. See Escaping special characters for more information. Return value A non-live NodeList containing one Element object for each descendant node that matches at least one of the specified selectors. Note: If the specified selectors include a CSS pseudo-element, the returned list is always empty. Exceptions SyntaxError The syntax of the specified selectors string is not valid. Examples To obtain a NodeList of all of the <p> elements in the document: var matches = document.querySelectorAll("p"); This example returns a list of all <div> elements within the document with a class of either note or alert: var matches = document.que...
PerformanceResourceTiming.initiatorType - Web APIs
If the initiator is a XMLHttpRequest object, the property returns "xmlhttprequest". If the initiator is a PerformanceNavigationTiming object, the property returns an empty string (""). ...
... If the initiator is a XMLHttpRequest object, the property returns "xmlhttprequest". If the initiator is a PerformanceNavigationTiming object, the property returns an empty string (""). ...
Point - Web APIs
Web › API › Point
Point is an interface, which existed only briefly in the CSS Transforms Level 1 specification, which represents a point in 2-dimensional space. It is non-standard, not broadly compatible, and should not be used. Although it is not directly related to this defunct interface, you are probably looking for DOMPoint, which is part of the Geometry Interfaces Module Level 1 specification. Properties x A floating-point value specifying the point's position with respect to the X (horizontal) axis. y A floating-point value specifying the point's position with respect to the Y (vertical) axis. Specifications This class was specified in the defunct 20 March 2009 Working Draft of CSS 2D Transforms Module Level 3. ...
...fication. Properties x A floating-point value specifying the point's position with respect to the X (horizontal) axis. y A floating-point value specifying the point's position with respect to the Y (vertical) axis. Specifications This class was specified in the defunct 20 March 2009 Working Draft of CSS 2D Transforms Module Level 3. It is not present in the current working draft of the CSS Transforms Level 1 specification. ...
PointerEvent.height - Web APIs
Example An example of this property is included in the PointerEvent.width example. ...
... Example An example of this property is included in the PointerEvent.width example. Specifications Specification Status Comment Pointer Events - Level 2The definition of 'height' in that specification. Recommendation Non-stable version. Pointer EventsThe definition of 'height' in that specification. ...
PointerEvent.width - Web APIs
Example This example illustrates using the PointerEvent interface's width and height properties to calculate the contact area. ...
... Example This example illustrates using the PointerEvent interface's width and height properties to calculate the contact area. ...
Pointer events - Web APIs
and Navigator interfaces. The following sub-sections contain short descriptions of each interface and property. PointerEvent interface The PointerEvent interface extends the MouseEvent interface and has the following properties. (All of the following properties are Read only .) pointerId A unique identifier for the pointer causing the event. width The width (magnitude on the X axis), in CSS pixels, of the contact geometry of the pointer. height the height (magnitude on the Y axis), in CSS pixels, of the contact geometry of the pointer. pressure the normalized pressure of the pointer input in the range of 0 to 1, where 0 and 1 represent the minimum and maximum pressure the hardware is capable of detecting, respectively. tangentialPressure The normalized tangential pressure of t...
...he pointer capture el.releasePointerCapture(ev.pointerId); } function init() { let el = document.getElementById("target"); // Register pointerdown and pointercancel handlers el.onpointerdown = downHandler; el.onpointercancel = cancelHandler; } </script> <body onload="init();"> <div id="target"> Touch me ... </div> </body> </html> touch-action CSS property The touch-action CSS property is used to specify whether or not the browser should apply its default (native) touch behavior (such as zooming or panning) to a region. This property may be applied to all elements except: non-replaced inline elements, table rows, row groups, table columns, and column groups. A value of auto means the browser is free to apply its default touch behavior (t...
SVGElement - Web APIs
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 ...
...est ancestor <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 pr...
SVGLength - Web APIs
Web › API › SVGLength
to define a new value of this type or to attempt to switch an existing value to this type. SVG_LENGTHTYPE_NUMBER 1 No unit type was provided (i.e., a unitless value was specified), which indicates a value in user units. SVG_LENGTHTYPE_PERCENTAGE 2 A percentage value was specified. SVG_LENGTHTYPE_EMS 3 A value was specified using the em units defined in CSS2. SVG_LENGTHTYPE_EXS 4 A value was specified using the ex units defined in CSS2. SVG_LENGTHTYPE_PX 5 A value was specified using the px units defined in CSS2. SVG_LENGTHTYPE_CM 6 A value was specified using the cm units defined in CSS2. SVG_LENGTHTYPE_MM 7 A value was specified using the mm units defined in CSS2. SVG_LENGTHTYPE_...
...ing the ex units defined in CSS2. SVG_LENGTHTYPE_PX 5 A value was specified using the px units defined in CSS2. SVG_LENGTHTYPE_CM 6 A value was specified using the cm units defined in CSS2. SVG_LENGTHTYPE_MM 7 A value was specified using the mm units defined in CSS2. SVG_LENGTHTYPE_IN 8 A value was specified using the in units defined in CSS2. SVG_LENGTHTYPE_PT 9 A value was specified using the pt units defined in CSS2. SVG_LENGTHTYPE_PC 10 A value was specified using the pc units defined in CSS2. Properties Name Type Description unitType unsigned short The type of the value as specified by one of the SVG_LENGTHTYPE_* constants defined on this interface. ...
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 Retu...
... 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 Description getPresentationAttribute(in DOMString name) CSSValue Returns the base (i.e., static) value of a given presentation attribute as an object of type CSSValue. The returned object is live; changes to the objects represent immediate changes to the objects to which the CSSValue is attached. Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check ou...
Screen.height - Web APIs
Web › API › Screen › height
Working Draft ...
... Working Draft ...
ScrollToOptions.behavior - Web APIs
Working Draft ...
... Working Draft ...
ScrollToOptions.left - Web APIs
Working Draft ...
... Working Draft ...
ScrollToOptions.top - Web APIs
Working Draft ...
... Working Draft ...
Using Service Workers - Web APIs
e in Google's Topeka demo, or perhaps store your assets in IndexedDB. ...
...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 cur...
ShadowRoot - Web APIs
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.getSelection() Returns a Selection object representing the r...
...dded 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. ...
StyleSheet.parentStyleSheet - Web APIs
Working Draft ...
... Working Draft ...
StyleSheet - Web APIs
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. ...
...arentStyleSheet 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 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. ...
StyleSheetList - Web APIs
yleSheetList 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. Ignoring...', styleSheet.href); } }) .filter(Boolean) .join('\n'); Specifications Specification ...
...y 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 ...
Touch.pageX - Web APIs
Web › API › Touch › pageX
viewport, including any scroll offset. Syntax touchItem.pageX; Return value A long representing the X coordinate of the touch point relative to the viewport, including any scroll offset. Example This example illustrates how to access the Touch object's Touch.pageX and Touch.pageY properties. The Touch.pageX property is the horizontal coordinate of a touch point relative to the viewport (in CSS pixels), including any scroll offset. The Touch.pageY property is the vertical coordinate of a touch point relative to the viewport (in CSS pixels), including any scroll offset. In following simple code snippet, we assume the user initiates one or more touch contacts on the source element, moves the touch points and then releases all contacts with the surface. When the touchmove event handler is...
...touch point's Touch.pageX and Touch.pageY coordinates are accessed via the event's TouchEvent.changedTouches list. // Register a touchmove listeners for the 'source' element var src = document.getElementById("source"); src.addEventListener('touchmove', function(e) { // Iterate through the touch points that have moved and log each // of the pageX/Y coordinates. The unit of each coordinate is CSS pixels. var i; for (i=0; i < e.changedTouches.length; i++) { console.log("touchpoint[" + i + "].pageX = " + e.changedTouches[i].pageX); console.log("touchpoint[" + i + "].pageY = " + e.changedTouches[i].pageY); } }, false); Specifications Specification Status Comment Touch Events - Level 2 Draft No change from the previous version. Touch Eve...
Touch.pageY - Web APIs
Web › API › Touch › pageY
including any scroll offset. Syntax touchItem.pageY; Return value A long value that representes the Y coordinate of the touch point relative to the viewport, including any scroll offset. Example This example illustrates how to access the Touch object's Touch.pageX and Touch.pageY properties. The Touch.pageX property is the horizontal coordinate of a touch point relative to the viewport (in CSS pixels), including any scroll offset. The Touch.pageY property is the vertical coordinate of a touch point relative to the viewport (in CSS pixels), including any scroll offset. In following simple code snippet, we assume the user initiates one or more touch contacts on the source element, moves the touch points and then releases all contacts with the surface. When the touchmove event handler is...
...touch point's Touch.pageX and Touch.pageY coordinates are accessed via the event's TouchEvent.changedTouches list. // Register a touchmove listeners for the 'source' element var src = document.getElementById("source"); src.addEventListener('touchmove', function(e) { // Iterate through the touch points that have moved and log each // of the pageX/Y coordinates. The unit of each coordinate is CSS pixels. var i; for (i=0; i < e.changedTouches.length; i++) { console.log("touchpoint[" + i + "].pageX = " + e.changedTouches[i].pageX); console.log("touchpoint[" + i + "].pageY = " + e.changedTouches[i].pageY); } }, false); Specifications Specification Status Comment Touch Events - Level 2 Draft No change from last version. Touch Events Re...
Touch.screenX - Web APIs
Web › API › Touch › screenX
not including any scroll offset. Syntax var x = touchItem.screenX; Return value x The X coordinate of the touch point relative to the screen, not including any scroll offset. Example This example illustrates how to access the Touch object's Touch.screenX and Touch.screenY properties. The Touch.screenX property is the horizontal (x) coordinate of a touch point relative to the screen in CSS pixels. The Touch.screenY property is the vertical coordinate of a touch point relative to the screen in CSS pixels. In following simple code snippet, we assume the user initiates multiple touch contacts on an element with an id of source and then releases contacts with the surface. When the touchstart event handler is invoked, each touch point's Touch.screenX and Touch.screenY coordinates are a...
...he surface. When the touchstart event handler is invoked, each touch point's Touch.screenX and Touch.screenY coordinates are accessed. // Register a touchstart listeners for the 'source' element var src = document.getElementById("source"); src.addEventListener('touchstart', function(e) { // Iterate through the touch points and log each screenX/Y coordinate. // The unit of each coordinate is CSS pixels. var i; for (i=0; i < e.touches.length; i++) { console.log("touchpoint[" + i + "].screenX = " + e.touches[i].screenX); console.log("touchpoint[" + i + "].screenY = " + e.touches[i].screenY); } }, false); Specifications Specification Status Comment Touch Events - Level 2 Draft Non-stable version. Touch Events Recommendation Init...
TransitionEvent() - Web APIs
: aFloat, pseudoElement: aPseudoElementName}); Arguments The TransitionEvent() constructor also inherits arguments from Event(). type Is a DOMString representing the name of the type of the TransitionEvent. It is case-sensitive and can only be: 'transitionend'. propertyName Optional Is a DOMString containing the value of the property-name CSS property associated with the transition. It defaults to "". elapsedTime Optional Is float giving the amount of time the animation has been running, in seconds, when this event fired, excluding any time the animation was paused. For an "animationstart" event, elapsedTime is 0.0 unless there was a negative value for animation-delay, in which case the event will be fired with elapsedTime containin...
...se the event will be fired with elapsedTime containing (-1 * delay). It defaults to 0.0. pseudoElement Optional Is a DOMString, starting with "::", containing the name of the pseudo-element the animation runs on. If the animation doesn't run on a pseudo-element but on the element, an empty string: "". It defaults to "". Specifications Specification Status Comment CSS TransitionsThe definition of 'TransitionEvent()' in that specification. Working Draft Initial definition. ...
Basic scissoring - Web APIs
canvas.width = canvas.clientWidth; canvas.height = canvas.clientHeight; var gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); if (!gl) { paragraph.innerHTML = "Failed to get WebGL context. " + "Your browser or device may not support...
...; } window.addEventListener("load", function setupWebGL (evt) { "use strict" window.removeEventListener(evt.type, setupWebGL, false); var paragraph = document.querySelector("p"); var canvas = document.querySelector("canvas"); // The following two lines set the size (in CSS pixels) of // the drawing buffer to be identical to the size of the // canvas HTML element, as determined by CSS. canvas.width = canvas.clientWidth; canvas.height = canvas.clientHeight; var gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); if (!gl) { paragraph.innerHTML = "Failed to get WebGL context. " + "Your browser or device may not support WebGL."; return; } gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); // Enable scisso...
Canvas size and WebGL - Web APIs
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. ...
...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. ...
Keyframe Formats - Web APIs
keyframe), and the browser will infer the other end of the animation if it is able to. For example, consider this simple animation -- the Keyframe object looks like so: let rotate360 = [ { transform: 'rotate(360deg)' } ]; We have only specified the end state of the animation, and the beginning state is implied. Attributes Keyframes may specify property-value pairs for any of the animatable css properties. The property names are specified using camel-case so for example background-color becomes backgroundColor and background-position-x becomes backgroundPositionX. Shorthand values such as margin are also permitted. Two exceptional CSS properties are: float, which must be written as cssFloat since "float" is a reserved word in JavaScript. It's just for reference here, this will have ...
...case so for example background-color becomes backgroundColor and background-position-x becomes backgroundPositionX. Shorthand values such as margin are also permitted. Two exceptional CSS properties are: float, which must be written as cssFloat since "float" is a reserved word in JavaScript. It's just for reference here, this will have no effect on animation 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 ...
Window: animationcancel event - Web APIs
Therefore, either directly or because any of its containing nodes are hidden. Bubbles Yes Cancelable No Interface AnimationEvent Event handler property onanimationcancel The original target for this event is the Element that had the animation applied. You can listen for this event on the Window interface to handle it in the capture or bubbling phases. ...
...listener to the animationcancel event. ...
Window: animationend event - Web APIs
If the animation aborts before reaching completion, such as if the element is removed from the DOM or the animation is removed from the element, the animationend event is not fired. Bubbles Yes Cancelable No Interface AnimationEvent Event handler property onanimationend The original target for this event is the Element that had the animation applied. 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 HTMLElement: animationend. ...
...ationend. ...
Window: animationiteration event - Web APIs
This event does not occur at the same time as the animationend event, and therefore does not occur for animations with an animation-iteration-count of one. Bubbles Yes Cancelable No Interface AnimationEvent Event handler property onanimationiteration The original target for this event is the Element that had the animation applied. 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 HTMLElement: animationiteration. ...
...++; console.log(`Animation iteration count: ${iterationCount}`); }); The same, but using the onanimationiteration event handler property: let iterationCount = 0; window.onanimationiteration = () => { iterationCount++; console.log(`Animation iteration count: ${iterationCount}`); }; See a live example of this event. Specifications Specification Status Comment CSS Animations Working Draft Initial definition ...
Window: animationstart event - Web APIs
If there is an animation-delay, this event will fire once the delay period has expired. A negative delay will cause the event to fire with an elapsedTime equal to the absolute value of the delay (and, correspondingly, the animation will begin playing at that time index into the sequence). Bubbles Yes Cancelable No Interface AnimationEvent Event handler property onanimationstart The original target for this event is the Element that had the animation applied. You can listen for this event on the Window interface to handle it in the capture or bubbling phases. ...
...ples This listens for the animationstart event and logs a message when it is fired: window.addEventListener('animationstart', () => { console.log('Animation started'); }); The same, but using onanimationstart: window.onanimationstart = () => { console.log('Animation started'); }; See a live example of this event. Specifications Specification Status Comment CSS Animations Working Draft Initial definition ...
Window.innerWidth - Web APIs
Web › API › Window › innerWidth
Working Draft Initial definition ...
... Working Draft Initial definition ...
Window.mozInnerScreenX - Web APIs
Syntax screenX = window.mozInnerScreenX; Value screenX stores the window.mozInnerScreenX property value. ...
... Syntax screenX = window.mozInnerScreenX; Value screenX stores the window.mozInnerScreenX property value. ...
Window.mozInnerScreenY - Web APIs
Syntax screenY = window.mozInnerScreenY; Value screenY stores the window.mozInnerScreenY property value. ...
... Syntax screenY = window.mozInnerScreenY; Value screenY stores the window.mozInnerScreenY property value. ...
Window.open() - Web APIs
Web › API › Window › open
lable. If you are using the SDK, tabs are handled a bit differently K-meleon 1.1, a Mozilla-based browser, gives complete control and power to the user regarding how links are opened. Only the user can set his advanced preferences to do that. Some advanced extensions also give Mozilla and Firefox a lot of power over how referenced resources are loaded. In a few years, the target property of the CSS3 hyperlink module may be implemented (if CSS3 Hyperlink module as it is right now is approved). And even if and when this happens, you can expect developers of browsers with tab-browsing to give the user entire veto power and full control over how links can open web pages. How to open a link should always be entirely under the control of the user. How do I know whether a window I opened is still...
...econd window Terms often used to describe or to identify the same window. It is the new window that was created. Unrequested popup windows Script-initiated windows opening automatically without the user's consent. Specification Specification Status Comment HTML Living StandardThe definition of 'Window.open()' in that specification. Living Standard CSS Object Model (CSSOM) View ModuleThe definition of 'The features argument to the open() method' in that specification. Working Draft Defines the effect of the features argument ...
Window.resizeBy() - Web APIs
Web › API › Window › resizeBy
Working Draft ...
... Working Draft ...
Window: resize event - Web APIs
Working Draft ...
... Working Draft ...
Window.scrollTo() - Web APIs
Web › API › Window › scrollTo
Working Draft Initial definition. ...
...ons: window.scrollTo({ top: 100, left: 100, behavior: 'smooth' }); Notes Window.scroll() is effectively the same as this method. For relative scrolling, see Window.scrollBy(), Window.scrollByLines(), and Window.scrollByPages(). For scrolling elements, see Element.scrollTop and Element.scrollLeft. Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'window.scroll()' in that specification. Working Draft Initial definition. ...
Window.scrollX - Web APIs
Web › API › Window › scrollX
Working Draft ...
... Working Draft ...
Window: transitioncancel event - Web APIs
See GlobalEventHandlers.ontransitioncancel for more information. Bubbles Yes Cancelable No Interface TransitionEvent Event handler property GlobalEventHandlers.ontransitioncancel The original target for this event is the Element that had the transition applied. 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 HTMLElement: transitioncancel. ...
... Working Draft Initial definition. ...
Window: transitionend event - Web APIs
In the case where a transition is removed before completion, such as if the transition-property is removed or display is set to none, then the event will not be generated. Bubbles Yes Cancelable Yes Interface TransitionEvent Event handler property ontransitionend The transitionend event is fired in both directions - as it finishes transitioning to the transitioned state, and when it fully reverts to the default or non-transitioned state. If there is no transition delay or duration, if both are 0s or neither is declared, there is no transition, and none of the transition events are fired. ...
... Working Draft Initial definition. ...
Window: transitionrun event - Web APIs
before any transition-delay has begun. Bubbles Yes Cancelable No Interface TransitionEvent Event handler property ontransitionrun The original target for this event is the Element that had the transition applied. 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 HTMLElement: transitionrun. ...
... Working Draft Initial definition. ...
Window: transitionstart event - Web APIs
Bubbles Yes Cancelable No Interface TransitionEvent Event handler property GlobalEventHandlers.ontransitionstart The original target for this event is the Element that had the transition applied. 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 HTMLElement: transitionstart. ...
... Working Draft Initial definition. ...
Generating HTML - Web APIs
</xsl:stylesheet version="1.0"> A template matching the root node of the XML document is created and used to create the basic structure of the HTML page. Figure 4 : Creating the basic HTML document XSL Stylesheet (example2.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:Auth...
Using the link role - Accessibility
s. Note: Opinons may differ on how assistive technology should handle this technique. The information provided above is one of those opinions and therefore not normative. Examples This example shows how to implement a fake link using a <span> element. This includes JavaScript to grab the location and handle navigating to the new location using window.open() via clicking, and using keyboard, CSS to give the desired visuals of a link, the tabindex="0" attribute to make it keyboard-focussable, and role="link" to make it recognised as a link by 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 pr...
... 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. ...
ARIA: alert role - Accessibility
d out the message. It should not be used on HTML where the user hasn't interacted with it. For example, if a page 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. ...
...iggered. 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 alerts as appropriate. <button type="button" onclick="triggerAlert">Trigger alert</button> <p class="alert">The ...
ARIA: grid role - Accessibility
td role="gridcell" tabindex="-1"> 28 </td> <td role="gridcell" tabindex="-1"> 29 </td> </tr> <tr role="row"> <th scope="row" role="rowheader">Week 40</th> <td role="gridcell" tabindex="-1"> 30 </td> <td>1</td> <td>2</td> <td>3</td> <td>4</td> <td>5</td> <td>6</td> </tr> </tbody> </table> CSS body { margin: 2rem; font-family: "Helvetica Neue", sans-serif; } table { margin: 0; border-collapse: collapse; font-variant-numeric: tabular-nums; } tbody th, tbody td { padding: 5px; } tbody td { border: 1px solid #000; text-align: right; color: #767676; } tbody td[role="gridcell"] { color: #000; } tbody td[role="gridcell"]:hover, tbody td[role="gridcell"]:focus { ...
... 3 </td> <td role="gridcell" tabindex="-1"> 4 </td> <td role="gridcell" tabindex="-1"> 5 </td> <td role="gridcell" tabindex="-1"> 6 </td> <td role="gridcell" tabindex="-1"> 7 </td> <td role="gridcell" tabindex="-1"> 8 </td> </tr> <!-- ... Additional Rows ... ...
Accessibility documentation index - Accessibility
lement during its life-cycle, unless the element already has appropriate ARIA semantics (via use of an appropriate HTML element). Addition of ARIA semantics only exposes extra information to a browser's accessibility API, and does not affect a page's DOM. 14 ARIA Technique Template Accessibility No summary! 15 Using the alert role ARIA, Accessibility, Advanced, CSS, Example, HTML, NeedsContent, alert, alert role, alertrole, alerts, assitive technology, role configuration, wcag1.2.1, wcag3.3.1 The alert role is used to communicate an important and usually time-sensitive message to the user. When this role is added to an element, the browser will send out an accessible alert event to assistive technology products which can then notify the user about it.
...ed to An overview of accessible web applications and widgets. 87 An overview of accessible web applications and widgets ARIA, Accessibility, Guide, Web apps, Widget Most JavaScript libraries offer a library of client-side widgets that mimic the behavior of familiar desktop interfaces. Sliders, menu bars, file list views, and more can be built with a combination of JavaScript, CSS, and HTML. Since the HTML4 specification doesn't provide built-in tags that semantically describe these kinds of widgets, developers typically resort to using generic elements such as and . While this results in a widget that looks like its desktop counterpart, there usually isn't enough semantic information in the markup to be usable by an assistive technology. 88 Architecture Ac...
Keyboard - Accessibility
. That will add the element to the list of elements that can be focused by pressing the Tab key, in the sequence of such elements as defined in the HTML document. See also tabindex global HTML attribute Focusable element must have focus styling Any element that can receive keyboard focus should have visible styling that indicates when the element is focused. ...
...an do this with the :focus CSS pseudo-class. Standard focusable elements such as links and input fields are given special styling by the browser by default, so you might not need to specify focus styling for such elements, unless you want the focus styling to be more distinctive. If you create your own focusable components, be sure that you also define focus styling for them. ...
Perceivable - Accessibility
se. Buttons are simple--you should make sure the button text describes the function of the button (e.g., <button>Upload image</button>). For more information on other UI controls, see UI controls. Implement decorative (non-content) images, video, etc., in a way that is invisible to assistive technology, so it doesn't confuse users. Decorative images should be implemented using CSS background images (see Backgrounds). If you have to include an image via an <img> element, give it a blank alt (alt=""). Otherwise, screenreaders may try to read out the filepath, etc. If you are including background video or audio that autoplays, make it as unobtrusive as possible. Don't make it look/sound like content, and provide a control to turn it off. Ideally, don't include it at all...
...formation about this, but you should particularly 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...
Rich-Text Editing in Mozilla - Developer guides
g). 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. The styleWithCSS command can be used to toggle between CSS and HTML markup creation. Figure 1 : Generated HTML differences Mozilla: <span style="font-weight: bold;">I love geckos.</span> <span style="font-weight: bold; font-style: italic; text-decoration: underline;">Dinosaurs are big.</span> Internet Explorer: <STRONG>I love geckos.</STRONG> <STRONG><EM><U>Dinosaurs are big.</U></EM></STRONG> Another...
...!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();"> <form name="compF...
Using HTML sections and outlines - Developer guides
removed all the other HTML except the <article> element, 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 articl...
...tra steps, and in this section we'll show you how. If a significant percentage of your 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 su...
The Unicode Bidirectional Text Algorithm - Developer guides
he user agent should order characters while rendering Unicode text. Understanding this algorithm in at least basic terms is helpful when you're striving to produce localization-ready web content or apps. ...
... Overiding BiDi using Unicode control characters Unicode provides a number of special control characters that make it possible to control directionality of ranges of text. ...
HTML attribute: rel - HTML: Hypertext Markup Language
Web › HTML › Attributes › rel
s 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 the referenced document is the same content in a different format. For example, with type="application/rss+xml" it creates a hyperlink refe...
...to a resource that can be used to search. If the type attribute is set to application/opensearchdescription+xml the resource is an OpenSearch plugin that can be easily added to the interface of some browsers like Firefox or Internet Explorer. stylesheet Valid for the <link> element, it imports an external resource to be used as a stylesheet. The type attribute is not needed as it's a text/css stylesheet, as that is the default value. If it's not a stylesheet of type text/css it is best to declare the type. While this attribute defines the link as being a stylesheet, the interaction with other attributes and other keyterms within the rel value impact whether the stylesheet is downloaded and / or used. When used with the alternate keyword, it defines an alternative style sheet. In t...
<abbr>: The Abbreviation element - HTML: Hypertext Markup Language
Web › HTML › Element › abbr
ault, 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. ...
...aps; 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 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"...
<b>: The Bring Attention To element - HTML: Hypertext Markup Language
Web › HTML › Element › b
The HTML Bring Attention To element (<b>) is used to draw the reader's attention to the element's contents, which are not otherwise granted special importance. This was formerly known as the Boldface element, and most browsers still draw the text in boldface. However, you should not use <b> for styling text; instead, you should use the CSS font-weight property to create boldface text, or the <strong> element to indicate that text is of special importance. 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 Phr...
...graph). This makes it easier to manage multiple use cases of <b> if your stylistic needs change, without the need to change all of its uses in the HTML. Historically, the <b> element was meant to make text boldface. Styling information has been deprecated since HTML4, so the meaning of the <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 C...
<basefont> - HTML: Hypertext Markup Language
Web › HTML › Element › basefont
The obsolete HTML Base Font element (<basefont>) sets a default font face, size, and color for the other elements which are descended from its parent element. With this set, the font's size can then be varied relative to the base size using the <font> element. You should not use this element; instead, you should use CSS properties such as font, font-family, font-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 fa...
...s 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="#FF0000" face="Helvetica" size="+2" /> ...
<big>: The Bigger Text element - HTML: Hypertext Markup Language
Web › HTML › Element › big
The obsolete HTML Big Element (<big>) renders the enclosed text at a font size one level larger than the surrounding text (medium becomes large, for example). The size is capped at the browser's maximum permitted font size. Usage note: As it was purely presentational, this element has been removed in HTML5 and shouldn't be used anymore. Instead web developers should use the CSS font-size property to adjust the font size. Attributes This element has no other attributes than the global attributes, common to all elements. Examples Here we see examples showing the use of <big> followed by an example showing how to accomplish the same results using modern CSS syntax instead. Using <big> This example uses the obsolete <big> element to increase the size of some text. HTML <p> This i...
...utes, common to all elements. Examples Here we see examples showing the use of <big> followed by an example showing how to accomplish the same results using modern CSS syntax instead. Using <big> This example uses the obsolete <big> element to increase the size of some text. HTML <p> This is the first sentence. <big>This whole sentence is in bigger letters.</big> </p> Result Using CSS font-size This example uses the CSS font-size property to increase the font size by one level. CSS .bigger { font-size: larger; } HTML <p> This is the first sentence. <span class="bigger">This whole sentence is in bigger letters.</span> </p> Result DOM interface This element implements the HTMLElement interface. Implementation note: Up to Gecko 1.9.2 inclusive, Firefox implements...
<br>: The Line Break element - HTML: Hypertext Markup Language
Web › HTML › Element › br
ples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. As you can see from the above example, a <br> element is included at each point where we want the text to break. The text after the <br> begins again at the start of the next line of the text block. Note: Do not use <br> to create margins between paragraphs; wrap them in <p> elements and use the CSS margin property 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 littl...
...cessibility concerns Creating separate paragraphs of text using <br> is not only bad practice, it is problematic for people who navigate with the aid of screen reading technology. Screen readers may announce the presence of the element, but not any content contained within <br>s. This can be a confusing and frustrating experience for the person using the screen reader. Use <p> elements, and use CSS properties like margin to control their spacing. Technical summary Content categories Flow content, phrasing content. Permitted content None, it is an empty element. Tag omission Must have a start tag, and must not have an end tag. In XHTML documents, write this element as <br />. Permitted parents Any element that accepts phrasing content. ...
<canvas>: The Graphics Canvas element - HTML: Hypertext Markup Language
Web › HTML › Element › canvas
g 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 HTMLCanvasElement Attributes This element's attributes include the global attributes. height The height of the coordinate space in CSS pixels. Defaults to 150. moz-opaque Lets the canvas know whether or not translucency will be a factor. If the canvas knows there's no translucency, painting performance can be optimized. This is only supported by Mozilla-based browsers; use the standardized canvas.getContext('2d', { alpha: false }) instead. width The width of the coordinate space in CSS pixels. Defaults to 300. Usage no...
... provide alternate content inside the <canvas> block. That content will be rendered both on older browsers that don't support canvas and in browsers 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. ...
<center>: The Centered Text element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › center
The obsolete HTML Center Element (<center>) is a block-level element that displays its block-level or inline contents centered horizontally within its containing element. The container is usually, but isn't required to be, <body>. This tag has been deprecated in HTML 4 (and XHTML 1) in favor of the CSS text-align property, which can be applied to the <div> element or to an individual <p>. For centering blocks, use other CSS properties 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> E...
...cks, use other CSS properties 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. ...
<dl>: The Description List element - HTML: Hypertext Markup Language
Web › HTML › Element › dl
multiple terms with multiple corresponding descriptions, by combining the examples above. Metadata Description lists are useful for displaying metadata as a list of key-value pairs. <dl> <dt>Name</dt> <dd>Godzilla</dd> <dt>Born</dt> <dd>1952</dd> <dt>Birthplace</dt> <dd>Japan</dd> <dt>Color</dt> <dd>Green</dd> </dl> Tip: It can be handy to define a key-value separator in the CSS, such as: dt::after { content: ": "; } Wrapping name-value groups in <div> elements WHATWG HTML allows wrapping each name-value group in a <dl> element in a <div> element. This can be useful when using microdata, or when global attributes apply to a whole group, or for styling purposes. <dl> <div> <dt>Name</dt> <dd>Godzilla</dd> </div> <div> <dt>Born</dt> <dd>1952</dd>...
...t>Born</dt> <dd>1952</dd> </div> <div> <dt>Birthplace</dt> <dd>Japan</dd> </div> <div> <dt>Color</dt> <dd>Green</dd> </div> </dl> Notes Do not use this element (nor <ul> elements) to merely create indentation on a page. Although it works, this is a bad practice and obscures the meaning of description lists. To change the indentation of a description term, use the CSS margin property. Accessibility concerns Each screen reader announces <dl> content differently. Some screen readers, such as VoiceOver on iOS, will not announce that <dl> content is a list. Because of this, make sure each list item's content is written in such a way that it communicates its relationship to the other list items in the list grouping. CodePen - HTML Buddies: dt & dd Specificat...
<em>: The Emphasis element - HTML: Hypertext Markup Language
Web › HTML › Element › em
Attributes 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 dev...
... represents text that is set off from the normal prose, such a foreign word, fictional character thoughts, or when the text refers to the definition of a word instead of representing its semantic meaning. (The title of a work, such as the name of a book or movie, should use <cite>.) This means the right one to use depends on the situation. Neither is for purely decorational purposes, that's what CSS styling is for. An example for <em> could be: "Just do it already!", or: "We had to do something about it". A person or software reading the text would pronounce the words in italics with an emphasis, using verbal stress. An example for <i> could be: "The Queen Mary sailed last night". Here, there is no added emphasis or importance on the word "Queen Mary". It is merely indicated that the objec...
<input type="date"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › date
April 2017 can't be selected in tte picker widget. Note: You should be able to use the step attribute to vary the number of days jumped each time the date is incremented (e.g. to only make Saturdays selectable). However, this does not seem to be in any implementation at the time of writing. Controlling input size <input type="date"> doesn't support form sizing attributes such as size. Prefer CSS for sizing it. Validation By default, <input type="date"> doesn't validate the entered value beyond its format. The interfaces generally don't let you enter anything that isn't a date -- which is helpful -- but you can leave the field empty or enter an invalid date in browsers where the input falls back to type text (like the 32nd of April). If you use min and max to restrict the available dat...
...arty" min="2017-04-01" max="2017-04-20" required> <span class="validity"></span> </label> <p> <button>Submit</button> </p> </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. 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...
<input type="datetime-local"> - HTML: Hypertext Markup Language
ould be able to use the step attribute to vary the number of days jumped each time the date is incremented (e.g. maybe you only want to make Saturdays selectable). However, this does not seem to work effectively in any implementation at the time of writing. Controlling input size <input type="datetime-local"> doesn't support form control sizing attributes such as size. You'll have to resort to CSS for customizing the sizes of these elements. Setting timezones One thing the datetime-local input type doesn't provide is a way to set the time zone and/or locale of the date/time control. This was available in the datetime input type, but this type is now obsolete, having been removed from the spec. The main reasons why this was removed are a lack of implementation in browsers, and concerns ov...
...16:30" required> <span class="validity"></span> </div> <div> <input type="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: ...
<input type="email"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › email
nteractive 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 input value is automatically validated to ensure that it's either empty or a properly-formatted e-mail address (or list of addresses) before the form can be submitted. The :valid and :invalid CSS pseudo-classes are automatically applied as appropriate to visually denote whether the current value of the field is a valid e-mail address or not. On browsers that don't support inputs of type email, a email input falls back to being a standard text input. Value A DOMString representing an e-mail address, or empty Events change and input Supported Common Attrib...
...ddresses is entered 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-...
<input type="month"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › month
s outside that range can't be scrolled to in the control. Depending on what browser you are using, you might find that months outside the specified range might not be selectable in the month picker (e.g. Edge), or invalid (see Validation) but still available (e.g. Chrome). Controlling input size <input type="month"> doesn't support form sizing attributes such as size. You'll have to resort to CSS for sizing needs. Validation By default, <input type="month"> does not apply any validation to entered values. The UI implementations generally don't let you enter anything that isn't a date -- which is helpful -- but you can still submit the form with the month input empty, or enter an invalid date (e.g. the 32nd of April). To help avoid this, you can use min and max to restrict the available...
... required> <span class="validity"></span> </div> <div> <input type="submit" value="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: rel...
<input type="tel"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › tel
t an empty input is invalid and won't be submitted to the server using the required attribute. ...
...lid+span:after { position: absolute; content: '?'; padding-left: 5px; color: #009000; } The output looks like this: Pattern validation If you want to further restrict entered numbers so they also have to conform to a specific pattern, you can use the pattern attribute, which takes as its value a regular expression that entered values have to match. ...
<input type="time"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › time
me"> involves a basic <input> and <label> element combination, as seen below: <form> <label for="appt-time">Choose an appointment time: </label> <input id="appt-time" type="time" name="appt-time"> </form> Controlling input size <input type="time"> doesn't support form sizing attributes such as size, since times are always about the same number of characters long. You'll have to resort to CSS for sizing needs. Using the step attribute You can use the step attribute to vary the amount of time jumped whenever the time is incremented or decremented (for example, so the time moves by 10 minutes at a time when clicking the little arrow widgets). This property has some strange effects across browsers, so is not completely reliable. It takes an integer value that equates to the number ...
...tes to restrict the valid times that can be chosen by the user. In the following example we are 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: rel...
<input type="week"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › week
browser support). Basic uses of week The simplest use of <input type="week"> involves a basic <input> and <label> element combination, as seen below: <form> <label for="week">What week would you like to start?</label> <input id="week" type="week" name="week"> </form> Controlling input size <input type="week"> doesn't support form sizing attributes such as size. You'll have to resort to CSS for sizing needs. Using the step attribute You should be able to use the step attribute to vary the number of weeks jumped whenever they are incremented or decremented, however it doesn't seem to have any effect on supporting browsers. Validation By default, <input type="week"> does not apply any validation to entered values. The UI implementations generally don't let you specify anything tha...
... and max attributes to restrict the valid weeks that can be chosen by the user. In the following 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: rel...
<label> - HTML: Hypertext Markup Language
Web › HTML › Element › label
ol for this label element, if it is a labelable element. If it is not labelable then the for attribute has no effect. If there are other 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" at...
... id="tac" type="checkbox" name="terms-and-conditions"> I agree to the Terms and Conditions </label> <p> <a href="terms-and-conditions.html">Read our Terms and Conditions</a> </p> Headings Placing heading elements within a <label> interferes with many kinds of assistive technology, because headings are commonly used as a navigation aid. If the label's text needs to be adjusted visually, use CSS classes applied to the <label> element instead. If a form, or a section of a form needs a title, use the <legend> element placed within a <fieldset>. Don't <label for="your-name"> <h3>Your name</h3> <input id="your-name" name="your-name" type="text"> </label> Do <label class="large-label" for="your-name"> Your name <input id="your-name" name="your-name" type="text"> </label> Butto...
<mark>: The Mark Text element - HTML: Hypertext Markup Language
Web › HTML › Element › mark
like using a highlighter pen in a book to mark passages that you find of interest. Otherwise, <mark> indicates a portion of the document's content which is likely to be relevant to the user's current activity. This might be used, for example, to indicate the words that matched a search operation. Don't use <mark> for syntax highlighting purposes; instead, use the <span> element with appropriate CSS applied to it. Don't confuse <mark> with the <strong> element; <mark> is used to denote content which has a degree of relevance, while <strong> indicates spans of text of importance. Examples Marking text of interest In this first example, a <mark> element is used to mark some text within a quote which is of particular interest to the user. <blockquote> It is a period of civil war. Rebe...
...e on the remote ice world of Hoth.</p> To help distinguish the use of <mark> for search results from other potential usage, this example applies the custom class "match" to each match. The results look like this: Accessibility concerns The presence of the mark 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. mark::before, mark::after { clip-path: inset(100%); clip: rect(1px, 1px, 1px, 1px); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; } mark::before { content: " [highlight start] "; } mark::after { content: " [highlight end] "; } Some people who use screen readers delib...
<marquee>: The Marquee element (Obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › marquee
ttom 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. ...
... <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 marquee features of CSS have since been abandoned. HTML5The definition of '<marquee>' in that specification. Recommendation Make it obsolete in favor of CSS but define its expected behavior, for backward compatibility. However, the development of the marquee features of CSS have since been abandoned. ...
<object> - HTML: Hypertext Markup Language
Web › HTML › Element › object
aration only. The object must be instantiated by a subsequent <object> element. In HTML5, repeat the <object> element completely each that that the resource is reused. formHTML5 The form element, if any, that the object element is associated with (its form owner). The value of the attribute must be an ID of a <form> element in the same document. height The height of the displayed resource, in CSS pixels. -- (Absolute values only. NO percentages) name The name of valid browsing context (HTML5), or the name of the control (HTML 4). standbyHTML 4 onlyObsolete since HTML5 A message that the browser can show while loading the object's implementation and data. tabindexHTML 4 onlyObsolete since HTML5 The position of the element in the tabbing navigation order for the current document. typ...
... content type of the resource specified by data. At least one of data and type must be defined. typemustmatchHTML5 This Boolean attribute indicates if the type attribute and the actual content type of the resource must match to be used. usemap A hash-name reference to a <map> element; that is a '#' followed by the value of a name of a map element. width The width of the display resource, in CSS pixels. -- (Absolute values only. NO percentages) Examples Embed a flash movie <!-- Embed a flash movie --> <object data="movie.swf" type="application/x-shockwave-flash"></object> <!-- Embed a flash movie with parameters --> <object data="movie.swf" type="application/x-shockwave-flash"> <param name="foo" value="bar"> </object> Specifications Specification Status Comment...
<small>: the side comment element - HTML: Hypertext Markup Language
Web › HTML › Element › small
element that accepts phrasing content, or any element that 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 ...
... ...
<strong>: The Strong Importance element - HTML: Hypertext Markup Language
Web › HTML › Element › strong
ortance," including things of great seriousness or urgency (such as warnings). This could be a sentence that is of great importance to the whole page, or you could merely try to point out that some words are of greater importance compared to nearby content. Typically this element is rendered by default using a bold font weight. However, it should not be used simply to apply bold styling; use the CSS font-weight property for that purpose. Use the <b> element to draw attention to certain text without indicating a higher level of importance. Use the <em> element to mark text that has stress emphasis. Another accepted use for <strong> is to denote the labels of paragraphs which represent notes or warnings within the text of a page. <b> vs. <strong> It is often confusing to new developers why ...
... important. It may help to realize that both are valid and semantic elements in HTML5 and that it's a coincidence that they both have the same default styling (boldface) in most browsers (although some older browsers actually underline <strong>). Each element is meant to be used in certain types of scenarios, and if you want to bold text simply for decoration, you should instead actually use the CSS font-weight property. The intended meaning or purpose of the enclosed text should be what determines which element you use. Communicating meaning is what semantics are all about. <em> vs. <strong> Adding to the confusion is the fact that while HTML 4 defined <strong> as simply indicating a stronger emphasis, HTML 5 defines <strong> as representing "strong importance for its contents." This is ...
<table>: The Table element - HTML: Hypertext Markup Language
Web › HTML › Element › table
ment; right: the table is displayed on the right side of the document. Set margin-left and margin-right to auto or margin to 0 auto to achieve an effect that is similar to the align attribute. bgcolor The background color of the table. It is a 6-digit hexadecimal RGB code, prefixed by a '#'. One of the predefined color kewords can also be used. To achieve a similar effect, use the CSS background-color property. border This integer attribute defines, in pixels, the size of the frame surrounding the table. If set to 0, the frame attribute is set to void. To achieve a similar effect, use the CSS border shorthand property. cellpadding This attribute defines the space between the content of a cell and its border, displayed or not. If the cellpadding's length is de...
...will cause the rules to be displayed between rows and columns. To achieve a similar effect, apply the border property to the appropriate <thead>, <tbody>, <tfoot>, <col>, or <colgroup> elements. summary This attribute defines an alternative text that summarizes the content of the table. Use the <caption> element instead. width This attribute defines the width of the table. Use the CSS width property instead. Examples Simple Table <table> <tr> <td>John</td> <td>Doe</td> </tr> <tr> <td>Jane</td> <td>Doe</td> </tr> </table> More Examples <p>Simple table with header</p> <table> <tr> <th>First name</th> <th>Last name</th> </tr> <tr> <td>John</td> <td>Doe</td> </tr> <tr> <td>Jane</td> <td>Doe</td> </tr> </table> ...
<textarea> - HTML: Hypertext Markup Language
Web › HTML › Element › textarea
is to take effect. soft: The browser ensures that all line breaks in the value consist of a CR+LF pair, but does not insert any additional line breaks. off : Like soft but changes appearance 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 ...
...irst line, on another browser it may be set on the bottom of the <textarea> box. Don't use vertical-align: baseline on it; the behavior is unpredictable. Controlling whether a textarea is resizable In most browsers, <textarea>s are resizable -- you'll notice the drag handle in the right hand corner, which can be used to alter the size of the element on the page. This is controlled by the resize CSS property -- resizing is enabled by default, but you can explicitly disable it using a resize value of none: textarea { resize: none; } Styling valid and invalid values Valid and invalid values of a <textarea> element (e.g. those within, and outside the bounds set by minlength, maxlength, or required) can be highlighted using the :valid and :invalid pseudo-classes. For example, to give your ...
HTML elements reference - HTML: Hypertext Markup Language
Web › HTML › Element
ute, while a text representation of the source can be given using the <cite> element. <dd> The HTML <dd> element provides the description, definition, or value for the preceding term (<dt>) in a description list (<dl>). <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. <dl> The HTML <dl> element represents a description list. The element encloses a list of groups of terms (specified using the <dt> element) and descriptions (provided by <dd> elements). Common uses for this element are to implement a glossary or to display metadata (a list of key-value pairs). <dt> The HTML <dt> element specifies a term in a description or definition ...
...spacer> is an obsolete HTML element which allowed insertion of empty spaces on pages. It was devised by Netscape to accomplish the same effect as a single-pixel layout image, which was something web designers used to use to add white spaces to web pages without actually using an image. However, <spacer> no longer supported by any major browser and the same effects can now be achieved using simple CSS. <strike> The HTML <strike> element (or HTML Strikethrough Element) places a strikethrough (horizontal line) over text. <tt> The obsolete HTML Teletype Text element (<tt>) creates inline text which is presented using the user agent's default monospace font face. <xmp> The HTML Example Element (<xmp>) renders text between the start and end tags without in...
hidden - HTML: Hypertext Markup Language
useful on their own, they could be written in such a way that they are useful in the specific context of being 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 HT...
...ute'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 suggested default rendering of the hidden attribute using CSS HTML 5.1The definition of 'hidden' in that specification. Recommendation Snapshot of HTML Living Standard, initial definition ...
style - HTML: Hypertext Markup Language
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. 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. ...
...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. ...
HTML: Hypertext Markup Language
Web › HTML
"Hypertext" refers to links that connect web pages to one another, either within a single website or between websites. Links are a fundamental aspect of the Web. ...
... content, each of which is allowed to be used in certain contexts and is disallowed in others. Similarly, each has a set of other content categories they can contain and elements that can or can't be used in them. This is a guide to these categories. Quirks mode and standards mode Historical information on quirks mode and standards mode. Related topics Applying color to HTML elements using CSS This article covers most of the ways you use CSS to add color to HTML content, listing what parts of HTML documents can be colored and what CSS properties to use when doing so. Includes examples, links to palette-building tools, and more. View All... ...
MIME types (IANA media types) - HTTP
opose a "Save As" dialog. text/plain This is the default for textual files. Even if it really means "unknown textual file," browsers assume they can display 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. ...
...he default for textual files. Even if it really means "unknown textual file," browsers assume they can display 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 b...
Resource URLs - HTTP
Resource URLs, URLs prefixed with the resource: scheme, are used by Firefox and Firefox browser extensions to load resources internally, but some of the information is available to sites the browser connects to as well. Syntax Resource URLs are composed of two parts: a prefix (resource:), and a URL pointing to the resource you want to load: resource://<url> An example: resource://gre/res/svg.css When arrows are found in the resource URL's ('->'), it means that the first file loaded the next one: resource://<File-loader> -> <File-loaded> Please refer to Identifying resources on the web for more general details. In this article, we focus on resource URIs, which are used internally by Firefox to point to built-in resources. Threats Because some of the information shared by resource: U...
...le to access whatever resource: URIs were desired -- not only Firefox's internal resources, but also extensions' assets. Now this behavior is prohibited by default. It is however still necessary for Firefox to load resources in web content under certain circumstances. For example, if you open the view source page (View Page Source or View Selection Source), you will find it requires viewsource.css through a resource: URI. Resources that have to be exposed to web content have been moved to a new location named resource://content-accessible/, which is isolated and only contains non-sensitive resources. In this way we can keep essential resources exposed and have most threats eliminated. Note: It is recommended that web and extension developers don't try to use resource URLs anymore. Thei...
Index - HTTP
Web › HTTP › Headers › Index
r 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 inform...
..., it is a way to say that the webmasters knew what they were doing. 117 X-DNS-Prefetch-Control DNS, HTTP, header The X-DNS-Prefetch-Control HTTP response header controls DNS prefetching, a feature by which browsers proactively perform domain name resolution on both links that the user may choose to follow as well as URLs for items referenced by the document, including images, CSS, JavaScript, and so forth. 118 X-Forwarded-For HTTP, HTTP Header, Non-standard, Reference, Request header, header The X-Forwarded-For (XFF) header is a de-facto standard header for identifying the originating IP address of a client connecting to a web server through an HTTP proxy or a load balancer. When traffic is intercepted between clients and servers, server access logs c...
JavaScript technologies overview - JavaScript
However, the umbrella term "JavaScript" as understood in a web browser context contains several very different elements. One of them is the core language (ECMAScript), another is the collection of the Web APIs, including the DOM (Document Object Model). JavaScript, the core language (ECMAScript) The core language of JavaScript is standardized by the ECMA TC39 committee as a language named ECMAScript. This core language is also used in non-browser environments, for example in node.js. ...
...In general, it also forbids using elements and attributes that aren't defined in a standard. Looking for the Document object, Window object, and the other DOM elements? Read the DOM documentation. Other notable APIs The setTimeout and setInterval functions were first specified on the Window interface in HTML Standard. XMLHttpRequest makes it possible to send asynchronous HTTP requests. The CSS Object Model abstract CSS rules as objects. WebWorkers allows parallel computation. WebSockets allows low-level bidirectional communication. Canvas 2D Context is a drawing API for <canvas>. ...
String.prototype.fontcolor() - JavaScript
Return value A string containing a <font> HTML element. ...
... Return value A string containing a <font> HTML element. Description If you express color as a hexadecimal RGB triplet, you must use the format rrggbb. ...
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. ...
... Examples "background_color": "red" Specification Specification Status Comment Feedback Web App ManifestThe definition of 'background_color' in that specification. ...
<mfrac> - MathML
Web › MathML › Element › mfrac
umerator 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 length values. The values medium, thin, and thick are deprecated and will be removed in the future. mathbackground The background color. You can use #rgb, #rrggbb and HTML color names. mathcolor The text color and also the fraction ...
... in the future. 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. numalign The alignment of the numerator over 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. Examples Sample rendering: Your browser rendering: a b c d <math> <mfrac bevelled="true"> <mfrac> <mi> a </mi> <mi> b </mi> </mfrac> <mfrac> <mi> c </mi> <mi> d </mi> </mfrac> </mfrac> </math> Specifications Specification Status Comment MathML 3.0The definition of 'mfr...
Image file type and format guide - Web media technologies
mlns="http://www.w3.org/2000/svg"> <line x1="0" y1="80" x2="100" y2="20" stroke="black" /> </svg> SVG can be used in web content in two ways: You can directly write the <svg> element within the HTML, containing SVG elements to draw the image. You can display an SVG image anywhere you can use any of the other image types, including with the <img> and <picture> elements, the background-image CSS property, and so forth. SVG is an ideal choice for images which can be represented using a series of drawing commands, especially if the size at which the image will be rendered is unknown or may vary, since SVG will smoothly scale to the desired size. It's not generally useful for strictly bitmap or photographic images, although it is possible to include bitmap images within an SVG. ...
... Compression SVG source may be compressed during transit using HTTP compression techniques, or on disk as an .svgz file. Licensing (C)2018 W3C(R) (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C liability, trademark, document use and software licensing rules apply. No known royalty-bearing patents. TIFF (Tagged Image File Format) TIFF is a raster ...
Navigation and resource timings - Web Performance
navigation and resource timings respectively. Navigation Timing When a user requests a web site or application, to populate the browser the user agent goes through a series of steps, including a DNS lookup, TCP handshake, and SSL negotiation, before the user agent makes the actual request and the servers return the requested assets. The browser then parses the content received, builds the DOM, CSSOM, accessibility, and render trees, eventually rendering the page. Once the user agent stops parsing the document, the user agent sets the document readiness to interactive. If there are deferred scripts needing to be parsed, it will do so, then fire the DOMContentLoaded, after which the readiness is set to complete. The Document can now handle post-load tasks, after which point the document is m...
...te that this is the size for this single document alone: for this resource alone, not for all the resources combined. However, the duration, load events and DOM related timings have to do with the entire navigation, not this single asset. Client-side web applications may seem faster than this one with transfer sizes under 10000 and decoded body sizes under 30000, but that doesn't mean JavaScript, CSS, or media assets aren't adding bloat. Checking compression ratios is important but ensure to also check duration and the time between when the DOMContentLoaded event ended and when the DOM is complete, as running JavaScript on the main thread for long periods of time can lead to a non-responsive user interface. Request time The API doesn't provide every measurement you may desire. For example, ...
SVG Core Attributes - SVG: Scalable Vector Graphics
Web › SVG › Attribute › Core
The SVG core attributes are all the common attributes that can be specified on any SVG element. id lang tabindex xml:base xml:lang xml:space Attributes id Defines a unique identifier (ID) which must be unique in the whole document. Its purpose is to identify the element when linking (using a fragment identifier), scripting, or styling (with CSS). Value: Any valid ID string; Animatable: No lang Participates in defining the language of the element, the language that non-editable elements are written in or the language that editable elements should be written in. The tag contains one single entry value in the format defined in the Tags for Identifying Languages (BCP47) IETF document. SVG 2 introduce the new lang attributes. If both lang and xml:lang attribute are...
...s. If both lang and xml:lang attribute are used, xml:lang has priority over lang. Value: Any valid language ID; Animatable: No xml:space Deprecated since SVG 2 SVG supports the standard XML attribute xml:space to specify the handling of white space characters within a given <text> element's character data. Note: Instead of using the xml:space attribute you should use the white-space CSS property. Value: default | preserve; Animatable: No ...
class - SVG: Scalable Vector Graphics
Web › SVG › Attribute › class
lass 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 differently, lists within SVG's XML attributes can be either comma-separa...
...-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. ...
clip - SVG: Scalable Vector Graphics
Web › SVG › Attribute › clip
Unitless values, which indicate current user coordinates, are permitted on the coordinate values on the rect(). The value of auto defines a clipping path along the bounds of the viewport created by the given element. ...
...y the given element.The value rect() defines a clipping rectangle following the following syntax: rect(<top>, <right>, <bottom>, <left>). The <top> and <bottom> values specify offsets from the top border edge of the element viewport, while <right> and <left> specify offsets from the left border edge of the element viewport. Specifications Specification Status Comment CSS Masking Module Level 1The definition of 'clip' in that specification. Candidate Recommendation Deprecates clip property, suggests clip-path as replacement. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'clip' in that specification. Recommendation Initial definition ...
color - SVG: Scalable Vector Graphics
Web › SVG › Attribute › color
As a presentation attribute, it can be applied to any element, but as noted above, it has no direct effect on SVG elements. ...
... As a presentation attribute, it can be applied to any element, but as noted above, it has no direct effect on SVG elements. ...
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) ...
...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) <FuncIRI> Functional notation for a reference. The syntax for this reference is the same as the css uri. Elements The following elements can use the cursor attribute Container elements >> Graphics elements >> 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. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafa...
dominant-baseline - SVG: Scalable Vector Graphics
value, auto, would give an undesired result, this property can be used to explicitly set the desired scaled-baseline-table. If there is no baseline table in the nominal font, or if the baseline table lacks an entry for the desired baseline, then the browser may use heuristics to determine the position of the desired baseline. Note: As a presentation attribute, dominant-baseline can be used as a CSS property. See css dominant-baseline for further information. As a presentation attribute, it can be applied to any element but it only has effect on the text content elements, including: <altGlyph>, <text>, <textPath>, <tref>, and <tspan> html, body, svg { height: 100%; } text { font: bold 14px Verdana, Helvetica, Arial, sans-serif; } <svg viewBox="0 0 200 120" xmlns="http://www.w3.org...
...ica, Arial, sans-serif; } ]]></style> </svg> Result Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'dominant-baseline' in that specification. 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 'dominant-baseline' in that specification. Working Draft Removed the values use-script, no-change, and reset-size and introduced the text-top value. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'dominant-baseline' in that specification. Recommendation Initial definition Browser compatibility The compatibility tabl...
fill-opacity - SVG: Scalable Vector Graphics
The fill-opacity attribute is a presentation attribute defining the opacity of the paint server (color, gradient, pattern, etc) applied to a shape. Note: As a presentation attribute fill-opacity can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following eleven elements: <altGlyph>, <circle>, <ellipse>, <path>, <polygon>, <polyline>, <rect>, <text>, <textPath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewBox="0 0 400 100" xmlns="http://www.w3.org/2000/svg"> <!-- Default fill opacity: 1 --> <circle cx="50" cy="50" r="40" /> <!-- Fill opacity as a number --> <circle cx="150" cy="50" r="40" fill-opacity="0.7" /> <!-- Fill opacity as a percentage --> <circle cx="250" cy="50" r="...
...ml,body,svg { height:100% } <svg viewBox="0 0 400 100" xmlns="http://www.w3.org/2000/svg"> <!-- Default fill opacity: 1 --> <circle cx="50" cy="50" r="40" /> <!-- Fill opacity as a number --> <circle cx="150" cy="50" r="40" fill-opacity="0.7" /> <!-- Fill opacity as a percentage --> <circle cx="250" cy="50" r="40" fill-opacity="50%" /> <!-- Fill opacity as a CSS property --> <circle cx="350" cy="50" r="40" style="fill-opacity: .25;" /> </svg> Usage notes Value [0-1] | <percentage> Default value 1 Animatable Yes Note: SVG2 introduces percentage values for fill-opacity, however, it is not widely supported yet (See Browser compatibility below) as a consequence, it is best practices to set opacity w...
filter - SVG: Scalable Vector Graphics
Web › SVG › Attribute › filter
See css filter for further information. As a presentation attribute, it can be applied to any element but it only has effect on container elements without the <defs> element, all graphics elements and the <use> element. ...
... Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'filter' in that specification. Working Draft Extended the values by several special filter functions. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'filter' in that specification. Recommendation Initial definition ...
flood-color - SVG: Scalable Vector Graphics
The flood-color attribute indicates what color to use to flood the current filter primitive subregion. Note: As a presentation attribute, flood-color can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following two elements: <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)...
... Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'flood-color' in that specification. Recommendation Initial definition ...
flood-opacity - SVG: Scalable Vector Graphics
The flood-opacity attribute indicates the opacity value to use across the current filter primitive subregion. Note: As a presentation attribute, flood-opacity can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following two elements: <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="seagreen" flood-opacity="1" x="0" y="0" width="200" height="200"/> </filter> <filter id="flood2"> <feFlood flood-color="seagreen" flood-opacity="0.3" 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" widt...
...ng the opacity value to use across the current filter primitive subregion. A number of 0 or a percentage of 0% represents a fully transparent color, 1 or 100% represents a fully opaque color. Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'flood-opacity' in that specification. Working Draft Aligned the value to the CSS <alpha-value> value. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'flood-opacity' in that specification. Recommendation Initial definition ...
paint-order - SVG: Scalable Vector Graphics
The paint-order attribute specifies the order that the fill, stroke, and markers of a given shape or text element are painted. Note: As a presentation attribute, paint-order can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following ten elements: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, <rect>, <text>, <textPath>, and <tspan> Usage notes Value normal | [ fill || stroke || markers ] Default value normal Animatable Yes normal This value indicates that the fill will be painted first, then the stroke, and finally the markers. [ fill || stroke || markers ] The order of these three keywords indicates the order in which the painting happens, from left to r...
... Candidate Recommendation Initial definition ...
rx - SVG: Scalable Vector Graphics
Web › SVG › Attribute › rx
" width="60" height="60" rx="150" ry="15"/> </svg> ellipse For <ellipse>, rx defines the x-radius of the shape. With a value lower or equal to zero the ellipse won't be drawn at all. Value <length> | <percentage> | auto Default value auto Animatable Yes Note: Starting with SVG2, rx is a Geometry Property meaning this attribute can also be used as a CSS property for ellipses. rect For <rect>, rx defines the x-axis radius of the ellipse used to round off the corners of the rectangle. The way the value of the rx attribute is interpreted depend on both the ry attribute and the width of the rectangle: If a properly specified value is provided for rx but not for ry (or the opposite), then the browser will consider the missing value equal to the...
...ll draw a rectangle with square corners. If rx is greater than half of the width of the rectangle, then the browser will consider the value for rx as half of the width of the rectangle. Value <length> | <percentage> | auto Default value auto Animatable Yes Note: Starting with SVG2, rx is a Geometry Property meaning this attribute can also be used as a CSS property for rects. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'rx' in that specification. Candidate Recommendation Definition as a geometry property Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'rx' in that specification. Recommendation Initial definition for <ellipse> ...
ry - SVG: Scalable Vector Graphics
Web › SVG › Attribute › ry
" width="60" height="60" ry="150" rx="15"/> </svg> ellipse For <ellipse>, ry defines the y-radius of the shape. With a value lower or equal to zero the ellipse won't be drawn at all. Value <length> | <percentage> | auto Default value auto Animatable Yes Note: Starting with SVG2, ry is a Geometry Property meaning this attribute can also be used as a CSS property for ellipses. rect For <rect>, ry defines the y-axis radius of the ellipse used to round off the corners of the rectangle. The way the value of the ry attribute is interpreted depend on both the rx attribute and the width of the rectangle: If a properly specified value is provided for ry but not for rx (or the opposite), then the browser will consider the missing value equal to the...
...ll draw a rectangle with square corners. If ry is greater than half of the width of the rectangle, then the browser will consider the value for ry as half of the width of the rectangle. Value <length> | <percentage> | auto Default value auto Animatable Yes Note: Starting with SVG2, ry is a Geometry Property meaning this attribute can also be used as a CSS property for rects. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'ry' in that specification. Candidate Recommendation Definition as a geometry property Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'ry' in that specification. Recommendation Initial definition for <ellipse> ...
stop-color - SVG: Scalable Vector Graphics
The stop-color attribute indicates what color to use at a gradient stop. Note: With respect to gradients, SVG treats the transparent keyword differently than CSS. SVG does not calculate gradients in pre-multiplied space, so transparent really means transparent black. So, specifying a stop-color with the value transparent is equivalent to specifying a stop-color with the value black and a stop-opacity with the value 0. Note: As a presentation attribute, stop-color can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following element: <stop> Usage notes Value currentcolor | <color> <icccolor> Default value black Animatable Yes currentcolor This keyword denotes the current...
...ll and stroke attributes. <color> This value indicates a color value. <icccolor> This value refers to an ICC color profile. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'stop-color' in that specification. Candidate Recommendation Added a note that in SVG the transparent keyword is treated differently than in CSS. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'stop-color' in that specification. Recommendation Initial definition ...
stop-opacity - SVG: Scalable Vector Graphics
The stop-opacity attribute defines the opacity of a given color gradient stop. The opacity value used for the gradient calculation is the product of the value of stop-opacity and the opacity of the value of the stop-color attribute. For stop-color values that don't include explicit opacity information, the opacity is treated as 1. Note: As a presentation attribute, stop-opacity can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following element: <stop> Usage notes Value <opacity-value> Default value 1 Animatable Yes <opacity-value> This value is either a <number> between 0 and 1 or a <percentage> value specifying the opacity of the color gradient stop. Specifications ...
...1 Animatable Yes <opacity-value> This value is either a <number> between 0 and 1 or a <percentage> value specifying the opacity of the color gradient stop. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'stop-opacity' in that specification. Candidate Recommendation Refers to the definition in CSS Colors 3, but allows percentage values. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'stop-opacity' in that specification. Recommendation Initial definition ...
stroke-opacity - SVG: Scalable Vector Graphics
The stroke-opacity attribute is a presentation attribute defining the opacity of the paint server (color, gradient, pattern, etc) applied to the stroke of a shape. Note: As a presentation attribute stroke-opacity can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following twelve elements: <altGlyph>, <circle>, <ellipse>, <path>, <line>, <polygon>, <polyline>, <rect>, <text>, <textPath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewBox="0 0 40 10" xmlns="http://www.w3.org/2000/svg"> <!-- Default stroke opacity: 1 --> <circle cx="5" cy="5" r="4" stroke="green" /> <!-- Stroke opacity as a number --> <circle cx="15" cy="5" r="4" stroke="green" stroke-opacity="0.7" /> <!-- Stroke op...
...0 40 10" xmlns="http://www.w3.org/2000/svg"> <!-- Default stroke opacity: 1 --> <circle cx="5" cy="5" r="4" stroke="green" /> <!-- Stroke opacity as a number --> <circle cx="15" cy="5" r="4" stroke="green" stroke-opacity="0.7" /> <!-- Stroke opacity as a percentage --> <circle cx="25" cy="5" r="4" stroke="green" stroke-opacity="50%" /> <!-- Stroke opacity as a CSS property --> <circle cx="35" cy="5" r="4" stroke="green" style="stroke-opacity: .3;" /> </svg> Usage notes Value [0-1] | <percentage> Default value 1 Animatable Yes Note: SVG2 introduces percentage values for stroke-opacity, however, it is not widely supported yet (See Browser compatibility below) as a consequence, it is best practices t...
text-rendering - SVG: Scalable Vector Graphics
See the css text-rendering property for more information. ...
... The text-rendering attribute provides hints to the renderer about what tradeoffs to make when rendering text. Note: As a presentation attribute, text-rendering can be used as a CSS property. See the css text-rendering property for more information. As a presentation attribute, it can be applied to any element but it has effect only on the following element: <text> html, body, svg { height: 100%; } <svg viewBox="0 0 140 40" xmlns="http://www.w3.org/2000/svg"> <text y="15" text-rendering="geometricPrecision">Geometric precision</text> <text y="35" text-rendering="optimizeLegibility">Optimized legibility</text> </svg> Usage notes Value auto | optimizeSpeed | optimizeLegibility | geometricPrecision Default value auto Animatable Yes a...
transform-origin - SVG: Scalable Vector Graphics
The transform-origin SVG attribute sets the origin for an item's transformations. Note: As a presentation attribute in SVG, transform-origin corresponds in syntax and behavior to the transform-origin property in CSS, and can be used as CSS property to style SVG. See the CSS transform-origin property for more information. Usage notes Values [ <length-percentage> | left | center | right | top | bottom ] | [ [ <length-percentage> | left | center | right ] && [ <length-percentage> | top | center | bottom ] ] <length>?where <length-percentage> = <length> | <percentage> Default value 50%, 50% Animatable Yes The transform-origin property may be specified using one, two, or three values, where each value represents an offset. Offsets that are not exp...
...e>, or one of the keywords left, center, and right. The other value must be a <length>, a <percentage>, or one of the keywords top, center, and bottom. Three-value syntax: The first two values are the same as for the two-value syntax. The third value must be a <length>. It always represents the Z offset. Specifications Specification Status Comment CSS Transforms Level 1The definition of 'transform-origin' in that specification. Working Draft Scalable Vector Graphics (SVG) 2The definition of 'transform-origin' in that specification. Candidate Recommendation ...
unicode-bidi - SVG: Scalable Vector Graphics
The unicode-bidi attribute specifies how the accumulation of the background image is managed. Note: As a presentation attribute, unicode-bidi can be used as a CSS property. See the CSS unicode-bidi property for more information. ...
...n. As a presentation attribute, it can be applied to any element but it has effect only on the following eleven elements: <altGlyph>, <textPath>, <text>, <tref>, and <tspan> Context notes Value normal | embed | isolate | bidi-override | isolate-override | plaintext Default value normal Animatable No For a description of the values, please refer to the CSS unicode-bidi property. Specifications Specification Status Comment CSS Writing Modes Module Level 3The definition of 'unicode-bidi' in that specification. Proposed Recommendation SVG 2 only refers to CSS Writing Modes. Introduced isolate, isolate-override, and plaintext keywords. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of ...
<clipPath> - SVG: Scalable Vector Graphics
Web › SVG › Element › clipPath
e. --> <circle cx="40" cy="35" r="35" /> </clipPath> <!-- The original black heart, for reference --> <path id="heart" d="M10,30 A20,20,0,0,1,50,30 A20,20,0,0,1,90,30 Q90,60,50,90 Q10,60,10,30 Z" /> <!-- Only the portion of the red heart inside the clip circle is visible. --> <use clip-path="url(#myClip)" xlink:href="#heart" fill="red" /> </svg> /* With a touch of CSS for browsers who * * implemented the r Geometry Property. */ @keyframes openYourHeart {from {r: 0} to {r: 60px}} #myClip circle { animation: openYourHeart 15s infinite; } A clipping path is conceptually equivalent to a custom viewport for the referencing element. Thus, it affects the rendering of an element, but not the element's inherent geometry. The bounding box of a clipped element (...
... Candidate Recommendation Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of '<clipPath>' in that specification. Recommendation Initial definition ...
<feMorphology> - SVG: Scalable Vector Graphics
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> <text y="1em">Normal text</text> <text id="thin" y="2em">Thinned text</text> <text id="thick" y="3em">Fattened text</text> </svg> CSS text { font-family: Arial, Helvetica, sans-serif; font-size: 3em; } #thin { filter: url(#erode); } #thick { filter: url(#dilate); } Filtering HTML content SVG <svg xmlns="http://www.w3.org/2000/svg" width="0" height="0"> <filter id="erode"> <feMorphology operator="erode" radius="1"/> </filter> <filter id="dilate"> <feMorphology operator="dilate" radius="2"/> </filt...
... Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second E...
<svg> - SVG: Scalable Vector Graphics
Web › SVG › Element › svg
cument 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 displayed with a different aspect ratio. Value type: (none| xMinYMin| xMidYMin| xMaxYMin| xMinYMid| xMidYMid| xMaxYMid| xMinYMax| xMidYMa...
...tainer. No effect on outermost svg elements. Value type: <length>|<percentage> ; Default value: 0; Animatable: 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. 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, Document event attributes, Document element event attributes Presentation Attributes Most notably: clip-path, clip-rule, color,...
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
suspendRedrawAll() deprecated Turned into no-ops (bug 734079) externalResourcesRequired attribute removed Implementation status unknown auto value for width and height in <image> Implementation status unknown referencing entire document with <use> Implementation status unknown lang attribute on <desc> and <title> Implemented (bug 721920) CSS transforms on outermost <svg> not affecting SVGSVGElement.currentScale or SVGSVGElement.currentTranslate Implementation status unknown rootElement attribute deprecated Implementation status unknown SVGElementInstance and SVGElementInstanceList and corresponding attributes on SVGUseElement removed Implementation status unknown <use> event flow following Shadow D...
...commands Implementation status unknown Z and z path commands to add path coordinate data to previous command Implementation status unknown Not render <path>, <polygon> and <polyline> with no data Implementation status unknown SVGPathSeg*, SVGAnimatedPathData and related methods removed from SVGPathElement Implementation status unknown d attribute as CSS property Implementation status unknown Basic Shapes Change Notes pathLength attribute for all basic shapes Implementation status unknown SVGAnimatedPoints.animatedPoints as alias of SVGAnimatedPoints.points Implementation status unknown Auto behavior for rx and ry in <ellipse> Implementation status unknown Text Change...
Introduction - SVG: Scalable Vector Graphics
nd that is best done by dirtying your hands with a bit of markup. You should note your final goal though. Not all SVG viewers are equal and so there is a good chance that something written for one app will not display exactly the same in another, simply because they support different levels of the SVG specification or another specification that you are using along with SVG (that is, JavaScript or CSS). SVG is supported in all modern browsers and even a couple versions back in some cases. A fairly complete browser support table can be found on Can I use. Firefox has supported some SVG content since version 1.5, and that support level has been growing with each release since. Hopefully, along with the tutorial here, MDN can help developers keep up with the differences between Gecko and some of...
...oming a recommendation in 2003, the most recent "full" SVG version is 1.1. It builds on top of SVG 1.0, but adds more modularization to ease implementation. The second edition of SVG 1.1 became a Recommendation in 2011. "Full" SVG 1.2 was meant to be the next major release of SVG. It was dropped for the upcoming SVG 2.0, which is under heavy development right now and follows a similar approach to CSS 3 in that it splits components into several loosely coupled specifications. Apart from the full SVG recommendations, the working group at the W3C introduced SVG Tiny and SVG Basic in 2003. These two profiles are aimed mainly at mobile devices. The first, SVG Tiny, should yield graphics primitives for small devices with low capabilities. SVG Basic offers many features of full SVG, but doesn't inc...
Texts - SVG: Scalable Vector Graphics
Web › SVG › Tutorial › Texts
ues "start", "middle", "end" or "inherit", decides in which direction the text flows from this point. The attribute dominant-baseline decides the vertical alignment. Like with the shape elements text can be colorized with the fill attribute and given a stroke with the stroke attribute. ...
...alignment. Like with the shape elements text can be colorized with the fill attribute and given a stroke with the stroke attribute. Both may also refer 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 ...
Using shadow DOM - Web Components
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; position: absolute; bottom: 20px; ...
...ent, but it is perfectly possible to do it by referencing an external stylesheet from a <link> element instead. For example, take a look at this code from our popup-info-box-external-stylesheet example (see the source code): // Apply external styles to the shadow dom const linkElem = document.createElement('link'); linkElem.setAttribute('rel', 'stylesheet'); linkElem.setAttribute('href', 'style.css'); // Attach the created element to the shadow dom shadow.appendChild(linkElem); Note that <link> elements do not block paint of the shadow root, so there may be a flash of unstyled content (FOUC) while the stylesheet loads. Many modern browsers implement an optimization for <style> tags either cloned from a common node or that have identical text, to allow them to share a single backing style...
Using templates and slots - Web Components
The <template> uses <slot> and its name attribute to make three named slots: <slot name="element-name"> <slot name="description"> <slot name="attributes"> The <template> wraps the named slots in a <details> element. Creating a new <element-details> element from the <template> Next, let's create a new cu...
...ow root . Only the first of those two <element-details> elements references the "attributes" named slot. The second <element-details> element lacks any reference to the "attributes" named slot. The first <element-details> element references the "attributes" named slot using a <dl> element with <dt> and <dd> children. Adding a final bit of style As a finishing touch, we'll add a tiny bit more CSS for the <dl>, <dt>, and <dd> elements in our doc: dl { margin-left: 6px; } dt { font-weight: bold; color: #217ac0; font-size: 110% } dt { font-family: Consolas, "Liberation Mono", Courier } dd { margin-left: 16px } body { margin-top: 47px } Result Finally let's put all the snippets together and see what the rendered result looks like. ScreenshotLive sample Notice the following po...
xml:base - XML: Extensible Markup Language
Web › XML › xml:base
s> <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. ...
... Work-arounds xml:base support in old browsers https://gist.github.com/leonderijke/c5cf7c5b2e...
Index - XPath
Web › XPath › Index
It uses a non-XML syntax to provide a flexible way of addressing (pointing to) different parts of an XML document. It can also be used to test addressed nodes within a document to determine whether they match a pattern or not. 2 Axes Transforming_XML_with_XSLT, XPath, XPath_Reference, XSLT, XSLT_Reference For further information on using XPath expressions, please see the For Further Reading section at the end of Transforming XML with XSLT document. Also see the 'axes' section in the xpath spec. ...
...ribute and namespace nodes. 14 preceding-sibling Axe, XPath The preceding-sibling axis indicates all the nodes that have the same parent as the context node and appear before the context node in the source document. 15 self Axe, XPath The self axis indicates the context node itself. It can be abbreviated as a single period (.). 16 Comparison of CSS Selectors and XPath CSS, Draft, NeedsContent, Reference, Selectors, XPath This article seeks to document the difference between CSS Selectors and XPath for web developers to be able to better choose the right tool for the right job. 17 Functions Transforming_XML_with_XSLT, XPath, XPath_Reference, XSLT, XSLT_Reference No summary! 18 boolean XSLT, XSLT_...
Loading Content Scripts - Archive of obsolete content
d 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, etc.) can be used here. ...
Content Scripts - Archive of obsolete content
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 object that is exposed to content scripts as a read-only value under the self.options property: // main.
XUL Migration Guide - Archive of obsolete content
veForwardButton }); There are more useful examples of this technique in the Jetpack Wiki's collection of third party modules. Accessing tabbrowser This example uses the action button API, which is only available from Firefox 29 onwards. The tabs/utils module gives you direct access to the tabbrowser object and the XUL tab objects it contains. ...
content/loader - Archive of obsolete content
load the content scripts. This may take one of the following values: "start": load content scripts immediately after the document element for the page is inserted into the DOM, but before the DOM content itself has been loaded "ready": load content scripts once DOM content has been loaded, corresponding to the DOMContentLoaded event "end": load content scripts once all the content (DOM, JS, CSS, images) for the page has been loaded, at the time the window.onload event fires contentScriptOptions Read-only value exposed to content scripts under self.options property. Any kind of jsonable value (object, array, string, etc.) can be used here. Optional. contentURL The URL of the content loaded. allow Permissions for the content, with the following keys: ...
Adding a Button to the Toolbar - Archive of obsolete content
s the button to the panel's show() method. For more details on this, see the toggle button's documentation. Displaying richer content To create more complex user interface content than is possible with just a button, use the toolbar API. With the toolbar API you get a complete horizontal strip of user interface real estate. You can add buttons to the toolbar and also frames, that can host HTML, CSS, and JavaScript. Learning more action button reference toggle button reference toolbar reference ...
Display a Popup - Archive of obsolete content
.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. ...
Modifying the Page Hosted by a Tab - Archive of obsolete content
ui/button/action").ActionButton({ id: "style-tab", label: "Style Tab", icon: "./icon-16.png", onClick: function() { var worker = tabs.activeTab.attach({ contentScriptFile: self.data.url("my-script.js") }); worker.port.emit("drawBorder", "red"); } }); The drawBorder message isn't a built-in message, it's one that this add-on defines in the port.emit() call. Injecting CSS Unlike the page-mod API, tab.attach() doesn't enable you to inject CSS directly into a page. To modify the style of a page, you have to use JavaScript, as in the example above. Learning More To learn more about working with tabs in the SDK, see the Open a Web Page tutorial, the List Open Tabs tutorial, and the tabs API reference. To learn more about content scripts, see the content scripts g...
Add-on SDK - Archive of obsolete content
The SDK includes JavaScript APIs, which you can use to create add-ons and tools for creating, running, testing, and packaging add-ons. Tutorials Getting started How to install the SDK and use the jpm tool to develop, test, and package add-ons. Interact with the browser Open web pages, listen for pages loading and list open pages. Development techniques Learn about common development techniques, such as unit testing, logging, creating reusable modules, localization, and mobile development. ...
Embedding SVG - Archive of obsolete content
<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.mozilla.org/keymaster/gatekeeper/there.is.only.xul" ...
Label and description - Archive of obsolete content
p 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:br/> What's that make us?<html:br/> Absolutely nothing!</description> Using labels as anchors Its possible to make a label look and act like an HTML <a> tag: <label class="text-link" href="http://whatever.com" value="click here...
Developing add-ons - Archive of obsolete content
x, SeaMonkey and Thunderbird. They can add anything from a toolbar button to a completely new feature. Plugins Information about how to create plugins, which are binary components that let Mozilla based software display content they can't handle natively. Jetpack Browser extension development for everyone. Jetpack developers only need to know the tools of the modern web: HTML, CSS, and JavaScript. Themes Themes let users customize the appearance of the user interface presented by Mozilla-based applications. Search engine plugins Firefox supports search engine plugins, which enable the search box to support different search engines. addons.mozilla.org (AMO) API Developers' Guide The AMO Developers' Guide describes how to use t...
Displaying web content in an extension without security issues - Archive of obsolete content
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. ...
How to convert an overlay extension to restartless - Archive of obsolete content
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. 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(...
Adding menus and submenus - Archive of obsolete content
opup 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 items that are...
Getting Started with Firefox Extensions - Archive of obsolete content
nux or Mac OS X: unzip xulschoolhello1.xpi -d xulschoolhello1 On Windows, you can change the file extension from xpi to zip, or open the file directly, then unzip it, using a ZIP tool. You should see the following directory structure: xulschoolhello1 chrome.manifest install.rdf content browserOverlay.xul browserOverlay.js skin browserOverlay.css locale en-US browserOverlay.dtd browserOverlay.properties That's lots of files for something so simple! In the next section, we'll inspect these files and see what they do. << PreviousNext >> This tutorial was kindly donated to Mozilla by Appcoast. ...
Handling Preferences - Archive of obsolete content
n the control will change the preference (depending on the instant apply rule), and vice versa. You may be able to create a Preferences window without a single line of JS code thanks to the preference element. Finally, groupboxes are a good idea to organize the contents of the window and preference panes. They are heavily stylized in the Firefox Preferences window, so you should include the same CSS file that is included in it (chrome://browser/skin/preferences/preferences.css). This way you don't have to rewrite all the CSS rules defined for Firefox. You should also look at the class values set to elements in the XUL file, so that your Preferences window is just like the one in Firefox and your extension is better integrated into the application and the native OS look and feel. << Previ...
Introduction - Archive of obsolete content
lusive to Mozilla, it tends to be used to identify all Mozilla-related development. You'll sometimes read terms like "XUL applications" and "XUL extensions", but rarely will they refer to projects that are exclusively built with XUL. It usually means that the projects were built using Mozilla technologies. Even this project, called XUL School, covers several other technologies such as JavaScript, CSS, XBL and XPCOM. XULRunner XULRunner includes the Gecko rendering engine, the Necko networking library, and several other components that provide OS-independent file management, accessibility, and localization, among others. It is this very powerful platform that has allowed such a fast growth of the development community surrounding Mozilla and Firefox. XULRunner is available in binary form at...
Mozilla Documentation Roadmap - Archive of obsolete content
h more to learn, and knowing how to find it is part of what we felt was necessary to teach. Let's look into the resources that have helped us the most. The Mozilla Developer Center This is the official and most extensive guide to everything related to Mozilla. MDC is where this tutorial is hosted, and where most of its links point to. It encompasses Firefox, other Mozilla products, Javascript, CSS, XUL, web and extension development guidelines, accessibility, usability, best practices... The list goes on. It's incredibly comprehensive, and its underlying Wiki technology makes it easy to expand and evolve with the help of the community. Having said that, there are a few problems with it. First of all, the in-site search is not reliable, so we recommend using a search engine like Google, wi...
XPCOM Objects - Archive of obsolete content
In fact, you can separate the two. We often mention other "Mozilla based applications". ...
Performance best practices in extensions - Archive of obsolete content
avoid zombie compartments and other kinds of leaks. As well as looking for these specific kinds of leaks, it's worth exercising your extension's functionality and checking the contents of about:memory for any excessive memory usage. For example, bug 719601 featured a "System Principal" JavaScript compartment containing 100s of MBs of memory, which is much larger than usual. Avoid Writing Slow CSS Read the "writing efficient CSS" guide. Remember that any selector in your rule which might match many different nodes is a source of inefficiency during either selector matching or dynamic update processing. This is especially bad for the latter if the selector can dynamically start or stop matching. Avoid unqualified ":hover" like the plague. Avoid DOM mutation event listeners DOM mutati...
Setting up an extension development environment - Archive of obsolete content
Chromebug combines elements of a JavaScript debugger and DOM (Firefox, "kinda works for Thunderbird") MozRepl explore and modify Firefox and other Mozilla apps while they run (Firefox, Thunderbird version is not working) ExecuteJS an enhanced JavaScript console (Firefox version, Thunderbird version is not working) XPCOMViewer an XPCOM inspector (Firefox and Thunderbi...
Firefox addons developer guide - Archive of obsolete content
o 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 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...
Add-ons - Archive of obsolete content
The SDK includes JavaScript APIs, which you can use to create add-ons and tools for creating, running, testing, and packaging add-ons. bookmarks.export() Exports bookmarks to an HTML bookmark file. bookmarks.import() Imports bookmarks from an HTML bookmark file. Bootstrapped extensions browser.bookmarks.export( function() {...} // optional function ) Code snippets ... ...
Adding preferences to an extension - Archive of obsolete content
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. ...
DOMSubtreeModified - Archive of obsolete content
OM 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
e of use to plugin vendors, but these keys are written mainly by CompuServe and other browsers by AOL (based on Mozilla) which are only in beta currently. These keys are discussed in bug 109402#c8, Comment 8. We can use CompuServe 7.0 as an example of these additional keys. Under HKEY_LOCAL_MACHINE\Software\Mozilla\CompuServe 7.0 you'll find: "Plugins Folders"="C:\\Program Files\\Common Files\\csshare\\plugins0942" "Product"="CompuServe" "Version"="7.0" "DisplayName"="CompuServe 7.0" The Product, Version, and DisplayName string values are currently only written by CompuServe 7.0, and they are written alongside the GeckoVer string value. Original Document Information Last Updated Date: June 18, 2002 Copyright Information: Portions of this content are (C) 1998-2006 by in...
Notes on HTML Reflow - Archive of obsolete content
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 frames. For example, a <div> with a constrained width (e.g., set via the CSS width property) would note this in the reflow state object before flowing its children. When reflow begins, the root reflow state is initialized with information about the top-level container for the document's presentation; e.g., the width and height of the application window. This is passed as an argument to the Reflow method of the root frame in the frame hierarchy. Each container fra...
Source code directories overview - Archive of obsolete content
ntains C code for tokenizing, 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 h...
Conclusion - Archive of obsolete content
d see if 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--loc...
Enabling the behavior - updating the status bar panel - Archive of obsolete content
r red (represented by the RGB code EE0000) means a tinderbox client failed to build Mozilla. The color orange ("FFAAOO") means a client successfully built Mozilla, but the build failed tests. The color green ("11DD11") means the client successfully built and tested Mozilla. When it finds a color, it sets the panel's status attribute to the corresponding status, which causes the previously defined CSS rules to switch to the icon appropriate for that status. Because our conditional looks for worse states (bustage, test failures) first, it will display those states before displaying the success state. << PreviousNext >> ...
Enabling the behavior - updating the status periodically - Archive of obsolete content
te (60,000 milliseconds) after each invocation. This allows users to get relatively frequent updates about tinderbox without overloading the tinderbox server or slowing down Mozilla with requests. Our code is now ready to run, but Mozilla doesn't know about it yet. To enable its functionality, we have to add a reference to our JavaScript code into navigator.xul, just as we put a reference to our CSS code into that file back in Specifying the appearance. Put the JavaScript code into a file called tinderstatus.js in the same directory as navigator.xul and reference it in navigator.xul where other JavaScript scripts are referenced: ... <!-- Navigator --> <script type="application/javascript" src="chrome://navigator/content/browser.js"/> <script type="application/javascript" src="c...
Making a Mozilla installation modifiable - Archive of obsolete content
The files are then collected into a series of JAR archives, which are just ZIP files that contain a specially formatted "manifest" file which describes the contents of the archive so Mozilla knows what to do with them. ...
Prerequisites - Archive of obsolete content
You might install Mozilla multiple times in the course of this tutorial, so you will find it handy to keep around a Mozilla installer. ...
Creating a hybrid CD - Archive of obsolete content
"GIF file" .png Raw 'ogle' 'PNG ' "PNG file" .jpg Raw 'ogle' 'JPEG' "JPEG file" .jpeg Raw 'ogle' 'JPEG' "JPEG file" .pl Ascii 'McPL' 'TEXT' "Perl file" .pm Ascii 'McPL' 'TEXT' "Perl module file" .xml Ascii 'R*ch' 'TEXT' "XML file" .xul Ascii 'R*ch' 'TEXT' "XUL file" .xbl Ascii 'R*ch' 'TEXT' "XBL file" .css Ascii 'R*ch' 'TEXT' "CSS file" .dtd Ascii 'R*ch' 'TEXT' "DTD file" .js Ascii 'R*ch' 'TEXT' "JavaScript file" .mp3 Raw 'TVOD' 'MPG3' "MPEG file" .mpg Raw 'TVOD' 'MPEG' "MPEG file" .mpeg Raw 'TVOD' 'MPEG' "MPEG file" .au Raw 'TVOD' 'ULAW' "Audio file" * Ascii 'ttxt' 'TEXT' "Text file" For more infor...
Links - Archive of obsolete content
Some other Skin related resources: Learning CSS Zvon.org The World Wide Web Consortium ...
Makefile.mozextension.2 - Archive of obsolete content
) chrome/$(PROJECT).jar ~/.mozilla/default/32p27fdr.slt/chrome/ #################################### ###### define CHROME_MANIFEST content $(PROJECT) content/ overlay chrome://browser/content/browser.xul chrome://$(PROJECT)/content/overlay.xul locale $(PROJECT) en-US locale/ skin $(PROJECT) classic/1.0 skin/ style chrome://global/content/customizeToolbar.xul chrome://$(PROJECT)/skin/overlay.css endef export CHROME_MANIFEST chrome.manifest: @echo Generating $(PROJECT)/chrome.manifest @echo "$$CHROME_MANIFEST" > $(PROJECT)/chrome.manifest ###### #Firefox {ec8030f7-c20a-464f-9b0e-13a3a9e97384} #Thunderbird {3550f703-e582-4d05-9a08-453d09bdfdc6} #Nvu {136c295a-4a5a-41cf-bf24-5cee526720d5} #Mozilla Suite {86c18b42-e466-45a9-ae7a-9b95ba6f5640} #SeaMonkey {92650c4d-4b8e-4d2a-b7eb-24...
Microsummary topics - Archive of obsolete content
tween 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 ...
Mozilla Application Framework - Archive of obsolete content
the Mozilla framework and make your life easier. We provide a comprehensive framework that does much of the work for you, tools to help you develop your apps, and a community of people to help. Framework XUL A comprehensive, cross-platform UI toolkit with an easy-to-learn XML language for defining UI structure, a schema for localization, and support for both native and cross-platform (using CSS) look and feel to make writing UIs quick and painless. Gecko A performant web content rendering/editing engine with world-leading support for standards that you can drop into your application with a single line of XUL. Necko A wicked-fast, extensible networking library with built-in support for many common protocols and a well-defined plug-in interface for custom protocol handling so yo...
Bundles - Archive of obsolete content
n=no sidebar=no navigation=no Zip the file to [whatever].webapp Double-click the webapp bundle or use prism -webapp [path-to-webapp] Structure A bundle can contain the following files. Any other files in the .webapp file will be ignored. After the .webapp file is executed the first time, these files will be unzipped and "cached" to a local directory structure. / webapp.ini webapp.js webapp.css winnt/ webapp.css darwin/ webapp.css linux/ webapp.css [icon].ico [icon].png [icon].icns ...
FAQ - Archive of obsolete content
Archive › Mozilla › Prism › FAQ
duct or is integrated into other products (like Firefox), then it won't necessarily continue to be called by this codename. Is Prism a platform? No, Prism is not a platform. Prism is built on top of the Mozilla platform and its Gecko rendering engine, just like Mozilla Firefox, so it provides the same capabilities to web applications that Firefox provides, including support for HTML, JavaScript, CSS, and <canvas>. At the same time, we're also working to increase the capabilities of those apps by adding features to the Web itself, like support for offline data storage and access to 3D graphics hardware, that will be available to web applications in both Prism and Firefox. How is Prism different from XULRunner? Prism is built on top of XULRUnner. Prism is a simple XULRunner application with t...
Prism - Archive of obsolete content
ile. 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. Scripting Prism allows for some client-side web application customization. Some simple objects and utilities are exposed to webapp scripts. Host Window Prism provides a simple, scaled down browser window for running web applications. Using configuration files and webapp scriptin...
Space Manager Detailed Design - Archive of obsolete content
nager, and as an introduction to the classes, structures and algorithms container in this, the Detailed Design Document. nsSpaceManager The Space Manager is the central class is a group of classes that manage the occupied and available space that exists in horizontal bands across a canvas. The primary goal of the Space Manager is to provide information about those bands of space to support the CSS notion of floated elements. There are three important parts to the Space Manager API: the parts that deal with the coordinate space of the Space Manager, the parts that deal with the regions managed by the Space Manager, and the parts that manage float impact intervals. The class nsSpaceManager is declared in the file nsSpaceManger.h. The class is only used in the layout module and cannot be expo...
Table Cellmap - Border Collapse - Archive of obsolete content
It can have 4 values: NS_SIDE_TOP NS_SIDE_RIGHT NS_SIDE_BOTTOM NS_SIDE_LEFT The size of the smaller border that goes into that corner. if this corner is a start for a horizontal segment, if this corner is a start for a vertical segme...
Table Layout Strategy - Archive of obsolete content
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. ...
The life of an HTML HTTP request - Archive of obsolete content
d nsHTMLContentSink::DidBuildModel(). WillInterrup is called by the parser between every 8kb block of data (unless 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 fra...
Tuning Pageload - Archive of obsolete content
ponsive; if there is no user activity, we will aim for less parser interruption and less responsiveness but lower overall load time. content.notify.* Controls the information flow from content sink to rendering model. In particular, the way things work right now is that the parser and content sink construct the DOM; then every so often, the content sink lets the rendering model constructor (nsCSSFrameConstructor) know that there are new DOM nodes. The reason for this is that nsCSSFrameConstructor is most efficient when doing a bunch of stuff at once instead of constructing rendering objects for one DOM node at a time. specifically - content.notify.ontimer controls whether the frame constructor is notified off a timer at all content.notify.backoffcount controls how many times that happens ...
URIScheme - Archive of obsolete content
List of Mozilla supported URI schemes List of URI Schemes http:// by default, port 80 https:// by default, port 443 (SSL) ftp:// by default, port 21 file:// : file:///etc/hosts on Unix/Linux, file:///c:/some/file.txt on Windows. moz-icon://.ext?size=32 : you can replace ext by your some file extension like js, css, xul, xml, etc. and the size number by 1 to 127 mailto:emailaddress@domain.com about: chrome:// ... Preferences See gecko.handlerService.schemes.* Scripting Interface See nsIProtocolHandler to create a new protocol/scheme. about: about: about:config about:crashes about:mozilla about:plugins about:robots ... ...
XBL - Archive of obsolete content
ome differences between sXBL and XBL2 are listed in an article by Anne van Ke ( seesteren (November, 2005). An overview of differences between Mozilla XBL and XBL2 is in a newsgroup posting by Jonas Sicking (April, 2007). Still living "Shadow DOM" related specs Shadow DOM (Editor's Draft) CSS Scoping >> Shadow Encapsulation See also Introduction to XBL from the XUL Tutorial. Custom XUL Elements with XBL from the XUL School Tutorial for add-on developers XBL chapter of "Rapid Application Development with Mozilla" XBL 2.0 Primer (draft) XBL 2.0 Cross-browser...
alternatingbackground - Archive of obsolete content
...
collapsed - Archive of obsolete content
...
equalsize - Archive of obsolete content
ldren of the element equal in size. always For a horizontally oriented element, this will make all of its children have the width of the widest child. For a vertically oriented element, this will make its children all have the height of the tallest child. never All of the children are displayed at the size required by the content or as specified by the width and height attributes or the CSS width and height properties. ...
height - Archive of obsolete content
...
hidden - Archive of obsolete content
...
maxheight - Archive of obsolete content
...
maxwidth - Archive of obsolete content
...
minheight - Archive of obsolete content
...
minwidth - Archive of obsolete content
...
onchange - Archive of obsolete content
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. ...
sizemode - Archive of obsolete content
XUL 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...
treecol.type - Archive of obsolete content
mn. The default is a text column that displays the content 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 a...
width - Archive of obsolete content
<< XUL Reference home width Type: string (representing an integer) The preferred width of the element. The value should not include a unit as all values are in pixels. The actual displayed 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. <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 ...
How to implement a custom XUL query processor component - Archive of obsolete content
tering 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. ...
appendNotification - Archive of obsolete content
cation and display it. If another notification is already present with a higher priority, the new notification will be added behind it. label - label to appear on the notification. This should be either a string, or, from Gecko 37 onwards, you can pass a DocumentFragment with rich content as well. Keep in mind that this is all XUL so using HTML elements for styling might still need additional CSS in order to work as you might expect. value - value used to identify the notification image - URL of image to appear on the notification. If "" then an icon appropriate for the priority level is used. priority - notification priority; see Priority Levels. buttons - array of button descriptions to appear on the notification. eventCallback Optional - a JavaScript function to call to notify yo...
openPopup - Archive of obsolete content
for position are: before_start, before_end, after_start, after_end, start_before, start_after, end_before, end_after, overlap, and after_pointer. Check Positioning of the Popup Guide for a precise description of the effect of the different values. x, y For an anchored popup, the x and y arguments may be used to offset the popup from its anchored position by some number, measured in CSS pixels. An unanchored popup appears at the position specified by x and y, relative to the viewport of the document containing the popup node. In this case, the position and attributesOverride arguments are ignored. isContextMenu The isContextMenu argument should be true for context menus and false for all other types of popups. It affects menu item highlighting; that is, while a con...
openPopupAtScreen - Archive of obsolete content
...
Panels - Archive of obsolete content
ing 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 panel is opened. Clicking outside the panel or pres...
style - Archive of obsolete content
Archive › Mozilla › XUL › Property › style
...
Sorting and filtering a custom tree view - Archive of obsolete content
, 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
...
textbox (Toolkit autocomplete) - Archive of obsolete content
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. ...
Textbox (XPFE autocomplete) - Archive of obsolete content
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. ...
Adding Buttons - Archive of obsolete content
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 horizontal orientation so that the two buttons a...
Adding HTML Elements - Archive of obsolete content
.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. Here is an example as it might be added to the find file window: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="findfile-window" title="Find Files" orient="horizontal" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> Then, you can use HTML tags as you would normally, keeping in mind the following: You must add a html: prefix to the beginning of each tag, assuming you declared the HTML namespace as above. The ...
Adding Labels and Images - Archive of obsolete content
an 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 vary by t...
Adding more elements - Archive of obsolete content
dth: 15em;"/> </hbox> <spacer style="height: 10px" flex="1"/> <hbox> Now when the dialog is resized, the two buttons will move so that they are always along the bottom of the dialog. The first spacer adds extra spacing in between the title label and the search criteria elements. It might look nicer if there was a border around the search criteria. There are two ways to do this. We could use the CSS border property or we could use the groupbox element. This first method would require that we set the style on the box itself. We will use the latter method, however. A groupbox has the advantage that it draws a box with a nice beveled look, suitable for the current theme. Let us change the box into a groupbox: <groupbox orient="horizontal"> <caption label="Search Criteria"/> <menulist id="se...
Creating a Wizard - Archive of obsolete content
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. ...
Creating an Installer - Archive of obsolete content
nents provided with Mozilla are stored in this manner. Because the XPI file is just a special ZIP file, you can create it and add files to it using a zip utility. Our find files example For the find files dialog, we'll create a structure in the archive much like the following: install.js findfile content contents.rdf findfile.xul findfile.js skin contents.rdf findfile.css locale contents.rdf findfile.dtd A directory has been added for each part of the package, the content, the skin and the locale. The contents.rdf files have also been added because they will be needed to register the chrome files. Next, we'll look further at the install script. << PreviousNext >> ...
Cross Package Overlays - Archive of obsolete content
e 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
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. ...
Groupboxes - Archive of obsolete content
to group HTML elements. The groupbox is a type of box, and the elements it contains are aligned according to the XUL box rules. However, there are several differences between groupboxes and regular boxes: The groupbox can be labeled using the caption element. The groupbox is displayed in a special way--usually with a beveled border and a caption, although you can change the appearance using CSS. You can create a caption for your groupbox by inserting a caption element as the first child. Groupboxes are box elements, so you can use the box attributes, such as orient and flex. A simple groupbox example The example below shows a simple groupbox: Example 1 : Source View <groupbox> <caption label="Answer"/> <description value="Banana"/> <description value="Tangerine"/> <descript...
Introduction - Archive of obsolete content
s and images used by an application would be packaged into a single file and downloaded and installed by the user. Mozilla applications such as Firefox provide an extension manager which allows packages to be installed without having to write a lot of complex code. What do I need to know to use this tutorial? You should 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 scrip...
More Button Features - Archive of obsolete content
s loaded from the URL, which can be a relative or absolute URL, and 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. Example 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...
More Event Handlers - Archive of obsolete content
is double clicked. mousedown Called when a mouse button is pressed down on an element. The event handler will be called as soon as a mouse button is pressed, even if it hasn't been released yet. mouseup Called when a mouse button is released on an element. mouseover Called when the mouse pointer is moved onto an element. You could use this to highlight the element, however CSS provides a way to do this automatically so you shouldn't do it with an event. You might, however, want to display some help text on a status bar. mousemove Called when the mouse pointer is moved while over an element. The event may be called many times as the user moves the mouse so you should avoid performing lengthy tasks from this handler. mouseout Called when the mouse pointer...
More Wizards - Archive of obsolete content
er 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. ...
Scrolling Menus - Archive of obsolete content
<button label="Lavender"/> <button label="Gold"/> <button label="Turquoise"/> <button label="Peach"/> <button label="Maroon"/> <button label="Black"/> </arrowscrollbox> If you try this example, it will first open at full size. However, if you shrink the height of the window, the scroll arrows will appear. Making the window larger again will cause the arrows to disappear. You can set a CSS max-height property on the arrowscrollbox to limit the size of the scrolling box and thus make the arrows appear all the time. The arrowscrollbox is mainly useful in menus and popups however. Next, we'll see how to add some event handlers to XUL elements. << PreviousNext >> ...
Templates - Archive of obsolete content
r hand, doesn't generate 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 th...
The Box Model - Archive of obsolete content
l part 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 o...
The Chrome URL - Archive of obsolete content
le for your main window with the same name as the package, so it can be referred to using this shorter form. This is convenient since all a user needs to know is the package name to be able to open the application. Of course, for extensions that modify the browser interface, the user will not need to know the URL, as the extension will present itself in the UI. For a skin, the file <package name>.css is selected; for a locale, the file <package name>.dtd is selected. Remember, the chrome URL is not related to where it is located on disk. The first two pieces of the chrome URL are the package name and the part (either content, skin, or locale). While it is common to put the content files in a directory called 'content', this is purely out of convention, and these files may be placed in an enti...
Tree View Details - Archive of obsolete content
ty 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. ...
XBL Example - Archive of obsolete content
as well. Some keyboard shortcuts could be used for the Previous and Next buttons, (say backspace and the Enter key). First and Last buttons could be added to go to the first and last pages. The label element could be changed to a field where the user could enter the page to go to, or a popup could be added to allow selection of the page from a menu. We could also add a border around the deck with CSS to make it look a bit nicer. The Final Code The final code is as follows: Example 2 : Source <binding id="slideshow"> <content> <xul:vbox flex="1"> <xul:deck xbl:inherits="selectedIndex" selectedIndex="0" flex="1"> <children/> </xul:deck> <xul:hbox> <xul:button xbl:inherits="label=previoustext" oncommand="parentNode.parentNode.parent...
XUL Tutorial - Archive of obsolete content
He has graciously given us permission to use it as part of the MDN. Or...
Using the Editor from XUL - Archive of obsolete content
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> element on ...
XUL Template Primer - Bindings - Archive of obsolete content
erent 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. ...
XML - Archive of obsolete content
ML elements, and other standards-based technologies. But this is all you need to build any interface. XUL is timely. Only quite recently have the standards out of which XUL was fashioned matured to a level where they might really be powerful and flexible enough to support the sort of development that XUL provides for. As the figure below indicates, XUL is an amalgam of these different standards: CSS for styling or "skinning", DOM for the object model and scriptable access, JavaScript for the linking and behavior, RDF for resources, XML for the structure, and HTML for the content and some little extras. In this way, it's more like a developmentplatform or framework than a user interface language, particularly when it's used with related cross-platform technologies like XPCOM, which also went ...
XUL Event Propagation - Archive of obsolete content
ion 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. ...
colorpicker - Archive of obsolete content
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. ...
dialog - Archive of obsolete content
accept, 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 label="Red"/> <radio label="Green" s...
grid - Archive of obsolete content
Archive › Mozilla › XUL › grid
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] A grid is a layout type that arranges elements in rows and columns. The grid is expected to contain both a columns element as a child which defines the structure of the columns and a rows element as child to define the rows. The size and attributes defined on columns and rows will affect the size and placement of elements in each cell. ...
notificationbox - Archive of obsolete content
cation and display it. If another notification is already present with a higher priority, the new notification will be added behind it. label - label to appear on the notification. This should be either a string, or, from Gecko 37 onwards, you can pass a DocumentFragment with rich content as well. Keep in mind that this is all XUL so using HTML elements for styling might still need additional CSS in order to work as you might expect. value - value used to identify the notification image - URL of image to appear on the notification. If "" then an icon appropriate for the priority level is used. priority - notification priority; see Priority Levels. buttons - array of button descriptions to appear on the notification. eventCallback Optional - a JavaScript function to call to notify yo...
preference - Archive of obsolete content
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
ept, 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="Automatically Save Backups" preference="pref-back...
toolbar - Archive of obsolete content
ng The text to appear on the tooltip for the toolbar's grippy when the toolbar is collapsed. This would be used to label the grippy so that the user knows which toolbar it represents. height Type: string (representing an integer) The preferred height of the element in pixels. The actual displayed height may be different if the element or its contents have a minimum or maximum height. The CSS height property may also be used. iconsize Type: string Indicates whether the toolbar should display large icons or small icons; this should be the string "large" or "small", respectively. These can vary from one toolbar to another within a given toolbox, whose iconsize attribute defines the default for all toolbars that don't specify an icon size. mode Not in SeaMonkey 1.x Type...
toolbox - Archive of obsolete content
rty. 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. ...
treechildren - Archive of obsolete content
nt will 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, po...
wizard - Archive of obsolete content
is available in the XUL tutorial. ...
XUL - Archive of obsolete content
of XUL explorer) Extension developer's extension (featuring a Live XUL Editor) XULRef sidebar Firebug DOM Inspector Spket IDE, IDE for XUL/XBL Ample SDK, (Cross-browser XUL renderer in JavaScript/HTML) View All... Related Topics JavaScript, XBL , CSS, RDF, Extensions, XULRunner ...
CommandLine - Archive of obsolete content
</window> Original Document Information Author: Georges-Etienne Legendre Last Up...
Debugging a XULRunner Application - Archive of obsolete content
the loaded script window, uncheck the menu item "debug\exclude Browser Files" and find them in open windows tab When opening a JS file in Venkman, the code is unformatted and I get the following error in the jsconsole... Security Error: Content at x-jsd:source?location=chrome%3A%2F%2Fvenkman%2Fcontent%2Fvenkman-overlay.js&instance=12 may not load or link to chrome://venkman/skin/venkman-source.css. Note the "New in Firefox 3" attribute "contentaccessible" on https://developer.mozilla.org/En/Chrome_Registration so as per http://markmail.org/message/ezbomhkw3bgqjllv#query:x-jsd+page:1+mid:xvlr7odilbyhn6v7+state:results change the manifest to have this line: content venkman jar:venkman.jar!/content/venkman/ contentaccessible=yes I get errors about not being able to open contentAreaUtils.
Dialogs in XULRunner - Archive of obsolete content
en and save dialogs are good examples of these. Whenever possible, it is a good idea to reuse these "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. Here is an example XUL dialog: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <dialog id="myDialog" title="My Dialog" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="window.sizeToContent();" buttons="accept,cancel" buttonlabelaccept="Set Favorite" butt...
Getting started with XULRunner - Archive of obsolete content
fying 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. ...
XULRunner Hall of Fame - Archive of obsolete content
Version updates match the rapid release cycle. Now available with XULRunner 30 with I18N support. MathML support is significant. Includes SMIL audio overlays and IDPF Fixed Layout. celtx All-in-one media pre-production software. ...
XULRunner tips - Archive of obsolete content
man uses "chrome://communicator/skin/" as an alias for "chrome://global/skin/" and this alias was maintained in the XULRunner toolkit until XULRunner 1.9 was released. When using XULRunner 1.9 or greater, you can create your own alias in your chrome manifest add a "skin" line: skin communicator classic/1.0 skin/communicator/ add a skin folder named "communicator" and add a single CSS file named "communicator.css" with this content: @import url("chrome://global/skin"); DOM Inspector To add DOM Inspector 2.0.* to your XULRunner 1.9.0.* application follow these steps: Download the Dom Inspector (instead of clicking the "Add to..." button, right-click and select "Save Link As..."). Save the dom_inspector-*.xpi package to a temporary directory Unzip the packag...
nsIContentPolicy - Archive of obsolete content
Indicates a timed refresh. shouldLoad() will never get this, because it does not represent content to be loaded (the actual load triggered by the refresh will go through shouldLoad() as expected). shouldProcess() will get this for, for example <meta> Refresh elements and HTTP Refresh headers. TYPE_XBL 9 Indicates an XBL binding request, triggered either by -moz-binding CSS property or the Document.addBinding() method. TYPE_PING 10 Indicates a ping triggered by a click on an <a> element using the ping attribute. TYPE_XMLHTTPREQUEST 11 Indicates an XMLHttpRequest. Also used for Document.load() TYPE_OBJECT_SUBREQUEST 12 Indicates a request by a plugin. TYPE_DTD 13 Indicates a DTD loaded by an XML document. ...
xbDesignMode.js - Archive of obsolete content
de = "On"; // IE needs to reget the document element after designMode was set this.mEditorDocument = this.mIFrameElement.contentWindow.document; } } xbDesignMode.prototype.execCommand = function (aCommandName, aParam){ if (this.mEditorDocument) this.mEditorDocument.execCommand(aCommandName, false, aParam); else throw "no mEditorDocument found"; } xbDesignMode.prototype.setCSSCreation = function (aUseCss){ if (this.mEditorDocument) this.mEditorDocument.execCommand("useCSS", false, aUseCss); else throw "no mEditorDocument found"; } ...
Mozilla release FAQ - Archive of obsolete content
with an internet radio tool. What does Mozilla have that wasn't in Communicator 4? Mozilla has (at least) the following new features: XML support A highly configurable appearance (courtesy of XUL) publicly available source code :) HTTP compression Exists on more platforms MathML support (somewhat limited at the moment) A significantly faster rendering engine Better HTML support (CSS 1 and partial CSS 2, DOM 1 and partial DOM 2) Plug-in JVM support Tabbed browsing Message filtering An IRC client Why is the animated icon different? The N logo is only to be present on Netscape's Communicator. This will serve as a way for an end-user to determine if they have Mozilla or Communicator. The icon that's distributed in the source will be used in mozilla.org distributions of ...
2006-09-29 - Archive of obsolete content
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. ...
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). ...
Using Web Standards in your Web Pages - Archive of obsolete content
browsers." -Web Standards Project This article provides an overview of the process for upgrading the content of your web pages to conform to the World Wide Web Consortium (W3C) web standards. The first 2 sections address exclusively validation issues, benefits of validation, deprecated elements, deprecated attributes. How to upgrade a webpage markup code to pass validation and how to implement CSS are addressed by providing recommendations, tutorials and references. The other sections address DOM and DHTML coding practices which are at odds with the W3C web standards and suggest replacements. Every proposed W3C web standards replacement in this article is working without a problem in modern browsers like MSIE 7, Firefox 2, Opera 9, Safari 3, Konqueror 3.5+, Icab 4, etc. The next-to-last ...
-moz-binding - Archive of obsolete content
Syntax /* <url> value */ -moz-binding: url(http://www.example.org/xbl/htmlBindings.xml#checkbox); /* Global values */ -moz-binding: inherited; -moz-binding: initial; -moz-binding: unset; Values <url> The URL for the XBL binding (including the fragment identifier). none No XBL binding is applied to the element. ...
-moz-stack-sizing - Archive of obsolete content
Normally, a <xul:stack> will change its size so that all of its child elements are completely visible. For example, moving a child of the stack far to the right will widen the stack so the child remains visible. /* Keyword values */ -moz-stack-sizing: auto; -moz-stack-sizing: ignore; /* Global values */ -moz-stack-sizing: inherit; -moz-stack-sizing: initial; -moz-stack-sizing: unset; If you wish to prevent the stack from resizing automatically to accommodate its children, you can set -moz-stack-sizing to ignore on the child element. The property is set not on the stack itself, but on the stack's children. This lets you ignore certain children, but not others. ...
-moz-text-blink - Archive of obsolete content
The -moz-text-blink non-standard Mozilla CSS extension specifies the blink mode. Firefox, which was the only major browser supporting it, dropped support for this property in Firefox 26. It is now unsupported on all browsers. Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values none Produces no blinking. blink Text blinks. Note that not blinking the text is one technique to satisfy checkpoint 3.3 of WAI-UAAG. Formal syntax none | blink Example .example { -moz-text-blink: blink; } Specifications This property was defined in an old draft of the CSS 3 Text specification. Newer versions removed its definition. ...
-ms-content-zoom-chaining - Archive of obsolete content
Initial valuenoneApplies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values none The initial value. A bounce effect is shown when the user hits a zoom limit during page manipulation. chained The nearest zoomable parent element begins zooming when the user hits a zoom limit during page manipulation. No bounce effect is shown. Formal syntax none | chained Specifications Not part of any specification. Remarks This property has no effect on non-zoomable elements. ...
-ms-content-zoom-limit-max - Archive of obsolete content
Initial value400%Applies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoPercentagesThe largest allowed zoom factor. A zoom factor of 100% corresponds to no zooming. Larger values zoom in. Smaller values zoom out.Computed valueas specifiedAnimation typediscrete Syntax Values <percentage> The maximum zoom factor. Formal syntax <percentage> Specifications Not part of any specification. Remarks This property constrains the limit for touch zooming as well as values of the msContentZoomFactor property. This property has no effect on non-zoomable elements. ...
-ms-content-zoom-limit-min - Archive of obsolete content
Initial value100%Applies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoPercentagesThe smallest allowed zoom factor. A zoom factor of 100% corresponds to no zooming. Larger values zoom in. Smaller values zoom out.Computed valueas specifiedAnimation typediscrete Syntax Values <percentage> The minimum zoom factor. Formal syntax <percentage> Specifications Not part of any specification. Remarks This property constrains the limit for touch zooming as well as values of the msContentZoomFactor property. This property has no effect on non-zoomable elements. ...
-ms-content-zoom-limit - Archive of obsolete content
Initial valueas each of the properties of the shorthand:-ms-content-zoom-limit-max: 400%-ms-content-zoom-limit-min: 100%Applies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoPercentagesas each of the properties of the shorthand:-ms-content-zoom-limit-max: The largest allowed zoom factor. A zoom factor of 100% corresponds to no zooming. Larger values zoom in. Smaller values zoom out.-ms-content-zoom-limit-min: The smallest allowed zoom factor. A zoom factor of 100% corresponds to no zooming. Larger values zoom in. ...
-ms-content-zoom-snap-points - Archive of obsolete content
Initial valuesnapInterval(0%, 100%)Applies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values snapInterval( <percentage>, <percentage> ) Specifies where the snap-points will be placed. The first percentage specifies where the first snap-point will be placed. The second percentage specifies the distance between subsequent snap-points, both zoomed in and zoomed out from the initial snap-point. ...
-ms-content-zoom-snap-type - Archive of obsolete content
Initial valuenoneApplies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values none Initial value. Indicates that zooming is unaffected by any defined snap-points. After the contact is picked up, the content will continue to move with inertia. proximity Indicates that the motion of the content after the contact is picked up may be adjusted if the content would normally stop "close enough" to a snap-point. This implies that it is possible for the content zoom factor to end up between snap-points. ...
-ms-content-zoom-snap - Archive of obsolete content
Initial valueas each of the properties of the shorthand:-ms-content-zoom-snap-type: none-ms-content-zoom-snap-points: snapInterval(0%, 100%)Applies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas each of the properties of the shorthand:-ms-content-zoom-snap-type: as specified-ms-content-zoom-snap-points: as specifiedAnimation typediscrete Syntax The -ms-content-zoom-snap shorthand property is specified as one or both of the following content zoom snap values, in order, separated by spaces. ...
-ms-content-zooming - Archive of obsolete content
Initial valuezoom for the top level element, none for all other elementsApplies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values none The initial value of all elements except the top-level element. The element is not zoomable. zoom The initial value of the top-level element. The element is zoomable. Formal syntax none | zoom Specifications Not part of any specification. Remarks This property has no effect unless overflow is permitted on both the x- and y-axes. By default, zoom-enabled elements can be zoomed by the user via pinch-zoom. ...
-ms-flow-from - Archive of obsolete content
Initial valuenoneApplies tonon-replaced elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values none Default. No container has been specified. <custom-ident> The name of the region container. ...
-ms-flow-into - Archive of obsolete content
Initial valuenoneApplies toiframe elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values none Default. No container has been specified. <custom-ident> The name of the region container. ...
-ms-hyphenate-limit-chars - Archive of obsolete content
If the word does not meet the required minimum number of characters in the word, before the hyphen, or after the hyphen, then the word is not hyphenated. Initial valueautoApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete Syntax Values auto Corresponds to a value of 5 2 2, indicating a 5-character word limit, 2 characters required before a hyphenation break, and 2 characters required following a hyphenation break. ...
-ms-hyphenate-limit-lines - Archive of obsolete content
Initial valueno-limitApplies toblock container elementsInheritedyesComputed valueas specifiedAnimation typediscrete Syntax Values no-limit Indicates that hyphenation is not limited based on the number of consecutive hyphenated lines. In the flow above the consecutive hyphenated lines limit would be an infinitely large positive number. <integer> Indicates the maximum number of successive hyphenated lines. For instance, if 2, then no more than 2 successive lines may end with a hyphenated word. If 0 then no lines may end with a hyphenated word. ...
-ms-ime-align - Archive of obsolete content
The extension is implemented in Microsoft Edge and Internet Explorer 11. IME candidate lists are positioned on the screen with sufficient size to allow basic text input. In some cases, the IME may enforce a reasonable minimum size. In the case of -ms-ime-align: after, an IME might adjust the candidate window and keyboard input behavior to provide a better user experience, such as using a horizontal candidate list and allowing some keys to be sent to the app for suggestion list navigation. ...
-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. ...
-ms-scroll-chaining - Archive of obsolete content
Initial valuechainedApplies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values chained Initial value. The nearest scrollable parent element begins scrolling when the user hits a scroll limit during any manipulation. No bounce effect is shown. none A bounce effect is shown when the user hits a scroll limit during any manipulation. Formal syntax chained | none Examples The following example illustrates the -ms-scroll-chaining property in use. ...
-ms-scroll-limit-x-max - Archive of obsolete content
Initial valueautoApplies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values auto The maximum value for the scrollLeft property is equal to Element.scrollWidth. <length> The maximum value for the scrollLeft property. Formal syntax auto | <length> Specifications Not part of any specification. Remarks This property has no effect on non-scrollable elements. ...
-ms-scroll-limit-x-min - Archive of obsolete content
Initial value0Applies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values <length> The minimum value for the scrollLeft property. If the value is negative, then 0 is used. Formal syntax <length> Specifications Not part of any specification. Remarks This property has no effect on non-scrollable elements. The specified behavior of the -ms-scroll-limit-x-min property is only applicable at a mscontentzoomfactor of 1; the behavior of this property is undefined at other zoom factors. ...
-ms-scroll-limit-y-max - Archive of obsolete content
Initial valueautoApplies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values auto The maximum value for the scrollTop property is equal to Element.scrollHeight. <length> The maximum value for the scrollTop property. Formal syntax auto | <length> Specifications Not part of any specification. Remarks This property has no effect on non-scrollable elements. ...
-ms-scroll-limit-y-min - Archive of obsolete content
Initial value0Applies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values <length> The minimum value for the scrollTop property. If the value is negative, then 0 is used. Formal syntax <length> Specifications Not part of any specification. Remarks This property has no effect on non-scrollable elements. The specified behavior of the -ms-scroll-limit-y-min property is only applicable at a mscontentzoomfactor of 1; the behavior of this property is undefined at other zoom factors. ...
-ms-scroll-limit - Archive of obsolete content
The -ms-scroll-limit CSS property is a Microsoft extension that specifies values for the -ms-scroll-limit-x-min, -ms-scroll-limit-y-min, -ms-scroll-limit-x-max, and -ms-scroll-limit-y-max properties. Initial valueas each of the properties of the shorthand:-ms-scroll-limit-x-min: 0-ms-scroll-limit-y-min: 0-ms-scroll-limit-x-max: auto-ms-scroll-limit-y-max: autoApplies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas each of the properties of the shorthand:-ms-scroll-limit-x-min: as specified-ms-scroll-limit-y-min: as specified-ms-scroll-limit-x-max: as specified-ms-scroll-limit-y-max: as specifiedAnimation typediscrete Syntax The -ms-scroll-limit property is specified as one or more of the following scroll limit values, in the order...
-ms-scroll-rails - Archive of obsolete content
Initial valuerailedApplies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values none The content moves exactly with the user's finger. This value allows for free-form panning. railed Initial value. Panning locks to the primary axis of motion. Formal syntax none | railed Specifications Not part of any specification. Remarks This property has no effect on non-scrollable elements. Starting with Windows 8.1, this property is also supported for touchpad interaction. ...
-ms-scroll-snap-points-x - Archive of obsolete content
Initial valuesnapInterval(0px, 100%)Applies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values Note: a <length-percentage> is a value that can be either a <length> or a <percentaqe>. snapInterval( <length-percentage>, <length-percentage> ) Specifies a starting snap-point followed by the interval between all snap-points. The first value specifies where the first snap-point will be placed. ...
-ms-scroll-snap-points-y - Archive of obsolete content
Initial valuesnapInterval(0px, 100%)Applies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values Note: a <length-percentage> is a value that can be either a <length> or a <percentaqe>. snapInterval( <length-percentage>, <length-percentage> ) Specifies a starting snap-point followed by the interval between all snap-points. The first value specifies where the first snap-point will be placed. ...
-ms-scroll-snap-x - Archive of obsolete content
Initial valueas each of the properties of the shorthand:-ms-scroll-snap-type: none-ms-scroll-snap-points-x: snapInterval(0px, 100%)Applies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas each of the properties of the shorthand:-ms-scroll-snap-type: as specified-ms-scroll-snap-points-x: as specifiedAnimation typediscrete Syntax Values The -ms-scroll-snap-x shorthand property is specified as one or both of the following values, in order and separated by spaces. -ms-scroll-snap-type The value of the -ms-scroll-snap-type property. ...
-ms-scroll-snap-y - Archive of obsolete content
Initial valueas each of the properties of the shorthand:-ms-scroll-snap-type: none-ms-scroll-snap-points-y: snapInterval(0px, 100%)Applies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas each of the properties of the shorthand:-ms-scroll-snap-type: as specified-ms-scroll-snap-points-y: as specifiedAnimation typediscrete Syntax Values The -ms-scroll-snap-y shorthand property is specified as one or both of the following values, in order and separated by spaces. -ms-scroll-snap-type The value of the -ms-scroll-snap-type property. ...
-ms-scrollbar-3dlight-color - Archive of obsolete content
Initial valuedepends on user agentApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete Syntax Values <color> The color of the top and left edges of the scroll box and scroll arrows of the scroll bar. ...
-ms-scrollbar-arrow-color - Archive of obsolete content
Initial valueButtonTextApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete Syntax Values <color> The color of the scroll arrows of the scroll bar. ...
-ms-scrollbar-base-color - Archive of obsolete content
Initial valuedepends on user agentApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete Syntax Values <color> The base color of the main elements of a scroll bar. ...
-ms-scrollbar-darkshadow-color - Archive of obsolete content
Initial valueThreeDDarkShadowApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete Syntax Values <color> The color of the scroll bar's gutter. ...
-ms-scrollbar-face-color - Archive of obsolete content
Initial valueThreeDFaceApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete Syntax Values <color> The color of the scroll box and scroll arrows. ...
-ms-scrollbar-highlight-color - Archive of obsolete content
Initial valueThreeDHighlightApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete Syntax Values <color> The color of the slider tray, the top and left edges of the scroll box, and the scroll arrows of a scroll bar. ...
-ms-scrollbar-shadow-color - Archive of obsolete content
Initial valueThreeDDarkShadowApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete Syntax Values <color> The color of the bottom and right edges of the scroll box and scroll arrows of a scroll bar. ...
-ms-scrollbar-track-color - Archive of obsolete content
Initial valueScrollbarApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete Syntax Values <color> The color of the track element. ...
-ms-touch-select - Archive of obsolete content
Initial valuegrippersApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete Syntax Values grippers The grippers are always on. In addition, selection will start even if an onclick, onmsgesturetap, or onmouseup handler is present. This is the initial value. none The grippers are always off and default touch selection functionality is not provided. Formal syntax grippers | none Specifications Not part of any specification. Remarks This property requires Windows 8 or later. ...
-ms-wrap-margin - Archive of obsolete content
Initial value0Applies toexclusion elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values <length> The margin size, a non-negative value. Formal syntax <length> Specifications Not part of any specification. Remarks Offsets created by the -ms-wrap-margin property are offset from the outside of the exclusion. ...
:-moz-full-screen-ancestor - Archive of obsolete content
However, those elements' ancestors have this pseudo-class applied to them. ...
:-moz-system-metric(images-in-menus) - Archive of obsolete content
This selector is intended for use mainly by theme developers. Note: Since Firefox 58, this pseudo-class is no longer available to web content -- it is only available internally (e.g. ...
:-moz-system-metric(scrollbar-end-backward) - Archive of obsolete content
This selector is intended for use mainly by theme developers. Note: Since Firefox 58, this pseudo-class is no longer available to web content -- it is only available internally (e.g. to XUL / chrome code). ...
:-moz-system-metric(scrollbar-end-forward) - Archive of obsolete content
This selector is intended for use mainly by theme developers. Note: Since Firefox 58, this pseudo-class is no longer available to web content -- it is only available internally (e.g. to XUL / chrome code). ...
:-moz-system-metric(scrollbar-start-backward) - Archive of obsolete content
This selector is intended for use mainly by theme developers. Note: Since Firefox 58, this pseudo-class is no longer available to web content -- it is only available internally (e.g. to XUL / chrome code). ...
:-moz-system-metric(scrollbar-start-forward) - Archive of obsolete content
This selector is intended for use mainly by theme developers. Note: Since Firefox 58, this pseudo-class is no longer available to web content -- it is only available internally (e.g. to XUL / chrome code). ...
:-moz-system-metric(scrollbar-thumb-proportional) - Archive of obsolete content
This selector is intended for use mainly by theme developers. Note: Since Firefox 58, this pseudo-class is no longer available to web content -- it is only available internally (e.g. to XUL / chrome code). ...
:-moz-system-metric(touch-enabled) - Archive of obsolete content
Note: Since Firefox 58, this pseudo-class is no longer available to web content -- it is only available internally (e.g. to XUL / chrome code). See bug 1396066 for more details. Use the -moz-touch-enabled media query instead. ...
-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. If it's using the newer Fremantle theme, this is 0. ...
-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
Syntax <integer> In recent Windows versions (e.g., 10), if accent colors are enabled in window titlebars, this is 1. ...
-moz-windows-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-windows-theme Gecko-only CSS media feature is useful for customizing application skins and other chrome code to work well with the user's Windows theme. Syntax The -moz-windows-theme feature is specified as a keyword value that Indicates which Windows theme is currently being used. Values aero luna-blue luna-olive luna-silver royale generic zune Media: media/visual Accepts min/max prefixes: no ...
Reference - Archive of obsolete content
d 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? --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 the...
Troubleshooting XForms Forms - Archive of obsolete content
<data> <value>42</value> </data> </xf:instance> You should use <output ref="instance('ins2')/value"/> to show the contents of the value element. (specification). Repeat And Tables Not Working Unfortunately you cannot do: <table> <xf:repeat nodeset="..."> <tr> ... </tr> </xf:repeat> </table> The XHTML modularization does not allow this. You either have to use CSS tables or repeat attributes, which at the moment are not working properly in the Firefox XForms extension :( Should be fixed by bug 306247 and bug 280368 respectively. Submission Not Working If you are trying to replace="instance" make sure that the document being returned is XML. There will be an error on the Javascript Console if it is not. On most webservers you cannot use <submission me...
Correctly Using Titles With External Stylesheets - Archive of obsolete content
as 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: <link type="text/css" rel="stylesheet" title="Basic styles" href="basic.css" /> <link type="text/css" rel="stylesheet" title="Fish and boats" href="ocean.css" /> According to the HTML 4.01 specification, only one of the preferred stylesheets can be used at a time. Therefore, given the above example, only one of the two preferred stylesheets will be applied to the document. The specification does not supply a procedu...
Styling Abbreviations and Acronyms - Archive of obsolete content
The underline tells readers that the word in questi...
Anatomy of a video game - Game development
control over each frame of animation. It is also very simple because main() is the only function getting looped. A First Person Shooter (or a similar game) presents a new scene once every frame. You cannot really get more smooth and responsive than that. But do not immediately assume animations require frame-by-frame control. Simple animations can be easily performed, even GPU-accelerated, with CSS animations and other tools included in the browser. There are a lot of them and they will make your life easier. Building a better main loop in Javascript There are two obvious issues with our previous main loop: main() pollutes the window object (where all global variables are stored) and the example code did not leave us with a way to stop the loop unless the whole tab is closed or refreshed.
Building up a basic demo with Babylon.js - Game development
The first <script> element includes the Babylon.js library in the page; we will write our example code in the second one. There is one helper variable already included, which will store a reference to the <canvas> element. Before reading on, copy t...
Building up a basic demo with the PlayCanvas engine - Game development
The first <script> element includes the PlayCanvas library in the page; we will write our example code in the second one. There is one helper variable already included, which will store a reference to the <canvas> element. Before reading on, copy this cod...
Audio for Web games - Game development
three pieces of audio at the same time using the standard audio API. Note: Simple autoplay functionality is tested with our autoplay test example. Note: Volume changeability is tested with our volume test example. Mobile workarounds Although mobile browsers can present problems, there are ways to work around the issues detailed above. Audio sprites Audio sprites borrow their name from CSS sprites, which is a visual technique for using CSS with a single graphic resource to break it into a series of sprites. We can apply the same principle to audio so that rather than having a bunch of small audio files that take time to load and play, we have one larger audio file containing all the smaller audio snippets we need. To play a specific sound from the file, we just use the known start ...
Techniques for game development - Game development
eer-to-peer data channels to exchange text or binary data actively between your players. This article explains what this can do for you, and shows how to use libraries that make this easy. Efficient animation for web games This article covers techniques and advice for creating efficient animation for web games, with a slant towards supporting lower end devices such as mobile phones. We touch on CSS transitions and CSS animations, and JavaScript loops involving window.requestAnimationFrame. Audio for Web Games Audio is an important part of any game -- it adds feedback and atmosphere. Web-based audio is maturing fast, but there are still many browser differences to negotiate. This article provides a detailed guide to implementing audio for web games, looking at what works currently across a...
Track the score and win - Game development
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 parameter is the text itself -- the code above shows the current number of points -- and the last two parameters are the coordinates where the text will be placed on the canvas.
Initialize the framework - Game development
I would recommend the min.js option as it keeps the source code smaller, and you are unlikely need to go through the source code anyway. Save the Phaser code inside a /js directory in the same location as your index.html file. Update the src value of the first <script> element as shown above. Walking through what we have so far At this point we have a charset defined, <title> and some basic CSS in the header to reset the default margin and padding. We also have a <script> element to apply the Phaser source code to the page. The body contains a second <script> element, where we will write the JavaScript code to render the game and control it. The <canvas> element is generated automatically by the framework. We are initializing it by creating a new Phaser.Game object and assigning it to ...
Scaling - Game development
The other two lines of code in the preload() function are responsible for aligning the canvas element horizontally and vertically, so it is always centered on screen regardless of size. Adding a custom canvas background colour We can also add a custom background color to our canvas, so it won't stay black. The stage object has a backgroundColor property for this purpose, which we can set using CSS color definition syntax. Add the following line below the other three you added earlier: game.stage.backgroundColor = '#eee'; Compare your code You can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: Next steps Now we've set up the scaling for our game, let's continue to the third lesson and work out how to load the asset...
The score - Game development
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 new lines seen below to the ballHitBrick() function: function ballHitBri...
2D maze game with device orientation - Game development
The <body> contains initialization of the Phaser framework and the definitions of the game states. var game = new Phaser.Game(320, 480, Phaser.CANVAS, 'game'); The line above will initialize the Phaser instance -- the arguments are the width of the Canvas, height of the Canvas, rendering method (we're using CANVAS, but there are also WEBGL and ...
Visual-js game engine - Game development
isual js - Pencil by VisualJS game engine (@zlatnaspirala) on CodePen. Online demo examples at : https://jsfiddle.net/user/zlatnaspirala/fiddles/ Demo slot mashine basic demo at : https://jsfiddle.net/zlatnaspirala/7d0d8v6d/ Help about new 2d part - implementation of matter.js based typescript . I make strong relation with webpack and project . build folder is full vendor nature. Html css and resources come from dependency logic taken from source. To make all dependency works in build proccess we need some plugins. Features : Tile's background draw for images (alias sprite - but for now there's no sprite and frame by frame animation methods). Small engine config . Some option in aspect view like npm install ... npm install typescript npm i clean-webpack-plugin --save-dev...
Game development
provide resources for web developers wanting to develop games. You will find many useful tutorials and technique articles in the main menu on the left, so feel free to explore. We've also included a reference section so you can easily find information about all the most common APIs used in game development. Note: Creating games on the web draws on a number of core web technologies such as HTML, CSS, and JavaScript. The Learning Area is a good place to go to get started with the basics. Port native games to the Web If you are a native developer (for example writing games in C++), and you are interested in how you can port your games over to the Web, you should learn more about our Emscripten tool -- this is an LLVM to JavaScript compiler, which takes LLVM bytecode (e.g. generated from C/...
Alignment container - MDN Web Docs Glossary: Definitions of Web-related terms
The alignment container is the rectangle that the alignment subject is aligned within. This is defined by the layout mode; it is usually the alignment subject's containing block, and assumes the writing mode of the box establishing the containing block. Learn more CSS Box Alignment ...
Alpha (alpha channel) - MDN Web Docs Glossary: Definitions of Web-related terms
The two boxes are drawn on top of a paragraph of text. As you can see, the color without an alpha channel completely blocks the background text, while the box with the alpha channel leaves it visible through the purple background color. Learn more General knowledge Alpha compositing on Wikipedia RGBA color model on Wikipedia Channel (digital image) on Wikipedia Technical reference CSS color ...
Block - MDN Web Docs Glossary: Definitions of Web-related terms
underneath the preceding element in a horizontal writing mode, and above the following element (commonly known as a block-level element). For example, <p> is by default a block-level element, whereas <a> is an inline element -- you can put several links next to one another in your HTML source and they will sit on the same line as one another in the rendered output. Block (scripting) In JavaScript, a block is a collection of related statements enclosed in braces ("{}"). ...
Bootstrap - MDN Web Docs Glossary: Definitions of Web-related terms
Initially, Bootstrap was called Twitter Blueprint and was developed by a team working at Twitter. It supports responsive design and features predefined design templates that you can use out of the box, or customize for your needs with your code. ...
Bézier curve - MDN Web Docs Glossary: Definitions of Web-related terms
irst helper line and the end point on the second helper line. ...
Code splitting - MDN Web Docs Glossary: Definitions of Web-related terms
To prevent the requirement of downloading ginormous files, scripts can be split into multiple smaller files. ...
Continuous Media - MDN Web Docs Glossary: Definitions of Web-related terms
Continuous media is data where there is a timing relationship between source and destination. The most common examples of continuous media are audio and motion video. Continuous media can be real-time (interactive), where there is a "tight" timing relationship between source and sink, or streaming (playback), where the relationship is less strict. CSS can be used in a variety of contexts, including print media and some CSS, in particular, that used for layout behaves differently depending on the context it is in. Continuous Media, therefore, identifies a context where the content is not broken up, it flows continuously. Web content displayed on a screen is continuous media, as is spoken content. ...
DHTML - MDN Web Docs Glossary: Definitions of Web-related terms
DHTML (Dynamic HTML) refers to the code behind interactive webpages that need no plugins like Flash or Java. DHTML aggregates the combined functionality of HTML, CSS, the DOM, and JavaScript. Learn more General knowledge DHTML on Wikipedia ...
Developer Tools - MDN Web Docs Glossary: Definitions of Web-related terms
Developer tools (or "development tools" or short "DevTools") are programs that allow a developer to create, test and debug software. Current browsers provide integrated developer tools, which allow to inspect a website. They let users inspect and debug the page's HTML, CSS, and JavaScript, allow to inspect the network traffic it causes, make it possible to measure it's performance, and much more. Learn more General knowledge Web development tools on Wikipedia Technical reference Firefox Developer Tools on MDN Firebug (former developer tool for Firefox) Chrome DevTools on chrome.com Safari Web Inspector on apple.com Edge Dev Tools on microsoft.com ...
Domain sharding - MDN Web Docs Glossary: Definitions of Web-related terms
sers are able to download more resources simultaneously, resulting in a faster page load time and improved user experience. The problem with domain sharding, in terms of performance, is the cost of extra DNS lookups for each domain and the overhead of establishing each TCP connection. The initial response from an HTTP request is generally an HTML file listing other resources such as JavaScript, CSS, images and other media files that need to be downloaded. As browsers limit the number of active connections per domain, serving all the required resources from a single domain could be slow as assets need to be downloaded sequentially. With domain sharding, the required downloads are served from more than one domain, enabling the browser to simultaneously download needed resources. Multiple doma...
Fragmentainer - MDN Web Docs Glossary: Definitions of Web-related terms
A fragmentainer is defined in the CSS Fragmentation Specification as follows: A box--such as a page box, column box, or region--that contains a portion (or all) of a fragmented flow. Fragmentainers can be pre-defined, or generated as needed. When breakable content would overflow a fragmentainer in the block dimension, it breaks into the next container in its fragmentation context instead. Fragmented contexts are found in CSS Paged Media, where the fragmentainer would be the box which defines a page. In Multiple-column Layout the fragmentainer is the column box created when columns are defined on a multicol container. In CSS Regions each Region is a fragmentainer. ...
Gaia - MDN Web Docs Glossary: Definitions of Web-related terms
The user interface and default application suite of the Firefox OS platform. Once Firefox OS starts, anything drawn to screen is a product of the Gaia layer (e.g., the lock screen, home screen, standard apps). Gaia is implemented entirely with HTML, CSS, and JavaScript, and its only interfaces to the underlying operating system are through open Web APIs, which the Gecko layer implements. You can install third-party apps alongside Gaia. Learn more Technical reference Gaia platform guide Gaia development/hacking guide ...
Gecko - MDN Web Docs Glossary: Definitions of Web-related terms
Besides this, Gecko makes sure associated APIs work well on every operating system Gecko supports, and that appropriate APIs are exposed only to relevant support targets. ...
Graceful degradation - MDN Web Docs Glossary: Definitions of Web-related terms
ing to build a modern web site/application that will work in the newest browsers, but falls back to an experience that while not as good still delivers essential content and functionality in older browsers. Polyfills can be used to build in missing features with JavaScript, but acceptable alternatives to features like styling and layout should be provided where possible, for example by using the CSS cascade, or HTML fallback behaviour. Some good examples can be found in Handling common HTML and CSS problems. It is a useful technique that allows Web developers to focus on developing the best possible websites, given that those websites are accessed by multiple unknown user-agents. Progressive enhancement is related but different -- often seen as going in the opposite direction to graceful de...
Grid - MDN Web Docs Glossary: Definitions of Web-related terms
The grid that you define using these properties is described as an explicit grid. If you place content outside of this explicit grid, or if you are relying on auto-placement and the grid algorithm needs to create additional row or column tracks to hold grid items, then extra tracks will be created in the implicit grid. The implicit grid is the grid created automatically due to content being added outside of the tracks defined. In the example below I have created an explicit grid of three columns and two rows. ...
Grid Areas - MDN Web Docs Glossary: Definitions of Web-related terms
d-template-rows: 100px 100px; grid-template-areas: "a a b" "a a b"; } .item1 { grid-area: a; } .item2 { grid-area: b; } <div class="wrapper"> <div class="item1">Item</div> <div class="item2">Item</div> </div> Learn More Property reference grid-template-columns grid-template-rows grid-auto-rows grid-auto-columns grid-template-areas grid-area Further reading CSS Grid Layout Guide: Basic concepts of grid layout CSS Grid Layout Guide: Grid template areas Definition of Grid Areas in the CSS Grid Layout specification ...
Head - MDN Web Docs Glossary: Definitions of Web-related terms
Learn more HTML head <head> element reference on MDN The HTML <head> on the MDN Learning Area ...
Intrinsic Size - MDN Web Docs Glossary: Definitions of Web-related terms
Intrinsic sizing takes into account the min-content and max-content size of an element. For text the min-content size would be if the text wrapped as small as it can in the inline direction without causing an overflow, doing as much soft-wrapping as possible. For a box containing a string of text, the min-content size would be defined by the longest word. ...
MVC - MDN Web Docs Glossary: Definitions of Web-related terms
developer, this pattern will probably be quite familiar even if you've never consciously used it before. Your data model is probably contained in some kind of database (be it a traditional server-side database like MySQL, or a client-side solution such as IndexedDB [en-US].) Your app's controlling code is probably written in HTML/JavaScript, and your user interface is probably written using HTML/CSS/whatever else you like. This sounds very much like MVC, but MVC makes these components follow a more rigid pattern. In the early days of the Web, MVC architecture was mostly implemented on the server-side, with the client requesting updates via forms or links, and receiving updated views back to display in the browser. However, these days, more of the logic is pushed to the client with the adven...
Media - MDN Web Docs Glossary: Definitions of Web-related terms
he term media is an overloaded one when talking 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
. HTML tokens include start and end tags, as well as attribute names and values. If the document is well-formed, parsing it is straightforward and faster. The parser parses tokenized 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 conte...
Perceived performance - MDN Web Docs Glossary: Definitions of Web-related terms
paint. While increased performance generally increases perceived performance, there are some techniques that can be used to increase perceived performance while marginally decreasing actual performance. There are front end optimization techniques that can improve perceived performance, such as adding the defer or async attribute to scripts, or placing scripts at the end of documents, and placing CSS in the head of documents. Learn more perceived performance ...
Polyfill - MDN Web Docs Glossary: Definitions of Web-related terms
A polyfill is a piece of code (usually JavaScript on the Web) used to provide modern functionality on older browsers that do not natively support it. For example, a polyfill could be used to mimic the functionality of an HTML Canvas element on Microsoft Internet Explorer 7 using a Silverlight plugin or mimic support for CSS rem units, or text-shadow, or whatever you want. The reason why polyfills are not used exclusively is for better functionality and better performance. Native implementations of APIs can do more and are faster than polyfills. For example, the Object.create polyfill only contains the functionalities that are possible in a non-native implementation of Object.create. Other times, polyfills are used to address issues where browsers implement the same features in diff...
Pseudo-class - MDN Web Docs Glossary: Definitions of Web-related terms
For example, the selector a:visited applies styles only to links that the user has already followed. ...
Pseudo-element - MDN Web Docs Glossary: Definitions of Web-related terms
For example, rather than putting the first letter of each paragraph in its own element, you can style them all with p::first-letter. ...
Raster image - MDN Web Docs Glossary: Definitions of Web-related terms
...
Rendering engine - MDN Web Docs Glossary: Definitions of Web-related terms
A rendering engine is software that draws text and images on the screen. The engine draws structured text from a document (often HTML), and formats it properly based on the given style declarations (often given in CSS). Examples of layout engines: Blink, Gecko, EdgeHTML, WebKit. Learn more General knowledge Web browser engine on Wikipedia Technical reference Gecko documentation Venkatraman.R - Behind Browsers (Part 1, Basics) ...
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
The process whereby an object or data structure is translated into a format suitable for transferral over a network, or storage (e.g. in an array buffer or file format). In JavaScript, for example, you can serialize an object to a JSON string by calling the function JSON.stringify(). CSS values are serialized by calling the function CSSStyleDeclaration.getPropertyValue(). Learn more General knowledge Serialization on Wikipedia ...
Snap positions - MDN Web Docs Glossary: Definitions of Web-related terms
...
Syntax error - MDN Web Docs Glossary: Definitions of Web-related terms
An exception caused by the incorrect use of a pre-defined syntax. Syntax errors are detected while compiling or parsing source code. For example, if you leave off a closing brace (}) when defining a JavaScript function, you trigger a syntax error. Browser development tools display JavaScript and CSS syntax errors in the console. Learn more General Knowledge Syntax error on Wikipedia SyntaxError JavaScript object ...
Validator - MDN Web Docs Glossary: Definitions of Web-related terms
A validator is a program that checks for syntax errors in code. Validators can be created for any format or language, but in our context we speak of tools that check HTML, CSS, and XML. Learn more General knowledge Validator on Wikipedia Short list of validators ...
WebKit - MDN Web Docs Glossary: Definitions of Web-related terms
aries, but many individuals and companies have since contributed (including KDE, Apple, Google, and Nokia). WebKit is an Apple trademark, and the framework is distributed under a BSD-form license. However, two important components fall under the LGPL: the WebCore rendering library and the JavaScriptCore engine. Learn more General knowledge WebKit on Wikipedia Technical reference WebKit CSS extensions ...
Web standards - MDN Web Docs Glossary: Definitions of Web-related terms
t evolve to improve the current status and adapt to new circumstances. ...
Whitespace - MDN Web Docs Glossary: Definitions of Web-related terms
Whitespace is a set of characters which is used to show horizontal or vertical spaces between other characters. They are often used to separate tokens in HTML, CSS, JavaScript, and other computer languages. Whitespace characters and their usage vary between languages. In HTML HTML Living Standard specifies 5 characters as the ASCII whitespace: U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, and U+0020 SPACE. In the form of text, they are treated as normal space characters and sequential whitespaces are collapsed as a single space in many cases (this behavior can be changed by the white-space CSS property. They are also used as a separator of an element name and its parameters, class names, and so on. In JavaScript ECMAScript(R) 2015 Language Specification specifies several Unicode co...
Baseline - MDN Web Docs Glossary: Definitions of Web-related terms
n imaginary line upon which the characters of a font rest. ...
caret - MDN Web Docs Glossary: Definitions of Web-related terms
the insertion point. The word "caret" differentiates the text insertion point from the mouse cursor. On the web, a caret is used to represent the insertion point in <input> and <textarea> elements, as well as any elements whose contenteditable attribute is set, thereby allowing the contents of the element to be edited by the user. Learn more General knowledge Caret navigation on Wikipedia CSS related to the caret You can set the color of the caret for a given element's editable content by setting the element's CSS caret-color property to the appropriate <color> value. HTML elements that may present a caret These elements provide text entry fields or boxes and therefore make use of the caret. <input type="text"> <input type="password"> <input type="search"> <input type="date">...
Property - MDN Web Docs Glossary: Definitions of Web-related terms
The term property can have several meanings depending on the context. It may refer to: Property (CSS) A CSS property is a characteristic (like color) whose associated value defines one aspect of how the browser should display the element. Property (JavaScript) A JavaScript property is a characteristic of an object, often describing attributes associated with a data structure. ...
Test your skills: HTML accessibility - Learn web development
le: Download the starting point for this task to work in your own editor or in an online editor. HTML accessibility 4 In our final HTML accessibility task, you are given a simple image gallery, which has some accessibility problems. Can you fix them? The header image has an accessiiblity issue, and so do the gallery images. You could take the header image further and implement it using CSS for arguably better accessibility. Why is this better, and what would a solution look like? 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. Assessment or further help You can practice these examples in the Interactive Editors above. If you would like your work assessed, or are...
Test your skills: WAI-ARIA - Learn web development
to make it easily findable? How can you give the search input a suitable label, without explicitly adding a visible text label to the DOM? 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. WAI-ARIA 3 For this final WAI-ARIA task, we return to an example we previously saw in the CSS and JavaScript skilltest. As before, we have a simple app that presents a list of animal names. Clicking one of the animal names causes a further description of that animal to appear in a box below the list. Here, we are starting with a mouse- and keyboard-accessible version. The problem we have now is that when the DOM changes to show a new decription, screenreaders cannot see what has change...
Test your skills: Overflow - Learn web development
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 One The content is overflowing the box because it has a fixed height. Keep the height but cause the box to have scrollbars only if there is enough text to cause an overflow. Test by removing some of the text from the HTML, that if there is only a small amount of text that does not overflow, no scrollbar appears. ...
Test your skills: sizing - Learn web development
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 One In this task, you have two boxes. ...
Test your skills: backgrounds and borders - Learn web development
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. Backgrounds and Borders 1 In this task we want you to add a background, border, and some simple styling to a page header: Give the box a 5px black solid border, with rounded corners of 10px. ...
Test your skills: Writing Modes and Logical Properties - Learn web development
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 One The box in the example is displayed with a horizontal writing mode. Can you add a line of CSS to change it so it uses a vertical writing mode with right to left text? Your example should look like the image below. 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. Task Two In the example below use logical properties to replace widt...
Test your skills: floats - Learn web development
You will be working through three small tasks which use different elements of the material you have just covered. 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. Floats One In this task you need to float the two elements with a class of float1 and float2 left and right respectively. The text should then appear between the two boxes as in the image below. ...
Test your skills: Multicol - Learn web development
You will be working through three small tasks which use different elements of the material you have just covered. 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. Multicol One In this task you need to create three columns, with a 50px gap between each column. ...
Test your skills: position - Learn web development
You will be working through two small tasks which use different elements of the material you have just covered. 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. Positioning One In this task you need to position the item with a class of target to the top and right of the container, which has the 5px grey border. ...
What do common web layouts contain? - Learn web development
nt. It doesn't really matter. What does matter is, if you put something right under the header, it should either be main content or directly related to the main content. It's a trap MICA. This is a bit trickier. It looks like a three-column layout... ...but it's not. B1 and B2 float around the main content. Remember that word "float"--it will ring a bell when you start learning about CSS. Why would you think it's a three-column layout? Because the image on the top-right is L-shaped, because B1 looks like a column supporting the shifted main content, and because the "M" and "I" of the MICA logo create a vertical line of force. This is a good example of a classic layout supporting some design creativity. Simple layouts are easier to implement, but allow yourself room to express y...
Basic native form controls - Learn web development
s Text <input> fields are the most basic form widgets. They are a very convenient way to let the user enter any kind of data, and we've already seen a few simple examples. Note: HTML form text fields are simple plain text input controls. This means that you cannot use them to perform rich editing (bold, italic, etc.). All rich text editors you'll encounter are custom widgets created with HTML, CSS, and JavaScript. All basic text controls share some common behaviors: They can be marked as readonly (the user cannot modify the input value but it is still sent with the rest of the form data) or disabled (the input value can't be modified and is never sent with the rest of the form data). They can have a placeholder; this is text that appears inside the text input box that should be used ...
Example 3 - Learn web development
n> <option>Strawberry</option> <option>Apple</option> </select> <div class="select" tabindex="0"> <span class="value">Cherry</span> <ul class="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 : ...
Example 4 - Learn web development
ion>Banana</option> <option>Strawberry</option> <option>Apple</option> </select> <div class="select"> <span class="value">Cherry</span> <ul class="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 : ...
Example 5 - Learn web development
x"> <span class="value">Cherry</span> <ul class="optList hidden" role="presentation"> <li class="option" role="option" aria-selected="true">Cherry</li> <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 : ...
Example - Learn web development
id="number" name="cardnumber"> </p> <p> <label for="date"> <span>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; ...
Test your skills: Advanced styling - Learn web development
in so that users can tell when the search box is being hovered or focused? Another thing that commonly denotes a search box is a magnifying glass icon. We've made one available in the same directory as our HTML files -- see search-24px.png -- plus a <div> element after the search input to help you attach it, should you need it. Can you figure out a sensible way to attach it, and can you use some CSS to get it to sit to the right of the search box, and be lined up vertically as well? 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. 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 alread...
Test your skills: Styling basics - Learn web development
ile locally, however it may be helpful to put your code in 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. Styling basics 1 Our basic form styling assessment is fairly free-form, and you have a lot of flexibility over what you end up doing here. But your CSS should aim to fulfill the following requirements: Add some kind of lightweight "reset" to make fonts, padding, margin, and sizing more consistent to begin with. On top of that, add in some nice, consistent styling for the inputs and button. Use some kind of layout technique to make the inputs and labels line up neatly. Download the starting point for this task to work in your own editor o...
Example - Learn web development
or="name">Name:</label> <input type="text" id="name" name="user_name"> </div> <div> <label for="mail">E-mail:</label> <input type="email" id="mail" name="user_email"> </div> <div> <label for="msg">Message:</label> <textarea id="msg" name="user_message"></textarea> </div> <div class="button"> <button type="submit">Send your message</button> </div> </form> CSS Content form { /* Just to center the form on the page */ margin: 0 auto; width: 400px; /* To see the limits of the form */ padding: 1em; border: 1px solid #CCC; border-radius: 1em; } div + div { margin-top: 1em; } label { /* To make sure that all label have the same size and are properly align */ display: inline-block; width: 90px; text-align: right; } input, textarea...
How the Web works - Learn web development
Transfer Protocol is an application protocol that defines a language for clients and servers to speak to each other. This is like the language you use to order your goods. Component files: A website is made up of many different files, which are like the different parts of the goods you buy from the shop. These files come in two main types: Code files: Websites are built primarily from HTML, CSS, and JavaScript, though you'll meet other technologies a bit later. Assets: This is a collective name for all the other stuff that makes up a website, such as images, music, video, Word documents, and PDFs. So what happens, exactly? When you type a web address into your browser (for our analogy that's like walking to the shop): The browser goes to the DNS server, and finds the real ad...
What will your website look like? - Learn web development
Selected" button in the panel at the bottom of the page ("*" depends on how many fonts you selected). In the popup box, you can see and copy the lines of code Google gives you into your text editor to save for later. Previous Overview: Getting started with the web Next In this module Installing basic software What will your website look like? Dealing with files HTML basics CSS basics JavaScript basics Publishing your website How the web works ...
Getting started with the Web - Learn web development
sues you should be aware 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 int...
HTML Cheatsheet - Learn web development
umentation as well as a deep instructional HTML how-to. However, in many cases we just need some quick hints as we go. That's the whole purpose of the cheatsheet, to give you some quick accurate ready to use code snippets for common usages. Remember that HTML tags must be used for their semantic, not their appearance. It's always possible to totally change the look and feel of a given tag using CSS so, when using HTML, take the time to focus on the meaning rather than the appearance. Inline elements An "element" is a single part of a webpage. Some elements are large and hold smaller elements like containers. Some elements are small and are "nested" inside larger ones. By default, "inline elements" appear next to one another in a webpage. They take up only as much width as they need in a ...
Use JavaScript within a webpage - Learn web development
g scripts. Moreover, third-party scripts (ads, tracking scripts, browser extensions) might break your scripts. At a minimum, leave a short message with <noscript> like this: <noscript>To use this site, please enable JavaScript.</noscript> Ideally, replicate the JavaScript functionality with HTML and server-side scripting when possible. If you're only looking for simple visual effects, CSS can often get the job done even more intuitively. Since almost everybody does have JavaScript enabled, <noscript> is no excuse for writing inaccessible scripts. Learn more <script> <noscript> James Edwards' introduction to using JavaScript accessibly Accessibility guidelines from W3C ...
Use HTML to solve common problems - Learn web development
Learn › HTML › Howto
L Hyperlinks One of the main reasons for HTML is making navigation easy with hyperlinks, which can be used in many different ways: How to create a hyperlink How to create a table of contents with HTML Images & multimedia How to add images to a webpage How to add video content to a webpage Scripting & styling HTML only sets up document structure. To solve presentation issues, use CSS, or use scripting to make your page interactive. How to use CSS within a webpage How to use JavaScript within a webpage Embedded content How to embed a webpage within another webpage How to add Flash content within a webpage Uncommon or advanced problems Beyond the basics, HTML is very rich and offers advanced features for solving complex problems. These articles help you tackle th...
Advanced text formatting - Learn web development
quire paragraph breaks.</q></p> Browser default styling will render this as normal text put in quotes to indicate a quotation, like so: Citations The content of the cite attribute sounds useful, but unfortunately browsers, screenreaders, etc. don't really do much with it. There is no way to get the browser to display the contents of cite, without writing your own solution using JavaScript or CSS. If you want to make the source of the quotation available on the page you need to make it available in the text via a link or some other appropriate way. There is a <cite> element, but this is meant to contain the title of the resource being quoted, e.g. the name of the book. There is no reason however why you couldn't link the text inside <cite> to the quote source in some way: <p>According t...
Test your skills: Advanced HTML text - Learn web development
below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Advanced HTML text 2 In this task we want you to add some semantics to the provided HTML as follows: Turn the second paragraph into a block-level quote, and semantically indicate that the quote is taken from Accessibility. Semantically mark up "HTML" and "CSS" as acronyms, providing expansions as tooltips. Semantically associate machine-readable dates with the dates in the text. Use subscript and superscript to provide correct semantics for the chemical formulae and dates, and make them display correctly. 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 i...
Introduction to HTML - Learn web development
how a typical HTML page 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 ...
Mozilla splash page - Learn web development
ory for now, 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 resour...
HTML Tables - Learn web development
Learn › HTML › Tables
This module takes you through all you need to know about structuring tabular data using 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. ...
Structuring the web with HTML - Learn web development
e web complete beginner's 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. ...
Functions — reusable blocks of code - Learn web development
e task inside a defined block, and then call that code whenever you need it using a single short command -- rather than having to type out the same code multiple times. In this article we'll explore fundamental concepts behind functions such as basic syntax, how to invoke and define them, scope, and parameters. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, JavaScript first steps. Objective: To understand the fundamental concepts behind JavaScript functions. Where do I find functions? In JavaScript, you'll find functions everywhere. In fact, we've been using functions all the way through the course so far; we've just not been talking about them very much. Now is the time, however, for us to start talking about functions explicit...
Looping code - Learn web development
ng blocks Next Programming languages are very useful for rapidly completing repetitive tasks, from multiple basic calculations to just about any other situation where you've got a lot of similar items of work to complete. Here we'll look at the loop structures available in JavaScript that handle such needs. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, JavaScript first steps. Objective: To understand how to use loops in JavaScript. Keep me in the loop Loops, loops, loops. As well as being associated with popular breakfast cereals, roller coasters, and musical production, they are also a critical concept in programming. Programming loops are all to do with doing the same thing over and over again -- which is termed iteration...
Function return values - Learn web development
's one last essential concept about functions for us to discuss -- return values. Some functions don't return a significant value, but others do. It's important to understand what their values are, how to use them in your code, and how to make functions return useful values. We'll cover all of these below. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, JavaScript first steps, Functions -- reusable blocks of code. Objective: To understand function return values, and how to make use of them. What are return values? Return values are just what they sound like -- the values that a function returns when it has completed. You've already met return values a number of times, although you may not have thought about them explici...
Making decisions in your code — conditionals - Learn web development
ifferent inputs. For example, in a game, if the player's number of lives is 0, then it's game over. In a weather app, if it is being looked at in the morning, show a sunrise graphic; show stars and a moon if it is nighttime. In this article, we'll explore how so-called conditional statements work in JavaScript. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, JavaScript first steps. Objective: To understand how to use conditional structures in JavaScript. You can have it on one condition..! Human beings (and other animals) make decisions all the time that affect their lives, from small ("should I eat one cookie or two?") to large ("should I stay in my home country and work on my father's farm, or should I move to America and study...
JavaScript building blocks - Learn web development
s, and events. You've seen this stuff already in the course, but only in passing -- here we'll discuss it all explicitly. 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 some familiarity with the basics of HTML and CSS, and you should have also worked through our previous module, JavaScript first steps. 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 Making decisions in your code -- conditionals In any programming language, code n...
Client-side web APIs - Learn web development
vaScript modules in the series (First steps, Building blocks, and JavaScript objects). Those modules typically involve simple API usage, as it is often difficult to write client-side JavaScript examples without them. For this tutorial, we will assume that you are knowledgable about the core JavaScript language, and we will explore common Web APIs in a bit more detail. Basic knowledge of HTML and CSS would also be useful. Note: If you are working on a 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 Introduction to web APIs First up, we'll start by looking at APIs from a high level -- what are they, how do they work, how do you use them in your code, and how are t...
Arrays - Learn web development
ous Overview: First steps Next In the final article of this module, we'll look at arrays -- a neat way of storing a list of data items under a single variable name. Here we look at why this is useful, then explore how to create an array, retrieve, add, and remove items stored in an array, and more besides. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, an understanding of what JavaScript is. Objective: To understand what arrays are and how to manipulate them in JavaScript. What is an array? Arrays are generally described as "list-like objects"; they are basically single objects that contain multiple values stored in a list. Array objects can be stored in variables and dealt with in much the same way as any other type of val...
Useful string methods - Learn web development
Next Now that we've looked at the very basics of strings, let's move up a gear and start thinking about what useful operations we can do on strings with built-in methods, such as finding the length of a text string, joining and splitting strings, substituting one character in a string for another, and more. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, an understanding of what JavaScript is. Objective: To understand that strings are objects, and learn how to use some of the basic methods available on those objects to manipulate strings. Strings as objects Most things are objects in JavaScript. When you create a string, for example by using let string = 'This is my string'; your variable becomes a string object instance, a...
Storing the information you need — Variables - Learn web development
es you should now know what JavaScript is, what it can do for you, how you use it alongside other web technologies, and what its main features look like from a high level. In this article, we will get down to the real basics, looking at how to work with the most basic building blocks of JavaScript -- Variables. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, an understanding of what JavaScript is. Objective: To gain familiarity with the basics of JavaScript variables. Tools you need Throughout this article, you'll be asked to type in lines of code to test your understanding of the content. If you are using a desktop browser, the best place to type your sample code is your browser's JavaScript console (see What are browser develop...
JavaScript First Steps - Learn web development
e key building blocks in detail, such as variables, strings, numbers and arrays. 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 don't need any previous JavaScript knowledge, but you should have some familiarity with HTML and CSS. You are advised to work through the following modules before starting on JavaScript: Getting started with the Web (which includes a really basic JavaScript introduction). Introduction to HTML. Introduction to CSS. 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...
JavaScript object basics - Learn web development
Overview: Objects Next In this article, we'll look at fundamental JavaScript object syntax, and revisit some JavaScript features that we've already seen earlier in the course, reiterating the fact that many of the features you've already dealt with are objects. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, familiarity with JavaScript basics (see First steps and Building blocks). Objective: To understand the basic theory behind object-oriented programming, how this relates to JavaScript ("most things are objects"), and how to start working with JavaScript objects. Object basics An object is a collection of related data and/or functionality (which usually consists of several variables and functions -- which are called pr...
Inheritance in JavaScript - Learn web development
most of the gory details of OOJS now explained, this article shows how to create "child" object classes (constructors) that inherit features from their "parent" classes. In addition, we present some advice on when and where you might use OOJS, and look at how classes are dealt with in modern ECMAScript syntax. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, familiarity with JavaScript basics (see First steps and Building blocks) and OOJS basics (see Introduction to objects). Objective: To understand how it is possible to implement inheritance in JavaScript. Prototypal inheritance So far we have seen some inheritance in action -- we have seen how prototype chains work, and how members are inherited going up a chain. But mostly th...
Object-oriented JavaScript for beginners - Learn web development
Overview: Objects Next With the basics out of the way, we'll now focus on object-oriented JavaScript (OOJS) -- this article presents a basic view of object-oriented programming (OOP) theory, then explores how JavaScript emulates object classes via constructor functions, and how to create object instances. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, familiarity with JavaScript basics (see First steps and Building blocks) and OOJS basics (see Introduction to objects). Objective: To understand the basic theory behind object-oriented programming, how this relates to JavaScript ("everything is an object"), and how to create constructors and object instances. Object-oriented programming -- the basics To start with, let's give...
Introducing JavaScript objects - Learn web development
we've provided this module to help you. Here we teach object theory and syntax in detail, then look at how to create your own objects. 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 some familiarity with HTML and CSS. You are advised to work through the Introduction to HTML and Introduction to CSS modules before starting on JavaScript. You should also have some familiarity with JavaScript basics before looking at JavaScript objects in detail. Before attempting this module, work through JavaScript first steps and JavaScript building blocks. Note: If you are working on a computer/tablet/other devices where y...
JavaScript — Dynamic client-side scripting - Learn web development
tive maps, animated 2D/3D graphics, scrolling video jukeboxes, or more--you can bet that JavaScript is probably involved. 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 JavaScript is arguably more difficult to learn than related technologies such as HTML and CSS. Before attempting to learn JavaScript, you are strongly advised to get familiar with at least these two technologies first, and perhaps others as well. Start by working through the following modules: Getting started with the Web Introduction to HTML Introduction to CSS Having previous experience with other programming languages might also help. After getting familiar with the basics of J...
HTML performance features - Learn web development
tps://w3c.github.io/preload/ ) async / defer attributes <iframe> <object> <script> rel attribute Conclusion Previous Overview: Performance Next In this module The "why" of web performance What is web performance? How do users perceive performance? ...
Measuring performance - Learn web development
some techniques to make unavoidable performance hits appear less severe to the user, or disguise them completely. Previous Overview: Performance Next In this module The "why" of web performance What is web performance? How do users perceive performance? Measuring performance Multimedia: images Multimedia: video JavaScript performance best practices. HTML performance features CSS performance features Fonts and performance Mobile performance Focusing on performance ...
The business case for web performance - Learn web development
eeded). ...
JavaScript performance - Learn web development
HTML features that can impact performance, including some attributes specifically created to improve performance. Previous Overview: Performance Next In this module The "why" of web performance What is web performance? How do users perceive performance? Measuring performance Multimedia: images Multimedia: video JavaScript performance best practices. HTML performance features CSS performance features Fonts and performance Mobile performance Focusing on performance ...
Multimedia: video - Learn web development
lains how to optimize website video through reducing file size, with (HTML) download settings, and with streaming. Previous Overview: Performance Next In this module The "why" of web performance What is web performance? How do users perceive performance? Measuring performance Multimedia: images Multimedia: video JavaScript performance best practices. HTML performance features CSS performance features Fonts and performance Mobile performance Focusing on performance ...
Server-side website programming - Learn web development
server-side programming. Most major websites use some kind of server-side technology to dynamically display data as required. For example, imagine how many products are available on Amazon, and imagine how many posts have been written on Facebook. Displaying all of these using different static pages would be extremely inefficient, so instead such sites display static templates (built using HTML, CSS, and JavaScript), and then dynamically update the data displayed inside those templates when needed, such as when you want to view a different product on Amazon. In the modern world of web development, learning about server-side development is highly recommended. Learning pathway Getting started with server-side programming is usually easier than client-side development, because dynamic websit...
Package management basics - Learn web development
Previous Overview: Understanding client-side tools Next In this article we'll look at package managers in some detail to understand how we can use them in our own projects -- to install project tool dependencies, keep them up-to-date, and more. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages. Objective: To understand what package managers and package repositories are, why they are needed, and the basics of how to use them. A dependency in your project A dependency is a third-party bit of software that was probably written by someone else and ideally solves a single problem for you. A web project can have any number of dependencies, ranging from none to many, and your dependencies might include sub-dependencies that you di...
Understanding client-side web development tools - Learn web development
pose of some of the most common client-side tool types, explain the tools you can chain together, how to install them using package managers, and control them using the command line. We finish up by providing a complete toolchain example showing you how to get productive. Get started now, with our "Client-side tooling overview" Prerequisites You should really learn the basics of the core HTML, CSS, and JavaScript languages first before attempting to use the tools detailed here. 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 Guides 1. Client-side tooling overview In this article we provide an overview of modern web tooling, what kinds of tools are available and ...
Mozilla accessibility architecture
essibility objects, which parallels the DOM tree, but is not a full representation. Above: a diagram showing that the MSAA tree is a subset of the DOM tree. The situation for other accessibility APIs is similar. The problem is, what happens if there are DOM nodes that the assistive technology vendors wants to know about, which are not exposed? Also, what if they want to get DOM information, like CSS rules, tag names and attributes, that MSAA's IAccessible does not provide? On Windows, we solve this by supporting an additional interface beyond MSAA's IAccesible, for every DOM node. QueryInterface() can be used to switch between the two interfaces. If there is no MSAA node for a DOM node, pAccessible->QueryInterface(IID_IAccessible) will return null. In addition, some vendors had asked us to p...
CSUN Firefox Materials
anager in the Tools menu. Here are some examples 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 spe...
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(...
Add-ons
Among other things, an add-on could: Change the appearance or content of particular websites Modify the Firefox user interface Add new features to Firefox There are several types of add-ons, but the most common type are extensions. Developing extensions In the past, there were several toolsets for developing Firefox extensions, but as of November 2017, extensions must be built using WebExtensions APIs. ...
Creating reftest-based unit tests
g should be examined. I have seen a case where the html file in the bug had a problem, but the checked-in version was "cleaned up" and not valid for testing. Mozilla has used HTML generation tools in the past. The htmlgen tool is an example of this. Tools like this may be more useful now that we have reftest to exercise the files. It would also be useful to generate files that combine HTML and CSS in interesting or unusual ways. Reftests and preferences In order to use preferences that are not listed in the browser's built-in preferences files such as all.js (in other words, preferences that will not show up in about:config) it is necessary to add the preference to testing/profiles/reftest/user.js. Reftests and elevated privileges In general, reftests that you intend to check-in must ...
How Mozilla's build system works
$(DIST)/lib/$(LIB_PREFIX)gkxulgrid_s.$(LIB_SUFFIX) \ $(NULL) include $(topsrcdir)/config/rules.mk SHARED_LIBRARY_LIBS is set to a list of static libraries, which should be linked into this shared library. Note the use of LIB_PREFIX and LIB_SUFFIX to make this work on all platforms. Building jar files jar files are used for packaging chrome files (XUL, JavaScript, and CSS). For more information on jar packaging, see this document. Here, we will only cover how to set up a makefile to package jars. Below is an example: DEPTH = ../../../.. topsrcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/rules.mk As you can see, there are no extra variables to defi...
Interface Compatibility
anguages involved. Web Content APIs which are visible to web content are not modified, except as a last resort when inherent security vulnerabilities or incompatibility with other browsers make it the only option. Any changes, including new features, must have super-review. One exception to this rule is APIs which are explicitly shipped with Mozilla prefixes as a technology preview. This includes CSS properties that begin with the -moz- prefix (e.g. -moz-box-shadow), or JavaScript APIs that begin with the moz prefix (e.g. canvasrenderingcontext.mozDrawText). These APIs may be removed or replaced with standard interfaces in future releases of Mozilla. Jetpack The Jetpack SDK and APIs are not yet complete. The stable version 1.0 of the Jetpack SDK is planned for later in 2010. Documented APIs...
Working with Mozilla source code
, but is a great way to search it. Navigating the Mozilla source code Learn about the various folders in the Mozilla source tree, and how to find what you're looking for. Bugs for newcomers If you are new to the project and want something to work on, look here. Interface development guide Guidelines and documentation for how to create and update XPCOM interfaces. The Firefox codebase: CSS Guidelines This document contains guidelines defining how CSS inside the Firefox codebase should be written, it is notably relevant for Firefox front-end engineers. SVG Cleanup Guide Guidelines and best practices for shipping new SVGs. Try Servers Mozilla products build on at least three platforms. If you don't have access to them all, you can use the try servers to test your patches and mak...
Performance best practices for Firefox front-end engineers
yle 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 synchronous style flushes What are style flushes? When CSS is applied to a document (HTML or XUL, it doesn't matter), the browser does calculations to figure out which CSS styles will apply to each element. This happens the first time the page loads and the CSS is initially applied, but can happen again if JavaScript modifies the DOM. JavaScript code might, for example, change DOM node attributes (either directly or by adding or removing classes from el...
mozbrowsercaretstatechanged
Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: rect An object that defines information about the bounding rectangle of the current selection. Its properties are width: The width of the bounding rectangle, in CSS pixels. height: The height of the bounding rectangle, in CSS pixels. top: The top position of the bounding rectangle, in CSS pixels. bottom: The bottom position of the bounding rectangle, in CSS pixels. left: The left position of the bounding rectangle, in CSS pixels. right: The right position of the bounding rectangle, in CSS pixels. commands An object that defines what commands ...
mozbrowserscroll
Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: top A number representing the new vertical scroll position of the <iframe> viewport -- in CSS pixels -- from the top of the viewport. left A number representing the new horizontal scroll position of the <iframe> viewport -- in CSS pixels -- from the left of the viewport. Example var browser = document.querySelector("iframe"); browser.addEventListener("mozbrowserscroll", function( event ) { console.log("The new scroll position is " + event.details.left + " across and ...
mozbrowserscrollareachanged
nly Boolean Whether the event normally bubbles or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: width A number representing the new scroll area width of the <iframe> viewport, in CSS pixels. height A number representing the new scroll area height of the <iframe> viewport, in CSS pixels. Example var browser = document.querySelector("iframe"); browser.addEventListener("mozbrowserscrollareachanged", function( event ) { console.log("The new scroll area is " + event.details.width + " x " + event.details.height + "."); }); Related Events mozbrowserasyncscr...
mozbrowserselectionstatechanged
es or not. cancelable Read only Boolean Whether the event is cancellable or not. details Read only Object A custom object. details The details property returns an anonymous JavaScript object with the following properties: rect An object that represents the bounding rectangle of the selection. Its properties are: width: The width of the selection, in CSS pixels. height: The height of the selection, in CSS pixels. top: The Y coordinate of the top of the bounding box, in CSS pixels. bottom: The Y coordinate of the bottom of the bounding box, in CSS pixels. left: The X coordinate of the left of the bounding box, in CSS pixels. right: The X coordinate of the right of the bounding box, in CSS pixels. commands An object that stores info...
HTMLIFrameElement.sendMouseEvent()
instanceOfHTMLIframeElement.sendMouseEvent(type, x, y, button, clickCount, modifiers); Returns Void. Parameters type A string representing the event type. Possible values are mousedown, mouseup, mousemove, mouseover, mouseout, or contextmenu. x A number representing the x position of the cursor relative to the browser <iframe>'s visible area in CSS pixels. y A number representing the y position of the cursor relative to the browser <iframe>'s visible area in CSS pixels. button A number representing which button has been pressed on the mouse: 0 (Left button), 1 (middle button), or 2 (right button). clickCount The number of clicks that should be performed. modifiers A number representing a key pressed at the same time the mouse button...
HTMLIFrameElement.sendTouchEvent()
ry, rotationAngles, forces, count, modifiers); Returns Void. Parameters type A string representing the event type. Possible values are touchstart, touchend, touchmove, or touchcancel. x An array of numbers representing the x position of each touch point relative to the browser <iframe>'s visible area in CSS pixels. y An array of numbers representing the y position of each touch point relative to the browser <iframe>'s visible area in CSS pixels. rx An array of numbers representing the x radius of each touch point in CSS pixels. ry An array of numbers representing the y radius of each touch point in CSS pixels. rotationAngles An array of numbers representing the angle of each touch point in d...
HTMLIFrameElement.setVisible()
on 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 setVisible() method of the HTMLIFrameElement is used to change the visibility state of the browser <iframe>. The visible state of a browser <iframe> has nothing to do with its actual visibility (which is handled through CSS). The visible state is used to define the level of resources required by the browser <iframe>. If the visible state is set to true, it means that the browser <iframe> should have high priority over the resources needed to render and handle its content. On the contrary, if its visible state is set to false, it has low priority over the resources it needs. As an example, if the content of a browse...
-moz-window-dragging
It only works in Chrome code, and only on Mac OS X. The property was added in Firefox 35 to solve intermittent problems related to Firefox windows not being moveable when busy (bug 944836). Initial value drag Applies to all elements that create native windows, e.g. <window>, <panel> Inherited no Media visual Computed value as specified Animation type discrete Canonical order the unique non-ambiguous order defined by the formal grammar Syntax The -moz-window-dragging property is specified as one of the keyword values listed below. ...
::-moz-tree-cell-text(hover)
The :-moz-tree-cell-text(hover) CSS pseudo-class will match an element if the mouse cursor is presently hovering over text in a tree cell. This selector is intended for use mainly by theme developers. ...
::-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. This selector is intended for use mainly by theme developers. ...
::-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> ...
Chrome-only Events reference
This page lists events that are only available in Gecko Chrome code (and sometimes in other privileged circumstances, eg. UA widgets). MozBeforePaintGecko 2.0 adds a new method for performing JavaScript controlled animations that synchronize not only with one another, but also with CSS transitions and SMIL animations being performed within the same window.MozScrolledAreaChangedThe MozScrolledAreaChanged event is fired when the document view has been scrolled or resized. smartcard-insertThe smartcard-insert event is fired when the insertion of a smart card has been detectedsmartcard-removeThe smartcard-remove event is fired when the removal of a smart card has been detected. ...
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). ...
Roll your own browser: An embedding how-to
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. Include...
Gecko
In XUL-based applications Gecko also renders the application's user interface. Gecko is used in many applications, including a few browsers such as Firefox and SeaMonkey (for a complete list, please refer to Wikipedia's article on Gecko). Products using the same version of Gecko have identical support for Web standards. ...
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 usuall...
PopupNotifications.jsm
ave otherwise been 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 notificati...
Localization content best practices
lization. Developer tools key shortcuts When translating Firefox strings from /devtools/ folder, you may see some keys like this: inspector.searchHTML.key=CmdOrCtrl+F The first part of the string `CmdOrCtrl` should not be translated. You may only translate the letter to better match your locale. This key shortcut definition matches the Electron key shortcut definition. Create localizable UI CSS issues Some CSS text/font properties may cause problems with text legibility when applied to certain language texts. Avoid using Italic for CJKT. This acronym stands for: Chinese (Simplified and Traditional), Japanese, Korean, and Taiwanese. The text-transform property is not reliable for some locales; for example, text-transform: uppercase won't work properly with languages such as Irish/Ga...
Creating localizable web content
all our web properties, especially links to community sites and redirects. Sometimes you can leave some freedom of modification for a block of text so that the localizers link to relevant local resources. Images Check that images are not going to be a problem for the audience (cultural references, positionning, mirroring for rtl, text in images...) and spot what sizes/margins can be tweaked by CSS or have to be fixed for all locales but English Don't use text in icons Images 1&2. Bad: Image 3. Good: Image 4. Good: This icon is recognized as the international symbol for information. It can stay this way. Use localized screenshots if possible Screenshots are important informative graphics, often times explaining how to achieve something in a desktop or web application.
MathML3Testsuite
e that in general, comparing with the "Sample Rendering" is not enough to conclude on the success/failure of the test. So please do not edit these pages if you are not able to explain Gecko's rendering. However, any report is welcome on the Tracking bug for the MathML testsuite. ...
MathML Torture Test
mo>?</mo><mrow><mi>?</mi><mo>?</mo><msub><mi>S</mi><mi>n</mi></msub></mrow></munder><mrow><mi>?</mi><mo stretchy="false">(</mo><mi>?</mi><mo stretchy="false">)</mo></mrow><mrow><munderover><mo>?</mo><mrow><mi>i</mi><mo>=</mo><mn>1</mn></mrow><mi>n</mi></munderover><msub><mi>a</mi><mrow><mi>i</mi><mo>,</mo><msub><mi>?</mi><mi>i</mi></msub></mrow></msub></mrow></mrow></math></td> </tr> </table> CSS Content /* Table style */ body { text-align: center; } table { border: solid thin; border-collapse: collapse; margin-left: auto; margin-right: auto; } th { background-color: #ddf; border: solid thin; color: black; padding: 5px; } td { border: solid thin; padding: 5px; text-align: center; } .Asana math { font-family: Asana Math; } .Cambria...
Updates
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 Report - MozillaZine an...
MathML Demo: <mfrac> - fractions
<mi>C</mi> </msub> <mfrac> <mrow> <mi>f</mi> <mo stretchy='false'>(</mo> <mi>i</mi> <mi>z</mi> <mo stretchy='false'>)</mo> <msup> <mrow> <mo>(</mo> <mo>-</mo> <mi>z</mi> <mo>)</mo> </mrow> <mi>&alpha;</mi> </msup> </mrow> <mrow> <msup> <mi>e</mi> <mrow> <mn>2</mn> <mi>&pi;</mi> <mi>z</mi> </mrow> </msup> <mo>-</mo> <mn>1</mn> </mrow> </mfrac> </mrow> <mi>d</mi> <mi>z</mi> </mrow> </math> CSS Content [class="background"] { background-image: url(http://www.mozilla.org/images/mozilla-banner.gif); opacity: 0.2; position: absolute; left: 0; width: 100%; height: 58px; } ...
MathML Demo: <mtable> - tables and matrices
55555 x + 1 666666 a b c 7777777 11 cols arg is"r|c:l". External vertical align is bottom ---... 1 22 333 4444 55555 666666 x 2 a b c 7777777 11 cols arg is "r|cl". MathML doesn't specify how to only display certain sides of the table border, as in "|rcl", but these can be obtained in Mozilla using the 'border' property of CSS, e.g., "|rcl" can be achieved with the CSS declaration "mtable { border-left: solid thin }". Math axis test, using externally aligned arrays inside symmetric fences. ---... [ 1 666666 x 2 c axis ] [ 1 666666 x 2 c center ] + ? 1 55555 x + 1 c bottom ? + ? 1 4444 x c top ? + || 1 4444 4444 ...
BloatView
The delta numbers show the percentage change between runs for the amount of leaks and amount of bloat (negative numbers are better!). The bloat number is a metric determined by multiplying the total number of objects allocated of a given class by the clas...
Performance
formation on how to add a new measurement to 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...
NSS 3.27 release notes
.27 may result in TLS 1.3 (draft) to be enabled. The TLS 1.3 (draft) protocol can be disabled, by defining symbol NSS_DISABLE_TLS_1_3 when building NSS. NPN can not be enabled anymore. Hard limits on the maximum number of TLS records encrypted with the same key are enforced. Disabled renegotiation in DTLS. ...
Embedded Dialog API
ko. A chrome window (the chrome flag is 1) should contain only an embedded instance of Gecko. This is the kind of window used by Gecko to display XUL dialogs. Advanced Windowing API Embedding applications concerned with ensuring that dialogs posed by Gecko are consistent in appearance and behaviour with dialogs posed directly by the application itself face a choice. It is probably easier to write CSS rules (a skin) to give Gecko's XUL dialogs the same appearance as the application's own. Skins are very rich and capable; this scheme can probably be made to work for nearly all applications. Many embeddors however choose to implement their own dialogs, and this is of course the only way to gain complete control and consistency. An embedding application may implement its own version of all dialog...
Using XPCOM Components
XPCOM Component Viewer can be extremely useful for this sort of gross interrogation, but again: it displays all of the components and interfaces in your build, many of which are not practical for actual reuse or stable enough to be used reliably in your own application development. Use comprehensive lists like this with caution. Using XPCOM Components in Your Cpp XPConnect makes it easy to acecss XPCOM components as JavaScript objects, but using XPCOM components in C++ is not much more difficult. Managing Cookies from Cpp duplicates code from Getting the CookieManager Component in JavaScript, but in C++ instead of JavaScript. Managing Cookies from Cpp nsCOMPtr<nsIServiceManager> servMan; nsresult rv = NS_GetServiceManager(getter_AddRefs(servMan)); if (NS_FAILED(rv)) return -1; nsCOM...
Creating XPCOM components
ing Notifications Implementing the nsIContentPolicy Uniform Resource Locators Checking the White List Creating nsIURI Objects Building the WebLock UI User Interface Package List Client Code Overview XUL The XUL Document The Locking UI Site Adding UI weblock.xul Overlaying New User Interface Into Mozilla webLockOverlay.xul Other Resources weblock.css Image Resources Packaging WebLock Component Installation Overview Archiving Resources The WebLock Installation Script The WebLock Trigger Script Distributing Your Component Appendix A - Setting up the Gecko SDK Downloading and Setting the SDK Building a Microsoft Visual Cpp Project Creating a New Project Adding the Gecko SDK to the Project Settings Building a Windo...
Mozilla internal string guide
er repertoire, and it efficiently maps to UTF-32. (Win32 W APIs and Mac OS X natively use UTF-16.) Latin1 - 8-bit encoding for the first 256 Unicode code points. Used for HTTP headers and for size-optimized storage in text node and SpiderMonkey strings. Latin1 converts to UTF-16 by zero-extending each byte to a 16-bit code unit. Note that this kind of "Latin1" is not available for encoding HTML, CSS, JS, etc. Specifying charset=latin1 means the same as charset=windows-1252. Windows-1252 is a similar but different encoding used for interchange. In addition, there exist multiple other (legacy) encodings. The Web-relevant ones are defined in the Encoding Standard. Conversions from these encodings to UTF-8 and UTF-16 are provided by mozilla::Encoding. Additonally, on Windows the are some rare ...
Index
Mozilla › Tech › XPCOM › Index
ence 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 nextSi...
Components.utils.Sandbox
tring is the name of an object that you want to make available as a global to code running in the sandbox. The exception is "-Promise": the Promise constructor is available by default for sandboxes, and you use this option to remove it from the sandbox. Note that "-Promise" is removed in Firefox 37. ...
Components.utils.importGlobalProperties
into a sandbox, use the wantGlobalProperties option in the Sandbox constructor. This function is passed an array of strings. Each string is the name of an object to import, and will be defined on the importing scope's global. ...
Observer Notifications
en opened and initialized. inspector-editor-saved - Sent when changes have been saved in the attribute-value editor. inspector-highlighting - Sent every time a different node in the page gets highlighted. inspector-opened - Sent after the Inspector tool has finished its initialization. inspector-ruleview-ready - Sent when the inspector's CSS Rule View is opened and initialized. inspector-state-restored - Sent when the Inspector is re-opened after a tab switch. inspector-treepanel-ready - Sent when the Inspector's Tree Panel is opened and initialized. inspector-unhighlighting - Sent every time the highlighter stops highlighting a node. remote-listening string Sent after ...
imgIContainer
space (for example, appunits) to image space. aFill The area in the context to draw pixels to. When aFlags includes FLAG_CLAMP, the image will be extended to this area by clamping image sample coordinates. Otherwise, the image will be automatically tiled as necessary. aSubimage The area of the image, in pixels, that we are allowed to sample from. aViewportSize The size (in CSS pixels) of the viewport that would be available for the full image to occupy, if we were drawing the full image. (Note that we might not actually be drawing the full image -- we might be restricted by aSubimage -- but we still need the full image's viewport-size in order for SVG images with the "viewBox" attribute to position their content correctly.) aFlags Flags of the FLAG_* variety. ...
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. ...
nsIContentViewManager
e in chrome device pixels and are relative to the browser element. void getContentViewsIn( in float aXPx, in float aYPx, in float aTopSize, in float aRightSize, in float aBottomSize, in float aLeftSize, out unsigned long aLength, Optional [retval, array, size_is(aLength)] out nsIContentView aResult ); Parameters aXPx The X coordinate of the anchor point of the rectangle, in CSS pixels. aYPx The Y coordinate of the anchor point of the rectangle, in CSS pixels. aTopSize The distance upward from the Y anchor to expand the rectangle. aRightSize The distance to the right from the X anchor to expand the rectangle. aBottomSize The distance downward from the Y anchor to expand the rectangle. aLeftSize The distance to the left from the X anchor to expand the rectangle.
nsIDOMChromeWindow
window. void restore(); Parameters None. setCursor() Sets the mouse cursor to the specified cursor. The mouse cursor is locked to the specified cursor if it's not "auto". At that time, the cursor has been never changed by cursor moving. After you call this method with "auto", the cursor will be unlocked. void setCursor( in DOMString cursor ); Parameters cursor You can specify same values of CSS cursor property (including -moz- prefixed values). And there are special values: "grab", "grabbing" and "spinning". But they might be dropped in the future version, if you use the values, you should use -moz-* value instead. ...
nsIDOMClientRect
of the top of the rectangle box. Read only. width float Width of the rectangle box (This is identical to right minus left). Read only. x float X-coordinate, relative to the viewport origin, of the left of the rectangle box. Read only. y float Y-coordinate, relative to the viewport origin, of the top of the rectangle box. Read only. See also CSSOM View Module : The ClientRect InterfaceWD This object was renamed a few times: initial name was TextRectangle, then ClientRect, then DOMRect. Initially it had just the top/left/right/bottom attributes, then width/height/x/y were added. ...
nsIDOMNSHTMLDocument
Read only. designMode DOMString Set to "on" or "off" to enable or disable editing for the entire document at once. Roughly equivalent to body.contentEditable domain DOMString Initially the host name of the document's URL, but may be changed to the parent (but not top-level) domain in order to faci...
nsIDOMXULElement
ue 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 DOMString ...
nsIFileView
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. ...
nsIStyleSheetService
onstants Constant Value Description AGENT_SHEET 0 USER_SHEET 1 AUTHOR_SHEET 2 Methods loadAndRegisterSheet() Synchronously loads a style sheet from sheetURI and adds it to the list of user or agent style sheets. A user sheet loaded via this API will come before userContent.css and userChrome.css in the cascade (so the rules in it will have lower precedence than rules in those sheets). An agent sheet loaded via this API will come after ua.css in the cascade (so the rules in it will have higher precedence than rules in ua.css). The relative ordering of two user or two agent sheets loaded via this API is undefined. Sheets added via this API take effect on all documents, i...
nsITreeBoxObject
invalidateRange(in long startIndex, in long endIndex); void invalidateColumnRange(in long startIndex, in long endIndex, in nsITreeColumn col); getRowAt() A hit test that can tell you what row the mouse is over. Returns -1 for invalid mouse coordinates. The coordinate system is the client coordinate system for the document this boxObject lives in, and the units are CSS pixels. long getRowAt(in long x, in long y); Parameters x The x coordinate y The y coordinate getCellAt() A hit test that can tell you what cell the mouse is over. Returns -1 for invalid mouse coordinates. The coordinate system is the client coordinate system for the document this boxObject lives in, and the units are CSS pixels. void getCellAt(in long x, in long y, out long ...
nsIWebBrowserPersist
() Save a channel to a file. It must not be opened yet. void saveChannel( in nsIChannel aChannel, in nsISupports aFile ); Parameters aChannel The nsIChannel to save to a file. aFile Target local file. This may be a nsILocalFile object or an nsIURI object with a file scheme. saveDocument() Save the specified DOM document to file and optionally all linked files (for example images, CSS, JS & subframes). Do not call this method until the document has finished loading! void saveDocument( in nsIDOMDocument aDocument, in nsISupports aFile, in nsISupports aDataPath, in string aOutputContentType, in unsigned long aEncodingFlags, in unsigned long aWrapColumn ); Parameters aDocument Document to save to file. Some implementations of this interface may also support nsn...
Setting HTTP request headers
f the core technologies behind the Web. In addition to the actual content, some important information is passed with HTTP headers for both HTTP requests and responses. You can add your own HTTP headers to any request the application makes, whether the request is initiated by your code explicitly opening an HTTP channel, because of XMLHttpRequest activity, an <img> element in content, or even from CSS. HTTP Channels When you deal with HTTP requests and responses, typically you are doing this with an nsIHttpChannel. The nsIHttpChannel interface has a number of properties and methods, but the method that is of interest to us is setRequestHeader. This method allows us to set an HTTP request header. Below is some sample code where we set an HTTP header. // adds "X-Hello: World" header to the reque...
DB Views (message lists)
iew 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. ...
Adding items to the Folder Pane
n-container", text: "Numbers", level: 0, open: false, _children: null, get children() { if (!this._children) { this._children = []; for (var i = 1; i <= this._NUMBERS; i++) this._children.push(new numberRow(i)); } return this._children; }, getProperties: function gne_getProps() { // Put your css attributes here }, command: function gne_command() { // Just going to alert, to do something here Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService) .alert(window, null, this.text); } }; Second, our child items (the numbers 1, 2, and 3) are copies of the follow...
Activity Manager examples
nents to extend the capabilities. Default implementations can be found in nsActivity.js file. If activity developers would like to extend the default UI representation of the activity types, they can provide their own XBL elements for their own activity types. All custom activity XBL elements should inherit from "activity-base" binding. For XBL samples please see activity.xml and activityBinding.css files. Showing a user-defined activity in the Activity Manager window The following sample will show a process and an event for junk processing in the Activity Manager window. // Step 1: Adding a Process into the activity manager const nsIAP = Components.interfaces.nsIActivityProcess; const nsIAE = Components.interfaces.nsIActivityEvent; const nsIAM = Components.interfaces.nsIActivityManager;...
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; } ...
Styling the Folder Pane
This content covers features introduced in Thunderbird 3 The folder pane in Thunderbird is predominantly controlled by code in folderPane.js. Since Thunderbird 3, the folder pane is designed in a more modular and extensible fashion. It is now possible to place non-mail entities in the folder pane. Treeview row/cell properties CSS Property Equivalent call Explanation folderNameCol -- A property for indicating that a column is the folder name column. hasUnreadMessages-true aFolder.getNumUnread(false) > 0 Indicates that the folder (but not subfolders) has unread messages. isServer-true aFolder.isServer Indicates that the folder is a root folder (one that represents a server). serverType-server aFolder.server.type ...
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
. ...
Drawing and Event Handling - Plugins
s of the instance's area and various platform-specific data. Typically, the browser calls NPP_SetWindow after creating the instance so that the plug-in can begin drawing immediately. However, the browser can create invisible instances for which NPP_SetWindow is never called and a window is never created. This happens when plug-ins are invoked with an HTML object element that has been hidden with CSS rules (see Plug-in Display Modes in the Introduction) or with an embed element whose hidden attribute has been set. The browser should call NPP_SetWindow again whenever the size or position of the instance changes, passing it the same NPWindow object each time, but with different values. The browser can also call NPP_SetWindow multiple times with different values for the window, including null.
Dominators view - Firefox Developer Tools
can also see that these objects have a relatively tiny "Shallow Size", so almost all of the retained size is in the objects that they dominate. Immediately under each GC root, you'll see all the nodes for which this root is the immediate dominator. These nodes are also ordered by their retained size. For example, if we click on the first Window object: We can see that this Window dominates a CSS2Properties object, whose retained size is 2% of the total snapshot size. Again the shallow size is very small: almost all of its retained size is in the nodes that it dominates. By clicking on the disclosure arrow next to the Function, we can see those nodes. In this way you can quickly get a sense of which objects retain the most memory in the snapshot. You can use Alt + click to expand the wh...
Network request details - Firefox Developer Tools
the list of cookies displayed. The full list of cookie attributes is shown--see the following screenshot showing Response cookies with further attributes shown. The samesite attribute has been shown since Firefox 62 (bug 1452715). Params tab This tab displays the GET parameters and POST data of a request: Response tab The complete content of the response. If the response is HTML, JS, or CSS, it will be shown as text: If the response is JSON, it will be shown as an inspectable object: If the response is an image, the tab displays a preview: For network responses that are initiated by a WebSocket connection, the details pane shows any associated messages. For more information, see Inspecting web sockets. Cache tab If the response is cached (i.e. a 304), the Cache tab displa...
Inspect and select colors - Firefox Developer Tools
If you click on the color sample, you'll see a color picker popup, enabling you to change the color: If the color is a foreground color, the color picker tells you whether its contrast with the background color meets accessibility guidelines. Hovering the mouse over the contrast message gives a more detailed explanation. ...
Select and highlight elements - Firefox Developer Tools
The selected element is the element in the page that the Inspector is currently focused on. The selected element is shown in the HTML pane and its CSS is displayed in the CSS pane. The highlighted element is the element that's overlaid in the page with a graphic showing the box model, and a tooltip showing its tag and size: With the context menu To open the Inspector and select an element immediately, activate the context menu over the element in the page and select "Inspect Element": With the HTML pane When the inspector is open, as you move the mouse around the elements listed in the HTML pane, the corresponding elements are highlighted in the page. Click an element in the HTML pane to select it: You can also use the arrow keys to move around the DOM with the keyboard. ...
Animation inspector example: Web Animations API - Firefox Developer Tools
firefox-logo-animation Example animation using the Web Animations API. ...
UI Tour - Firefox Developer Tools
the screenshot below we've selected that drop in the frame rate, and can see the long-running paint operation in more detail: Details pane The Details pane shows whichever tool is currently selected. To switch to a different tool, use the buttons in the Toolbar. Waterfall The Waterfall presents a view of the work the browser is doing during the recording: executing JavaScript, updating the CSS, updating the page layout, and performing repaints. The x-axis represents time, and the recorded operations are laid out as a waterfall, reflecting the serial nature of the browser's execution. To learn much more about the Waterfall, see the separate Waterfall page. Call Tree The Call Tree is a sampling profiler for JavaScript running in the page. It periodically samples the state of the Jav...
Performance - Firefox Developer Tools
's overall responsiveness. Call Tree Find bottlenecks in your site's JavaScript. Allocations See the allocations made by your code over the course of the recording. Waterfall Understand the work the browser's doing as the user interacts with your site. Flame Chart See which JavaScript functions are executing, and when, over the course of the recording. Scenarios Animating CSS properties Uses the Waterfall to understand how the browser updates a page, and how animating different CSS properties can affect performance. Intensive JavaScript Uses the frame rate and Waterfall tools to highlight performance problems caused by long-running JavaScript, and how using workers can help in this situation. ...
Settings - Firefox Developer Tools
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. 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. S...
Taking screenshots - Firefox Developer Tools
string The name to use in saving the file. The file should have a ".png" extension. --fullpage boolean If included, the full webpage will be saved. With this parameter, even the parts of the webpage which are outside the current bounds of the window will be included in the screenshot. When used, "-fullpage" will be appended to the file name. --selector string A CSS selector that selects a single element on the page. When supplied, only this element and its descendants will be included in the screenshot. Note: If you capture an image to a filename like test.png, and then you capture to that same filename, the new image will overwrite the old image. So if you're using the up-arrow history scroll to capture images in quick succession, be careful -- yo...
Tips - Firefox Developer Tools
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 Monitor Click the request summary to compare performance of cache vs. no-cache page loading. When a request is selected click "Edit and Resend" to modify its headers and send it again. Check "Enable persistent logs" in the settings to keep requests from before even after navigation. Hover the "js" icon within the "Cause" column to see the JavaScript stack trace...
Validators - Firefox Developer Tools
zard This interface to W3C services guides beginning-to-intermediate web authors through the process of updating content to support Netscape 7.x, Mozilla and other browsers that support W3C Standards. W3C HTML Validator The W3C HTML Validator will validate any Web page according to the W3C HTML standards. It is very useful for detecting the use of proprietary HTML as well as invalid HTML. W3C CSS Validator The W3C CSS Validator will validate the CSS within any web page or external CSS files according to the W3C CSS standards. W3C RDF Validator The RDF Validator service will validate the RDF/XML contained on a given URI. Link Checker This tool will check links on a given web page. HTML Tidy HTML Tidy is a tool that can be used to report errors in an HTML page and to format web pages...
Web Console UI Tour - Firefox Developer Tools
e Web Console's interface is split into three horizontal sections, detailed in the sections below. Toolbar The toolbar across the top contains a number of features: Garbage can: Click this icon to clear the contents of the console. Funnel: Click this icon to filter the messages that are displayed in the console. Filter categories: You can click a filter category (such as Errors, Warnings, CSS, or XHR) to display just those types of messages. Settings ("gear" menu): New in Firefox 71, you can click the gear icon to access the new settings menu, where you can toggle the following features on and off: Persist Logs: When enabled, the console doesn't clear on page reload, or new page load. Show Timestamps: When enabled, timestamps are shown on the left-hand side of each message r...
Web Console - Firefox Developer Tools
The JavaScript input interpreter How to interact with a document using the Console. Split console Use the Console alongside other tools. Console messages Details of the messages that the Console logs. Helper commands Commands you can use that are not part of JavaScript. ...
Animation.playState - Web APIs
Syntax var currentPlayState = Animation.playState; Animation.playState = newState; Value idle The current time of the animation is unresolved and there are no pending tasks. running The animation is running. paused The animation was suspended and the Animation.currentTime property is not updating. ...
Animation - Web APIs
Web › API › Animation
and migraine, and Scotopic sensitivity. Consider providing a mechanism for pausing or disabling animation, as well as using the Reduced Motion Media Query to create a complimentary experience for users who have expressed a preference for no animated experiences. Designing Safer Web Animation For Motion Sensitivity . An A List Apart Article An Introduction to the Reduced Motion Media Query | CSS-Tricks Responsive Design for Motion | WebKit MDN Understanding WCAG, Guideline 2.2 explanations Understanding Success Criterion 2.2.2 | W3C Understanding WCAG 2.0 Specifications Specification Status Comment Web AnimationsThe definition of 'Animation' in that specification. Working Draft Initial definition ...
AnimationEffect - Web APIs
Methods AnimationEffect.getTiming() Returns the EffectTiming object associated with the animation containing all the animation's timing values. AnimationEffect.getComputedTiming() Returns the calculated timing properties for this AnimationEffect. ...
AnimationEvent.animationName - Web APIs
The AnimationEvent.animationName read-only property is a DOMString containing the value of the animation-name CSS property associated with the transition. Syntax name = AnimationEvent.animationName Specifications Specification Status Comment CSS AnimationsThe definition of 'AnimationEvent.animationName' in that specification. Working Draft Initial definition. ...
AnimationEvent.elapsedTime - Web APIs
n has been running, in seconds, when this event fired, excluding any time the animation was paused. For an animationstart event, elapsedTime is 0.0 unless there was a negative value for animation-delay, in which case the event will be fired with elapsedTime containing (-1 * delay). Syntax time = AnimationEvent.elapsedTime Specifications Specification Status Comment CSS AnimationsThe definition of 'AnimationEvent.elapsedTime' in that specification. Working Draft Initial definition. ...
AnimationEvent.initAnimationEvent() - Web APIs
animationend The animation completed. animationiteration The current iteration just completed. canBubbleArg A Boolean flag indicating if the event can bubble (true) or not (false). cancelableArg A Boolean flag indicating if the event associated action can be avoided (true) or not (false). animationNameArg A DOMString containing the value of the animation-name CSS property associated with the transition. elapsedTimeArg A float indicating the amount of time the animation has been running, in seconds, as of the time the event was fired, excluding any time the animation was paused. For an "animationstart" event, elapsedTime is 0.0 unless there was a negative value for animation-delay, in which case the event will be fired with elapsedTime containing (-1 * ...
AnimationEvent.pseudoElement - Web APIs
Working Draft Initial definition. ...
AnimationEvent - Web APIs
element the animation runs on. If the animation doesn't run on a pseudo-element but on the element, an empty string: ''. Methods Also inherits methods from its parent Event. AnimationEvent.initAnimationEvent() Initializes a AnimationEvent created using the deprecated Document.createEvent("AnimationEvent") method. Specifications Specification Status Comment CSS AnimationsThe definition of 'AnimationEvent' in that specification. Working Draft Initial definition. ...
Cache.addAll() - Web APIs
Web › API › Cache › addAll
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
itUntil() 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
lorStop() method adds a new color stop, defined by an offset and a color, to a given canvas gradient. Syntax void gradient.addColorStop(offset, color); Parameters offset A number between 0 and 1, inclusive, representing the position of the color stop. 0 represents the start of the gradient and 1 represents the end; an INDEX_SIZE_ERR is raised if the number is outside that range. color A CSS <color> value representing the color of the stop. A SYNTAX_ERR is raised if the value cannot be parsed as a CSS <color> value. Examples Adding stops to a gradient This example uses the addColorStop method to 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('canv...
CanvasGradient - Web APIs
gContext2D.createRadialGradient(). It can be used as a fillStyle or strokeStyle. 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. If the offset is not between 0 and 1, inclusive, an INDEX_SIZE_ERR is raised; if the color can't be parsed as a CSS <color>, a SYNTAX_ERR is raised. Specifications Specification Status Comment HTML Living StandardThe definition of 'CanvasGradient' in that specification. Living Standard ...
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. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.fillStyle = 'blue'; ct...
CanvasRenderingContext2D.font - Web APIs
The CanvasRenderingContext2D.font property of the Canvas 2D API specifies the current text style to use when drawing text. 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. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.font = 'bold 48px serif'; ctx.strokeText('Hello world', 50, 100); Result Loading fonts with the CSS Font Loading API With the help of the FontFace API, you can explicitly load fonts before using them in a canvas. let f = n...
CanvasRenderingContext2D.getTransform() - Web APIs
apply a transform to the first one's context using CanvasRenderingContext2D.setTransform() and draw a square on it, then retrieve the matrix from it using getTransform(). We then apply the retrieved matrix directly to the second canvas context by passing the DOMMatrix object directly to setTransform(), and draw a circle on it. ...
CanvasRenderingContext2D.setTransform() - Web APIs
text using the first type of setTransform() and draw a square on it, then retrieve the matrix from it using CanvasRenderingContext2D.getTransform(). We then apply the retrieved matrix directly to the second canvas context by passing the DOMMatrix object directly to setTransform() (i.e. the second type), and draw a circle on it. ...
CanvasRenderingContext2D.shadowColor - Web APIs
the shadow's rendered opacity will be affected by the opacity of the fillStyle color when filling, and of the strokeStyle color when stroking. 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. Examples Adding a shadow to shapes This example adds a shadow to two squares; the first one is filled, and the second one is stroked. The shadowColor property sets the shadows' color, while shadowOffsetX and shadowOffsetY set their position relative to the shapes. HTML <canvas id="canvas"></canvas> JavaScript const canvas = doc...
CanvasRenderingContext2D.strokeStyle - Web APIs
xt2D.strokeStyle property of the Canvas 2D API specifies the color, gradient, or pattern to use for the strokes (outlines) around shapes. The default is #000 (black). For more examples of stroke and fill styles, see Applying styles and color in the Canvas tutorial. Syntax ctx.strokeStyle = color; ctx.strokeStyle = gradient; ctx.strokeStyle = 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 stroke color of a shape This example applies a blue stroke color to a rectangle. HTML <canvas id="canvas"></canvas> JavaScript var canvas = document.getElementById('canvas'); var ctx = canvas.getContext('2d'); ctx.strokeStyle = 'blu...
CanvasRenderingContext2D - Web APIs
ll if it is not associated with a <canvas> element. Hit regions CanvasRenderingContext2D.addHitRegion() Adds a hit region to the canvas. CanvasRenderingContext2D.removeHitRegion() Removes the hit region with the specified id from the canvas. CanvasRenderingContext2D.clearHitRegions() Removes all hit regions from the canvas. Filters CanvasRenderingContext2D.filter Applies a CSS or SVG filter to the canvas, e.g., to change its brightness or bluriness. Non-standard APIs Blink and WebKit Most of these APIs are deprecated and were removed shortly after Chrome 36. CanvasRenderingContext2D.clearShadow() Removes all shadow settings like CanvasRenderingContext2D.shadowColor and CanvasRenderingContext2D.shadowBlur. CanvasRenderingContext2D.drawImageFromRect() T...
A basic ray-caster - Web APIs
. ...
CaretPosition - Web APIs
method. Properties This interface doesn't inherit any properties. CaretPosition.offsetNode Read only Returns a Node containing the found node at the caret's position. CaretPosition.offset Read only Returns a long representing the character offset in the caret position node. Methods CaretPosition.getClientRect Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'CaretPosition' in that specification. Working Draft ...
console - Web APIs
Web › API › Console
called 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...
CustomElementRegistry.define() - Web APIs
attribute content and put it inside the 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;' + ...
DOMMatrix() - Web APIs
Example This example creates a DOMMatrix to use as an argument for calling Point.matrixTransform(). ...
DOMMatrix - Web APIs
Web › API › DOMMatrix
Specifications Specification Status Comment Geometry Interfaces Module Level 1The definition of 'DOMMatrix' in that specification. Candidate Recommendation Initial definition ...
DataTransfer.dropEffect - Web APIs
Example This example shows the use of the dropEffect and effectAllowed properties. HTML Content <div> <p id="source" ondragstart="dragstart_handler(event);" draggable="true"> Select this element, drag it to the Drop Zone and then release the selection to move the element. ...
DataTransfer.getData() - Web APIs
tData() not returning an expected value. Example This example shows the use of the DataTransfer object's getData() and setData() methods. ...
DataTransferItem.webkitGetAsEntry() - Web APIs
tories, outputting 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: 14...
DataTransferItemList.DataTransferItem() - Web APIs
Living Standard ...
DataTransferItemList.add() - Web APIs
eter. Example This example shows the use of the add() method. ...
DataTransferItemList.clear() - Web APIs
mple This example shows the use of the clear() method. ...
DataTransferItemList.length - Web APIs
Living Standard HTML 5.1The definition of 'length' in that specificatio...
DataTransferItemList.remove() - Web APIs
Living Standard HTML 5.1The definition of 'remove()' in that specification. Re...
Document: DOMContentLoaded event - Web APIs
ing hasn't finished yet document.addEventListener('DOMContentLoaded', doSomething); } else { // `DOMContentLoaded` has already fired doSomething(); } Live example HTML <div class="controls"> <button id="reload" type="button">Reload</button> </div> <div class="event-log"> <label>Event log:</label> <textarea readonly class="event-log-contents" rows="8" cols="30"></textarea> </div> CSS body { display: grid; grid-template-areas: "control log"; } .controls { grid-area: control; display: flex; align-items: center; justify-content: center; } .event-log { grid-area: log; } .event-log-contents { resize: none; } label, button { display: block; } #reload { height: 2rem; } JS const log = document.querySelector('.event-log-contents'); const reload = docume...
Document.alinkColor - Web APIs
d mouseup events. Syntax var color = document.alinkColor; document.alinkColor = color; color is a string containing the name of the color (e.g., blue, darkblue, etc.) or the hexadecimal value of the color (e.g., #0000FF) Notes The default value for this property in Mozilla Firefox is red (#ee0000 in hexadecimal). document.alinkColor is deprecated in DOM Level 2 HTML. One alternative is the CSS selector :active. Another alternative is document.body.aLink, although this is deprecated in HTML 4.01 in favor of the CSS alternative. Gecko supports both alinkColor/:active and :focus. Internet Explorer 6 and 7 support alinkColor/:active only for HTML anchor (<a>) links and the behavior is the same as :focus under Gecko. There is no support for :focus in IE. ...
Document.bgColor - Web APIs
Web › API › Document › bgColor
color = 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.compatMode - Web APIs
The Document.compatMode property indicates whether the document is rendered in Quirks mode or Standards mode. Syntax const mode = document.compatMode Value An enumerated value that can be: "BackCompat" if the document is in quirks mode. "CSS1Compat" if the document is in no-quirks (also known as "standards") mode or limited-quirks (also known as "almost standards") mode. Note: All these modes are now standardized, so the older "standards" and "almost standards" names are nonsensical and no longer used in standards. Example if (document.compatMode == "BackCompat") { // in Quirks mode } Specifications Specification Status Comment DOMThe definition of 'compatMode' in that specification. Living Standard ...
Document.createProcessingInstruction() - Web APIs
s 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 DOM4The definit...
Document: drag event - Web APIs
erface DragEvent Event handler property ondrag Examples See this code in a JSFiddle demo or interact with it below. ...
Document.fgColor - Web APIs
Web › API › Document › fgColor
ment.fgColor = color; Parameters color 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.getAnimations() - Web APIs
Syntax var allAnimations = Document.getAnimations(); Parameters None. Return value An Array of Animation objects, each representing one animation currently associated with elements which are descendants of the Document on which it's called. ...
Document.linkColor - Web APIs
Another alternative is document.body.link, although this is deprecated in HTML 4.01. ...
Document: pointercancel event - Web APIs
lication switcher interface or the "home" button on a mobile device. The device's screen orientation is changed while the pointer is active. The browser decides that the user started pointer input accidentally. This can happen if, for example, the hardware supports palm rejection to prevent a hand resting on the display while using a stylus from accidentally triggering events. The touch-action CSS property prevents the input from continuing. After the pointercancel event is fired, the browser will also send pointerout followed by pointerleave. Examples Using addEventListener(): document.addEventListener('pointercancel', (event) => { console.log('Pointer event cancelled') }); Using the onpointercancel event handler property: document.onpointercancel = (event) => { console.log('...
Document: readystatechange event - Web APIs
hanged. ...
Document: scroll event - Web APIs
scroll position } window.addEventListener('scroll', function(e) { last_known_scroll_position = window.scrollY; if (!ticking) { window.requestAnimationFrame(function() { doSomething(last_known_scroll_position); ticking = false; }); ticking = true; } }); See more, similar examples on the resize event page. Specifications Specification Status CSS Object Model (CSSOM) View Module Working Draft ...
Document.scrollingElement - Web APIs
of the document, document.documentElement. When in quirks mode, the scrollingElement attribute returns the HTML body element if it exists and is not potentially scrollable, otherwise it returns null. Syntax var element = document.scrollingElement; Example var scrollElm = document.scrollingElement; scrollElm.scrollTop = 0; Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'scrollingElement' in that specification. Working Draft Initial definition ...
Document.vlinkColor - Web APIs
tax color = document.vlinkColor document.vlinkColor = color Parameters color is a string representing the color as a word (e.g., "red") or hexadecimal value (e.g., "#ff0000"). Notes The default value for this property in Mozilla Firefox is purple (#551a8b in hexadecimal). Document.vlinkColor is deprecated in DOM Level 2 HTML. The recommended alternative is to get/set the color of the CSS :visited pseudo-class on HTML <a> elements (e.g., a:visited {color:red;}). Another alternative is document.body.vLink, although this is deprecated in HTML 4.01 in favor of the CSS alternative. ...
DocumentFragment.querySelectorAll() - Web APIs
-order traversal of the document's nodes) that matches the specified group of selectors. If the selectors specified in parameter are invalid a DOMException with a SYNTAX_ERR value is raised. Note: The definition of this API was moved to the ParentNode interface. Syntax elementList = documentfragment.querySelectorAll(selectors); Parameters selectors Is a DOMString containing one or more CSS selectors separated by commas. Examples This example returns a list of all div elements within the DocumentFragment with a class of either "note" or "alert": var matches = documentfrag.querySelectorAll("div.note, div.alert"); Specifications Specification Status Comment Selectors API Level 1The definition of 'DocumentFragment.querySelectorAll' in that specification. ...
DocumentOrShadowRoot.styleSheets - Web APIs
Examples function getStyleSheet(unique_title) { for (var i=0; i<document.styleSheets.length; i++) { var sheet = document.styleSheets[i]; if (sheet.title == unique_title) { return sheet; } } } Notes The returned list is ordered as follows: StyleSheets retrieved from <link> headers are placed first, sorted in header order. StyleSheets retrieved from the DOM are placed after, sorted in tree order. ...
DocumentOrShadowRoot - Web APIs
ead 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 specified coordinates. DocumentOrShadowRoot.elements...
Traversing an HTML table with JavaScript and DOM Interfaces - Web APIs
First it uses the childNodes attribute to get the list of child nodes of mycel. The childNodes list includes all child nodes, regardless of what their name or type is. Like getElementsByTagName(), it returns a list of nodes. The differences are that (a) getElementsByTagName() only returns elements of the specifi...
Element: auxclick event - Web APIs
lt(); button.style.color = randomColor(); } button.oncontextmenu = function(e) { e.preventDefault(); } Notice that in addition to capturing the auxclick event using onauxclick, the contextmenu event is also captured, and preventDefault() called on that event, in order to prevent the context menu from popping up after the color change is applied. ...
Element.clientLeft - Web APIs
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. padding-bottom Left Top Right Bottom margin-top margin-bottom border-top border-bottom Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'clientLeft' in that specification. Working Draft ...
Element.clientTop - Web APIs
Web › API › Element › clientTop
uptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. padding-bottom Left Top Right Bottom margin-top margin-bottom border-top border-bottom Notes clientTop was first introduced in the MS IE DHTML object model. Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'clientTop' in that specification. Working Draft ...
Element.closest() - Web APIs
Web › API › Element › closest
lement.prototype.closest = function(s) { var el = this; do { if (Element.prototype.matches.call(el, s)) return el; el = el.parentElement || el.parentNode; } while (el !== null && el.nodeType === 1); return null; }; } However, if you really do require IE 8 support, then the following polyfill will do the job very slowly, but eventually. However, it will only support CSS 2.1 selectors in IE 8, and it can cause severe lag spikes in production websites. if (window.Element && !Element.prototype.closest) { Element.prototype.closest = function(s) { var matches = (this.document || this.ownerDocument).querySelectorAll(s), i, el = this; do { i = matches.length; while (--i >= 0 && matches.item(i) !== el) {}; } while ((i < 0) && (...
Element: compositionend event - Web APIs
ML <div class="control"> <label for="name">On macOS, click in the textbox below,<br> then type <kbd>option</kbd> + <kbd>`</kbd>, then <kbd>a</kbd>:</label> <input type="text" id="example" name="example"> </div> <div class="event-log"> <label>Event log:</label> <textarea readonly class="event-log-contents" rows="8" cols="25"></textarea> <button class="clear-log">Clear</button> </div> CSS body { padding: .2rem; display: grid; grid-template-areas: "control log"; } .control { grid-area: control; } .event-log { grid-area: log; } .event-log-contents { resize: none; } label, button { display: block; } input[type="text"] { margin: .5rem 0; } kbd { border-radius: 3px; padding: 1px 2px 0; border: 1px solid black; } JS const inputElement = document.querySe...
Element: compositionstart event - Web APIs
ML <div class="control"> <label for="name">On macOS, click in the textbox below,<br> then type <kbd>option</kbd> + <kbd>`</kbd>, then <kbd>a</kbd>:</label> <input type="text" id="example" name="example"> </div> <div class="event-log"> <label>Event log:</label> <textarea readonly class="event-log-contents" rows="8" cols="25"></textarea> <button class="clear-log">Clear</button> </div> CSS body { padding: .2rem; display: grid; grid-template-areas: "control log"; } .control { grid-area: control; } .event-log { grid-area: log; } .event-log-contents { resize: none; } label, button { display: block; } input[type="text"] { margin: .5rem 0; } kbd { border-radius: 3px; padding: 1px 2px 0; border: 1px solid black; } JS const inputElement = document.querySe...
Element: compositionupdate event - Web APIs
ML <div class="control"> <label for="name">On macOS, click in the textbox below,<br> then type <kbd>option</kbd> + <kbd>`</kbd>, then <kbd>a</kbd>:</label> <input type="text" id="example" name="example"> </div> <div class="event-log"> <label>Event log:</label> <textarea readonly class="event-log-contents" rows="8" cols="25"></textarea> <button class="clear-log">Clear</button> </div> CSS body { padding: .2rem; display: grid; grid-template-areas: "control log"; } .control { grid-area: control; } .event-log { grid-area: log; } .event-log-contents { resize: none; } label, button { display: block; } input[type="text"] { margin: .5rem 0; } kbd { border-radius: 3px; padding: 1px 2px 0; border: 1px solid black; } JS const inputElement = document.querySe...
Element: copy event - Web APIs
ction using event.preventDefault(). However, the handler cannot read the clipboard data. It's possible to construct and dispatch a synthetic copy event, but this will not affect the system clipboard. ...
Element.currentStyle - Web APIs
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. ...
Element: cut event - Web APIs
Web › API › Element › cut event
from the document. The handler cannot read the clipboard data. It's possible to construct and dispatch a synthetic cut event, but this will not affect the system clipboard or the document's contents. ...
Element: dblclick event - Web APIs
Interface MouseEvent Event handler property ondblclick Examples This example toggles the size of a card when you double click on it. JavaScript const card = document.querySelector('aside'); card.addEventListener('dblclick', function (e) { card.classList.toggle('large'); }); HTML <aside> <h3>My Card</h3> <p>Double click to resize this object.</p> </aside> CSS aside { background: #fe9; border-radius: 1em; display: inline-block; padding: 1em; transform: scale(.9); transform-origin: 0 0; transition: transform .6s; } .large { transform: scale(1.3); } Result Specifications Specification Status UI EventsThe definition of 'dblclick' in that specification. Working Draft Document Object Model (DOM) Level ...
Element: error event - Web APIs
a UIEvent instance if it was generated from a user interface element, or an Event instance otherwise. ...
Element.getAnimations() - Web APIs
The getAnimations() method of the Element interface (specified on the Animatable mixin) returns an array of all Animation objects affecting this element or which are scheduled to do so in future. It can optionally return Animation objects for descendant elements too. Note: This array includes CSS Animations, CSS Transitions, and Web Animations. Syntax const animations = Element.getAnimations(options); Parameters options Optional An options object containing the following property: subtree A boolean value which, if true, causes animations that target descendants of Element to be returned as well. This includes animations that target any CSS pseudo-elements attached to Element or one of its descendents. Defaults to false. Return value An Array of Animation o...
Element.getAttribute() - Web APIs
ibute() in XUL (Gecko) actually follows the DOM 3 Core specification and returns an empty string. Consequently, you should use element.hasAttribute() to check for an attribute's existence prior to calling getAttribute() if it is possible that the requested attribute does not exist on the specified element. Retrieving nonce values For security reasons, CSP nonces from non-script sources, such as CSS selectors, and .getAttribute("nonce") calls are hidden. let nonce = script.getAttribute('nonce'); // returns empty string Instead of retrieving the nonce from the content attribute, use the nonce property: let nonce = script.nonce; Specifications Specification Status Comment DOMThe definition of 'getAttribute()' in that specification. Living Standard ...
Element.id - Web APIs
Web › API › Element › id
The id property of the Element interface represents the element's identifier, reflecting the id global attribute. If the id value is not the empty string, it must be unique in a document. The id is often used with getElementById() to retrieve a particular element. Another common case is to use an element's ID as a selector when styling the document with CSS. Note: Identifiers are case-sensitive, but you should avoid creating IDs that differ only in the capitalization. Syntax var idStr = element.id; // Get the id element.id = idStr; // Set the id idStr is the identifier of the element. Specifications Specification Status Comment DOMThe definition of 'id' in that specification. Living Standard No change from Document Object Model (DOM) Level 2 HT...
Element.innerHTML - Web APIs
Web › API › Element › innerHTML
seenter", logEvent); boxElem.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. Specifica...
Element: mousedown event - Web APIs
function to draw a line from the stored x and y values to the current location. When the drawLine() function returns, we adjust the coordinates and then save them in x and y. The mouseup event draws the final line segment, sets x and y to 0, and stops further drawing by setting isDrawing to false. HTML <h1>Drawing with mouse events</h1> <canvas id="myPics" width="560" height="360"></canvas> CSS canvas { border: 1px solid black; width: 560px; height: 360px; } JavaScript // When true, moving the mouse draws on the canvas let isDrawing = false; let x = 0; let y = 0; const myPics = document.getElementById('myPics'); const context = myPics.getContext('2d'); // event.offsetX, event.offsetY gives the (x,y) offset from the edge of the canvas. // Add the event listeners for mousedown...
Element: mouseleave event - Web APIs
mple illustrating the difference between mouseout and mouseleave. mouseleave The following trivial example uses the mouseenter event to change the border on the <div> when the mouse enters the space alloted to it. It then adds an item to the list with the number of the mouseenter or mouseleave event. HTML <div id='mouseTarget'> <ul id="unorderedList"> <li>No events yet!</li> </ul> </div> CSS Styling the <div> to make it more visible. #mouseTarget { box-sizing: border-box; width:15rem; border:1px solid #333; } JavaScript var enterEventCount = 0; var leaveEventCount = 0; const mouseTarget = document.getElementById('mouseTarget'); const unorderedList = document.getElementById('unorderedList'); mouseTarget.addEventListener('mouseenter', e => { mouseTarget.style.border = '5px...
Element: mousemove event - Web APIs
function to draw a line from the stored x and y values to the current location. When the drawLine() function returns, we adjust the coordinates and then save them in x and y. The mouseup event draws the final line segment, sets x and y to 0, and stops further drawing by setting isDrawing to false. HTML <h1>Drawing with mouse events</h1> <canvas id="myPics" width="560" height="360"></canvas> CSS canvas { border: 1px solid black; width: 560px; height: 360px; } JavaScript // When true, moving the mouse draws on the canvas let isDrawing = false; let x = 0; let y = 0; const myPics = document.getElementById('myPics'); const context = myPics.getContext('2d'); // event.offsetX, event.offsetY gives the (x,y) offset from the edge of the canvas. // Add the event listeners for mousedown...
Element: mouseup event - Web APIs
function to draw a line from the stored x and y values to the current location. When the drawLine() function returns, we adjust the coordinates and then save them in x and y. The mouseup event draws the final line segment, sets x and y to 0, and stops further drawing by setting isDrawing to false. HTML <h1>Drawing with mouse events</h1> <canvas id="myPics" width="560" height="360"></canvas> CSS canvas { border: 1px solid black; width: 560px; height: 360px; } JavaScript // When true, moving the mouse draws on the canvas let isDrawing = false; let x = 0; let y = 0; const myPics = document.getElementById('myPics'); const context = myPics.getContext('2d'); // event.offsetX, event.offsetY gives the (x,y) offset from the edge of the canvas. // Add the event listeners for mousedown...
Element: paste event - Web APIs
efault action using event.preventDefault(), and then insert its desired data manually. It's possible to construct and dispatch a synthetic paste event, but this will not affect the document's contents. ...
Element.releasePointerCapture() - Web APIs
value This method returns undefined. Exceptions Exception Explanation InvalidPointerId pointerId does not match any of the active pointers. Example This example sets pointer capture on a <div> when you press down on it. This lets you slide the element horizontally, even when you pointer moves outside of its boundaries. ...
Element.scroll() - Web APIs
Web › API › Element › scroll
long the vertical axis of the element that you want displayed in the upper left. Calling with options options A ScrollToOptions dictionary. Examples // Put the 1000th vertical pixel at the top of the element element.scroll(0, 1000); Using options: element.scroll({ top: 100, left: 100, behavior: 'smooth' }); Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'element.scroll()' in that specification. Working Draft Initial definition. Browser Compatibility The compatibility table in 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. DesktopMobileChromeEdgeFire...
Element.scrollBy() - Web APIs
Web › API › Element › scrollBy
rd is the horizontal pixel value that you want to scroll by. y-coord is the vertical pixel value that you want to scroll by. - or - options is a ScrollToOptions dictionary. Examples // scroll an element element.scrollBy(300, 300); Using options: element.scrollBy({ top: 100, left: 100, behavior: 'smooth' }); Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'element.scrollBy()' in that specification. Working Draft Initial definition. ...
Element.scrollTo() - Web APIs
Web › API › Element › scrollTo
that you want displayed in the upper left. y-coord is the pixel along the vertical axis of the element that you want displayed in the upper left. - or - options is a ScrollToOptions dictionary. Examples element.scrollTo(0, 1000); Using options: element.scrollTo({ top: 100, left: 100, behavior: 'smooth' }); Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'element.scrollTo()' in that specification. Working Draft Initial definition. Browser Compatibility The compatibility table in 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. DesktopMobileChromeEdgeFirefoxInt...
Element.scrollTop - Web APIs
Web › API › Element › scrollTop
in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. If you can see this, scrollTop is maxed-out padding-bottom Left Top Right Bottom margin-top margin-bottom border-top border-bottom Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'scrollTop' in that specification. Working Draft ...
Element: scroll event - Web APIs
position } window.addEventListener('scroll', function(e) { last_known_scroll_position = window.scrollY; if (!ticking) { window.requestAnimationFrame(function() { doSomething(last_known_scroll_position); ticking = false; }); ticking = true; } }); Note: You can find more examples on the resize event page. Specifications Specification Status CSS Object Model (CSSOM) View Module Working Draft ...
Element.setCapture() - Web APIs
ax 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. ...
Element.setPointerCapture() - Web APIs
value This method returns undefined. Exceptions Exception Explanation InvalidPointerId pointerId does not match any of the active pointers. Example This example sets pointer capture on a <div> when you press down on it. This lets you slide the element horizontally, even when you pointer moves outside of its boundaries. ...
Element.shadowRoot - Web APIs
dded 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. ...
Event.eventPhase - Web APIs
Web › API › Event › eventPhase
li>Analyse event propagation chain</li> <li>Click next div and repeat the experience</li> <li>Change Capturing mode</li> <li>Repeat the experience</li> </ul> <input type="checkbox" id="chCapture" /> <label for="chCapture">Use Capturing</label> <div id="d1">d1 <div id="d2">d2 <div id="d3">d3 <div id="d4">d4</div> </div> </div> </div> <div id="divInfo"></div> CSS div { margin: 20px; padding: 4px; border: thin black solid; } #divInfo { margin: 18px; padding: 8px; background-color:white; font-size:80%; } JavaScript let clear = false, divInfo = null, divs = null, useCapture = false; window.onload = function () { divInfo = document.getElementById('divInfo') divs = document.getElementsByTagName('div') chCapture = document.g...
Event.preventDefault() - Web APIs
reaching an edit field The following example demonstrates how invalid text input can be stopped from reaching the input field with preventDefault(). Nowadays, you should usually use native HTML form validation instead. HTML Here's the form: <div class="container"> <p>Please enter your name using lowercase letters only.</p> <form> <input type="text" id="my-textbox"> </form> </div> CSS We use a little bit of CSS for the warning box we'll draw when the user presses an invalid key: .warning { border: 2px solid #f39389; border-radius: 2px; padding: 10px; position: absolute; background-color: #fbd8d4; color: #3b3c40; } JavaScript And here's the JavaScript code that does the job. First, listen for keypress events: var myTextbox = document.getElementById('my-textbox'...
Event - Web APIs
Web › API › Event
each handler triggered. Interfaces based on Event Below is a list of interfaces which are based on the main Event interface, with links to their respective documentation in the MDN API reference. Note that all event interfaces have names which end in "Event". ...
EventTarget.addEventListener() - Web APIs
, once & none-once <div class="middle" target="_blank"> middle, capture & none-capture <a class="inner1" href="https://www.mozilla.org" target="_blank"> inner1, passive & preventDefault(which is not allowed) </a> <a class="inner2" href="https://developer.mozilla.org/" target="_blank"> inner2, none-passive & preventDefault(not open new page) </a> </div> </div> CSS .outer, .middle, .inner1, .inner2 { display: block; width: 520px; padding: 15px; margin: 15px; text-decoration: none; } .outer { border: 1px solid red; color: red; } .middle { border: 1px solid green; color: green; width: 460px; } .inner1, .inner2 { border: 1px solid purple; color: purple; width: 400px; } JavaScript const outer = document.querySelector('.out...
ExtendableEvent.waitUntil() - Web APIs
ed 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.getAsBinary() - Web APIs
Web › API › File › getAsBinary
tanceOfFile.getAsBinary(); Returns A string. ...
File.getAsText() - Web APIs
Web › API › File › getAsText
interpreted as text in the specified encoding. ...
FileReader: abort event - Web APIs
abel for="avatar">Choose a profile picture:</label> <input type="file" id="avatar" name="avatar" accept="image/png, image/jpeg"> </div> <img src="" class="preview" height="200" alt="Image preview..."> <div class="event-log"> <label>Event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> CSS img.preview { margin: 1rem 0; } .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; padding: .2rem; } .example { display: grid; grid-template-areas: "select log" "preview log"; } .file-select { grid-area: select; } .preview { grid-area: preview; } .event-log { grid-area: log; } .event-log>label { dis...
FileReader: load event - Web APIs
abel for="avatar">Choose a profile picture:</label> <input type="file" id="avatar" name="avatar" accept="image/png, image/jpeg"> </div> <img src="" class="preview" height="200" alt="Image preview..."> <div class="event-log"> <label>Event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> CSS img.preview { margin: 1rem 0; } .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; padding: .2rem; } .example { display: grid; grid-template-areas: "select log" "preview log"; } .file-select { grid-area: select; } .preview { grid-area: preview; } .event-log { grid-area: log; } .event-log>label { dis...
FileReader: loadend event - Web APIs
abel for="avatar">Choose a profile picture:</label> <input type="file" id="avatar" name="avatar" accept="image/png, image/jpeg"> </div> <img src="" class="preview" height="200" alt="Image preview..."> <div class="event-log"> <label>Event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> CSS img.preview { margin: 1rem 0; } .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; padding: .2rem; } .example { display: grid; grid-template-areas: "select log" "preview log"; } .file-select { grid-area: select; } .preview { grid-area: preview; } .event-log { grid-area: log; } .event-log>label { dis...
FileReader: loadstart event - Web APIs
abel for="avatar">Choose a profile picture:</label> <input type="file" id="avatar" name="avatar" accept="image/png, image/jpeg"> </div> <img src="" class="preview" height="200" alt="Image preview..."> <div class="event-log"> <label>Event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> CSS img.preview { margin: 1rem 0; } .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; padding: .2rem; } .example { display: grid; grid-template-areas: "select log" "preview log"; } .file-select { grid-area: select; } .preview { grid-area: preview; } .event-log { grid-area: log; } .event-log>label { dis...
FileReader: progress event - Web APIs
abel for="avatar">Choose a profile picture:</label> <input type="file" id="avatar" name="avatar" accept="image/png, image/jpeg"> </div> <img src="" class="preview" height="200" alt="Image preview..."> <div class="event-log"> <label>Event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> CSS img.preview { margin: 1rem 0; } .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; padding: .2rem; } .example { display: grid; grid-template-areas: "select log" "preview log"; } .file-select { grid-area: select; } .preview { grid-area: preview; } .event-log { grid-area: log; } .event-log>label { dis...
FileSystemDirectoryReader.readEntries() - Web APIs
tories, outputting 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: 14...
FontFace.family - Web APIs
Web › API › FontFace › family
family = 'font family name'; var fontFace = instanceOfFontFace.family; // "font family name" Value A DOMString. Example var fontFace = new FontFace('Roboto', 'url(https://fonts.example.com/roboto.woff2)'); console.log(fontFace.family); // 'Roboto' fontFace.family = 'newRoboto'; console.log(fontFace.family); // 'newRoboto' Specifications Specification Status Comment CSS Font Loading Module Level 3The definition of 'family' in that specification. Working Draft Initial definition ...
FontFace.featureSettings - Web APIs
The featureSettings property of the FontFace interface retrieves or sets infrequently used font features that are not available from a font's variant properties. It is equivalent to the font-feature-settings descriptor. Syntax var featureSettingDescriptor = FontFace.featureSettings; FontFace.featureSettings = featureSettingDescriptor; Value A CSSOMString containing a descriptor. Specifications Specification Status Comment CSS Font Loading Module Level 3The definition of 'featureSettings' in that specification. Working Draft Initial definition. ...
FontFace.load - Web APIs
Web › API › FontFace › load
ent FontFace object. Syntax var promise = FontFace.load(); Parameters None. Return value A Promise that resolves with a reference to the current FontFace object when the font loads or rejects with a NetworkError if the loading process fails. Exceptions NetworkError Indicates that the attempt to load the font failed. Specifications Specification Status Comment CSS Font Loading Module Level 3The definition of 'load' in that specification. Working Draft Initial definition. ...
FontFace.loaded - Web APIs
Web › API › FontFace › loaded
Working Draft Initial definition. ...
FontFace.status - Web APIs
Web › API › FontFace › status
Working Draft Initial definition. ...
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.style - Web APIs
Web › API › FontFace › style
The style property of the FontFace interface retrieves or sets the font's style. It is equivalent to the font-style descriptor. Syntax var style = FontFace.style; FontFace.style = value; Value A CSSOMString containing the descriptors defined in the style sheet's @font-face rule. Specifications Specification Status Comment CSS Font Loading Module Level 3The definition of 'style' 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. ...
FontFaceSet.ready - Web APIs
Web › API › FontFaceSet › ready
The ready readonly property of the FontFaceSet interface returns a Promise that resolves to the given FontFaceSet. Syntax fontFaceSet.ready.then(function(fontFaceSet) { // ... }); Returns A Promise that resolves to the given FontFaceSet. Parameters None. Specifications Specification Status Comment CSS Font Loading Module Level 3The definition of 'FontFaceSet' in that specification. Working Draft Initial definition ...
FontFaceSetLoadEvent.FontFaceSetLoadEvent() - Web APIs
reates a new FontFaceLoadEvent object which is fired whenever a FontFaceSet loads. Syntax var fontFaceSetLoadEvent = new FontFaceSetLoadEvent(type[, options]) Parameters type The literal value 'Type' (quotation marks included). options Optional Options are as follows: fontfaces: An array of FontFace instances. Specifications Specification Status Comment CSS Font Loading Module Level 3The definition of 'FontFaceSetLoadEvent()' in that specification. Working Draft 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://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInt...
FontFaceSetLoadEvent.fontfaces - Web APIs
Working Draft Initial definition. ...
FontFaceSetLoadEvent - Web APIs
Constructor FontFaceSetLoadEvent() Creates a new FontFaceSetLoadEvent object. Properties FontFaceSetLoadEvent.fontfacesRead only Returns an array of FontFace instances each of which represents a single usable font. Specifications Specification Status Comment CSS Font Loading Module Level 3The definition of 'FontFaceSetLoadEvent' in that specification. Working Draft Initial definition. Browser Compatibility The compatibility table on this page is generated from structured data. ...
Using the Frame Timing API - Web APIs
A frame rate of 60 fps (frames per second) for a 60 Hz refresh rate is a common target for a good responsive user experience. This means the browser should process a frame in about 16.7ms. ...
Frame Timing API - Web APIs
A frame rate of 60 fps (frames per second) for a 60 Hz refresh rate is a common target for a good responsive user experience. This means the browser should process a frame in about 16.7 ms. An application can register a PerformanceObserver for "frame" performance entry types. ...
GlobalEventHandlers.oncontextmenu - Web APIs
opening in the window. The context menu typically appears upon a right click. HTML <p>Try opening the context menu. Is it disabled?<p> JavaScript window.oncontextmenu = (e) => { e.preventDefault(); } Result Pausing an animation This example pauses a spinning shape whenever you open the context menu. ...
GlobalEventHandlers.onmousedown - Web APIs
ction name or a function expression. The function receives a MouseEvent object as its sole argument. Example This example reveals part of an image when you press and hold a mouse button. It uses the onmousedown, onmouseup, and onmousemove event handlers. ...
GlobalEventHandlers.onmousemove - Web APIs
on name or a function expression. The function receives a MouseEvent object as its sole argument. Examples Tooltips This example creates link tooltips that follow your mouse. It uses the onmousemove, onmouseover, and onmouseout event handlers. ...
GlobalEventHandlers.onmouseup - Web APIs
tionRef is a function name or a function expression. The function receives a MouseEvent object as its sole argument. Example In this example, a piece of "toast" hides when you click down with the mouse, and reappears when you release. It uses the onmousedown and onmouseup event handlers. ...
GlobalEventHandlers.onpointerdown - Web APIs
o the target box after the user's interaction with the element ends (for example, when they release the mouse button, or when they lift the stylus or finger from the screen). In addition, the event's preventDefault() method is called to ensure that the mouseup event isn't triggered unnecessarily. HTML The HTML is extremely simple: <div id="target"> Tap me, click me, or touch me! </div> CSS The CSS simply sets up the appearance of the target, and doesn't affect its functionality at all. #target { width: 400px; height: 30px; text-align: center; font: 16px "Open Sans", "Helvetica", sans-serif; color: white; background-color: blue; border: 2px solid darkblue; cursor: pointer; user-select: none; -moz-user-select: none; -webkit-user-select: none; -ms-user-selec...
GlobalEventHandlers.onscroll - Web APIs
a UIEvent object as its sole argument. Only one onscroll handler can be assigned to an object at a time. For greater flexibility, you can pass a scroll event to the EventTarget.addEventListener() method instead. Example This example monitors scrolling on a <textarea>, and logs the element's vertical scroll position accordingly. ...
GlobalEventHandlers.onwheel - Web APIs
l wheel rotation, while onscroll handles scrolling of an object's content. Syntax target.onwheel = functionRef; Value functionRef is a function name or a function expression. The function receives a WheelEvent object as its sole argument. Examples This example shows how to scale an element using the mouse (or other pointing device) wheel. ...
HTMLCanvasElement.height - Web APIs
When the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 150 is used. This is one of the two properties, the other being HTMLCanvasElement.width, that controls the size of the canvas. ...
HTMLCanvasElement.width - Web APIs
When the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 300 is used. This is one of the two properties, the other being HTMLCanvasElement.height, that controls the size of the canvas. ...
HTMLContentElement.select - Web APIs
The HTMLContentElement.select property reflects the select attribute. It is a DOMString containing a space-separated list of CSS selectors that select the content to insert in place of the <content> element. Syntax object.select = "CSSselector CSSselector ..."; Example // Select <h1> elements and elements with class="error" myContentObject.select = "h1 .error"; Specifications This feature is no longer defined by any standards. ...
HTMLContentElement - Web APIs
The HTMLContentElement interface represents a <content> HTML Element, which is used in Shadow DOM. Properties This interface inherits the properties of HTMLElement. HTMLContentElement.select Is a DOMString that reflects the select HTML attribute. The value is a comma-separated list of CSS selectors that select the content to insert in place of the <content> element. Methods This interface inherits the methods of HTMLElement. HTMLContentElement.getDistributedNodes() Returns a static NodeList of the distributed nodes associated with this <content> element. Specifications This feature is no longer defined by any standards. ...
HTMLDetailsElement: toggle event - Web APIs
id="ch2"> <summary>Chapter II</summary> Philosophy in Fortune's name replies to Boethius' reproaches, and proves that the gifts of Fortune are hers to give and to take away. </details> <details id="ch3"> <summary>Chapter III</summary> Boethius falls back upon his present sense of misery. Philosophy reminds him of the brilliancy of his former fortunes. ...
HTMLDialogElement: cancel event - Web APIs
key or clicks a "Close dialog" button which is part of the browser's UI. ...
HTMLDialogElement: close event - Web APIs
alogElement object when the dialog it represents has been closed. ...
HTMLElement.offsetParent - Web APIs
as the position property set to fixed (firefox returns <body>). The element is <body> or <html>. offsetParent is useful because offsetTop and offsetLeft are relative to its padding edge. Syntax parentObj = element.offsetParent; parentObj is an object reference to the element in which the current element is offset. Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'offsetParent' in that specification. Working Draft 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. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafari...
HTMLElement.offsetTop - Web APIs
tParent node. Syntax topPos = element.offsetTop; Parameters topPos is the number of pixels from the top of the closest relatively positioned parent element. Example var d = document.getElementById("div1"); var topPos = d.offsetTop; if (topPos > 10) { // object is offset more // than 10 pixels from its parent } Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'offsetTop' in that specification. Working Draft 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. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAn...
HTMLElement: pointercancel event - Web APIs
lication switcher interface or the "home" button on a mobile device. The device's screen orientation is changed while the pointer is active. The browser decides that the user started pointer input accidentally. This can happen if, for example, the hardware supports palm rejection to prevent a hand resting on the display while using a stylus from accidentally triggering events. The touch-action CSS property prevents the input from continuing. After the pointercancel event is fired, the browser will also send pointerout followed by pointerleave. Examples Using addEventListener(): const para = document.querySelector('p'); para.addEventListener('pointercancel', (event) => { console.log('Pointer event cancelled'); }); Using the onpointercancel event handler property: const para = do...
HTMLFormElement - Web APIs
the entry list representing the form's data is constructed. Also available via the onformdata property. reset The reset event fires when a form is reset. Also available via the onreset property. submit The submit event fires when a form is submitted. Also available via the onsubmit property. Usage notes Obtaining a form element object To obtain an HTMLFormElement object, you can use a CSS selector with querySelector(), or you can get a list of all of the forms in the document using its forms property. Document.forms returns an array of HTMLFormElement objects listing each of the forms on the page. You can then use any of the following syntaxes to get an individual form: document.forms[index] Returns the form at the specified index into the array of forms. document.forms[id] ...
HTMLImageElement.crossOrigin - Web APIs
ng image at ${url}`; container.append(errMsg); }); image.crossOrigin = "anonymous"; image.alt = ""; image.src = url; } loadImage(imageUrl); HTML <div class="container"> <p>Here's a paragraph. It's a very interesting paragraph. You are captivated by this paragraph. Keep reading this paragraph. Okay, now you can stop reading this paragraph. ...
HTMLImageElement.height - Web APIs
The height property of the HTMLImageElement interface indicates the height at which the image is drawn, in CSS pixels if the image is being drawn or rendered to any visual medium such as the screen or a printer; otherwise, it's the natural, pixel density corrected height of the image. Syntax htmlImageElement.height = newHeight; let height = htmlImageElement.height; Value An integer value indicating the height of the image. The terms in which the height is defined depends on whether the image is being rendered to a visual medium or not. If the image is being rendered to a visual medium such as a screen or printer, the height is expressed in CSS pixels. Otherwise, the image's height is represented using its natural (intrinsic) height, adjusted for the display density as indicated by n...
HTMLImageElement.hspace - Web APIs
nWidth; marginWidth = htmlImageElement.hspace; Value An integer value specifying the width, in pixels, of the horizontal margin to apply to the left and right sides of the image. Usage notes The value specified for hspace is mapped to the margin-left and margin-right properties to specify the width of those margins in pixels. Important: This property is obsolete. You should instead use the CSS margin property and its longhand forms to establish margins around an <img>. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLImageElement.hspace' in that specification. Living Standard HTML 4.01 SpecificationThe definition of 'HTMLImageElement.hspace' in that specification. Recommendation Provides addition...
HTMLImageElement.isMap - Web APIs
ent.isMap; Value A Boolean value which is true if the image is being used for a server-side image map; otherwise, the value is false. Usage notes When an image marked as being part of a server-side image map is clicked, the browser constructs the string "?x,y", where x and y indicate the coordinates at which the mouse was clicked as offsets from the top-left corner of the image, specified in CSS pixels. The browser then fetches that URL from the server and displays or downloads it depending on the value of the download attribute. Unlike server-side image maps, client-side image maps don't cause the <img> element to adopt interactive content mode. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLImageElement.isMap' in t...
HTMLImageElement.srcset - Web APIs
e use in several places throughout our documentation. Also specified by the srcset attribute is that the 200-pixel version should be used for 1x displays while the 400-pixel version should be used for 2x displays. <div class="box"> <img src="/files/16797/clock-demo-200px.png" alt="Clock" srcset="/files/16864/clock-demo-200px.png 1x, /files/16797/clock-demo-400px.png 2x"> </div> CSS The CSS simply specifies that the image and its surrounding box should be 200 pixels square and should have a simple border around it. Also provided is the word-break attribute, using the break-all value to tell the browser to wrap the string within the width available regardless of where in the string the wrap must occur. .box { width: 200px; border: 2px solid rgba(150, 150, 150, 255); p...
HTMLImageElement.vspace - Web APIs
eight; marginHeight = htmlImageElement.vspace; Value An integer value specifying the height, in pixels, of the vertical margin to apply to the top and bottom sides of the image. Usage notes The value specified for vspace is mapped to the margin-top and margin-bottom properties to specify the height of those margins in pixels. Important: This property is obsolete. You should instead use the CSS margin property and its longhand forms to establish margins around an <img>. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLImageElement.vspace' in that specification. Living Standard HTML 4.01 SpecificationThe definition of 'HTMLImageElement.vspace' in that specification. Recommendation The HTML 4.01 spe...
HTMLImageElement.width - Web APIs
The width property of the HTMLImageElement interface indicates the width at which the image is drawn, in CSS pixels if the image is being drawn or rendered to any visual medium such as the screen or a printer; otherwise, it's the natural, pixel density corrected width of the image. Syntax htmlImageElement.width = newWidth; let width = htmlImageElement.width; Value An integer value indicating the width of the image. The terms in which the width is defined depends on whether the image is being rendered to a visual medium or not. If the image is being rendered to a visual medium such as a screen or printer, the width is expressed in CSS pixels. Otherwise, the image's width is represented using its natural (intrinsic) width, adjusted for the display density as indicated by naturalWidth.
HTMLInputElement.stepDown() - Web APIs
ElementById('theButton'); button.addEventListener('click', function() { stepondown();} ); function stepondown() { let input = document.getElementById('theNumber'); let val = document.getElementById('decrementer').value; if (val) { /* increment with a parameter */ input.stepDown(val); } else { /* or without a parameter. Try it with 0, 5, -2, etc. */ input.stepDown(); } } CSS input:invalid { border: red solid 3px; } Result Note if you don't pass a parameter to the stepDown() method, it defaults to 1. Any other value is a multiplier of the step attribute value, which in this case is 5. If we pass 4 as the stepDecrement, the input will stepDown by 4 * 5, or 20. If the parameter is 0, the number will not be decremented. The stepDown() method will not allow the inp...
HTMLInputElement.stepUp() - Web APIs
*/ let button = document.getElementById('theButton') button.addEventListener('click', function() { steponup() }) function steponup() { let input = document.getElementById('theNumber') let val = document.getElementById('incrementer').value if (val) { /* increment with a parameter */ input.stepUp(val) } else { /* or without a parameter. Try it with 0 */ input.stepUp() } } CSS input:invalid { border: red solid 3px; } Result Note if you don't pass a parameter to the stepUp method, it defaults to 1. Any other value is a multiplier of the step attribute value, which in this case is 5. If you pass 4 as the stepIncrement, the input will stepUp by 4 * 5, or 20. If the parameter is 0, the number will not be incremented. The stepUp will not allow the input to out of ran...
HTMLInputElement - Web APIs
ible autocapitalize string: Defines the capitalization behavior for user input. Valid values are none, off, characters, words, or sentences. inputmode Provides a hint to browsers as to the type of virtual keyboard configuration to use when editing this element or its contents. HTMLInputElement.align string: Represents the alignment of the element. Use CSS instead. HTMLInputElement.useMap string: Represents a client-side image map. Methods blur() Removes focus from the input element; keystrokes will subsequently go nowhere. click() Simulates a click on the input element. focus() Focuses on the input element; keystrokes will subsequently go to this element. select() Selects all the text in the i...
HTMLLIElement - Web APIs
onospace" 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 fr...
HTMLMediaElement: loadstart event - Web APIs
o Cancelable No Interface Event Event handler property onloadstart Examples Live example HTML <div class="example"> <button type="button">Load video</button> <video controls width="250"></video> <div class="event-log"> <label>Event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> CSS .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; padding: .2rem; } .example { display: grid; grid-template-areas: "button log" "video log"; } button { grid-area: button; width: 10rem; margin: .5rem 0; } video { grid-area: video; } .event-log { grid-area: log; } .event-log>label { display: block; ...
HTMLMediaElement: progress event - Web APIs
No Cancelable No Interface Event Event handler property onprogress Examples Live example HTML <div class="example"> <button type="button">Load video</button> <video controls width="250"></video> <div class="event-log"> <label>Event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> CSS .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; padding: .2rem; } .example { display: grid; grid-template-areas: "button log" "video log"; } button { grid-area: button; width: 10rem; margin: .5rem 0; } video { grid-area: video; } .event-log { grid-area: log; } .event-log>label { display: block; ...
HTMLOListElement - Web APIs
latin alphabet is used: A, B, C, D, E, ... 'i' meaning that the lowercase latin numerals are used: i, ii, iii, iv, v, ... 'I' meaning that the uppercase latin numerals are used: I, II, III, IV, V, ... HTMLOListElement.compact Is a Boolean indicating that spacing between list items should be reduced. This property reflects the compact attribute only, it doesn't consider the line-height CSS property used for that behavior in modern pages. Methods No specific method; inherits methods from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLOListElement' in that specification. Living Standard HTML5The definition of 'HTMLOListElement' in that specification. Recommendation Add...
HTMLObjectElement.height - Web APIs
Syntax var String = HTMLObjectElement.height; HTMLObjectElement.height = String; Value A DOMString. ...
HTMLObjectElement.width - Web APIs
Syntax var String = HTMLObjectElement.width; HTMLObjectElement.width = String; Value A DOMString. ...
HTMLOrForeignElement.nonce - Web APIs
The nonce property of the HTMLOrForeignElement interface returns the cryptographic number used once that is used by Content Security Policy to determine whether a given fetch will be allowed to proceed. In later implementations, elements only expose their nonce attribute to scripts (and not to side-channels like CSS attribute selectors). Examples Retrieving a nonce value In the past, not all browsers supported the nonce IDL attribute, so a workaround is to try to use getAttribute as a fallback: let nonce = script['nonce'] || script.getAttribute('nonce'); However, recent browsers version hide nonce values that are accessed this way (an empty string will be returned). The IDL property (script['nonce']) will be the only way to access nonces. Nonce hiding helps preventing that attackers e...
HTMLSelectElement.form - Web APIs
="get"> <label>Google: <input type="search" name="q"></label> <input type="submit" value="Search..."> </form> Javascript A property available on 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. ...
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. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" 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"...
HTMLTableCellElement - Web APIs
llElement.noWrap A Boolean value reflecting the nowrap attribute and indicating if cell content can be broken in several lines. HTMLTableCellElement.vAlign A DOMString representing an enumerated value indicating how the content of the cell must be vertically aligned. It reflects the valign attribute and can have one of the following values: "top", "middle", "bottom", or "baseline". Use the CSS vertical-align property instead. HTMLTableCellElement.width A DOMString specifying the number of pixels wide the cell should be drawn, if possible. This property reflects the also obsolete width attribute. Use the CSS width property instead. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLTableCellElement' in that specific...
HTMLTableElement.bgColor - Web APIs
Also available on DOM tbody, row and cell objects. Syntax color = table.bgColor table.bgColor = color Parameters color is a string representing a color value. ...
HTMLTableElement.cellSpacing - Web APIs
Any two cells are separated by the sum of the cellSpacing of each of the two cells. Syntax HTMLTableElement.cellSpacing = spacing; var spacing = HTMLTableElement.cellSpacing; Value A DOMString which is either a number of pixels (such as "10") or a percentage value (like "10%"). Example This example sets cell spacing for a given table to 10 pixels. ...
HTMLUListElement - Web APIs
ent, HTMLElement. HTMLUListElement.type Is a DOMString value reflecting the type and defining the kind of marker to be used to display. The values are browser dependent and have never been standardized. HTMLUListElement.compact Is a Boolean indicating that spacing between list items should be reduced. This property reflects the compact attribute only, it doesn't consider the line-height CSS property used for that behavior in modern pages. Methods No specific method; inherits methods from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLUListElement' in that specification. Living Standard HTML5The definition of 'HTMLUListElement' in that specification. Recommendation The...
HTMLVideoElement.msIsLayoutOptimalForPlayback - Web APIs
rer 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 extensions ...
Drag Operations - Web APIs
the exact appearance depends on the user's platform, typically a plus sign icon will appear for a 'copy' for example, and a 'cannot drop here' icon will appear when a drop is not allowed. This mouse pointer feedback is sufficient in many cases. However, you can also update the user interface with an insertion point or highlight as needed. For simple highlighting, you can use the :-moz-drag-over CSS pseudoclass on a drop target. .droparea:-moz-drag-over { outline: 1px solid black; } In this example, the element with the class droparea will receive a 1 pixel black outline while it is a valid drop target, that is, if the preventDefault() method was called during the dragenter event. Note: You must cancel the dragenter event for this pseudoclass to apply, as this state is not checked for...
ImageBitmap.height - Web APIs
The read-only ImageBitmap.height property returns the ImageBitmap object's height in CSS pixels. Specifications Specification Status Comment HTML Living StandardThe definition of 'ImageBitmap.height' in that specification. Living Standard Initial definition. ...
ImageBitmap.width - Web APIs
Web › API › ImageBitmap › width
The read-only ImageBitmap.width property returns the ImageBitmap object's width in CSS pixels. Specifications Specification Status Comment HTML Living StandardThe definition of 'ImageBitmap.height' in that specification. Living Standard Initial definition. ...
ImageBitmap - Web APIs
tmap interface represents a bitmap image which can be drawn to a <canvas> without undue latency. It can be created from a variety of source objects using the createImageBitmap() factory method. ImageBitmap provides an asynchronous and resource efficient pathway to prepare textures for rendering in WebGL. Properties ImageBitmap.height Read only Is an unsigned long representing the height, in CSS pixels, of the ImageData. ImageBitmap.width Read only Is an unsigned long representing the width, in CSS pixels, of the ImageData. Methods ImageBitmap.close() Disposes of all graphical resources associated with an ImageBitmap. Specifications Specification Status Comment HTML Living StandardThe definition of 'ImageBitmap' in that specification. Living...
IntersectionObserver.IntersectionObserver() - Web APIs
et, whose bounding rectangle will be considered the viewport. Any part of the target not visible in the visible area of the root is not considered visible. rootMargin A string which specifies a set of offsets to add to the root's bounding_box when calculating intersections, effectively shrinking or growing the root for calculation purposes. The syntax is approximately the same as that for the CSS margin property; see The root element and root margin in Intersection Observer API for more information on how the margin works and the syntax. The default is "0px 0px 0px 0px". threshold Either a single number or an array of numbers between 0.0 and 1.0, specifying a ratio of intersection area to total bounding box area for the observed target. A value of 0.0 means that even a single visible ...
KeyboardEvent.key - Web APIs
Web › API › KeyboardEvent › key
lease the Shift key. Press and hold the Shift key, then press and hold 2. Release the Shift key. Finally, release 2. ...
KeyframeEffect.getKeyframes() - Web APIs
ameEffect.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 n...
KeyframeEffect.target - Web APIs
The target property of a KeyframeEffect interface represents the element or pseudo-element being animated. It may be null for animations that do not target a specific element. It performs as both a getter and a setter, except with animations and transitions generated by CSS. Syntax var targetElement = document.getElementById("elementToAnimate"); var keyframes = new KeyframeEffect( targetElement, keyframeBlock, timingOptions ); // returns #elementToAnimate keyframes.target; // assigns keyframes a new target keyframes.target = newTargetElement; Value An Element, CSSPseudoElement, or null. Examples In the Follow the White Rabbit example, whiteRabbit sets the target element to be animated: var whiteRabbit = document.getElementById("rabbit"); var rabbitDownKeyframes = new K...
Location - Web APIs
Web › API › Location
spectively. ...
MediaDevices.getSupportedConstraints() - Web APIs
straints dictionary listing the constraints supported by the user agent. Because only constraints supported by the user agent are included in the list, each of these Boolean properties has the value true. Example This example outputs a list of the constraints supported by your browser. ...
MediaDevices.ondevicechange - Web APIs
Click the start button below to begin the demonstration.</p> <div id="startButton" class="button"> Start </div> <video id="video" width="160" height="120" autoplay></video><br> <div class="left"> <h2>Audio devices:</h2> <ul class="deviceList" id="audioList"></ul> </div> <div class="right"> <h2>Video devices:</h2> <ul class="deviceList" id="videoList"></ul> </div> <div id="log"></div> CSS content body { font: 14px "Open Sans", "Arial", sans-serif; } video { margin-top: 20px; border: 1px solid black; } .button { cursor: pointer; width: 160px; border: 1px solid black; font-size: 16px; text-align: center; padding-top: 2px; padding-bottom: 4px; color: white; background-color: darkgreen; } h2 { margin-bottom: 4px; } .left { float:left; width: 48%; m...
MediaList.mediaText - Web APIs
e 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 ...
MediaQueryList.media - Web APIs
a property in a <span>. JavaScript let mql = window.matchMedia('(max-width: 600px)'); document.querySelector(".mq-value").innerText = mql.media; The JavaScript code simply passes the media query to match into matchMedia() to compile it, then sets the <span>'s innerText to the value of the result's media property. HTML <span class="mq-value"></span> A simple <span> to receive the output. CSS .mq-value { font: 18px arial, sans-serif; font-weight: bold; color: #88f; padding: 0.4em; border: 1px solid #dde; } Result Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'media' in that specification. Working Draft Initial definition ...
MediaQueryListEvent.MediaQueryListEvent() - Web APIs
The available properties are: media: A DOMString representing a serialized media query. matches: A Boolean representing the media query status -- true if it matches, false if not. Examples var media = '(max-width: 600px)'; var matches = true; var myMediaQueryListEvent = new MediaQueryListEvent({media, matches}); Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'MediaQueryListEvent()' in that specification. Working Draft Initial definition ...
MediaQueryListListener - Web APIs
f you need to detect changes to the values of media queries on a document. A MediaQueryListListener is a callback function that gets invoked with a single argument, the MediaQueryList for which the evaluated result changed. Syntax function( mediaQueryList ) { ... } Parameters mediaQueryList The MediaQueryList instance. Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'MediaQueryListListener' in that specification. Working Draft Initial definition ...
MediaTrackSupportedConstraints.aspectRatio - Web APIs
upported = supportedConstraintsDictionary.aspectRatio; Value This property is present in the dictionary (and its value is always true) if the user agent supports the aspectRatio constraint. If the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. ...
MediaTrackSupportedConstraints.autoGainControl - Web APIs
ry (and its value is always true) if the user agent supports the autoGainControl constraint. If the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. Example This example simply displays whether or not your browser supports the autoGainControl constraint. ...
MediaTrackSupportedConstraints.channelCount - Web APIs
ported = supportedConstraintsDictionary.channelCount; Value This property is present in the dictionary (and its value is always true) if the user agent supports the channelCount constraint. If the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. ...
MediaTrackSupportedConstraints.deviceId - Web APIs
raintSupported = supportedConstraintsDictionary.deviceId; Value This property is present in the dictionary (and its value is always true) if the user agent supports the deviceId constraint. If the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. ...
MediaTrackSupportedConstraints.echoCancellation - Web APIs
supportedConstraintsDictionary.echoCancellation; Value This property is present in the dictionary (and its value is always true) if the user agent supports the echoCancellation constraint. If the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. ...
MediaTrackSupportedConstraints.facingMode - Web APIs
onstraintSupported = supportedConstraintsDictionary.facingMode; Value This property is present in the dictionary (and its value is always true) if the user agent supports the facingMode constraint. If the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. ...
MediaTrackSupportedConstraints.frameRate - Web APIs
ue is always true. Example This simple example looks to see if your browser supports constraining the frame rate when requesting video tracks. JavaScript let result = document.getElementById("result"); if (navigator.mediaDevices.getSupportedConstraints().frameRate) { result.innerHTML = "Supported!"; } else { result.innerHTML = "Not supported!"; } HTML <div id="result"> </div> CSS #result { font: 14px "Arial", sans-serif; } Result The output, showing if your browser supports the frameRate constraint, is: While this example is trivial, you can replace the simple output of "Supported" vs. "Not supported" with code to provide alternative methods for presenting the audiovisual information you want to share with the user or otherwise work with. Specifications ...
MediaTrackSupportedConstraints.groupId - Web APIs
straintSupported = supportedConstraintsDictionary.groupId; Value This property is present in the dictionary (and its value is always true) if the user agent supports the groupId constraint. If the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. ...
MediaTrackSupportedConstraints.height - Web APIs
onstraintSupported = supportedConstraintsDictionary.height; Value This property is present in the dictionary (and its value is always true) if the user agent supports the height constraint. If the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. ...
MediaTrackSupportedConstraints.latency - Web APIs
straintSupported = supportedConstraintsDictionary.latency; Value This property is present in the dictionary (and its value is always true) if the user agent supports the latency constraint. If the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. ...
MediaTrackSupportedConstraints.noiseSuppression - Web APIs
the noiseSuppression constraint (and therefore supports noise suppression on audio tracks). If the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. Example This example simply displays whether or not your browser supports the noiseSuppression constraint. ...
MediaTrackSupportedConstraints.sampleRate - Web APIs
tSupported = supportedConstraintsDictionary.sampleRate; Value This property is present in the dictionary (and its value is always true) if the user agent supports the sampleRate constraint. If the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. ...
MediaTrackSupportedConstraints.sampleSize - Web APIs
tSupported = supportedConstraintsDictionary.sampleSize; Value This property is present in the dictionary (and its value is always true) if the user agent supports the sampleSize constraint. If the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. ...
MediaTrackSupportedConstraints.volume - Web APIs
onstraintSupported = supportedConstraintsDictionary.volume; Value This property is present in the dictionary (and its value is always true) if the user agent supports the volume constraint. ...
MediaTrackSupportedConstraints.width - Web APIs
hConstraintSupported = supportedConstraintsDictionary.width; Value This property is present in the dictionary (and its value is always true) if the user agent supports the width constraint. If the property isn't present, this property is missing from the supported constraints dictionary, and you'll get undefined if you try to look at its value. ...
Using the Media Capabilities API - Web APIs
ntType given is The error can be due to the type not being one of the two possible values, the contentType not being a valid codec MIME type, or invalid or omitted definitions required in the VideoConfiguration. ...
MouseEvent() - Web APIs
ed by the event. The absence of any hit region is affected, is represented by the null value. In some implementations, passing anything other than a number for the screen and client fields will throw a TypeError. The MouseEventInit dictionary also accepts fields from UIEventInit and from EventInit dictionaries. Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'MouseEvent' in that specification. Working Draft Redefines screen and client fields long to double. Document Object Model (DOM) Level 3 Events SpecificationThe definition of 'MouseEvent()' in that specification. Obsolete Initial definition. ...
MouseEvent.offsetX - Web APIs
e provides the offset in the X coordinate of the mouse pointer between that event and the padding edge of the target node. Syntax var xOffset = instanceOfMouseEvent.offsetX; Return value A double floating point value. Early versions of the spec defined this as an integer. See the Browser compatibility section for details. Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'MouseEvent' in that specification. Working Draft Initial definition ...
MouseEvent.offsetY - Web APIs
ce provides the offset in the Y coordinate of the mouse pointer between that event and the padding edge of the target node. Syntax var yOffset = instanceOfMouseEvent.offsetY; Return value A double floating point value. Early versions of the spec defined this as an integer. See the Browser compatibility section for details. Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'MouseEvent' in that specification. Working Draft Initial definition ...
MouseEvent.pageY - Web APIs
Web › API › MouseEvent › pageY
The pageY read-only property of the MouseEvent interface returns the Y (vertical) coordinate in pixels of the event relative to the whole document. This property takes into account any vertical scrolling of the page. Syntax var pos = event.pageY; Originally, this property was defined as a long integer. The CSSOM View Module redefined it as a double float. See the Browser compatibility section for details. Examples var pageY = event.pageY; Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'pageY' in that specification. Working Draft Redefined from long to double. Touch EventsThe definition of 'pageY' in that specification. Unknown Initial definition. ...
MouseEvent.relatedTarget - Web APIs
arget returns null. FocusEvent.relatedTarget is a similar property for focus events. Syntax var target = instanceOfMouseEvent.relatedTarget Return value An EventTarget object or null. Example Try moving your mouse cursor into and out of the red and blue boxes. ...
MouseEvent.x - Web APIs
Web › API › MouseEvent › x
The MouseEvent.x property is an alias for the MouseEvent.clientX property. Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'MouseEvent.x' in that specification. Working Draft Initial definition ...
MouseEvent.y - Web APIs
Web › API › MouseEvent › y
The MouseEvent.y property is an alias for the MouseEvent.clientY property. Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'MouseEvent.y' in that specification. Working Draft Initial definition. ...
Online and offline events - Web APIs
dateOnlineStatus(event) { var condition = navigator.onLine ? ...
Node.isConnected - Web APIs
Web › API › Node › isConnected
nected to its relevant context object, and false if not. ...
Node.isEqualNode() - Web APIs
Web › API › Node › isEqualNode
quality with. Example In this example, we create three <div> blocks. The first and third have the same contents and attributes, while the second is different. Then we run some JavaScript to compare the nodes using isEqualNode() and output the results. ...
Node.isSameNode() - Web APIs
Web › API › Node › isSameNode
test against. Example In this example, we create three <div> blocks. The first and third have the same contents and attributes, while the second is different. Then we run some JavaScript to compare the nodes using isSameNode() and output the results. ...
Node.textContent - Web APIs
Web › API › Node › textContent
Text. 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 computationally expensive, and thus should be avoided when possible.) Unlike textContent, altering innerText in Internet Explorer (version 11 and below) removes child nodes from the element and permanently destroys all descendant text nodes. It is impossible to insert ...
Node - Web APIs
Web › API › Node
Node.cloneNode() Clone a Node, and optionally, all of its contents. By default, it clones the content of the node. Node.compareDocumentPosition() Compares the position of the current node against another node in any other document. Node.contains() Returns a Boolean value indicating whether or not a node is a descendant of the calling node. Node.getBoxQuads() Returns a list of the node's CSS boxes relative to another node. Node.getRootNode() Returns the context object's root which optionally includes the shadow root if it is available. Node.hasChildNodes() Returns a Boolean indicating whether or not the element has any child nodes. Node.insertBefore() Inserts a Node before the reference node as a child of a specified parent node. Node.isDefaultNamespace() Accepts a namespace...
Page Visibility API - Web APIs
ause the video when the user puts the tab into the background, and resume playback when the user returns to the tab. The user doesn't lose their place in the video, the video's soundtrack doesn't interfere with audio in the new foreground tab, and the user doesn't miss any of the video in the meantime. Visibility states of an <iframe> are the same as the parent document. Hiding an <iframe> using CSS properties (such as display: none;) doesn't trigger visibility events or change the state of the document contained within the frame. Use cases Let's consider a few use cases for the Page Visibility API. A site has an image carousel that shouldn't advance to the next slide unless the user is viewing the page An application showing a dashboard of information doesn't want to poll the server f...
Paint​Worklet​.device​Pixel​Ratio - Web APIs
Working Draft Initial definition. ...
PaintWorklet.devicePixelRatio - Web APIs
Working Draft Initial definition. ...
PaintWorklet.devicePixelRatio - Web APIs
Working Draft Initial definition. ...
ParentNode.replaceChildren() - Web APIs
pperoni pizza</option> <option>Vegan veggie pizza</option> </select> </div> <div class="buttons"> <button id="to-yes">Transfer to "Yes" --&gt;</button> <button id="to-no">&lt;-- Transfer to "No"</button> </div> <div> <label for="yes">Yes please!</label> <select id="yes" multiple size="10"> </select> </div> </main> It would make sense to use some simple CSS to lay out the two select lists in a line alongside one another, with the control buttons in between them: main { display: flex; } div { margin-right: 20px; } label, button { display: block; } .buttons { display: flex; flex-flow: column; justify-content: center; } select { width: 200px; } What we want to do is transfer any selected options in the "no" list over to the "yes" li...
ParentNode - Web APIs
Properties ParentNode.childElementCount Read only Returns the number of children of this ParentNode which are elements. ...
PerformanceFrameTiming - Web APIs
A frame rate of 60fps (frames per second) for a 60Hz refresh rate is the target for a good responsive user experience. This means the browser should process a frame in about 16.7ms. ...
PointerEvent.pointerType - Web APIs
console.log(`pointerType ${event.pointerType} is not suported`); } }, false); Specifications Specification Status Comment Pointer EventsThe definition of 'pointerType' in that specification. Obsolete Initial definition. Pointer Events - Level 2The definition of 'pointerType' in that specification. Recommendation Non-stable version. CSS Object Model (CSSOM) View ModuleThe definition of 'MouseEvent' in that specification. Working Draft Redefines MouseEvent from long to double. This means that a PointerEvent whose pointerType is mouse will be a double. ...
PointerEvent - Web APIs
ation and also the visual layout of elements in a document on screen media. Constructors PointerEvent() Creates a synthetic--and untrusted--PointerEvent. Properties This interface inherits properties from MouseEvent and Event. PointerEvent.pointerId Read only A unique identifier for the pointer causing the event. PointerEvent.width Read only The width (magnitude on the X axis), in CSS pixels, of the contact geometry of the pointer. PointerEvent.height Read only The height (magnitude on the Y axis), in CSS pixels, of the contact geometry of the pointer. PointerEvent.pressure Read only The normalized pressure of the pointer input in the range 0 to 1, where 0 and 1 represent the minimum and maximum pressure the hardware is capable of detecting, respectively. PointerEvent.t...
RTCPeerConnection: iceconnectionstatechange event - Web APIs
ckleIceCandidates to false. Examples An event handler for this event can be added using the RTCPeerConnection.oniceconnectionstatechange property or by using addEventListener() on the RTCPeerConnection. In this example, a handler for iceconnectionstatechange is set up to update a call state indicator by using the value of iceConnectionState to create a string which corresponds to the name of a CSS class that we can assign to the status indicator to cause it to reflect the current state of the connection. pc.addEventListener("iceconnectionstatechange", ev => { let stateElem = document.querySelector("#call-state"); stateElem.className = `${pc.iceConnectionState}-state`; }, false); This can also be written as: pc.oniceconnectionstatechange = ev => { let stateElem = document.querySel...
Range.commonAncestorContainer - Web APIs
listener gets the common ancestors of each piece of selected text, and triggers an animation to highlight them. HTML <ul> <li>Strings <ul> <li>Cello</li> <li>Violin <ul> <li>First Chair</li> <li>Second Chair</li> </ul> </li> </ul> </li> <li>Woodwinds <ul> <li>Clarinet</li> <li>Oboe</li> </ul> </li> </ul> CSS The .highlight class created below uses a set of CSS @keyframes to animate a fading outline. .highlight { animation: highlight linear 1s; } @keyframes highlight { from { outline: 1px solid #f00f; } to { outline: 1px solid #f000; } } body { padding: 1px; } JavaScript document.addEventListener('pointerup', e => { const selection = window.getSelection(); if (selection.type ===...
Range.extractContents() - Web APIs
ame("div").item(0)); var documentFragment = range.extractContents(); document.body.appendChild(documentFragment); Moving items between containers This example lets you move items between two containers. Select one or more item, and then click "swap" to move them to the opposite container. ...
Range.getClientRects() - Web APIs
screen occupied by the range. This is created by aggregating the results of calls to Element.getClientRects() for all the elements in the range. Syntax rectList = range.getClientRects() Example range = document.createRange(); range.selectNode(document.getElementsByTagName("div").item(0)); rectList = range.getClientRects(); Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Range.getClientRects()' in that specification. Working Draft Initial specification. ...
Range - Web APIs
Web › API › Range
not use RangeException anymore, use DOMException instead. Made the second parameter of collapse() optional. Added the methods isPointInRange(), comparePoint(), and intersectsNode(). Added the constructor Range(). DOM Parsing and SerializationThe definition of 'Extensions to Range' in that specification. Working Draft Added the method createContextualFragment(). CSS Object Model (CSSOM) View ModuleThe definition of 'Extensions to Range' in that specification. Working Draft Added the methods getClientRects() and getBoundingClientRect(). Document Object Model (DOM) Level 2 Traversal and Range SpecificationThe definition of 'Range' in that specification. Obsolete Initial specification. ...
Resource Timing API - Web APIs
ore removing any applied content-codings. decodedBodySize returns the size (in octets) received from the fetch (HTTP or cache) of the message body, after removing any applied content-codings. Other properties The nextHopProtocol property returns the network protocol used to fetch the resource. The initiatorType property returns the type of resource that initiated the performance entry such as "css" for a CSS resource, "xmlhttprequest" for an XMLHttpRequest and "img" for an image (such as a JPEG). If the current context is a worker, the workerStart property can be used to obtain a DOMHighResTimeStamp when the worker was started. Methods The Resource Timing API includes two methods that extend the Performance interface. The clearResourceTimings() method removes all "resource" type perform...
format - Web APIs
The SVGAltGlyphElement.format property is a DOMString that defines the format of the given font. It has the same meaning as the 'format' property of SVGGlyphRefElement property. If the font is in one of the formats listed in CSS2([CSS2], section15.3.5), then its value is the corresponding <string> parameter of the font. Syntax string = myGlyph.format; myGlyph.format = string; Value The format values listed below are taken from CSS2([CSS2], section15.3.5). String Font Format Examples of common extensions truedoc-pfr TrueDoc(TM) Portable Font Resource .pfr embedded-opentype Embedded OpenType .eot type-1 PostScript(TM) Type 1 .pfb, .pfa truetype TrueType .ttf opentype OpenType, including TrueType...
SVGClipPathElement - Web APIs
GElement. SVGClipPathElement.clipPathUnits Read only An SVGAnimatedEnumeration corresponding to the clipPathUnits attribute of the given <clipPath> element. Takes one of the constants defined in SVGUnitTypes. Methods This interface doesn't implement any specific methods, but inherits methods from its parent, SVGElement. Specifications Specification Status Comment CSS Masking Module Level 1The definition of 'SVGClipPathElement' in that specification. Candidate Recommendation Removed the inheritance from SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGStylable, SVGTransformable, and SVGUnitTypes Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGClipPathElement' in that specification. Recommendation Initial de...
SVGGraphicsElement: copy event - Web APIs
ffect the system clipboard. ...
SVGGraphicsElement: paste event - Web APIs
contents. ...
SVGMaskElement - Web APIs
AnimatedLength corresponding to the width attribute of the given <mask> element. SVGMaskElement.height Read only An SVGAnimatedLength corresponding to the height attribute of the given <mask> element. Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGElement. Specifications Specification Status Comment CSS Masking Module Level 1The definition of 'SVGMaskElement' in that specification. Candidate Recommendation Removed the implemented interfaces SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGStylable, and SVGTransformable. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGMaskElement' in that specification. Recommendation Initial definition ...
SVGTextContentElement - Web APIs
omputedTextLength() Returns a float representing the computed length for the text within the element. SVGTextContentElement.getSubStringLength() Returns a float representing the computed length of the formatted text advance distance for a substring of text within the element. Note that this method only accounts for the widths of the glyphs in the substring and any extra spacing inserted by the CSS 'letter-spacing' and 'word-spacing' properties. Visual spacing adjustments made by the 'x' attribute is ignored. SVGTextContentElement.getStartPositionOfChar() Returns a DOMPoint representing the position of a typographic character after text layout has been performed. Note: In SVG 1.1 this method returned an SVGPoint. SVGTextContentElement.getEndPositionOfChar() Returns a DOMPoint represe...
Screen.availWidth - Web APIs
Web › API › Screen › availWidth
The Screen.availWidth property returns the amount of horizontal space (in pixels) available to the window. Syntax var width = window.screen.availWidth Example var screenAvailWidth = window.screen.availWidth; console.log(screenAvailWidth); Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Screen.availWidth' in that specification. Working Draft Initial definition ...
Screen.colorDepth - Web APIs
Web › API › Screen › colorDepth
The Screen.colorDepth read-only property returns the color 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 bitDepth = window.screen.colorDepth; Example // Check the color depth of the screen if ( window.screen.colorDepth < 8) { // Use low-color version of page } else { // Use regular, colorful page } Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Screen.colorDepth' in that specification. Working Draft ...
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. ...
Screen.width - Web APIs
Web › API › Screen › width
ets occupy space that cannot be used by the window object, there is a difference in window.screen.width and window.screen.availWidth. See also screen.height. Internet Explorer will take into account the zoom setting when reporting the screen width. It will only return the real width of the screen if the zoom is set to 100%. Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Screen.width' in that specification. Working Draft Initial definition. ...
Screen - Web APIs
Web › API › Screen
use by JS-implemented event targets to implement onevent properties. See also WebIDL bindings. void setEventHandler(DOMString type, EventHandler handler) EventHandler getEventHandler(DOMString type) Example if (screen.pixelDepth < 8) { // use low-color version of page } else { // use regular, colorful page } Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Screen' in that specification. Working Draft Initial definition. ...
Using the Screen Capture API - Web APIs
"Start Capture" which, when clicked, calls the startCapture() function to request access to, and begin capturing, screen contents. A second button, "Stop Capture", which upon being clicked calls stopCapture() to terminate capture of screen contents. A <video> into which the captured screen contents 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:...
ServiceWorkerGlobalScope: install event - Web APIs
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: globalScope.o...
ServiceWorkerGlobalScope.oninstall - Web APIs
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 'Even...
StylePropertyMap.append() - Web APIs
The append() method of the StylePropertyMap interface adds a new CSS declaration to the StylePropertyMap with the given property and value. Syntax StylePropertyMap.append(property,value) Parameters property An identifier indicating the stylistic feature (e.g. 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. Working Draft Initial definition. ...
StylePropertyMap.clear() - Web APIs
The clear() method of the StylePropertyMap interface removes all declarations in the StylePropertyMap. Syntax StylePropertMap.clear() Parameters None. Return value undefined Example // TBD Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'clear()' in that specification. Working Draft Initial definition. ...
StylePropertyMap.delete() - Web APIs
The delete() method of the StylePropertyMap interface removes the CSS declaration with the given property. Syntax StylePropertyMap.delete(property) Parameters property An identifier indicating the stylistic feature (e.g. 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. Working Draft Initial definition. ...
StylePropertyMap.set() - Web APIs
The set() method of the StylePropertyMap interface changes the CSS declaration with the given property. Syntax StylePropertyMap.set(property,value) Parameters property An identifier indicating the stylistic feature (e.g. 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. Working Draft Initial definition. ...
StylePropertyMapReadOnly.entries() - Web APIs
Working Draft Initial definition. ...
StylePropertyMapReadOnly.forEach() - Web APIs
the current element being processed. indexOptional The index of the current element being processed. arrayOptional The StylePropertyMapReadOnly thatforEach() is being called on. 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. Working Draft Initial definition. ...
StylePropertyMapReadOnly.getAll() - Web APIs
The getAll() method of the StylePropertyMapReadOnly interface returns an array of CSSStyleValue objects containing the values for the provided property. Syntax var cssStyleValues[] = StylePropertyMapReadOnly.getAll(property) Parameters property The name of the property to retrieve all values of. Return value An array of CSSStyleValue objects. Example // TBD Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'getAll()' in that specification. Working Draft Initial definition. ...
StylePropertyMapReadOnly.has() - Web APIs
Working Draft Initial definition. ...
StylePropertyMapReadOnly.keys() - Web APIs
Working Draft Initial definition. ...
StylePropertyMapReadOnly.size - Web APIs
Working Draft Initial definition. ...
StylePropertyMapReadOnly.values() - Web APIs
Working Draft Initial definition. ...
StyleSheet.disabled - Web APIs
y 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 (DOM) Level 2 Style SpecificationThe definition of 'StyleSheet.disabled' in that specification. Obsolete Initial definition. ...
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. Specifications Specification Status Comment CSS Object Model (CSSOM)The definition of 'StyleSheet...
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 ...
TextDecoder() - Web APIs
"cseucpkdfmtjapanese", "euc-jp", "x-euc-jp" 'euc-jp' "csiso2022jp", "iso-2022-jp" Note: Firefox used to accept iso-2022-jp-2 sequences silently when an iso-2022-jp decoder was instantiated, however this was removed in version 56 to simplify the API, as no other browsers support it and no pages seem to use it. ...
TextMetrics.actualBoundingBoxAscent - Web APIs
The read-only actualBoundingBoxAscent property of the TextMetrics interface is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline attribute to the top of the bounding rectangle used to render the text, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.actualBoundingBoxAscent; // 8; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.actualBoundingBoxAscent' in that specification. ...
TextMetrics.actualBoundingBoxDescent - Web APIs
The read-only actualBoundingBoxDescent property of the TextMetrics interface is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline attribute to the bottom of the bounding rectangle used to render the text, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.actualBoundingBoxDescent; // 0; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.actualBoundingBoxDescent' in that specification. ...
TextMetrics.actualBoundingBoxLeft - Web APIs
The read-only actualBoundingBoxLeft property of the TextMetrics interface is a double giving the distance parallel to the baseline from the alignment point given by the CanvasRenderingContext2D.textAlign property to the left side of the bounding rectangle of the given text, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.actualBoundingBoxLeft; // 0; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.actualBoundingBoxLeft' in that specification. ...
TextMetrics.actualBoundingBoxRight - Web APIs
The read-only actualBoundingBoxRight property of the TextMetrics interface is a double giving the distance parallel to the baseline from the alignment point given by the CanvasRenderingContext2D.textAlign property to the right side of the bounding rectangle of the given text, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.actualBoundingBoxRight; // 15.633333333333333; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.actualBoundingBoxRight' in that specification. ...
TextMetrics.alphabeticBaseline - Web APIs
The read-only alphabeticBaseline property of the TextMetrics interface is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline property to the alphabetic baseline of the line box, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.alphabeticBaseline; // -0; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.alphabeticBaseline' in that specification. ...
TextMetrics.emHeightAscent - Web APIs
The read-only emHeightAscent property of the TextMetrics interface is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline property to the top of the em square in the line box, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.emHeightAscent; // 7.59765625; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.emHeightAscent' in that specification. ...
TextMetrics.emHeightDescent - Web APIs
The read-only emHeightDescent property of the TextMetrics interface is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline property to the bottom of the em square in the line box, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.emHeightDescent; // -2.40234375; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.emHeightDescent' in that specification. ...
TextMetrics.fontBoundingBoxAscent - Web APIs
The read-only fontBoundingBoxAscent property of the TextMetrics interface is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline attribute to the top of the highest bounding rectangle of all the fonts used to render the text, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.fontBoundingBoxAscent; // 10; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.fontBoundingBoxAscent' in that specification. ...
TextMetrics.fontBoundingBoxDescent - Web APIs
The read-only fontBoundingBoxDescent property of the TextMetrics interface is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline attribute to the bottom of the bounding rectangle of all the fonts used to render the text, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.fontBoundingBoxDescent; // 3; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.fontBoundingBoxDescent' in that specification. ...
TextMetrics.hangingBaseline - Web APIs
The read-only hangingBaseline property of the TextMetrics interface is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline property to the hanging baseline of the line box, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.hangingBaseline; // 6.078125; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.hangingBaseline' in that specification. ...
TextMetrics.ideographicBaseline - Web APIs
The read-only ideographicBaseline property of the TextMetrics interface is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline property to the ideographic baseline of the line box, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.ideographicBaseline; // -1.201171875; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.ideographicBaseline' in that specification. ...
TextMetrics.width - Web APIs
Web › API › TextMetrics › width
Examples Given this <canvas> element: <canvas id="canvas"></canvas> ... ...
msManipulationViewsEnabled - Web APIs
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 msManipulationViewsEnabled read-only property returns true if manipulation features are support available, such as touch panning and zooming using CSS rules. This proprietary property is specific to Internet Explorer and Microsoft Edge. Value Returns true if manipulation features are support available, such as touch panning and zooming using CSS rules. Example Using a JSON file: { msManipulationViewsEnabled: true, } See also Touch API Microsoft API extensions ...
Touch() - Web APIs
Web › API › Touch › Touch
y scroll offset. "pageY", optional and defaulting to 0, of type double, that is the vertical position of the touch on the client window of the user's screen, including any scroll offset. "radiusX", optional and defaulting to 0, of type float, that is the radius of the ellipse which most closely circumscribes the touching area (e.g. finger, stylus) along the axis indicated by rotationAngle, in CSS pixels of the same scale as screenX; 0 if no value is known. The value must not be negative. "radiusY", optional and defaulting to 0, of type float, that is the the radius of the ellipse which most closely circumscribes the touching area (e.g. finger, stylus) along the axis perpendicular to that indicated by rotationAngle, in CSS pixels of the same scale as screenY; 0 if no value is known. The...
Touch.radiusX - Web APIs
Web › API › Touch › radiusX
This value, in combination with Touch.radiusY and Touch.rotationAngle constructs an ellipse that approximates the size and shape of the area of contact between the user and the screen. This may be a relatively large ellipse representing the contact between a fingertip and the screen or a small area representing the tip of a stylus, for example. Note: This attribute has not been formally standardized. ...
Touch.radiusY - Web APIs
Web › API › Touch › radiusY
This value, in combination with Touch.radiusX and Touch.rotationAngle constructs an ellipse that approximates the size and shape of the area of contact between the user and the screen. This may be a large ellipse representing the contact between a fingertip and the screen or a small one representing the tip of a stylus, for example. Note: This attribute has not been formally standardized. ...
TransitionEvent.transitionName - Web APIs
The TransitionEvent.transitionName read-only property is a DOMString containing the name of the CSS property associated with the transition. Syntax name = TransitionEvent.transitionName Specifications Specification Status Comment CSS TransitionsThe definition of 'TransitionEvent.transitionName' in that specification. Working Draft Initial definition. ...
TransitionEvent.elapsedTime - Web APIs
Working Draft Initial definition. ...
TransitionEvent.initTransitionEvent() - Web APIs
following value is allowed: Value Meaning transitionend The transition completed. canBubbleArg Is a Boolean flag indicating if the event can bubble (true) or not (false). cancelableArg Is a Boolean flag indicating if the event associated action can be avoided (true) or not (false). transitionNameArg Is a DOMString containing the name of the CSS property associated with the transition. This value is not affected by the transition-delay property. elapsedTimeArg Is float giving the amount of time the transition has been running, in seconds, when this event fired. Specifications This method is non-standard and not part of any specification, though it was present in early drafts of CSS Transitions. ...
TransitionEvent.pseudoElement - Web APIs
Working Draft Initial definition. ...
UIEvent.layerX - Web APIs
Web › API › UIEvent › layerX
& 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 mouse coordinates ...
UIEvent.layerY - Web APIs
Web › API › UIEvent › layerY
& 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 mouse coordinates ...
UIEvent.pageY - Web APIs
Web › API › UIEvent › 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 mouse coordinates ...
VTTCue - Web APIs
Web › API › VTTCue
ze of the cue, as a percentage of the video size. VTTCue.textAlign Returns an enum representing the alignment of all the lines of text within the cue box. VTTCue.text Returns a DOMString with the contents of the cue. Methods getCueAsHTML() Returns the cue text as a DocumentFragment. ...
ValidityState.patternMismatch - Web APIs
Here we have 3 sections for a north American phone number with an implicit label encompassing all three components of the phone number, expecting 3-digits, 3-digits and 4-digits respectively, as defined by the pattern attribute set on each. If the values are too long or too short, or contain characters that aren't digits, patternMismatch will be true. When true, the element matches the :invalid CSS pseudo-classes. input:invalid { border: red solid 3px; } Note, in this case, we get a patternMismatch not a validityState.tooLong or validityState.tooShort if the values are too long or too short because it is the pattern that is dictating the length of the value. Had we used minlength and maxlength attributes instead, we may have seen validityState.tooLong or validityState.tooShort being t...
ValidityState.rangeOverflow - Web APIs
, including the date, month, week, time, datetime-local, number and range types and a max value is set, if the value don't doesn't conform to the constraints set by the max value, the rangeOverflow property will be true. Given the following: <input type="number" min="20" max="40" step="2"/> if value > 40, rangeOverflow will be true. When true, the element matches the :invalid and :out-of-range CSS pseudo-classes. Specifications Specification Status Comment HTML Living StandardThe definition of 'ValidityState.rangeOverflow' in that specification. Living Standard HTML 5.1The definition of 'ValidityState.rangeOverflow' in that specification. Recommendation HTML5The definition of 'ValidityState.rangeOverflow' in that specification. R...
ValidityState.rangeUnderflow - Web APIs
including the date, month, week, time, datetime-local, number and range types and a min value is set, if the value don't doesn't conform to the constraints set by the min value, the rangeUnderflow property will be true. Given the following: <input type="number" min="20" max="40" step="2"/> if value < 20, rangeUnderflow will be true. When true, the element matches the :invalid and :out-of-range CSS pseudo-classes. Specifications Specification Status Comment HTML Living StandardThe definition of 'ValidityState.rangeUnderflow' in that specification. Living Standard HTML 5.1The definition of 'ValidityState.rangeUnderflow' in that specification. Recommendation HTML5The definition of 'ValidityState.rangeUnderflow' in that specification. ...
ValidityState.stepMismatch - Web APIs
ep and min values, then stepMismatch will be true. If the remainder of the form control's value less the min value, divided by the step value (which defaults to 1 if ommitted) is not zero, there is a mismatch. Given the following: <input type="number" min="20" max="40" step="2"/> if (value - min) / 2 != 0, stepMismatch will be true. If true, the element matches the :invalid and :out-of-range CSS pseudo-classes. Specifications Specification Status Comment HTML Living StandardThe definition of 'ValidityState.stepMismatch' in that specification. Living Standard HTML 5.1The definition of 'ValidityState.stepMismatch' in that specification. Recommendation HTML5The definition of 'ValidityState.stepMismatch' in that specification. Reco...
VisualViewport.height - Web APIs
Syntax var height = VisualViewport.height Value A double. ...
VisualViewport.offsetTop - Web APIs
Syntax var offsetTop = VisualViewport.offsetTop Value A double. ...
VisualViewport.offsetleft - Web APIs
Syntax var offsetLeft = VisualViewport.offsetLeft Value A double. ...
VisualViewport.pageLeft - Web APIs
The pageLeft read-only property of the VisualViewport interface returns the x coordinate of the left edge of the visual viewport relative to the initial containing block origin, in CSS pixels. Syntax var pageLeft = VisualViewport.pageLeft Value A double. Specifications Specification Status Comment Visual Viewport APIThe definition of 'pageLeft' in that specification. Draft Initial definition. ...
VisualViewport.pageTop - Web APIs
The pageTop read-only property of the VisualViewport interface returns the y coordinate of the top edge of the visual viewport relative to the initial containing block origin, in CSS pixels. Syntax var pageTop = VisualViewport.pageTop Value A double. Specifications Specification Status Comment Visual Viewport APIThe definition of 'pageTop' in that specification. Draft Initial definition. ...
VisualViewport.width - Web APIs
Syntax var width = VisualViewport.width Value A double. ...
Visual Viewport API - Web APIs
on and size, and receives the resize and event:VisualViewport:scroll events you can onitor to know when chances occur to the window's viewport. Example The code below is based on the sample the specification, though it adds a few things that make it function better. It shows a function called viewportHandler(). When called it queries the offsetLeft and height properties for values it uses in a CSS translate() method. You invoke this function by passing it to both event calls. One thing that may not be clear in this example is the use of the pendingUpdate flag and the call to requestAnimationFrame(). The pendingUpdate flag serves to prevent multiple invocations of the transfrom that can occur when onresize and onscroll fire at the same time. Using requestAnimationFrame() ensures that the t...
WebGLRenderingContext - Web APIs
n 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 browser window. The effect is clea...
Clearing with colors - Web APIs
In addition, you may notice that clearing the drawing buffer with a solid color is a two-stage process. ...
WebGL by example - Web APIs
ng buffer with a different random color every second. Color masking Modifying random colors by applying color masking and thus limiting the range of displayed colors to specific shades. Basic scissoring How to draw simple rectangles and squares with scissoring operations. Canvas size and WebGL The 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. Boilerplate 1 The example describes repeated pieces of code that will be hidden from now on, as well as defining a JavaScript utility function to make WebGL initialization easier. Scissor animation Some animation fun with scissoring and clearing operations. Raining rectangles A simple game that demonstrates clearing with solid colors, scissoring,...
WebGL best practices - Web APIs
as possible for rendering each frame. devicePixelRatio and high-dpi rendering Handling devicePixelRatio != 1.0 is tricky. While the common approach is to set canvas.width = width * devicePixelRatio, this will cause moire artifacts with non-integer values of devicePixelRatio, as is common with UI scaling on Windows, as well as zooming on all platforms. Instead, we can use non-integer values for CSS's top/bottom/left/right to fairly reliably 'pre-snap' our canvas to whole integer device coordinates. Demo: https://jdashg.github.io/misc/webgl/device-pixel-presnap.html ResizeObserver and 'device-pixel-content-box' On supporting browsers (Chromium?), ResizeObserver can be used with 'device-pixel-content-box' to request a callback that includes the true device pixel size of an element. This ca...
WebGL: 2D and 3D graphics for the web - Web APIs
Web › API › WebGL API
rogramming, textures, geometry, user interaction, and more. Advanced tutorials WebGL model view projection A detailed explanation of the three core matrices that are typically used to represent a 3D object view: the model, view and projection matrices. Matrix math for the web A useful guide to how 3D transform matrices work, and can be used on the web -- both for WebGL calculations and in CSS3 transforms. Resources Raw WebGL: An introduction to WebGL A talk by Nick Desaulniers that introduces the basics of WebGL. This is a great place to start if you've never done low-level graphics programming. Khronos WebGL site The main web site for WebGL at the Khronos Group. WebGL Fundamentals A basic tutorial with fundamentals of WebGL. WebGL playground An online tool for creating and sh...
Signaling and video calling - Web APIs
ss="flexChild" id="camera-container"> <div class="camera-box"> <video id="received_video" autoplay></video> <video id="local_video" autoplay muted></video> <button id="hangup-button" onclick="hangUpCall();" disabled> Hang Up </button> </div> </div> The page structure defined here is using <div> elements, giving us full control over the page layout by enabling the use of CSS. We'll skip layout detail in this guide, but take a look at the CSS on Github to see how we handled it. Take note of the two <video> elements, one for your self-view, one for the connection, and the <button> element. The <video> element with the id "received_video" will present video received from the connected user. We specify the autoplay attribute, ensuring once the video starts arriving, it ...
Taking still photos with WebRTC - Web APIs
ke our captured still box display the image. If there isn't a valid image available (that is, the width and height are both 0), we clear the contents of the captured frame box by calling clearphoto(). Fun with filters Since we're capturing images from the user's webcam by grabbing frames from 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...
WebXR Device API - Web APIs
cs concepts. Foundations and basics Fundamentals of WebXR Before diving into the details of how to create content using WebXR, it may be helpful to read this overview of the technology, which includes introductions to terminology that may be unfamiliar to you, or which may be used in a new way. Matrix math for the web A guide covering how matrices can be used on the web, including both for CSS transforms and for WebGL purposes, as well as to handle the positioning and orientation of objects in WebXR contexts. WebXR application life cycle An overview of the overall life cycle of a WebXR application, from startup to shutdown. This article serves as an introduction to the basics of what's involved in creating a WebXR experience without diving into the code in detail. It's a good way to...
Web Animations API - Web APIs
Describes sets of animatable properties and values, called keyframes and their timing options. These can then be played using the Animation() constructor. AnimationTimeline Represents the timeline of animation. This interface exists to define timeline features (inherited by DocumentTimeline and future timeline objects) and is not itself accessed by developers. AnimationEvent Actually part of CSS Animations. DocumentTimeline Represents animation timelines, including the default document timeline (accessed using the Document.timeline property). EffectTiming Element.animate(), KeyframeEffectReadOnly.KeyframeEffectReadOnly(), and KeyframeEffect.KeyframeEffect() all accept an optional dictionary object of timing properties. Extensions to other interfaces The Web Animations API adds som...
Controlling multiple parameters with ConstantSourceNode - Web APIs
div class="left"> <div id="playButton" class="button"> ? ...
Example and tutorial: Simple synth keyboard - Web APIs
ns correspond to the available waveforms. ...
Window: blur event - Web APIs
Web › API › Window › blur event
Bubbles No Cancelable No Interface FocusEvent Event handler property onblur Sync / Async Sync Composed Yes Examples Live example This example changes the appearance of a document when it loses focus. It uses addEventListener() to monitor focus and blur events. HTML <p id="log">Click on this document to give it focus.</p> CSS .paused { background: #ddd; color: #555; } JavaScript function pause() { document.body.classList.add('paused'); log.textContent = 'FOCUS LOST!'; } function play() { document.body.classList.remove('paused'); log.textContent = 'This document has focus. Click outside the document to lose focus.'; } const log = document.getElementById('log'); window.addEventListener('blur', pause); ...
Window.convertPointFromNodeToPage() - Web APIs
node The Node in whose coordinate system the Point specified by nodePoint is described. nodePoint A Point object describing a point in node's coordinate system; this point will be converted to the page's coordinate system. Return value A Point object specifying a point in the page's coordinate system. Specifications This method was specified in the defunct 20 March 2009 Working Draft of CSS 2D Transforms Module Level 3. It is not present in the current CSS Transforms Module Level 1 Working Draft. ...
Window.convertPointFromPageToNode - Web APIs
The Node into whose coordinate system the point is to be converted. pagePoint A Point object specifying a point in the coordinate system of the page, which is to be converted into the node's coordinate system. Return value A Point object describing the specified location in the node's coordinate system. Specifications This method was specified in the defunct 20 March 2009 Working Draft of CSS 2D Transforms Module Level 3. It is not present in the current CSS Transforms Module Level 1 Working Draft. ...
Window: error event - Web APIs
IEvent instance if it was generated from a user interface element, or an Event instance otherwise. ...
Window: focus event - Web APIs
Bubbles No Cancelable No Interface FocusEvent Event handler property onfocus Sync / Async Sync Composed Yes Examples Live example This example changes the appearance of a document when it loses focus. It uses addEventListener() to monitor focus and blur events. HTML <p id="log">Click on this document to give it focus.</p> CSS .paused { background: #ddd; color: #555; } JavaScript function pause() { document.body.classList.add('paused'); log.textContent = 'FOCUS LOST!'; } function play() { document.body.classList.remove('paused'); log.textContent = 'This document has focus. Click outside the document to lose focus.'; } const log = document.getElementById('log'); window.addEventListener('blur', pause); ...
Window.innerHeight - Web APIs
FIXME: link to an interactive demo here To change the size of a window, see window.resizeBy() and window.resizeTo(). To get the outer height of a window, i.e. the height of the whole browser window, see window.outerHeight. Graphical example The following figure shows the difference between outerHeight and innerHeight. Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'window.innerHeight' in that specification. Working Draft Initial definition ...
Window: load event - Web APIs
Web › API › Window › load event
age is fully loaded'); }); The same, but using the onload event handler property: window.onload = (event) => { console.log('page is fully loaded'); }; Live example HTML <div class="controls"> <button id="reload" type="button">Reload</button> </div> <div class="event-log"> <label>Event log:</label> <textarea readonly class="event-log-contents" rows="8" cols="30"></textarea> </div> CSS body { display: grid; grid-template-areas: "control log"; } .controls { grid-area: control; display: flex; align-items: center; justify-content: center; } .event-log { grid-area: log; } .event-log-contents { resize: none; } label, button { display: block; } #reload { height: 2rem; } JS const log = document.querySelector('.event-log-contents'); const reload = documen...
Window.matchMedia() - Web APIs
Web › API › Window › matchMedia
".mq-value").innerText = mql.matches; The JavaScript code simply passes the media query to match into matchMedia() to compile it, then sets the <span>'s innerText to the value of the results' matches property, so that it indicates whether or not the document matches the media query at the moment the page was loaded. HTML <span class="mq-value"></span> A simple <span> to receive the output. CSS .mq-value { font: 18px arial, sans-serif; font-weight: bold; color: #88f; padding: 0.4em; border: 1px solid #dde; } Result See Testing media queries programmatically for additional code examples. Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Window.matchMedia()' in that specification. Working Dr...
Window.moveBy() - Web APIs
Web › API › Window › moveBy
rizontally. Positive values are to the right, while negative values are to the left. deltaY is the amount of pixels to move the window vertically. Positive values are down, while negative values are up. Example This example moves the window 10 pixels to the right and 10 pixels up. function budge() { moveBy(10, -10); } Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'window.moveBy()' in that specification. Working Draft ...
Window.moveTo() - Web APIs
Web › API › Window › moveTo
moveBy() moves the window relative to its current location. Syntax window.moveTo(x, y) Parameters x is the horizontal coordinate to be moved to. y is the vertical coordinate to be moved to. Example This example moves the window to the top-left corner of the screen. function origin() { window.moveTo(0, 0); } Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'window.moveTo()' in that specification. Working Draft Initial definition ...
Window.mozAnimationStartTime - Web APIs
, in milliseconds since the epoch, at which animations started now should be considered to have started. This value should be used instead of, for example, Date.now(), because this value will be the same for all animations started in this window during this refresh interval, allowing them to remain in sync with one another. This also allows JavaScript-based animations to remain synchronized with CSS transitions and SMIL animations triggered during the same refresh interval. Syntax time = window.mozAnimationStartTime; Parameters time is the time in milliseconds since the epoch at which animations for the current window should be considered to have started. ...
Window.onmozbeforepaint - Web APIs
d by one or more scripts calling window.mozRequestAnimationFrame(). The event handler receives as an input parameter an event whose timeStamp property is the time, in milliseconds since epoch, that is the "current time" for the current animation frame. This time is the same for all animations being run in the same browser window, including those using the window.mozRequestAnimationFrame() method, CSS transitions, and SMIL animations. Specification Not part of a specification. ...
Window.outerHeight - Web APIs
window-resizing borders/handles. Notes To change the size of a window, see window.resizeBy() and window.resizeTo(). To get the inner height of a window, i.e. the height of the page being displayed, see window.innerHeight. Graphical example The following figure shows the difference between outerHeight and innerHeight. Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Window.outerHeight' in that specification. Working Draft ...
Window.outerWidth - Web APIs
Web › API › Window › outerWidth
. It represents the width of the whole browser window including sidebar (if expanded), window chrome and window resizing borders/handles. Notes To change the size of a window, see window.resizeBy() and window.resizeTo(). To get the inner width of a window, i.e. the width of the page being displayed, see window.innerWidth. Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Window.outerWidth' in that specification. Working Draft Initial definition. ...
Window.pageXOffset - Web APIs
The read-only Window property pageXOffset is an alias for scrollX. Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'window.pageXOffset' in that specification. Working Draft ...
Window.requestAnimationFrame() - Web APIs
uely identifies the entry in the callback list. This is a non-zero value, but you may not make any other assumptions about its value. You can pass this value to window.cancelAnimationFrame() to cancel the refresh callback request. Example In this example, an element is animated for 2 seconds (2000 milliseconds). The element moves at a speed of 0.1px/ms to the right, so its relative position (in CSS pixels) can be calculated in function of the time elapsed since the start of the animation (in milliseconds) with 0.1 * 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 elapse...
Window.resizeTo() - Web APIs
Web › API › Window › resizeTo
pixels (including scroll bars, title bars, etc). Example This function resizes the window so that it takes up one quarter of the available screen. See the Screen.availWidth and Screen.availHeight properties. function quarter() { window.resizeTo( window.screen.availWidth / 2, window.screen.availHeight / 2 ); } Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'window.resizeTo()' in that specification. Working Draft ...
Window.screen - Web APIs
Web › API › Window › screen
indow. The screen object, implementing the Screen interface, is a special object for inspecting properties of the screen on which the current window is being rendered. Syntax let screenObj = window.screen; Example if (screen.pixelDepth < 8) { // use low-color version of page } else { // use regular, colorful page } Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'window.screen' in that specification. Working Draft Initial definition. ...
Window.scroll() - Web APIs
Web › API › Window › scroll
utton> Using options: window.scroll({ top: 100, left: 100, behavior: 'smooth' }); Notes Window.scrollTo() is effectively the same as this method. For relative scrolling, see Window.scrollBy(), Window.scrollByLines(), and Window.scrollByPages(). For scrolling elements, see Element.scrollTop and Element.scrollLeft. Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'window.scroll()' in that specification. Working Draft Initial definition. Browser Compatibility The compatibility table in 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. DesktopMobileChromeEdgeFirefoxIntern...
Window.scrollBy() - Web APIs
Web › API › Window › scrollBy
roll up: window.scrollBy(0, -window.innerHeight); Using options: window.scrollBy({ top: 100, left: 100, behavior: 'smooth' }); Notes window.scrollBy() scrolls by a particular amount, whereas window.scroll() scrolls to an absolute position in the document. See also window.scrollByLines() and window.scrollByPages(). Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'window.scrollBy()' in that specification. Working Draft Initial definition. Browser Compatibility The compatibility table in 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. DesktopMobileChromeEdgeFirefoxInte...
Window.setCursor() - Web APIs
Web › API › Window › setCursor
Specification This is not part of any specification. ...
WindowEventHandlers.onafterprint - Web APIs
ler for processing afterprint events for the current window. These events are raised after the user prints, or if they abort the print dialog. The beforeprint and afterprint events allow pages to change their content before printing starts (perhaps to remove a banner, for example) and then revert those changes after printing has completed. In general, you should prefer the use of an @media print CSS at-rule, but it may be necessary to use these events in some cases. Syntax window.addEventListener("afterprint", function(event) { ... }); window.onafterprint = function(event) { ... }; Specification Specification Status Comment HTML Living StandardThe definition of 'onafterprint' in that specification. Living Standard ...
WindowEventHandlers.onbeforeprint - Web APIs
s the EventHandler for processing beforeprint events for the current window. These events are raised before the print dialog window is opened. The beforeprint and afterprint events allow pages to change their content before printing starts (perhaps to remove a banner, for example) and then revert those changes after printing has completed. In general, you should prefer the use of an @media print CSS at-rule, but it may be necessary to use these events in some cases. Syntax window.addEventListener("beforeprint", function(event) { ... }); window.onbeforeprint = function(event) { ... }; Polyfill Safari does not implement these events, but you can create an equivalent result to the beforeprint event with window.matchMedia('print'). var mediaQueryList = window.matchMedia('print'); mediaQuer...
WindowOrWorkerGlobalScope.caches - Web APIs
e = 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. ...
XMLHttpRequest: abort event - Web APIs
Examples Live example HTML <div class="controls"> <input class="xhr success" type="button" name="xhr" value="Click to start XHR (success)" /> <input class="xhr error" type="button" name="xhr" value="Click to start XHR (error)" /> <input class="xhr abort" type="button" name="xhr" value="Click to start XHR (abort)" /> </div> <textarea readonly class="event-log"></textarea> CSS .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; margin: .5rem; } JS const xhrButtonSuccess = document.querySelector('.xhr.success'); const xhrButtonError = document.querySelector('.xhr.error'); const xhrButtonAbort = document.querySelector('.xhr.abort'); const log = document.querySelector('.
XMLHttpRequest: error event - Web APIs
Examples Live example HTML <div class="controls"> <input class="xhr success" type="button" name="xhr" value="Click to start XHR (success)" /> <input class="xhr error" type="button" name="xhr" value="Click to start XHR (error)" /> <input class="xhr abort" type="button" name="xhr" value="Click to start XHR (abort)" /> </div> <textarea readonly class="event-log"></textarea> CSS .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; margin: .5rem; } JS const xhrButtonSuccess = document.querySelector('.xhr.success'); const xhrButtonError = document.querySelector('.xhr.error'); const xhrButtonAbort = document.querySelector('.xhr.abort'); const log = document.querySelector('.
XMLHttpRequest: load event - Web APIs
Examples Live example HTML <div class="controls"> <input class="xhr success" type="button" name="xhr" value="Click to start XHR (success)" /> <input class="xhr error" type="button" name="xhr" value="Click to start XHR (error)" /> <input class="xhr abort" type="button" name="xhr" value="Click to start XHR (abort)" /> </div> <textarea readonly class="event-log"></textarea> CSS .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; margin: .5rem; } JS const xhrButtonSuccess = document.querySelector('.xhr.success'); const xhrButtonError = document.querySelector('.xhr.error'); const xhrButtonAbort = document.querySelector('.xhr.abort'); const log = document.querySelector('.
XMLHttpRequest: loadend event - Web APIs
Examples Live example HTML <div class="controls"> <input class="xhr success" type="button" name="xhr" value="Click to start XHR (success)" /> <input class="xhr error" type="button" name="xhr" value="Click to start XHR (error)" /> <input class="xhr abort" type="button" name="xhr" value="Click to start XHR (abort)" /> </div> <textarea readonly class="event-log"></textarea> CSS .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; margin: .5rem; } JS const xhrButtonSuccess = document.querySelector('.xhr.success'); const xhrButtonError = document.querySelector('.xhr.error'); const xhrButtonAbort = document.querySelector('.xhr.abort'); const log = document.querySelector('.
XMLHttpRequest: loadstart event - Web APIs
Examples Live example HTML <div class="controls"> <input class="xhr success" type="button" name="xhr" value="Click to start XHR (success)" /> <input class="xhr error" type="button" name="xhr" value="Click to start XHR (error)" /> <input class="xhr abort" type="button" name="xhr" value="Click to start XHR (abort)" /> </div> <textarea readonly class="event-log"></textarea> CSS .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; margin: .5rem; } JS const xhrButtonSuccess = document.querySelector('.xhr.success'); const xhrButtonError = document.querySelector('.xhr.error'); const xhrButtonAbort = document.querySelector('.xhr.abort'); const log = document.querySelector('.
XMLHttpRequest: progress event - Web APIs
Examples Live example HTML <div class="controls"> <input class="xhr success" type="button" name="xhr" value="Click to start XHR (success)" /> <input class="xhr error" type="button" name="xhr" value="Click to start XHR (error)" /> <input class="xhr abort" type="button" name="xhr" value="Click to start XHR (abort)" /> </div> <textarea readonly class="event-log"></textarea> CSS .event-log { width: 25rem; height: 4rem; border: 1px solid black; margin: .5rem; padding: .2rem; } input { width: 11rem; margin: .5rem; } JS const xhrButtonSuccess = document.querySelector('.xhr.success'); const xhrButtonError = document.querySelector('.xhr.error'); const xhrButtonAbort = document.querySelector('.xhr.abort'); const log = document.querySelector('.
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. XSL (Extensible Stylesheet Language) Transformations are composed of two parts: XSL elements, which allow the transforma...
XSL Transformations in Mozilla FAQ - Web APIs
ieved by printing the current DOM tree. Having XSLT stylesheet specific to particular media would require to retransform the original XML source, which counteracts the expectations of the user. Thus, using media in <?xml-stylesheet ?> is strongly discouraged. Future builds might only load an XSLT stylesheet if media is not specified, or if the specified media include screen. This does not affect CSS stylesheets loaded from the generated DOM, those honor media just like in pages without XSLT. How do I do transformNode? There is transformToDocument and transformToFragment starting with Mozilla 1.2 final, see Using the Mozilla JavaScript interface to XSL Transformations. Why does Internet Explorer require a different XSLT namespace than Mozilla? IE up to version 6 required a deprecated name...
msPutPropertyEnabled - Web APIs
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 also CSS Style Declaration Microsoft API extensions ...
Using the alert role - Accessibility
This means that an existing alert can be "reused" multiple times. Note: In most cases this approach is not recommended, because it's not ideal to hide error or alert text that is currently not applicable. Users of older assistive technology may still be able to perceive the alert text even when the alert does n...
ARIA Test Cases - Accessibility
As focus moves among the radio buttons, the newly focused radio button's label, state and...
ARIA: cell role - Accessibility
've included the aria-rowindex property on every cell. If no cells spanned more than one row or column, the aria-rowindex could have been placed on the row rather than the row's individual cells. Best practices Only use table, tbody, thead, tr, th, td, etc., for data table structure. You can add ARIA roles to ensure accessibility should the native semantics of the table be removed, such as with CSS. A relevant use case for the ARIA table role is when the native semantics of a table are overridden by CSS's display property, such as by display: grid. In this case, you can use the ARIA table roles to add the semantics back in. <table role="table" aria-label="Semantic Elements" aria-describedby="semantic_elements_table_desc" aria-rowcount="81"> <caption id="semantic_elements_table_desc">Se...
ARIA: row role - Accessibility
ort property. The table body is in a separate rowgroup, with four rows currently in the DOM. Because not all the rows are in the DOM, we've included the aria-rowindex property on every row. Best practices Only use table, tbody, thead, tr, th, td, etc., for data table structure. You can add these ARIA roles to ensure accessibility should the native semantics of the table be removed, such as with CSS. A relevant use case for the ARIA table role is when the native semantics of a table are overridden by CSS's display property, such as by display: grid. In this case, you can use the ARIA table roles to add the semantics back in. <table role="table" aria-label="Semantic Elements" aria-describedby="semantic_elements_table_desc" aria-rowcount="81"> <caption id="semantic_elements_table_desc">Se...
ARIA: rowgroup role - Accessibility
rt property. The table body is a separate rowgroup, with four rows currently in the DOM. Because not all the rows are in the DOM, we've included the aria-rowindex property on every row. Best practices Only use table, tbody, thead, tr, th, td, and so on for data table structure. You can add these ARIA roles to ensure accessibility should the native semantics of the table be removed, such as with CSS. A relevant use case for the ARIA table role is when the CSS's display property overrides the native semantics of a table, such as by display: grid. In this case, you can use the ARIA table roles to add in the semantics. <table role="table" aria-label="Semantic Elements" aria-describedby="semantic_elements_table_desc" aria-rowcount="81"> <caption id="semantic_elements_table_desc">Semantic El...
ARIA: switch role - Accessibility
ribute from true to false, or vice versa. document.querySelectorAll(".switch").forEach(function(theSwitch) { theSwitch.addEventListener("click", handleClickEvent, false); }); function handleClickEvent(evt) { let el = evt.target; if (el.getAttribute("aria-checked") == "true") { el.setAttribute("aria-checked", "false"); } else { el.setAttribute("aria-checked", "true"); } } CSS The purpose of the CSS is to establish a look and feel for the switch that's reminiscent of the power switch paradigm. button.switch { margin: 0; padding: 0; width: 70px; height: 26px; border: 2px solid black; display: inline-block; margin-right: 0.25em; line-height: 20px; vertical-align: middle; text-align: center; font: 12px "Open Sans", "Arial", serif; } button.switch ...
ARIA: tab role - Accessibility
<- Focuses and optionally activates the previous tab in the tab list. If the current tab is the first tab in the tab list it activates the last tab. Delete When allowed removes the currently selected tab from the tab list. Required JavaScript features While there are ways to build tab-like functionality without JavaScript, there are no substitute combination of HTML and CSS only that will provide the same set of functionality that's required above for accessible tabs with content. Example This example combines the role tab with tablist and elements with tabpanel to create an interactive group of tabbed content. Here we are enclosing our group of content in a div, with our tablist having an aria-label to label it for assistive technology. Each tab is a button with...
ARIA: table role - Accessibility
s indicated by the aria-rowcount property, only four are currently visible. The columns are sortable, but not currently sorted, as indicated by the aria-sort property on the column headers. Best practices Only use table, tbody, thead, tr, th, td, etc., for data table structure. You can add these ARIA roles to ensure accessibility should the native semantics of the table be removed, such as with CSS. A relevant use case for the ARIA table role is when CSS's display property overrides the native semantics of a table, such as by display: grid. In this case, you can use the ARIA table roles to re-add the semantics. Added benefits none Specifications Specification Status Accessible Rich Internet Applications (WAI-ARIA) 1.1The definition of 'ARIA Table Role' in that speci...
ARIA: checkbox role - Accessibility
earance of the checkbox so it appears checked or unchecked to the sighted user onKeyPress Handle the case where the user presses the Space key to change the state of the checkbox by changing the value of the aria-checked attribute and the appearance of the checkbox so it appears checked or unchecked to the sighted user Examples The following example creates a simple checkbox element using CSS and JavaScript to handle the checked or unchecked status of the element. HTML <span role="checkbox" id="chkPref" aria-checked="false" onclick="changeCheckbox()" onKeyPress="changeCheckbox()" tabindex="0" aria-labelledby="chk1-label"></span> <label id="chk1-label" onclick="changeCheckbox()" onKeyPress="changeCheckbox()">Remember my preferences</label> CSS [role="checkbox"] { padding:5px...
Web applications and ARIA FAQ - Accessibility
A 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 officially part of the HTML 4 or XHTML 4...
Accessibility: What users can do to browse more safely - Accessibility
can actually be a money-saving endeavor. One work station can be set up to acommodate both a low-vision individual (needs high-contrast) and to accomodate an individual with photosensitive susceptibilities, by simply, adjusting personalization and accessiblity settings. Use modern browers. Learn personalization and accessibility settings Firefox 73 and above (Dekstop) Firefox added support for CSS prefers-reduced-motion in October 2018. Chrome 74 and above (Desktop) Chrome 74 added support for reduced-motion-query, it has even added support to detect whether the user has requested a reduced motion experience. The user would access this through an accessibility interface, as seen below. CSS Transition events are now supported. Examples include: transitionrun transitionstart transi...
Accessibility Information for Web Authors - Accessibility
or reading, furthermore for people with partial color deficiency (see the excellent examples in Effective Color 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 D...
Keyboard-navigable JavaScript widgets - Accessibility
us. 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 your widget handles a key event, prevent the browser from also handling it (for example, scrolling in response to the arrow keys) by using your event handler's return code. If your event handler returns false, the event will not be propagated beyond your handler. For example: <span tabindex="-1" onkeydown="return handleKe...
Color contrast - Accessibility
ast, and have trouble differentiating between similar colors. This is because they don't see bright and dark 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 </d...
Accessibility
what tools different people use to interact with the Web, and how we can make accessibility part of our web development workflow. HTML: A good basis for accessibility A great deal of web content can be made accessible just by making sure the correct HTML elements are used for the correct purpose at all times. This article looks in detail at how HTML can be used to ensure maximum accessibility. CSS and JavaScript accessibility best practices CSS and JavaScript, when used properly, also have the potential to allow for accessible web experiences ... or they can significantly harm accessibility if misused. This article outlines some CSS and JavaScript best practices that should be considered to ensure even complex content is as accessible as possible. WAI-ARIA basics Following on from the p...
Demos of open web technologies
Browser Firefox Flick Virtual Barber Shop Transformers Movie Trailer A Scanner Darkly Movie Trailer (with built in controls) Events firing and volume control Dragable and sizable videos 3D Graphics WebGL Web Audio Fireworks IoQuake3 (source code) Escher puzzle (source code) Kai 'Opua (source code) Virtual Reality The Polar Sea (source code) Sechelt fly-through (source code) CSS CSS Zen Garden CSS floating logo "mozilla" Paperfold CSS Blockout Rubik's cube Pure CSS Slides Planetarium (source code) Loader with blend modes Text reveal with clip-path Ambient shadow with custom properties Luminiscent vial CSS-based single page application (source code) Transformations Impress.js (source code) Games IoQuake3 (source code) Kai 'Opua (source code) Web...
Ajax - Developer guides
Web › Guide › AJAX
Getting Started An introduction to Ajax. Asynchronous JavaScript and XML, while not a technology in itself, is a term coined in 2005 by Jesse James Garrett, that describes a "new" approach to using a number of existing technologies together, including HTML or XHTML, CSS, JavaScript, DOM, XML, XSLT, and most importantly the XMLHttpRequest object. When these technologies are combined in the Ajax model, web applications are able to make quick, incremental updates to the user interface without reloading the entire browser page. This makes the application faster and more responsive to user actions. Although X in Ajax stands for XML, JSON is used more than XML nowadays because of its many advantages such as being lighter and a part of JavaScript. Both JSON and XML are used for packaging...
Cross-browser audio basics - Developer guides
age bar.style.width = parseInt(((myAudio.currentTime / myAudio.duration) * 100), 10) + "%"; }); } You should end up with something like this: Seeking using the seek bar This is a good start, but it would be nice to be able to navigate the audio using the progress bar. Fortunately this isn't too difficult to implement. ...
Media buffering, seeking, and time ranges - Developer guides
has actually downloaded -- this what the browser's native players seem to display. So let's build this. ...
Audio and Video Delivery - Developer guides
information see Live streaming web audio and video. Customising Your Media Player You may decide that you want your audio or video player to have a consistent look across browsers, or just wish to tweak it to match your site. The general technique for achieving this is to omit the controls attribute so that the default browser controls are not displayed, create custom controls using HTML and CSS, then use JavaScript to link your controls to the audio/video API. If you need something extra, it's possible to add features that are not currently present in default players, such as playback rate, quality stream switches or even audio spectrums. You can also choose how to make your player responsive -- for example you might remove the progress bar under certain conditions. You may detect cli...
Using device orientation with 3D transforms - Developer guides
Using orientation to rotate an element The easiest way to convert orientation data to a 3D transform is basically to use the alpha, gamma, and beta values as rotateZ, rotateX and rotateY values. ...
Event developer guide - Developer guides
Web › Guide › Events
...
Making content editable - Developer guides
!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();"> <form name="compF...
HTML5 Parser - Developer guides
Web › Guide › HTML › HTML5 › HTML5 Parser
g> is assigned to the SVG namespace in the DOM. <math>...</math> is assigned to the MathML namespace in the DOM. foreignObject and annotation-xml (and various less important elements) establish a nested HTML scope, so you can nest SVG, MathML and HTML as you'd expect to be able to nest them. The parser case-corrects markup so <SVG VIEWBOX='0 0 10 10'> works in HTML source. The DOM methods and CSS selectors behave case-sensitively, so you need to write your DOM calls and CSS selectors using the canonical case, which is camelCase for various parts of SVG such as viewBox. The syntax <foo/> opens and immediately closes the foo element if it is a MathML or SVG element (i.e. not an HTML element). Attributes are tokenized the same way they are tokenized in HTML, so you can omit quotes in the s...
Separate sites for mobile and desktop - Developer guides
or the older WML. This factor aside, there is one case where this strategy really shines over other methods. If the functionality you would like to provide to your users on mobile devices is extremely different from that on a desktop, then using separate sites is simply likely to be the most practical choice. This is because you have the option of sending completely separate HTML, JavaScript, and CSS to phones and PCs. Another case where you may be forced to use this approach is if you cannot, for whatever reason, modify your existing desktop site, and need to have a 100% separate mobile site. Though it's not ideal, at least you have this option. Examples Most of the major Web applications you see in the wild have chosen this path, including Facebook, YouTube, Digg, and Flickr. In fact, Mozil...
Printing - Developer guides
ting, 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 during printing (such as by displaying or hiding user interface elements dur...
The Web Open Font Format (WOFF) - Developer guides
Web › Guide › WOFF
rs like the WOFF format, so it has the potential of becoming a truly universal, interoperable font format for the web, unlike other current font formats. There are two versions of WOFF; WOFF and WOFF2, they mostly differ in regard to the compression algorithm used. In @font-face they are identified by the 'woff' and respectively 'woff2' format descriptor. Using WOFF You can use the @font-face CSS property to use WOFF fonts for text in web content. It works exactly like OpenType and TrueType format fonts do, except it will likely let your content download more efficiently due to the addition of compression. Tools for working with WOFF fonts Tools for working with WOFF fonts are available. sfnt2woff and woff2sfnt convert between WOFF and OpenType. Specifications Specificatio...
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 ...
HTML attribute: multiple - HTML: Hypertext Markup Language
odworkers.com</option> <option>sleepy@woodworkers.com</option> <option>bashful@woodworkers.com</option> <option>sneezy@woodworkers.com</option> <option>dopey@woodworkers.com</option> <option>doc@woodworkers.com</option> </select> </p> <p> <input type="submit" value="Submit"> </p> </form> Note the difference in appearance between the two form controls. /* uncomment this CSS to make the multiple the same height as the single */ /* select[multiple] { height: 1.5em; vertical-align: top; } select[multiple]:focus, select[multiple]:active { height: auto; } */ There are a few ways to select multiple options in a <select> element with a multiple attribute. Depending on the operating system, mouse users can hold the Ctrl, Command, or Shift keys and then click multipl...
HTML attribute: pattern - HTML: Hypertext Markup Language
e we have 3 sections for a north American phone number with an implicit label encompassing all three components of the phone number, expecting 3-digits, 3-digits and 4-digits respectively, as defined by the pattern attribute set on each. If the values are too long or too short, or contain characters that aren't digits, the patternMismatch will be true. When true, the element matches the :invalid CSS pseudo-classes. input:invalid { border: red solid 3px; } Had we used minlength and maxlength attributes instead, we may have seen validityState.tooLong or validityState.tooShort being true. Specifying a pattern You can use the pattern attribute to specify a regular expression that the inputted value must match in order to be considered valid (see Validating against a regular expression f...
HTML attribute: size - HTML: Hypertext Markup Language
Web › HTML › Attributes › size
The size attribute defines the width of the <input> and the height of the <select> element. For the input, if the type attribute is text or password then it's the number of characters. This must be an integer value 0 or higher. If no size is specified, or an invalid value is specified, the input has no size declared, and the form control will be the default width based on the user agent. If CSS targets the element with properties impacting the width, CSS takes precedence. The size attribute has no impact on constraint validation. Examples By adding size on some input types, the width of the input can be controlled. Adding size on a select changes the height, definining how many options are visible in the closed state. <label for="fruit">Enter a fruit</label> <input type="text" size=...
Block-level elements - HTML: Hypertext Markup Language
them as a stack of boxes. A block-level element always starts on a new line and takes up the full width available (stretches out to the left and right as far as it can). The following example demonstrates the block-level element's influence: Block-level elements HTML <p>This paragraph is a block-level element; its background has been colored to display the paragraph's parent element.</p> CSS p { background-color: #8ABB55; } Usage Block-level elements may appear only within a <body> element. Block-level vs. inline There are a couple of key differences between block-level elements and inline elements: Content model Generally, block-level elements may contain inline elements and (sometimes) other block-level elements. Inherent in this structural distinction is the idea th...
<h1>–<h6>: The HTML Section Heading elements - HTML: Hypertext Markup Language
roles tab, presentation or none DOM interface HTMLHeadingElement Attributes These elements only include the global attributes. The align attribute is obsolete; don't use it. Usage notes Heading information may be used by user agents, for example, to construct a table of contents for a document automatically. Avoid using heading tags to resize text. Instead, use the CSS font-size property. Headings use size to indicate their relative importance, but CSS is preferred for general-purpose resizing. Avoid skipping heading levels: always start from <h1>, next use <h2> and so on. You should only use one <h1> per page. Using more than one will not result in an error, but using only one is seen as a best practice. It makes logical sense -- <h1> is the most important h...
<acronym> - HTML: Hypertext Markup Language
Web › HTML › Element › acronym
hor, 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, Chrome, 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. It is therefore recommended that web authors either explicitly style this element, or accept some cross-browser variation. Specifications Specification Status Comment HTML 4.01 SpecificationThe definition of '<acronym>' in that specification. Recommendation Browser compatibility The compatibility table in this page is generat...
<area> - HTML: Hypertext Markup Language
Web › HTML › Element › area
lues depend upon the value specified for the shape attribute. rect or rectangle: the value is two x,y pairs: left, top, right, bottom. circle: the value is x,y,r where x,y is a pair specifying the center of the circle and r is a value for the radius. poly or polygon: the value is a set of x,y pairs for each point in the polygon: x1,y1,x2,y2,x3,y3, and so on. The values are numbers of CSS pixels. download This attribute, if present, indicates that the author intends the hyperlink to be used for downloading a resource. See <a> for a full description of the download attribute. href The hyperlink target for the area. Its value is a valid URL. This attribute may be omitted; if so, the <area> element does not represent a hyperlink. hreflang Indicates the language of the linked re...
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
Web › HTML › Element › audio
streams from JavaScript code rather than streaming pre-existing audio files. <audio> elements can't have subtitles or captions associated with them in the same way that <video> elements can. See WebVTT and Audio by Ian Devlin for some useful information and workarounds. A good general source of information on using HTML <audio> is the Video and audio content beginner's tutorial. Styling with 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...
<bdi>: The Bidirectional Isolate element - HTML: Hypertext Markup Language
Web › HTML › Element › bdi
x this problem by wrapping EMBEDDED-TEXT in a <span> with the dir attribute set to the known directionality. But if you don't know the directionality - for example, because EMBEDDED-TEXT is being read from a database or entered by the user - you should use <bdi> to prevent the directionality of EMBEDDED-TEXT from affecting its surroundings. Though the same visual effect can be achieved using the CSS rule unicode-bidi: isolate on a <span> or another text-formatting element, HTML authors should not use this approach because it is not semantic and browsers are allowed to ignore CSS styling. Embedding the characters in <span dir="auto"> has the same effect as using <bdi>, but its semantics are less clear. Content categories Flow content, phrasing content, palpable content. ...
<blink>: The Blinking Text element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › blink
The HTML Blink Element (<blink>) is a non-standard element which causes the enclosed text to flash slowly. Do not use this element as it is obsolete and is bad design practice. Blinking text is frowned upon by several accessibility standards and the CSS specification allows browsers to ignore the <blink> element. DOM interface This element is unsupported and thus implements the HTMLUnknownElement interface. Example <blink>Why would somebody use this?</blink> Result (toned down!) Specification This element is non-standard and not part of any specification. If you don't believe us, see for yourself in the HTML spec. CSS polyfill If you really do need a polyfill, then you can use the following CSS polyfill. Works in IE10+. blink { -webkit-animation: 2s linear infinite...
<blockquote>: The Block Quotation element - HTML: Hypertext Markup Language
es Any DOM interface HTMLQuoteElement Attributes This element's attributes include the global attributes. cite 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. Usage notes To change the indentation applied to the quoted text, use the CSS margin-left and/or margin-right properties, or the margin shorthand property. To include shorter quotes inline rather than in a separate block, use the <q> (Quotation) element. Example This example demonstrates the use of the <blockquote> element to quote a passage from RFC 1149, A Standard for the Transmission of IP Datagrams on Avian Carriers. <blockquote cite="https://tools.ietf.org/html/r...
<caption>: The Table Caption element - HTML: Hypertext Markup Language
Web › HTML › Element › caption
o 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> <caption>Example C...
<cite>: The Citation element - HTML: Hypertext Markup Language
Web › HTML › Element › cite
hor. 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 HTML5The definition of '<cite>' in that specification. Recommendation ...
<code>: The Inline Code element - HTML: Hypertext Markup Language
Web › HTML › Element › code
t includes <code>: <p>The function <code>selectAll()</code> highlights all the text in the input field so the user can, for example, copy or delete the text.</p> The output generated by this HTML looks like this: Notes To represent multiple lines of code, wrap the <code> element within a <pre> element. The <code> element by itself only represents a single phrase of code or line of code. A CSS rule can be defined for the code selector to override the browser's default font face. Preferences set by the user might take precedence over the specified CSS. Specifications Specification Status Comment HTML Living StandardThe definition of '<code>' in that specification. Living Standard HTML5The definition of '<code>' in that specification. Reco...
<content>: The Shadow DOM Content Placeholder element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › content
ent content. Permitted content Flow content. Tag omission None, both the starting and ending tag are mandatory. Permitted parent elements Any element that accepts flow content. DOM interface HTMLContentElement Attributes This element includes the global attributes. select A comma-separated list of selectors. These have the same syntax as CSS selectors. They select the content to insert in place of the <content> element. Example Here is a simple example of using the <content> element. It is an HTML file with everything needed in it. Note: For this code to work, the browser you display it in must support Web Components. See Enabling Web Components in Firefox. <html> <head></head> <body> <!-- The original content accessed b...
<del>: The Deleted Text element - HTML: Hypertext Markup Language
Web › HTML › Element › del
s both date and time is covered in Local date and time strings. Examples <p><del>This text has been deleted</del>, here is the rest of the paragraph.</p> <del><p>This paragraph has been deleted.</p></del> Result Accessibility concerns The presence of the del 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. del::before, del::after { clip-path: inset(100%); clip: rect(1px, 1px, 1px, 1px); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; } del::before { content: " [deletion start] "; } del::after { content: " [deletion end] "; } Some people who use screen readers deliberatel...
<dialog>: The Dialog element - HTML: Hypertext Markup Language
Web › HTML › Element › dialog
Indicates that the dialog is active 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 click...
<dir>: The Directory element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › dir
nterface. 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%. ...
<embed>: The Embed External Content element - HTML: Hypertext Markup Language
Web › HTML › Element › embed
t not have an end tag. Permitted parents Any element that accepts embedded content. Implicit ARIA role No corresponding role Permitted ARIA roles application, document, img, none, presentation DOM interface HTMLEmbedElement Attributes This element's attributes include the global attributes. height The displayed height of the resource, in CSS pixels. This must be an absolute value; percentages are not allowed. src The URL of the resource being embedded. type The MIME type to use to select the plug-in to instantiate. width The displayed width of the resource, in CSS pixels. This must be an absolute value; percentages are not allowed. Usage notes You can use the object-position property to adjust the positioning of the embedded...
<fieldset>: The Field Set element - HTML: Hypertext Markup Language
Web › HTML › Element › fieldset
ch controls grayed out. Note that form elements inside the <legend> element won't be disabled. form This attribute takes the value of the id attribute of a <form> element you want 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 elemen...
<font> - HTML: Hypertext Markup Language
Web › HTML › Element › font
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 specified in the hexadecimal #RRGGBB format. face This attribute contains a comma-separated list...
<form> - HTML: Hypertext Markup Language
Web › HTML › Element › form
The HTML <form> 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 Implic...
<hr>: The Thematic Break (Horizontal Rule) element - HTML: Hypertext Markup Language
Web › HTML › Element › hr
mples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Historically, this has been presented as a horizontal rule or line. While it may still be displayed as a horizontal rule in visual browsers, this element is now defined in semantic terms, rather than presentational terms, so if you wish to draw a horizontal line, you should do so using appropriate CSS. Content categories Flow content. Permitted content None, it is an empty element. Tag omission It must have start tag, but must not have an end tag. Permitted parents Any element that accepts flow content. Implicit ARIA role separator Permitted ARIA roles presentation or none DOM interface HTMLHRElement At...
<i>: The Idiomatic Text element - HTML: Hypertext Markup Language
Web › HTML › Element › i
l element 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. ...
<input type="button"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › button
Note: Firefox will, unlike other browsers, by default, persist the dynamic disabled state of a <button> across page loads. Use the autocomplete attribute to control this feature. Validation Buttons don't participate in constraint validation; they have no real value to be constrained. Examples The below example shows a very simple drawing app created using a <canvas> element and some simple CSS and JavaScript (we'll hide the CSS for brevity). The top two controls allow you to choose the color and size of the drawing pen. The button, when clicked, invokes a function that clears the canvas. <div class="toolbar"> <input type="color" aria-label="select pen color"> <input type="range" min="2" max="50" value="30" aria-label="select pen size"><span class="output">30</span> <input type="...
<input type="file"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › file
owsers, and in fact is defined in the spec. Examples In this example, we'll present a slightly more advanced file chooser that takes advantage of the file information available in the HTMLInputElement.files property, as well as showing off a few clever tricks. Note: You can see the complete source code for this example on GitHub -- file-example.html (see it live also). We won't explain the CSS; the JavaScript is the main focus. First of all, let's look at the HTML: <form method="post" enctype="multipart/form-data"> <div> <label for="image_uploads">Choose images to upload (PNG, JPG)</label> <input type="file" id="image_uploads" name="image_uploads" accept=".jpg, .jpeg, .png" multiple> </div> <div class="preview"> <p>No files currently selected for upload</p> </div...
<input type="hidden"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › hidden
lent blog post"> </div> <div> <label for="content">Post content:</label> <textarea id="content" name="content" cols="60" rows="5"> This is the content of my excellent blog post. ...
<input type="radio"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › radio
l> <input type="radio" id="contactChoice3" name="contact" value="mail"> <label for="contactChoice3">Mail</label> </div> <div> <button type="submit">Submit</button> </div> </fieldset> </form> There's not much new to note here except for the addition of <fieldset> and <legend> elements, which help to group the functionality nicely and in a semantic way. ...
<input type="search"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › search
tly to your server. If your server-side code fails to validate the data it receives, disaster could strike when improperly-formatted data (or data which is too large, is of the wrong type, and so forth) is entered into your database. A note on styling There are useful pseudo-classes available for styling valid/invalid form elements: :valid and :invalid. In this section, we'll use the following CSS, which will place a check (tick) next to inputs containing valid values, and a cross next to inputs containing invalid values. input:invalid ~ span:after { content: '?'; padding-left: 5px; position: absolute; } input:valid ~ span:after { content: '?'; padding-left: 5px; position: absolute; } The technique also requires a <span> element to be placed after the form elemen...
<input type="text"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › text
lidate the data it receives, disaster could strike when improperly-formatted data (or data which is too large, is of the wrong type, and so forth) is entered into your database. A note on styling There are useful pseudo-classes available for styling form elements to help the user see when their values are valid or invalid. These are :valid and :invalid. In this section, we'll use the following CSS, which will place a check (tick) mark next to inputs containing valid values, and a cross (X) next to inputs containing invalid values. div { margin-bottom: 10px; position: relative; } input + span { padding-right: 30px; } input:invalid+span:after { position: absolute; content: '?'; padding-left: 5px; } input:valid+span:after { position: absolute; content: '?'; padding-left: 5...
<input type="url"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › url
it a URL. 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 input value is automatically validated to ensure that it's either empty or a properly-formatted URL before the form can be submitted. The :valid and :invalid CSS pseudo-classes are automatically applied as appropriate to visually denote whether the current value of the field is a valid URL or not. On browsers that don't support inputs of type url, a url input falls back to being a standard text input. Value A DOMString representing a URL, or empty Events change and input Supported Common Attributes autocomplete, list,...
<ins> - HTML: Hypertext Markup Language
Web › HTML › Element › ins
see Format of a valid date string. The format of the string if it includes both date and time is covered in Format of a valid local date and time string. Examples <ins>This text has been inserted</ins> Result Accessibility concerns The presence of the <ins> 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. ins::before, ins::after { clip-path: inset(100%); clip: rect(1px, 1px, 1px, 1px); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; } ins::before { content: " [insertion start] "; } ins::after { content: " [insertion end] "; } Some people who use screen readers deliberat...
<li> - HTML: Hypertext Markup Language
Web › HTML › Element › li
enus (<menu>). 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> ...
<listing> - HTML: Hypertext Markup Language
Web › HTML › Element › listing
tent 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 compa...
<menu> - HTML: Hypertext Markup Language
Web › HTML › Element › menu
on. Type 'list' is likely to change to 'toolbar' according to HTML5.1. Examples Context menu HTML <!-- A <div> element with a context menu --> <div contextmenu="popup-menu"> Right-click to see the adjusted context menu </div> <menu type="context" id="popup-menu"> <menuitem>Action</menuitem> <menuitem>Another action</menuitem> <hr/> <menuitem>Separated action</menuitem> </menu> CSS div { width: 300px; height: 80px; background-color: lightgreen; } Result Menu button Menu buttons haven't been implemented in any known browsers yet. The type attribute on the <menu> element is now obsolete. <menuitem> element is obsolete. HTML <!-- A button, which displays a menu when clicked. --> <button type="menu" menu="popup-menu"> Dropdown </button> <menu type="contex...
<menuitem> - HTML: Hypertext Markup Language
Web › HTML › Element › menuitem
t/static/img/favicon144.png"> Commands don't render their contents. </menuitem> <menuitem type="command" label="This command has javascript" onclick="alert('command clicked')"> Commands don't render their contents. </menuitem> <hr> <menuitem type="radio" radiogroup="group1">Radio Button 1</menuitem> <menuitem type="radio" radiogroup="group1">Radio Button 2</menuitem> </menu> CSS content div { width: 300px; height: 80px; background-color: lightgreen; } Result Specifications Specification Status Comment HTML 5.2The definition of '<menuitem>' in that specification. Recommendation Snapshot of the HTML Living Standard, made obsolete. HTML 5.1The definition of '<menuitem>' in that specification. Recommendation Snaps...
theme-color - HTML: Hypertext Markup Language
Web › HTML › Element › meta › name › theme-color
Example <meta name="theme-color" content="#4285f4"> The following image shows the effect that the <meta> element above will have on a document displayed in Chrome running on an Android mobile device. ...
<meta>: The Document-level Metadata element - HTML: Hypertext Markup Language
Web › HTML › Element › meta
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 page should redirect to another - onl...
<multicol>: The HTML Multi-Column Layout element (Obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › multicol
Specifications None. ...
<nav>: The Navigation Section element - HTML: Hypertext Markup Language
Web › HTML › Element › nav
igation and one for intra-page navigation. aria-labelledby can be used in such case to promote accessibility, see example. User agents, such as screen readers targeting disabled users, can use this element to determine whether to omit the initial rendering of navigation-only content. Examples In this example, a <nav> block is used to contain an unordered list (<ul>) of links. With appropriate CSS, this can be presented as a sidebar, navigation bar, or drop-down menu. <nav class="menu"> <ul> <li><a href="#">Home</a></li> <li><a href="#">About</a></li> <li><a href="#">Contact</a></li> </ul> </nav> Specifications Specification Status Comment HTML Living StandardThe definition of '<nav>' in that specification. Living Standard No change sin...
<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> ...
<ol>: The Ordered List element - HTML: Hypertext Markup Language
Web › HTML › Element › ol
ase letters 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: St...
<plaintext>: The Plain Text element (Deprecated) - HTML: Hypertext Markup Language
lements, like <head>), 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. ...
<rp>: The Ruby Fallback Parenthesis element - HTML: Hypertext Markup Language
Web › HTML › Element › rp
cters. The <rp> element is used in the case of lack of <ruby> element support; the <rp> content provides what should be displayed in order to indicate the presence of a ruby annotation, usually parentheses. Examples This example uses ruby annotations to display the Romaji equivalents for each character. <ruby> ? <rp>(</rp><rt>Kan</rt><rp>)</rp> ? <rp>(</rp><rt>ji</rt><rp>)</rp> </ruby> CSS body { font-size: 22px; } The result looks like this in your browser: The HTML above rendered by a browser without ruby support might look like this: ? (Kan) ? (ji) body { font-size: 22px; } See the article about the <ruby> element for further examples. Specifications Specification Status Comment HTML Living StandardThe definition of '<rp>' in th...
<s> - HTML: Hypertext Markup Language
Web › HTML › Element › s
nclusive, 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, 1px, 1px, 1px); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; } s::before { content: " [start of stricken text] "; } s::after { content: " [end of stricken text] "; } Some people who use screen readers del...
<select>: The HTML Select element - HTML: Hypertext Markup Language
Web › HTML › Element › select
ocusing on the <select> element (e.g. using Tab). Holding 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 diffe...
<spacer> - HTML: Hypertext Markup Language
Web › HTML › Element › spacer
spacer> is an obsolete HTML element which allowed insertion of empty spaces on pages. It was devised by Netscape to accomplish the same effect as a single-pixel layout image, which was something web designers used to use to add white spaces to web pages without actually using an image. However, <spacer> no longer supported by any major browser and the same effects can now be achieved using simple CSS. Firefox, which is the descendant of Netscape's browsers, removed support for <spacer> in version 4. Attributes Like all other HTML elements, this element supports the global attributes. type This attribute determines type of spacer. Possible values are horizontal, vertical and block. size This attribute can be used for defining size of spacer in pixels when type is horizontal or vertic...
<span> - HTML: Hypertext Markup Language
Web › HTML › Element › span
ole No corresponding role Permitted ARIA roles Any DOM interface HTMLSpanElement (before HTML5, the interface was HTMLElement) Attributes This element only includes the global attributes. Example Example 1 HTML <p><span>Some text</span></p> Result Example 2 HTML <li><span> <a href="portfolio.html" target="_blank">See my portfolio</a> </span></li> CSS li span { background: gold; } Result Specifications Specification Status Comment HTML Living StandardThe definition of '<span>' in that specification. Living Standard HTML5The definition of '<span>' in that specification. Recommendation The DOM interface is now HTMLSpanElement. HTML 4.01 SpecificationThe definition of '<span>' i...
<sub>: The Subscript element - HTML: Hypertext Markup Language
Web › HTML › Element › sub
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 example. Marking up the subscript in mathematical variable numbers (although you may also consider using a M...
<summary>: The Disclosure Summary element - HTML: Hypertext Markup Language
Web › HTML › Element › summary
: $75.30</li> <li>Due date: 5/6/19</li> </ol> </details> Summaries as headings You can use heading elements in <summary>, like this: <details open> <summary><h4>Overview</h4></summary> <ol> <li>Cash on hand: $500.00</li> <li>Current invoice: $75.30</li> <li>Due date: 5/6/19</li> </ol> </details> This currently has some spacing issues that could be addressed using CSS. Warning: Because the <summary> element has a default role of button (which strips all roles from child elements), this example will not work for users of assistive technologies such as screen readers. The <h4> will have its role removed and thus will not be treated as a heading for these users. HTML in summaries This example adds some semantics to the <summary> element to indicate the label...
<sup>: The Superscript element - HTML: Hypertext Markup Language
Web › HTML › Element › sup
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 considering the use of MathML for these, especially in more complex cases. See Exponents under Example...
<xmp> - HTML: Hypertext Markup Language
Web › HTML › Element › xmp
s been 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
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. ...
contenteditable - HTML: Hypertext Markup Language
</label>, its value is treated as an empty string. If this attribute is missing or its value is invalid, its value is inherited from its parent element: so the element is editable if its parent is editable. Note that although its allowed values include true and false, this attribute is an enumerated one and not a Boolean one. You can set the color used to draw the text insertion caret with the CSS caret-color property. Specifications Specification Status Comment HTML Living StandardThe definition of 'contenteditable' in that specification. Living Standard No change from latest snapshot, HTML 5.2 HTML 5.2The definition of 'contenteditable' in that specification. Recommendation Snapshot of HTML Living Standard, no change from HTML 5.1 ...
id - 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. ...
lang - HTML: Hypertext Markup Language
erica. "International Spanish" would just be es. The script subtag precedes the region subtag if both are present -- ru-Cyrl-BY is Russian, written in the Cyrillic alphabet, as spoken in Belarus. To find the correct subtag codes for a language, try the Language Subtag Lookup. Even if the lang attribute is set, it may not be taken into account, as the xml:lang attribute has priority. For the CSS pseudo-class :lang, two invalid language names are different if their names are different. So while :lang(es) matches both lang="es-ES" and lang="es-419", :lang(xyzzy) would not match lang="xyzzy-Zorp!". Specifications Specification Status Comment HTML Living StandardThe definition of 'lang' in that specification. Living Standard No change from latest snapshot,...
part - HTML: Hypertext Markup Language
See our Shadow part example for a usage example. ...
Link types - HTML: Hypertext Markup Language
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 Indicates that the hyperlink refers to a document describing a tag that applies to this document. Note: This link type should n...
Quirks Mode and Standards Mode - HTML: Hypertext Markup Language
sed by the layout engines in web browsers: quirks mode, almost standards mode, and full standards mode. In quirks mode, layout emulates nonstandard behavior in Navigator 4 and Internet Explorer 5. This is essential in order to support websites that were built before the widespread adoption of web standards. In full standards mode, the behavior is (hopefully) the behavior described by the HTML and CSS specifications. In almost standards mode, there are only a very small number of quirks implemented. How do browsers determine which mode to use? For HTML documents, browsers use a DOCTYPE in the beginning of the document to decide whether to handle it in quirks mode or standards mode. To ensure that your page uses full standards mode, make sure that your page has a DOCTYPE like in this example:...
Using the application cache - HTML: Hypertext Markup Language
d. 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 a ca...
Common MIME types - HTTP
terleave video/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) ...
Cross-Origin Resource Sharing (CORS) - HTTP
Web › HTTP › CORS
response headers. Another article for server developers discussing cross-origin sharing from a server perspective (with PHP code snippets) is supplementary reading. What requests use CORS? This cross-origin sharing standard can enable cross-site HTTP requests for: Invocations of the XMLHttpRequest or Fetch APIs, as discussed above. Web Fonts (for cross-domain font usage in @font-face within CSS), so that servers can deploy TrueType fonts that can only be cross-site loaded and used by web sites that are permitted to do so. WebGL textures. Images/video frames drawn to a canvas using drawImage(). CSS Shapes from images. This article is a general discussion of Cross-Origin Resource Sharing and includes a discussion of the necessary HTTP headers. Functional overview The Cross-Origin R...
Content negotiation - HTTP
ues are: Value Meaning Device-Memory Indicates the approximate amount of device RAM. This value is an approximation given by rounding to the nearest power of 2 and dividing that number by 1024. For example, 512 megabytes will be reported as 0.5. DPR Indicates the client's device pixel ratio. Viewport-Width Indicates the layout viewport width in CSS pixels. Width Indicates the resource width in physical pixels (in other words the intrinsic size of an image). The Accept-Charset header The Accept-Charset header indicates to the server what kinds of character encodings are understood by the user-agent. Traditionally, it was set to a different value for each locale for the browser, like ISO-8859-1,utf-8;q=0.7,*;q=0.7 for a We...
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: <MIM...
Cache-Control - HTTP
lowing response header: Good: Cache-Control: no-store Bad: Cache-Control: private,no-cache,no-store,max-age=0,must-revalidate,pre-check=0,post-check=0 Caching static assets For the files in the application that will not change, you can usually add aggressive caching by sending the response header below. This includes static files that are served by the application such as images, CSS files and JavaScript files, for example. In addition, see also the Expires header. Cache-Control: public, max-age=604800, immutable Requiring revalidation Specifying no-cache or max-age=0 indicates that clients can cache a resource and must revalidate each time before using it. This means HTTP request occurs each time, but it can skip downloading HTTP body if the content is valid. Cache-Cont...
DPR - HTTP
Web › HTTP › Headers › DPR
Header type Request header Forbidden header name ? Note: Client Hints are accessible only on secure origins (via TLS). Server has to opt in to receive DPR header from the client by sending Accept-CH and Accept-CH-Lifetime response headers. ...
Firefox user agent string reference - HTTP
ox runs on a tablet device, there is a Tablet; token in the platform part of the UA string instead. For example: Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0 Mozilla/5.0 (Android 4.4; Tablet; rv:41.0) Gecko/41.0 Firefox/41.0 The version numbers are not relevant. Avoid inferring materials based on these. The preferred way to target content to a device form factor is to use CSS Media Queries. However, if you use UA sniffing to target content to a device form factor, please look for Mobi (to include Opera Mobile, which uses "Mobi") for the phone form factor and do not assume any correlation between "Android" and the device form factor. This way, your code will work if/when Firefox ships on other phone/tablet operating systems or Android is used for laptops. Also, please ...
X-Content-Type-Options - HTTP
" and "style". However, it also enables Cross-Origin Read Blocking (CORB) protection for HTML, TXT, JSON and XML files (excluding SVG image/svg+xml). ...
X-DNS-Prefetch-Control - HTTP
This prefetching is performed in the background, so that the DNS is likely to have been resolved by the time the referenced items are needed. This reduces latency when the user clicks a link. ...
Link prefetching FAQ - HTTP
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 probably help content providers avoid the problem of sta...
An overview of HTTP - HTTP
Web › HTTP › Overview
The browser is always the entity initiating the request. It is never the server (though some mechanisms have been added over the years to simulate server-initiated messages). To present a Web page, the browser sends an original request to fetch the HTML document that represents the page. It then parses this file, making additional requests corresponding to execution scripts, layout information (CSS) to display, and sub-resources contained within the page (usually images and videos). The Web browser then mixes these resources to present to the user a complete document, the Web page. Scripts executed by the browser can fetch more resources in later phases and the browser updates the Web page accordingly. A Web page is a hypertext document. This means some parts of displayed text are links wh...
HTTP
Web › HTTP
Cross-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 applicatio...
Grammar and types - JavaScript
R TOO function f() { const g = 5; var g; //statements } However, the properties of objects assigned to constants are not protected, so the following statement is executed without problems. const MY_OBJECT = {'key': 'value'}; MY_OBJECT.key = 'otherValue'; Also, the contents of an array are not protected, so the following statement is executed without problems. const MY_ARRAY = ['HTML','CSS']; MY_ARRAY.push('JAVASCRIPT'); console.log(MY_ARRAY); //logs ['HTML','CSS','JAVASCRIPT']; Data structures and types Data types The latest ECMAScript standard defines eight data types: Seven data types that are primitives: Boolean. true and false. null. A special keyword denoting a null value. (Because JavaScript is case-sensitive, null is not the same as Null, NULL, or any other ...
Math - JavaScript
rns the tangent of x. Math.tanh(x) Returns the hyperbolic tangent of x. Math.trunc(x) Returns the integer portion of x, removing any fractional digits. Examples Converting between degrees and radians The trigonometric functions sin(), cos(), tan(), asin(), acos(), atan(), and atan2() expect (and return) angles in radians. ...
String.prototype.big() - JavaScript
Syntax str.big() Return value A string containing a <big> HTML element. Description The big() method embeds a string in a <big> tag: "<big>str</big>". ...
String.prototype.fontsize() - JavaScript
Syntax str.fontsize(size) Parameters size An integer between 1 and 7, a string representing a signed integer between 1 and 7. Return value A string containing a <font> HTML element. ...
JavaScript
nd the complete course is available for a small one-time payment. TogetherJS Collaboration made easy. By adding TogetherJS to your site, your users can help each other out on a website in real-time! Stack Overflow Stack Overflow questions tagged with "JavaScript". JavaScript versions and release notes Browse JavaScript's feature history and implementation status. JSFiddle Edit JavaScript, CSS, HTML and get live results. Use external resources and collaborate with your team online. Plunker Plunker is an online community for creating, collaborating on and sharing your web development ideas. Edit your JavaScript, CSS, HTML files and get live results and file structure. JSBin JS Bin is an open-source collaborative web development debugging tool. Codepen Codepen is another coll...
display - Web app manifests
The display member is a string that determines the developers' preferred display mode for the website. The display mode changes how much of browser UI is shown to the user and can range from browser (when the full browser window is shown) to fullscreen (when the app is full-screened). Note: If the display member is not specified, it defaults to browser. Note: You can selectively apply CSS to your app based on the display mode, using the display-mode media feature. This can be used to provide a consistent user experience between launching a site from an URL and launching it from a desktop icon. Values The possible values are: Display Mode Description Fallback Display Mode fullscreen All of the available display area is used and no user agent chrom...
<mmultiscripts> - MathML
sage. 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 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 CSS length. This property is deprecated and will be removed in the future. Examples Using <mprescripts/> Sample rendering: Rendering in your browser: X d c b a <math> <mmultiscripts> <...
<mover> - MathML
Web › MathML › Element › mover
the following syntax: <mover> base overscript </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...
<munder> - MathML
Web › MathML › Element › munder
following syntax: <munder> base underscript </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 accen...
<munderover> - MathML
rscript is a limit over the base expression. 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. 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"> <mund...
MathML
irefox OS webapp, Firefox add-on, using in a Web Page, JS program etc) LaTeXML - Convert LaTeX documents into HTML+MathML Web pages Web Equation - Turn handwritten equations into MathML or LaTeX MathJax - Cross-browser JavaScript display engine for mathematics. To force MathJax to use native MathML, try this Mozilla add-on, this Safari extension or this GreaseMonkey script. Related topics CSS HTML SVG ...
Handling media support issues in web content - Web media technologies
quality. ...
Understanding latency - Web Performance
ay on a network or Internet connection. Low latency implies that there are no or almost no delays. High latency implies that there are many delays. One of the main aims of improving performance is to reduce latency. The latency associated with a single asset, especially a basic HTML page, may seem trivial. But websites generally involve multiple requests: the HTML includes requests for multiple CSS, scripts, and media files. The greater the number and size of these requests, the greater the impact of high latency on user experience. On a connection with low latency, requested resources will appear almost immediately. On a connection with high latency, there will be a discernible delay between the time that a request is sent, and the resources are returned. We can determine the amount of la...
Making PWAs work offline with Service workers - Progressive web apps (PWAs)
r, 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. ...
Responsive Navigation Patterns - Progressive web apps (PWAs)
to start. The following present several ways to handle navigation on large and small screens. Top and left navigation menus are common on larger screens, but are often not the optimal way to present information on small screens because of the reduced screen real estate. Therefore, it is necessary to consider the presentation of content and ease of navigation for all screen sizes. Note: HTML/CSS for the corresponding patterns will be available soon. Pattern 1: Top toggle menu In this pattern, as the screen width is reduced, the top navigation items rearrange until there is not enough space. At that point, some items move from the top navigation to a drop-down menu. In the smallest screen, all navigation items live in a toggle menu, and the user has to tap to expand the toggle menu. ...
Web technology reference
lements that are delineated by tags, 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 ...
SVG Styling Attributes - SVG: Scalable Vector Graphics
Web › SVG › Attribute › Styling
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. Value: Any valid ID string; Animatable: Yes style It specifies style information for its element. ...
attributeName - SVG: Scalable Vector Graphics
The attributeName attribute indicates the name of the CSS property or attribute of the target element that is going to be changed during an animation. Four elements are using this attribute: <animate>, <animateColor>, <animateTransform>, and <set> html, body, svg { height: 100%; } <svg viewBox="0 0 250 250" xmlns="http://www.w3.org/2000/svg"> <rect x="50" y="50" width="100" height="100"> <animate attributeType="XML" attributeName="y" from="0" to="50" dur="5s" repeatCount="indefinite"/> </rect> </svg> Usage notes Value <name> Default value None Animatable No <name> This value indicates the name of the CSS property or attribute of the target element to be animated. Specifications Specification Status C...
begin - SVG: Scalable Vector Graphics
Web › SVG › Attribute › begin
="0 0 120 120" xmlns="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" id="myLoop" begin="0s;myLoop.end" dur="4s" repeatCount="3" /> <set attributeType="CSS" attributeName="fill" to="green" begin="myLoop.begin" /> <set attributeType="CSS" attributeName="fill" to="gold" begin="myLoop.repeat(1)" /> <set attributeType="CSS" attributeName="fill" to="red" begin="myLoop.repeat(2)" /> </rect> <!-- grid --> <text x="10" y="20" text-anchor="middle">0s</text> <line x1="10" y1="25" x2="10...
cap-height - SVG: Scalable Vector Graphics
The cap-height attribute defines the height of uppercase glyphs of the font within the font coordinate system. Note: It was specified to share the syntax and semantics of the obsolete cap-height descriptor of the @font-face at-rule defined in an early version of CSS 2. Only one element is using this attribute: <font-face> Usage notes Value <number> Default value None Animatable No Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'cap-height' in that specification. Recommendation Initial definition ...
clip-rule - SVG: Scalable Vector Graphics
ment 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...
clipPathUnits - SVG: Scalable Vector Graphics
coordinates inside the <clipPath> element are relative to the bounding box of the element the clipping path is applied to. It means that the origin of the coordinate system is the top left corner of the object bounding box and the width and height of the object bounding box are considered to have a length of 1 unit value. Specifications Specification Status Comment CSS Masking Module Level 1The definition of 'clipPathUnits' in that specification. Candidate Recommendation Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'clipPathUnits' in that specification. Recommendation Initial definition ...
color-interpolation-filters - SVG: Scalable Vector Graphics
value of linearRGB, whereas color-interpolation has an initial value of sRGB. Thus, in the default case, filter effects operations occur in the linearRGB color space, whereas all other color interpolations occur by default in the sRGB color space. It has no affect on filter functions, which operate in the sRGB color space. Note: As a presentation attribute, color-interpolation can be used as a CSS property. As a presentation attribute, it can be applied to any element but it only has an effect on the following eighteen elements: <feSpotLight>, <feBlend>, <feColorMatrix>, <feComponentTransfer>, <feComposite>, <feConvolveMatrix>, <feDiffuseLighting>, <feDisplacementMap>, <feDropShadow>, <feFlood>, <feGaussianBlur>, <feImage>, <feMerge>, <feMorphology>, <feOffset>, <feSpecularLighting>, <feT...
color-interpolation - SVG: Scalable Vector Graphics
ed xlink:href attribute to reference another gradient, the gradient uses the property's value from the gradient element which is directly referenced by the fill or stroke property. When animating colors, color interpolation is performed according to the value of the color-interpolation property on the element being animated. Note: As a presentation attribute, color-interpolation can be used as a CSS property. As a presentation attribute, it can be applied to any element but it only has an effect on the following 29 elements: <a>, <animate>, <animateColor>, <circle>, <clipPath>, <defs>, <ellipse>, <foreignObject>, <g>, <glyph>, <image>, <line>, <linearGradient>, <marker>, <mask>, <missing-glyph>, <path>, <pattern>, <polygon>, <polyline>, <radialGradient>, <rect>, <svg>, <switch>, <symbol>, <...
color-profile - SVG: Scalable Vector Graphics
As a presentation attribute, it can be applied to any element but it only has an effect on the following element: <image> Usage notes Value auto | sRGB | <name> | <iri> Default value auto Animatable Yes auto All colors are presumed to be defined in the sRGB color space unless a more precise embedded profile is specified within content data. ...
color-rendering - SVG: Scalable Vector Graphics
ample, assume color-rendering: optimizeSpeed and color-interpolation-filters: linearRGB. In this case, the SVG user agent should perform color operations in a way that optimizes performance, which might mean sacrificing the color interpolation precision as specified by through the linearRGB value for color-interpolation-filters. Note: As a presentation attribute, color-rendering can be used as a CSS property. As a presentation attribute, it can be applied to any element but it only has an effect on the following 29 elements: <a>, <animate>, <animateColor>, <circle>, <clipPath>, <defs>, <ellipse>, <foreignObject>, <g>, <glyph>, <image>, <line>, <linearGradient>, <marker>, <mask>, <missing-glyph>, <path>, <pattern>, <polygon>, <polyline>, <radialGradient>, <rect>, <svg>, <switch>, <symbol>, <...
contentStyleType - SVG: Scalable Vector Graphics
iven 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. 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 th...
cx - SVG: Scalable Vector Graphics
Web › SVG › Attribute › cx
cx="150" cy="50" rx="45" ry="25" /> <rect x="205" y="5" width="90" height="90" fill="url(#myGradient)" /> </svg> circle For <circle>, cx defines the x-axis coordinate of the center of the shape. Value <length-percentage> Default value 0 Animatable Yes Note: Starting with SVG2 cx, is a Geometry Property, meaning this attribute can also be used as CSS property for circles. ellipse For <ellipse>, cx defines the x-axis coordinate of the center of the shape. Value <length-percentage> Default value 0 Animatable Yes Note: Starting with SVG2 cx, is a Geometry Property, meaning this attribute can also be used as CSS property for ellipses. radialGradient For <radialGradient>, cx defines the x-axis coordi...
cy - SVG: Scalable Vector Graphics
Web › SVG › Attribute › cy
150" cx="50" rx="45" ry="25" /> <rect x="5" y="205" width="90" height="90" fill="url(#myGradient)" /> </svg> circle For <circle>, cy defines the y-axis coordinate of the center of the shape. Value <length> | <percentage> Default value 0 Animatable Yes Note: Starting with SVG2, cy is a Geometry Property meaning this attribute can also be used as a CSS property for circles. ellipse For <ellipse>, cy defines the y-axis coordinate of the center of the shape. Value <length> | <percentage> Default value 0 Animatable Yes Note: Starting with SVG2, cy is a Geometry Property meaning this attribute can also be used as a CSS property for ellipses. radialGradient For <radialGradient>, cy defines the y-axis c...
descent - SVG: Scalable Vector Graphics
Web › SVG › Attribute › descent
The descent attribute defines the maximum unaccented depth of the font. Note: It was specified to share the syntax and semantics of the obsolete descent descriptor of the @font-face at-rule defined in an early version of CSS 2. Only one element is using this attribute: <font-face> Usage notes Value <number> Default value Value of vert-origin-y Animatable No Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'descent' in that specification. Recommendation Initial definition ...
enable-background - SVG: Scalable Vector Graphics
The enable-background attribute specifies how the accumulation of the background image is managed. Note: As a presentation attribute, enable-background can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following eleven elements: <a>, <defs>, <glyph>, <g>, <marker>, <mask>, <missing-glyph>, <pattern>, <svg>, <switch>, and <symbol> Context notes Value accumulate | new [ <x> <y> <width> <height> ]? Default value accumulate Animatable No accumulate If an ancestor container element has a property value of enable-background: new, then all graphics elements within the current container element are rendered both onto the parent container element's background image canvas and...
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 externalReso...
fill-rule - SVG: Scalable Vector Graphics
The fill-rule attribute is a presentation attribute defining the algorithm to use to determine the inside part of a shape. Note: As a presentation attribute, fill-rule can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <altGlyph>, <path>, <polygon>, <polyline>, <text>, <textPath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewBox="-10 -10 220 120" xmlns="http://www.w3.org/2000/svg"> <!-- Default value for fill-rule --> <polygon fill-rule="nonzero" stroke="red" points="50,0 21,90 98,35 2,35 79,90"/> <!-- The center of the shape has two path segments (shown by the red stroke) between it and infinity. It is therefore considered outside the shape, and not filled...
glyph-orientation-horizontal - SVG: Scalable Vector Graphics
tion is incremented according to the horizontal metrics of the glyph. Otherwise, if the value of this attribute is not a multiple of 180 degrees, then the current text position is incremented according to the vertical metrics of the glyph. This attribute is applied only to text written in a horizontal writing-mode. Note: As a presentation attribute, glyph-orientation-horizontal can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following five elements: <altGlyph>, <textPath>, <text>, <tref>, and <tspan> Context notes Value <angle> Default value 0deg Animatable No <angle> The value of the angle is restricted to 0, 90, 180, and 270 degrees. If another angle is specified, ...
glyph-orientation-vertical - SVG: Scalable Vector Graphics
the current text position is incremented according to the vertical metrics of the glyph. Otherwise, if the angle is not a multiple of 180 degrees, then the current text position is incremented according to the horizontal metrics of the glyph. This attribute is applied only to text written in a vertical writing-mode. Note: As a presentation attribute, glyph-orientation-vertical can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following five elements: <altGlyph>, <textPath>, <text>, <tref>, and <tspan> Context notes Value auto | <angle> Default value auto Animatable No auto Fullwidth ideographic and fullwidth Latin text will be set with a glyph orientation of 0 degrees...
gradientTransform - SVG: Scalable Vector Graphics
slateX(220px);" /> </svg> Usage notes Default value Identity transform Value <transform-list> Animatable Yes <transform-list> A list of transformation functions specifying some additional transformation from the gradient coordinate system onto the target coordinate system. Specifications Specification Status Comment CSS Transforms Level 1The definition of 'surfaceScale for <feSpecularLighting>' in that specification. Working Draft Defines the <transformation-list> value. Scalable Vector Graphics (SVG) 2The definition of 'gradientTransformation for <linearGradient>' in that specification. Candidate Recommendation No change Scalable Vector Graphics (SVG) 2The definition of 'gradientTr...
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,1...
kerning - SVG: Scalable Vector Graphics
Web › SVG › Attribute › kerning
The kerning attribute indicates whether the spacing between glyphs should be adjusted based on kerning tables that are included in the relevant font (i.e., enable auto-kerning) or instead disable auto-kerning and set the spacing between them to a specific length (typically, zero). Note: As a presentation attribute kerning can be used as a CSS property. In CSS the property is called font-kerning, though. As a presentation attribute, it can be applied to any element but it has effect only on the following four elements: <altGlyph>, <textPath>, <text>, <tref>, and <tspan> html, body, svg { height: 100%; font: 36px Verdana, Helvetica, Arial, sans-serif; } <svg viewBox="0 0 150 125" xmlns="http://www.w3.org/2000/svg"> <text x="10" y="30" kerning="auto">auto</text> <text x="10" y="...
marker-end - SVG: Scalable Vector Graphics
t vertex is the same as the first vertex. In this case, if the value of marker-start and marker-end are both not none, then two markers will be rendered on that final vertex. For <path> elements, for each closed subpath, the last vertex is the same as the first vertex. marker-end is only rendered on the final vertex of the path data. Note: As a presentation attribute, marker-end can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following seven elements: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, and <rect> html, body, svg { height: 100%; } <svg viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"> <defs> <marker id="triangle" viewBox="0 0 10 10" refX="1" refY="5" m...
marker-mid - SVG: Scalable Vector Graphics
The marker-mid attribute defines the arrowhead or polymarker that will be drawn at all interior vertices of the given shape. The marker is rendered on every vertex other than the first and last vertices of the path data. Note: As a presentation attribute, marker-mid can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following seven elements: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, and <rect> html, body, svg { height: 100%; } <svg viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"> <defs> <marker id="circle" markerWidth="8" markerHeight="8" refX="4" refY="4"> <circle cx="4" cy="4" r="4" stroke="none" fill="#f00"/> </marker> </defs> <polyline fill="none" stroke="bla...
marker-start - SVG: Scalable Vector Graphics
rtex is the same as the first vertex. In this case, if the value of marker-start and marker-end are both not none, then two markers will be rendered on that final vertex. For <path> elements, for each closed subpath, the last vertex is the same as the first vertex. marker-start is only rendered on the first vertex of the path data. Note: As a presentation attribute, marker-start can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following seven elements: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, and <rect> html, body, svg { height: 100%; } <svg viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"> <defs> <marker id="triangle" viewBox="0 0 10 10" refX="1" refY="5" m...
maskContentUnits - SVG: Scalable Vector Graphics
ordinate system as defined when the mask was created. objectBoundingBox This value indicates that all coordinates inside the <mask> element are relative to the bounding box of the element the mask is applied to. A bounding box could be considered the same as if the content of the <mask> were bound to a "0 0 1 1" viewbox. Specifications Specification Status Comment CSS Masking Module Level 1The definition of 'maskContentUnits' in that specification. Candidate Recommendation Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'maskContentUnits' in that specification. Recommendation Initial definition ...
maskUnits - SVG: Scalable Vector Graphics
n the mask was created. objectBoundingBox This value indicates that all coordinates for the geometry attributes represent fractions or percentages of the bounding box of the element to which the mask is applied. A bounding box could be considered the same as if the content of the <mask> were bound to a "0 0 1 1" viewbox. Specifications Specification Status Comment CSS Masking Module Level 1The definition of 'maskUnits' in that specification. Candidate Recommendation Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'maskUnits' in that specification. Recommendation Initial definition ...
media - SVG: Scalable Vector Graphics
Web › SVG › Attribute › media
media query that needs to match in order for the style sheet to be applied. If not specified, the style sheet is applied unconditionally. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'media' in that specification. Candidate Recommendation Changed the value definition from different media types as defined in CSS 2 to <media-query-list>. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'media' in that specification. Recommendation Initial definition ...
operator - SVG: Scalable Vector Graphics
fattens the source graphic defined in the in attribute. Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'operator for <feMorphology>' in that specification. Working Draft No change Filter Effects Module Level 1The definition of 'operator for <feComposite>' in that specification. Working Draft Refers to CSS Compositing and Blending specification for the values and added the lighter value. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'operator for <feMorphology>' in that specification. Recommendation Initial definition for <feMorphology> Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'operator for <feComposite>' in that specificati...
patternTransform - SVG: Scalable Vector Graphics
ewX(30) scale(1 0.5)"> <circle cx="10" cy="10" r="10" /> </pattern> <!-- Apply the transformed pattern tile --> <rect x="10" y="10" width="80" height="80" fill="url(#p1)" /> </svg> pattern For <pattern>, patternTransform defines a list of transform definitions that are applied to a pattern tile. Note: As of SVG2, it is also allowed to use the CSS transform property. However, the current state of implementation isn't very good. For backward compatibility reason, it is highly suggested to keep using the patternTransform attribute. Value <transform-list> Default value Identity transform Animatable Yes Transform functions To know more about the definition of transform functions, see the transform a...
r - SVG: Scalable Vector Graphics
Web › SVG › Attribute › r
ht="60" fill="url(#myGradient100)" /> </svg> circle For <circle>, r defines the radius of the circle and therefor its size. With a value lower or equal to zero the circle won't be drawn at all. Value <length> | <percentage> Default value 0 Animatable Yes Note: Starting with SVG2, r is a Geometry Property meaning this attribute can also be used as a CSS property for circles. radialGradient For <radialGradient>, r defines the radius of the end circle for the radial gradient. The gradient will be drawn such that the 100% gradient stop is mapped to the perimeter of this end circle. A value of lower or equal to zero will cause the area to be painted as a single color using the color and opacity of the last gradient <stop>. Value <len...
requiredFeatures - SVG: Scalable Vector Graphics
Recommendation Initial defi...
shape-rendering - SVG: Scalable Vector Graphics
The shape-rendering attribute provides hints to the renderer about what tradeoffs to make when rendering shapes like paths, circles, or rectangles. Note: As a presentation attribute, shape-rendering can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following seven elements: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, and <rect> html, body, svg { height: 100%; } <svg viewBox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <circle cx="100" cy="100" r="100" shape-rendering="geometricPrecision"/> <circle cx="320" cy="100" r="100" shape-rendering="crispEdges"/> </svg> Usage notes Value auto | optimizeSpeed | crispEdges | geometricPrecision Default value auto ...
stroke-dasharray - SVG: Scalable Vector Graphics
The stroke-dasharray attribute is a presentation attribute defining the pattern of dashes and gaps used to paint the outline of the shape; Note: As a presentation attribute, stroke-dasharray can be used as a CSS property. As a presentation attribute, it can be applied to any element, but it only has effect on the following twelve elements: <altGlyph> <circle> <ellipse> <path> <line> <polygon> <polyline> <rect> <text> <textPath> <tref> <tspan> html,body,svg { height:100% } <svg viewBox="0 0 30 10" xmlns="http://www.w3.org/2000/svg"> <!-- No dashes nor gaps --> <line x1="0" y1="1" x2="30" y2="1" stroke="black" /> <!-- Dashes and gaps of the same size --> <line x1="0" y1="3" x2="30" y2="3" stroke="black" stroke-dasharray="4" /> <!-- Dashes and gap...
stroke-dashoffset - SVG: Scalable Vector Graphics
The stroke-dashoffset attribute is a presentation attribute defining an offset on the rendering of the associated dash array. Note: As a presentation attribute stroke-dashoffset can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following twelve elements: <altGlyph>, <circle>, <ellipse>, <path>, <line>, <polygon>, <polyline>, <rect>, <text>, <textPath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewBox="-3 0 33 10" xmlns="http://www.w3.org/2000/svg"> <!-- No dash array --> <line x1="0" y1="1" x2="30" y2="1" stroke="black" /> <!-- No dash offset --> <line x1="0" y1="3" x2="30" y2="3" stroke="black" stroke-dasharray="3 1" /> <!-- The start of the dash array computation is pulle...
stroke-linecap - SVG: Scalable Vector Graphics
The stroke-linecap attribute is a presentation attribute defining the shape to be used at the end of open subpaths when they are stroked. Note: As a presentation attribute stroke-linecap can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <altGlyph>, <path>, <polyline>, <line>, <text>, <textPath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewBox="0 0 6 6" xmlns="http://www.w3.org/2000/svg"> <!-- Effect of the (default) "butt" value --> <line x1="1" y1="1" x2="5" y2="1" stroke="black" stroke-linecap="butt" /> <!-- Effect of the "round" value --> <line x1="1" y1="3" x2="5" y2="3" stroke="black" stroke-linecap="round" /> <!-- Effect of the "square"...
stroke-linejoin - SVG: Scalable Vector Graphics
The stroke-linejoin attribute is a presentation attribute defining the shape to be used at the corners of paths when they are stroked. Note: As a presentation attribute stroke-linejoin can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following nine elements: <altGlyph>, <path>, <polygon>, <polyline>, <rect>, <text>, <textPath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewBox="0 0 18 12" xmlns="http://www.w3.org/2000/svg"> <!-- Upper left path: Effect of the "miter" value --> <path d="M1,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="miter" /> <!-- Center path: Effect of the "round" value --> <path d="M7,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2...
stroke-miterlimit - SVG: Scalable Vector Graphics
The stroke-miterlimit attribute is a presentation attribute defining a limit on the ratio of the miter length to the stroke-width used to draw a miter join. When the limit is exceeded, the join is converted from a miter to a bevel. Note: As a presentation attribute stroke-miterlimit can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following nine elements: <altGlyph>, <path>, <polygon>, <polyline>, <rect>, <text>, <textPath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewBox="0 0 38 30" xmlns="http://www.w3.org/2000/svg"> <!-- Impact of the default miter limit --> <path stroke="black" fill="none" stroke-linejoin="miter" id="p1" d="M1,9 l7 ,-3 l7 ,3 m2,0 l3.5 ,-3 l3.5 ,3 ...
stroke - SVG: Scalable Vector Graphics
Web › SVG › Attribute › stroke
The stroke attribute is a presentation attribute defining the color (or any SVG paint servers like gradients or patterns) used to paint the outline of the shape; Note: As a presentation attribute stroke can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following twelve elements: <altGlyph>, <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, <rect>, <text>, <textPath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewBox="0 0 20 10" xmlns="http://www.w3.org/2000/svg"> <!-- Simple color stroke --> <circle cx="5" cy="5" r="4" fill="none" stroke="green" /> <!-- Stroke a circle with a gradient --> <defs> <linearGradient id="myGradient"> <stop offset="0%" stop-color="g...
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 y...
text-anchor - SVG: Scalable Vector Graphics
ordinate system resulting from (depending on context) application of the x and y attributes on the <text> element, any x or y attribute values on a <tspan>, <tref> or <altGlyph> element assigned explicitly to the first rendered character in a text chunk, or determination of the initial current text position for a <textPath> element. Note: As a presentation attribute, text-anchor can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following five elements: <altGlyph>, <text>, <textPath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"> <!-- Materialisation of anchors --> <path d="M60,15 L60,110 M30,40 L90,40 M30,75 L90,75 M30,110 L90,110" stroke...
textLength - SVG: Scalable Vector Graphics
None Animatable Yes <length-percentage> This value specifies the width of the space the text will be adjusted to occupy as absolute length or percentage. <number> A numeric value outlines a length referring to the units of the current coordinate system. Example Let's create a simple example that presents text you can resize using an <input> element of type "range". CSS .controls { font: 16px "Open Sans", "Arial", sans-serif; } SVG Let's start with the SVG. It's pretty basic, with a 1000-by-300 pixel space mapped into a 10 centimeter by 3 centimeter box. <svg width="10cm" height="3cm" viewBox="0 0 1000 300" xmlns="http://www.w3.org/2000/svg"> <rect x="1" y="1" width="998" height="298" fill="none" stroke="green" stroke-width="2"/> <text id=...
vector-effect - SVG: Scalable Vector Graphics
The vector-effect property specifies the vector effect to use when drawing an object. Vector effects are applied before any of the other compositing operations, i.e. filters, masks and clips. Note: As a presentation attribute, vector-effect can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following ten elements: <circle>, <ellipse>, <foreignObject>, <image>, <line>, <path>, <polygon>, <polyline>, <rect>, <text>, <textPath> <tspan>, and <use> Usage notes Value none | non-scaling-stroke | non-scaling-size | non-rotation | fixed-position Default value none Animatable Yes none This value specifies that no vector effect shall be applied, i.e. the default rendering behaviour ...
xml:space - SVG: Scalable Vector Graphics
This attribute influences how browsers parse text content and therefore changes the way the DOM is built. Therefore, changing this attribute's value through the DOM API may have no effect. All elements are using this attribute. ...
SVG Attribute reference - SVG: Scalable Vector Graphics
Web › SVG › Attribute
ributes id, lang, tabindex, xml:base, xml:lang, xml:space Style Attributes class, style Conditional Processing Attributes externalResourcesRequired, requiredExtensions, requiredFeatures, systemLanguage. 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-path, clip-rule, color, color-interpolation, color-interpolation-filters, color-profile, color-rendering, cursor, direction, display, dominant-baseline, enable-background, fill, fill-opacity, fill-rule, filter, flood-color, flood-opacity, font-family, font-size, font-size-adjust, font-stretch, font-style, font-variant, font-weight, glyph...
<a> - SVG: Scalable Vector Graphics
Web › SVG › Element › a
ecessary to select only SVG <a> elements, and not also HTML's. 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 { outline: dotted 1px blue; } Since this element shares its tag name with HTML's <a> element, selecting a with CSS or querySelector may apply to the wrong kind of element. Try the @namespace rule to distinguish the two. Attributes download Instructs browsers to download a URL instead of navigating to it, so the user will be prompted to save it as a local file. Value type: <string> ; Default value: none; Animatable: no href The URL or URL fragment the hyperlink points to. Value type: <URL> ; Defaul...
<animate> - SVG: Scalable Vector Graphics
Web › SVG › Element › animate
and migraine and Scotopic sensitivity. Consider providing a mechanism for pausing or disabling animation, as well as using the Reduced Motion Media Query to create a complimentary experience for users who have expressed a preference for no animated experiences. Designing Safer Web Animation For Motion Sensitivity . An A List Apart Article An Introduction to the Reduced Motion Media Query | CSS-Tricks Responsive Design for Motion | WebKit MDN Understanding WCAG, Guideline 2.2 explanations Understanding Success Criterion 2.2.2 | W3C Understanding WCAG 2.0 Specifications Specification Status Comment SVG Animations Level 2The definition of '<animate>' in that specification. Editor's Draft No change Scalable Vector Graphics (SVG) 1.1 (Second...
<circle> - SVG: Scalable Vector Graphics
Web › SVG › Element › circle
The radius of the circle. A value lower or equal to zero disables rendering of the circle. Value type: <length> ; Default value: 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. 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...
<cursor> - SVG: Scalable Vector Graphics
Web › SVG › Element › cursor
The <cursor> SVG element can be used to define a platform-independent custom cursor. A recommended approach for defining a platform-independent custom cursor is to create a PNG image and define a cursor element that references the PNG image and identifies the exact position within the image which is the pointer position (i.e., the hot spot). The PNG format is recommended because it supports the ability to define a transparency mask via an alpha channel. If a different image format is used, this format should support the definition of a transparency mask (two options: provide an explicit alpha channel or use a particular pixel color to indicate transparency). ...
<ellipse> - SVG: Scalable Vector Graphics
Web › SVG › Element › ellipse
table: yes ry The radius of the ellipse on the y axis. Value type: auto|<length>|<percentage> ; Default value: auto; Animatable: 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. 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...
<feComponentTransfer> - SVG: Scalable Vector Graphics
Working Draft Specified that missing transfer function elements are treated like they were specified with their type attributes set to identity. Scalable Vector Graphics (SV...
<filter> - SVG: Scalable Vector Graphics
Web › SVG › Element › filter
The <filter> SVG element defines a custom filter effect by grouping atomic filter primitives. 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"> <...
<font-face-src> - SVG: Scalable Vector Graphics
It serves as container for <font-face-name>, pointing to locally installed copies of this font, and <font-face-uri>, utilizing remotely defined fonts. Usage context CategoriesFont elementPermitted contentOne or more of the following elements, in any order:<font-face-name>, <font-face-uri> Attributes Global attributes Core attributes Specific attributes None DOM Interface This element implements the SVGFontFaceSrcElement interface. ...
<font-face> - SVG: Scalable Vector Graphics
Web › SVG › Element › font-face
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. ...
<foreignObject> - SVG: Scalable Vector Graphics
rcentage> ; Default value: auto; Animatable: yes x The x coordinate of the foreignObject. Value type: <length>|<percentage> ; 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. 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, Document event attributes, Document element event attributes Presentation Attributes Most notably: clip-path, ...
<hatch> - SVG: Scalable Vector Graphics
Web › SVG › Element › hatch
Paths are defined by <hatchpath> elements. ...
<linearGradient> - SVG: Scalable Vector Graphics
The <linearGradient> element lets authors define linear gradients that can be applied to fill or stroke of graphical elements. Don't be confused with CSS linear-gradient() as CSS gradients can only apply to HTML elements where SVG gradient can only apply to SVG elements. html,body,svg { height:100% } <svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <linearGradient id="myGradient" gradientTransform="rotate(90)"> <stop offset="5%" stop-color="gold" /> <stop offset="95%" stop-color="red" /> </linearGradient> </defs> <!-- using my linear gradient --> <circle cx="5" cy="5" r="4" fill="url('#myGradient')" /> </svg> Attributes gradientUnits This attribute defines the coordinate system fo...
<mask> - SVG: Scalable Vector Graphics
Web › SVG › Element › mask
Candidate Recommendation Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of '<mask>' in that specification. Recommendation Initial definition ...
<radialGradient> - SVG: Scalable Vector Graphics
The <radialGradient> element lets authors define radial gradients that can be applied to fill or stroke of graphical elements. Don't be confused with CSS radial-gradient() as CSS gradients can only apply to HTML elements where SVG gradient can only apply to SVG elements. html,body,svg { height:100% } <svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <radialGradient id="myGradient"> <stop offset="10%" stop-color="gold" /> <stop offset="95%" stop-color="red" /> </radialGradient> </defs> <!-- using my linear gradient --> <circle cx="5" cy="5" r="4" fill="url('#myGradient')" /> </svg> Attributes cx This attribute defines the x coordinate of the end circle of the radial gradient. Value ...
<rect> - SVG: Scalable Vector Graphics
Web › SVG › Element › rect
radius of the rect. Defaults to rx if it is specified. Value type: auto|<length>|<percentage> ; Default value: auto; Animatable: 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. 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...
<stop> - SVG: Scalable Vector Graphics
Web › SVG › Element › stop
</linearGradient> </defs> <!-- using my linear gradient --> <circle cx="5" cy="5" r="4" fill="url('#myGradient')" /> </svg> Attributes offset This attribute defines where the gradient stop is placed along the gradient vector. Value type: <number>|<percentage>; Default value: 0; Animatable: yes stop-color This attribute defines 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. Value type: <opacity>; Default value: 1; Animatable: yes Global attributes Core Attributes Most notably: id Styling Attributes class, style Event Attributes Global event attributes, Docume...
<style> - SVG: Scalable Vector Graphics
Web › SVG › Element › style
eight: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 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, styl...
<symbol> - SVG: Scalable Vector Graphics
Web › SVG › Element › symbol
<cursor>, <filter>, <font>, <font-face>, <foreignObject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> Note: A <symbol> element itself is not meant to be rendered. Only instances of a <symbol> element (i.e., a reference to a <symbol> by a <use> element) are rendered. That means that some browsers could refuse to directly display a <symbol> element even if the CSS display property tells otherwise. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of '<symbol>' in that specification. Candidate Recommendation Allowed geometry properties to be specified on a symbol Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of '<symbol>' in that specification. Recom...
Example - SVG: Scalable Vector Graphics
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. ...
SVG animation with SMIL - SVG: Scalable Vector Graphics
Firefox 4 introduced support for animating SVG using Synchronized Multimedia Integration Language (SMIL). SMIL allows you to: animate the numeric attributes of an element (x, y, ...) animate transform attributes (translation or rotation) animate color attributes follow a motion path This is done adding an SVG element like <animate> inside the SVG element to animate. Below are examples for the four different ways. Animating attributes of an element The following example animates the cx attribute of a circle. To do so, we add an <animate> element inside the <circle> element. ...
Specification Deviations - SVG: Scalable Vector Graphics
te 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. 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. ...
Clipping and masking - SVG: Scalable Vector Graphics
link="http://www.w3.org/1999/xlink"> <rect x="0" y="0" width="200" height="200" fill="blue" /> <circle cx="100" cy="100" r="50" stroke="yellow" stroke-width="40" stroke-opacity=".5" fill="red" /> </svg> ScreenshotLive sample You see in this example the red circle on blue background. The yellow stroke is set to 50% opacity, which leads effectively to a double-color stroke. Using well-known CSS techniques One of the most powerful tools in a web developer's toolbox is display: none. It is therefore little surprise, that it was decided to take this CSS property into SVG as well, together with visibility and clip as defined by CSS 2. For reverting a previously set display: none it is important to know, that the initial value for all SVG elements is inline. << PreviousNext >> ...
Positions - SVG: Scalable Vector Graphics
fines a rectangle from the upper left corner, that spans from there 100px to the right and to the bottom. What are "pixels"? In the most basic case one pixel in an SVG document maps to one pixel on the output device (a.k.a. the screen). But SVG wouldn't have the "Scalable" in its name, if there weren't several possibilities to change this behaviour. Much like absolute and relative font sizes in CSS, SVG defines absolute units (ones with a dimensional identifier like "pt" or "cm") and so-called user units, that lack that identifier and are plain numbers. Without further specification, one user unit equals one screen unit. To explicitly change this behaviour, there are several possibilities in SVG. We start with the svg root element: <svg width="100" height="100"> The above element define...
SVG Tutorial - SVG: Scalable Vector Graphics
Web › SVG › Tutorial
pment. If you're able, please help out by chipping in and writing a paragraph or two. Extra points for writing a whole page! Introducing SVG from Scratch Introduction Getting Started Positions Basic Shapes Paths Fills and Strokes Gradients Patterns Texts Basic Transformations Clipping and masking Other content in SVG Filter effects SVG fonts SVG Image tag Tools for SVG SVG and CSS The following topics are more advanced and hence should get their own tutorials. Scripting SVG with JavaScript TBD SVG filters tutorial TBD Animations with SMIL in SVG TBD Creating fonts in SVG TBD ...
Mixed content - Web security
the 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 W...
Same-origin policy - Web security
disallowed, but read access 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 w...
Web security
>, or <applet>. User information security Insecure passwords Serving login forms over HTTP is especially dangerous because of the wide variety of attacks that can be used against them to extract a user's password. Network eavesdroppers could steal a user's password by sniffing the network, or by modifying the served page in transit. Privacy and the :visited selector 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. To mitigate this problem, browsers have limited the amount of information that can be obtained from visited links. Security-related glossary terms Block cipher mode of operation Certificate authority Challenge-response authentication Cipher Ciphe...
XML introduction - XML: Extensible Markup Language
&warning; </message> </body> You can also use numeric character references to specify special characters; for example, &#xA9; is the "(C)" 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. <?xml-stylesheet type="text/css" href="stylesheet.css"?> There is also another more powerful way to display XML: the Extensible Stylesheet Language Transformations (XSLT) which can be used to transform XML into other languages such as HTML. This makes XML incredibly versatile. <?xml-stylesheet type="text/xsl" href="trans...
XPath
the most practical way and valid alternative to XPath. View All... Tools ChroPath XPath panel that integrates tightly into FireBug, providing an editor and inspector (FireFox Add-On). XMLQuire (formerly known as SketchPath) A Graphical XPath Builder/Debugger(.NET). XPath tester An online XPath Builder/Debugger. Related Topics XSLT, XQuery, XML, DOM, JXON, JSONPath Comparison of CSS Selectors and XPath ...
<xsl:attribute-set> - XSLT: Extensible Stylesheet Language Transformations
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. ...
Index - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Index
es The <xsl:apply-templates> element selects a set of nodes in the input tree and instructs the processor to apply the proper templates to them. 22 <xsl:attribute-set> Element, Reference, XSLT, attribute-set 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. 23 <xsl:attribute> Attribute, Element, Reference, XSLT The <xsl:attribute> element creates an attribute in the output document, using any values that can be accessed from the stylesheet. 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...
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. The outermost element in an XSLT stylesheet must be the <xsl:stylesheet> element (an acceptable alte...
For Further Reading - XSLT: Extensible Stylesheet Language Transformations
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.ibm.com...
Transforming XML with XSLT - XSLT: Extensible Stylesheet Language Transformations
orates 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 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 docume...
Basic Example - XSLT: Extensible Stylesheet Language Transformations
et <?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/myNS:Author"/> ...
WebAssembly Concepts - WebAssembly
uses outside web and JavaScript environments (see Non-web embeddings). How does WebAssembly fit into the web platform? The web platform can be thought of as having two parts: A virtual machine (VM) that runs the Web app's code, e.g. the JavaScript code that powers your apps. A set of Web APIs that the Web app can call to control web browser/device functionality and make things happen (DOM, CSSOM, WebGL, IndexedDB, Web Audio API, etc.). Historically, the VM has been able to load only JavaScript. This has worked well for us as JavaScript is powerful enough to solve most problems people have on the Web today. We have run into performance problems, however, when trying to use JavaScript for more intensive use cases like 3D games, Virtual and Augmented Reality, computer vision, image/vide...