Reputation: 159
I'm a complete begginer in CSS and HTML and I'm building my first basic page for training.
What I want do do is making the embedded google map scale according to the size of the browser window. What are your suggestions? Is there a way to use the embedded code in a CSS class? How would you do it?
Example google maps code:
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.pt/maps?f=q&source=s_q&hl=pt-PT&geocode=&q=lisbon,+portugal&aq=&sll=39.399872,-8.224454&sspn=36.11675,86.572266&ie=UTF8&hq=&hnear=Lisboa&t=h&z=11&iwloc=A&ll=38.706932,-9.135632&output=embed"></iframe><br /><small><a href="http://maps.google.pt/maps?f=q&source=embed&hl=pt-PT&geocode=&q=lisbon,+portugal&aq=&sll=39.399872,-8.224454&sspn=36.11675,86.572266&ie=UTF8&hq=&hnear=Lisboa&t=h&z=11&iwloc=A&ll=38.706932,-9.135632" style="color:#0000FF;text-align:left">Ver mapa maior</a></small>
Upvotes: 1
Views: 9775
Reputation: 751
Check out these two links. The first one shows the code the second shows the result
http://www.leapbeyond.com/ric/scuba/appletdemo/FullScreenMapCode.htm
http://www.leapbeyond.com/ric/scuba/appletdemo/FullScreenMap.htm
Upvotes: 0
Reputation: 8819
So one option is to simply change the width and height attributes to percents.
<iframe width="50%" height="50%"...
Another option would be to take those attributes out and create a CSS element selector in your stylesheet
iframe{width:50%;height:50%;}
If you add an class attribute say:
<iframe class="map"...
You can further specify your class:
iframe.map{width:50%;height:50%;}
Sitepoint has a good CSS reference: http://reference.sitepoint.com/css
Upvotes: 4