diff options
author | Florian Merz <me@fiji-flo.de> | 2021-02-11 12:56:40 +0100 |
---|---|---|
committer | Florian Merz <me@fiji-flo.de> | 2021-02-11 12:56:40 +0100 |
commit | 310fd066e91f454b990372ffa30e803cc8120975 (patch) | |
tree | d5d900deb656a5da18e0b60d00f0db73f3a2e88e /files/zh-cn/learn/css | |
parent | 8260a606c143e6b55a467edf017a56bdcd6cba7e (diff) | |
download | translated-content-310fd066e91f454b990372ffa30e803cc8120975.tar.gz translated-content-310fd066e91f454b990372ffa30e803cc8120975.tar.bz2 translated-content-310fd066e91f454b990372ffa30e803cc8120975.zip |
unslug zh-cn: move
Diffstat (limited to 'files/zh-cn/learn/css')
-rw-r--r-- | files/zh-cn/learn/css/building_blocks/a_cool_looking_box/index.html (renamed from files/zh-cn/learn/css/styling_boxes/a_cool_looking_box/index.html) | 0 | ||||
-rw-r--r-- | files/zh-cn/learn/css/building_blocks/creating_fancy_letterheaded_paper/index.html (renamed from files/zh-cn/learn/css/styling_boxes/creating_fancy_letterheaded_paper/index.html) | 0 | ||||
-rw-r--r-- | files/zh-cn/learn/css/building_blocks/fundamental_css_comprehension/index.html (renamed from files/zh-cn/learn/css/introduction_to_css/fundamental_css_comprehension/index.html) | 0 | ||||
-rw-r--r-- | files/zh-cn/learn/css/building_blocks/handling_different_text_directions/index.html (renamed from files/zh-cn/learn/css/building_blocks/处理_不同_方向的_文本/index.html) | 0 | ||||
-rw-r--r-- | files/zh-cn/learn/css/css_layout/legacy_layout_methods/index.html (renamed from files/zh-cn/learn/css/css_layout/传统的布局方法/index.html) | 0 | ||||
-rw-r--r-- | files/zh-cn/learn/css/css_layout/positioning/index.html (renamed from files/zh-cn/learn/css/css_layout/定位/index.html) | 0 | ||||
-rw-r--r-- | files/zh-cn/learn/css/first_steps/getting_started/index.html (renamed from files/zh-cn/learn/css/first_steps/开始/index.html) | 0 | ||||
-rw-r--r-- | files/zh-cn/learn/css/first_steps/how_css_works/index.html (renamed from files/zh-cn/learn/css/first_steps/css如何运行/index.html) | 0 | ||||
-rw-r--r-- | files/zh-cn/learn/css/howto/css_faq/index.html | 183 | ||||
-rw-r--r-- | files/zh-cn/learn/css/howto/generated_content/index.html | 160 | ||||
-rw-r--r-- | files/zh-cn/learn/css/styling_text/fundamentals/index.html (renamed from files/zh-cn/learn/css/为文本添加样式/fundamentals/index.html) | 0 | ||||
-rw-r--r-- | files/zh-cn/learn/css/styling_text/index.html (renamed from files/zh-cn/learn/css/为文本添加样式/index.html) | 0 | ||||
-rw-r--r-- | files/zh-cn/learn/css/styling_text/styling_links/index.html (renamed from files/zh-cn/learn/css/为文本添加样式/styling_links/index.html) | 0 | ||||
-rw-r--r-- | files/zh-cn/learn/css/styling_text/styling_lists/index.html (renamed from files/zh-cn/learn/css/为文本添加样式/styling_lists/index.html) | 0 | ||||
-rw-r--r-- | files/zh-cn/learn/css/styling_text/typesetting_a_homepage/index.html (renamed from files/zh-cn/learn/css/为文本添加样式/typesetting_a_homepage/index.html) | 0 | ||||
-rw-r--r-- | files/zh-cn/learn/css/styling_text/web_fonts/index.html (renamed from files/zh-cn/learn/css/为文本添加样式/web_字体/index.html) | 0 |
16 files changed, 343 insertions, 0 deletions
diff --git a/files/zh-cn/learn/css/styling_boxes/a_cool_looking_box/index.html b/files/zh-cn/learn/css/building_blocks/a_cool_looking_box/index.html index 6ddd1d114b..6ddd1d114b 100644 --- a/files/zh-cn/learn/css/styling_boxes/a_cool_looking_box/index.html +++ b/files/zh-cn/learn/css/building_blocks/a_cool_looking_box/index.html diff --git a/files/zh-cn/learn/css/styling_boxes/creating_fancy_letterheaded_paper/index.html b/files/zh-cn/learn/css/building_blocks/creating_fancy_letterheaded_paper/index.html index 692071dfde..692071dfde 100644 --- a/files/zh-cn/learn/css/styling_boxes/creating_fancy_letterheaded_paper/index.html +++ b/files/zh-cn/learn/css/building_blocks/creating_fancy_letterheaded_paper/index.html diff --git a/files/zh-cn/learn/css/introduction_to_css/fundamental_css_comprehension/index.html b/files/zh-cn/learn/css/building_blocks/fundamental_css_comprehension/index.html index b246af87fe..b246af87fe 100644 --- a/files/zh-cn/learn/css/introduction_to_css/fundamental_css_comprehension/index.html +++ b/files/zh-cn/learn/css/building_blocks/fundamental_css_comprehension/index.html diff --git a/files/zh-cn/learn/css/building_blocks/处理_不同_方向的_文本/index.html b/files/zh-cn/learn/css/building_blocks/handling_different_text_directions/index.html index f907c93a3c..f907c93a3c 100644 --- a/files/zh-cn/learn/css/building_blocks/处理_不同_方向的_文本/index.html +++ b/files/zh-cn/learn/css/building_blocks/handling_different_text_directions/index.html diff --git a/files/zh-cn/learn/css/css_layout/传统的布局方法/index.html b/files/zh-cn/learn/css/css_layout/legacy_layout_methods/index.html index 58313b6fdd..58313b6fdd 100644 --- a/files/zh-cn/learn/css/css_layout/传统的布局方法/index.html +++ b/files/zh-cn/learn/css/css_layout/legacy_layout_methods/index.html diff --git a/files/zh-cn/learn/css/css_layout/定位/index.html b/files/zh-cn/learn/css/css_layout/positioning/index.html index cbfa094300..cbfa094300 100644 --- a/files/zh-cn/learn/css/css_layout/定位/index.html +++ b/files/zh-cn/learn/css/css_layout/positioning/index.html diff --git a/files/zh-cn/learn/css/first_steps/开始/index.html b/files/zh-cn/learn/css/first_steps/getting_started/index.html index 0a6087ee12..0a6087ee12 100644 --- a/files/zh-cn/learn/css/first_steps/开始/index.html +++ b/files/zh-cn/learn/css/first_steps/getting_started/index.html diff --git a/files/zh-cn/learn/css/first_steps/css如何运行/index.html b/files/zh-cn/learn/css/first_steps/how_css_works/index.html index 7aafcf481f..7aafcf481f 100644 --- a/files/zh-cn/learn/css/first_steps/css如何运行/index.html +++ b/files/zh-cn/learn/css/first_steps/how_css_works/index.html diff --git a/files/zh-cn/learn/css/howto/css_faq/index.html b/files/zh-cn/learn/css/howto/css_faq/index.html new file mode 100644 index 0000000000..0e0593054b --- /dev/null +++ b/files/zh-cn/learn/css/howto/css_faq/index.html @@ -0,0 +1,183 @@ +--- +title: CSS 常见问题 +slug: Web/CSS/Common_CSS_Questions +translation_of: Learn/CSS/Howto/CSS_FAQ +--- +<h2 id="为什么我有效的CSS没有正确的渲染?">为什么我有效的CSS没有正确的渲染?</h2> + +<p>浏览器使用DOCTYPE声明来选择是否使用更符合Web标准或兼容旧浏览器的bug的模式。在你的HTML的开始使用一个正确的和现代的DOCTYPE声明将改善浏览器标准执行。</p> + +<p>现代浏览器主要有两种渲染模式:</p> + +<ul> + <li><em>怪异模式:</em> 又称向后兼容模式,,允许将传统网页渲染为作者意图。 旧浏览器使用的非标准渲染规则。 不完整的、不正确的、缺少DOCTYPE声明或已知的DOCTYPE声明中普遍使用2001年以前的文件将在怪异模式中呈现。</li> + <li><em>标准模式:</em>浏览器试图严格遵守W3C标准。新HTML网页有望被设计为符合标准的浏览器,这样做的结果就是,用现代DOCTYPE声明的页面将被用标准模式呈现。</li> +</ul> + +<p>基于Gecko的浏览器, 有三分之一 <em><a href="https://developer.mozilla.org/en-US/docs/Gecko's_%22Almost_Standards%22_Mode">Almost Standards Mode</a></em>, 只有一些小怪癖。</p> + +<p>这是最常用的触发标准模式或准标准模式的DOCTYPE声明列表:</p> + +<pre><!DOCTYPE html> /* 这一行是 HTML5 的 doctype 声明。,使用该声明会使现代浏览器使用 + HTML5 解析器处理页面,这是推荐的 doctype 声明。*/ + +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" +"http://www.w3.org/TR/html4/loose.dtd"> + +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" +"http://www.w3.org/TR/html4/strict.dtd"> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" +"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" +"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +</pre> + +<h2 id="My_CSS_is_valid.2C_but_not_correctly_rendered" name="My_CSS_is_valid.2C_but_not_correctly_rendered">为什么我有效的css完全没有被渲染? </h2> + +<p>为了使浏览器渲染样式文件,CSS样式表必须用text/css的MIME。如果Web服务器不服务于这种类型,则CSS也不会被应用。</p> + +<h2 id="Difference_between_id_and_class" name="Difference_between_id_and_class">id和class有什么不同?</h2> + +<p>HTML元素可以拥有一个id/或class属性。 id属性为元素指定应用一个有效名称,只能有一个具有该名称的元素。class属性指定一个类名的元素,而这个名称可以被页面内的许多元素被使用。 CSS允许你可以对特定的id和/或类名的元素应用样式。<br> + <br> + 当你想给一个特定元素或块应用样式规则时就使用ID选择符。此样式将只用于与该特定id匹配的元素。</p> + +<p><br> + 当你想要将样式规则应用于多个块和元素时,你应该使用class选择符。</p> + +<p>较少样式的样式表通常性能更高。因此建议尽可能多地使用类, 保留id作为特定用途 (比如链接label标签和form元素或者为语义上唯一的元素应用样式)。</p> + +<p>查看 <a href="/en/CSS/Getting_Started/Selectors" title="en/CSS/Getting_Started/Selectors">CSS selectors</a></p> + +<h2 id="Restoring_the_default_property_value" name="Restoring_the_default_property_value">我如何还原属性的默认值?</h2> + +<p>最初CSS没有提供“defaule”关键字和还原默认属性的值,唯一途径是显式地重新声明该属性。</p> + +<p>与CSS2相比,已经发生了改变。 关键字 <a href="/es/CSS/initial" title="initial">initial</a> 现在是一个有效的CSS属性。它将给定的CSS属性值重置为默认值。</p> + +<h2 id="Derived_styles" name="Derived_styles">我如何才可以从一个样式中衍生出另一种样式?</h2> + +<p>CSS 不允许这样做。(See <a class="external" href="http://archivist.incutio.com/viewlist/css-discuss/2685">Eric Meyer's note about the Working Group's stance)</a>. 但是,将多个类分配给单个元素,可以提供相同的效果。</p> + +<h2 id="Assigning_multiple_classes" name="Assigning_multiple_classes">我该如何给一个元素分配多个类?</h2> + +<p>HTML元素可以通过列出的类属性,用空格分开它们。</p> + +<pre><style type="text/css"> +.news { background: black; color: white; } +.today { font-weight: bold; } +</style> + +<div class="news today"> +... content of today's news ... +</div> +</pre> + +<p>如果相同的属性中声明的规则,解决冲突首先通过特异性,然后根据CSS声明的顺序。在class属性类的顺序是不相关的。</p> + +<h2 id="Style_rules_that_don.27t_work" name="Style_rules_that_don.27t_work">为什么我的样式规则不能正确地工作?</h2> + +<p>在语法上正确的样式规则可能在某些情况下不适用。你可以使用 <a href="/en/DOM_Inspector" title="en/DOM_Inspector">DOM Inspector</a>'s <em>CSS Style Rules</em> 调试这类问题。 下面列出了最常见的忽略样式规则的实例:</p> + +<h3 id="HTML_elements_hierarchy" name="HTML_elements_hierarchy">HTML元素层次结构</h3> + +<p>The way CSS styles are applied to HTML elements depends also on the elements hierarchy. It is important to remember that a rule applied to a descendent overrides the style of the parent, in spite of any specificity or priority of CSS rules.</p> + +<pre>.news { color: black; } +.corpName { font-weight: bold; color: red; } + +<!-- news item text is black, but corporate name is red and in bold --> +<div class="news"> + (Reuters) <span class="corpName">General Electric</span> (GE.NYS) announced on Thursday... +</div> +</pre> + +<p>In case of complex HTML hierarchies, if a rule seems to be ignored, check if the element is inside another element with a different style.</p> + +<h3 id="Explicitly_re-defined_style_rule" name="Explicitly_re-defined_style_rule">显式重定义样式规则</h3> + +<p>In CSS stylesheets, order <strong>is</strong> important. If you define a rule and then you re-define the same rule, the last definition is used.</p> + +<pre>#stockTicker { font-weight: bold; } +.stockSymbol { color: red; } +/* other rules */ +/* other rules */ +/* other rules */ +.stockSymbol { font-weight: normal; } + +<!-- most text is in bold, except "GE", which is red and not bold --> +<div id="stockTicker"> + NYS: <span class="stockSymbol">GE</span> +1.0 ... +</div> +</pre> + +<p>To avoid this kind of error, try to define rules only once for a certain selector, and group all rules belonging to that selector.</p> + +<h3 id="Use_of_a_shorthand_property" name="Use_of_a_shorthand_property">使用便捷属性</h3> + +<p>Using shorthand properties for defining style rules is good because it uses a very compact syntax. Using shorthand with only some attributes is possible and correct, but it must be remembered that undeclared attributes are automatically reset to default. This means that a previous rule for a single attribute could be implicitly overridden.</p> + +<pre>#stockTicker { font-size: 12px; font-family: Verdana; font-weight: bold; } +.stockSymbol { font: 14px Arial; color: red; } + +<div id="stockTicker"> + NYS: <span class="stockSymbol">GE</span> +1.0 ... +</div> +</pre> + +<p>In the previous example the problem occurred on rules belonging to different elements, but it could happen also for the same element, because rule order <strong>is</strong> important.</p> + +<pre>#stockTicker { + font-weight: bold; + font: 12px Verdana; /* font-weight is now normal */ +} +</pre> + +<h3 id="Use_of_the_.2A_selector" name="Use_of_the_.2A_selector">使用 <code>*</code> 选择器</h3> + +<p>The <code>*</code> wildcard selector refers to any element, and it has to be used with particular care.</p> + +<pre>body * { font-weight: normal; } +#stockTicker { font: 12px Verdana; } +.corpName { font-weight: bold; } +.stockUp { color: red; } + +<div id="section"> + NYS: <span class="corpName"><span class="stockUp">GE</span></span> +1.0 ... +</div> +</pre> + +<p>In this example the <code>body *</code> selector applies the rule to all elements inside body, at any hierarchy level, including the .stockUp class. So <code>font-weight: bold;</code> applied to the .corpName class is overridden by <code>font-weight: normal;</code> applied to all elements in the body.</p> + +<p>The use of the * selector should be minimized as it is a slow selector, especially when not used as the first element of a selector. Its use should be avoided as much as possible.</p> + +<h3 id="Specificity_in_CSS" name="Specificity_in_CSS">CSS 中的优先级</h3> + +<p>When multiples rules apply to a certain element, the rule chosen depends on its style <a href="/en/CSS/Specificity" title="Specificity">specificity</a>. Inline style (in HTML <code>style</code> attributes) comes first, followed by ID selectors, then class selectors and eventually element-name selectors.</p> + +<pre>div { color: black; } +#orange { color: orange; } +.green { color: green; } + +<div id="orange" class="green" style="color: red;">This is red</div> +</pre> + +<p>The rules are more complicated when the selector has multiple parts. More detailed information about how selector specificity is calculated can be found in the <a class="external" href="http://www.w3.org/TR/CSS21/cascade.html#specificity">CSS 2.1 Specification chapter 6.4.3</a></p> + +<h2 id="What_do_the_-moz-.2A_properties_do.3F" name="What_do_the_-moz-.2A_properties_do.3F"> -moz-*, -ms-*, -webkit-*, -o-* 以及 -khtml-* 属性有什么用?</h2> + +<h2 id="What_do_the_-moz-.2A_properties_do.3F" name="What_do_the_-moz-.2A_properties_do.3F"><span style="font-size: 14px; font-weight: normal; line-height: 1.5;">These properties, called </span><em>prefixed properties</em><span style="font-size: 14px; font-weight: normal; line-height: 1.5;">, are extension to the CSS standard. They are used to use experimental and non-standard features without polluting the regular namespace, preventing future incompatibilities to arise when the standard is extended.</span></h2> + +<p>The use of such properties on production websites is not recommended. If nevertheless needed, you are hinted to make a plan for the website evolution: these prefixed properties can be modified or even suppressed when the standard evolve.</p> + +<p>Please see the <a class="internal" href="/en/CSS/CSS_Reference/Mozilla_Extensions" title="en/CSS Reference/Mozilla Extensions">Mozilla CSS Extensions</a> page for more information on the Mozilla-prefixed CSS properties.</p> + +<h2 id="z-index_属性与定位有什么关系?">z-index 属性与定位有什么关系?</h2> + +<p>z-index属性指定了元素的栈序。</p> + +<p>有较高z-index/栈序的元素总是在有着较低z-index/栈序的元素之前。</p> + +<p>z-index只会在有着指定position (<code>position:absolute</code>, <code>position:relative</code>, or <code>position:fixed</code>)的元素上工作。</p> diff --git a/files/zh-cn/learn/css/howto/generated_content/index.html b/files/zh-cn/learn/css/howto/generated_content/index.html new file mode 100644 index 0000000000..f3f9a0797b --- /dev/null +++ b/files/zh-cn/learn/css/howto/generated_content/index.html @@ -0,0 +1,160 @@ +--- +title: Content +slug: Web/Guide/CSS/Getting_started/Content +translation_of: Learn/CSS/Howto/Generated_content +--- +<p>{{ CSSTutorialTOC() }}</p> + +<p>{{ previousPage("/zh-CN/docs/Web/Guide/CSS/Getting_Started/Color", "颜色") }}<span class="seoSummary">这是 <a href="/en-US/docs/Web/Guide/CSS/Getting_Started" title="en-US/docs/Web/Guide/CSS/Getting Started">CSS 入门教程</a>的第9部分,介绍了一些通过CSS改变文档内容的方法。这样,仅修改样式表你就能把文本内容及图片添加到文档。</span></p> + +<h2 class="clearLeft" id="信息_内容">信息: 内容</h2> + +<p>CSS的一个重要优势是它可以帮助你将文档内容和其样式分离。但是有时候在样式而非文档中定义一些内容也是很有用的。</p> + +<p>在样式中可以定义文本内容和图片内容。当内容与文档结构紧密相关的时候,你可以在样式表中指定内容。</p> + +<div class="tuto_details"> +<div class="tuto_type">更多细节</div> + +<p>在样式表中指定内容会使事情变得复杂:你可能有多个语言版本的文档共享同一个样式表。如果样式表的一部分需要翻译,这就意味着你需要将这部分单独保存在多个样式表中,并在不同语言的文档中引用。</p> + +<p>如果你指定的内容由通用符号和图片组成的话,就不存在这个问题。</p> + +<p>样式表中指定的内容不会成为DOM的一部分。</p> +</div> + +<h3 id="文本内容">文本内容</h3> + +<p>CSS可以在元素的前后插入文本:在选择器的后面加上{{ cssxref("::before") }} 或者 {{ cssxref("::after") }} 。在声明中,指定 {{ cssxref("content") }} 属性,并设置文本内容。</p> + +<div class="tuto_example"> +<div class="tuto_type">例</div> + +<p>下面这条规则在所有类名包含 <span style="font-family: courier new,andale mono,monospace; line-height: normal;">ref的元素前面加上</span><span style="line-height: 1.5;"> </span><strong style="color: navy; font-weight: bold; line-height: 1.5;">Reference:</strong></p> + +<pre class="brush:css">.ref::before { + font-weight: bold; + color: navy; + content: "Reference: "; +} +</pre> +</div> + +<div class="tuto_details"> +<div class="tuto_type">更多细节</div> + +<p>样式表默认使用UTF-8字符集。也可以通过link属性或样式表以及其他方式指定。 参见 CSS规范中 <a class="external" href="http://www.w3.org/TR/CSS21/syndata.html#q23">4.4 CSS style sheet representation</a></p> + +<p>还可以通过转义机制(通过反斜杠转义)指定单个字符。<span style="line-height: 1.5;">比如, \265B 是国际象棋黑皇后的符号 ♛。更多参见 </span><a class="external" href="http://www.w3.org/TR/CSS21/syndata.html#q24" style="line-height: 1.5;">Referring to characters not represented in a character encoding</a><span style="line-height: 1.5;"> 和CSS规范中的 </span><a class="external" href="http://www.w3.org/TR/CSS21/syndata.html#q6" style="line-height: 1.5;">Characters and case</a><span style="line-height: 1.5;">。</span></p> +</div> + +<h3 id="图片内容">图片内容</h3> + +<p>可以通过将{{ cssxref("content") }} 属性值设置为某个图片的URL,可以将图片插到元素的前面或后面。</p> + +<div class="tuto_example"> +<div class="tuto_type">例</div> + +<p>下面这条规则在所有类名包含<span style="font-family: courier new,andale mono,monospace; line-height: normal;">glossary的a标签后面插入一个空格和一个图标:</span></p> + +<pre class="brush:css">a.glossary::after {content: " " url("../images/glossary-icon.gif");} +</pre> +</div> + +<p>将图片设置成元素的背景图:将 {{ cssxref("background") }} 的值设为图片的URL。这是同时设置背景颜色,背景图,图片如何重复等的快捷写法。</p> + +<div class="tuto_example"> +<div class="tuto_type">例</div> + +<p>这条规则通过指定图片URL设置特定元素的背景。</p> + +<p>这是一个ID选择器;no-repeat表示背景图只出现一次,不重复:</p> + +<pre class="brush:css">#sidebar-box {background: url("../images/sidebar-ground.png") no-repeat;} +</pre> +</div> + +<div class="tuto_details"> +<div class="tuto_type">更多细节</div> + +<p>了解更多影响背景图的属性,以及其他背景图选项,参见 {{ cssxref("background") }} 。</p> +</div> + +<h2 id="实践_添加背景图片">实践: 添加背景图片</h2> + +<p>这幅图是一个白方块,底部有一条蓝色实线:</p> + +<table style="border: 2px solid #cccccc;"> + <tbody> + <tr> + <td><img alt="Image:Blue-rule.png" class="internal" src="https://mdn.mozillademos.org/files/160/Blue-rule.png"></td> + </tr> + </tbody> +</table> + +<ol> + <li>下载上图放到CSS同目录下</li> + <li>编辑CSS文件,为body设置背景图. + <pre class="brush:css">background: url("Blue-rule.png"); +</pre> + + <p>背景图默认是 <code>repeat(重复)的,无需明确指出。图片在水平和垂直方向重复,最终呈现出横格纸的效果:</code></p> + + <div style="position: relative; width: 24em; height: 11em; border: 2px outset #36b; overflow: hidden;"> + <p style="margin: 0px;"><img alt="Image:Blue-rule-ground.png" class="internal" src="https://mdn.mozillademos.org/files/161/Blue-rule-ground.png"></p> + + <div style="position: absolute; top: 0px; left: 0px; border: none; margin: 0px; padding: .5em 0px 0px 1em; font: 16px 'Comic Sams MS', cursive; color: blue; background-color: transparent;"> + <div style="font-style: italic; width: 24em;"> + <p><strong style="background-color: #ddddff; color: red; font: 200% serif;">C</strong>ascading <strong style="background-color: #ddddff; color: green; font: 200% serif;">S</strong>tyle <strong style="background-color: #ddddff; color: green; font: 200% serif;">S</strong>heets</p> + </div> + + <div style="font-style: normal; padding-top: 2px; height: 8em;"> + <p><strong style="background-color: #ddddff; color: red; font: 200% serif;">C</strong>ascading <strong style="background-color: #ddddff; color: red; font: 200% serif;">S</strong>tyle <strong style="background-color: #ddddff; color: red; font: 200% serif;">S</strong>heets</p> + </div> + </div> + </div> + </li> +</ol> + +<div class="tuto_example"> +<div class="tuto_type">挑战</div> + +<p>下载图片:</p> + +<table style="border: 2px solid #cccccc;"> + <tbody> + <tr> + <td><img alt="Image:Yellow-pin.png" class="internal" src="https://mdn.mozillademos.org/files/924/Yellow-pin.png"></td> + </tr> + </tbody> +</table> + +<p>在样式表中增加一条规则,使得每行前面显示上面的图标</p> + +<div style="position: relative; width: 24em; height: 11em; border: 2px outset #36b; overflow: hidden;"> +<p style="margin: 0px;"><img alt="Image:Blue-rule-ground.png" class="internal" src="https://mdn.mozillademos.org/files/161/Blue-rule-ground.png"></p> + +<div style="position: absolute; top: 0px; left: 0px; border: none; margin: 0px; padding: .5em 0px 0px 1em; font: 16px 'Comic Sams MS', cursive; color: blue; background-color: transparent;"> +<div style="font-style: italic; width: 24em; padding-top: 8px;"><img alt="image:Yellow-pin.png" class="internal" src="https://mdn.mozillademos.org/files/924/Yellow-pin.png"> <strong style="background-color: #ddddff; color: red; font: 200% serif;">C</strong>ascading <strong style="background-color: #ddddff; color: green; font: 200% serif;">S</strong>tyle <strong style="background-color: #ddddff; color: green; font: 200% serif;">S</strong>heets</div> + +<div style="font-style: normal; padding-top: 12px; height: 8em;"><img alt="image:Yellow-pin.png" class="internal" src="https://mdn.mozillademos.org/files/924/Yellow-pin.png"> <strong style="background-color: #ddddff; color: red; font: 200% serif;">C</strong>ascading <strong style="background-color: #ddddff; color: red; font: 200% serif;">S</strong>tyle <strong style="background-color: #ddddff; color: red; font: 200% serif;">S</strong>heets</div> +</div> +</div> + +<div class="tuto_details" id="tutochallenge"> +<div class="tuto_type">Possible solution</div> + +<p>Add this rule to your stylesheet:</p> + +<pre class="brush: css">p:before{ + content: url("yellow-pin.png"); +} +</pre> + +<p> </p> +<a class="hideAnswer" href="#challenge">Hide solution</a></div> +<a href="#tutochallenge" title="Display a possible solution for the challenge">答案.</a></div> + +<h2 id="接下来">接下来?</h2> + +<p>{{ nextPage("/zh-CN/docs/Web/Guide/CSS/Getting_Started/Lists", "列表") }}列表是一种常见的为列表元素添加内容的方式。下节将介绍如何 <a href="/zh-CN/docs/Web/Guide/CSS/Getting_Started/Lists" title="/en-US/docs/Web/Guide/CSS/Getting_Started/Lists">为列表元素指定样式</a>。</p> diff --git a/files/zh-cn/learn/css/为文本添加样式/fundamentals/index.html b/files/zh-cn/learn/css/styling_text/fundamentals/index.html index 45660a9532..45660a9532 100644 --- a/files/zh-cn/learn/css/为文本添加样式/fundamentals/index.html +++ b/files/zh-cn/learn/css/styling_text/fundamentals/index.html diff --git a/files/zh-cn/learn/css/为文本添加样式/index.html b/files/zh-cn/learn/css/styling_text/index.html index ec4822b9ad..ec4822b9ad 100644 --- a/files/zh-cn/learn/css/为文本添加样式/index.html +++ b/files/zh-cn/learn/css/styling_text/index.html diff --git a/files/zh-cn/learn/css/为文本添加样式/styling_links/index.html b/files/zh-cn/learn/css/styling_text/styling_links/index.html index df2e7c6093..df2e7c6093 100644 --- a/files/zh-cn/learn/css/为文本添加样式/styling_links/index.html +++ b/files/zh-cn/learn/css/styling_text/styling_links/index.html diff --git a/files/zh-cn/learn/css/为文本添加样式/styling_lists/index.html b/files/zh-cn/learn/css/styling_text/styling_lists/index.html index 075b457836..075b457836 100644 --- a/files/zh-cn/learn/css/为文本添加样式/styling_lists/index.html +++ b/files/zh-cn/learn/css/styling_text/styling_lists/index.html diff --git a/files/zh-cn/learn/css/为文本添加样式/typesetting_a_homepage/index.html b/files/zh-cn/learn/css/styling_text/typesetting_a_homepage/index.html index 98f86f125f..98f86f125f 100644 --- a/files/zh-cn/learn/css/为文本添加样式/typesetting_a_homepage/index.html +++ b/files/zh-cn/learn/css/styling_text/typesetting_a_homepage/index.html diff --git a/files/zh-cn/learn/css/为文本添加样式/web_字体/index.html b/files/zh-cn/learn/css/styling_text/web_fonts/index.html index ad9691cb00..ad9691cb00 100644 --- a/files/zh-cn/learn/css/为文本添加样式/web_字体/index.html +++ b/files/zh-cn/learn/css/styling_text/web_fonts/index.html |