diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/css/list-style-position/index.html | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/css/list-style-position/index.html')
-rw-r--r-- | files/zh-cn/web/css/list-style-position/index.html | 162 |
1 files changed, 162 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/list-style-position/index.html b/files/zh-cn/web/css/list-style-position/index.html new file mode 100644 index 0000000000..eb83b0b108 --- /dev/null +++ b/files/zh-cn/web/css/list-style-position/index.html @@ -0,0 +1,162 @@ +--- +title: list-style-position +slug: Web/CSS/list-style-position +translation_of: Web/CSS/list-style-position +--- +<div>{{CSSRef}}</div> + +<p> <strong><code>list-style-position</code></strong> 属性指定标记框在主体块框中的位置。</p> + +<p>使用助记符{{cssxref("list-style")}}更方便。</p> + +<p>{{cssinfo}}</p> + +<h2 id="语法">语法</h2> + +<pre class="brush:css notranslate">/* Keyword values */ +list-style-position: inside; +list-style-position: outside; + +/* Global values */ +list-style-position: inherit; +list-style-position: initial; +list-style-position: unset; +</pre> + +<h3 id="数值">数值</h3> + +<dl> + <dt><code>outside</code></dt> + <dd>标记盒在主块盒的外面。</dd> + <dt><code>inside</code></dt> + <dd>标记盒是主要块盒中的第一个行内盒,处于元素的内容流之后。</dd> +</dl> + +<h3 id="Formal_syntax">Formal syntax</h3> + +<pre class="syntaxbox notranslate">{{csssyntax}}</pre> + +<h2 id="例子">例子</h2> + +<h3 id="HTML">HTML</h3> + +<pre class="brush: html notranslate"><ul class="one"> List 1 + <li>List Item 1-1</li> + <li>List Item 1-2</li> + <li>List Item 1-3</li> + <li>List Item 1-4</li> +</ul> +<ul class="two"> List 2 + <li>List Item 2-1</li> + <li>List Item 2-2</li> + <li>List Item 2-3</li> + <li>List Item 2-4</li> +</ul> +<ul class="three"> List 3 + <li>List Item 3-1</li> + <li>List Item 3-2</li> + <li>List Item 3-3</li> + <li>List Item 3-4</li> +</ul></pre> + +<h3 id="CSS">CSS</h3> + +<pre class="brush:css; notranslate">.one { + list-style:square inside; +} + +.two { + list-style-position: outside; + list-style-type: circle; +} + +.three { + list-style-image: url("https://mdn.mozillademos.org/files/11979/starsolid.gif"); + list-style-position: inherit; +}</pre> + +<h3 id="Result">Result</h3> + +<p>{{EmbedLiveSample("例子","200","420")}}</p> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('CSS3 Lists', '#list-style-position-property', 'list-style-position')}}</td> + <td>{{Spec2('CSS3 Lists')}}</td> + <td>No change.</td> + </tr> + <tr> + <td>{{SpecName('CSS2.1', 'generate.html#propdef-list-style-position', 'list-style-position')}}</td> + <td>{{Spec2('CSS2.1')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<p>{{CompatibilityTable}}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari (WebKit)</th> + </tr> + <tr> + <td>Basic support</td> + <td>1.0</td> + <td>1.0 (1.0)</td> + <td>4.0</td> + <td>3.5</td> + <td>1.0 (85)</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Phone</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<p>N.B. There is variance among browsers regarding behaviour when a block element is placed first within a list element declared as <code>list-style-position:inside</code>. Chrome and Safari both place this element on the same line as the marker box, whereas Firefox, Internet Explorer and Opera place it on the next line. For more information on this, see this <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=36854">Mozilla Bug</a> report and an <a href="http://jsfiddle.net/hydrurga/MAS7j/">example</a>.</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li>{{Cssxref("list-style")}}, {{Cssxref("list-style-type")}}, {{Cssxref("list-style-image")}}</li> +</ul> |