html,将链接显示为普通文本

Fox*_*ity 9 html

我想知道你是否可以将链接显示为普通文本.

<a id="" href="" target="_parent"><img src="" width="121" height="20" alt="">
<div style="position:absolute;left:163px;top:1px;font-size: 12px; display: block">
<font color="white">Log in</font></a>
Run Code Online (Sandbox Code Playgroud)

我正在尝试重叠一个也是一个按钮的图像,文本"登录",它与上面的代码一样工作,但我想知道我是否可以更改"登录",显示为蓝色和下划线显示为普通文本.

sts*_*vik 34

在css中:

a {
  color: inherit;
  text-decoration: inherit;
}
Run Code Online (Sandbox Code Playgroud)

这些值也可能会卡在锚标记的style属性中.

应该导致您的锚标签看起来与父文本的文本颜色和装饰相同.


Tim*_*mes 9

如果您查看层叠样式表(CSS),可以更改链接的颜色和文本样式.

在您的示例中,您可以使用

<a id="" href="" target="_parent" style="color: white; text-decoration: none;"><img src="" width="121" height="20" alt="">
    <div style="position:absolute; sleft:163px;top:1px;font-size: 12px; display: block">
        <font color="white">Log in</font>
    </div>
</a>
Run Code Online (Sandbox Code Playgroud)

但是,我将学习如何使用外部样式表,并通过HTML中的<link>标记将它们链接到<head>HTML.然后,您可以通过标记名称,id或css类来设置单个标记的样式.所以一个更新的例子是:

<link rel="stylesheet" href="link-to-your-css-file" />
Run Code Online (Sandbox Code Playgroud)

在你的css文件中有

a.imgLink{
    color: white; text-decoration: none;
}
div.imgLink{ 
    position: absolute; left: 163px; top: 1px; font-size: 12px; display: block;
}
Run Code Online (Sandbox Code Playgroud)

然后你的HTML将是

<a class="imgLink" id="" href="" target="_parent">
    <img src="" width="121" height="20" alt="">
    <div class="imgLink">
         Log In
    </div>
</a>
Run Code Online (Sandbox Code Playgroud)

它不仅使您的HTML"干",而且通过仅更改css文件,您可以更好地控制html的样式.