Dreamweaver 按钮链接 CSS 帮助

发布于 2024-08-13 22:18:25 字数 190 浏览 3 评论 0原文

大家好,我目前在 CSS 链接方面遇到问题。基本上,我希望当我将鼠标悬停在链接上并单击它们等时,链接的颜色会发生变化。但由于某种原因,当我在浏览器上查看它时,它不起作用。下面是我的 HTML 代码和 CSS 代码,它们是单独的文件并链接在一起。提前致谢。 (如果代码显示不正确,我深表歉意,但它都在那里)

编辑:不用担心它现在已修复:D 感谢您的帮助

Hey guys I'm currently having trouble with my CSS linking. Basically I want the colour of my links to change when I hover over them, and click on them and such. But for some reason it is not working when I view it on a browser. Below is my HTML code and my CSS code, they are seperate files and are linked togather. Thanks in advance. (I apologise if the codes are not appearing correctly but it is all there)

EDIT: Don't worry its fixed now :D thanks for the help

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一绘本一梦想 2024-08-20 22:18:25

据我所知,您没有在任何地方定义 a:hover、a:vistied 或 a:active ,这就是控制您正在寻找的行为的原因。

from what I see, you don't have a:hover,a:vistied, or a:active defined anywhere, which is what controls the behavior you're looking for.

吃素的狼 2024-08-20 22:18:25

您是手动编码还是使用 Dreamweaver 作为所见即所得?


注意:这可能是因为您的问题中的文件格式不正确,因此 Markdown 可能会从显示中删除一些字符。

据我所知,CSS 文件编写不正确。我将为您提供一个适合整个文件的示例:

content {
    width: 510px;
    float: left;
}

上面的代码片段在 HTML 中查找 标记,当找到该标记时,它会给出它宽度为 510px 并向左浮动。这里的问题是 HTML 页面或 HTML 4.01 本身没有 标记。您需要做的是将其更改为:

.content {
    width: 510px;
    float: left;
}

通过添加“.”在 CSS 中的“content”之前,它将“content”从 更改为查找具有 class="content" 作为属性的标记。


另外,要使 标签在悬停时更改等,请使用 :hover的伪元素(伪属性?): active:visited 分别表示用户将鼠标悬停在链接上、单击链接以及之前访问过链接时的情况。

示例:

a {
    color: blue;
}

a:hover {
    color: red;
}

在此示例中,除非用户将鼠标放在链接上,否则链接将显示为蓝色。

Are you coding by hand or using Dreamweaver as a WYSIWYG?


NOTE: This could be because the files aren't formatted well in your question, so Markdown could have dropped some characters from the display.

From what I can see, the CSS file isn't written correctly. I'm going to give one example for you which fits for the whole file:

content {
    width: 510px;
    float: left;
}

This snippet above looks for the <content> tag in the HTML, and when it finds that tag, it will give it a width of 510px and floats it to the left. The problem here is that there are no <content> tags in your HTML page OR in HTML 4.01 itself. What you need to do is change it to this:

.content {
    width: 510px;
    float: left;
}

By adding the '.' before 'content' in the CSS, it changes 'content' from <content> to finding a tag that has class="content" as an attribute.


Also, to get the <a> tags to change on hover, etc, use the pseudo-elements (pseudo-attributes?) of :hover, :active, and :visited, for when a user hovers over a link, clicks on a link, and has previously visited a link, respectively.

Example:

a {
    color: blue;
}

a:hover {
    color: red;
}

In this example, a link will display as blue unless the user has their mouse on the link.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文