Transparent iframes


An iframe is a useful tool for embedding content within a webpage, but sometimes you might want the iframe to blend seamlessly with its surroundings.
This tutorial will show you how to make an iframe transparent by adjusting its attributes and styling the content it displays.


1. Add Transparency to the iframe


To make the iframe transparent, include the allowtransparency="true" attribute in your iframe tag:
HTML Code
  1. <iframe name="iframe" src="mypage.html" width="50" height="50" allowtransparency="true"></iframe>



2. Style the iframe Content


The page loaded inside the iframe must have a transparent background. Add the following CSS to the HEAD section of the iframe's content page:

HTML Code
  1. <style type="text/css">
  2. body, html { background-color: transparent; }
  3. </style>
DanielXP's Avatar
Author:
Views:
2,182
Rating:
There are currently no comments for this tutorial, login or register to leave one.