Skip to content

Commit 5b242a8

Browse files
author
Tantek Çelik
committed
add CSS IS AWESOME example for text-overflow, clarify definition a bit, change (X)HTML references to HTML.
1 parent 99bfca0 commit 5b242a8

5 files changed

Lines changed: 156 additions & 19 deletions

File tree

css3-ui/Overview.html

Lines changed: 86 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@
5555
src="http://www.w3.org/Icons/w3c_home" width=72> </a>
5656
<h1>CSS Basic User Interface Module Level 3</h1>
5757

58-
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 23 January
58+
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 26 January
5959
2011</h2>
6060

6161
<dl>
6262
<dt>This version:</dt>
63-
<!-- <dd><a href="http://www.w3.org/TR/2011/ED-css3-ui-20110123">http://www.w3.org/TR/2011/ED-css3-ui-20110123</a></dd> -->
63+
<!-- <dd><a href="http://www.w3.org/TR/2011/ED-css3-ui-20110126">http://www.w3.org/TR/2011/ED-css3-ui-20110126</a></dd> -->
6464

6565
<dd><a
6666
href="http://dev.w3.org/csswg/css3-ui/">http://dev.w3.org/csswg/css3-ui/</a>
@@ -1091,8 +1091,8 @@ <h5 class="no-num no-toc" id=sample-css>sample CSS:</h5>
10911091
input::value { border:solid }
10921092
</code></pre>
10931093

1094-
<h5 class="no-num no-toc" id=an-xhtmlcss-approximation-of-this-exampl>an
1095-
(X)HTML+CSS approximation of this example</h5>
1094+
<h5 class="no-num no-toc" id=an-htmlcss-approximation-of-this-example>an
1095+
HTML+CSS approximation of this example</h5>
10961096

10971097
<p> <span style="border:dashed;display:inline-block;padding:10px"> <label
10981098
style="border:dotted;display:inline-block;padding:2px;margin:0;font-size:1em">Zip
@@ -1758,8 +1758,7 @@ <h5 class="no-num no-toc" id=sample-css0>sample CSS:</h5>
17581758
}
17591759
</code></pre>
17601760

1761-
<h5 class="no-num no-toc" id=sample-xhtml-fragment>sample (X)HTML
1762-
fragment:</h5>
1761+
<h5 class="no-num no-toc" id=sample-html-fragment>sample HTML fragment:</h5>
17631762

17641763
<pre><code>
17651764
&lt;input type="button" value="Plain button" /&gt;
@@ -2237,8 +2236,7 @@ <h5 class="no-num no-toc" id=sample-css1>sample CSS:</h5>
22372236
}
22382237
</code></pre>
22392238

2240-
<h5 class="no-num no-toc" id=sample-xhtml-fragment0>sample (X)HTML
2241-
fragment:</h5>
2239+
<h5 class="no-num no-toc" id=sample-html-fragment0>sample HTML fragment:</h5>
22422240

22432241
<pre><code>
22442242
&lt;div class="container"&gt;
@@ -2248,8 +2246,8 @@ <h5 class="no-num no-toc" id=sample-xhtml-fragment0>sample (X)HTML
22482246
</code></pre>
22492247

22502248
<h5 class="no-num no-toc"
2251-
id=demonstration-of-sample-css-and-xhtml>demonstration of sample CSS and
2252-
(X)HTML:</h5>
2249+
id=demonstration-of-sample-css-and-html>demonstration of sample CSS and
2250+
HTML:</h5>
22532251

22542252
<div style="width:38em; border:1em solid black">
22552253
<div style="box-sizing:border-box; width:50%; border:1em silver ridge;
@@ -2913,9 +2911,10 @@ <h3 id=text-overflow><span class=secno>9.2. </span> Overflow Ellipsis: the
29132911
<td>as specified
29142912
</table>
29152913

2916-
<p>This property specifies the behavior when text overflows its element
2917-
(e.g. has &lsquo;<code class=property>overflow</code>&rsquo; of hidden)
2918-
when text is prevented from wrapping (e.g. due to &lsquo;<code
2914+
<p>This property specifies the behavior when text overflows a block-level
2915+
element that has &lsquo;<code class=property>overflow</code>&rsquo; other
2916+
than &lsquo;<code class=property>visible</code>&rsquo;. Text may overflow
2917+
for example when it is prevented from wrapping (e.g. due to &lsquo;<code
29192918
class=css><code>white-space:nowrap</code></code>&rsquo; or a single word
29202919
is too long to fit). Values have the following meanings:
29212920

@@ -2939,6 +2938,80 @@ <h3 id=text-overflow><span class=secno>9.2. </span> Overflow Ellipsis: the
29392938
deeper descendants without text-overflow ellipsis).
29402939
</dl>
29412940

2941+
<div class=example>
2942+
<p style="display:none">Example(s):</p>
2943+
2944+
<h4 class="no-num no-toc" id=text-overflow-examples>text-overflow examples</h4>
2945+
2946+
<p>These examples demonstrate setting the text-overflow of a block-level
2947+
element that has text which overflows its dimensions:</p>
2948+
2949+
<h5 class="no-num no-toc" id=sample-css-for-a-div>sample CSS for a div:</h5>
2950+
2951+
<pre><code class=css>div { width:3.2em; border:solid .1em black; margin:1em 0; padding:.2em; font-family:Helvetica,sans-serif}
2952+
</code></pre>
2953+
2954+
<h5 class="no-num no-toc"
2955+
id=sample-html-fragments-renderings-and-you>sample HTML fragments,
2956+
renderings, and your browser:</h5>
2957+
2958+
<table border=1 cellpadding=5>
2959+
<tbody>
2960+
<tr>
2961+
<th>HTML
2962+
2963+
<th>sample rendering
2964+
2965+
<th>your browser
2966+
2967+
<tr>
2968+
<td>
2969+
<pre><code>&lt;div&gt;
2970+
CSS IS AWESOME
2971+
&lt;/div&gt;
2972+
</code></pre>
2973+
2974+
<td> <object data=cssisawesome.png type="image/png"> First, a box with
2975+
text drawing outside of it. </object>
2976+
2977+
<td>
2978+
<div style="width:3.2em; border:solid .1em black; margin:1em 0;
2979+
padding:.2em; font-family:Helvetica,sans-serif;">CSS IS AWESOME</div>
2980+
2981+
<tr>
2982+
<td>
2983+
<pre><code>&lt;div style="<a href="#clip"><strong>text-overflow:clip;</strong></a> overflow:hidden"&gt;
2984+
CSS IS AWESOME
2985+
&lt;/div&gt;
2986+
</code></pre>
2987+
2988+
<td> <object data=cssisaweso.png type="image/png"> Second, a similar
2989+
box with the text clipped outside the box. </object>
2990+
2991+
<td>
2992+
<div style="width:3.2em; border:solid .1em black; margin:1em 0;
2993+
padding:.2em;
2994+
font-family:Helvetica,sans-serif;overflow:hidden;text-overflow:clip;">CSS
2995+
IS AWESOME</div>
2996+
2997+
<tr>
2998+
<td>
2999+
<pre><code>&lt;div style="<a href="#ellipsis"><strong>text-overflow:ellipsis;</strong></a> overflow:hidden"&gt;
3000+
CSS IS AWESOME
3001+
&lt;/div&gt;
3002+
</code></pre>
3003+
3004+
<td> <object data=cssisaw.png type="image/png"> Third, a similar box
3005+
with an ellipsis representing the clipped text. </object>
3006+
3007+
<td>
3008+
<div style="width:3.2em; border:solid .1em black; margin:1em 0;
3009+
padding:.2em;
3010+
font-family:Helvetica,sans-serif;overflow:hidden;text-overflow:ellipsis;">CSS
3011+
IS AWESOME</div>
3012+
</table>
3013+
</div>
3014+
29423015
<h2 id=pointing-devices-and-keyboards><span class=secno>10. </span>Pointing
29433016
Devices and Keyboards</h2>
29443017

css3-ui/Overview.src.html

Lines changed: 70 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ <h5 class="no-num no-toc">sample CSS:</h5>
625625
input::value { border:solid }
626626
</code></pre>
627627

628-
<h5 class="no-num no-toc">an (X)HTML+CSS approximation of this example</h5>
628+
<h5 class="no-num no-toc">an HTML+CSS approximation of this example</h5>
629629
<p>
630630
<span style="border:dashed;display:inline-block;padding:10px">
631631
<label
@@ -989,7 +989,7 @@ <h5 class="no-num no-toc">sample CSS:</h5>
989989
background-color: #9cf;
990990
}
991991
</code></pre>
992-
<h5 class="no-num no-toc">sample (X)HTML fragment:</h5>
992+
<h5 class="no-num no-toc">sample HTML fragment:</h5>
993993
<pre><code>
994994
&lt;input type="button" value="Plain button" /&gt;
995995
&lt;input type="button" value="With color" class="custom" /&gt;
@@ -1220,14 +1220,14 @@ <h5 class="no-num no-toc">sample CSS:</h5>
12201220
float:left;
12211221
}
12221222
</code></pre>
1223-
<h5 class="no-num no-toc">sample (X)HTML fragment:</h5>
1223+
<h5 class="no-num no-toc">sample HTML fragment:</h5>
12241224
<pre><code>
12251225
&lt;div class="container"&gt;
12261226
&lt;div class="split"&gt;This div occupies the left half.&lt;/div&gt;
12271227
&lt;div class="split"&gt;This div occupies the right half.&lt;/div&gt;
12281228
&lt;/div&gt;
12291229
</code></pre>
1230-
<h5 class="no-num no-toc">demonstration of sample CSS and (X)HTML:</h5>
1230+
<h5 class="no-num no-toc">demonstration of sample CSS and HTML:</h5>
12311231
<div style="width:38em; border:1em solid black"><div style="box-sizing:border-box; width:50%; border:1em silver ridge; float:left">This div should occupy the left half.</div><div style="box-sizing:border-box; width:50%; border:1em silver ridge; float:left">This div should occupy the right half.</div>The two divs above should appear side by side, each (including borders) 50% of the content width of their container. If instead they are stacked one on top of the other then your browser does not support <span class="property">'box-sizing'</span>.
12321232
</div>
12331233
</div>
@@ -1537,8 +1537,8 @@ <h3 id="text-overflow">
15371537
<td>as specified</td></tr>
15381538
</tbody></table>
15391539

1540-
<p>This property specifies the behavior when text overflows its
1541-
element (e.g. has 'overflow' of hidden) when text is prevented from wrapping (e.g. due to '<code>white-space:nowrap</code>' or a single word is too long to fit). Values have the following meanings:</p>
1540+
<p>This property specifies the behavior when text overflows a block-level
1541+
element that has 'overflow' other than 'visible'. Text may overflow for example when it is prevented from wrapping (e.g. due to '<code>white-space:nowrap</code>' or a single word is too long to fit). Values have the following meanings:</p>
15421542

15431543
<dl>
15441544
<dt><dfn title="text-overflow:clip"><code>clip</code></dfn></dt>
@@ -1548,6 +1548,70 @@ <h3 id="text-overflow">
15481548
<dd>Render an ellipsis character (U+2026) to represent clipped text, just before where the text would be otherwise clipped (in the direction of the flow of the text being clipped), replacing however many characters are necessary for the ellipsis to fit. If there is insufficient space for the ellipsis itself to fit, then clip the rendering of the ellipsis itself. Implementations may substitute a more language/script-appropriate ellipsis character. Implementations may render three dots "..." instead if the ellipsis character is unavailable. The ellipsis is styled according to the element with text-overflow ellipsis (rather than any deeper descendants without text-overflow ellipsis).</dd>
15491549
</dl>
15501550

1551+
<div class="example"><p style="display:none">Example(s):</p>
1552+
<h4 class="no-num no-toc">text-overflow examples</h4>
1553+
<p>These examples demonstrate setting the text-overflow of a block-level element that has text which overflows its dimensions:
1554+
</p>
1555+
<h5 class="no-num no-toc">sample CSS for a div:</h5>
1556+
<pre><code class="css">div { width:3.2em; border:solid .1em black; margin:1em 0; padding:.2em; font-family:Helvetica,sans-serif}
1557+
</code></pre>
1558+
<h5 class="no-num no-toc">sample HTML fragments, renderings, and your browser:</h5>
1559+
<table border="1" cellpadding="5"><tbody>
1560+
<tr><th>HTML</th><th>sample rendering</th><th>your browser</th></tr>
1561+
<tr>
1562+
<td><pre><code>&lt;div&gt;
1563+
CSS IS AWESOME
1564+
&lt;/div&gt;
1565+
</code></pre></td>
1566+
1567+
1568+
<td>
1569+
<object type="image/png" data="cssisawesome.png">
1570+
First, a box with text drawing outside of it.
1571+
</object>
1572+
</td>
1573+
1574+
<td>
1575+
<div style="width:3.2em; border:solid .1em black; margin:1em 0; padding:.2em; font-family:Helvetica,sans-serif;">CSS IS AWESOME</div>
1576+
</td>
1577+
</tr>
1578+
1579+
<tr>
1580+
<td><pre><code>&lt;div style="<strong>text-overflow:clip;</strong> overflow:hidden"&gt;
1581+
CSS IS AWESOME
1582+
&lt;/div&gt;
1583+
</code></pre></td>
1584+
1585+
<td>
1586+
<object type="image/png" data="cssisaweso.png">
1587+
Second, a similar box with the text clipped outside the box.
1588+
</object></td>
1589+
1590+
<td>
1591+
<div style="width:3.2em; border:solid .1em black; margin:1em 0; padding:.2em; font-family:Helvetica,sans-serif;overflow:hidden;text-overflow:clip;">CSS IS AWESOME</div>
1592+
</td>
1593+
</tr>
1594+
1595+
<tr>
1596+
<td><pre><code>&lt;div style="<strong>text-overflow:ellipsis;</strong> overflow:hidden"&gt;
1597+
CSS IS AWESOME
1598+
&lt;/div&gt;
1599+
</code></pre></td>
1600+
1601+
<td>
1602+
<object type="image/png" data="cssisaw.png">
1603+
Third, a similar box with an ellipsis representing the clipped text.
1604+
</object>
1605+
</td>
1606+
1607+
<td>
1608+
<div style="width:3.2em; border:solid .1em black; margin:1em 0; padding:.2em; font-family:Helvetica,sans-serif;overflow:hidden;text-overflow:ellipsis;">CSS IS AWESOME</div>
1609+
</td>
1610+
</tr>
1611+
</tbody></table>
1612+
1613+
</div>
1614+
15511615

15521616
<h2>Pointing Devices and Keyboards</h2>
15531617

css3-ui/cssisaw.png

7.61 KB
Loading

css3-ui/cssisaweso.png

7.66 KB
Loading

css3-ui/cssisawesome.png

8.37 KB
Loading

0 commit comments

Comments
 (0)