优化我的网站为Internet Explorer

时间:2012-02-05 11:25:18

标签: html css

我对整个html / css有点新鲜,但到目前为止,我设法为我的投资组合网站制作了一个不错的页面。事情是,在Internet Explorer中看起来像垃圾。我试图优化它,以便我的CSS动画工作等等,但我似乎无法让它正常工作。

www.thomasteilmann.dk

如果你看看,你会明白我的意思。除了IE之外,它应该可以正常工作。 如果有人能就如何达到我的目标给我一些建议,那就太好了! :)

是的,我知道我的代码很乱:P

以下课程:

<html xmlns="http://www.w3.org/1999/xhtml">
<link rel="stylesheet" href="stylesheets/style.css" type="text/css" media="screen" />

    <head>
        <title>thomasteilmann.dk</title>    
    </head>
    <body>

        <div class="header">
            <h1><img src="images/thomas_logo_Web.png" alt="Sick Logo" /></a></h1>
        </div>

    <div id="content">

        <div class="view-first">
            <img src="images/cosmic_art_icon.jpg"/>
            <div class="mask">
                <h2>Cosmic Art</h2>
                <p>A galleri of cosmic art made in Photoshop</p>
                <a href="#" class="info">View</a>
            </div>
        </div>

        <div class="view-second">
            <img src="images/thomas_web.jpg"/>
            <div class="mask">
                <h2>About myself</h2>
                <p>Information about my skills and my personality in general</p>
                <a href="#" class="info">View</a>
            </div>
        </div>

        <div class="view-third">
            <img src="images/web_web.jpg"/>
            <div class="mask">
                <h2>Websites</h2>
                <p>A list of websites i've made/worked on.</p>
                <a href="#" class="info">View</a>
            </div>
        </div>

        <div class="view-fourth">
            <img src="images/ice_age_web.jpg"/>
            <div class="mask">
                <h2>Cartoon Art</h2>
                <p>A galleri of Cartoon art made in Photoshop</p>
                <a href="#" class="info">View</a>
            </div>
        </div>
    </div>

    </body>
</html>

的CSS:

body {
    background: #21211f;
    width: 100%;
    font-family: helvetica, arial, sans-serif;
    margin: 0 auto;
    padding: 0px 0 0 0;

}

.header{
    position: absolute;
    width: 700px;
    padding-bottom:50px;
    margin-left: 23%;
    float: left;


}

h1 img{
    padding: 0;
    margin: 0;
}

#content{
    width: 50%;
    height: 500px;

    line-height: 22px;
    font-size: 18px;
    font-family: Georgia, times, serif;
    float: left;
    color: #ffffff;
    margin-left: 22%;
    margin-top: 20%;
    padding: 20px 30px 20px 30px;
}


img {
    border: none;
}

/*
 * View one
*/

.view-first {
    width: 279px;
    height: 198px;
    margin: 3px;
    margin-left: 33px;
    float: left;
    border: 5px solid white;
    overflow: hidden;
    position: absolute;
    text-align: center;
    box-shadow: 1px 2px 2px #e6e6e6;
    cursor: default;
    background: #fff url(../images/bgimg.jpg) no-repeat center center;
}
.view-first .mask, .view .content {
    width: 279px;
    height: 198px;
    position: absolute;
    overflow: hidden;
    top: 0;
    left: 0;
}
.view-first img {
    display: block;
    position: relative;
        -webkit-transition: all 0.2s linear;
    -moz-transition: all 0.2s linear;
    -o-transition: all 0.2s linear;
    -ms-transition: all 0.2s linear;
    transition: all 0.2s linear;
}
.view-first h2 {
    text-transform: uppercase;
    color: #fff;
    text-align: center;
    position: relative;
    font-size: 17px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.8);
    margin: 20px 0 0 0;

    -webkit-transform: translateY(-100px);
    -moz-transform: translateY(-100px);
    -o-transform: translateY(-100px);
    -ms-transform: translateY(-100px);

    opacity: 0;
    -webkit-transition: all 0.4s ease-in-out;
    -moz-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    -ms-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out;
}
.view-first p {
    font-family: Georgia, serif;
    font-style: italic;
    font-size: 12px;
    position: relative;
    color: #fff;
    padding: 10px 20px 20px;
    text-align: center;

    -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";

    opacity: 0;
    -webkit-transition: all 0.4s linear;
    -moz-transition: all 0.2s linear;
    -o-transition: all 0.2s linear;
    -ms-transition: all 0.2s linear;
    transition: all 0.2s linear;
}
.view-first a.info {
    display: inline-block;
    text-decoration: none;
    padding: 7px 14px;
    background: #000;
    color: #fff;
    text-transform: uppercase;
    box-shadow: 0 0 1px #000;

    -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";

    opacity: 0;
    -webkit-transition: all 0.2s ease-in-out;
    -moz-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    -ms-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out;
}


.view-first .mask {
    -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";

    opacity: 0;
    background-color: rgba(219,127,8, 0.7);
    -webkit-transition: all 0.4s ease-in-out;
    -moz-transition: all 0.4s ease-in-out;
    -o-transition: all 0.4s ease-in-out;
    -ms-transition: all 0.4s ease-in-out;
    transition: all 0.4s ease-in-out;
}

.view-first a.info:hover {
    box-shadow: 0 0 5px #000;
}

.view-first:hover img {
        -webkit-transform: scale(1.1,1.1);
    -moz-transform: scale(1.1,1.1);
    -o-transform: scale(1.1,1.1);
    -ms-transform: scale(1.1,1.1);

}
.view-first:hover .mask {
    -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=100)";
    -webkit-filter: alpha(opacity=100);
    opacity: 1;
}
.view-first:hover h2,
.view-first:hover p,
.view-first:hover a.info {
    -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=100)";
    -webkit-filter: alpha(opacity=100);
    opacity: 1;
    -webkit-transform: translateY(0px);
    -moz-transform: translateY(0px);
    -o-transform: translateY(0px);
    -ms-transform: translateY(0px);

}
.view-first:hover p {
    -webkit-transition-delay: 0.4s;
    -moz-transition-delay: 0.1s;
    -o-transition-delay: 0.1s;
    -ms-transition-delay: 0.1s;
    transition-delay: 0.1s;
}
.view-first:hover a.info {
    -webkit-transition-delay: 0.1s;
    -moz-transition-delay: 0.1s;
    -o-transition-delay: 0.1s;
    -ms-transition-delay: 0.1s;
    transition-delay: 0.1s;
}

/**
 * View two
 */

.view-second {
    width: 279px;
    height: 198px;
    margin: 3px;

    margin-left: 400px;
    float: right;
    border: 5px solid white;
    overflow: hidden;
    position: absolute;
    text-align: center;
    box-shadow: 1px 2px 2px #e6e6e6;
    cursor: default;
    background: #fff url(../images/bgimg.jpg) no-repeat center center;
}
.view-second .mask, .view .content {
    width: 279px;
    height: 198px;
    position: absolute;
    overflow: hidden;
    top: 0;
    left: 0;
}
.view-second img {
    display: block;
    position: relative;
        -webkit-transition: all 0.2s linear;
    -moz-transition: all 0.2s linear;
    -o-transition: all 0.2s linear;
    -ms-transition: all 0.2s linear;
    transition: all 0.2s linear;
}
.view-second h2 {
    text-transform: uppercase;
    color: #fff;
    text-align: center;
    position: relative;
    font-size: 17px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.8);
    margin: 20px 0 0 0;

    -webkit-transform: translateY(-100px);
    -moz-transform: translateY(-100px);
    -o-transform: translateY(-100px);
    -ms-transform: translateY(-100px);

    opacity: 0;
    -webkit-transition: all 0.4s ease-in-out;
    -moz-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    -ms-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out;
}
.view-second p {
    font-family: Georgia, serif;
    font-style: italic;
    font-size: 12px;
    position: relative;
    color: #fff;
    padding: 10px 20px 0px;
    text-align: center;

    -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";

    opacity: 0;
    -webkit-transition: all 0.4s linear;
    -moz-transition: all 0.2s linear;
    -o-transition: all 0.2s linear;
    -ms-transition: all 0.2s linear;
    transition: all 0.2s linear;
}
.view-second a.info {
    display: inline-block;
    text-decoration: none;
    padding: 7px 14px;
    background: #000;
    color: #fff;
    text-transform: uppercase;
    box-shadow: 0 0 1px #000;

    -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";

    opacity: 0;
    -webkit-transition: all 0.2s ease-in-out;
    -moz-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    -ms-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out;
}


.view-second .mask {
    -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";

    opacity: 0;
    background-color: rgba(219,127,8, 0.7);
    -webkit-transition: all 0.4s ease-in-out;
    -moz-transition: all 0.4s ease-in-out;
    -o-transition: all 0.4s ease-in-out;
    -ms-transition: all 0.4s ease-in-out;
    transition: all 0.4s ease-in-out;
}

.view-second a.info:hover {
    box-shadow: 0 0 5px #000;
}

.view-second:hover img {
        -webkit-transform: scale(1.1,1.1);
    -moz-transform: scale(1.1,1.1);
    -o-transform: scale(1.1,1.1);
    -ms-transform: scale(1.1,1.1);

}
.view-second:hover .mask {
    -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=100)";
    -webkit-filter: alpha(opacity=100);
    opacity: 1;
}
.view-second:hover h2,
.view-second:hover p,
.view-second:hover a.info {
    -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=100)";
    -webkit-filter: alpha(opacity=100);
    opacity: 1;
    -webkit-transform: translateY(0px);
    -moz-transform: translateY(0px);
    -o-transform: translateY(0px);
    -ms-transform: translateY(0px);

}
.view-second:hover p {
    -webkit-transition-delay: 0.4s;
    -moz-transition-delay: 0.1s;
    -o-transition-delay: 0.1s;
    -ms-transition-delay: 0.1s;
    transition-delay: 0.1s;
}
.view-second:hover a.info {
    -webkit-transition-delay: 0.1s;
    -moz-transition-delay: 0.1s;
    -o-transition-delay: 0.1s;
    -ms-transition-delay: 0.1s;
    transition-delay: 0.1s;
}

/**
 * View three
 */

.view-third {
    width: 279px;
    height: 198px;
    margin: 3px;
    margin-left: 33px;
    float: left;
    margin-top: 240px;
    border: 5px solid white;
    overflow: hidden;
    position: absolute;
    text-align: center;
    box-shadow: 1px 2px 2px #e6e6e6;
    cursor: default;
    background: #fff url(../images/bgimg.jpg) no-repeat center center;
}
.view-third .mask, .view .content {
    width: 279px;
    height: 198px;
    position: absolute;
    overflow: hidden;
    top: 0;
    left: 0;
}
.view-third img {
    display: block;
    position: relative;
        -webkit-transition: all 0.2s linear;
    -moz-transition: all 0.2s linear;
    -o-transition: all 0.2s linear;
    -ms-transition: all 0.2s linear;
    transition: all 0.2s linear;
}
.view-third h2 {
    text-transform: uppercase;
    color: #fff;
    text-align: center;
    position: relative;
    font-size: 17px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.8);
    margin: 20px 0 0 0;

    -webkit-transform: translateY(-100px);
    -moz-transform: translateY(-100px);
    -o-transform: translateY(-100px);
    -ms-transform: translateY(-100px);

    opacity: 0;
    -webkit-transition: all 0.4s ease-in-out;
    -moz-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    -ms-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out;
}
.view-third p {
    font-family: Georgia, serif;
    font-style: italic;
    font-size: 12px;
    position: relative;
    color: #fff;
    padding: 10px 20px 20px;
    text-align: center;

    -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";

    opacity: 0;
    -webkit-transition: all 0.4s linear;
    -moz-transition: all 0.2s linear;
    -o-transition: all 0.2s linear;
    -ms-transition: all 0.2s linear;
    transition: all 0.2s linear;
}
.view-third a.info {
    display: inline-block;
    text-decoration: none;
    padding: 7px 14px;
    background: #000;
    color: #fff;
    text-transform: uppercase;
    box-shadow: 0 0 1px #000;

    -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";

    opacity: 0;
    -webkit-transition: all 0.2s ease-in-out;
    -moz-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    -ms-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out;
}


.view-third .mask {
    -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";

    opacity: 0;
    background-color: rgba(219,127,8, 0.7);
    -webkit-transition: all 0.4s ease-in-out;
    -moz-transition: all 0.4s ease-in-out;
    -o-transition: all 0.4s ease-in-out;
    -ms-transition: all 0.4s ease-in-out;
    transition: all 0.4s ease-in-out;
}

.view-third a.info:hover {
    box-shadow: 0 0 5px #000;
}

.view-third:hover img {
        -webkit-transform: scale(1.1,1.1);
    -moz-transform: scale(1.1,1.1);
    -o-transform: scale(1.1,1.1);
    -ms-transform: scale(1.1,1.1);

}
.view-third:hover .mask {
    -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=100)";
    -webkit-filter: alpha(opacity=100);
    opacity: 1;
}
.view-third:hover h2,
.view-third:hover p,
.view-third:hover a.info {
    -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=100)";
    -webkit-filter: alpha(opacity=100);
    opacity: 1;
    -webkit-transform: translateY(0px);
    -moz-transform: translateY(0px);
    -o-transform: translateY(0px);
    -ms-transform: translateY(0px);

}
.view-third:hover p {
    -webkit-transition-delay: 0.4s;
    -moz-transition-delay: 0.4s;
    -o-transition-delay: 0.4s;
    -ms-transition-delay: 0.4s;
    transition-delay: 0.4s;
}
.view-third:hover a.info {
    -webkit-transition-delay: 0.1s;
    -moz-transition-delay: 0.2s;
    -o-transition-delay: 0.2s;
    -ms-transition-delay: 0.2s;
    transition-delay: 0.2s;
}


/**
 * View four
 */

.view-fourth {
    width: 279px;
    height: 198px;
    margin: 3px;
    margin-top: 240px;
    margin-left: 400px;
    float: right;
    border: 5px solid white;
    overflow: hidden;
    position: absolute;
    text-align: center;
    box-shadow: 1px 2px 2px #e6e6e6;
    cursor: default;
    background: #fff url(../images/bgimg.jpg) no-repeat center center;
}
.view-fourth .mask, .view .content {
    width: 279px;
    height: 198px;
    position: absolute;
    overflow: hidden;
    top: 0;
    left: 0;
}
.view-fourth img {
    display: block;
    position: relative;
        -webkit-transition: all 0.2s linear;
    -moz-transition: all 0.2s linear;
    -o-transition: all 0.2s linear;
    -ms-transition: all 0.2s linear;
    transition: all 0.2s linear;
}
.view-fourth h2 {
    text-transform: uppercase;
    color: #fff;
    text-align: center;
    position: relative;
    font-size: 17px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.8);
    margin: 20px 0 0 0;

    -webkit-transform: translateY(-100px);
    -moz-transform: translateY(-100px);
    -o-transform: translateY(-100px);
    -ms-transform: translateY(-100px);

    opacity: 0;
    -webkit-transition: all 0.4s ease-in-out;
    -moz-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    -ms-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out;
}
.view-fourth p {
    font-family: Georgia, serif;
    font-style: italic;
    font-size: 12px;
    position: relative;
    color: #fff;
    padding: 10px 20px 0px;
    text-align: center;

    -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";

    opacity: 0;
    -webkit-transition: all 0.4s linear;
    -moz-transition: all 0.2s linear;
    -o-transition: all 0.2s linear;
    -ms-transition: all 0.2s linear;
    transition: all 0.2s linear;
}
.view-fourth a.info {
    display: inline-block;
    text-decoration: none;
    padding: 7px 14px;
    background: #000;
    color: #fff;
    text-transform: uppercase;
    box-shadow: 0 0 1px #000;

    -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";

    opacity: 0;
    -webkit-transition: all 0.2s ease-in-out;
    -moz-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    -ms-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out;
}


.view-fourth .mask {
    -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=0)";

    opacity: 0;
    background-color: rgba(219,127,8, 0.7);
    -webkit-transition: all 0.4s ease-in-out;
    -moz-transition: all 0.4s ease-in-out;
    -o-transition: all 0.4s ease-in-out;
    -ms-transition: all 0.4s ease-in-out;
    transition: all 0.4s ease-in-out;
}

.view-fourth a.info:hover {
    box-shadow: 0 0 5px #000;
}

.view-fourth:hover img {
        -webkit-transform: scale(1.1,1.1);
    -moz-transform: scale(1.1,1.1);
    -o-transform: scale(1.1,1.1);
    -ms-transform: scale(1.1,1.1);

}
.view-fourth:hover .mask {
    -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=100)";
    -webkit-filter: alpha(opacity=100);
    opacity: 1;
}
.view-fourth:hover h2,
.view-fourth:hover p,
.view-fourth:hover a.info {
    -ms-filter: "progid: DXImageTransform.Microsoft.Alpha(Opacity=100)";
    -webkit-filter: alpha(opacity=100);
    opacity: 1;
    -webkit-transform: translateY(0px);
    -moz-transform: translateY(0px);
    -o-transform: translateY(0px);
    -ms-transform: translateY(0px);

}
.view-fourth:hover p {
    -webkit-transition-delay: 0.4s;
    -moz-transition-delay: 0.1s;
    -o-transition-delay: 0.1s;
    -ms-transition-delay: 0.1s;
    transition-delay: 0.1s;
}
.view-fourth:hover a.info {
    -webkit-transition-delay: 0.1s;
    -moz-transition-delay: 0.1s;
    -o-transition-delay: 0.1s;
    -ms-transition-delay: 0.1s;
    transition-delay: 0.1s;
}

6 个答案:

答案 0 :(得分:2)

您的HTML中存在错误,例如<link&gt;在<head></a>之上,没有任何匹配的<a>。通过http://validator.w3.org/处的W3C验证程序运行您的页面并更正它找到的所有错误。

不同的浏览器对错误的反应不同,因此使其无错误应该是使其与多浏览器兼容的第一步。

答案 1 :(得分:1)

IE,即使IE9也不支持AFIAK的CSS转换。

答案 2 :(得分:1)

第一步:在文件开头包含文档类型声明,例如:

<!DOCTYPE html>

如果不这样做,最终会进入Quirks Mode,这会大大增加IE和其他浏览器之间的差异。

答案 3 :(得分:0)

您的Internet Explorer使用css 2,但在您的代码中使用css 3.如果您需要使用此功能,最好的方法是使用javascript / jquery编码,这将在Internet Explorer中有效。

答案 4 :(得分:0)

你是从哪里学会以这种方式编程的? 你有一个非常基本的网站,你拥有的CSS是怪异不成比例的。 对于您的特定网站,CSS最多应为10-20行代码。 我建议您从头开始并遵循此规则。

答案 5 :(得分:0)

您的网站存在凌乱代码之外的问题。您的背景图片太大了,我花了几秒钟才能加载有线互联网的新MBP。

您的导航不会让您的用户知道您的图片链接到什么,直到他们鼠标悬停。使用文本和较小的缩略图进行水平导航会更好。

您的Photoshop图片库太小了。为什么你甚至没有关于你的“关于我”一节?暗灰色的背景上的黑色文字?

我不是故意在这里超级苛刻。当我第一次进入HTML和CSS时,它比我能够产生的要好,但是你有一些严重的设计缺陷。