⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pr_pseudo_first-child.asp@output=print

📁 W3Schools tutorial..web designing
💻 ASP@OUTPUT=PRINT
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSS :first-child pseudo-class</title>
 
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Keywords" content="xml,tutorial,html,dhtml,css,xsl,xhtml,javascript,asp,ado,vbscript,dom,sql,colors,soap,php,authoring,programming,training,learning,beginner's guide,primer,lessons,school,howto,reference,examples,samples,source code,tags,demos,tips,links,FAQ,tag list,forms,frames,color table,w3c,cascading style sheets,active server pages,dynamic html,internet,database,development,Web building,Webmaster,html guide" />

<meta name="Description" content="Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building." />

<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "../../https@ssl./default.htm" : "../../www./default.htm");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3855518-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>

</head>
<body>

<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>


<h1>CSS :first-child pseudo-class</h1>
<hr />
<a href="css_reference.asp"><img class="navup" src="../images/up.gif" alt="CSS Reference" border="0" /> Complete CSS Reference</a>
<hr />

<h2>Definition</h2>

<p>The :first-child pseudo-class adds a special style to an element that is the first child of some other element.</p>
<p><b>Note:</b> For :first-child to work in IE. A
<a href="../tags/tag_doctype.asp">&lt;!DOCTYPE&gt;</a> must be declared.</p>

<h2>Example 1 - Match the first &lt;p&gt; element</h2>
<p>
In the following example, the selector matches <b>any &lt;p&gt; element that is the first child 
of any element</b>:<br />
</p>
<table width="100%" border="1" class="ex" cellspacing="0" id="table5"><tr><td>
<pre>&lt;style type=&quot;text/css&quot;&gt;
p:first-child
{
font-weight:bold
} 
&lt;/style&gt;

&lt;p&gt;I am a &lt;em&gt;strong&lt;/em&gt; man. I am a &lt;em&gt;strong&lt;/em&gt; man.&lt;/p&gt;
&lt;p&gt;I am a &lt;em&gt;strong&lt;/em&gt; man. I am a &lt;em&gt;strong&lt;/em&gt; man.&lt;/p&gt;</pre>
</td></tr></table>

<p><a href="tryit.asp@filename=trycss_first-child1">Try it yourself!</a></p>
<h2>Example 2 - Match the first &lt;em&gt; element in all &lt;p&gt; elements</h2>
<p>In the following example, the selector matches <b> any &lt;em&gt; element that is the first child of a
&lt;p&gt; element</b>:</p>
<table width="100%" border="1" class="ex" cellspacing="0" id="table3"><tr><td>
<pre>&lt;style type=&quot;text/css&quot;&gt;
p &gt; em:first-child
{
font-weight:bold
} 
&lt;/style&gt;

&lt;p&gt;I am a &lt;em&gt;strong&lt;/em&gt; man. I am a &lt;em&gt;strong&lt;/em&gt; man.&lt;/p&gt;
&lt;p&gt;I am a &lt;em&gt;strong&lt;/em&gt; man. I am a &lt;em&gt;strong&lt;/em&gt; man.&lt;/p&gt;</pre>
</td></tr></table>
<p><a href="tryit.asp@filename=trycss_first-child2">Try it yourself!</a></p>
<h2>Example 3 - Match all &lt;em&gt; elements in all first child &lt;p&gt; 
elements</h2>
<p>In the following example, the selector matches <b> any &lt;em&gt; elements in
&lt;p&gt; elements that are the first child of another element</b>:</p>
<table width="100%" border="1" class="ex" cellspacing="0" id="table4"><tr><td>
<pre>&lt;style type=&quot;text/css&quot;&gt;
p:first-child em
{
font-weight:bold
} 
&lt;/style&gt;

&lt;p&gt;I am a &lt;em&gt;strong&lt;/em&gt; man. I am a &lt;em&gt;strong&lt;/em&gt; man.&lt;/p&gt;
&lt;p&gt;I am a &lt;em&gt;strong&lt;/em&gt; man. I am a &lt;em&gt;strong&lt;/em&gt; man.&lt;/p&gt;</pre>
</td></tr></table>
<p><a href="tryit.asp@filename=trycss_first-child3">Try it yourself!</a></p>

<hr />
<a href="css_reference.asp"><img class="navup" src="../images/up.gif" alt="CSS Reference" border="0" /> Complete CSS Reference</a>

<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -