Solved

Width of header/footer repeated image when window is shrunk

Posted on 2010-08-24
9
385 Views
Last Modified: 2012-05-10
Hey all,

I have this interesting scenario and i'm wondering if someone could assist me since it's been something that even stumped my buddy who works in web dev.

I don't like giving out links usually so i will explain this problem using images.

My concern is when I minimize the browser below the initial width of my container; upon scrolling to the right, i notice that the repeated bg image i'm using for the header and footer are eventually stuck once i've scrolled beyond the new browsers width.

My width is set to 100%, so my css is just doing what it's told, however i'm wondering if anyone has a solution to this problem that I've seemed to had time and time again on other sites.
1.jpg
2.jpg
3.jpg
0
Comment
Question by:Arka3L
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 21

Expert Comment

by:chapmanjw
ID: 33516579
Using CSS try setting the width of HTML, BODY, and the header container to 100%.

html
{
width: 100%;
}

body
{
width: 100%;
}

#header
{
width: 100%;
}
0
 
LVL 1

Author Comment

by:Arka3L
ID: 33516958
Those are my current attributes.
0
 
LVL 43

Expert Comment

by:Chris Stanyon
ID: 33516972
Without seeing the code and debugging using FireBug, it may be a little tricky to find your problem!

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Expert Comment

by:level9wizard
ID: 33520484
That is not normal browser behavior - my first thought is to ask if you have validated both your HTML and CSS using a valid DOCTYPE ? [see w3.org]

Second, this can sometimes appear if there is a containing div (often used for content) that either applies this repeating background, or has its own interfering with it.

For the repeating bg, where is it applied? The <body>, or in <html> or in another containing <div> ?
0
 
LVL 1

Author Comment

by:Arka3L
ID: 33522975
Yes, of course, i always validate my code.

The main gradient you see in the first picture is set in the body, however the header is completely separate from the container div.

My header div is by itself and spans a width of 100% with its own bg image. Below that the container begins, so they are two separate divs altogether and one is not contained in the other.

I've decided to upload my files and remove any particular wording. The footer is not included, but thats not important.
urology.zip
0
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 500 total points
ID: 33523541
Try adding:

    min-width:900px;

to your CSS rule for #header, within style.css

#header {
	width: 100%;
	height: 132px;
	background: #fff url(../images/header_bg.gif) repeat-x top left;
	top: 0px;
	min-width:900px;
}

Open in new window

0
 
LVL 11

Expert Comment

by:level9wizard
ID: 33524722
Arka3L>>The main gradient you see in the first picture is set in the body, however the header is completely separate from the container div.


I don't really see the need to have two separate background containers for that (one in header, one in body). Just take a single 1px-wide slice as high as needs be to grab both the header menu bit and the fading gradient and repeat it on body. Then, you can define an overlaying div for the header with Background: transparent. As for the following content boxes ( the ones with "serving your health" and "Welcome to Urology") just give them a margin:0 auto; to center, and apply the background color as needed.
0
 
LVL 1

Author Closing Comment

by:Arka3L
ID: 33525683
Most of the time is the obvious solutions that work best!
0
 
LVL 11

Expert Comment

by:level9wizard
ID: 33530617
Arka3L>>Most of the time is the obvious solutions that work best!

I would test that in several browsers (Opera,Chrome,IE,FF,etc) - I have had unexpected results with min-width and min-height unless using the min-height fast hack:
http://www.dustindiaz.com/min-height-fast-hack/
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question