Advanced Search

Results 1 to 8 of 8

Thread: Arrange an image on top

  1. #1
    Join Date
    Feb 2009
    Location
    The land "Down Under"
    Posts
    10
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Arrange an image on top

    Hi there

    Hopefully you can understand what im trying to explain here!

    I have a transparant image that i want to be able to place as a background but have it on top of text and other elements on my page, giving the see through affect.

    I read a little about z-index but i cant see to get that to work, can someone give me a quick run down on what i might need to do to achive this.



    Thanks
    Ryan.
    Last edited by Stinger; 02-06-2009 at 05:09 AM.

  2. #2
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    Some code would be nice to have something to work with or a link to your site.

    But yes, it sounds like z-index will need to be used here.

    Say you have two divs one called "main" and another called "transimage"

    Then in the CSS you could have:

    Code:
    #main{
    z-index:10;
    }
    #transimage{
    z-index:50;
    }
    The transimage would then take precedence and appear on top of main if they were positioned in the same place.

  3. #3
    Join Date
    Jan 2008
    Posts
    4,103
    Thanks
    18
    Thanked 615 Times in 611 Posts
    Blog Entries
    5

    Default

    Yup. Take a look at this screen cast.

  4. #4
    Join Date
    Feb 2009
    Location
    The land "Down Under"
    Posts
    10
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default

    Hey guys,

    Thanks for the quick replies.

    I have had a quick play around with this, i think i might have an issue with the way im using the css (its hard to explain) but in my css file i have the following.

    Code:
    .bg{
      background:(url../images/sidebar_bg.gif) no-repeat bottom left;
      z-index:50;}
    And i call it in a td like this

    <td class="bg">

    It doesnt work but i noticed you used #bg in the css instead of .bg which i used. I tried using #bg and calling it with <div id="bg">

    But i will keep working on it!


    Thanks
    Ryan

  5. #5
    Join Date
    Jan 2008
    Posts
    4,103
    Thanks
    18
    Thanked 615 Times in 611 Posts
    Blog Entries
    5

    Default

    @Schmoopy You need to give it a position

    @Stinger Use .bg, and call it with <div class="bg">
    Except in the CSS, add:
    Code:
    position: relative;

  6. The Following User Says Thank You to Nile For This Useful Post:

    Stinger (02-06-2009)

  7. #6
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    Yes forgot about that, main cause of z-index not working is if the element isn't positioned, (e.g. static), so make sure you have it either position:relative or position:absolute and it should solve the problem.

  8. The Following User Says Thank You to Schmoopy For This Useful Post:

    Stinger (02-06-2009)

  9. #7
    Join Date
    Feb 2009
    Location
    The land "Down Under"
    Posts
    10
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default

    Thanks very much everyone!

  10. #8
    Join Date
    Jan 2008
    Posts
    4,103
    Thanks
    18
    Thanked 615 Times in 611 Posts
    Blog Entries
    5

    Default

    Glad to help you Stinger! Your welcome!

    It seems your topic is solved... Please set the status to resolved.. To do this:
    Go to your first post ->
    Edit your first post ->
    Click "Go Advanced" ->
    Then in the drop down next to the title, select "RESOLVED"

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •