Zen Cart Logo
Forums / Addon Templates / Please help with centering page- SilverFish template

Please help with centering page- SilverFish template

Locked

Views: 2,258

Results 1 to 15 of 15
This thread is locked. New replies are disabled.
8 Nov 2008, 4:33 AM
#1
hornsales avatar

hornsales

New Zenner

Join Date:
Nov 2007
Posts:
54
Plugin Contributions:
0

Please help with centering page- SilverFish template

I have looked through my stylesheet extensively and am at a complete loss.

my shops main page which can be found at
https://www.hornsales.com

appears centered in my browser but the main logo in the header was aligned left. I added text-align: center to #logo and that didn't work so I adjusted the padding of #logo and that worked.

But certain pages will show up centered in my browser and others like this one :
http://www.hornsales.com/catalog/index.php?main_page=index&cPath=65_81

Show up aligned to the left of the browser and the logo image is still centered, I know it stays there because I used padding to position it.

What I need to figure out is what is wrong in my stylesheet or what is overriding my stylesheet that is making some pages center in the browser and some pages align left. And Why I couldn't get
#logo {text-align: center};
to make my logo image center in the header so I can remove the padding and the logo image will appeared centered to the header box

I have tried every instance in the style sheet of text-align: left or float: left , but changing any of them to text-align: center does not affect the anything.

I feel there is an override in place that I didn't know I put in but I am clueless

Please help

8 Nov 2008, 2:21 PM
#2
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Please help with centering page- SilverFish template

Try taking the postion:absolute; out of #logo, then move it around with padding and/or margin. Leave the text-align:center; in.

8 Nov 2008, 2:47 PM
#3
hornsales avatar

hornsales

New Zenner

Join Date:
Nov 2007
Posts:
54
Plugin Contributions:
0

Re: Please help with centering page- SilverFish template

ok
Taking out position: absolute helped somewhat. Now the logo image doesn't stay stuck n the middle of the browser screen when the page aligns left.

But the logo image still won't center and changing the padding now doesn't move it and some pages are still aligning left while others center in the browser screen

8 Nov 2008, 3:13 PM
#4
rstevenson avatar

rstevenson

Totally Zenned

Join Date:
Nov 2006
Location:
Dartmouth, NS Canada
Posts:
2,400
Plugin Contributions:
0

Re: Please help with centering page- SilverFish template

I've never seen a stylesheet customized to that extent before! But looking through it to the extent I'm able to understand it, I think the problem has to lie in the section titled...

/* SilverFish Customizations */

...since that's the only area of the stylesheet where the body and mainwrapper locations are defined.

I'd start by laying out the element definitions in that section in separate lines so you can easily read the definitions being applied. Clarity of code helps with debugging.

so when you change this...```
body {margin: 0; text-align: center; font-family: verdana, arial, helvetica, sans-serif; font-size: 62.5%; color: #00000; margin: 10px 0px 50px 0px; color: #333; background: url(../images/bg_body.gif) repeat-x #6f9db8;}

...to this...```
body {
margin: 0; 
text-align: center; 
font-family: verdana, arial, helvetica, sans-serif; 
font-size: 62.5%; 
color: #00000; 
margin: 10px 0px 50px 0px; 
color: #333; 
background: url(../images/bg_body.gif) repeat-x #6f9db8;}

... you can quickly see that you've defined margin and color twice each for the body tag. That won't be your problem, since the second definition takes precedence, but it indicates that it's going to be harder to figure out the problem than it needs to be.

You may have closed up the code that way in an attempt to save stylesheet load time. That's no longer any kind of issue. Stylesheets load in a fraction of a second.

Rob

8 Nov 2008, 3:31 PM
#5
hornsales avatar

hornsales

New Zenner

Join Date:
Nov 2007
Posts:
54
Plugin Contributions:
0

Re: Please help with centering page- SilverFish template

This is the way the code came with the template. I have maybe made 2 or 3 adjustments. But I will make the layout changes so maybe I or someone can see the problem.

8 Nov 2008, 3:38 PM
#6
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Please help with centering page- SilverFish template

I noticed that template has a lot of tables in it, and the author seems to have removed the logoWrapper altogether.

You might try installing a similar template and switching temporarliy to see if the header problem goes away.

8 Nov 2008, 4:01 PM
#7
hornsales avatar

hornsales

New Zenner

Join Date:
Nov 2007
Posts:
54
Plugin Contributions:
0

Re: Please help with centering page- SilverFish template

I am not sure what a similar template would be.

I did notice that if i remove

margin: 10px 0px 50px 0px;
from body then the pages that were aligning left suddenly align right even if I change it to
margin: auto;

So I am totally clueless here

8 Nov 2008, 4:09 PM
#8
hornsales avatar

hornsales

New Zenner

Join Date:
Nov 2007
Posts:
54
Plugin Contributions:
0

Re: Please help with centering page- SilverFish template

Ok

I have looked through many pages on my site. And it doesn;t appear to be any specific type of product or category that is aligning to the left. It is fairly random which pages line up center and which ones line up left. But it is always the same pages.

Could it be something in my actual product and category descriptions that is making the alignment changes?

8 Nov 2008, 4:14 PM
#9
rstevenson avatar

rstevenson

Totally Zenned

Join Date:
Nov 2006
Location:
Dartmouth, NS Canada
Posts:
2,400
Plugin Contributions:
0

Re: Please help with centering page- SilverFish template

There certainly has to be something making a mess of things. Stylesheets don't behave randomly. If a style works on one page and nothing overrides it on a second page, it'll work on the second page too. But computers have a bad habit of doing exactly what we tell them to do instead of what we want them to do, so ...

I would try running a working page through a validator, then running one of the odd pages through the same validator. Compare the two reports. Ignore the warnings; it's the errors that you'll need to look at closely.

Do you have the Web Developer tools (or similar) in your browser?

Rob

8 Nov 2008, 4:15 PM
#10
hornsales avatar

hornsales

New Zenner

Join Date:
Nov 2007
Posts:
54
Plugin Contributions:
0

Re: Please help with centering page- SilverFish template

I have firebug installed in firefox

what is this validator you are talking about?

8 Nov 2008, 4:22 PM
#11
rstevenson avatar

rstevenson

Totally Zenned

Join Date:
Nov 2006
Location:
Dartmouth, NS Canada
Posts:
2,400
Plugin Contributions:
0

Re: Please help with centering page- SilverFish template

I just ran one of your centered pages through a validator and immediately saw major problems. The validator reports a lot of missing end tags. They're not really missing of course, they're just not where they belong, so the validator can't find them.

The main problem seems to be that the beginning and ending tags are intermixed. So you get something like this...

<td> <div> </td> </div>

That'll make things hairy for sure. And that was on a working page! There were even more erros on the odd page -- too many for the browser to ignore I guess.

It looks like you'll have to do some restorative work on your template. You may have to deal with the template author to get it fixed.

Rob

8 Nov 2008, 4:26 PM
#12
rstevenson avatar

rstevenson

Totally Zenned

Join Date:
Nov 2006
Location:
Dartmouth, NS Canada
Posts:
2,400
Plugin Contributions:
0

Re: Please help with centering page- SilverFish template

what is this validator you are talking about?

There are many validators available. You can use the free ones at the center of the web universe: w3.org

I have Total Validator installed in Firefox. That's the one I just used.

Rob

8 Nov 2008, 4:35 PM
#13
hornsales avatar

hornsales

New Zenner

Join Date:
Nov 2007
Posts:
54
Plugin Contributions:
0

Re: Please help with centering page- SilverFish template

I did a google search for a validator ad used the WC3.com one. It shows lots and lots of errors for pages that center and pages that don't but theres over 300 on each type of page and they seem to be consistent between the 2. Mainly parsing errors and so forth. I am not an expert with this stuff so I don't know what I am looking for

8 Nov 2008, 4:41 PM
#14
rstevenson avatar

rstevenson

Totally Zenned

Join Date:
Nov 2006
Location:
Dartmouth, NS Canada
Posts:
2,400
Plugin Contributions:
0

Re: Please help with centering page- SilverFish template

Well, the error count on the odd pages is higher than on the good ones, so saving and labouriously comparing the two error reports should tell you where the problem is. But the simple answer is to fix all the errors. They're coming from your template code -- that is, the PHP -- mostly, though there are a few things wrong with the stylesheet as well.

I really think you have to go back to the template designer and ask them to fix things up. It's their code which has caused the problems -- unless you've modified it to any degree. Do you have a clean install of the template, without even slight mods by you?

Rob

9 Nov 2008, 4:09 AM
#15
hornsales avatar

hornsales

New Zenner

Join Date:
Nov 2007
Posts:
54
Plugin Contributions:
0

Re: Please help with centering page- SilverFish template

I installed a different template. And I got the same results. The same pages appear centered and the same ones are aligned left So I guess its not in the template files but somewhere else any ideas where to start looking