[英]setting background image behind link tags
I currently have: 我目前有:
and I am looking to set the background of the div with links to an image. 我希望设置div的背景与图像的链接。 Also I only want opacity to apply to the image only, not the links.
另外,我只希望不透明度仅应用于图像,而不是链接。 This is what I have:
这就是我所拥有的:
#homelinks
{
border: 1px solid black;
height: 80px;
width: auto;
font-size: 20pt;
padding-left: 5px;
padding-right: 5px;
text-align: center;
overflow: auto;
padding-top: 75px;
}
#homeimage
{
opacity: 0.3;
background-image:url("http://www.imagegoeshere.jpg");
background-repeat:no-repeat;
background-attachment: fixed;
background-position: 100% 100%;
}
HTML: HTML:
<h1>
My Surfing Shop
</h1>
<div id="homeimage">
<div id="homelinks">
<a href="http://www.111.html">Home</a>
<a href="http://www.222.html">Products</a>
<a href="http://www.333.html">Surf Reports</a>
<a href="http://www.444.html">Surf lessons</a>
<a href="http://www.555.html">Message Board</a>
<a href="http://www.666.html">Directions</a>
</div>
</div>
Fix the CSS for your homeimage div. 修复homeimage div的CSS。 You have it in your CSS as a class (.) instead of an ID (#).
你在CSS中将它作为一个类(。)而不是一个ID(#)。 Also the link to your image was invalid (on purpose for some reason I'm guessing).
此外,您图像的链接无效(出于某些原因,我猜是有目的)。 And check the background-position which might need to be 0 0. I'd also remove the fixed background-attachment rule.
并检查可能需要为0的背景位置。我还将删除固定的背景附加规则。
#homeimage
{
opacity: 0.3;
background-image:url("http://www.imagegoeshere.jpg");
background-repeat:no-repeat;
background-position: 100% 100%;
}
It's because your CSS refers to the class homeimage and NOT the ID (that's what it is in your markup). 这是因为你的CSS引用了类homeimage而不是 ID(这就是你的标记中的内容)。
#homeimage
{
opacity: 0.3;
background-image:url("http://www.imagegoeshere.jpg");
background-repeat:no-repeat;
background-attachment: fixed;
background-position: 100% 100%;
}
在CSS中使用#homeimage,句点指的是一类homeimage。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.