Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cell background image question

Status
Not open for further replies.

NetNomad312

Technical User
Jun 16, 2004
27
US
I'm still a pretty inexperienced with HTML, but I thought I would try making a site with a table instead of frames (or neither). I created a few background images that were relatively simple: mostly blue with a gradient to gold at the edges. I have a "horizontal" image with the gradients at the top and bottom, and a "vertical" image with the gradients at the sides. Because adding side borders to these images would make them un-tileable (i.e. only decent-looking on one particular screen resolution), I instead made two "endcap" images: one which would go on the right side of the table (to the right of the title), and one which would go below the end of the menu. To do this I decided to add another cell, of 8 pixels in width (as is the width of the endcap image) and set the endcap as its background.

That's when I noticed the problem: for some reason there's an x-offset being applied to these images. It's not a big offset, two pixels I believe, but it definitely made the endcap look weird. When I applied the "vertical" background image to the menu cell, it had the same problem. Oddly enough, there is no vertical offset (as the "horizontal" background image appeared correctly). It's not a product of a visual error in the editor I'm using (Visual Studio .NET) either, because when I opened the file in internet explorer the problem was still there.

The HTML that defines the endcap cell is:
<td style="WIDTH: 8px; HEIGHT: 128px" background="border1.png"></td>

Where could this offset be coming from, and how would I go about fixing it?
 
Try the Table Tag - get rid of the cellspacing, cellpadding and border
Code:
<table border=0 cellpadding=0 cellspacing=0>

TwoOdd
--------------
Good judgment comes from experience, and experience comes from bad judgment.
-- Barry LePatner
 
I thought I would try making a site with a table instead of frames

Good on you for going away from frames - they really don't have a huge amount of use for generic web-pages these days - and certainly not for layout only purposes.

Have you considered trying to go to a table-less design using CSS to position the elements on your page?

There are many tutorials and references out there on how to do this - so have a read up. You might find it a hard slog at the beginning, compared to the realtive simplicity of tables, but trust me - it's worth it in the long run.

Here are a few links to get you started:




Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Huh... it had a cell padding of 1 and I didn't notice it. Of course, I also wasn't sure what cell padding DID. Anyway, they look fine now. Thanks a lot.

As for CSS, well, I'm such a newb that I've never heard of it. Heh. I'd rather screw around with HTML and have that down before trying another language.
 
Sorry to double post (wish there was an edit feature here!), but I was wondering if it was possible to make a cell 8 units in height. I can't seem to do that because the text I can enter in it is so much larger. I'm just going to make the border image larger, then... fill the rest up with black pixels (page background) so no one can tell the difference...
 
Sorry, I'm more used to editing in a certain program (has nothing to do with HTML or web pages) in which unit is synonymous with pixel. Force of habit. Yeah, I mean pixel. :p
 
Out of curiosity, since you're new to all this. Do you really think it is smart to learn outdated methods which will completely limit you and teach you how to do lots of things entirely wrong? When you decided to get a driver's license, did you practice on Ford T?
 
I'm not going for something really fancy here, this is more of a personal site than anything else. So I'm going with the basics... outdated, maybe, but it's not like they're out of use. I'll learn the heavy stuff when I need the heavy stuff; until then, I'd appreciate a simple "no, it can't be done in HTML" as opposed to "learn a more complex language or you may as well be driving Ford Ts.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top