0

Dear programmers @ stackoverflow,

Is it possible to set an iframe as a background using css?

I explain myself a bit further:

Today I have a div in my website called div="lead"
When I use that div in my html files the picture 'lead_photo.jpg' displays as a background.
The code I use in my css file to obtain that is:

#lead { position: relative; float: left; clear: both; 
        width: 100%; height: 300px;
        background: #dbdbdb url(../images/lead_photo.jpg) center no-repeat; }

So far so good.

Now, I would like to display my "google business view-tour", which I should integrate using the iframe link, as a background on my website in stead of the current photograph.

Is this possible?

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
filip
  • 11
  • 1
  • 1
  • 1
  • Please see this question: http://stackoverflow.com/questions/13363092/vimeo-iframe-as-background – Shaun Apr 11 '15 at 08:06
  • You'll have to position the iframe absolutely and with a z index lower than the other elements. – Bram Vanroy Apr 11 '15 at 08:08
  • remember to add your own answer and mark solved, it helps the community ;) – Daniel Cheung Apr 11 '15 at 13:08
  • Hi @filip , I want to do the same with what you want to achieve but i cant find still figure out how to do it ? do you have that answer already? my goal is to make the google map iframe as background to my section. – cdt Dec 14 '21 at 03:15

2 Answers2

0

With this text in the css it worked just fine for me:

#iframe { position: absolute; float: left; clear: both; width: 100%; height: 350px; z-index: 0; left no-repeat; }

afterwords I used div="iframe" in html.

Thanks 4 helping me out!

Manwal
  • 23,450
  • 12
  • 63
  • 93
filip
  • 11
  • 1
  • 1
  • 1
0

you try it this CSS to set background image us. also, check the path of your image correct or not.

#lead { 
    position: relative; 
    float: left; 
    clear: both; 
    width: 100%; 
    height: 300px;
    background-image:  #dbdbdb, url(images/lead_photo.jpg);
    background-position: center no-repeat; 
}

you set color & images to us this CSS and set background image.

KashyapVadi
  • 495
  • 4
  • 14