【发布时间】:2011-03-28 23:05:12
【问题描述】:
我正在编写一个简单的波段,该波段在我网站的浏览器底部运行。我使用半透明 PNG 作为背景来控制一切,但为了获得更大的灵活性,我被要求纯粹在 CSS 中完成。因此,我使用了带有 RGBa 的背景,并回退为纯色,并使用条件样式表,Microsoft 过滤器用于 IE 8 和更早版本。这很好用,我的背景看起来就像我想要的那样。我遇到的问题是这个横幅包含一个比它高的图像。由于我添加了过滤器,它现在可以在 IE 中进行裁剪...如果切换到纯色背景,一切正常。
这是一个已知问题吗?有什么解决办法吗?
这是我的 IE CSS:
/* This is the banner taking the whole browser width */
#bottompub {
position:fixed;
bottom:0px;
left:0px;
width:100%;
height:50px;
text-align: center;
background: transparent;
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#B289BAE4,endColorstr=#B289BAE4)"; /* IE8 */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#B289BAE4,endColorstr=#B289BAE4); /* IE6 & 7 */
zoom: 1;
margin:0;
padding:0;
overflow:visible; /* Just to make sure no parent change that to hidden */
}
/* This is the image in the banner */
#bottompub .pubimage {
position:relative;
margin-left:220px;
height:75px;
}
/* This is to fit my content web site width the image is in there */
#bottompub .insidebottompub {
width:1031px;
margin-left:auto;
margin-right: auto;
}
这是简单的 HTML:
<div id="bottompub">
<div class="insidebottompub">
<a href="http://www.mysite.com"><img class="pubimage" src="myimageof75px.png"/></a>
</div>
</div>
谢谢!
编辑不使用负边距
【问题讨论】:
标签: css transparency