网站完美地显示在Chrome中,但不是在mozilla或IE中

时间:2014-08-18 22:36:21

标签: html css html5 css3 google-chrome

这里是html和css的代码片段。它可以在Google Chrome中找到,但是当我尝试在mozilla或IE中显示它时,它会显示完全不同的东西。我无法附加图片,因为我没有所需的声誉。我非常感谢你的帮助。谢谢!

HTML

<!DOCTYPE html>
<html>
<head>
 <meta charset="utf-8" />
 <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
 <meta name="viewport" content="width=device-width, initial-scale=1" />
 <link rel="stylesheet" type="text/css" href="style.css">
 <link rel="shortcut icon" href="ak.png">
  <title>Home</title>
</head>
<body>
        <div class="Nav">
            <nav>
                <ul class="navigation fade-in2">
                    <li><a href="#home">Home</a></li>
                    <li><a href="#about">About</a></li>
                    <li><a href="#portfolio">Portfolio</a></li>
                    <li><a href="#shop">Shop</a></li>
                    <li><a href="#blog">Blog</a></li>
                    <li><a href="#contact">Contact</a></li>
                </ul>
            </nav>
        </div>
        <div class="logo"><a href="#home"><img class="ak fade-in2" src="ak.png"></a></div>

    <div class="background"><img class="beauty" src="beauty.jpg"></div>
    <div class="header">
        <h1 class="headerName fade-in">DESIGN | DEVELOP | BRAND</h1>
        <h4 class="service fade-in3"><a href="#portfolio">VIEW PORTFOLIO</a></h4>
        <h4 class="service fade-in3"><a href="#services">VIEW SERVICES</a></h4>
    </div>
    <!--<div class="mainbody"><p>safsdaf</p></div>-->
</body>
</html>

CSS

@-webkit-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@-moz-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

* {
    padding: 0;
    margin: 0;
}

li {
    display: inline;
    font-size: 15px;
    font-family: verdana;

}

nav {
    width: 100%;
    text-align: right;
    background-color: #222222;
    padding: 0;
    margin: 0px;
    line-height: 47px;
    position: fixed;
    z-index: 100;
}


.ak{
    width: 90px;
    height: 55px;
    z-index: 101;
    position: fixed;
    background: transparent;
    color: transparent;
    background-color: transparent;
}


.Nav a{
    text-decoration: none;
    padding: 15px;
}

.Nav a:link{
    color: #A7A7A7;

}

.Nav a:visited{
    color: #A7A7A7;

}

.Nav a:hover{

    color: #DBDBDB;
    transition: all 0.3s ease-out 0s;
    transition-property: all;
    transition-duration: 0.3s;
    transition-timing-function: ease-out;
    transition-delay: 0s;
}

.header {

    background-color: rgba(0,0,0, 0.25);
    width: 100%;
    height: 626px;
    text-align: center;
    position: fixed;
    z-index: 10;
}


.background {
    position: fixed;
    z-index: 8;



}

.beauty {
    width: 100%;
    height: 626px;

}


.headerName {
    font-size: 2.5em;
    text-align: center;
    color: #D3D3D3;
    padding: 180px;
    padding-bottom: 50px;
    margin: 0px;
    letter-spacing: 4px;
    font-weight: 100;
    font-family: 'Lato', sans-serif;
}



.fade-in {
    opacity:0;  /* make things invisible upon start */
    -webkit-animation:fadeIn ease-in 1;  /* call our keyframe named fadeIn, use animation ease-in and repeat it only 1 time */
    -moz-animation:fadeIn ease-in 1;
    animation:fadeIn ease-in 1;

    -webkit-animation-fill-mode:forwards;  /* this makes sure that after animation is done we remain at the last keyframe value (opacity: 1)*/
    -moz-animation-fill-mode:forwards;
    animation-fill-mode:forwards;

    -webkit-animation-duration:1s;
    -moz-animation-duration:1s;
    animation-duration:1s;

    -webkit-animation-delay: 0.3s;
    -moz-animation-delay:0.3s;
    animation-delay: 0.3s;
}

.fade-in2 {
    opacity:0;  /* make things invisible upon start */
    -webkit-animation:fadeIn ease-in 1;  /* call our keyframe named fadeIn, use animation ease-in and repeat it only 1 time */
    -moz-animation:fadeIn ease-in 1;
    animation:fadeIn ease-in 1;

    -webkit-animation-fill-mode:forwards;  /* this makes sure that after animation is done we remain at the last keyframe value (opacity: 1)*/
    -moz-animation-fill-mode:forwards;
    animation-fill-mode:forwards;

    -webkit-animation-duration:1s;
    -moz-animation-duration:1s;
    animation-duration:1s;

    -webkit-animation-delay: 0.6s;
    -moz-animation-delay:0.6s;
    animation-delay: 0.6s;
}

.fade-in3 {
    opacity:0;  /* make things invisible upon start */
    -webkit-animation:fadeIn ease-in 1;  /* call our keyframe named fadeIn, use animation ease-in and repeat it only 1 time */
    -moz-animation:fadeIn ease-in 1;
    animation:fadeIn ease-in 1;

    -webkit-animation-fill-mode:forwards;  /* this makes sure that after animation is done we remain at the last keyframe value (opacity: 1)*/
    -moz-animation-fill-mode:forwards;
    animation-fill-mode:forwards;

    -webkit-animation-duration:1s;
    -moz-animation-duration:1s;
    animation-duration:1s;

    -webkit-animation-delay: 0.9s;
    -moz-animation-delay:0.9s;
    animation-delay: 0.9s;
}

.service{
    font-size: 14px;
    width: 190px;
    text-align: center;
    font-family: 'Lato', sans-serif;
    color: #D3D3D3;
    border: 2px #A7A7A7 solid;
    border-color: rgba(255, 255, 255, 0.5);
    display: inline-block;
    border-radius: 5px;
    background-color: transparent;
    letter-spacing: 2px;



}



.service a{
    text-decoration: none;
    display: block;
    padding: 15px 20px;
}

.service a:link{
    color: #D3D3D3;

}

.service a:visited{
    color: #D3D3D3;

}

.service a:hover{
    background-color: rgba(255, 255, 255, 0.15);
    transition: background-color .15s ease-in;
    -webkit-transition: background-color .15s ease-in;
    -moz-transition: background-color .15s ease-in;
    -o-transition: background-color .15s ease-in;
}

更新1:我更新了两个浏览器,似乎css3动画在两个浏览器上都能正常运行。似乎问题是页面的定位

更新2:以下是不同浏览器屏幕截图的链接

Chrome:https://www.dropbox.com/s/jlpa4vu51kdnews/Chrome.JPG

InternetExplorer:https://www.dropbox.com/s/zbchs3su9ahxr0n/IE.JPG

Mozilla Firefox:dropbox(。)com / s / fyalnhsha9ktadz / Mozilla.JPG(我无法发布第三个链接,因为我没有足够的声誉)

---注意在镀铬中,左上角的徽标看起来很光滑,而其他两个则没有那么多。我相信这些照片是不言自明的。

2 个答案:

答案 0 :(得分:0)

这是我的JSFiddle。这是你想要的吗?

只需更改css文件的第一行即可。

@-webkit-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

答案 1 :(得分:0)

IE8和早期版本

的问题

IE8及更早版本不知道如何在它无法识别的元素上渲染CSS。您无法设置新的HTML5元素,例如标题,导航,部分

HTML 5 shiv javascript文件用于在版本9之前的Internet Explorer版本中启用HTML5元素的样式。

您可以从http://code.google.com/p/html5shiv/

下载

要启用HTML5 Shiv(下载后),请将以下代码插入元素:

<!--[if lt IE 9]>
<script src="html5shiv.js"></script>
<![endif]-->