2014-02-16 43 views
0

股利干扰我与其他的div

#nameleft { 
    margin-left: 170px; 
    margin-top: -170px; 
    font-size: 40px; 
    font-family: Georgia, "Times New Roman", Times, serif;" 
} 
#nameright { 
    float: right; 
    margin-right: 20px; 
    margin-top: 180px; 
    font-size: 40px; 
    font-family: Georgia, "Times New Roman", Times, serif;" 
} 
#namecenter { 
    margin-left: 400px; 
    margin-right: auto; 
    font-size: 20px; 
    text-align: center; 
    font-family: Georgia, "Times New Roman", Times, serif;" 
} 

但随着nameright和nameleft的div的namecenter一个干扰。我怎样才能让这个namecenter忽略页面上的所有内容,这样我就可以把它放在我想要的地方?

回答

0

让它绝对的,这将是相对定位成与位置最近的(往上走的树)元素,是不是staticFiddle

position: absolute; 
top: 0; /* Distance from top of this element to top of positioning element */ 
left: 400px; /* Distance from left of this element to left of positioning element */ 
+0

我傻我只是忘了添加<字体样式=“position:absolute;”> div中的字母hahaha – Friedpanseller

+0

@Friedpanseller仅供参考,''标签自HTML 4.0.1起弃用,使用''用CSS。 – bjb568