Html CSS:将div置于任何其他元素之上?

Html CSS:将div置于任何其他元素之上?,html,css,Html,Css,我试图让navigator游戏窗口显示在画布元素和其他所有元素之上,它似乎总是在这些元素后面。当我加载页面时,我可以在顶部看到它一瞬间,然后它消失,再也不会出现 我怎样才能让它在上面运行?我试过换个姿势,但没用 HTML: 使用position:absolute或position:fixed和top:0以及left:0作为导航器游戏窗口id和类css 希望这能奏效。我使用的是stackoverflow iOS应用程序,无法进行太多的代码格式化:(我不能完全确定我是否理解您的要求,因为我看不到图像

我试图让navigator游戏窗口显示在画布元素和其他所有元素之上,它似乎总是在这些元素后面。当我加载页面时,我可以在顶部看到它一瞬间,然后它消失,再也不会出现

我怎样才能让它在上面运行?我试过换个姿势,但没用

HTML:


使用position:absolute或position:fixed和top:0以及left:0作为导航器游戏窗口id和类css


希望这能奏效。我使用的是stackoverflow iOS应用程序,无法进行太多的代码格式化:(

我不能完全确定我是否理解您的要求,因为我看不到图像的正常外观。但是,如果您希望导航器游戏窗口始终可见,您需要使用

#navigator-game-window {
position: absolute;
top: 0;
left: 0;
}
将元素定位在具有相对定位的最近父div的左上角。除非手动将另一个父div设置为position:relative;,否则使用此代码将其设置为相对于

下面是一个JSFIDLE,其中包含您提供的代码副本,并粘贴到其中进行必要的更改:

body {
    background-color: black;
    overflow: hidden;
}

#loading-screen {
    font-family: sans-serif;
    text-align: center;
    position:fixed;
    padding:0;
    margin:0;
    height: 100%;
    width: 100%;
    background-color: #0E151C;
    color: white;
    padding-top: 147px;
    margin-top: -8.1px;
    margin-left: -7.7px;
}

#loading-images {
    position: relative;
}

#loading-images img {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.last-loading-image{
    padding-top: 51px;
    padding-left:11px;
}

#loading-text {
    padding-top: 456.7px;
    text-align:center;
    font-family: 'Ubuntu', sans-serif;
    font-size:28.1px;
    font-family: Ubuntu;
    letter-spacing: 0.4px;
}

#loading-bar {
    border: 1px solid white;
    width: 392.8px;
    height: 18px;
    border-radius: 3px;
    margin-left: auto;
    margin-right: auto;
    margin-top: -16px;
    padding: 3px;
    background-color: black;
}

.loading-bar-center {
    width: 76%;
    background: #BACAD3;
    height: 8px;
    border-bottom: 10px solid #8CA1AD;
}

.loading-progress-text {
    font-size: 13.5px;
    font-weight: 600;
    font-family: 'Ubuntu', sans-serif;
    color: rgb(138, 138, 138);
    text-align: center;
    margin-top: -1px;
    margin-top: 7px;
}

.container {
    display: none;
}

#bottom-bar {
    position: fixed;
    background-color: #2F2F2F;
    left: 0;
    bottom: 0;
    height: 51px;
    width: 100%;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    color: #fff;
    z-index: 2000;
    background:linear-gradient(to bottom,#53524f 2px,orange 2px,red 1px, transparent 0);
    background-color: #2F2F2F;
    border-bottom: 1px solid #53524f;
    border-top: 1px solid #2F2F2F;
}

#bottom-bar img {
    float: left;
}

.bottom-bar-view-more-icon {
    height: 43.1px;
    border-top-right-radius: 7px;
    border-bottom-right-radius: 7px;
    position: absolute;
    line-height: 35px;
    left: 0;
    cursor: pointer;
    top: 2px;
    padding-left: 2px;
    background-color: #3A3832;
    color: #9C9791;
    font-weight: 600;
    width:12px;
}

.bottom-bar-view-more-icon {
    margin-top: 2.4px;
    padding-left: 1.7px;
    margin-bottom: 1px;
}

.bottom-bar-view-more-icon img {
    padding-top: 17px;
    padding-left: 2px;
}

.bottom-bar-home-icon img {
    padding-left: 25px;
    padding-top: 10px;
}

.bottom-bar-rooms-icon img {
    padding-left: 15px;
    padding-top: 10px;
}

.bottom-bar-catalog-icon img {
    padding-left: 13px;
    padding-top: 5.5px;
}

.bottom-bar-avatar {
    margin-top: -17.6px;
    margin-left: 167px;
}

.bottom-bar-avatar img {
    position: absolute;
    clip: rect(0, 150px, 64px, 0);
}

.bottom-bar-seperator {
    margin-left: 231px;
    width:1.4px;
    background-color: rgba(104, 104, 104, 0.308);
    height:40px;
    margin-top: 22.4px;
}
html, body, div, canvas {
    margin: 0;
    padding: 0;
}

#game_canvas {
}

#hotel-view {
    background: url(http://www.habbo.com/habbo-imaging/avatarimage?hb=hd-3091-8.lg-3078-81.hr-8…wa-2005-62&action=wlk&gesture=sad&direction=2&head_direction=2&gesture=sml),url(http://habboo-a.akamaihd.net/c_images/reception/val18_background_left.png),url(http://habboo-a.akamaihd.net/c_images/reception/meter_level_1_vip_icon_lympix.png),url(http://habboo-a.akamaihd.net/c_images/reception/background_right_easter2016.png),url(http://habboo-a.akamaihd.net/c_images/reception/val18_background_gradient.png);
    background-position: 11.5% 92%, left bottom, left bottom,right bottom;
    background-repeat: no-repeat,no-repeat, no-repeat,no-repeat,repeat-x,repeat-x;
    background-color: #68E5FF;
    width: 100%;
    height: 794px;
    margin-top: -38px;
}

.hotel-view-avatar {
    margin-top: 399px;
    margin-left: 120.6px;
}

.hotel-view-logo {
    padding-top: 38px;
    padding-left: 100px;
}

#navigator-game-window, .navigator-game-window {
    position: relative;
    background-color: red;
    height: 51px;
    width: 100%;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    color: #fff;
    z-index: 2001;

}
#navigator-game-window {
position: absolute;
top: 0;
left: 0;
}