Why do the div elements overlay here? - html

I am about that page: https://developer.mozilla.org/ru/docs/Mozilla/Connect
There is a yellow block with text "This translation incomplete Please help us to translate ..." and below a block 'article' which overlays with it.
I can't find out why this happens.
There is no absolute positioning. The below (article) block has position relative but no margins.
I am curious why it is happening. I played around in firebug with css properties and nothing helps.

You are setting
.dev-program-first {
margin-top: -60px;
}
in Connect$styles, line 80.
That affects the three boxes below to overlay the translation message. Setting it to 0, it looked fine for me. Such overlaying is often caused by negative margins, so you should avoid them if possible.

You should be able to force the warning message on top by altering it's z-index.
Of course, you need to set it as a relative positions as well.
.warning warning-review
{
position: relative;
z-index: 999999;
}
If that is what you are after. If the question is why the boxes aren't placed underneath the warning on the y axies, #ConcurrentHashMap is spot on.

Related

Why does opacity make an element appear above another, if an element without is appears below?

I have an absolutely positioned flyout table, that is hidden (display:none;) by default,
and appears (display:block;) on hovering over its heading.
It appears above everything else on the page, which is what I want.
The exception are elements with an opacity value below 1.
They appear above the hover table.
Why is that, and how could I avoid it?
JSFiddle
This is working "as it should", but to get your desired result, use z-index: 1 on your position: absolute element.
I did some more digging into this because I was curious as to why it was happening. There are two important things:
elements with position: absolute and a z-index: auto stay in the same stacking context.
an element with an opacity less than 1 creates a new stacking context.
I found this answer helpful as it goes into more depth about why this happens.
You can easily avoid it by adding z-index: 1; to table.hidden

Z-Index / positioning not working as expected

I'm trying to position image on top of colored background as shown in attached image.
I've tried setting it's Z-index higher than other elements. Didn't worked.
Set other elements z-index lower than image Z-index. Didn't worked.
Here is the webpage: https://buyshroomsonline.ca/about/
This is the ID of the image (Girls with Phone). As you can see What I'm trying to make it come on top of all other elements.
#ctrlimg{
position: relative;
z-index: 10;
top:-160px;}
I've also tried setting higher Z-index. Please take a look and help me find what I am missing.
Thanks
Remove overflow:hidden from .vc_row[data-vc-full-width] but make sure do not remove directly from .vc_row as it may have a impact on other sections. so inherit or concatenate .vc_row[data-vc-full-width] with your custom class.
For Example
.yourClass.vc_row[data-vc-full-width]

How to get DIV Beneath Other DIVs in Hierarchy?

I'm having trouble with the order of layered DIV elements. I have a DIV .lens-flare that's at the bottom of the hierarchy in HTML. Yet when I transform: translate the position so it encompasses the entire parent DIV, it shows above elements that are above it in the hierarchy.
So I tried setting z-indexes, and then turned my translate into translate3d. Still I'm not able to get .lens-flare underneath .top-nav-bar, .nav-bar, or .cta.
Currently I have a pointer-events: none applied so I can at least click on the things underneath. But how can i actually move the .lens-flare layer under everything else successfully?
Here's my CodePen for the project
Elements rendered later are considered being closer to the screen than the elements rendered before them.
Z-index is the answer if you want to change this, you just need to remember z-index works only with elements that are positioned.
.lens-flare
position: relative
z-index: 1
.nav-bar, .top-nav-bar, .cta
position: relative
z-index: 2
Your corrected codepen: http://codepen.io/sEvher/pen/doyWoW

iframe preventing z-index from working?

I've been trying to use the z-index css attribute to make one element always be in front of another, but it isn't working. The z-index of one element is clearly greater than that of the other, but it is still positioned behind the other element. Could it be because one of the elements (the one showing up in front) is an iframe? Does anyone have any other advice?
For those that arrive here later, the correct answer is to put position: relative; or any of the other position props on the problematic elements.
My recommendation would be to put this on every element involved with the problem:
position: relative;
z-index: 0;
and then increase the z-index on the back-most element(s) that are in front of the iframe.
If you do that, you will start winning pretty quick.
In my testing here, z-index only works if you have position explicitly set. Test it by modulating your z-index values and then trying to highlight the text on the screen via mouse-clicking. You should see evidence of layers acting either as desired or horribly incorrect.
I find it works great if you press F12 (to open dev pane, in Chrome) and then click the Inspect Button at the top-left or press CTRL + SHIFT + C. Then you can mouseover everything and see what their stacking context is relative to adjacent elements.
UX BONUS TIP: Remember, users may want to copy text, so make sure they can select it.
If you are having problems, most likely you are either:
missing position: relative; on an element's parent, or
missing z-index: 0; somewhere
Remember that the z-index index only counts on absolute elements. Both elements should has the position:absolute. More info in the CSS 2.1 Specification

Weird z-index behaviour preventing mouse interactions: bug or normal?

Every time I try to use z-index in a webpage to change the order of stacking overlapping divs, I seem to run into a problem where the div that is being forced lower becomes unresponsive to mouse events.
In my current situation I have:
<div class="leftcolumn">
<div class="leftbar"></div> <!-- a 95px wide bar on the left -->
...
<h3>header</h3> <!-- a little header sitting inside the leftbar
...
</div>
By default the h3 isn't showing - it's hidden behind the leftbar. If I add z-index: 5; to the h3, it still doesn't show.
So I add z-index: -1 to the leftbar. Now it's hidden behind the leftcolumn - but at least h3 shows.
So I add z-index: -2 to the leftcolumn. Now everything looks right - but you can't click on anything inside leftcolumn. The mouse cursor doesn't change from an arrow.
I get this exact behaviour in both Chrome and Firefox. IE7 doesn't show the leftbar at all, but at least stuff is clickable.
So, am I misunderstanding z-index, or is there a bug in both FF and Chrome here? Can z-index be effectively used for this kind of stuff, or do I have to find another way?
(I can change the HTML, but the less, the better.)
Ok, 10 seconds later I discover that using only positive z-index'es makes the problem go away. Perhaps negative z-index means the object is below the level that the mouse cursor notionally lives?
Do you know that in order for z-index to work right, you need to position your elements, even if they're simply position: relative (which doesn't change their position any but allows you to use z-index). That way, you should be able to give leftbar a position of, say, 2 and your h3 a position of, say, 3. And your h3 should be on top.
You can use any position type as long as you have one.
For recap:
#leftcolumn { position: absolute; z-index: 1; }
#leftbar { position: relative; z-index: 2; }
h3 { position: relative; z-index: 3; }
Even though the leftcolumn content is visible, the leftbar div is now sitting on top of it, likely with a transparent background. Ideally you would want to modify the HTML so that the H3 resides within the leftbar, but if that is not an option, you may need to apply z-index to specific elements within the leftcolumn in order to pull them above elements in the leftbar.