Is it possible to set I-Frame source in a CSS style sheet?

I am using CSS media queries to set up a web page, I want the homepage to just be a 100% x 100% background image with an iframe centralised on it. However I want different content to load depending on screen size / resolution of the person viewing.

I can use CSS media queries to render the iframe appearance (width / height / position / etc) as I want, but depending on which query it fits I also want source to change... is this possible? Can I list source as a CSS style or must it be within iframe tag? If it is possible any idea how as nothing I try seems to work!

tried:

.frame1{

src=__________.htm;

}

and

.frame1{

src=url(____________.htm);

}

and

.frame1{

iframe src=url(____________.htm);

}

and a few other similar approaches. Then in the html <iframe class="frame1"></iframe>

2 Answers

Relevance
  • 8 years ago
    Favorite Answer

    Use 100% HTML and optionally Javascript for IFRAMES. If you want the source to change periodically, you'd have to set it as a Javascript variable and change it with Javascript.

  • Anonymous
    4 years ago

    Put this in the <head> area of the web pages you want the stylesheet linked to: <link href="mystylesheet.css" rel="stylesheet" type="text/css"> bear in mind that the path to "mystylesheet.css" will change if your HTML files are in different folders than your css file.

Still have questions? Get your answers by asking now.