【发布时间】:2023-03-04 14:40:01
【问题描述】:
我正在使用一些引导代码在 Hugo 中处理一些预制主题,我只想在显示、悬停等时更改所有链接的颜色。我已经搜索了很多,它说我必须按此顺序将 a:link{...}, a:visited{...}, a:hover{...}, a:active{...} 放入我的 css 中。我也试过放
<link rel="stylesheet" href="kitab.css">
在有人说之后在我的 html 中。没有一个变体工作,链接是蓝色的,我只想知道如何在 html 和 css 之间建立连接。 我的 html 部分(如果这不是一个非常简单的问题,我会全部提供)列出了一些可点击的标题,它们对应于网站中的页面:
<ul class="list-unstyled ml-1 mb-0 border-top border-warning pt-2">
{{ range first 4 .Pages }}
<li>
<a href="{{ .Permalink }}">
<p class="mb-1">
{{ .Title }}
</p>
</a>
</li>
{{ end }}
</ul>
,这是我的整个 CSS:
html {
scroll-behavior: smooth;
}
body {
font-family: "Roboto", sans-serif;
background-color: whitesmoke;
overflow-y: scroll;
min-width: 250px;
}
nav {
height: 40px;
}
main {
min-height: calc(100vh - 100px);
border-radius: 10px;
}
.side-bar {
width: 25px;
position: fixed;
top: 70px;
}
footer {
font-size: 0.9em;
margin-left: 35px;
}
.nav-menu {
/* color: #007bff !important; */
font-size: 1.5em;
}
.nav-menu:hover {
/* color: #0056b3 !important; */
cursor: pointer;
}
.nav-menu-disabled {
/* color: #4e4f50 !important; */
font-size: 1.5em;
}
/* the link colors here */
a:link {
color: green;
background-color: transparent;
text-decoration: none;
}
a:visited {
color: pink;
background-color: transparent;
text-decoration: none;
}
a:hover {
color: red;
background-color: transparent;
text-decoration: underline;
}
a:active {
color: yellow;
background-color: transparent;
text-decoration: underline;
}
.book-cover {
color: white;
/* background-color: #24242499; */
}
.bookTitle {
position: absolute;
top: 2%;
left: 5%;
}
.bookAuthor {
position: absolute;
bottom: 2%;
right: 5%;
}
.show {
transition: all 0.1s;
}
.hanging {
padding-left: 15px;
text-indent: -15px;
}
/*
ul.nav li a, ul.nav li a:visited {
color: orange !important;
}
ul.nav li a:hover, ul.nav li a:active {
color: orange !important;
}
ul.nav li.active a {
color: orange !important;
}
*/
#copiedMessage {
position: fixed;
display: table-cell;
line-height: 100px;
width: 224px;
height: 100px;
text-align: center;
top: calc(50% - 50px);
left: calc(50% - 112px);
transition: all 1s;
}
【问题讨论】:
-
欢迎来到 Stack Overflow!访问help center,使用tour 了解内容和How to Ask。如果您遇到困难,请发布您尝试的minimal reproducible example,使用
[<>]sn-p 编辑器记录输入和预期输出。请不要发布模板,而是发布呈现的 HTML
标签: html css bootstrap-4 colors hugo