html - 在 CSS/HTML 中重新居中网页

标签 html css

我已经为我定制了 CSS,但我不再与创建者联系。我想让一个 div (#rightcolumn) 大 55px。我通过使 div 中的 iframe 变大来做到这一点,它会自动为我扩展。然而,横幅 (#topsection) 变得有点短 - 所以我不得不添加 55px 以使其宽度为 1255px。

现在页面有些偏心了。当我尝试编辑其他 float 命令来修复时,div 的结果到处都是。我已经试了几天了。如果有人现在可以帮助重新定位它。我真的很感激。

测试页:Serious Sports Bigger CSS 链接:CSS link 新的CSS

body {
    margin:0;
    padding:0;
    line-height:1.5em;
    background:#C0C0C0;
}
b {
    font-size:110%;
}
em {
    color:red;
}
#maincontainer {
    width:1200px;
    margin:0 auto;
}
#topsection {
    background:#191919;
    height:90px;
    width:1255px
}
#contentwrapper {
    float:left;
    width:100%;
}
#contentcolumn {
    margin:0 360px 0 180px;
    color:#F1F1F1;
}
#leftcolumn {
    float:left;
    width:180px;
    margin-left:-1200px;
    background:#C8FC98;
}
#rightcolumn {
    float:left;
    width:355px;
    margin-left:-355px;
    background:#E5E5E5;
}
#footer {
    clear:left;
    width:100%;
    background:#191919;
    color:#FFF;
    text-align:center;
    padding:4px 0;
}
#footer a {
    color:#62C301;
}
.innertube {
    margin:10px;
    margin-top:0;
}
.arrowgreen {
    width:180px;
    border-style:solid solid none solid;
    border-color:#94AA74;
    border-size:1px;
    border-width:1px;
}
.arrowgreen ul {
    list-style-type:none;
    margin:0;
    padding:0;
}
.arrowgreen li a {
    font:bold 12px Verdana, Arial, Helvetica, sans-serif;
    display:block;
    background:transparent url(http://i39.tinypic.com/2r2rhnc.gif) 100% 0;
    height:24px;
    padding:4px 0 4px 10px;
    line-height:24px;
    text-decoration:none;
}
.arrowgreen li a:link, .arrowgreen li a:visited {
    color:#5E7830;
}
.arrowgreen li a:hover {
    color:#26370A;
    background-position:100% -32px;
}
.arrowgreen li a.selected {
    color:#26370A;
    background-position:100% -64px;
}

最佳答案

您还必须将 DOCTYPE 更改为

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"> 

关于html - 在 CSS/HTML 中重新居中网页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18907691/

相关文章:

javascript - Google Analytics 跟踪 pdf 下载

html - 垂直对齐标题中的导航和标题

JavaScript/HTML/CSS : Zooming

css - 仅在对象周围具有边框的自定义透明框

css - 如何使用 flexbox 将两个 <a/> 居中对齐?

css - float div 中的文本

javascript - CSS 在类切换上添加删除边框

html - Z-index 的 IE 不透明度问题

javascript - 如何在显示警报时调暗背景并在警报关闭时关闭#dim?

html - 如何让这个纯 CSS 图像比较 slider 从中间开始?