Question on Css img? (fixed) [SOLVED]

Web design related discussion or help, including CSS.

Question on Css img? (fixed)

Postby Big_w » Tue Feb 02, 2010 11:22 pm

Hi, quick question, im trying to style the css background img so that it is above the html image, ive tryed using the z-index method but with no luck do you know what i can do?

http://i50.tinypic.com/2coj4tc.png

Heres the HTMl:

  1. <html>
  2.     <head>
  3.         <title></title>
  4.         <link rel='stylesheet' href='style.css' type='text/css'>
  5.     </head>
  6. <body>
  7.  
  8. <div id="splash">
  9. <div id='splash_img_graident'>
  10.  
  11. <img src="Star_Trek_Movie_2009_New_Enterprise_Crew_freecomputerdesktopwallpaper_1024.jpg" alt="image" width="1024" height="347" />
  12.  
  13. </div>
  14. </div>
  15.  
  16. </body>
  17. </html>
  18.  


The style.css:

  1. #splash_img.img{
  2. z-index: 2;
  3. }
  4.  
  5. #splash_img_graident {
  6. background-image: url(gradient.gif);
  7. z-index: 1;
  8. }


Thank you :)
Last edited by Big_w on Thu Feb 04, 2010 12:02 am, edited 1 time in total.
Im Dyslexic, Laugh as much as you want, I would.
User avatar
Big_w
 
Posts: 26
Joined: Tue Jan 05, 2010 6:56 pm
Location: England
Online: 24s
Karma: 0

Re: Question on Css img? (fixed)

Advertisment

Advertisment
 

Re: Question on Css img?

Postby wide_load » Wed Feb 03, 2010 1:13 am

you meen you want gradient.gif on top of Star_Trek_Movie_2009_New_Enterprise_Crew_freecomputerdesktopwallpaper_1024.jpg (terrible file name btw) ???

if so you cant have them in the same div like that, z-index will be moving the div up or down (including the content) if you put them in seperate divs you should be able to change the order either by using z-index, or by knowing that the browser starts from the top of the html and will put things on top of things already on the page. Things lower in the HTML are "above" things above them
Image
User avatar
wide_load
Top Contributor
 
Posts: 5616
Joined: Thu Aug 13, 2009 1:04 pm
Online: 13d 21h 55m 49s
Karma: 45

Re: Question on Css img?  [SOLVED]

Postby libeco » Wed Feb 03, 2010 7:17 pm

z-index ONLY works on items which have a position property. So in addition to wide_load's suggestion, also set the position to absolute or relative.
Common PHP/MySQL errors | How to display code on the forum
"It always seems impossible until its done." - Nelson Mandela
User avatar
libeco
Moderator
 
Posts: 2466
Joined: Fri Apr 24, 2009 9:03 pm
Location: Netherlands
Online: 5d 9h 32m 31s
Karma: 25

Re: Question on Css img?

Postby Big_w » Wed Feb 03, 2010 8:32 pm

Brilliant with some jiggling about ive got it working that you :)

Yeah the Image name was just what it was called on a site, its just a quick test im doing.

Thanks again.
Im Dyslexic, Laugh as much as you want, I would.
User avatar
Big_w
 
Posts: 26
Joined: Tue Jan 05, 2010 6:56 pm
Location: England
Online: 24s
Karma: 0


Return to Web Design

Who's online?

Users browsing this forum: No registered users and 1 guest