为什么在不同的浏览器中这样?

时间:2011-06-16 13:46:09

标签: html css

截图:

  • 在Chrome中预览

http://img221.imageshack.us/img221/600/screenshot20110616at932l.png

  • 在Firefox中预览

http://img850.imageshack.us/img850/8023/screenshot20110616at933.png

我该如何解决这个差异?这是我的CSS代码:

BODY
{
    margin: 0;
    padding: 0;
    background-image:url('images/bg.jpg');
}

@font-face {
    font-family: "District";
    font-style: normal;
    font-weight: 1;
    src: url("DisTh__.otf");
}

#logo
{
    padding-top: 0;
    line-height: 0%;
    font-family: District;
    font-size: 36px;
    color:#d8d8d8;
    text-decoration: none;
    text-shadow: #000000 1px 1px 1px;
    float:left;
}

#main-container
{
    width:980px;
    margin-left:auto;
    margin-right:auto;
    padding-top: 0px;
    border-style:solid;
    border-width:2px;
}

#nav
{
    float: right;
    Width: 500px;
    padding-top:26px;

}

#nav li
{   
    line-height: 22px;
    font-family: District;
    font-size: 18px;
    text-align:center;
    color:#d8d8d8;
    list-style-position:inside;
    list-style-type: none;
    float: right;
    padding-right: 30px;
}

#nav li a
{
    text-decoration:none;
    text-shadow: #000000 1px 1px 1px;
    color:#d8d8d8;
}

#nav li a:hover
{
    text-decoration:none;
    text-shadow: #000000 2px 2px 1px;
}

#middle-container
{
    width:980px;
    margin-left:auto;
    margin-right:auto;
    margin-top: -4px;
    background-image:url(images/box-bg.jpg);
    background-repeat:no-repeat;
}
#clear
{
    clear:both;
}

/* SLIDER CSS */

#slideshow {
    margin: auto;
    width:980px;
    height:450px;
    background:transparent url(images/box-bg.jpg) no-repeat 0 0;
    position:relative;
}
#slideshow #slidesContainer {
    width:568px;
    height:225px;
    overflow:auto; /* allow scrollbar */
    position:relative;
    top: 47px;
}
#slideshow #slidesContainer .slide {
    width:568px; /* reduce by 20 pixels of #slidesContainer to avoid horizontal scroll */
    height:263px;
}

/** 
 * Slideshow controls style rules.
 */
.control {
    display:block;
    width:39px;
    height:263px;
    text-indent:-10000px;
    position:absolute;
    cursor: pointer;
}
#leftControl {
    top:0;
    left:0;
    background:transparent url(images/Lprev-button.png) no-repeat 0 0;
    margin-top:116px;
    margin-left: 85px;
}
#rightControl {
    top:0;
    right:0;
    background:transparent url(images/Rnext-button.png) no-repeat 0 0;
    margin-top:116px;
    margin-right: 85px;
}
/* END SLIDER */

1 个答案:

答案 0 :(得分:0)

这个答案不会直接解决问题,但它有助于避免这种问题的发生。您应该使用reset.css,这会将所有浏览器重置为相同的基本样式。 Eric Mayers特别优秀 - http://meyerweb.com/eric/tools/css/reset/

使用这并不意味着你永远不必使用任何黑客,但它是一个伟大的开始。