How can i allow opacity to a div and not the background image?

≡放荡痞女 提交于 2019-12-05 12:22:32

Well, I can't think of any ways to do this by using only the single element that already exists without using a CSS3 solution... You're already using JavaScript, so maybe you could create a box that contains that loading image in the background at the bottom of the page and hide it, then position it in the center of the division and un-hide it?

Anyways, here's the CSS3 solution I came up with:

.ajax-mask {
    position: relative;
}
.ajax-mask:after {
    background: rgba(255, 255, 255, 0.5) url('/Images/Ajax/Ajax.gif') no-repeat center center;
    content: " ";
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
}

Make it so the loading div / background image isn't a child of the div you're applying the lowered opacity to.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!