简体   繁体   English

高于DIV的透明PNG给出了奇怪的结果

[英]Transperent PNG above DIV gives weird results

I have weird problem where placing transparent png above div makes png take websites background color and apply it to entire transparent area instead displaying things that are below the image. 我有一个奇怪的问题,其中在div上方放置透明png会使png采取网站背景颜色并将其应用于整个透明区域,而不是显示图片下方的内容。

Colors of div and image are identical. div和图像的颜色相同。

How I expected it to look: http://i.imgur.com/ccr8jkn.jpg 我希望它看起来如何: http : //i.imgur.com/ccr8jkn.jpg

How it looks: http://i.imgur.com/fK1xZgI.jpg 外观: http//i.imgur.com/fK1xZgI.jpg

I'm not really sure maybe it's not even possible enlighten me. 我不确定,甚至不可能启发我。

Markup looks like this. 标记看起来像这样。

<div id="wrapper">
  <div id="menubarwrap">
    <div id="menubar"></div>
  </div>
  <div id="logo">
    <img class="menu-logo" src="/img/etc..">
  </div>
</div>

CSS: CSS:

#wrapper {
  position: relative;
}
#wrapper #menubarwrap #menubar {
  margin: 110px 0 0 0;
  height: 50px;
  width: 100%;
  background: #122137;
}
#wrapper #logo .menu-logo {
  position: absolute;
  margin: 0 auto;
  display: block;
  top: -75px;
  right: calc(50% - 100px);
}

Reset the background and it might work. 重置背景,它可能会起作用。 Could you try this CSS: 您可以尝试以下CSS:

#wrapper #logo .menu-logo {
  position: absolute;
  margin: 0 auto;
  display: block;
  top: -75px;
  right: calc(50% - 100px);
  background: none;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM