HTML file in another html file applying CSS


HTML file in another html file applying CSS



I'm having an issue as when I load in an imported email's HTML it applies the CSS within the email HTML to all my site. Images found below. To clarify, I am loading the site in through jquery load.



With email loaded in:



Email not loaded in:



I want to apply the CSS in the email only within the 'results' div.



Here's my code:




https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js

$(function(){
$("#results").load("https://x/");
});






So, what is the problem? What would you expect to be different?
– Nico Haase
Jul 2 at 13:33





Load new html inside a iframe, not in div
– Sinto
Jul 2 at 13:34






I only want the CSS to effect the results div. Not my whole site. @NicoHaase
– Taylan Selvi
Jul 2 at 13:34





Iframe can't make the height 100% based on content of the iframe. ALready triied.
– Taylan Selvi
Jul 2 at 13:35





I think we can get the content height inside iframe by contentWindow.document.body.scrollHeight & set it to iframe, as stackoverflow.com/a/9163087/4229270
– Sinto
Jul 2 at 13:40



contentWindow.document.body.scrollHeight









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

api-platform.com Unable to generate an IRI for the item of type

How to set up datasource with Spring for HikariCP?

Display dokan vendor name on Woocommerce single product pages