Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Overlay div for popups, repeating inputs are included in overlay

1722570808

Edited 1722571982
Daniel S.
Pro
Marketplace Creator
Sheet Author
Compendium Curator
I've been experimenting with the popup feature as a sort of temporary replacement for a compendium, to include some useful information by clicking on parts of the sheet. Similar to the D&amp;D beyond character sheet, which pops up a little explainer bar for almost any element on the sheet. I'm using the guide here:&nbsp; <a href="https://wiki.roll20.net/Character_Sheet_Enhancement#Popup" rel="nofollow">https://wiki.roll20.net/Character_Sheet_Enhancement#Popup</a> It's mostly working seamlessly, however I hit an unexpected hickup. It seems that repeating input fields, some div elements, and some of the images are included as part of the popup overlay.&nbsp; I'm not really even sure where to begin troubleshooting this, as I don't fully understand how the overlay element works. But if it helps, here's one example of a popup in the html, as well as the relevent CSS. &lt;div class="passiveperceptiontable"&gt; &lt;div class="passiveperceptiontabletoprow"&gt; &lt;div class="passiveperceptionsimage"&gt; &lt;div class="box"&gt; &lt;a class="button" href="#popup2"&gt;&lt;img class="REFImg" src="<a href="https://github.com/danimagaming/ForgeofSteelRoll20beta/blob/main/WT%20Icon.png?raw=true" rel="nofollow">https://github.com/danimagaming/ForgeofSteelRoll20beta/blob/main/WT%20Icon.png?raw=true</a>" width="23" height="23"&gt;&lt;/img&gt;&lt;/a&gt; &lt;/div&gt; &lt;div id="popup2" class="overlay"&gt; &lt;div class="popup"&gt; &lt;h2&gt;Passive Perception Table&lt;/h2&gt; &lt;a class="close" href="#"&gt;×&lt;/a&gt; &lt;div class="content"&gt; &lt;p&gt; Passive score totals are used passively, in that you as a player don't roll anything. They are compared against a DC of something in the environment, like a trap or hidden object, to determine if you notice something. Sometimes an opposed roll is made instead, which must beat your passive score to succeed. &lt;br&gt;&lt;br&gt; Passive scores start with a&lt;strong&gt;base value of 7&lt;/strong&gt; (equal to an average die roll), and then add your Wit + your skill modifier. &lt;br&gt;&lt;br&gt; &lt;strong&gt;Passive Perception&lt;/strong&gt; is your general &lt;i&gt;Perception&lt;/i&gt; skill. &lt;strong&gt;Enemy Detection&lt;/strong&gt; is used against &lt;i&gt;Stealth&lt;/i&gt; rolls. &lt;strong&gt;Passive Insight&lt;/strong&gt; is used to determine if someone is lying or hiding something. &lt;/p&gt; &lt;/div&gt; &lt;!-- close content --&gt; &lt;/div&gt; &lt;!-- close popup --&gt; &lt;/div&gt; &lt;!-- close popup1 id overlay --&gt; &lt;/div&gt; &lt;span class="passiveperceptiontotal"&gt;Total&lt;/span&gt; &lt;!-- rest of table continuied... --&gt; And the CSS .box { /* width: 90%; margin: 0; background: none; padding: 35px; border: 2px solid gray; border-radius: 20px/50px; background-clip: padding-box; text-align: center; */ } .button { /* font-size: 1em; padding: 10px; color: black; background-color: orange; border: 1px solid #06D85F; border-radius: 20px/50px; text-decoration: none; */ cursor: help; } .button:hover { /* background: gray; */ color: green; } .overlay { position: fixed; top: 0; bottom: 0; left: 0; right: 0; background: rgba(0, 0, 0, 0.7); transition: opacity 500ms; visibility: hidden; opacity: 0; } .overlay:target { visibility: visible; opacity: 1; } .popup { margin: 0px auto; /* padding: 13px; */ background: #292328; color: #deddd7; border-radius: 5px; border: 1px solid gray; width: 30%; position: relative; left: 0px; top: 56px; font-family: georgia, palatino, times new roman; /* transition: all 5s ease-in-out; */ } .popup h2 { margin-top: 0px; margin-bottom: 8pt; padding-top: 6px; padding-bottom: 2px; color: white; height: 22px; font-family: Girassol, Garamond, Tahoma, Arial, sans-serif; text-align: center; vertical-align: bottom; background: black; font-size: 12pt; } .popup .close { position: absolute; top: 0px; right: 20px; /* transition: all 200ms; */ font-size: 30px; font-weight: bold; text-decoration: none; color: #cc8c47; opacity: .9; } div.popup .close:hover { color: #ffffff; } .popup .content { max-height: 30%; overflow: auto; } @media screen and (max-width: 700px){ .box{ width: 70%; } .popup{ width: 70%; } } div.popup .content { text-indent: 16px; text-align: left; margin-left: 12px; margin-right: 12px; margin-bottom: 12px; font-size: .93rem; font-family: Garamond, Georgia, Palatino; } It does appear that removing position: relative here fixes this. But is this part of the code important? Any risks of disabling this? What CSS specificity would I even need to use to override this? It seems I sorta solved one aspect of it, or found a temporary fix. But I'm a little perplexed about what's going on and why, and would appreciate anyone who understands what's going on here or some tips on how to go about this without changing things and having unintended consequences due to lack of awareness. And as far as I'm aware, you can't remove a CSS element, you'd have to replace it with something else? Thanks!
1722571822
Daniel S.
Pro
Marketplace Creator
Sheet Author
Compendium Curator
It seems getting rid of position: relative, and changes to position: inherit or something, works for some of the repeating inputs, and the images. But this whole section is still a mystery to me, as to why it's included in the overlay.
1722572032

Edited 1722572060
vÍnce
Pro
Sheet Author
That's looking sharp. If you haven't done so, I would experiment with display, positioning, and z-index to ensure your pop-up is always "above" the other sheet elements. Helpful: <a href="https://ishadeed.com/article/understanding-z-index/" rel="nofollow">https://ishadeed.com/article/understanding-z-index/</a>
1722572127
Daniel S.
Pro
Marketplace Creator
Sheet Author
Compendium Curator
Thanks! The aesthetics are coming along. That sounds like the sort of thing I'm looking for. I'll take a look! Thanks!
1722572448
Daniel S.
Pro
Marketplace Creator
Sheet Author
Compendium Curator
Sweet, all I had to do was add: z-index: 1; to the overlay element. Didn't have to change it from position: fixed, to position: relative. Sweet! Thanks for the tip! I really had no idea where to start, thanks for making it easy!
1722597011
GiGs
Pro
Sheet Author
API Scripter
I was just about to say, this is a z-index issue. The z-index sets the verticality of an element (and 0 is the default). Setting to 1 puts it above everything usually, but if you manually create z-index elements yourself, you might what to put a higher z-index. I usually use 99 for anything I really want to be on the top - you can use any number (I think they have to be integers).
1722614937
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
I'll add that with something like a pop up, it can get much more complicated because assigning a position like relative or absolute creates a new rendering context. This can cause z-indexes to not interact like you would expect across different elements.