Skip to content Skip to sidebar Skip to footer

Show Page In Div

I want to get div content from another page (.html) and display it with the styling of my page. The div height should size depending on the content since it's aligned to the bottom

Solution 1:

If you wish to have the content from the remote file styled with your local styles, you would either have to load your styles into an iframe containing that remote file (removing any competing stylesheets), or load the content from the remote file into your local file. The later is probably easier.

Many tools exist online to assist you in doing this. For instance, jQuery (world's most popular JavaScript library) can asynchronously load a remote file and then add portions of it to the parent document:

$("#page").load("remote.html #content");

This would grab the contents of #content on page remote.html, and place them within #page on the current page.

Post a Comment for "Show Page In Div"