Wrox Programmer Forums
|
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 14th, 2004, 04:44 PM
Authorized User
 
Join Date: Dec 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default background images

I can't find my HTML book and have forgotten a couple of things,
I'm using a background.gif in the td tags and I don't want it to repeat as the cell gets larger, do I use absolute positioning in the td tag or just say "no-repeat" ex: src="tbl1.gif" no-repeat="true"

secondly, I have a banner .gif that I also want to put into a <td> that will contain the same background .gif how can I do this effectivly.

Thanks in advance
Larson

I think.....therefore..I code
__________________
I think.....therefore..I code
 
Old February 14th, 2004, 05:48 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

I would suggest using CSS.

The syntax goes like this:

CSS Shorthand:
background: color image repeat attachment position;

Individual declarations:
background-color: white; (color|transparent)
background-image: url('path/to/image.jpg');
background-repeat: no-repeat; (repeat|repeat-x|repeat-y|no-repeat)
    repeat: Image is tiled horizontally and vertically
    repeat-x: tiled horizontally only
    repeat-y: tiled vertically
    no-repeat: Image appears just once

background-position: center bottom;
Keyword positioning (x: left|center|right) (y: top|center|bottom)
background-position: Xpx Ypx; (Absolute positioning)
background-position: X% Y%; (percentage relative to containing element)
background-attachment: fixed; (fixed|scroll)
    fixed: stay put when scrolling
    scroll: scroll with window


Example using CSS with individual declarations:
<td style="background-color: white; background-image: url('fish.jpg'); background-repeat: no-repeat; background-position: center bottom; background-attachment: fixed;">
Some content
</td>

Example using CSS background shorthand:
<td style="background: white url('fish.jpg') no-repeat fixed center bottom;">
Some content
</td>

BTW: 'fixed' in this example will only work in NS/MOZ browsers, whereas it will only work if used on the <body> element when used in IE.

hth,
Rich

:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
 
Old February 15th, 2004, 06:22 PM
Authorized User
 
Join Date: Dec 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I thought about CSS, then decided against it, I'll take your advice and use it ;),, thx
Larson

I think.....therefore..I code





Similar Threads
Thread Thread Starter Forum Replies Last Post
No Background Images in ReportViewer wb8bgy Visual Basic 2005 Basics 1 March 28th, 2007 03:08 PM
background images Maxxim CSS Cascading Style Sheets 14 February 14th, 2007 02:56 PM
how to creat a treeview with background images tjgrindsted ASP.NET 2.0 Basics 0 January 10th, 2007 04:31 PM
'Print Background colors and images' crmpicco Javascript How-To 0 January 14th, 2005 10:19 AM
XML background images timsweet XML 0 September 30th, 2004 06:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.