gpt4 book ai didi

html - HTML 中的 Navbar 类不会显示某些 CSS 属性

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

出于某种原因,nText 类中唯一经过的 CSS 属性是内联显示和字体大小。 border 属性、padding 和 text-decoration 不会响应更改。代码如下:

<!DOCTYPE html>
<html>
<head>
<title>Ted's Lawn Care</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="header">
<a href="index.html"> <img id="headText" src="headerLeftImage.jpg"/>
<img id="headImage" src="headerImage.jpg"/></a>
</div>
<div id="navbar">
<img id="navImage" src="navBackground.jpg"/>
<div id="navText">
<p class="nText" id="home"><a href="index.html">Home</a></p>
<p class="nText" id="services"><a href="services.html">Services</a></p>
<p class="nText" id="rates"><a href="rates.html">Rates</a></p>
<p class="nText" id="contact"><a href="contact.html">Contact Us</a></p>
<p class="nText" id="about"><a href="about.html">About</a></p>
</div>
</div>
</body>
</html>

还有 CSS:

 *{-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;

}
#header{
background-color: #BDB76B;
height: 20%;
width: 100%;
position: absolute;
left: 0; top: 0; bottom: 0; right: 0;
border-bottom: 10px;
border-top: 0;
border-left: 0;
border-right: 0;
border-color: black;
border-style: solid;
}
#headText{
position: relative;
float: left;
height: 100%;
width: 15%
}
#headImage{
position: relative;
float: right;
height: 100%;
width: 85%;
}
#navImage{
background-color: #66CD00;
width: 100%;
height: 8%;
position: absolute;
top: 20%; left: 0; right: 0;
}
#navBar{
width: 100%;
height: 8%;
position: absolute;
top: 20%; left: 0; right: 0;
}
#navText{
z-index: 1;
position: absolute;
top: 20%; left: 0; right: 0;
text-align: center;
}
.nText{
display: inline;
border-width: 2px;
border-color: #9ACD32;
border-top-left-radius: 5px;
border-top-right-radius: 80px;
font-size: 2em;
padding-left: 30px;
padding-right: 30px;
padding-top: 10px;
padding-bottom: 10px;
text-decoration: none;`
}

感谢所有帮助。

最佳答案

您所要做的就是边框样式,没有它边框属性不起作用

.nText{
border-style: solid;
}

关于html - HTML 中的 Navbar 类不会显示某些 CSS 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27009143/

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