Simple Machines Community Forum

General Community => Scripting Help => Aiheen aloitti: simpleTVT - heinäkuu 10, 2007, 02:49:44 AP

Otsikko: Centering Issues
Kirjoitti: simpleTVT - heinäkuu 10, 2007, 02:49:44 AP
The Problem

How can i center the banner at the top of the page.

Forums:http://cutemachines.com/forums/ (http://cutemachines.com/forums/)


#MRHeader {
   background-image:  url(images/head_bg.gif);
    {
    text-align:center;
    margin-top:0px;
    margin-bottom:0px;
    padding:0px;
    }


Im guessing the code is incorrect, as its not actually centering the banner.
Otsikko: Re: Centering Issues
Kirjoitti: Rudolf - heinäkuu 10, 2007, 05:05:49 AP
It is centered in Firefox, but that piece of code is not correct
Koodi (Try this) [Valitse]

#MRHeader {
   background-image:  url(images/head_bg.gif);
   text-align:center;
   margin-top:0px;
   margin-bottom:0px;
   padding:0px;
}
Otsikko: Re: Centering Issues
Kirjoitti: simpleTVT - heinäkuu 10, 2007, 05:26:51 AP
Ok i did change that code. But in I.E it is not centered.
Otsikko: Re: Centering Issues
Kirjoitti: Rudolf - heinäkuu 10, 2007, 05:35:56 AP
Koodi (Search) [Valitse]
<div id="MRHeader">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td width="650" valign="top" height="110" align="middle">
<a href="http://cutemachines.com/forums/index.php">
<img width="780" height="110" title="Cute Machines Logo" alt="Cute Machines Logo" src="http://cutemachines.com/forums/Themes/PSPTheme_Fixed/images/logo.gif"/>
</a>
</td>
</tr>
</tbody>
</table>
</div>


You'll see align="middle" which should be align="center". Or simply remove it.


Otsikko: Re: Centering Issues
Kirjoitti: simpleTVT - heinäkuu 10, 2007, 05:54:14 AP
I have changed the "middle" to "center" but still no change.


Firefox is aligned center.

I.E is still aligned to left.
Otsikko: Re: Centering Issues
Kirjoitti: dolator - heinäkuu 10, 2007, 06:25:40 AP
maybe you just need to empty your cache?
Otsikko: Re: Centering Issues
Kirjoitti: simpleTVT - heinäkuu 10, 2007, 06:29:08 AP
I have empted cache, but still not change. Im stumped.
Otsikko: Re: Centering Issues
Kirjoitti: Rudolf - heinäkuu 10, 2007, 06:38:36 AP
You have two tables nested, or so it appears. The tables are not needed anyway.
You need to have something like this:

<div id="MRHeader">
<a href="http://cutemachines.com/forums/index.php"><img src="http://cutemachines.com/forums/Themes/PSPTheme_Fixed/images/logo.gif" width="780" height="110" alt="Cute Machines Logo" title="Cute Machines Logo" /></a>
</div>


Use the style

#MRHeader {
   background-image:  url(images/head_bg.gif);
   text-align:center;
   margin-top:0px;
   margin-bottom:0px;
   padding:0px;
}


For reference, the reason it wasn't centered in IE is that the wrapper table cell had a width of 760px defined. This forced IE to don't take the whole screen for the cell, so the resulting image was centered in that 760px.
Otsikko: Re: Centering Issues
Kirjoitti: simpleTVT - heinäkuu 10, 2007, 07:11:59 AP
<div id="MRHeader">
<a href="http://cutemachines.com/forums/index.php"><img src="http://cutemachines.com/forums/Themes/PSPTheme_Fixed/images/logo.gif" width="780" height="110" alt="Cute Machines Logo" title="Cute Machines Logo" /></a>
</div>

When i replace the code with this is get: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in index.template.php on line 220

Any ideas

Otsikko: Re: Centering Issues
Kirjoitti: simpleTVT - heinäkuu 10, 2007, 08:03:00 AP
Fixed it.