How do I make my header graphic auto resize?
Hi there,
I was slapping myself silly with how to get my header graphic to auto resize when someone has a different resolution. Someone told me it has to do with javascripts, but I just didn't get it .
This is the first time I have ever done a website, and don't understand much of anything.
I would like my header graphic to do what this site does.
http://www.thetechguide.com/forum/index.php?showtopic=17695&pid=42738&mode=threaded&show=&st=&
see how the top graphic extends when you increase your resolution? I want mine to do that. I know this whole website actually moves with the resolution, but I just want my graphic to do that, not my whole page, because I don't have my text in a table due to google and search engines not crawling it properly.
If you can help me, I would be greatful.
Thanks A Bunch :wave:
DaveyBoy posted this at 12:26 — 16th March 2006.
They have: 453 posts
Joined: Feb 2003
That is quite easy to achieve. If you are using tables, you will simply need to make sure your header image is aligned to the left in the table cell, and then colour the background of the cell to the colour you want the extended part to be.
DSSR posted this at 12:32 — 16th March 2006.
They have: 166 posts
Joined: Mar 2006
hmmm, okay, I'm not really clear on that, but are you saying, I need to put my header image in a table? Then align it to the left? Then colour the cell with a gradient from photoshop?
I want the extended part to be the same colour as my banner, but my banner was created in photoshop, and I don't think frontpage has this gradient effect?
Can I make a completely seperate image with that colour gradient and place it next to my header image, and will this extend automatically? Or does it have to be a colour?
Thanks heaps for your input, I appreciate it heaps. I am getting somewhere now : )
DaveyBoy posted this at 12:43 — 16th March 2006.
They have: 453 posts
Joined: Feb 2003
Yeah it has to go inside a table cell, aligned left.
What you can then do is in photoshop create a 1pixel wide image (cropped from your header image) and use that as the background image for the cell.
If you are using standard HTML, it will be something like :
<table width="100%">
<tr>
<td align="left" background="header.jpg"><img src="background.jpg"></td>
</tr>
</table>
That isn't valid code but it's a start anyway.
DSSR posted this at 13:11 — 16th March 2006.
They have: 166 posts
Joined: Mar 2006
Ah dude, you're a champion.
I also think I done your paypal button, I need to check it over my network. One sec.
JeevesBond posted this at 13:52 — 16th March 2006.
He has: 3,956 posts
Joined: Jun 2002
Or you can do it the correct way without tables and with CSS (and this is the way you should do things).
In your HTML:
<div id="header"><img src="logo.jpg" alt="Test logo image"/></div>
In your CSS file:
#header {
width: 100%;
text-align: left;
border: 1px solid #000;
background: #fff;
/*Background color (shown here as: #fff) can be whatever you like*/
/*You can also add an image to the background, for example change the
line above to be:
background: #fff url("bg.gif") left repeat-x;
will set the background colour to be white with a horizontally
repeated image that is aligned left*/
}
Feel free to remove my comments, they're there to help you. If you need to stop horizontal scrollbars appearing when the div gets too small then you can remove the image and use the following CSS:
#header {
width: 100%;
height: 200px;
/*Height should be equal to the height of your background image*/
background: #fff url("logo.gif") left no-repeat;
}
The rules of good design dictate that you should use XHTML for document structure (like creating lists, and Headings etc.) but use CSS for formatting it all. Using tables for layouts works against these rules.
Also that site you showed us breaks in Opera, so I wouldn't use it as too much of a role-model.
a Padded Cell our articles site!
DaveyBoy posted this at 14:07 — 16th March 2006.
They have: 453 posts
Joined: Feb 2003
Or you can use tables if you feel more comfortable with them
DSSR posted this at 14:18 — 16th March 2006.
They have: 166 posts
Joined: Mar 2006
Shucks, I dont understand any of that ..
How do I get my image as far left as possible? I put my image to teh left, but it still has a little gap there say 3 mils.
I'll try learn how to do it the easy way first, then move onto this CSS.
And about that site, I just wanted to give an example of what I wanted to do, since I am new, I didn't know how to explain it that well.
Oh, and I'm making my site for IE users mainly, if those guys have firefox or opera, that's there problem So if this is for making things compatible, nevermind about that, I just want to get it to work in IE.
Thanks mates
DaveyBoy posted this at 14:25 — 16th March 2006.
They have: 453 posts
Joined: Feb 2003
in your body tag (or CSS file jeeves ) you need to set your margins to 0.
DSSR posted this at 14:39 — 16th March 2006.
They have: 166 posts
Joined: Mar 2006
I done it but it still had a little bit there, but I fixed it cause I seen something called horizontal spacing, it was 3, now its 0, now its abolutely to the left ..thanks abunch mate.
Now to the hard part, doing the table .. hahaha
DSSR posted this at 15:57 — 16th March 2006.
They have: 166 posts
Joined: Mar 2006
The thing wont let me put a backround into my table Wont even let me put in a normal colour. Am I missing something?
DaveyBoy posted this at 15:59 — 16th March 2006.
They have: 453 posts
Joined: Feb 2003
if you follow mine or jeeves' code properly, it will work.
DSSR posted this at 16:14 — 16th March 2006.
They have: 166 posts
Joined: Mar 2006
Okay, Im going to start over. I think my backround image is not exactly the same size as the image. Which is why I think theres a white border around it.
DSSR posted this at 16:17 — 16th March 2006.
They have: 166 posts
Joined: Mar 2006
Hmm, there is a problem. The thing wont auto resize when I change resolutions.? It stays the same size. Am I missing something?
DaveyBoy posted this at 16:24 — 16th March 2006.
They have: 453 posts
Joined: Feb 2003
if you wanna email me your header image, i can do you a quick mock up of the header code.
DSSR posted this at 17:08 — 16th March 2006.
They have: 166 posts
Joined: Mar 2006
Thanks mate, sent both my header and backround to ya.
DaveyBoy posted this at 17:10 — 16th March 2006.
They have: 453 posts
Joined: Feb 2003
have emailled you back about 10 minutes ago lol
DSSR posted this at 17:12 — 16th March 2006.
They have: 166 posts
Joined: Mar 2006
Huh where? I cant see it What email did you send to, iq454?
DaveyBoy posted this at 17:13 — 16th March 2006.
They have: 453 posts
Joined: Feb 2003
yep i think so lol, one sec...yep i did
DSSR posted this at 17:14 — 16th March 2006.
They have: 166 posts
Joined: Mar 2006
hmm, can you send again please mate? Im getting heaps of email from this forum informing me that I got new replies, but tahts about it ..
DaveyBoy posted this at 17:17 — 16th March 2006.
They have: 453 posts
Joined: Feb 2003
sent now, if you don't get it i'll upload the zip
JeevesBond posted this at 21:47 — 16th March 2006.
He has: 3,956 posts
Joined: Jun 2002
Not clever, I use Linux so can't use IE. Not that I'd want to, it is an awful product. You need to start designing to standards (even if you start out with tables) and test in all browsers. An attitude like that will not get you far in Web Design.
And could you possibly use PM's or e-mail now guys? Thanks.
a Padded Cell our articles site!
DSSR posted this at 21:56 — 16th March 2006.
They have: 166 posts
Joined: Mar 2006
How do I know what the standard is?
Im not making my site for people with linux. If you cant see my site, too bad..not my loss, get windows with IE. lol.. Everyone now knows that IE is as safe as opera or firefox, and it is more userfriendly too. I used firefox and opera, and I removed both of them because of sites it couldnt visit. That says everything about them. Till they step their standards up, Ill deside then to catar for those guys.
Um, we are using pms and emails now, way before you even asked. I dont seem what the problem is when its my thread? Whats wrong now? Because I said I dont want to make MY website for people with opera? okay, fine. Be that way...I said I was new in teh begining, then you came up with all this CSS stuff, like I am meant to know what that is?
Anyway, thanks for your help, Im going now, close the thread do what you want.
JeevesBond posted this at 23:12 — 16th March 2006.
He has: 3,956 posts
Joined: Jun 2002
Well that's a good point really! The standards are available at: http://www.w3.org but I wouldn't advise trying that straight away. Even the most hardened web professionals have trouble reading the specs on that site.
Good, sorry, didn't know that.
That's simply not the case. IE has some big Activex problems, Opera simply can't be attacked and you have to really try hard to download a malicious extension into Firefox. Well, it is simpler, but it doesn't have support for:
So you'll only write sites for IE, until other browsers web standards get better? That's a bit backwards! IE is the one that doesn't follow those standards mentioned above. Microsoft is a member of the W3C, but chose not to comply with standards to secure their market share. So it's not that Firefox & Opera can't display sites. The problem is those sites have bugs.
Really, if you're just wanting to get a small site together and not really learn much, what you're doing is fine. If you're on the road to becoming a professional then these are things you'll need to know.
Hope this helps.
a Padded Cell our articles site!
DSSR posted this at 23:47 — 16th March 2006.
They have: 166 posts
Joined: Mar 2006
Okay, Ill shut up, I didnt know you were so smart in this web thing.
Thanks a lot for teh information. Much appreciated.
Yeah, just putting a site together. It looks real ugly, and makes no sense hhahaha.
I just made my life harder now because I made a banner, now I have made that banner with slices with buttons links. I htought I could save it as a gif and insert that into my table, now I find it wont save as gif, well it will, but it wont let me select any of the slices I made, so I had to save it as a html file with an images folder. I have to start all over again, all because I want the stupid header graphic to extend when soemone has a different resolution. ..haha, oh well, I had great help here fomr you two guys. I better get to it.
DSSR posted this at 23:59 — 16th March 2006.
They have: 166 posts
Joined: Mar 2006
okay okay I stuffed it up . Can I email you my starting html file (index) and can you make it so I can have the body move to the right about 10 in the margin? because when i go to page properties, the thing moves the hedaer graphic with it, and I want that to the far left. Then I will place all my text in the body bit.
Also, can you make that thing I was talking about before? I have the background image too that I want added to make it extend when someone has a different resolution. If no it's okay, I will figure it out one day .
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.