我一直在为我的网站制作一个CSS流体布局,我试图将包含版权的div集中在页面底部。 出于某种原因,div上的文字不会正确居中,这让我发疯。 这是我正在做的工作的链接: http://fenixflame.net/Templates/New%20Classic%20Template/New%20Classic/New%20Classic.php
这是我得到的CSS代码:
body {
background-color: #484238;
font-family: Verdana, Helvetica, Arial, sans-serif;
font-size: 10px;
color: #4F493D;
padding-right: 10px;
padding-bottom: 10px;
padding-left: 10px;
padding-top: 0px;
margin-top: 0px;
}
#content-left {
background-image: url(../../../Images/Backgrounds/Classic%20Template/border_left.gif);
background-repeat: repeat-y;
background-position: left top;
margin: 0px;
}
#content-right {
background-image: url(../../../Images/Backgrounds/Classic%20Template/border_right.gif);
background-repeat: repeat-y;
background-position: right top;
margin: 0px;
padding: 0px;
}
#header {
background-image: url(../../../Images/Backgrounds/Classic%20Template/border_top.gif);
background-repeat: repeat-x;
background-position: left top;
padding: 0px;
margin-top: 0px;
margin-right: 3.5px;
margin-bottom: 0px;
margin-left: 0px;
height: 50px;
}
#header-left {
background-image: url(../../../Images/Backgrounds/Classic%20Template/border_top_left.gif);
background-repeat: no-repeat;
background-position: left top;
margin: 0px;
padding: 0px;
height: 44px;
}
#header-right {
background-image: url(../../../Images/Backgrounds/Classic%20Template/border_top_right.gif);
background-repeat: no-repeat;
background-position: right top;
margin: 0px;
padding: 0px;
}
#topnav {
background-image: url(../../../Images/Backgrounds/Classic%20Template/topnav_bg.gif);
background-repeat: repeat-x;
background-position: left top;
white-space: nowrap;
display: block;
float: left;
height: 24px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 15px;
border-top-width: 3px;
border-right-width: 3px;
border-left-width: 3px;
border-top-style: solid;
border-right-style: solid;
border-left-style: solid;
border-top-color: #4F493D;
border-right-color: #4F493D;
border-left-color: #4F493D;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 0px;
}
#Global {
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
font-family: Verdana, Helvetica, Arial, sans-serif;
font-size: 10px;
color: #4F493D;
background-color: #E0DACE;
background-image: url(/Images/Backgrounds/Classic%20Template/bg_content.gif);
background-repeat: repeat;
background-position: left top;
width: 100%;
}
#page-header {
clear: both;
height: 15px;
margin-top: 0px;
margin-right: 2.5%;
margin-bottom: 0px;
margin-left: 2.5%;
border: 2px solid #4F493D;
text-align: center;
padding-top: 5px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 0px;
}
#navar-top {
margin: 0px;
padding: 0px;
}
#block_header {
background-image: url(../../../Images/Backgrounds/Classic%20Template/block_top.gif);
background-repeat: repeat-x;
background-position: left top;
display: block;
padding: 0px;
clear: both;
height: 5px;
margin-top: 0px;
margin-right: 5px;
margin-bottom: 0px;
margin-left: 5px;
}
#block-content {
background-image: url(../../../Images/Backgrounds/Classic%20Template/block_left.gif);
background-repeat: repeat-y;
background-position: left top;
}
#block-footer {
background-image: url(../../../Images/Backgrounds/Classic%20Template/block_bottom.gif);
background-repeat: repeat-x;
display: block;
padding: 0px;
clear: both;
height: 5px;
margin-top: 0px;
margin-right: 5px;
margin-bottom: 0px;
margin-left: 5px;
}
#div {
background-repeat: no-repeat;
background-position: left top;
height: 24px;
}
#div {
background-repeat: no-repeat;
background-position: right top;
margin: 0px;
height: 24px;
padding-top: 0px;
padding-right: 6px;
padding-bottom: 0px;
padding-left: 10px;
}
#content-right {
background-image: url(../../../Images/Backgrounds/Classic%20Template/border_right.gif);
background-repeat: repeat-y;
background-position: right top;
margin: 0px;
padding: 0px;
}
#topnav-search {
float: right;
width: 120px;
margin-right: 20px;
padding: 0px;
border: 2px solid #4F493D;
height: 25px;
background-color: #E2DCD0;
}
#footer {
background-image: url(../../../Images/Backgrounds/Classic%20Template/border_bottom.gif);
background-repeat: repeat-x;
background-position: left bottom;
clear: both;
height: 6px;
text-align: center;
}
#left-column {
background-image: url(../../../Images/Backgrounds/Classic%20Template/block2_top_left.gif);
background-repeat: no-repeat;
width: 15%;
border: 1px solid #484238;
}
#column-left-rightbg {
background-image: url(../../../Images/Backgrounds/Classic%20Template/block2_top_right.gif);
background-position: right top;
background-repeat: no-repeat;
}
#column-content {
background-image: url(../../../Images/Backgrounds/Classic%20Template/block2_top.gif);
background-repeat: repeat-x;
}
#column-left {
float: left;
width: 12%;
margin-top: 20px;
margin-right: 2.5%;
margin-bottom: 20px;
margin-left: 2.5%;
}
#column-left-quests {
margin-bottom: 20px;
}
#column-left-title-leftbg {
background-image: url(../../../Images/Backgrounds/Classic%20Template/block2_top_left.gif);
background-position: left top;
background-repeat: no-repeat;
}
#column-left-title-rightbg {
background-image: url(../../../Images/Backgrounds/Classic%20Template/block2_top_right.gif);
background-repeat: no-repeat;
background-position: right top;
}
#column-left-title-center {
background-image: url(../../../Images/Backgrounds/Classic%20Template/block2_top.gif);
background-repeat: repeat-x;
margin-right: 13px;
margin-left: 13px;
font-size: 11px;
}
#Global #content-left #content-right #column-left #column-left-quests #column-left-title-leftbg #column-left-title-rightbg #column-left-title-rightbgTrue #column-left-title-center strong {
text-align: center;
}
#column-left-title-mainbox {
margin-bottom: 50px;
border: 1.5px solid #484238;
}
#column-left-quests {
text-align: center;
}
#column-left-quests-title {
font-size: 11px;
font-weight: bold;
color: #484238;
border-top-width: 2.5px;
border-right-width: 2.5px;
border-bottom-width: 2.5px;
border-left-width: 2.5px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: none;
border-left-style: solid;
border-top-color: #484238;
border-right-color: #484238;
border-bottom-color: #484238;
border-left-color: #484238;
text-align: center;
vertical-align: middle;
height: 20px;
padding-top: 2px;
background-image: url(../../../Images/Backgrounds/Classic%20Template/Classic-Template-Column-Degradee.png);
background-repeat: repeat;
}
#column-left-quests-content {
border-top-width: 2px;
border-right-width: 2.5px;
border-bottom-width: 2.5px;
border-left-width: 2.5px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #484238;
border-right-color: #484238;
border-bottom-color: #484238;
border-left-color: #484238;
letter-spacing: 0.05em;
padding: 4px;
}
#column-left-HLM {
text-align: center;
margin-bottom: 20px;
}
#column-left-HLM-title {
background-color: #E2DCD0;
padding-top: 3px;
font-weight: bold;
border-top-width: 2.5px;
border-right-width: 2.5px;
border-bottom-width: 2.5px;
border-left-width: 2.5px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: none;
border-left-style: solid;
border-top-color: #484238;
border-right-color: #484238;
border-bottom-color: #484238;
border-left-color: #484238;
height: 20px;
font-size: 11px;
background-image: url(../../../Images/Backgrounds/Classic%20Template/Classic-Template-Column-Degradee.png);
background-repeat: repeat-x;
}
#column-left-HLM-content {
border: 2.5px solid #484238;
padding: 3px;
}
#column-right {
text-align: center;
float: right;
width: 12%;
margin-top: 20px;
margin-right: 2%;
margin-bottom: 20px;
margin-left: 15px;
}
#column-main {
margin-top: 20px;
margin-right: 15%;
margin-bottom: 20px;
margin-left: 15%;
background-image: url(../../../Images/Backgrounds/Classic%20Template/block2_top_left.gif);
background-repeat: no-repeat;
background-position: left top;
border: 2px none #484238;
}
#column-main-rightbg {
background-image: url(../../../Images/Backgrounds/Classic%20Template/block2_top_right.gif);
background-position: right top;
background-repeat: no-repeat;
height: 12px;
}
#column-main-content {
background-image: url(../../../Images/Backgrounds/Classic%20Template/block2_top.gif);
background-repeat: repeat-x;
background-position: center top;
margin-right: 12px;
margin-left: 11px;
}
#column-main-text {
border-top-width: 2px;
border-right-width: 2px;
border-bottom-width: 2px;
border-left-width: 2px;
border-top-style: none;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #484238;
border-right-color: #484238;
border-bottom-color: #484238;
border-left-color: #484238;
margin-top: 0px;
padding: 2px;
}
#column-right-poll {
border: 2px solid #484238;
margin-bottom: 20px;
padding: 0px;
}
#content-right-poll-title {
background-image: url(../../../Images/Backgrounds/Classic%20Template/Classic-Template-Column-Degradee.png);
background-repeat: repeat-x;
border-top-width: 2px;
border-right-width: 2px;
border-bottom-width: 2px;
border-left-width: 2px;
border-bottom-style: solid;
border-top-color: #484238;
border-right-color: #484238;
border-bottom-color: #484238;
border-left-color: #484238;
font-weight: bolder;
height: 20px;
padding-top: 5px;
}
#column-right-poll-content {
padding: 2.5px;
}
#column-right-imagenes {
margin-bottom: 20px;
border: 2px solid #484238;
}
#column-right-images-title {
font-weight: bold;
background-image: url(../../../Images/Backgrounds/Classic%20Template/Classic-Template-Column-Degradee.png);
background-repeat: repeat-x;
border-top-width: 2px;
border-right-width: 2px;
border-bottom-width: 2px;
border-left-width: 2px;
border-bottom-style: solid;
border-top-color: #484238;
border-right-color: #484238;
border-bottom-color: #484238;
border-left-color: #484238;
height: 20px;
padding-top: 5px;
}
#content-right-images-content {
padding: 2px;
}
#column-right-herramientas {
text-align: center;
border: 2px solid #484238;
margin-bottom: 20px;
}
#column-right-herramientas-title {
font-weight: bold;
background-image: url(../../../Images/Backgrounds/Classic%20Template/Classic-Template-Column-Degradee.png);
background-repeat: repeat-x;
height: 20px;
padding-top: 5px;
border-top-width: 2px;
border-right-width: 2px;
border-bottom-width: 2px;
border-left-width: 2px;
border-bottom-style: solid;
border-top-color: #484238;
border-right-color: #484238;
border-bottom-color: #484238;
border-left-color: #484238;
}
#column-right-herramientas-content {
padding: 2px;
}
#column-right-videos {
text-align: center;
margin-bottom: 20px;
border: 2px solid #484238;
}
#column-right-videos-title {
font-weight: bold;
background-image: url(../../../Images/Backgrounds/Classic%20Template/Classic-Template-Column-Degradee.png);
background-repeat: repeat-x;
height: 20px;
padding-top: 5px;
border-top-width: 2px;
border-right-width: 2px;
border-bottom-width: 2px;
border-left-width: 2px;
border-bottom-style: solid;
border-top-color: #484238;
border-right-color: #484238;
border-bottom-color: #484238;
border-left-color: #484238;
}
#column-right-videos-content {
padding: 2px;
}
#page-banner {
text-align: center;
}
.Image {
display: block;
margin-right: auto;
margin-left: auto;
text-align: center;
border: 1px solid #000;
}
#copyright {
text-align: center;
margin-left: 15%;
width: 99%;
margin-right: 15%;
clear: both;
}
不过,我不是网页设计师,也不是程序员。我相信你能从代码中说出来。
答案 0 :(得分:2)
您可能正在编辑错误的CSS文件。您的示例网页包含here上的CSS文件,该文件没有#copyright
的CSS样式。
希望有所帮助。
答案 1 :(得分:2)
链接页面的css文件中不存在#footer { text-align: center; }
规则。 #footer是您需要text-align:center的地方,而不是#copyright。