Override body style for content in an iframe

前端 未结 10 952
青春惊慌失措
青春惊慌失措 2020-11-22 01:10

How can I control the background image and colour of a body element within an iframe? Note, the embedded body element has a class, and the iframe i

10条回答
  •  名媛妹妹
    2020-11-22 01:16

    An iframe is a 'hole' in your page that displays another web page inside of it. The contents of the iframe is not in any shape or form part of your parent page.

    As others have stated, your options are:

    • give the file that is being loaded in the iframe the necessary CSS
    • if the file in the iframe is from the same domain as your parent, then you can access the DOM of the document in the iframe from the parent.

提交回复
热议问题