我的标题正在移动

时间:2012-11-13 00:37:02

标签: html header

我正在尝试在页面顶部放置标题。它适用于IE 8.它稍微向下移动并阻止我的页面内容在最新的IE和苹果狩猎。任何人都可以告诉我我需要放置什么,以便它兼容所有搜索引擎?我是PHP包括我的所有页面的标题。下面是我的标题代码。

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>

<body>

<div style="position: absolute; width: 1280px; height: 92px; z-index: 1; left: 1px; top: 0px" id="layer1">
    <div style="position: absolute; width: 660px; height: 22px; z-index: 1; left: 238px; top: 52px" id="layer2">
        <font face="Arial">|<b>
        <a href="http://www..net/carriers/test3.php">New Cost</a> </b>| <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </b>|<b> <a href="http://www..net/carriers/newcarrier.php">New 
        Carrier</a></b> | <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </b>|<b> <a href="http://www..net/carriers/search.php">Carrier 
        Board</a></b> | </font></div>
    <p>
    <img border="0" src="/carriers/.png" margin= 0 auto width="100%" height="73"></div>


</body>

</html>

1 个答案:

答案 0 :(得分:0)

假设这是你正在谈论的标题......

<img border="0" src="/carriers/echoheader.png" margin= 0 auto width="100%" height="73">

......看起来应该是这样的。我认为您需要指定top并将其定位absolute

HTML:

<img class='header' />

CSS:

img.header {
   position:absolute;
   top:0;
   ...other styles...
}

尽量避免使用“内联样式” - 这是您直接在HTML中设置元素样式的地方。

最好将样式与标记分开,因为稍后,在更复杂的页面中,您可以更轻松地找到方法。