Как создать прозрачный iframe?

Опубликовано: 31 Января, 2022

Тег <iframe> - это встроенный фрейм. Он используется для встраивания другой HTML-страницы в текущую HTML-страницу.

Syntax:

<iframe src = "URL"></iframe>

A transparent iframe can be made by setting its background to transparent.

body {
    background-color : transparent;
}

And, the allowtransparency attribute of “iframe” is to be set as “true”.

<iframe src = "URL" allowtransparency = "true"></iframe>

Example:

  • HTML code:
    <!DOCTYPE html>
    <html>
      
    <body>
        <div style="background: green; 
                padding: 30px;">
                  
            <iframe src="iframe.html" 
                allowtransparency="true">
                Alternate content
            </iframe>
        </div>
    </body>
      
    </html>
  • iframe.html
    <!DOCTYPE html>
    <html>
      
    <body style=
        "background-color: transparent; 
        text-align: center; 
        color: #ffffff;">
          
        <p>geeksforgeeks</p>
        <p>geeksforgeeks</p>
        <p>geeksforgeeks</p>
        <p>geeksforgeeks</p>
        <p>geeksforgeeks</p>
        <p>geeksforgeeks</p>
        <p>geeksforgeeks</p>
    </body>
      
    </html>

    Output:




Previous
How to check whether a script is running under Node.js or not ?
Next
HTTP status codes | Redirection Responses
Recommended Articles
Page :
Article Contributed By :
jnikita356
@jnikita356
Vote for difficulty
Article Tags :
  • HTML-Misc
  • Picked
  • HTML
  • Web Technologies
Practice Tags :
  • HTML
Report Issue
Picked HTML HTML-Misc

РЕКОМЕНДУЕМЫЕ СТАТЬИ