css-backgrounds-4/Overview.bs

Sun, 31 Jan 2016 15:42:31 -0800

author
Peter Linss <[email protected]>
date
Sun, 31 Jan 2016 15:42:31 -0800
changeset 16986
5be73fbc8592
parent 16545
022a9eb33b39
child 16989
255258410d1b
permissions
-rw-r--r--

change //dev.w3.org/csswg/ urls to //drafts.csswg.org/

fantasai@1756 1 <h1>CSS Backgrounds and Borders Module Level 4</h1>
fantasai@1756 2
fantasai@13525 3 <pre class='metadata'>
fantasai@13525 4 Shortname: css-backgrounds
fantasai@13525 5 Level: 4
fantasai@13525 6 Status: ED
jackalmage@15674 7 Work Status: Exploring
fantasai@13525 8 Group: csswg
fantasai@13525 9 TR: http://www.w3.org/TR/css-backgrounds-4/
peter@16986 10 ED: https://drafts.csswg.org/css-backgrounds-4/
fantasai@13525 11 Editor: Bert Bos, W3C, [email protected]
fantasai@16189 12 Editor: Elika J. Etemad / fantasai, Invited Expert, http://fantasai.inkedblade.net/contact
fantasai@13525 13 Editor: Lea Verou, Invited Expert, http://lea.verou.me/about/
fantasai@13527 14 Abstract: This module contains the features of CSS relating to the borders and backgrounds of boxes on the page. It includes and extends the functionality of <a href="http://www.w3.org/TR/css3-background/">CSS Backgrounds and Borders Level&nbsp;3</a>. [[CSS3BG]] The main extensions compared to level&nbsp;3 are shaping ('corner-shape') and clipping borders ('border-clip'), logical background positions ('background-position'), and the ''extend'' ability of 'background-repeat'.
jackalmage@15674 15 Ignored Terms:
fantasai@16009 16 Warning: Not Ready
fantasai@13525 17 </pre>
fantasai@1756 18
fantasai@13525 19 <h2 id="intro">
fantasai@4172 20 Introduction</h2>
fantasai@1756 21
fantasai@13525 22 <p class="issue">
fantasai@13525 23 This module is currently maintained as a diff against Level 3.
fantasai@13525 24 We will fold in the text once it's all formatted up and in CR again,
fantasai@13525 25 as this will reduce the effort of keeping them in sync
fantasai@13525 26 (source diffs will be accurate in reflecting the differences).
fantasai@4172 27
fantasai@13528 28 <h2 id="backgrounds">
fantasai@13528 29 Backgrounds</h2>
fantasai@13528 30
fantasai@13528 31 <h3 id="the-background-position">
fantasai@16009 32 Background Positioning: the 'background-position' shorthand property</h3>
fantasai@13528 33
fantasai@13528 34 <pre class='propdef'>
fantasai@16009 35 Name: background-position
fantasai@13528 36 Value: <<position>>#
fantasai@13528 37 Initial: top left
fantasai@13528 38 Applies to: all
fantasai@13528 39 Inherited: no
fantasai@13528 40 Percentages: refer to size of background positioning area <em>minus</em> size of background image
fantasai@13528 41 Media: visual
fantasai@13528 42 Computed value: A list, each item consisting of: a pair of offsets and an origin, each offset given as a combination of an absolute length and a percentage
fantasai@13528 43 </pre>
fantasai@13528 44
fantasai@13528 45 See [[CSS3BG]] for definition.
fantasai@16009 46
fantasai@13528 47 <p>Where
fantasai@13528 48 <pre class=prod><dfn><var>&lt;position&gt;</var></dfn> = [
fantasai@16010 49 [ left | center | right | top | bottom | start | end | <var>&lt;percentage&gt;</var> | <var>&lt;length&gt;</var> ]
fantasai@13528 50 |
fantasai@16011 51 [ left | center | right | x-start | x-end | <var>&lt;percentage&gt;</var> | <var>&lt;length&gt;</var> ]
fantasai@16011 52 [ top | center | bottom | y-start | y-end | <var>&lt;percentage&gt;</var> | <var>&lt;length&gt;</var> ]
fantasai@13528 53 |
fantasai@16010 54 [ center | [ left | right | x-start | x-end ] [ <var>&lt;percentage&gt;</var> | <var>&lt;length&gt;</var> ]? ] &amp;&amp;
fantasai@16010 55 [ center | [ top | bottom | y-start | y-end ] [ <var>&lt;percentage&gt;</var> | <var>&lt;length&gt;</var> ]? ]
fantasai@16009 56 |
fantasai@16011 57 [ center | [ start | end ] [ <var>&lt;percentage&gt;</var> | <var>&lt;length&gt;</var> ]? ]
fantasai@16010 58 [ center | [ start | end ] [ <var>&lt;percentage&gt;</var> | <var>&lt;length&gt;</var> ]? ] ]</pre>
fantasai@13528 59
fantasai@16010 60 Values have the following meanings:
fantasai@16010 61 <dl>
fantasai@16010 62 <dt>One value
fantasai@16010 63 <dd>
fantasai@16010 64 If only one value is given,
fantasai@16010 65 and that value is ''background-position/start'' or ''background-position/end'',
fantasai@16010 66 then the keyword is duplicated;
fantasai@16010 67 otherwise the second keyword defaults to ''background-position/center''.
fantasai@16010 68 The resulting value is treated as a two-component value.
fantasai@16009 69
fantasai@16010 70 <dt>More than one value
fantasai@16010 71 <dd>
fantasai@16010 72 If the value contains a ''background-position/start'' or ''background-position/end'' keyword,
fantasai@16010 73 then the shorthand sets
fantasai@16010 74 'background-position-inline' and 'background-position-block' to the specified values.
fantasai@16010 75 Otherwise
fantasai@16010 76 the shorthand sets
fantasai@16010 77 'background-position-x' and 'background-position-y' to the specified values.
fantasai@16009 78
fantasai@16010 79 Issue: Specify the value assignment in more detail. Should expand just like Level 3.
fantasai@16010 80 </dl>
fantasai@16009 81
fantasai@16009 82 Issue: Specify what happens to set of properties that are not set. Maybe they're just not set?
fantasai@16009 83
fantasai@16009 84 <h4 id="background-position-longhands">
fantasai@16009 85 Background Positioning Longhands: the 'background-position-x', 'background-position-y', 'background-position-inline', and 'background-position-block' properties</h4>
fantasai@16009 86
fantasai@16009 87 Issue: This section is still being worked out. The tricky thing is making all the start/end keywords work sanely.
fantasai@16009 88
fantasai@16009 89 <pre class='propdef'>
fantasai@16009 90 Name: background-position-x
fantasai@16010 91 Value: [ center | [ left | right | x-start | x-end ] [ <var>&lt;percentage&gt;</var> | <var>&lt;length&gt;</var> ]? ]#
fantasai@16009 92 Initial: left
fantasai@16009 93 Applies to: all
fantasai@16009 94 Inherited: no
fantasai@16009 95 Percentages: refer to width of background positioning area <em>minus</em> height of background image
fantasai@16009 96 Media: visual
fantasai@16009 97 Computed value: A list, each item consisting of: an offset given as a combination of an absolute length and a percentage, plus an origin keyword
fantasai@16009 98 </pre>
fantasai@16009 99
fantasai@16009 100 This property specifies the background position's horizontal component.
fantasai@16009 101
fantasai@16009 102 <pre class='propdef'>
fantasai@16009 103 Name: background-position-y
fantasai@16010 104 Value: [ center | [ top | bottom | y-start | y-end ] [ <var>&lt;percentage&gt;</var> | <var>&lt;length&gt;</var> ]? ]#
fantasai@16009 105 Initial: left
fantasai@16009 106 Applies to: all
fantasai@16009 107 Inherited: no
fantasai@16009 108 Percentages: refer to height of background positioning area <em>minus</em> height of background image
fantasai@16009 109 Media: visual
fantasai@16009 110 Computed value: A list, each item consisting of: an offset given as a combination of an absolute length and a percentage, plus an origin keyword
fantasai@16009 111 </pre>
fantasai@16009 112
fantasai@16009 113 This property specifies the background position's vertical component.
fantasai@16009 114
fantasai@16009 115 <pre class='propdef'>
fantasai@16009 116 Name: background-position-inline
fantasai@16009 117 Value: [ center | [ start | end ] [ <var>&lt;percentage&gt;</var> | <var>&lt;length&gt;</var> ]? ]#
dbaron@16545 118 Initial: not applicable (initial value comes from physical property)
fantasai@16009 119 Applies to: all
fantasai@16009 120 Inherited: no
fantasai@16009 121 Percentages: refer to inline-size of background positioning area <em>minus</em> inline-size of background image
fantasai@16009 122 Media: visual
fantasai@16009 123 Computed value: A list, each item consisting of: an offset given as a combination of an absolute length and a percentage, plus an origin keyword
fantasai@16009 124 </pre>
fantasai@16009 125
fantasai@16009 126 This property specifies the background position's inline-axis component.
fantasai@16009 127
fantasai@16009 128 <pre class='propdef'>
fantasai@16009 129 Name: background-position-block
fantasai@16009 130 Value: [ center | [ start | end ] [ <var>&lt;percentage&gt;</var> | <var>&lt;length&gt;</var> ]? ]#
dbaron@16545 131 Initial: not applicable (initial value comes from physical property)
fantasai@16009 132 Applies to: all
fantasai@16009 133 Inherited: no
fantasai@16009 134 Percentages: refer to size of background positioning area <em>minus</em> size of background image
fantasai@16009 135 Media: visual
fantasai@16009 136 Computed value: A list, each item consisting of: an offset given as a combination of an absolute length and a percentage, plus an origin keyword
fantasai@16009 137 </pre>
fantasai@16009 138
fantasai@16009 139 This property specifies the background position's block-axis component.
fantasai@13528 140
fantasai@13527 141 <h2 id="corners">
fantasai@13527 142 Corners</h2>
fantasai@13527 143
fantasai@13527 144 <h3 id=corner-sizing>
fantasai@13527 145 Corner Sizing: the 'border-radius property</h3>
fantasai@4172 146
fantasai@13525 147 <pre class='propdef'>
fantasai@13527 148 Name: border-radius
fantasai@13527 149 Value: [ <<length>> | <<percentage>> ]{1,4} [ / [ <<length>> | <<percentage>> ]{1,4} ]?
fantasai@13527 150 Initial: 0
fantasai@13527 151 Applies to: all elements, except table element when 'border-collapse' is ''collapse''
fantasai@13527 152 Inherited: no
fantasai@13527 153 Percentages: n/a
fantasai@13527 154 Media: visual
fantasai@13527 155 Computed value: specified value
fantasai@13527 156 Animatable: no
fantasai@13527 157 Canonical order: n/a
fantasai@13527 158 </pre>
fantasai@13527 159
fantasai@13527 160 See [[CSS3BG]].
fantasai@13527 161
fantasai@13527 162 <h3 id=corner-shaping>
fantasai@13527 163 Corner Shaping: the 'corner-shape' property</h3>
fantasai@13527 164
fantasai@13527 165 <pre class='propdef'>
fantasai@13527 166 Name: corner-shape
fantasai@13527 167 Value: [round | bevel | scoop | notch]{1,4}
fantasai@13527 168 Initial: round
fantasai@13527 169 Applies to: all elements, except table element when 'border-collapse' is ''collapse''
fantasai@13527 170 Inherited: no
fantasai@13527 171 Percentages: n/a
fantasai@13527 172 Media: visual
fantasai@13527 173 Computed value: specified value
fantasai@13527 174 Animatable: no
fantasai@13525 175 Canonical order: n/a
fantasai@13525 176 </pre>
jackalmage@9894 177
fantasai@13525 178 By default, non-zero border-radii define
fantasai@13525 179 a quarter-ellipse that rounds the affected corners.
fantasai@13525 180 However in some cases, other corner shapes are desired.
fantasai@13527 181 The 'corner-shape' property specifies a reinterpretation of the radii
fantasai@13525 182 to define other corner shapes.
jackalmage@9894 183
fantasai@13527 184 <dl dfn-type="value" dfn-for="corner-shape">
fantasai@13527 185 <dt><dfn>''round''</dfn>
fantasai@13527 186 <dd>Border radii define a convex elliptical curve at the corner.
fantasai@13525 187 <dt><dfn>''bevel''</dfn>
fantasai@13525 188 <dd>Border radii define a diagonal slice at the corner.
fantasai@13525 189 <dt><dfn>''scoop''</dfn>
fantasai@13527 190 <dd>Border radii define a concave elliptical curve at the corner.
fantasai@13525 191 <dt><dfn>''notch''</dfn>
fantasai@13525 192 <dd>Border radii define a concave rectangular notch at the corner.
fantasai@13525 193 </dl>
fantasai@4172 194
fantasai@13527 195 <div class="example">
fantasai@13527 196 For example, the following declarations create a right-pointing next button.
fantasai@13527 197 <pre>
fantasai@13527 198 a {
fantasai@13527 199 border-radius: 0 2em 2em 0;
fantasai@13527 200 corner-shape: bevel;
fantasai@13527 201 padding: 0.5em 2em 0.5em 0.5em;
fantasai@13527 202 </pre>
fantasai@13527 203 As a fallback in UAs that don't support 'border-radius',
fantasai@13527 204 the right side would be rounded rather than pointy.
fantasai@13527 205 </div>
fantasai@13527 206
fantasai@13527 207 <p class="issue">
fantasai@13527 208 For ''scoop'' and ''notch'', how do the color/style/width transitions work?
fantasai@13527 209 Do they transition once in the middle, or alternate to match the topness/sideness of that segment of the border?
fantasai@13527 210
fantasai@13527 211 <p class="issue">
fantasai@13527 212 Add a ''cubic-bezier()'' function for random other shapes?
fantasai@13527 213 Or some other functions?
fantasai@13527 214
fantasai@13527 215 <h3 id="corners-shorthand">
fantasai@13527 216 Corner Shape and Size: the 'corners' shorthand</h3>
fantasai@13527 217
fantasai@13527 218 <pre class='propdef'>
fantasai@13527 219 Name: corners
fantasai@13527 220 Value: <<'corner-shape'>> || <<'border-radius'>>
fantasai@13527 221 Initial: see individual properties
fantasai@13528 222 Applies to: see individual properties
fantasai@13527 223 Inherited: see individual properties
fantasai@13527 224 Percentages: see individual properties
fantasai@13527 225 Media: visual
fantasai@13527 226 Computed value: see individual properties
fantasai@13527 227 </pre>
fantasai@13527 228
fantasai@13527 229 The 'corners' shorthand sets 'corner-shape' and 'border-radius' in the same declaration.
fantasai@13527 230 If either is omitted, it is reset to its initial value.
fantasai@13527 231
fantasai@13527 232 <div class="example">
fantasai@13527 233 For example, the following declaration creates a diamond shape.
fantasai@13527 234 <pre>corners: bevel 50%;</pre>
fantasai@13527 235 In UAs that don't support 'corner-shape', the declaration is ignored
fantasai@13527 236 (falls back to a rectangle).
fantasai@13527 237 </div>
fantasai@13527 238
fantasai@13527 239 <div class="example">
fantasai@13527 240 In this example, the first declaration creates tabs with vertical sides and rounded corners using 'border-radius',
fantasai@13527 241 while the second example makes them trapezoid-shaped in UAs that support 'corners'.
fantasai@13527 242 <pre>
fantasai@13527 243 border-radius: 0.25em 0.25em 0 0;
fantasai@13527 244 corners: bevel 0.25em 0.25em 0 0 / 50% 50% 0 0;
fantasai@13527 245 </pre>
fantasai@13527 246 </div>
fantasai@13527 247
fantasai@4576 248 <h2 id="partial-borders">
fantasai@13525 249 Partial borders</h2>
fantasai@4576 250
fantasai@13525 251 <p>CSS borders traditionally cover an entire border edge. Sometimes,
fantasai@13525 252 however, it can be useful to hide some parts of the border.
fantasai@13530 253
fantasai@13530 254 <p class="issue">
fantasai@13530 255 Here are two proposals for doing this:
fantasai@13530 256 the second one is from GCPM, the first one is an attempt to recast it more readably.
fantasai@13530 257 The names are terrible, known problem, proposals accepted.
fantasai@13530 258 There is a problem with conceiving this as clipping:
fantasai@13530 259 if you have dotted borders, you want whole dots always, not parts of dots.
fantasai@13530 260 So it should be a drawing limit, not a clip.
jackalmage@9894 261
fantasai@16009 262 <h3 id="border-limit">
fantasai@13525 263 Partial Borders: the 'border-limit' property</h3>
fantasai@4576 264
fantasai@13525 265 <table class=propdef>
fantasai@13525 266 <tr>
fantasai@13525 267 <th>Name:
fantasai@13525 268 <td><dfn>border-limit</dfn>
fantasai@13525 269 <tr>
fantasai@13525 270 <th>Value:
fantasai@13525 271 <td>all | [ sides | corners ] [ &lt;length&gt; | &lt;percentage&gt; ]?
fantasai@13525 272 | [ top | right | bottom | left ] [ &lt;length&gt; | &lt;percentage&gt; ]
fantasai@13525 273 <tr>
fantasai@13525 274 <th>Initial:
fantasai@13525 275 <td>round
fantasai@13525 276 <tr>
fantasai@13525 277 <th>Applies to:
fantasai@13525 278 <td>all elements, except table element when 'border-collapse' is
fantasai@13525 279 ''collapse''
fantasai@13525 280 <tr>
fantasai@13525 281 <th>Inherited:
fantasai@13525 282 <td>no
fantasai@13525 283 <tr>
fantasai@13525 284 <th>Percentages:
fantasai@13525 285 <td>relative to border-box
fantasai@13525 286 <tr>
fantasai@13525 287 <th>Media:
fantasai@13525 288 <td>visual
fantasai@13525 289 <tr>
fantasai@13525 290 <th>Computed value:
fantasai@13525 291 <td>as specified
fantasai@13525 292 </table>
fantasai@4576 293
fantasai@13525 294 <p>By default, the entire border is drawn. However, border rendering can be
fantasai@13525 295 limited to only part of a border. The keyword specifies which part, and
fantasai@13525 296 the length or percentage specifies how much.
jackalmage@9894 297
fantasai@13525 298 <dl dfn-type="value" dfn-for="border-limit">
fantasai@13525 299 <dt><dfn>''sides''</dfn>
fantasai@13525 300 <dd>The sides are drawn up to but not including the corners (as defined
fantasai@13525 301 by the border radii). A length or percentage is measured from the center
fantasai@13525 302 of each side: ''50%'' draws the middle 50% of the border; by default the
fantasai@13525 303 entire side is drawn.
fantasai@13525 304 <dt><dfn>''corners''</dfn>
fantasai@13525 305 <dd>The corners are drawn plus the specified distance into the sides if
fantasai@13525 306 specified. A length is measured from the closest edge of the corner area.
fantasai@13525 307 A percentage is measured from the absolute corner of the border box.
fantasai@13525 308 <dt><dfn>''left''</dfn>
fantasai@13525 309 <dt><dfn>''right''</dfn>
fantasai@13525 310 <dd>For the left and right (vertical) sides, draws the entire side and
fantasai@13525 311 corner. For the top and bottom (horizontal) sides, draws the left/right
fantasai@13525 312 portion, as specified. Distances are measured as for ''corners''.
fantasai@13525 313 <dt><dfn>''top''</dfn>
fantasai@13525 314 <dt><dfn>''bottom''</dfn>
fantasai@13525 315 <dd>For the top and bottom (horizontal) sides, draws the entire side and
fantasai@13525 316 corner. For the left and right (vertical) sides, draws the top/bottom
fantasai@13525 317 portion, as specified. Distances are measured as for ''corners''.
fantasai@13525 318 </dl>
fantasai@4172 319
fantasai@13525 320 <div class="example">
fantasai@13525 321 <p>The following example draws only the middle 50% of the sides.</p>
fantasai@13525 322 <pre>box { border: solid; border-parts: sides 50% }</pre>
fantasai@13525 323 <p>The following example draws only the curved parts of the corners.</p>
fantasai@13525 324 <pre>box { border: solid; border-radius: 1em 2em; border-parts: corners; }</pre>
fantasai@13525 325 <p>The following example draws only the left 4em of the top border.</p>
fantasai@13525 326 <pre>box { border-top: solid; border-parts: left 4em; }
fantasai@13525 327 <p>The following example draws only the first 10px of each corner:</p>
fantasai@13525 328 <pre>box { border: solid; border-parts: corners 10px; }</pre>
fantasai@13525 329 <p>The following example draws the curved part of the corner plus 5px
fantasai@13525 330 along ths sides:</p>
fantasai@13525 331 <pre>box { border: solid; border-radius: 5px; border-shape: scoop; border-parts: corners 5px; }</pre>
fantasai@13525 332 <p>The following example draws the curved part of the corner and all of
fantasai@13529 333 the side except the middle 40%.</p>
fantasai@13529 334 <pre>box { border: solid; border-radius: 5px; border-shape: scoope; border-parts: corners 30%; }</pre>
fantasai@13525 335 </div>
jackalmage@9894 336
fantasai@13525 337 <h3 id="border-clip">
fantasai@13525 338 The 'border-clip' properties</h3>
jackalmage@9894 339
fantasai@13525 340 <table class=propdef>
fantasai@13525 341 <tr>
fantasai@13525 342 <th>Name:
fantasai@13525 343 <td><dfn>border-clip</dfn>, <dfn>border-clip-top</dfn>, <dfn>border-clip-right</dfn>, <dfn>border-clip-bottom</dfn>, <dfn>border-clip-left</dfn>
fantasai@13525 344 <tr>
fantasai@13525 345 <th>Value:
fantasai@13525 346 <td>normal | [ &lt;length&gt; | &lt;percentage&gt; | &lt;fraction&gt; ]+
fantasai@13525 347 <tr>
fantasai@13525 348 <th>Initial:
fantasai@13525 349 <td>normal
fantasai@13525 350 <tr>
fantasai@13525 351 <th>Applies to:
fantasai@13525 352 <td>all elements
fantasai@13525 353 <tr>
fantasai@13525 354 <th>Inherited:
fantasai@13525 355 <td>no
fantasai@13525 356 <tr>
fantasai@13525 357 <th>Percentages:
fantasai@13525 358 <td>refer to length of border-edge side
fantasai@13525 359 <tr>
fantasai@13525 360 <th>Media:
fantasai@13525 361 <td>visual
fantasai@13525 362 <tr>
fantasai@13525 363 <th>Computed&nbsp;value:
fantasai@16009 364 <td>''border-clip/normal'', or a list consisting of absolute lengths, or percentages as specified
fantasai@13525 365 </table>
fantasai@4172 366
fantasai@13525 367 <p class=issue>Should these properties be simplified to only accept <code>normal | [ &lt;length&gt; | &lt;percentage&gt; ] +</code>?
fantasai@4172 368
fantasai@13525 369 <p>These properties split their respective borders into parts along
fantasai@13525 370 the border edge. The first part is visible, the second is invisible,
fantasai@13525 371 the third part is visible, etc. Parts can be specified with lengths,
fantasai@13527 372 percentages, or fractions (expressed by the ''fr'' unit, as per
peter@16986 373 [[CSS3GRID]] or its <a href="https://drafts.csswg.org/css3-grid/">editor's
fantasai@16009 374 edition</a>).
fantasai@16009 375 The ''border-clip/normal'' value means
fantasai@13525 376 that the border is not split, but shown normally.
jackalmage@9894 377
fantasai@13525 378 <p>'border-clip' is a shorthand property for the four individual properties.
fantasai@4172 379
fantasai@13525 380 <p>If the listed parts are shorter than the border, any remaining
fantasai@13525 381 border is split proportionally between the specified fractions. If
fantasai@13525 382 there are no fractions, the behavior is as if ''1fr'' had been
fantasai@13525 383 specified at the end of the list.
jackalmage@9894 384
fantasai@13525 385 <p>If the listed parts are longer than the border, the specified parts
fantasai@13525 386 will be shown in full until the end of the border. In this case, all
fantasai@13525 387 fractions will be zero.
jackalmage@9894 388
fantasai@13525 389 <p>For horizontal borders, parts are listed from left to right. For
fantasai@13525 390 vertical borders, parts are listed from top to bottom.
jackalmage@9894 391
fantasai@13525 392 <p>The exact border parts are determined by laying out the specified border
fantasai@13525 393 parts with all fractions initially set to zero. Any remaining border is
fantasai@13525 394 split proportionally between the fractions specified.
jackalmage@9894 395
fantasai@13525 396 <div class="example">
jackalmage@9894 397
fantasai@13525 398 <pre>border-clip: 10px 1fr 10px;</pre>
fantasai@4172 399
fantasai@13525 400 <div style="position: relative; width: 250px; height: 150px; background: white;">
fantasai@13525 401 <div style="border: 2px solid black; width: 200px; height: 100px; position: absolute; top: 20px; left: 20px">
fantasai@13525 402 <div style="position: absolute; background: white; left: 15px; top: -5px; height: 110px; width: 170px"></div>
fantasai@13525 403 <div style="position: absolute; background: white; left: -5px; top: 15px; height: 70px; width: 210px"></div>
fantasai@13525 404 </div>
fantasai@13525 405 </div>
fantasai@13525 406 </div>
fantasai@4172 407
fantasai@13525 408 <div class="example">
jackalmage@9894 409
fantasai@13525 410 <pre>
fantasai@13525 411 border-clip-top: 10px 1fr 10px;
fantasai@13525 412 border-clip-bottom: 10px 1fr 10px;
fantasai@13525 413 border-clip-right: 5px 1fr 5px;
fantasai@13525 414 border-clip-left: 5px 1fr 5px;
fantasai@13525 415 </pre>
fantasai@13525 416 <div style="position: relative; width: 250px; height: 150px; background: white;">
fantasai@13525 417 <div style="border: 2px solid black; width: 200px; height: 100px; position: absolute; top: 20px; left: 20px">
fantasai@13525 418 <div style="position: absolute; background: white; left: 15px; top: -5px; height: 110px; width: 170px"></div>
fantasai@13525 419 <div style="position: absolute; background: white; left: -5px; top: 5px; height: 90px; width: 210px"></div>
fantasai@13525 420 </div>
fantasai@13525 421 </div>
fantasai@13525 422 </div>
fantasai@4172 423
fantasai@13525 424 <div class="example">
jackalmage@9894 425
fantasai@13525 426 <p>By making the first part have zero length, the inverse border of
fantasai@13525 427 the previous example can easily be created:
jackalmage@9894 428
fantasai@13525 429 <pre>
fantasai@13525 430 border-clip-top: 0 10px 1fr 10px;
fantasai@13525 431 border-clip-bottom: 0 10px 1fr 10px;
fantasai@13525 432 border-clip-right: 0 5px 1fr 5px;
fantasai@13525 433 border-clip-left: 0 5px 1fr 5px;
fantasai@13525 434 </pre>
fantasai@4172 435
fantasai@13525 436 <div style="position: relative; width: 250px; height: 150px; background: white;">
fantasai@13525 437 <div style="border: 2px solid black; width: 200px; height: 100px; position: absolute; top: 20px; left: 20px">
fantasai@13525 438 <div style="position: absolute; background: white; left: -5px; top: -5px; height: 10px; width: 15px"></div>
fantasai@13525 439 <div style="position: absolute; background: white; right: -5px; top: -5px; height: 10px; width: 15px"></div>
fantasai@13525 440 <div style="position: absolute; background: white; left: -5px; top: 95px; height: 10px; width: 15px"></div>
fantasai@13525 441 <div style="position: absolute; background: white; right: -5px; top: 95px; height: 10px; width: 15px"></div>
fantasai@13525 442 </div>
fantasai@13525 443 </div>
fantasai@13525 444 </div>
jackalmage@9894 445
fantasai@13525 446 <div class="example">
fantasai@13525 447 <pre>
fantasai@13525 448 border: thin solid black;
fantasai@13525 449 border-clip: 0 1fr; /* hide borders */
fantasai@13525 450 border-clip-top: 10px 1fr 10px; /* make certain borders visible */
fantasai@13525 451 border-clip-bottom: 10px 1fr 10px;
fantasai@13525 452 </pre>
jackalmage@9894 453
fantasai@13525 454 <div style="position: relative; width: 250px; height: 150px; background: white;">
fantasai@13525 455 <div style="border: 2px solid black; width: 200px; height: 100px; position: absolute; top: 20px; left: 20px">
fantasai@13525 456 <div style="position: absolute; background: white; left: 15px; top: -5px; height: 110px; width: 170px"></div>
fantasai@13525 457 <div style="position: absolute; background: white; left: -5px; top: 0px; height: 100px; width: 210px"></div>
fantasai@13525 458 </div>
fantasai@13525 459 </div>
fantasai@13525 460 </div>
jackalmage@9894 461
fantasai@13525 462 <div class="example">
fantasai@13525 463 <pre>
fantasai@13525 464 <!-- -->border-top: thin solid black;
fantasai@13525 465 <!-- -->border-bottom: thin solid black;
fantasai@13525 466 <!-- -->border-clip-top: 10px;
fantasai@13525 467 <!-- -->border-clip-bottom: 10px;
fantasai@13525 468 <!-- --></pre>
jackalmage@9894 469
fantasai@13525 470 <div style="position: relative; width: 250px; height: 150px; background: white;">
fantasai@13525 471 <div style="border: 2px solid black; width: 200px; height: 100px; position: absolute; top: 20px; left: 20px">
fantasai@13525 472 <div style="position: absolute; background: white; left: 15px; top: -5px; height: 110px; width: 200px"></div>
fantasai@13525 473 <div style="position: absolute; background: white; left: -5px; top: 0px; height: 100px; width: 210px"></div>
fantasai@13525 474 </div>
fantasai@13525 475 </div>
fantasai@13525 476 </div>
jackalmage@9894 477
fantasai@13525 478 <div class="example">
fantasai@13525 479 <pre>
fantasai@13525 480 border-top: thin solid black;
fantasai@13525 481 border-clip: 10px;
fantasai@13525 482 </pre>
fantasai@13525 483 <div style="position: relative; width: 250px; height: 150px; background: white;">
fantasai@13525 484 <div style="border: 2px solid black; width: 200px; height: 100px; position: absolute; top: 20px; left: 20px">
fantasai@13525 485 <div style="position: absolute; background: white; left: 15px; top: -5px; height: 110px; width: 200px"></div>
fantasai@13525 486 <div style="position: absolute; background: white; left: -5px; top: 0px; height: 110px; width: 210px"></div>
fantasai@13525 487 </div>
fantasai@13525 488 </div>
fantasai@13525 489 </div>
jackalmage@9894 490
fantasai@13525 491 <div class="example">
fantasai@13525 492 <p>This rendering:
fantasai@13525 493 <div style="background: white; padding: 0.2em 0.5em">
fantasai@13525 494 <pre style="margin-left: 0">
fantasai@13525 495 A sentence consists of words&#xB9;.
fantasai@13525 496 </pre>
fantasai@13525 497 <div style="width: 3em; height: 2px; background: black"></div>
fantasai@13525 498 <pre style="margin-left: 0">
fantasai@13525 499 &#xB9; Most often.
fantasai@13525 500 </pre>
fantasai@13525 501 </div>
fantasai@13525 502 can be achieved with this style sheet:
fantasai@13525 503 <pre>
fantasai@13525 504 @footnote {
fantasai@13525 505 border-top: thin solid black;
fantasai@13525 506 border-clip: 4em;
fantasai@13525 507 }
fantasai@13525 508 </pre>
fantasai@13525 509 </div>
jackalmage@9894 510
fantasai@13525 511 <div class="example">
fantasai@13525 512 <pre>
fantasai@13525 513 border: 2px solid black;
fantasai@13525 514 border-top-parts: repeat(10px 10px);
fantasai@13525 515 </pre>
fantasai@13525 516 <p>In this example, the repeat pattern is shown five times and there is, by coincidence, no remaining border.
fantasai@13525 517 <div style="position: relative; width: 100px; background: white; padding: 20px">
fantasai@13525 518 <div style="border: 2px solid black; height: 40px"></div>
fantasai@13525 519 <div style="position: absolute; background: white; width: 10px; height: 2px; top: 20px; left: 30px"></div>
fantasai@13525 520 <div style="position: absolute; background: white; width: 10px; height: 2px; top: 20px; left: 50px"></div>
fantasai@13525 521 <div style="position: absolute; background: white; width: 10px; height: 2px; top: 20px; left: 70px"></div>
fantasai@13525 522 <div style="position: absolute; background: white; width: 10px; height: 2px; top: 20px; left: 90px"></div>
fantasai@13525 523 <div style="position: absolute; background: white; width: 10px; height: 2px; top: 20px; left: 110px"></div>
fantasai@13525 524 </div>
fantasai@13525 525 </div>
jackalmage@9894 526
fantasai@13525 527 <div class="example">
fantasai@13525 528 <pre>
fantasai@13525 529 border: 2px solid black;
fantasai@13525 530 border-top-parts: repeat(10px 10px);
fantasai@13525 531 </pre>
fantasai@13525 532 <p>In this example, the repeat pattern is shown five times. The box in this example is slightly wider than the box in the previous example. The remaining border is taken up by a fraction, as if this code had been specified:
fantasai@13525 533 <pre>
fantasai@13525 534 border: 2px solid black;
fantasai@13525 535 border-top-parts: repeat(10px 10px) 1fr;
fantasai@13525 536 </pre>
fantasai@13525 537 <div style="position: relative; width: 105px; background: white; padding: 20px">
fantasai@13525 538 <div style="border: 2px solid black; height: 40px"></div>
fantasai@13525 539 <div style="position: absolute; background: white; width: 10px; height: 2px; top: 20px; left: 30px"></div>
fantasai@13525 540 <div style="position: absolute; background: white; width: 10px; height: 2px; top: 20px; left: 50px"></div>
fantasai@13525 541 <div style="position: absolute; background: white; width: 10px; height: 2px; top: 20px; left: 70px"></div>
fantasai@13525 542 <div style="position: absolute; background: white; width: 10px; height: 2px; top: 20px; left: 90px"></div>
fantasai@13525 543 <div style="position: absolute; background: white; width: 10px; height: 2px; top: 20px; left: 110px"></div>
fantasai@13525 544 <div style="position: absolute; background: red; width: 5px; height: 2px; top: 20px; left: 120px"></div>
fantasai@13525 545 </div>
fantasai@13525 546 <p>The fragment is shown in red for illustrative purposes; it should be shown in black by a compliant UA.
fantasai@13525 547 </div>
jackalmage@9894 548
fantasai@13525 549 <div class="example">
fantasai@13525 550 <pre>
fantasai@13525 551 border: 4px solid black;
fantasai@13525 552 border-top-parts: 40px 20px 0 1fr repeat(20px 20px) 0 1fr 40px;
fantasai@13525 553 </pre>
fantasai@13525 554 <p>In this example, there will be a visible 40px border part on each end of the top border. Inside the 40px border parts, there will be an invisible border part of at least 20px. Inside these invisible border parts, there will be visible border parts, each 20px long with 20px invisible border parts between them.
fantasai@13525 555 <div style="position: relative; width: 192px; background: white; padding: 40px">
fantasai@13525 556 <div style="border: 4px solid black; height: 40px"></div>
fantasai@13525 557 <div style="position: absolute; background: white; width: 20px; height: 4px; top: 40px; left: 80px"></div>
fantasai@13525 558 <div style="position: absolute; background: red; width: 6px; height: 4px; top: 40px; left: 100px"></div>
fantasai@13525 559 <div style="position: absolute; background: white; width: 20px; height: 4px; top: 40px; left: 126px"></div>
fantasai@13525 560 <div style="position: absolute; background: white; width: 20px; height: 4px; top: 40px; left: 166px"></div>
fantasai@13525 561 <div style="position: absolute; background: red; width: 6px; height: 4px; top: 40px; left: 186px"></div>
fantasai@13525 562 </div>
fantasai@13525 563 <p>The fragments are shown in red for illustrative purposes; they should not be visible in compliant UAs.
fantasai@13525 564 </div>
jackalmage@9894 565
fantasai@13525 566 <div class="example">
fantasai@13525 567 <pre>
fantasai@13525 568 border: 4px solid black;
fantasai@13525 569 border-top-parts: 40px 20px 0 1fr 20px 20px 0 1fr 40px;
fantasai@13525 570 </pre>
fantasai@13525 571 <p>In this example, there will be a visible 40px border part on each end of the top border. Inside the 40px border parts, there will be an invisible border part of at least 20px. Inside these invisible border parts, there will be visible border parts, each 20px long with 20px invisible border parts between them.
fantasai@13525 572 <div style="position: relative; width: 192px; background: white; padding: 40px">
fantasai@13525 573 <div style="border: 4px solid black; height: 40px"></div>
fantasai@13525 574 <div style="position: absolute; background: white; width: 20px; height: 4px; top: 40px; left: 80px"></div>
fantasai@13525 575 <div style="position: absolute; background: red; width: 6px; height: 4px; top: 40px; left: 100px"></div>
fantasai@13525 576 <div style="position: absolute; background: white; width: 20px; height: 4px; top: 40px; left: 126px"></div>
fantasai@13525 577 <div style="position: absolute; background: white; width: 20px; height: 4px; top: 40px; left: 166px"></div>
fantasai@13525 578 <div style="position: absolute; background: red; width: 6px; height: 4px; top: 40px; left: 186px"></div>
fantasai@13525 579 </div>
fantasai@13525 580 <p>The fragments are shown in red for illustrative purposes; they should not be visible in compliant UAs.
fantasai@13525 581 </div>
fantasai@4172 582
fantasai@13525 583 <div class="example">
fantasai@13525 584 <pre>
fantasai@13525 585 border: 4px solid black;
fantasai@13525 586 border-clip-top: 3fr 10px 2fr 10px 1fr 10px 10px 10px 1fr 10px 2fr 10px 3fr;
fantasai@13525 587 </pre>
jackalmage@9894 588
fantasai@13525 589 <p>All but one of the visible border parts are represented as fractions in this example. The length of these border parts will change when the width of the element changes. Here is one rendering where 1fr ends up being 10px:
fantasai@13525 590 <div style="position: relative; width: 190px; background: white; padding: 40px">
fantasai@13525 591 <div style="border: 4px solid black; border-top: none; height: 40px"></div>
fantasai@13525 592 <div style="position: absolute; background: red; width: 30px; height: 4px; top: 40px; left: 40px"></div>
fantasai@13525 593 <div style="position: absolute; background: white; width: 10px; height: 4px; top: 40px; left: 70px"></div>
fantasai@13525 594 <div style="position: absolute; background: red; width: 20px; height: 4px; top: 40px; left: 80px"></div>
fantasai@13525 595 <div style="position: absolute; background: white; width: 10px; height: 4px; top: 40px; left: 100px"></div>
fantasai@13525 596 <div style="position: absolute; background: red; width: 10px; height: 4px; top: 40px; left: 110px"></div>
fantasai@13525 597 <div style="position: absolute; background: white; width: 10px; height: 4px; top: 40px; left: 120px"></div>
fantasai@13525 598 <div style="position: absolute; background: black; width: 10px; height: 4px; top: 40px; left: 130px"></div>
fantasai@13525 599 <div style="position: absolute; background: white; width: 10px; height: 4px; top: 40px; left: 140px"></div>
fantasai@13525 600 <div style="position: absolute; background: red; width: 10px; height: 4px; top: 40px; left: 150px"></div>
fantasai@13525 601 <div style="position: absolute; background: white; width: 10px; height: 4px; top: 40px; left: 160px"></div>
fantasai@13525 602 <div style="position: absolute; background: red; width: 20px; height: 4px; top: 40px; left: 170px"></div>
fantasai@13525 603 <div style="position: absolute; background: white; width: 10px; height: 4px; top: 40px; left: 190px"></div>
fantasai@13525 604 <div style="position: absolute; background: red; width: 30px; height: 4px; top: 40px; left: 200px"></div>
fantasai@13525 605 </div>
jackalmage@9894 606
fantasai@13525 607 <p>Here is another rendering where 1fr ends up being 30px:
jackalmage@9894 608
fantasai@13525 609 <div style="position: relative; width: 440px; background: white; padding: 40px">
fantasai@13525 610 <div style="border: 4px solid black; border-top: none; height: 40px"></div>
fantasai@13525 611 <div style="position: absolute; background: red; width: 90px; height: 4px; top: 40px; left: 40px"></div>
fantasai@13525 612 <div style="position: absolute; background: white; width: 10px; height: 4px; top: 40px; left: 130px"></div>
fantasai@13525 613 <div style="position: absolute; background: red; width: 60px; height: 4px; top: 40px; left: 140px"></div>
fantasai@13525 614 <div style="position: absolute; background: white; width: 10px; height: 4px; top: 40px; left: 200px"></div>
fantasai@13525 615 <div style="position: absolute; background: red; width: 30px; height: 4px; top: 40px; left: 210px"></div>
fantasai@13525 616 <div style="position: absolute; background: white; width: 10px; height: 4px; top: 40px; left: 240px"></div>
fantasai@13525 617 <div style="position: absolute; background: black; width: 10px; height: 4px; top: 40px; left: 250px"></div>
fantasai@13525 618 <div style="position: absolute; background: white; width: 10px; height: 4px; top: 40px; left: 260px"></div>
fantasai@13525 619 <div style="position: absolute; background: red; width: 30px; height: 4px; top: 40px; left: 270px"></div>
fantasai@13525 620 <div style="position: absolute; background: white; width: 10px; height: 4px; top: 40px; left: 300px"></div>
fantasai@13525 621 <div style="position: absolute; background: red; width: 60px; height: 4px; top: 40px; left: 310px"></div>
fantasai@13525 622 <div style="position: absolute; background: white; width: 10px; height: 4px; top: 40px; left: 370px"></div>
fantasai@13525 623 <div style="position: absolute; background: red; width: 90px; height: 4px; top: 40px; left: 390px"></div>
fantasai@13525 624 </div>
fantasai@13525 625 <p>The fragments are shown in red for illustrative purposes; they should be black in compliant UAs.
fantasai@13525 626 </div>
jackalmage@9894 627
fantasai@13525 628 <h2 id="changes">
fantasai@13525 629 Changes</h2>
jackalmage@9894 630
fantasai@13525 631 <h3 id="level-changes">
fantasai@13525 632 Additions Since Level 3</h3>
jackalmage@9894 633
fantasai@13533 634 <p class="issue">Additions are a work in progress... here's what we're planning to add. :)
fantasai@13533 635
fantasai@13525 636 <ul>
fantasai@16010 637 <li>logical 'background-position' values (''background-position/start'', ''background-position/end'')
fantasai@13525 638 <li>the ''extend'' keyword of 'background-repeat'
fantasai@13525 639 <li>'corner-shape'
fantasai@13525 640 <li>multiple borders per element
fantasai@13533 641 <li>logical border properties
fantasai@13533 642 <li><a href="#partial-borders">Partial Borders</a> (make part of border shorthand as well!)
fantasai@16009 643 <li><a href="http://lists.w3.org/Archives/Public/www-style/2012Oct/0314.html">More <css>border-radius</css> shorthands</a> for doing both corners on a side at once.
fantasai@13533 644 <li>Splitting horizontal / vertical spread radius for box-shadow, if we can come up with a sane syntax for it.
fantasai@13525 645 </ul>
fantasai@1756 646
fantasai@1756 647 <h2 id="acknowledgments">Acknowledgments</h2>
fantasai@1756 648
fantasai@13525 649 <p>In addition to the many contributors to the [[CSS1]], [[CSS21]],
fantasai@13527 650 and [[CSS3BG]] predecessors to this module,
fantasai@13525 651 the editors would like to thank
fantasai@13525 652 Tab Atkins,
fantasai@13525 653 and HÃ¥kon Wium Lie
fantasai@13525 654 for their suggestions and feedback specifically for this Level 4.

mercurial