<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>爱周末 &#187; css选择器</title>
	<atom:link href="http://zhoumo123.cn/tag/css-xuanzeqi/feed" rel="self" type="application/rss+xml" />
	<link>http://zhoumo123.cn</link>
	<description>知识分享，共同进步。zhoumo123.cn</description>
	<lastBuildDate>Thu, 07 Nov 2019 05:53:49 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.0.1</generator>
	<item>
		<title>css选择器：标签选择器的用法</title>
		<link>http://zhoumo123.cn/web/css/1775.html</link>
		<comments>http://zhoumo123.cn/web/css/1775.html#comments</comments>
		<pubDate>Thu, 06 Nov 2014 11:25:43 +0000</pubDate>
		<dc:creator><![CDATA[zhangc]]></dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[css选择器]]></category>

		<guid isPermaLink="false">http://zhoumo123.cn/?p=1775</guid>
		<description><![CDATA[最常用的选择器类型是标签选择器。标签选择器可用来寻找特定类型的元素，如段落、超链接或标题元素，只需指定希望应用样式的元素的名称。标签选择器有时候也称为元素选择器或简单选择器。 例如，下面3个样式分别定义段落字体颜色为黑色，超链接显示为下划线，一级标题显示为粗体效果。 &#160; p{ color:black;} a{ text-decoration:underline;} h1{ font-weight:bold;} 使用标签选择器时，应该考虑该类型选择器的优缺点。 优点：能够快速为页面中同类型的标签统一样式。 缺点：不能设计差异化样式，有时候会相互干扰。 例如，如果在网页样式表中定义如下样 ...  <a href="http://zhoumo123.cn/web/css/1775.html">  阅读全文 </a>]]></description>
				<content:encoded><![CDATA[<p>最常用的选择器类型是标签选择器。标签选择器可用来寻找特定类型的元素，如段落、超链接或标题元素，只需指定希望应用样式的元素的名称。标签选择器有时候也称为元素选择器或简单选择器。</p>
<p>例如，下面3个样式分别定义段落字体颜色为黑色，超链接显示为下划线，一级标题显示为粗体效果。</p>
<p>&nbsp;</p>
<p>p{ color:black;}<br />
a{ text-decoration:underline;}<br />
h1{ font-weight:bold;}</p>
<p>使用标签选择器时，应该考虑该类型选择器的优缺点。</p>
<p>优点：能够快速为页面中同类型的标签统一样式。</p>
<p>缺点：不能设计差异化样式，有时候会相互干扰。</p>
<p>例如，如果在网页样式表中定义如下样式，把所有div元素对象都定义为宽度为774px。</p>
<p>div{ width:774px;}</p>
<p>那么当用div进行布局时，就需要重新为页面中每个div对象定义宽度，因为在页而中并不是每个div元素对象的宽度都显示为774px，否则将是件非常麻烦的事情。</p>
<p>那么在什么情况下选用标签选择器呢？</p>
<p>如果希望为标签定义默认样式时，可以使用标签选择器。例如，使用ul元素时，它会自动缩进，并自带列表符号，有时这种样式会给列表布局带来麻烦，此时可以选择ul元素作为标签选择器，并清除预定义样式。</p>
<p>ul{<br />
margin:0px;<br />
list-style:none;<br />
}</p>
<p>如果希望统一文档中标签的样式，也可以使用标签选择器。例如，在下而样式表片段中通过body标签选择器统一文档字体大小、行高和字体，通过table标签选择器统一表格的字体样式，通过a标签选择器清除所有超链接的下划线，通过img标签选择器清除网页图像的边框，当图像嵌入a元素中，即作为超链接对象时会出现边框，通过input标签选择器统一输入表单的边框为浅灰色的实线。</p>
<p><a href="http://zhoumo123.cn/web/css/1775.html/attachment/biaoqianxuanzeqi" rel="attachment wp-att-1776"><img class="alignnone wp-image-1776 size-full" title="css选择器：标签选择器的用法" src="http://img.zhoumo123.cn/wp-content/uploads/biaoqianxuanzeqi.jpg" alt="css选择器：标签选择器的用法" width="663" height="220" /></a></p>
<p>对于div、span等通用结构元素，不建议使用标签选择器，因为通用结构元素的应用范围广泛，使用标签选择器会相互干扰。</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://zhoumo123.cn/web/css/1775.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
