【发布时间】:2023-03-23 08:42:01
【问题描述】:
我正在制作一个网站,但我只想显示一个通知(仅在会员打开网站时显示一次)。此通知必须显示在 html 主页的正上方(因为主页可能会因会员而异)。我想用'opacity'在首页上方做一个淡入淡出的页面(这样会员也可以在通知的四个侧面旁边看到主页),我不能使用“alert”,因为通知包含图片、代码和一些额外的功能诸如正面颜色之类的代码。到目前为止,我发现'opacity' 使用了上面的图片,但是我如何在我的网站的 html 主页上方使用'opacity' ???
<html>
<head>
<style>
div.bacgro
{
width:500px;
height:250px;
background:url of a jpg file;
border:2px solid black;
}
div.trabox
{
width:400px;
height:180px;
margin:30px 50px;
background-color:#ffffff;
border:1px solid black;
opacity:0.6;
filter:alpha(opacity=60); /* For IE8 and earlier */
}
div.trabox p
{
margin:30px 40px;
font-weight:bold;
color:#000000;
}
</style>
</head>
<body>
<div class="bacgro">
<div class="trabox">
<p>This is some text that is placed in the transparent box. It may contain some code and small profile image also ...
</p>
</div>
</div>
</body>
</html>
但最重要的是,我想将 background:url of a jpg file; 替换为 background:"url of my site's homepage";
【问题讨论】:
-
你已经尝试了什么?
-
问题回答了吗?
标签: html css opacity opacitymask