943,946 Members | Top Members by Rank

Ad:
Jan 17th, 2007
0

Background image? Z-Index?

Expand Post »
I have a template that I'm trying to customize. It has a left sidebanner div and image.
How do I get text to appear on top of the image? By making the image a background-image in CSS? By specifying z-index?
Your help is GREATLY appreciated
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Bonus is offline Offline
3 posts
since Jan 2007
Jan 17th, 2007
0

Re: Background image? Z-Index?

The best way is to put the image in as a background image using CSS.
Z-index requires that the image is Absolutely positioned which can cause other layout problems in different browsers.


HTH
Reputation Points: 10
Solved Threads: 1
Newbie Poster
webecho is offline Offline
20 posts
since Aug 2006
Aug 6th, 2007
0

Re: Background image? Z-Index?

Hi all, I'm having a similar problem...

I have an image that I would like to be the background of a table cell so I can have text over it. I have given the cell a class referred to it in my style sheet, which reads:

td.banner {
background-image:url(../images/banner.jpg);
background-position:center;
background-repeat:no-repeat;
background:fixed;
}

The images are there in working mode, but when I preview in a browser, the images aren't there!

Can anyone tell me what's wrong?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Scrawn_Dog is offline Offline
9 posts
since Jun 2007
Aug 7th, 2007
0

Re: Background image? Z-Index?

Not 100% certain you can put "background" in a TD... I know that it is also dodgey trying to colour a TD...

So you have two options.
1) Put a Div inside the TD and apply the BGIMG to that
2) Use full on selectors.... #TABLEID TR TD {} and see if that works.

To be honest... probably best going with (1)... and is the Table for content... or layout ?
Reputation Points: 63
Solved Threads: 12
Posting Pro in Training
autocrat is offline Offline
427 posts
since Feb 2005
Aug 7th, 2007
0

Re: Background image? Z-Index?

I have had no trouble coloring a td. A background should work in any box object.

But it must be a td and not a TD. CSS doesn't know what a TD is.

All relevant tage, styles, ids, classes, and selectors must be in lowercase for CSS to understand them.

Be aware that the cell will NOT expand to show the entire image. It shows only the portion which fits behind the contents.
Last edited by MidiMagic; Aug 7th, 2007 at 5:11 am.
Reputation Points: 730
Solved Threads: 181
Nearly a Senior Poster
MidiMagic is offline Offline
3,314 posts
since Jan 2007
Aug 7th, 2007
0

Re: Background image? Z-Index?

Is there some reason I always have trouble posting at 4 am?
Last edited by MidiMagic; Aug 7th, 2007 at 5:08 am. Reason: The server locked up, and when I tried to free it, it posted twice.
Reputation Points: 730
Solved Threads: 181
Nearly a Senior Poster
MidiMagic is offline Offline
3,314 posts
since Jan 2007
Aug 8th, 2007
0

Re: Background image? Z-Index?

... MidiMagic ...
The reason I mentioned it...
" being dodgey "
...is that some browsers aren't 100% on it, (i.e. some simply won't show it if it is the TD that is styled, rather than the TABLE TR / TABLE TD / TABLE TR TD or use of classes etc.).

Simply fore-warning them and trying to make sure they get the best result across browsers (ok, most modern ones are fine, but I know NN and some Opera's are iffy on it).


Also, can you please confirm about the UPPER/lowercase for CSS...

* I thought that you shouldn't use _ (underscore) due to some browsers not liking it (added for CSS2 after release) (NN was an issue).

* You shouldn't use a Numeric value at the begin (not due to CSS, but due to DocTypes).

* You can use UPPER/lower/MiXeD case in ID and CLASS, so long as the same is used in both the DOC and the CSS code, (but you are correct about things such as TABLE should be table (I think)), thus...

<div id="rabbitone"> #rabbitone
<div id="rabbitOne"> #rabbitOne
<div id="rabbit1"> #rabbit1
<div id="raBBitone"> #raBBitone
<div id="raBBit1"> #raBBit1

should work fine...
where as

<div id="Rabbitone"> #Rabbitone
<div id="rabbit_one"> #rabbit_one
<div id="rabbitone"> #RABBITONE
<div id="RABBITONE"> #rabbitone

shouldn't work (or won't work on all browsers!)

???

If you know of an official doc on this, please point it out, as for some reason I cannot actually find one... (which bugs me no end )
Reputation Points: 63
Solved Threads: 12
Posting Pro in Training
autocrat is offline Offline
427 posts
since Feb 2005
Aug 9th, 2007
0

Re: Background image? Z-Index?

Click to Expand / Collapse  Quote originally posted by autocrat ...
... MidiMagic ...
Also, can you please confirm about the UPPER/lowercase for CSS...
* I thought that you shouldn't use _ (underscore) due to some browsers not liking it (added for CSS2 after release) (NN was an issue).
True. Use letters and numbers for classes and ids for max compatibility. The first character must be a letter.

Quote ...
* You shouldn't use a Numeric value at the begin (not due to CSS, but due to DocTypes).
Correct.

Quote ...
* You can use UPPER/lower/MiXeD case in ID and CLASS, so long as the same is used in both the DOC and the CSS code, (but you are correct about things such as TABLE should be table (I think)), thus...
HTML and CSS Syntax (Toggle Plain Text)
  1. <div id="rabbitone"> #rabbitone
  2. <div id="rabbitOne"> #rabbitOne
  3. <div id="raBBitone"> #raBBitone
The problem is that you shouldn't use more than one of these as identifiers. Mozilla (Netscape and Firefox) correctly addresses them as three different ids, but Internet Explorer does smash-case on them (interpreting all alphabetic characters as being lowercase), making all of them become the same id.

----

Quote ...
HTML and CSS Syntax (Toggle Plain Text)
  1. <div id="rabbit1"> #rabbit1
  2. <div id="raBBit1"> #raBBit1
These become the same id in IE.

----

Quote ...
should work fine...
where as

HTML and CSS Syntax (Toggle Plain Text)
  1. <div id="Rabbitone"> #Rabbitone
That one works as long as the smash-case duplicate ID is not present.

----

Quote ...
HTML and CSS Syntax (Toggle Plain Text)
  1. <div id="rabbit_one"> #rabbit_one
  2. <div id="rabbitone"> #RABBITONE
  3. <div id="RABBITONE"> #rabbitone
shouldn't work (or won't work on all browsers!)
The first one has an illegal character on some Doctypes.

The last two become the same id in IE, and dont address in Mozilla (or address as each other).
???

Quote ...
If you know of an official doc on this, please point it out, as for some reason I cannot actually find one... (which bugs me no end )
XHTML 1.0: The Extensible HyperText Markup Language (Second Edition)
Last edited by MidiMagic; Aug 9th, 2007 at 1:14 am.
Reputation Points: 730
Solved Threads: 181
Nearly a Senior Poster
MidiMagic is offline Offline
3,314 posts
since Jan 2007
Aug 9th, 2007
0

Re: Background image? Z-Index?

lol... no wonder I couldn't see a reference, I was looking at CSS 1/2 specs... not xhtml!

Thank you for the extra clarification
Reputation Points: 63
Solved Threads: 12
Posting Pro in Training
autocrat is offline Offline
427 posts
since Feb 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: Problems on IE6
Next Thread in HTML and CSS Forum Timeline: Graphic Text containers that stretch





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC