简体   繁体   English

在javascript元素上放置html元素

[英]Positioning of an html element over a javascript one

this is the website I'm working on: http://labbrini.netsons.org and on its left side I have a div (#puntate) that should be on top of the javascript of the big lips logo (#logo) that shows up over everything. 这是我正在使用的网站: http ://labbrini.netsons.org,左侧是div(#puntate),该div应该位于大嘴唇徽标(#logo)的javascript顶部,显示一切。 Of course I need the links of #puntate being clickable even when logo shows over it. 当然,即使徽标显示在其上,我也需要单击#puntate的链接。 z-index doesn't works for this. z-index不适用于此功能。 Can somebody help me with this positioning? 有人可以帮我这个位置吗?

While inspecting your code in my browser, I saw that you were using px for z-index . 在浏览器中检查代码时,我看到您正在使用px作为z-index

Dont give any units for z-index 不要给z-index提供任何单位

In your CSS, replace, 在您的CSS中,替换为

z-index: 900px;

with

z-index: 900;

As, stated in the docs 文档中所述

The z-index property specifies the z-order of an element and its descendants. z-index属性指定元素及其后代的z顺序。

And, order doesnt have a unit. 而且,订单没有单位。 Thus no need for any units. 因此不需要任何单位。 Any element with a higher z-index will be on top of other elements. 具有更高z-index的任何元素都将位于其他元素之上。

Thank you all. 谢谢你们。 The value to the z-index was my stupid mistake. z-index的值是我的愚蠢错误。 But I needed to tinker a little bit more in order to get what I wanted. 但是我需要多花一点功夫才能得到想要的东西。 I created another div #left2 我创建了另一个div#left2

<div id="left"></div>
<div id="left2"><div id="puntate"><ahref="http://labbrini.netsons.org/Labbrinip1"> 
Labbrini p.1 - Lorem ipsum dolor sit amet</a><br/> 
</div></div>

so that my div in question (#puntate) belongs to the new one and I set the background-color to transparent in order to see below the old one with the color transition: 这样我的div(#puntate)属于新的div,因此我将background-color设置为透明,以便在具有颜色过渡的旧div下方看到:

#left2 {
background-color : transparent;
position:fixed;
display: table;
z-index:1000;
width:50%;
height:100%;
position:fixed;
bottom:0;
left:0;
}

and of course the z-index of #puntate is set to an higher value than #logo 当然,#puntate的z-index设置为比#logo高的值

I'm sorry for not having posted previously the code. 抱歉,您以前没有发布过代码。

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

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