我的标题正在移动 [英] My Header is moving

查看:108
本文介绍了我的标题正在移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在页面顶部添加一个标题。它可以在IE 8下正常工作。它稍微向下移动,并阻止我的页面内容在最新的IE和苹果Safari浏览器上。任何人都可以向我展示我需要放置什么,以便它与所有搜索引擎兼容?我是PHP将我的页眉包含在我的所有页面中。以下是我的标题代码。

I'm trying to put a header on top of my pages. It works fine with IE 8. It moves slightly down and blocking my page content on the newest IE and apple safari. Can anyone show me what I need to put so that it is compatible for all search engines? I am PHP Including my header to all my pages. Below is my header code.

<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>


推荐答案

假设这是您正在讨论的标题。 ..

Assuming this is the header you're talking about...

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

...它应该看起来像这样。我认为你需要指定顶部,并使其位置绝对

...it should look something like this. I think you'll need to specify top and make its position absolute.

HTML:

HTML:

<img class='header' />

CSS:

CSS:

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

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

Try to avoid "inline styling" - this is where you set the style of the element directly in the HTML.

从标记中分离样式是一种很好的做法,一个更复杂的页面,你可以更轻松地找到你的方式。

It is good practice to split the style from the markup, since later, in a more complex page, you can find your way around more easily.

这篇关于我的标题正在移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆