我想在容器的背景上制作一个透明盒子,但是,我不能在背景中间做它,而是当我尝试使用顶级盒子时,缘来实现我的设计,它会移动的背景图像倒也,所以我想问一下,为什么我不能让它像由W3C给出的例子中http://www.w3schools.com/Css/tryit.asp?filename=trycss_transparency用CSS制作一个透明盒子
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" Content="text/html; Charset=UTF-8">
<title>
Portal
</title>
<link rel="stylesheet" href="style.css" type="text/css"/>
<script type="text/javascript" src="ajax.js"></script>
</head>
<body onload="load()">
<div id="header">
<img src="images/logo.gif" id="logo" alt="Logo"/>
<a href="http://www.google.com">
<img src="images/a.png" id="logo2" align="right" alt="logo"/>
</a>
</div>
<div id="container">
<div id="function"></div>
<div id="Display"></div>
<div id="View"></div>
</div>
<div id="footer">
</div>
</body>
</html>
这里的CSS文件:
body{
font-size:100%;
margin: 0em 9em 0em 9em;
}
#header{
width:55em;
height:2.375em;
background:black;
border: 0em 0em 0em 0em;
}
#logo{
padding: 0em 0em 0em 2em;
}
#logo2{
width:3.618em;
height:2.3em;
margin: 0.1em 0.25em 0.1em 0em;
}
#container{
width:55em;
height: 36.25em;
background-image:url("images/background1.jpg");
margin: 0.25em 0em 0em 0em;
}
#function{
width:35em;
height:32.625em;
margin: 2em 10em;
background-color: #ffffff;
opacity:0.6;
filter:alpha(opacity=60);
}
#footer{
font-family:"Times New Roman";
width:62em;
font-size:0.75em;
color:grey;
border-top-style:solid;
border-color:grey;
border-width:0.25em;
margin: 0.25em 0em 0em 5em;
}
相关http://stackoverflow.com/questions/806000/transparent-background-but-not-the-content-text-images-inside-it-in-css-on – 2014-03-02 14:09:45