刚开始用html和css编码,但我坚持通过导航栏使图片可见(Just started coding in html and css but i'm stuck at making the p

编程入门 行业动态 更新时间:2024-10-18 12:31:38
刚开始用html和css编码,但我坚持通过导航栏使图片可见(Just started coding in html and css but i'm stuck at making the picture seeable through the navigation bar)

正如你在上面看到的,我无法通过导航栏看到图片。 请记住,我刚开始,我没有经验。 这是我得到的,不知道从哪里去。

<body> <nav> <ul> <li><a class="active" href="index.html">Home</a></li> <li><a href="about.html">About</a></li> <li><a href="sights.html">Sights</a></li> <li><a href="sakura.html">Sakura</a></li> </ul> </nav> </body> body{ background-image:url(pic1.jpg); } * { padding:0; margin:0; } nav { height:70px; text-align:center; background-color:rgba(255, 10, 173, 0.27); padding:20px; } nav li { display:inline-block; margin:0; padding-top:20px; } nav li a { text-decoration:none; color:#FFF; padding-left:150px; padding-right:150px; padding-top:20px; padding-bottom:20px; font-family:arial; text-align:center; background-color:rgba(170, 19, 120, 1); } nav li a:hover, .active { background-color:rgba(255, 77, 181, 0.87); }

我希望它看起来像这样

As you saw above i can't get the picture seeable through the navigation bar. Keep in mind i just started and i got no experience. This is what i got and don't know where to go from here.

HTML:

<body> <nav> <ul> <li> <a class="active" href="index.html">Home</a> </li> <li> <a href="about.html">About</a> </li> <li> <a href="sights.html">Sights</a> </li> <li> <a href="sakura.html">Sakura</a> </li> </ul> </nav> </body>

CSS:

body { background-image: url(pic1.jpg); } * { padding: 0; margin: 0; } nav { height: 70px; text-align: center; background-color: rgba(255, 10, 173, 0.27); padding: 20px; } nav li { display: inline-block; margin: 0; padding-top: 20px; } nav li a { text-decoration: none; color: #FFF; padding-left: 150px; padding-right: 150px; padding-top: 20px; padding-bottom: 20px; font-family: arial; text-align: center; background-color: rgba(170, 19, 120, 1); } nav li a:hover, .active { background-color: rgba(255, 77, 181, 0.87); }

Here is a screenshot of the expected output:

最满意答案

我认为你在寻找的是opacity属性。

尝试添加:

opacity: 0.5;

给你的nav li a CSS,看看是否有帮助!

I think what you are lookging for is the opacity attribute.

Try adding:

opacity: 0.5;

to your nav li a CSS and see if that helps!

更多推荐

本文发布于:2023-08-06 17:59:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1454514.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:但我   刚开始   图片   started   coding

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!