2

我正在尝试创建一个带有背景的简单搜索栏,并在旁边添加一个“高级”href。它在 Chrome、Mozilla 中正确呈现,但是在 IE 8 中,href 显示为下面一行的单独块?

我的 HTML 代码:

<!DOCTYPE html>
<html lang = "en">
<head>
<meta charset="utf-8" />
<title>FireFox HomePage</title>
<!--[if lt IE 9]>
    <script src="../HTML5Shiv/dist/html5shiv.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="MainPage1.css" />
</head>

<body>
<header>
    <div class="wrapper">
        <a href="#"><img src="../../IMG/FireFox.png" alt="FireFox Logo"     title="FireFox Home" /></a>     
        <span id="usernav"><a href="#">Logout</a><a href="#">My Profile</span>  
    </div>

    <form action="" method="Search">
        <p>
            <input type="search" />
            <input type="submit" value="Search"/>
            <a href="#">Advanced</a>
        </p>                    
    </form>         
</header>

</body>
</html>

我的 CSS 代码:

        /* CSS Reset */
    * { margin: 0; padding: 0; }

    html { height: 101%; font-family: “Helvetica Neue”, Arial, Helvetica, sans-serif; background: #fff; }
    body { font-size: 62.5%; font-family: Helvetica, Arial, sans-serif; line-height: 10%; }
    img { border: 0;}

    /* HTML5 display-role reset for older browsers */
    article, aside, details, figcaption, figure, 
    footer, header, hgroup, menu, nav, section {
        display: block;
    }

    /* Main CSS */

    header { width: 1000px; margin: 0 auto; clear: both;}
    .wrapper { width: 1000px; margin: 0 auto; margin-top: 10px;}

    #usernav { position: relative;  margin-top: 20 px; font-size: 12px;}
    #usernav a { color: #444; text-shadow: 0px 1px 1px #ddd; text-decoration: none;  float: right; padding: 8px;}   
    #usernav a:hover { text-decoration: underline; }

    form{background-color: #eee; border-bottom: 1px solid #dadada; height: 50px;}


    /** @group clearfix **/
    .clearfix:after { content: "."; display: block; clear: both; visibility: hidden; line-height: 0; height: 0; }
    .clearfix { display: inline-block; }
    html[xmlns] .clearfix { display: block; }
    * html .clearfix { height: 1%; }
4

1 回答 1

0

好的,在玩了一点代码之后,我已经解决了这个问题。似乎删除

<span id="usernav"><a href="#">Logout</a><a href="#">My Profile</span> 

从 div 中并将其直接放在标题中解决了 IE 错误。不知道为什么,欢迎提出建议。我无法发布图片,因为我的声誉点数不超过 10 :(

于 2012-09-13T14:50:19.510 回答