Skip to content

Commit 69ccbe2

Browse files
committed
[css-images-4] Add highlighting classes to all code samples.
1 parent a7a166f commit 69ccbe2

1 file changed

Lines changed: 36 additions & 32 deletions

File tree

css-images-4/Overview.bs

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ Include Can I Use Panels: yes
2525
<pre class=link-defaults>
2626
spec: css-images-3;
2727
type: function;
28+
# fuck it, here's a comment
29+
# here's another
30+
# and some more
2831
text: image-set();
2932
text: cross-fade();
3033
</pre>
@@ -144,7 +147,7 @@ Image Fallbacks and Annotations: the ''image()'' notation {#image-notation}
144147
even when the image fails to load.
145148
For example, the following legacy code works fine if the image is rectangular and has no transparency:
146149

147-
<pre>
150+
<pre class="lang-css">
148151
body { color: black; background: white; }
149152
p.special { color: white; background: url("dark.png") black; }
150153
</pre>
@@ -156,7 +159,7 @@ Image Fallbacks and Annotations: the ''image()'' notation {#image-notation}
156159
which is probably not desired.
157160
The ''image()'' function addresses this:
158161

159-
<pre>
162+
<pre class="lang-css">
160163
body { color: black; background: white; }
161164
p.special { color: white; background: image("dark.png", black); }
162165
</pre>
@@ -172,7 +175,7 @@ Image Fallbacks and Annotations: the ''image()'' notation {#image-notation}
172175
an author could write the following to get newer browsers to use the GIF's frame,
173176
and older browsers to instead download the fallback image:
174177

175-
<pre>background-image: image("cat_meme.gif#frame=5", "lolcat.png");</pre>
178+
<pre class="lang-css">background-image: image("cat_meme.gif#frame=5", "lolcat.png");</pre>
176179
</div>
177180
-->
178181

@@ -189,7 +192,7 @@ Image Fallbacks and Annotations: the ''image()'' notation {#image-notation}
189192
<img src="images/sprites.svg" height="20" width="180" alt="[9 circles, with 0 to 8 eighths filled in]">
190193
</a>
191194

192-
<pre>background-image: image('sprites.svg#xywh=40,0,20,20')</pre>
195+
<pre class="lang-css">background-image: image('sprites.svg#xywh=40,0,20,20')</pre>
193196

194197
...the background of the element will be the portion of the image that starts at (40px,0px) and is 20px wide and tall,
195198
which is just the circle with a quarter filled in.
@@ -209,7 +212,7 @@ Image Fallbacks and Annotations: the ''image()'' notation {#image-notation}
209212
authors can take advantage of CSS's forward-compatible parsing rules
210213
to provide a fallback when using an image fragment URL:
211214

212-
<pre>
215+
<pre class="lang-css">
213216
background-image: url('swirl.png'); /* old UAs */
214217
background-image: image('sprites.png#xywh=10,30,60,20'); /* new UAs */
215218
</pre>
@@ -234,7 +237,7 @@ Image Fallbacks and Annotations: the ''image()'' notation {#image-notation}
234237
one can use this as a simple way to "tint" a background image,
235238
by overlaying a partially-transparent color over the top of the other image:
236239

237-
<pre>background-image: image(rgba(0,0,255,.5)), url("bg-image.png");</pre>
240+
<pre class="lang-css">background-image: image(rgba(0,0,255,.5)), url("bg-image.png");</pre>
238241

239242
'background-color' does not work for this,
240243
as the solid color it generates always lies <em>beneath</em> all the background images.
@@ -261,7 +264,7 @@ Image Fallbacks and Annotations: the ''image()'' notation {#image-notation}
261264
and an image designed to point into the text on one side will point out of the text on the other side.
262265
This can be fixed with code like:
263266

264-
<pre>
267+
<pre class="lang-html">
265268
&lt;ul style="list-style-image: image(ltr 'arrow.png');">
266269
&lt;li dir='ltr'>My bullet is on the left!&lt;/li>
267270
&lt;li dir='rtl'>MY BULLET IS ON THE RIGHT!&lt;/li>
@@ -270,7 +273,7 @@ Image Fallbacks and Annotations: the ''image()'' notation {#image-notation}
270273

271274
This should render something like:
272275

273-
<pre>
276+
<pre class="lang-html">
274277
&#8658; My bullet is on the left!
275278
!THGIR EHT NO SI TELLUB YM &#8656;
276279
</pre>
@@ -427,7 +430,7 @@ Note: No change from [[css3-images]].
427430

428431
As a somewhat silly example, a <code>&lt;p></code> element can be reused as a background elsewhere in the document:
429432

430-
<pre>
433+
<pre class="lang-html">
431434
&lt;style>
432435
#src { color: white; background: lime; width: 300px; height: 40px; position: relative; }
433436
#dst { color: black; background: element(#src); padding: 20px; margin: 20px 0; }
@@ -448,7 +451,7 @@ Note: No change from [[css3-images]].
448451
<div class='example'>
449452
For example, the ''element()'' function can reference an SVG <code>&lt;pattern></code> element in an HTML document:
450453

451-
<pre>
454+
<pre class=lang-html>
452455
&lt;!DOCTYPE html>
453456
&lt;svg>
454457
&lt;defs>
@@ -471,7 +474,7 @@ Note: No change from [[css3-images]].
471474
reference a canvas that's being drawn into,
472475
but not displayed in the page:
473476

474-
<pre>
477+
<pre class=lang-html>
475478
&lt;!DOCTYPE html>
476479
&lt;script>
477480
var canvas = document.querySelector('#animated-bullet');
@@ -498,7 +501,7 @@ Note: No change from [[css3-images]].
498501

499502
For example, all of the following ''element()'' uses will result in a transparent background:
500503

501-
<pre>
504+
<pre class=lang-html>
502505
&lt;!DOCTYPE html>
503506
&lt;p id='one' style="display:none; position: relative;">one&lt;/p>
504507
&lt;iframe src="http://example.com">
@@ -535,7 +538,7 @@ Note: No change from [[css3-images]].
535538
The ''element()'' function can be put to many uses.
536539
For example, it can be used to show a preview of the previous or next slide in a slideshow:
537540

538-
<pre>
541+
<pre class=lang-html>
539542
&lt;!DOCTYPE html>
540543
&lt;script>
541544
function navigateSlides() {
@@ -662,7 +665,7 @@ Using Out-Of-Document Sources: the <code>ElementSources</code> interface</h4>
662665
<div class='example'>
663666
For example, fancy animating backgrounds can be done with an external canvas:
664667

665-
<pre>
668+
<pre class=lang-html>
666669
&lt;script>
667670
var bg = document.createElement('canvas');
668671
bg.height = 200;
@@ -750,7 +753,7 @@ Gradients</h2>
750753
gradients can be used in any property that accepts images.
751754
For example:
752755

753-
<ul>
756+
<ul class=lang-css>
754757
<li><code>background: linear-gradient(white, gray);</code>
755758
<li><code>list-style-image: radial-gradient(circle, #006, #00a 90%, #0000af 100%, white 100%)</code>
756759
</ul>
@@ -926,7 +929,7 @@ Conic Gradient Examples</h4>
926929
<div class=example>
927930
Below are various ways of specifying the same basic conic gradient:
928931

929-
<pre>
932+
<pre class=lang-css>
930933
background: conic-gradient(#f06, gold);
931934
background: conic-gradient(at 50% 50%, #f06, gold);
932935
background: conic-gradient(from 0deg, #f06, gold);
@@ -943,7 +946,7 @@ Conic Gradient Examples</h4>
943946
This demonstrates how even though color stops with angles outside [0deg, 360deg) are not directly painted,
944947
they can still affect the color of the painted part of the gradient.
945948

946-
<pre>
949+
<pre class=lang-css>
947950
background: conic-gradient(white -50%, black 150%);
948951
background: conic-gradient(white -180deg, black 540deg);
949952
background: conic-gradient(hsl(0,0%,75%), hsl(0,0%,25%));
@@ -955,7 +958,7 @@ Conic Gradient Examples</h4>
955958
<div class=example>
956959
Below are two different ways of specifying the same rotated conic gradient, one with a rotation angle and one without:
957960

958-
<pre>
961+
<pre class=lang-css>
959962
background: conic-gradient(from 45deg, white, black, white);
960963
background: conic-gradient(hsl(0,0%,87.5%), white 45deg, black 225deg, hsl(0,0%,87.5%));
961964
</pre>
@@ -974,7 +977,7 @@ Conic Gradient Examples</h4>
974977
<div class=example>
975978
A conic gradient with a radial gradient overlaid on it, to draw a hue & saturation wheel:
976979

977-
<pre>
980+
<pre class=lang-css>
978981
background: radial-gradient(gray, transparent),
979982
conic-gradient(red, yellow, lime, aqua, blue, magenta, red);
980983
border-radius: 50%;
@@ -990,7 +993,7 @@ Conic Gradient Examples</h4>
990993
This will produce infinitesimal (invisible) transitions between the color stops with different colors,
991994
effectively producing solid color segments.
992995

993-
<pre>
996+
<pre class=lang-css>
994997
background: conic-gradient(yellowgreen 40%, gold 0deg 75%, #f06 0deg);
995998
border-radius: 50%;
996999
width: 200px; height: 200px;
@@ -1031,19 +1034,20 @@ Repeating Gradients: the ''repeating-linear-gradient()'', ''repeating-radial-gra
10311034
<div class=example>
10321035
Repeating color stops with abrupt transitions creates a starburst-type background:
10331036

1034-
<pre>
1037+
<pre class=lang-css>
10351038
background: repeating-conic-gradient(
1036-
hsla(0,0%,100%,.2) 0deg 15deg,
1037-
hsla(0,0%,100%,0) 0deg 30deg
1038-
) #0ac;</pre>
1039+
hsla(0,0%,100%,.2) 0deg 15deg,
1040+
hsla(0,0%,100%,0) 0deg 30deg
1041+
) #0ac;
1042+
</pre>
10391043

10401044
<img src="images/repeating-conic2.png" alt="">
10411045
</div>
10421046

10431047
<div class=example>
10441048
Here repeating color stops with abrupt transitions are used to create a checkerboard:
10451049

1046-
<pre>
1050+
<pre class=lang-css>
10471051
background: repeating-conic-gradient(black 0deg 25%, white 0deg 50%);
10481052
background-size: 60px 60px;
10491053
</pre>
@@ -1052,7 +1056,7 @@ Repeating Gradients: the ''repeating-linear-gradient()'', ''repeating-radial-gra
10521056

10531057
The same checkerboard can be created via non-repeating conic gradients:
10541058

1055-
<pre>
1059+
<pre class=lang-css>
10561060
background: conic-gradient(black 25%, white 0deg 50%, black 0deg 75%, white 0deg);
10571061
background-size: 60px 60px;
10581062
</pre>
@@ -1443,7 +1447,7 @@ Overriding Image Resolutions: the 'image-resolution' property {#the-image-resolu
14431447
and maintain an appropriate size,
14441448
ensuring attractive display both on screen and on paper:
14451449

1446-
<pre>
1450+
<pre class=lang-css>
14471451
img.high-res {
14481452
image-resolution: 300dpi;
14491453
}
@@ -1463,13 +1467,13 @@ Overriding Image Resolutions: the 'image-resolution' property {#the-image-resolu
14631467
This rule specifies that the UA should use the image resolution found in the image itself,
14641468
falling back to 1 image pixel per CSS ''px'' unit.
14651469

1466-
<pre>img { image-resolution: from-image }</pre>
1470+
<pre class=lang-css>img { image-resolution: from-image }</pre>
14671471

14681472
These rules both specify that the UA should use the image resolution found in the image itself,
14691473
but if the image has no resolution,
14701474
the resolution is set to ''300dpi'' instead of the default ''1dppx''.
14711475

1472-
<pre>
1476+
<pre class=lang-css>
14731477
img { image-resolution: from-image 300dpi }
14741478
img { image-resolution: 300dpi from-image }
14751479
</pre>
@@ -1480,18 +1484,18 @@ Overriding Image Resolutions: the 'image-resolution' property {#the-image-resolu
14801484
Using this rule, the image resolution is set to 300dpi.
14811485
(The resolution in the image, if any, is ignored.)
14821486

1483-
<pre>img { image-resolution: 300dpi }</pre>
1487+
<pre class=lang-css>img { image-resolution: 300dpi }</pre>
14841488

14851489
This rule, on the other hand,
14861490
if used when the screen's resolution is 96dpi,
14871491
would instead render the image at 288dpi
14881492
(so that 3 image pixels map to 1 device pixel):
14891493

1490-
<pre>img { image-resolution: 300dpi snap; }</pre>
1494+
<pre class=lang-css>img { image-resolution: 300dpi snap; }</pre>
14911495

14921496
The ''snap'' keyword can also be used when the resolution is taken from the image:
14931497

1494-
<pre>img { image-resolution: snap from-image; }</pre>
1498+
<pre class=lang-css>img { image-resolution: snap from-image; }</pre>
14951499

14961500
An image declaring itself as 300dpi will,
14971501
in the situation above,

0 commit comments

Comments
 (0)