Css 调整窗口大小时水平定位跨距

Css 调整窗口大小时水平定位跨距,css,Css,我使用以下代码定位了一个跨度: #Header .NavTabs .tabLevel1 { position:relative; margin:0 auto; clear:left; height:auto; z-index: 0; text-align:center; top: -90px; left: 600px; }​ 我需要它准确地定位在它现在相对于屏幕的水平位置。然而,每当我水平收缩浏览器窗口时,因为我已

我使用以下代码定位了一个跨度:

#Header .NavTabs .tabLevel1 { 
    position:relative; 
    margin:0 auto; 
    clear:left; 
    height:auto; 
    z-index: 0; 
    text-align:center; 
    top: -90px; 
    left: 600px;
}​
我需要它准确地定位在它现在相对于屏幕的水平位置。然而,每当我水平收缩浏览器窗口时,因为我已经设置了left:600px;它不是呆在我需要的地方。是否有其他方法将其置于左侧:600px;但是根据屏幕大小自动调整它的位置

[编辑]我很愚蠢。我知道答案了。我这样做:

#Header .NavTabs .tabLevel1 { 
    position:relative; 
    margin:0 auto; 
    clear:left; 
    height:auto; 
    z-index: 0; 
    text-align:center; 
    top: -85px; 
    margin-left: 51.5%;
}​
#Header .NavTabs .tabLevel1 { 
    position:relative; 
    margin:0 auto; 
    clear:left; h
    eight:auto; 
    z-index: 0; 
    text-align:center; 
    top: -85px; 
    margin-left: 51.5%;
}​

您可以使用可见宽度(vw)代替固定数量的像素。这将更好地与不同大小的屏幕和分辨率


因此,生产线将向左:50vw

我很愚蠢。我知道答案了。我这样做:

#Header .NavTabs .tabLevel1 { 
    position:relative; 
    margin:0 auto; 
    clear:left; 
    height:auto; 
    z-index: 0; 
    text-align:center; 
    top: -85px; 
    margin-left: 51.5%;
}​
#Header .NavTabs .tabLevel1 { 
    position:relative; 
    margin:0 auto; 
    clear:left; h
    eight:auto; 
    z-index: 0; 
    text-align:center; 
    top: -85px; 
    margin-left: 51.5%;
}​

你能提供更多的上下文,比如html,一个工作示例,这个跨度应该在哪里?@MrLister-Oops,哈哈,谢谢!西蒙,谢谢!只要浏览器窗口被调整到非常小的大小,这种方式就可以工作,但在全屏显示时,它离需要的位置很远:(.有没有办法做到像这样,左边距百分比?