Monday, October 13, 2014

How to display another website in iframe for full height and width

I know you are thing of how you can show another website in your website for full height and width in html code <iframe></iframe> . The main code for iframe is bellow


    <iframe src="www.anothersite.com" width="" height=""></iframe>

Here is the confusion how you will place the and width. you know you website is 1000px width for example and 1400 px height. definitely, you will go to give this height and width in <iframe> . yes, thta will work. but problem is for other pages. When the user will go to other pages, they see those pages in this specified height and width and there will show a scroller in the right side as your specified height has crossed other pages. Or, you will see there are a lot of white space in your bottom if the height of other pages don't cover full height you mentioned in the <iframe>. so, you are confused. here is the solution that will rid you of this problem. just give the  height="100%" and width="100%", it will solve your problem. it will get automatically height and width of per pages. So,  no worries. user will enjoy your website from another server without any problem.



Here is the full code for your clear understanding...


    <!DOCTYPE html>

    <html>

    <body>


    <iframe src="www.anothersite.com" width="100%" height="100%"></iframe>


    </body>

    </html>

Hope now you are clear for understanding this issue. Write your comment bellow for any query.

No comments:

Post a Comment