Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
Thread Tools Display Modes
Share |
  #1  
Old 04-30-2013, 06:36 PM
xarzu's Avatar
xarzu xarzu is offline
Contributing Member
 
Join Date: 04-07-07
Posts: 50
iTrader: 0 / 0%
How do I code an iframe in html such that it keeps a percentage of the browser window

Hi forum.
How do I code an iframe in html such that it keeps a percentage of the browser window width when the browser is resized instead of a static pixel count?
 
Reply With Quote

Advertisement

Advertisement

  #2  
Old 05-01-2013, 08:51 PM
smanaher's Avatar
smanaher smanaher is offline
v7n Mentor
 
Join Date: 03-04-13
Location: Oneonta, NY
Posts: 329
iTrader: 0 / 0%
Xaru,

You would use percentages when defining the width of the iframe instead of absolute values (i.e. pixels). That way no matter what the browser window width, the width of the iframe will be a percentage of it.

Hope that helps,
Shawn
 
Reply With Quote
  #3  
Old 05-05-2013, 06:11 PM
beanz750 beanz750 is offline
Junior Member
 
Join Date: 05-05-13
Posts: 7
iTrader: 0 / 0%
This should work. I added some extra settings in case you need any of those as well...

HTML Code:
<iframe marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" frameborder="0" height="50%" scrolling="No" width="50%" src="yourPage.html"></iframe>

Last edited by snakeair; 05-05-2013 at 06:54 PM.
 
Reply With Quote
  #4  
Old 05-07-2013, 12:00 AM
cellsindex cellsindex is offline
Junior Member
 
Join Date: 04-25-13
Posts: 25
iTrader: 0 / 0%
If you want to adjust automatically then you should used javascript. Get width and height of current documant and devide by two and just accroding to resultend dimentions.
 
Reply With Quote
  #5  
Old 05-07-2013, 04:13 AM
lieo12 lieo12 is offline
Junior Member
 
Join Date: 05-06-13
Location: UK
Posts: 2
iTrader: 0 / 0%
Thumbs up

It is easy to work with java-script. Either you can use all the attributes of iFrame tag more carefully and according to your requirement.
Code:
<iframe marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" frameborder="0" height="50%" scrolling="No" width="50%" src="yourPage.html"> </iframe>

Last edited by snakeair; 05-07-2013 at 06:27 AM.
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
open iFrame link in a new tab in browser! HeLP! basslion Coding Forum 5 07-02-2009 10:04 PM
Open new browser window in Full Screen Javascript Help 2939195631902 Coding Forum 11 01-29-2009 09:32 AM
How to make BckGrn image resize to browser window? seonewbee Web Design Lobby 4 07-19-2005 10:47 AM
Code To Automatically Close Browser Window DJ-Craig Coding Forum 1 02-15-2004 08:13 PM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 07:56 PM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC