nav li border off in safari

时间:2011-07-12 15:39:23

标签: html css

通常我在AS3论坛,但我正在努力提高我的CSS技能。我正在尝试创建一个网站。但我与safari有相容性问题。我的导航列表有一个边框,我使用填充来使边框更大并以文本为中心。但在野生动物园中,边界被推向左边。

第一个问题是有人可以帮忙吗? 第二个问题是哪些书籍或哪些资源最适合学习跨浏览器兼容性?

    <html>
    <head>

            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
                <!-- Internet Explorer HTML5 enabling code: -->

                <!--[if IE]>
                <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>

                <style type="text/css">
                .clear {
                  zoom: 1;
                  display: block;
                }
                </style>


                <![endif]-->
        <title>Antonn Harden Jr | Interactive Designer</title>
        <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js' type='text/javascript'></script>
        <script type="text/javascript" src="js/scripts.js"></script>
        <script>



    html, body, div, span, applet, object, iframe,
    h1, h2, h3, h4, h5, h6, p, blockquote, pre,
    a, abbr, acronym, address, big, cite, code,
    del, dfn, em, img, ins, kbd, q, s, samp,
    small, strike, strong, sub, sup, tt, var,
    b, u, i, center,
    dl, dt, dd, ol, ul, li,
    fieldset, form, label, legend,
    table, caption, tbody, tfoot, thead, tr, th, td,
    article, aside, canvas, details, embed, 
    figure, figcaption, footer, header, hgroup, 
    menu, nav, output, ruby, section, summary,
    time, mark, audio, video {
        margin: 0;
        padding: 0;
        border: 0;
        vertical-align: baseline;
    }
    /* HTML5 display-role reset for older browsers */
    article, aside, details, figcaption, figure, 
    footer, header, hgroup, menu, nav, section {
        display: block;
    }
    body {
        line-height: 1;
    }
    ol, ul {
        list-style: none;
    }
    blockquote, q {
        quotes: none;
    }
    blockquote:before, blockquote:after,
    q:before, q:after {
        content: '';
        content: none;
    }
    table {
        border-collapse: collapse;
        border-spacing: 0;
    }



    body {
        font-family: 'DroidSansRegular', Arial, Helvetica, sans-serif;
        font-size: 1em;
        background-color: #999999;
        height: 100%;
        overflow-y:scroll; /*** scrollbar **/
    }

    p{
        line-height:1.5em;
        padding-bottom:1em;
        color: #fff;
    }

    a, a:visited {
        text-decoration: none;
        color:#ffffff;
        outline: none;
    }

    a:hover {
        color: #fff;
    }

    h2, h3, h4{
        line-height: 1.5;
        text-shadow: 5px 5px 3px #333;
        color: #FFFFFF;
    }

    h2, h3, h4, nav{
        font-family: 'ArchitectsDaughterRegular';   
    }

    @font-face {
        font-family: 'ArchitectsDaughterRegular';
        src: url('architects-daughter-fontfacekit/ArchitectsDaughter-webfont.eot');
        src: url('architects-daughter-fontfacekit/ArchitectsDaughter-webfont.eot?#iefix') format('embedded-opentype'),
             url('architects-daughter-fontfacekit/ArchitectsDaughter-webfont.woff') format('woff'),
             url('architects-daughter-fontfacekit/ArchitectsDaughter-webfont.ttf') format('truetype'),
             url('architects-daughter-fontfacekit/ArchitectsDaughter-webfont.svg#ArchitectsDaughterRegular') format('svg');
        font-weight: normal;
        font-style: normal;

    }

    @font-face {
        font-family: 'DroidSansRegular';
        src: url('ds/DroidSans-webfont.eot');
        src: url('ds/DroidSans-webfont.eot?#iefix') format('embedded-opentype'),
             url('ds/DroidSans-webfont.woff') format('woff'),
             url('ds/DroidSans-webfont.ttf') format('truetype'),
             url('ds/DroidSans-webfont.svg#DroidSansRegular') format('svg');
        font-weight: normal;
        font-style: normal;

    }

    .line{
        height:1px;
        background-color:#FFF;
        width: 100%;
        overflow:hidden;
    }

    .clear:after{
        content: ".";
        display: block;
        height: 70px;
        clear: both;
        visibility: hidden;
    }



    /***      HEADER      ***/

    #wrapper {
        margin: 0 auto;
        position: relative;
        width: 960px;   
    }

    header { 
        position:relative;
        bottom:0;
    }

    #logo {
        padding: 50px 0 0 12px;
    }

    nav a {
        padding: 3px 14px;  
    }

    nav ul{
        font-size: 20px;
        float: right;
        margin: -10px 0 0 0;
    }

    nav ul li {
      padding: 0 6px;
      list-style: none;
      float: left;
    }

    nav a:hover {
        outline: medium none;
        background-color:#990505;
        color: #fff;
    }



    nav ul li a.current {
        background-color: #990505;
    }

/**** ABOUT ****/

section#about {
    padding-top: 25px;
}

#content {
    padding-top: 10px;
    width: 61%;
    font-size: 1.2em;
    color: #FFF;    
}

section#about aside{
    float: right;
    color: #fff;
    width: 20%;
}

section#about aside h3 {
    font-size: 18px;    
}

section#about aside ul {
    list-style: none;
    margin: 10px 0;
}

section#container aside ul li{
    margin: 2px 0;  
}


/***       FOOTER      ****/

footer {
    background-color: #FFF;
    height: 50px; 
    position:fixed;
    width: 100%;
    padding-top: 10px;
    bottom: 0;
    left: 0;
}


footer h4{
    position:absolute;
    margin-top: 0px;
    margin-left: 680px;
    color: #990505;
    font-size: 20px;
}

footer ul {
    float:right;

}

footer ul li {
    padding: 0 3px; 
    display: inline;
}

        </script>
        </head>
        <body>

                <header>

                    <div id="wrapper">

                        <div id="logo"><a href="index.html"><img src="img/logo.png" alt="home"></a></div>

                        <nav> 


                            <ul>
                                <li><a href="index.html"> home </a></li>
                                <li><a href="about.html" class="current"> about </a></li>
                                <li><a href="work.html"> work </a></li>
                                <li><a href="contact.html"> contact </a></li>
                            </ul>


                       </nav>
                   </div>

                </header>

                </section>

                <section id="about">

                    <div id="wrapper">

                         <article id="content">   

                            <p>
                                Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus 
                            </p>

                            <p>
                                Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus
                            </p>

                        </article><!--- content -->

                        <div class="clear"></div>

                    </div>

             </section>


            <footer>

                <div id="wrapper">

                    <h4>Follow Me</h4>

                    <ul id>
                        <li><a href="" TARGET="_blank"><img src="./icons/facebook_alt.png"></a></li>
                        <li><a href="" TARGET="_blank"><img src="./icons/linkedin_alt.png"></a></li>
                        <li><a href="" TARGET="_blank"><img src="./icons/twitter_alt.png"></a></li>
                    </ul>

                </div>

            </footer>

        </body>
    </html>

2 个答案:

答案 0 :(得分:3)

那是你的第一个问题。您的代码中是否使用了{c}标记而不是<script>标记。

假设第一个问题只是在复制到网站时发生的错误,解决填充问题的方法是在<style>上设置display:block

nav a

答案 1 :(得分:0)

首先,您的问题已解决:

nav a {
  display: block;
  padding: 3px 14px;
}

现在,没有任何书可以引导您了解每个网络浏览器的所有特性。值得一读的唯一怪癖是IE 6,7和8,如果你遵守标准,其余的浏览器就会正常运行。

每隔一段时间就会出现一个虫子并抬起它丑陋的脑袋。你会找到解决方法。 Safari与Chrome共享相同的渲染引擎,但问题仅在Safari中可见!因此,不要过于担心它,最终它变得足够直观,以便您可以自己完成修复。