blob: 7ec6efcfcb6feec0bd99108bdfb7c29b392f0c14 (
plain)
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
|
---
title: hanging-punctuation
slug: Web/CSS/hanging-punctuation
tags:
- css css属性 css文本
translation_of: Web/CSS/hanging-punctuation
---
<div>{{cssref}}</div>
<div><strong><code>hanging-punctuation </code></strong>CSS属性指定了标点符号应该放在文本句子的开头还是结尾。悬挂标点符号可能被放在线框外。</div>
<pre class="brush:css no-line-numbers notranslate">/* Keyword values */
hanging-punctuation: none;
hanging-punctuation: first;
hanging-punctuation: last;
hanging-punctuation: force-end;
hanging-punctuation: allow-end;
/* Two keywords */
hanging-punctuation: first force-end;
hanging-punctuation: first allow-end;
hanging-punctuation: first last;
hanging-punctuation: last force-end;
hanging-punctuation: last allow-end;
/* Three keywords */
hanging-punctuation: first force-end last;
hanging-punctuation: first allow-end last;
/* Global values */
hanging-punctuation: inherit;
hanging-punctuation: initial;
hanging-punctuation: unset;
</pre>
<p>{{cssinfo}}</p>
<h2 id="语法">语法</h2>
<p>这个属性可被指定多个值,可以是一个值,也可以是两个值,或者是三个值。</p>
<ul>
<li>一个值 语法:在下面列表中的任意一个值。</li>
<li>两个值 语法:
<ul>
<li>或者与以下任何一个一起使用,并以它们结尾:last,allow-end或force-end</li>
<li>或者与以下任何一个一起使用,并以它们开头:first,allow-end或force-end。</li>
</ul>
</li>
<li>三个值 语法:
<ul>
<li>或者<code>first</code>, <code>allow-end</code>, 和<code>last</code></li>
<li>或者 <code>first</code>, <code>force-end</code>, 和 <code>last</code>.</li>
</ul>
</li>
</ul>
<h3 id="取值">取值</h3>
<dl>
<dt><code>none</code></dt>
<dd>无悬挂字符。</dd>
<dt><code>first</code></dt>
<dd>显示元素的第一个格式化行开头的括号或引号。</dd>
<dt><code>last</code></dt>
<dd>显示元素的最后一个格式化行结尾的括号或引号。</dd>
<dt><code>force-end</code></dt>
<dd>显示行结尾处的句号或逗号。</dd>
<dt><code>allow-end</code></dt>
<dd>如果预先没有其它适合的来适应的,则在行尾显示句号或逗号。</dd>
</dl>
<h3 id="正式语法">正式语法</h3>
{{csssyntax}}
<h2 id="示例">示例</h2>
<h3 id="HTML">HTML</h3>
<pre class="brush: html notranslate"><p>“Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur dignissim nunc mauris, et sollicitudin est scelerisque sed. Praesent laoreet tortor massa, sit amet vulputate nulla pharetra ut.”</p></pre>
<h3 id="CSS">CSS</h3>
<pre class="brush: css notranslate">p {
hanging-punctuation: first;
margin: .5rem;
}</pre>
<h3 id="Result">Result</h3>
<h2 id="Specifications">Specifications</h2>
<ul>
<li><a href="https://www.w3.org/TR/css-text-3/#hanging-punctuation-property">CSS Text Module Level 3 (Working Draft, 10-Oct-2013)</a></li>
<li><a href="https://drafts.csswg.org/css-text-3/#hanging-punctuation-property">CSS Text Module Level 3 (Editor’s Draft, 03-May-2017)</a></li>
</ul>
|