7 Replies - 2744 Views - Last Post: 30 June 2011 - 08:50 AM

#1 lemonchicken  Icon User is offline

  • D.I.C Head

Reputation: -5
  • View blog
  • Posts: 76
  • Joined: 11-December 10

Floating div over image

Posted 30 June 2011 - 08:13 AM

Hi,

I'm wanting to place a floating nav over everything

the code here
is basically what I need but my site won't display it over the image

I've tried position:absolute in HTML & CSS, as well as using z-index but with no avail.

the menu here is what I'll be using but I need help in getting it to show above the image. So any tips or tricks you know of to do this are much appreciated..?

Is This A Good Question/Topic? 0
  • +

Replies To: Floating div over image

#2 EnvXOwner  Icon User is offline

  • PHP Brogrammer
  • member icon

Reputation: 355
  • View blog
  • Posts: 2,314
  • Joined: 10-August 09

Re: Floating div over image

Posted 30 June 2011 - 08:18 AM

Here is an example of what you have to do:
.menu {
    position: fixed;
    top: 100px;
    left: 0px;
    z-index: 5;
}


Tell me if that works.
Was This Post Helpful? 1
  • +
  • -

#3 lemonchicken  Icon User is offline

  • D.I.C Head

Reputation: -5
  • View blog
  • Posts: 76
  • Joined: 11-December 10

Re: Floating div over image

Posted 30 June 2011 - 08:29 AM

thanks for the code unfortunately it still shows behind the image :/

any other ideas?


cheers

This post has been edited by lemonchicken: 30 June 2011 - 08:29 AM

Was This Post Helpful? 0
  • +
  • -

#4 Slice  Icon User is online

  • D.I.C Addict


Reputation: 197
  • View blog
  • Posts: 595
  • Joined: 24-November 08

Re: Floating div over image

Posted 30 June 2011 - 08:30 AM

you can also try:
.menu
{
   float: left;
   position: relative;
   z-index: 999;
   /* then all your height, width, borders etc. */
}



Then make sure the z-index of containers or anything else is set to below 999. Using relative and floats keeps the page flowing. Absolute positioning can be a pain to work with sometimes.

EDIT: oh and you will have to set the other divs to relative as well.

This post has been edited by Slice: 30 June 2011 - 08:31 AM

Was This Post Helpful? 1
  • +
  • -

#5 EnvXOwner  Icon User is offline

  • PHP Brogrammer
  • member icon

Reputation: 355
  • View blog
  • Posts: 2,314
  • Joined: 10-August 09

Re: Floating div over image

Posted 30 June 2011 - 08:35 AM

Alright, but aren't you also wanting the overlying div to scroll? That's what happens in the link in the tutorial you gave us.

This post has been edited by EnvXOwner: 30 June 2011 - 08:35 AM

Was This Post Helpful? 0
  • +
  • -

#6 lemonchicken  Icon User is offline

  • D.I.C Head

Reputation: -5
  • View blog
  • Posts: 76
  • Joined: 11-December 10

Re: Floating div over image

Posted 30 June 2011 - 08:37 AM

the pic still pushes the menu to underneath. really strange cos like you say, the other divs are relative.. I'll have another fiddle and report back. In the meantime, anything else that could work is appreciated :D


View PostEnvXOwner, on 30 June 2011 - 04:35 PM, said:

Alright, but aren't you also wanting the overlying div to scroll? That's what happens in the link in the tutorial you gave us.

initially I only wanted it at a fixed position near the top. scrolling is fine cos I figure that code would work in a way better than any others at showing above the image..

This post has been edited by lemonchicken: 30 June 2011 - 08:40 AM

Was This Post Helpful? 0
  • +
  • -

#7 EnvXOwner  Icon User is offline

  • PHP Brogrammer
  • member icon

Reputation: 355
  • View blog
  • Posts: 2,314
  • Joined: 10-August 09

Re: Floating div over image

Posted 30 June 2011 - 08:39 AM

Is that background the image you're talking about? If it is set the image via CSS on the body like:
body {
    background-image: url('blahblah.png');
}


nvm. I just noticed that you're images cycled.

This post has been edited by EnvXOwner: 30 June 2011 - 08:41 AM

Was This Post Helpful? 0
  • +
  • -

#8 lemonchicken  Icon User is offline

  • D.I.C Head

Reputation: -5
  • View blog
  • Posts: 76
  • Joined: 11-December 10

Re: Floating div over image

Posted 30 June 2011 - 08:50 AM

Excellent, thank you EnvX I now have it working with your css :walkman:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1