1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
<!DOCTYPE html>
<html>
<head>
<title>CSS white-space property</title>
<link rel="Stylesheet" href="css/reset-min.css">
<style>
#wrap { margin:30px auto; width:600px; font-family:sans-serif; color:#444; cursor:default; }
h1 { font-size:40px; text-align:center; font-weight:bold; margin-bottom:30px; text-shadow:0 0 3px #ddd; }
pre { background-color:#eee; margin:10px 0; padding:5px; }
p.demo { background-color:orange; width:100px; margin:10px 0; font-family:monospace; }
</style>
</head>
<body>
<div id="wrap">
<h1>CSS white-space property</h1>
<p> Given this CSS code: </p>
<pre>
p {
width:100px;
background-color:orange;
margin:10px 0;
font-family:monospace;
}
</pre>
<p> and this HTML code: </p>
<pre>
<p>
P
A
R
A
G
R
A
P
H
</p>
</pre>
<p> Depending on the white-space property, the resulting presentation will be: </p>
<hr>
<p> normal </p>
<p class="demo" style="white-space:normal">
P
A
R
A
G
R
A
P
H
</p>
<hr>
<p> nowrap </p>
<p class="demo" style="white-space:nowrap">
P
A
R
A
G
R
A
P
H
</p>
<hr>
<p> pre </p>
<p class="demo" style="white-space:pre">
P
A
R
A
G
R
A
P
H
</p>
<hr>
<p> pre-wrap </p>
<p class="demo" style="white-space:pre-wrap">
P
A
R
A
G
R
A
P
H
</p>
<hr>
<p> pre-line </p>
<p class="demo" style="white-space:pre-line">
P
A
R
A
G
R
A
P
H
</p>
</div>
</body>
</html>
|