重新链接和锚点 [英] re links and anchors

查看:86
本文介绍了重新链接和锚点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




刚开始使用styleshhets,并定义了悬停


a:hover

{

颜色:红色;

文字装饰:无;

边框宽度:中等;

边框宽度:中等;

边框底部宽度:中等;

边框左边宽度:中等;

边框 - 颜色:rgb(255,102,51);

边框式:凹槽;

宽度:30%;

显示:内联;

}


但我如何停止使用锚点,例如

< h1>< a name =" top"> Strings and Thins< / a>< / h1>


i尝试定义一个悬停,名称与h2相同,但是

这不起作用


名字a:悬停

{

文字装饰:无;

颜色:浅绿色;

}

我根本不想悬停与锚点一起工作只需链接


问候


Adrian

解决方案

adrian suri写道:

a:hover
{
颜色:红色;
文字装饰:无;
边框宽度:中等;
边框宽度:中等;
边框底宽:中等;
边框左宽:中;
边框颜色:rgb(255,102,51);
边框式:凹槽;
宽度:30%;
显示:内联;
}


首先删除冒号前的空格。

但是如何停止使用锚点例如
< h1>< a name =" top"> Strings and Thins< / a>< / h1>


使用选择器如:a:link:hover或a:visited:hover。

name a:hover



这会选择一个悬停的元素,它是名称

元素的后代,在HTML中不存在。


-

Johannes Koch

in te domine speravi;非永久性的东西。

(Te Deum,4美分。)


adrian suri写道:



刚刚开始使用styleshhets,并定义了悬停

a:悬停
{
颜色:红色;
文字装饰:无;
边框宽度:中等;
边框宽度:中等;
边框底宽:中等;
边框左边 - width:medium;
边框颜色:rgb(255,102,51);
边框样式:凹槽;
宽度:30%;
显示:内联;
}

但我如何停止使用锚点,例如
< h1>< a name =" top"> Strings and Thins< / a>< / h1>

我尝试定义一个悬停,名称与h2颜色相同,但
这不起作用

名称a:hover
{
文字装饰:无;
颜色:浅绿色;
}
我根本就不喜欢蚂蚁悬停与锚点工作只是链接




如果您的非链接锚点都在< h1> s内,您可以设置

h1 a:hover {text-decoration:none; color:aqua; border:none;}

如果您的锚点可以在任何地方,您可以给他们一个班级:

< a name =" top" class =" just-an-anchor"> Strings and Thins< / a>

a.just-an-anchor:hover {text-decoration:none; color:aqua; border:none ;}


问:为什么要定义宽度和显示:内联在

上的链接?如果它们还没有内嵌并且在

悬停之前有一定的宽度,它会让你的链接在悬停时跳转。


-

Els http://locusmeus.com/

Sonhos vem。 Sonhos v?o。 Orestoébritfeito。

- Renato Russo -


2005年8月3日星期三10:46:43 + 0200,adrian suri< as**************@tele2.se>

写道:

刚刚开始使用styleshhets,以及已定义悬停

a:悬停
{
颜色:红色;
文字装饰:无;
边框顶部宽度:中等;
边框 - 右边宽度:中等;
边框底部宽度:中等;
边框左边宽度:中等;
边框颜色:rgb(255,102,51)边框式:凹槽;


了解css中的简写可以为您做什么。你的边界风格可以最小化

到:


边框:中等凹槽rgb(255,102,51);

宽度:30% ;
显示:内联;
}
但是我如何停止使用锚点,例如
< h1>< a name =" top"> ;字符串和Thins< / a>< / h1>


为什么要使用带有[name]属性的锚点?您使用什么文件类型

?您可以将[id]属性与header元素一起使用,例如< h1

id =" top">。在引用和片段网址中,您可以引用id =" top"与#top,

就像你使用name =" top"除此以外。这将解决你的问题,

,因为非链接元素的锚点消失了。

i尝试定义一个悬停,名称与h2的颜色相同,但是这个
不起作用

名称a:悬停


您也可以尝试[名称]:悬停,但我不认为IE支持使用

属性在样式表中创建一个选择器。

{
Text-decoration:none;
颜色:aqua;
}
我根本不希望悬停与锚点一起工作只是链接




如果你坚持使用锚点,而不是切换到使用标题元素上的ID(如你的例子中所示),你可以设置一个类(如.header)

并指定你的类的样式为


a.header:悬停{

text-decoration:none;

color:aqua; }


-

, - - < - @ - PretLetters:''woest wyf'',遇见了vele interesses: - --------。

|博客| http://home.wanadoo.nl/b。 de.zoete / _private / weblog.html |

| webontwerp | http://home.wanadoo.nl/b。 de.zoete / html / webontwerp.html |

| zweefvliegen | http://home.wanadoo.nl/b。 de.zoete / html / vliegen.html |

` --------------------------- ----------------------- - < - @ ------------''


Hi

just started to experement with styleshhets, and have defined hover

a:hover
{
Color : red;
Text-decoration : none;
Border-top-width : medium;
Border-right-width : medium;
Border-bottom-width : medium;
Border-left-width : medium;
Border-color : rgb(255 , 102 , 51);
Border-style : groove;
Width : 30%;
Display : inline;
}

but how do i stop this working with anchors eg
<h1><a name="top">Strings and Thins</a></h1>

i tried definning an a hover, with name with the same colors as h2, but
this does not work

name a:hover
{
Text-decoration : none;
Color : aqua;
}
I simply do not want a hover to work with anchors just links

regards

Adrian

解决方案

adrian suri wrote:

a:hover
{
Color : red;
Text-decoration : none;
Border-top-width : medium;
Border-right-width : medium;
Border-bottom-width : medium;
Border-left-width : medium;
Border-color : rgb(255 , 102 , 51);
Border-style : groove;
Width : 30%;
Display : inline;
}
First remove the space before the colon.
but how do i stop this working with anchors eg
<h1><a name="top">Strings and Thins</a></h1>
Use selectors like a:link:hover or a:visited:hover.
name a:hover



This selects a hovered a element which is a descendant of a name
element, which does not exist in HTML.

--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)


adrian suri wrote:

Hi

just started to experement with styleshhets, and have defined hover

a:hover
{
Color : red;
Text-decoration : none;
Border-top-width : medium;
Border-right-width : medium;
Border-bottom-width : medium;
Border-left-width : medium;
Border-color : rgb(255 , 102 , 51);
Border-style : groove;
Width : 30%;
Display : inline;
}

but how do i stop this working with anchors eg
<h1><a name="top">Strings and Thins</a></h1>

i tried definning an a hover, with name with the same colors as h2, but
this does not work

name a:hover
{
Text-decoration : none;
Color : aqua;
}
I simply do not want a hover to work with anchors just links



If your non-link anchors are all inside <h1>s, you could set
h1 a:hover{text-decoration:none;color:aqua;border:none;}

If your anchors could be anywhere, you could give them a class:
<a name="top" class="just-an-anchor">Strings and Thins</a>
a.just-an-anchor:hover{text-decoration:none;color:aqua;border:none;}

Q: why are you defining width and display:inline on the links on
hover? If they''re not already inline and have a certain width before
hovering, it will make your links jump around on hover.

--
Els http://locusmeus.com/
Sonhos vem. Sonhos v?o. O resto é imperfeito.
- Renato Russo -


On Wed, 03 Aug 2005 10:46:43 +0200, adrian suri <as**************@tele2.se>
wrote:

just started to experement with styleshhets, and have defined hover

a:hover
{
Color : red;
Text-decoration : none;
Border-top-width : medium;
Border-right-width : medium;
Border-bottom-width : medium;
Border-left-width : medium;
Border-color : rgb(255 , 102 , 51);
Border-style : groove;
Learn what shorthand in css can do for you. Your borderstyles can be minimised
to:

border:medium groove rgb(255,102,51);
Width : 30%;
Display : inline;
}

but how do i stop this working with anchors eg
<h1><a name="top">Strings and Thins</a></h1>

Why do you use the anchor with the [name] attribute for this? What document type
do you use? You can use the [id] attribute with the header element, like <h1
id="top">. In references and fragment url''s you can refer to id="top" with #top,
just like you would with name="top" otherwise. That would solve your problem,
because the anchors arount non linking elements are gone.
i tried definning an a hover, with name with the same colors as h2, but this
does not work

name a:hover
You could also try a[name]:hover, but I don''t think IE supports the use of
attributes to create a selector in your stylesheet.
{
Text-decoration : none;
Color : aqua;
} I simply do not want a hover to work with anchors just links



If you do stick to the use of the anchor, instead of switching to using an id on
the header element (as in your example), you could set a class (like .header)
and specify your styles for that class to be

a.header:hover {
text-decoration:none;
color:aqua; }

--
,-- --<--@ -- PretLetters: ''woest wyf'', met vele interesses: ----------.
| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
| webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
|zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
`-------------------------------------------------- --<--@ ------------''


这篇关于重新链接和锚点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆