<?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>浮山狼de博客 &#187; 超链接</title>
	<atom:link href="https://www.fushanlang.com/tag/link/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fushanlang.com</link>
	<description>next station - 下一站，活在当下，且行且思</description>
	<lastBuildDate>Sat, 29 Nov 2014 15:14:11 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.2.5</generator>
	<item>
		<title>css超链接下划线</title>
		<link>https://www.fushanlang.com/css-underline-hyperlinks-1026/</link>
		<comments>https://www.fushanlang.com/css-underline-hyperlinks-1026/#comments</comments>
		<pubDate>Sun, 26 Sep 2010 03:15:53 +0000</pubDate>
		<dc:creator><![CDATA[fushanlang]]></dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[网页设计]]></category>
		<category><![CDATA[超链接]]></category>

		<guid isPermaLink="false">http://www.fushanlang.com/blog/?p=1026</guid>
		<description><![CDATA[css超链接下划线往下隔开一段距离的两种实现方法 css underline style  without text-decoration <p>经常使用的超链接的CSS样式，带下划线通常采用&#8221;text-decoration:underline&#8221; 普通情况下，很好用，但是当字体加粗或者对h1~h3比较大的字体加下划线时，会发现下划线与超链接连在一起，很不雅观。于是便有了将超链接下划线与文本链接往下隔开一段距离的要求。这里采用的是用首先设置text-decoration:none，然后设置border-bottom,只需设置为solid 即可，最后padding-bottom往下隔开一段像素距离如3px，可以完美实现将下划线往下隔开一段距离的要求。</p> <p>a.cls-underline-1{</p> <p></p> <p>text-decoration:none;</p> <p>border-bottom:solid /*设置为solid就可以了*/</p> <p>padding-bottom:3px; /*设置下方隔开距离此处为3像素*/ }</p> a.cls-underline-1{ text-decoration:none; border-bottom:solid; /*设置为solid就可以了*/ padding-bottom:3px; /*设置下方隔开距离此处为3像素*/ margin:5px; } a.cls-underline-2{ text-decoration:none; border-bottom:dotted #C90; /*设置为solid就可以了*/ padding-bottom:3px; /*设置下方隔开距离此处为3像素*/ margin:5px; } a.cls-underline-3{ text-decoration:none; border-bottom:double black; /*设置为solid就可以了*/ padding-bottom:3px; /*设置下方隔开距离此处为3像素*/ margin:5px; } a.cls-underline-4{ text-decoration:none; border-bottom:dashed; /*设置为solid就可以了*/ padding-bottom:3px; /*设置下方隔开距离此处为3像素*/ margin:5px; } a.cls-bgunderline-1{ text-decoration:none; padding-bottom:3px; <span style="color:#777"> . . . &#8594; Read More: <a href="https://www.fushanlang.com/css-underline-hyperlinks-1026/">css超链接下划线</a></span>]]></description>
				<content:encoded><![CDATA[<h3>css超链接下划线往下隔开一段距离的两种实现方法</h3>
<h2>css underline style  without text-decoration</h2>
<p>经常使用的超链接的CSS样式，带下划线通常采用&#8221;text-decoration:underline&#8221; 普通情况下，很好用，但是当字体加粗或者对h1~h3比较大的字体加下划线时，会发现下划线与超链接连在一起，很不雅观。于是便有了将超链接下划线与文本链接往下隔开一段距离的要求。这里采用的是用首先设置text-decoration:none，然后设置border-bottom,只需设置为solid 即可，最后padding-bottom往下隔开一段像素距离如3px，可以完美实现将下划线往下隔开一段距离的要求。</p>
<p>a.cls-underline-1{</p>
<p><span id="more-1026"></span></p>
<p>text-decoration:none;</p>
<p>border-bottom:solid /*设置为solid就可以了*/</p>
<p>padding-bottom:3px; /*设置下方隔开距离此处为3像素*/<br />
}</p>
<style type="text/css"> a.cls-underline-1{ text-decoration:none; border-bottom:solid; /*设置为solid就可以了*/ padding-bottom:3px; /*设置下方隔开距离此处为3像素*/ margin:5px; } a.cls-underline-2{ text-decoration:none; border-bottom:dotted  #C90; /*设置为solid就可以了*/ padding-bottom:3px; /*设置下方隔开距离此处为3像素*/ margin:5px; } a.cls-underline-3{ text-decoration:none; border-bottom:double black; /*设置为solid就可以了*/ padding-bottom:3px; /*设置下方隔开距离此处为3像素*/ margin:5px; } a.cls-underline-4{ text-decoration:none; border-bottom:dashed; /*设置为solid就可以了*/ padding-bottom:3px; /*设置下方隔开距离此处为3像素*/ margin:5px; } a.cls-bgunderline-1{ text-decoration:none; padding-bottom:3px; /*设置下方隔开距离此处为3像素*/ background:url('http://www.fushanlang.com/blog/wp-content/uploads/2010/09/underline.gif')  repeat-x 100% 100%; margin:5px; } </style>
<p>Examples:<br />
<a class="cls-underline-1" href="#">css underline style </a><br />
<a class="cls-underline-2" href="#">css underline style </a><br />
<a class="cls-underline-3" href="#">css underline style </a><br />
<a class="cls-underline-4" href="#">css underline style </a></p>
<p>当然，还有一种方式更为简单一些，就是直接设置一个图片作为超链接的背景，背景图片里定制好下划线的位置。也可以采用background-position来辅助调整一下。采用此种方式，可以通过替换背景图片为动态的gif图片制作更炫的效果，而且图片的下划线可以制作的更丰富一些。</p>
<p>a.cls-underline-2{</p>
<p>text-decoration:none;</p>
<p>background:url(alink-background.jpg);</p>
<p>background-position: left+px top+px;/*当背景图片设计的不够好时，可以采用此设置来调整位置*/</p>
<p>pading-bottom:3px;/*设置下方隔开距离此处为3像素*/</p>
<p>}<br />
Examples:<br />
<a class="cls-bgunderline-1" href="#">css underline style </a></p>
]]></content:encoded>
			<wfw:commentRss>https://www.fushanlang.com/css-underline-hyperlinks-1026/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>超链接css样式优先级</title>
		<link>https://www.fushanlang.com/hyperlink-css-style-558/</link>
		<comments>https://www.fushanlang.com/hyperlink-css-style-558/#comments</comments>
		<pubDate>Wed, 15 Sep 2010 00:51:36 +0000</pubDate>
		<dc:creator><![CDATA[fushanlang]]></dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[编程]]></category>
		<category><![CDATA[网页设计]]></category>
		<category><![CDATA[超链接]]></category>

		<guid isPermaLink="false">http://www.fushanlang.com/blog/?p=558</guid>
		<description><![CDATA[<p>超链接的样式，例如 hover,visited,active样式 定义会出现没有实际效果的情况，实际上为了保证能看到不同状态下的连接样式,正确的样式顺序应该是：</p> <p>&#8221; link &#8211; visited &#8211; hover &#8211; active &#8220;或&#8221; LVHA &#8220;(缩写)。</p> <p>分析原因：</p> <p>每个选择符selector都有一个“specificity” 权重，如果两个selectors应用于同一个元素,具有较高specificity的选择符将胜出，具有优先权。例如：</p> <p>P.hithere {color: green;} /* specificity = 1,1 */</p> <p>P {color: red;} /* specificity = 1 */</p> <p>任何设置了类class＝hithere的段落内容显示为绿色而不是红色。两个selectors都设置了颜色，但是具有更高specificity的选择符将胜出。</p> <p>伪类如何影响specificity呢？它们具有完全相同的加权值，下列样式具有相同的specificity加权值：</p> <p>A:link {color: blue;} /* specificity = 1,1 */</p> <p>A:active {color: red;} /* specificity = 1,1 */</p> <p>A:hover {color: magenta;} <span style="color:#777"> . . . &#8594; Read More: <a href="https://www.fushanlang.com/hyperlink-css-style-558/">超链接css样式优先级</a></span>]]></description>
				<content:encoded><![CDATA[<p>超链接的样式，例如 hover,visited,active样式 定义会出现没有实际效果的情况，实际上为了保证能看到不同状态下的连接样式,正确的样式顺序应该是：</p>
<p>&#8221; link &#8211; visited &#8211; hover &#8211; active &#8220;或&#8221; LVHA &#8220;(缩写)。</p>
<p>分析原因：</p>
<p>每个选择符selector都有一个“specificity” 权重，如果两个selectors应用于同一个元素,具有较高specificity的选择符将胜出，具有优先权。例如：</p>
<p>P.hithere {color: green;} /* specificity = 1,1 */</p>
<p>P {color: red;} /* specificity = 1 */</p>
<p>任何设置了类class＝hithere的段落内容显示为绿色而不是红色。两个selectors都设置了颜色，但是具有更高specificity的选择符将胜出。</p>
<p>伪类如何影响specificity呢？它们具有完全相同的加权值，下列样式具有相同的specificity加权值：<span id="more-558"></span></p>
<p>A:link {color: blue;} /* specificity = 1,1 */</p>
<p>A:active {color: red;} /* specificity = 1,1 */</p>
<p>A:hover {color: magenta;} /* specificity = 1,1 */</p>
<p>A:visited {color: purple;} /* specificity = 1,1 */</p>
<p>这些都是用于超链接的样式设置。大部分情况下需要同时设置其中的几个样式，例如,一个未被访问的超链接在鼠标悬停和点击时可设置“鼠标悬停”和“鼠标激活“两种状态下的不同样式,由于上述三个规则都可应用于超链接,并且全部选择符具备相同的specificity,那么根据规则,最后一个样式“胜出”。所以&#8221; active &#8220;式样永远也不会显示出来，因为它总是被&#8221; hover &#8220;式样覆盖(即&#8221; hover &#8220;优先)。现在再来分析一下已经被访问过的超链接鼠标悬停是什么效果，结果永远是purple紫色的:( ，因为它的&#8221; visited &#8220;式样总是优先于其它的状态样式规则(包括&#8221; active &#8220;和&#8221; hover&#8221;)而显示。</p>
<p>这就是为什么CSS1推荐样式顺序的原因：</p>
<p>A:link</p>
<p>A:visited</p>
<p>A:hover</p>
<p>A:active</p>
<p>实际上，开头两个样式的顺序可以调换，因为一个超链接不可能同时存在“未访问”和“已访问”两种状态。( :link意思是&#8221; unvisited &#8220;；我不知道为什么不这样定义呢.)</p>
<p>CSS2现在允许伪类可以以“联合成组”形式出现，例如：</p>
<p>A:visited:hover {color: maroon;} /* specificity = 2,1 */</p>
<p>A:link:hover {color: magenta;} /* specificity = 2,1 */</p>
<p>A:hover:active {color: cyan;} /* specificity = 2,1 */</p>
<p>They have the same specificity, but they apply to fundamentally different beasts, and so don&#8217;t conflict. You can get hover-active combinations, for example.</p>
<p>如何理解本文当中所涉及到的“specificity”呢？specificity可以理解未简单地连在一起的号码字符串,上面的一个例子：</p>
<p>P.hithere {color: green;} /* specificity = 11 */</p>
<p>P {color: red;} /* specificity = 1 */</p>
<p>这好像是一个基于十进制的简单运算。然而计算“specificity”不能使用十进制算法，例如你把15种选择符连在一起使用、它们具有的“specificity”加权值还是比简单的class选择符低。举例：</p>
<p>.hello {color: red;} /* specificity = 10 */</p>
<p>HTML BODY DIV UL LI OL LI UL LI OL LI UL LI OL LI (color: green;} /* specificity = 15 */</p>
<p>&#8221; 10 &#8220;实际上是一个“1”后面接着“零”、不是&#8221;十&#8221;，我们可以使用十六进制描述前面的样式规则的specificitiy，像下面：</p>
<p>.hello {color: red;} /* specificity = 10 */</p>
<p>HTML BODY DIV UL LI OL LI UL LI OL LI UL LI OL LI (color: green;} /* specificity = F */</p>
<p>唯一的问题是如果你想为第二个样式规则增加两个或更多的选择符时，那时你就可能得到一个“17”的specificity、会再一次混淆。事实上specificity可能是无穷大的，所以为了避免更多的混乱，建议使用逗号来分隔specificity的值。</p>
]]></content:encoded>
			<wfw:commentRss>https://www.fushanlang.com/hyperlink-css-style-558/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.267 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2026-03-09 15:06:55 -->
