Home >Web Front-end >HTML Tutorial >Detailed explanation of iframe tag usage (attributes, transparency, adaptive height)_HTML/Xhtml_Web page production
Detailed explanation of iframe tag usage (attributes, transparency, adaptive height)_HTML/Xhtml_Web page production
WBOYOriginal
2016-05-16 16:41:072052browse
1. iframe definition and usage
The iframe element creates an inline frame (ie, inline frame) that contains another document.
Differences between HTML and XHTML
In HTML 4.1 Strict DTD and XHTML 1.0 Strict DTD, the iframe element is not supported.
Script House uses frame technology, but your browser does not support it Frame, please upgrade your browser to access Script Home normally.
Use pixels to define iframe frame size
Copy code
The code is as follows:
Script Home Frame technology is used, but your browser does not support frames. Please upgrade your browser to access Script Home normally.
Use percentage to define iframe frame size
2. iframe transparent
in transparentBody.htm file In the tag, I have added style="background-color=transparent". Through the following four ways of writing IFRAME, I think you should have a clear understanding of how to achieve the iframe background transparency effect:
Copy code
The code is as follows:
iframe is used as a last resort, because using iframe will bring more problems, and some Browsers can be set up to block iframes as ads.
I used iframe in a recent work content. The problem I encountered at first was that the iframe was highly adaptive. I found a solution to this problem in the blog of Ued team of Koubei.com, and later I encountered an iframe. Transparency issue
Usually the background color of iframe will be white, and it may have different colors in different browsers
If the main page has an overall background color or background image
A white block will appear in the iframe area, which is inconsistent with the main page, which requires iframe transparency
I found the solution by searching for iframe transparency on Google
Copy code
The code is as follows:
Of course, the premise is that the color is not set in the iframe page [code] Note: iframe transparency mainly uses allowtransparency="true" style="background-color=transparent" 3. iframe adaptive height Due to The article is too long, you can move here to view http://www.jb51. net/article/15780.htm 4. Output iframe advertising code through js [code] document.write('');
5. Sometimes we need to consider whether the user's browser supports the iframe tag, then we need to write it as follows
Copy code
The code is as follows:
Your browser does not support inline frames or is currently configured not to display inline frames.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn