Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / can you make header and page different widths?

can you make header and page different widths?

Locked

Views: 1,393

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
18 Nov 2008, 9:27 AM
#1
1kell avatar

1kell

Zen Follower

Join Date:
Jul 2008
Posts:
151
Plugin Contributions:
0

can you make header and page different widths?

I want my header to be white across the screen in the background, and the rest of the page to have the background colour. The only way I think I can do this is to make the header stretch accross the whole screen, while keeping the rest of the page as wide as it is.

Can you make the header 100% while the rest of the page is 80%?

18 Nov 2008, 10:02 AM
#2
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: can you make header and page different widths?

Certainly. Two ways.

You could edit your site's common/tpl_main_page.php to move the header block outside of #mainWrapper and then set you #headerWrapper width to 100%

or

set the width of #mainWrapper to be 100%, and constrain the width of #contentMainWrapper. This would also result in a 100% wide footer.

18 Nov 2008, 10:19 AM
#3
1kell avatar

1kell

Zen Follower

Join Date:
Jul 2008
Posts:
151
Plugin Contributions:
0

Re: can you make header and page different widths?

Thank you, that sounds easy. The first option is what I am trying to do. Only how do you move the header block out??? I am still a bit newish at this.:blush:

18 Nov 2008, 10:23 AM
#4
1kell avatar

1kell

Zen Follower

Join Date:
Jul 2008
Posts:
151
Plugin Contributions:
0

Re: can you make header and page different widths?

I don't have #mainwrapper in that file. I guess it may be css?..

18 Nov 2008, 10:29 AM
#5
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: can you make header and page different widths?

Create an override for tpl_main_page.php as explained in the FAQ. Then in the override file move this block

<?php
 /**
  * prepares and displays header output
  *
  */
  if (CUSTOMERS_APPROVAL_AUTHORIZATION == 1 && CUSTOMERS_AUTHORIZATION_HEADER_OFF == 'true' and ($_SESSION['customers_authorization'] != 0 or $_SESSION['customer_id'] == '')) {
    $flag_disable_header = true;
  }
  require($template->get_template_dir('tpl_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header.php');?>
```up one line, so that it comes before this```php
<div id="mainWrapper">
18 Nov 2008, 10:40 AM
#6
1kell avatar

1kell

Zen Follower

Join Date:
Jul 2008
Posts:
151
Plugin Contributions:
0

Re: can you make header and page different widths?

Excellent! Worked a treat and looks awesome :clap::hug::smartalec:

18 Nov 2008, 10:43 AM
#7
1kell avatar

1kell

Zen Follower

Join Date:
Jul 2008
Posts:
151
Plugin Contributions:
0

Re: can you make header and page different widths?

Now just wondering one thing - how to stop the header scrolling with the rest of the page. So it stays put when you scroll down the rest of the page.

18 Nov 2008, 11:07 AM
#8
1kell avatar

1kell

Zen Follower

Join Date:
Jul 2008
Posts:
151
Plugin Contributions:
0

Re: can you make header and page different widths?

having a bit of a problem. I changed as per above and its great. I am trying to move the content of the header so it is inline with the main page below it. I have been trying to pad margins. I have been able to do this with the logowrapper, but its having the wrong effect. The headerwrapper had the wrong effect too. What I am getting is the whole headerwrapper shrinking. I want it to stay at 100% but "pad" the sides like you do with tables. Here is the code I have in css:

/wrappers - page or section containers/
#mainWrapper {
background-color: #ffffff;
text-align: left;
width: 80%;
vertical-align: top;
border: 1px solid #518240;
}

#headerwrapper, #contentMainWrapper, #logoWrapper, #cartBoxListWrapper, #ezPageBoxList, #cartBoxListWrapper ul, #ezPageBoxList ul, #mainWrapper, #popupAdditionalImage, #popupImage {
margin: 0em;
padding: 0em;
}

#headerwrapper{
background-color: #ffffff;
}

#logoWrapper{
background-color: #ffffff;
height:85px;
margin-left: 13em;
margin-right: 13em;
}

Any suggestions?

18 Nov 2008, 11:16 AM
#9
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: can you make header and page different widths?

How sites work is down to the interaction of the HTML and CSS. Seeing a snippet of one along is often not enough.

I can see that you have given your mainWrapper a width of 80% which means that there's a margin of 10% each side (probably (assuming that you have centered it, can't tell from the snippet). But you have put margins of 13em each side of the logoWrapper.

There will be only one browser width at which 13em = 10% of the available window. I doubt this is what you really want, especially as it will chanmge slightly from browser to browser and dramatically of the vistitor changes their font size.

Overall though to give more help on this, it would be necessary to the site.