How can one create an overlay in css?

前端 未结 9 2046
青春惊慌失措
青春惊慌失措 2020-11-29 17:58

I\'d like to create a div with an arbitrary size, then display something on top of that div. What is the best way to position and size the overlay exactly as the div below i

9条回答
  •  借酒劲吻你
    2020-11-29 18:35

    I would suggest using css attributes to do this. You can use position:absolute to position an element on top of another.

    For example:

    Top!
    Bottom!

    and css

    #container {position:relative;}
    #on-top {position:absolute; z-index:5;}
    #on-bottom {position:absolute; z-index:4;}
    

    I would take a look at this for advice: http://www.w3schools.com/cssref/pr_class_position.asp

    And finally here is a jsfiddle to show you my example

    http://jsfiddle.net/Wgfw6/

提交回复
热议问题