AbleCommerce Front end not centering on the page

Store UI, layout, design, look and feel; Discussion on the customer facing pages of your online store. Cascading Style Sheets, Themes, Scriptlets, NVelocity and the components in the ConLib directory.
Post Reply
paulh1971
Ensign (ENS)
Ensign (ENS)
Posts: 1
Joined: Thu Jun 26, 2008 6:43 am

AbleCommerce Front end not centering on the page

Post by paulh1971 » Thu Jun 26, 2008 6:51 am

Hello, the AbleCommerce front end was set at 100% width. I changed it to 800px. That worked fine, but it justifies to the left. I have tried everything I can think of, but it just won't center. Has anyone ever had this problem, and found a solution? Any help would be very much appreciated.

Thanks!

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: AbleCommerce Front end not centering on the page

Post by jmestep » Thu Jun 26, 2008 11:13 am

It has to do with the body style padding and margins in your style.css. Here is what changed ours.
body { padding: 0px 0 0 0 ; margin:0px auto 0 auto; background:RGB(128,125,159);font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; width:1000px;}
The auto auto is what is important for Firefox- IE centered OK without it.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
m_plugables
Commander (CMDR)
Commander (CMDR)
Posts: 149
Joined: Tue Mar 11, 2008 12:44 am
Contact:

Re: AbleCommerce Front end not centering on the page

Post by m_plugables » Thu Jun 26, 2008 11:29 am

I have faced this problem some time ago. I have tried center align the outer containers but that fix has some cross browser problems. The quick workaround i found was to made modification in the layout scriptlets and it worked fine.

You just need to wrap all the contents of each layout scriptlet into a three column table with width 100% and then assign the center column a width of 50% and assign 25% width to both side columns. The center column will contain all the contents of layout scriptlet.

For example if you want to center align the pages using Three column template then the Three Column Layout scriptlet should look like.

Code: Select all

<!--
<Description>
Displays headers, footers, a left sidebar, a right sidebar, and a main content area.
</Description>
-->
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td style="width:25%">
&nbsp;
</td>
<td style="width:50%">

[[layout:header]]
<div id="outerContentWrapper">
	<div id="innerContentWrapper">
		<table cellspacing="0" cellpadding="0" id="contentLayout">
			<tr>
				<td align="left" valign="top" id="leftSidebarPanel">
					[[layout:sidebar]]
				</td>
				<td align="left" valign="top" id="mainPanel">
					[[layout:content]]
				</td>
				<td align="left" valign="top" id="rightSidebarPanel">
					[[layout:sidebar2]]
				</td>
			</tr>
		</table>
	</div>
	[[layout:footer]]
</div>

</td>
<td style="width:25%">
&nbsp;
</td>
</tr>
</table>

This works fine for both the IE and FF
Image
Visit the links below to Download Plugins for your AC7 Store
http://www.plugables.com
http://blog.plugables.com

IndyTwoStep
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 23
Joined: Wed Dec 05, 2007 1:25 pm

Re: AbleCommerce Front end not centering on the page

Post by IndyTwoStep » Fri Jun 27, 2008 1:23 pm

There is a better, more flexible way to do this...

Add this to your theme's style.css file:

Code: Select all

#wrapContainer {
margin:0pt auto;
max-width:1000px;
min-width:700px;
width: expression(document.body.clientWidth < 701? "700px" : document.body.clientWidth > 1001? "1000px" : "auto");
}
(You can replace 700px and 1000px with whatever your want you min / max width to be)
!If you use this technique, remember to change the width in the expression above as well, and notice how 701 / 700 and 1001 / 1000 are used, this ensures that this works smoothly in IE as well as FF and Opera...

Now, using a similiar method, wrap the layout scriptlet (whichever ones you want this effect - 3 column, whatever...) with this code:

Code: Select all

<div id="wrapContainer">
[[layout:header]]
<div id="outerContentWrapper">
	<div id="innerContentWrapper">
		<table cellspacing="0" cellpadding="0" id="contentLayout">
			<tr>
				<td align="left" valign="top" id="leftSidebarPanel">
					[[layout:sidebar]]
				</td>
				<td align="left" valign="top" id="mainPanel">
					[[layout:content]]
				</td>
				<td align="left" valign="top" id="rightSidebarPanel">
					[[layout:sidebar2]]
				</td>
			</tr>
		</table>
	</div>
	[[layout:footer]]
</div>
</div>
In this example, i created a flexable width layout, but you could just as easily define #wrapContainer as a fixed width div with auto margins and get the same effect that mazhar described.... Though flex width layouts add a new dimension to this technique.

mdickinson
Ensign (ENS)
Ensign (ENS)
Posts: 8
Joined: Wed Oct 27, 2010 5:40 pm

Re: AbleCommerce Front end not centering on the page

Post by mdickinson » Tue Nov 16, 2010 12:45 pm

IndyTwoStep's post worked so great! Thank you, thank you!

User avatar
Maryram
Ensign (ENS)
Ensign (ENS)
Posts: 6
Joined: Wed Feb 17, 2010 2:39 pm

Re: AbleCommerce Front end not centering on the page

Post by Maryram » Wed Apr 06, 2011 2:50 pm

I'm trying to center my web page.

Using Indy's post, I get lost on this part :
Now, using a similiar method, wrap the layout scriptlet (whichever ones you want this effect - 3 column, whatever...) with this code:
Where do I find these scriptlets and how many of them do I add the
<div id="wrapContainer"> . . . to ?

plugables
Captain (CAPT)
Captain (CAPT)
Posts: 276
Joined: Sat Aug 15, 2009 4:04 am
Contact:

Re: AbleCommerce Front end not centering on the page

Post by plugables » Sat Apr 09, 2011 4:20 am

Just do something like this in your stylesheet for body element.

Code: Select all

body
{   
    margin:0 auto;
    width:980px;
}

User avatar
clevername
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Tue Jan 11, 2011 8:54 am

Re: AbleCommerce Front end not centering on the page

Post by clevername » Mon Apr 11, 2011 2:06 pm

Just so you know you have to set the exact width of the element for the "margin: 0 auto;" to work. For example:

Code: Select all

body {
     width:1000px;
     margin:0 auto;
}
IndyTwoStep's suggestion uses CSS Expressions which is not a very good practice. And it can be done without them with easy valid CSS.

Post Reply