how to place a div like this

Discussion in 'HTML & Website Design' started by hasanbasri, Dec 6, 2009.

  1. #1
    hello
    I want a method to make a page with these elements

    1. DIV element with width 100% and hieght:20px and placed on top of page,this div will not scroll up when the user scroll the page (this will be as same as a toolbar)

    • the page will be Iframe with height and width equal to all the page

    as in example bellow
    http://stackoverflow.com/

    thanks in advance
     
    hasanbasri, Dec 6, 2009 IP
  2. TJ Coldstepper

    TJ Coldstepper Peon

    Messages:
    224
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It is achievable using AJAX. Not merely using CSS.
     
    TJ Coldstepper, Dec 6, 2009 IP
  3. AssistantX

    AssistantX Peon

    Messages:
    173
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    The div can be stationary by giving the div CSS properties position: fixed; top: 0px; left: 0px; z-index: 1; width: 100%; height: 20px;. StackOverflow.com is not using an iFRAME.
     
    Last edited: Dec 6, 2009
    AssistantX, Dec 6, 2009 IP
  4. hasanbasri

    hasanbasri Peon

    Messages:
    78
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    thank you
    sooo what ajax script can do this job?
     
    hasanbasri, Dec 7, 2009 IP
  5. AssistantX

    AssistantX Peon

    Messages:
    173
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #5
    AJAX is not needed or used to create the effect (1 and 2) that you mentioned above.
     
    AssistantX, Dec 7, 2009 IP
  6. TJ Coldstepper

    TJ Coldstepper Peon

    Messages:
    224
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    from the site the OP provided -

    It's plain old javascript!
     
    TJ Coldstepper, Dec 7, 2009 IP
  7. Piggy

    Piggy Active Member

    Messages:
    574
    Likes Received:
    9
    Best Answers:
    1
    Trophy Points:
    70
    #7
    Yeah, if it were me, I'd use JavaScript for this... But if you're persistant on CSS, try this:

    I've used this code before and it works, but some browers had some issues...
     
    Last edited: Dec 8, 2009
    Piggy, Dec 8, 2009 IP
  8. white10

    white10 Peon

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    you do not need javascript for this only cSS
     
    white10, Dec 8, 2009 IP
  9. hasanbasri

    hasanbasri Peon

    Messages:
    78
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    thank you all
    really I just need javascript and CSS
    I will finish the work and will introduce a demo page here
     
    hasanbasri, Dec 8, 2009 IP
  10. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #10
    The javascript is there simply so that people only see that bar one time. That's all it does.

    With pure css, the bar would always be there. If this is ok, you can just use CSS. Notice that IE6 doesn't do position: fixed so possibly you might want to hide the bar entirely for that browser rather than writing a bunch of JS or CSS Expressions to get IE6 to behave.
     
    Stomme poes, Dec 9, 2009 IP