position a div on top of an image

后端 未结 4 1032
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-04 05:50

I want position a DIV with the content of an addsense script on top of a img that I use as a banner.

I have the img tag inside a div. then I put the google script inside

4条回答
  •  伪装坚强ぢ
    2021-02-04 06:02

    You want to position the second div with absolute:

    http://jsfiddle.net/sbNZu/

    Relevant code:

    img {
        border: 2px solid black;   
    }
    
    #container {
        position: relative;    
    }
    
    #example {
       position: absolute;
       top: 10px;
       left: 10px; 
        
       padding: 5px;
       background-color: white;
       border: 2px solid red;
    }
    This is my div

提交回复
热议问题