开发者

Center a div text on a liquid CSS

开发者 https://www.devze.com 2023-02-02 03:43 出处:网络
I\'ve been working on a CSS fluid layout for my website, and I am trying to center the div that contains the copyright on the bottom of the page.

I've been working on a CSS fluid layout for my website, and I am trying to center the div that contains the copyright on the bottom of the page. For some reason, the text on the div wont center correctly, and it is driving me crazy. This is a link of what I am working on: http://fenixflame.net/Templates/New%20Classic%20Template/New%20Classic/New%20Classic.php

This is the CSS code I got:

    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;
}

Btw, Im not really a web designer nor programer. Im sure you'll be able to tell that from the code.


the #footer { text-align: center; } rule is not present in the css file of the linked page. #footer is where you need text-align: center, not under #copyright.


You might be editing the wrong CSS file. Your sample web page has included the CSS file over here which does not have the CSS styles for #copyright.

Hope that helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消