Create non-transparent div on top of transparent parent element

前端 未结 7 1681
渐次进展
渐次进展 2020-12-29 04:35

EDIT: Changed title to actually be correct

I\'m trying to simulate a modal popup in all HTML and CSS and am having a bit of bad luck w

7条回答
  •  囚心锁ツ
    2020-12-29 05:21

    The way that I was able to put a transparent div behind an opaque div was to use something like:

    `div.transparent-behind { opacity: 0.4; 
                          z-index: -1; }
    
     div.opaque-ontop { position: absolute; 
                    top: (wherever you need it to fit)px;
                    left: (some # of)px}'
    

    where the div's were not nested inside each other, but one right after another in the html

    make sense?

提交回复
热议问题