The best way?

I'm putting a banner type image on a web page and if I do it through a table it automatically scrolls to how long the image is. And if I do it as a background it repeats. What do you suggest for getting rid of this horizontal scroll problem?
 
Assuming you mean background on the page...

Code:
[[CSS for linked file or style tags in the header]]
 
body {
     background: #fff url("imagename.jpg") no-repeat top center;
     }

That'll make the image center itself in the window at the top and not repeat. Another way to do it would be VIA a positioned div containing the image.

You should always post a URL or ZIP containing the offending HTML/other files when you ask a question here if possible. Makes it a lot easier for people to figure out what's happening and what needs to be done to correct it.
 
use CSS like he say or...

put the banner in a table by itself, then put your main table below it. You can have more than one table on a page. I do this a lot since I usually build my sites header graphic and navigation buttons in one table and the main content in a table below it. With no space between, they seem as one. That way I can copy and paste my header/navigation to a new page. Anyhow, try that. Just make sure to hit return a few times if you need more space. The CSS is probably the best way overall, a bit less work and CSS is pretty much standard across browsers now I think.
 
benp said:
I'm putting a banner type image on a web page and if I do it through a table it automatically scrolls to how long the image is. And if I do it as a background it repeats. What do you suggest for getting rid of this horizontal scroll problem?

Hmm, I'm not totally sure what you mean. However, I take it to mean that you're adding a banner to a page which is too long long in width that it is causing your browser window to include horizontal scroll bars - correct? If this is the case the table cell will stretch to accommodate the banner.

Therefore you have two options:

a) Reduce the width of the banner itself (not just the table cell);

or

b) Include the banner as a background image but you must use CSS to stop it repeating which was explained above.

Ian
 
Back
Top