Transparent Iframe Body

前端 未结 3 1055
深忆病人
深忆病人 2021-01-31 01:44

I need to have a (crossdomain) iframe with dynamic width and height.

My question is, Can I create an iframe with 100% size and a transparent background that will show th

相关标签:
3条回答
  • 2021-01-31 02:05

    By inspecting the iframe page you might find out there is color on some parts of the page. My suggestion would be to start from the highest component when adding the transparency:

    html {
      background-color: transparent !important;
    }
    

    And then in the iframe element:

    <iframe src="www.." allowtransparency="true">
    
    0 讨论(0)
  • 2021-01-31 02:22

    yes you can (if i understand your question correctly)

    heres the code if you have edit access to the iframe content put this in the head (of the iframe)

    <style type="text/css">
     <!-- BODY {background:none transparent;}-->
     </style>
    

    and then embed the iframe like this

    <iframe src="frame.htm" allowtransparency="true">
    
    0 讨论(0)
  • 2021-01-31 02:22

    This isn't tested, but iframes (any element) should have a default background of being transparent.

    If that's not true, you can set them to being transparent in CSS background: transparent

    If that doesn't work, you can use CSS opacity filters:
    http://www.w3schools.com/Css/css_image_transparency.asp

    0 讨论(0)
提交回复
热议问题