我有
#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;"
}
但是,名称中心会干扰名称和名称div。我如何才能使名称中心忽略页面上的所有内容,以便将其放在我想要的地方?
答案 0 :(得分:0)
使其成为绝对值,并且它将相对于最接近(向上的树)元素定位,其位置不是static
:Fiddle
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 */