gpt4 book ai didi

html - href 样式继承

转载 作者:行者123 更新时间:2023-11-28 16:33:17 25 4
gpt4 key购买 nike

我遇到一个问题,我的导航 a.content 上的 a href 冲突 - 我一直在努力解决这个问题在过去的几个小时里,没有运气,谢谢。

ul.nav {
list-style-type: none;
margin: 0;
min-width: 360px;
}
ul.nav li {
display: table-cell;
text-align: center;
}
a.active {
background-color: #cc293f;
font-weight: 700;
}
.nav-container {
font-family: 'Catamaran', sans-serif;
background-color: #505050;
margin: 5px 0 0;
}
.table {
display: table;
margin: 5px auto;
}
a {
font-family: 'Catamaran', sans-serif;
background-color: #505050;
border-right: 1px solid #fff;
color: #fff;
float: left;
padding: .2em .6em;
text-decoration: none;
width: 10em;
}
a:hover {
background-color: #cc293f;
}
.content {
border-radius: 10px 10px 10px 10px;
border: 2px solid #cc293f;
margin-top: 10px;
min-width: 360px;
min-height: 650px;
}
.content h1 {
font-size: 26px;
color: #fff;
text-align: center;
margin-top: 5px;
}
.content h2 {
font-size: 22px;
text-align: center;
margin-top: -35px;
}
.content p {
font-size: 18px;
margin-top: -5px;
margin-left: 10px;
}
.content #p2 {
font-size: 19px;
margin-left: 50px;
margin-top: -5px;
}
<html>
<body>
<div class="nav-container">
<div class="table">
<ul class="nav">
<li style="border-left:1px solid white;"><a class="active" href=
"index.html">Home</a></li>
<li><a href="faq.html">FAQs</a></li>

<li><a href="support.html">Resolution Center</a></li>
<li><a href="upload.html">Upload</a></li></ul>
</div>
</div>

<div class="content">

<p>example</p>
<a href="google.com" target="_blank"><img src="http://cumbrianrun.co.uk/wp-content/uploads/2014/02/default-placeholder.png" height="75" width="75"></a>

</body>
</html>

最佳答案

您为全局 <a> tag 声明样式, 所以所有 <a tags将使用该样式。特殊款式 <a tags from .content class可以通过添加到您的 css 文件来实现:.content a { your instructions } .

此外,使用 ul nav li a指定您想要的菜单选项。如果您的元素中有多个 ul 列表,请为每个列表使用一个特定的类。

关于html - href 样式继承,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34977554/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com