Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Make boxes align against the side of the page


Guest

Recommended Posts

I've seen many questions on the forums about this but could not find any answers that were correct. After some fiddling I figured it out and thought others may find it useful.

 

Firstly, with any layout elements, check both the stylesheet and the actual pages in "catalog" because the style coding is a bit messy and some elements are defined in the pages while others are defined in the stylesheet.

 

The code that causes the gap between the page edges and the boxes is in the actual pages.

 

Start with catalog/index.php and look for the body tag.

 

It is coded as:

 

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

 

This is the culprit. Strip this tag to <body>

 

You will need to do this in all your catalog pages.

 

To keep your format across different browsers, open catalog/stylesheet.php

 

In the body tag towards the top of the page, add:

 

marginwidth:0;

marginheight:0;

topmargin:0;

bottommargin:0;

leftmargin:0;

rightmargin:0;

Link to comment
Share on other sites

I've seen many questions on the forums about this but could not find any answers that were correct. After some fiddling I figured it out and thought others may find it useful.

 

Firstly, with any layout elements, check both the stylesheet and the actual pages in "catalog" because the style coding is a bit messy and some elements are defined in the pages while others are defined in the stylesheet.

 

The code that causes the gap between the page edges and the boxes is in the actual pages.

 

Start with catalog/index.php and look for the body tag.

 

It is coded as:

 

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

 

This is the culprit. Strip this tag to <body>

 

You will need to do this in all your catalog pages.

 

To keep your format across different browsers, open catalog/stylesheet.php

 

In the body tag towards the top of the page, add:

 

marginwidth:0;

marginheight:0;

topmargin:0;

bottommargin:0;

leftmargin:0;

rightmargin:0;

 

 

Sorry - need to make a correction on the above. Too little sleep and I defined the margins incorrectly. It should be :

 

marginwidth:0;

marginheight:0;

margin-top:0;

margin-right:0;

margin-bottom:0;

margin-left:0;

Link to comment
Share on other sites

  • 2 weeks later...
Sorry - need to make a correction on the above. Too little sleep and I defined the margins incorrectly. It should be :

 

marginwidth:0;

marginheight:0;

margin-top:0;

margin-right:0;

margin-bottom:0;

margin-left:0;

Actually, it's simpler than that! First, "marginwidth" and "marginheight" are not valid CSS properties. The rest are valid, but there's a shortcut: margin. If you want all sides the same, only one value is needed, hence the above can be written "margin: 0;".

 

Depending on the browser, the default whitespace on <body> might actually be padding, so you could add "padding: 0;" to be safe.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...