Several situations where div is covered by iframe and their solutions

Several situations where div is covered by iframe and their solutions

Similar structures:

Copy code
The code is as follows:

<div></div><ifram src="<a href="http://caibaojian.com"></iframe">http://caibaojian.com"></iframe</a>>

The first one: the transparent background is blocked

When a div uses a transparent background, regardless of whether it is in (opacity or RGBA format), except for Chrome, all other browsers will show that the div is covered by the iframe.

Solution:

The div uses an opaque background or a transparent background image.

The second type: z-index is invalid in IE8

In IE, introducing video playback in an iframe will cause the z-index of the div to be invalid, that is, no matter what the z-index of the div is set to, it will be covered by the iframe. source

Solution:

Add a parameter wmode=opaque to the iframe address. If the address is: http://caibaojian.com, then change it to: http://caibaojian.com?wmode=opaque.

flash behind other elements

By the way, I saw that Flash also has this z-index invalid problem. The same is to add the above parameter to Flash


Copy code
The code is as follows:

<param name="wmode" value="transparent">

or


Copy code
The code is as follows:

<EMBED src="<a href="https://cdn.css-tricks.com/FlashAnimation.swf">https://cdn.css-tricks.com/FlashAnimation.swf</a>" type="application/x-shockwave-flash" wMode="Transparent">

Appendix: Some parameters of iframe

border


Copy code
The code is as follows:

<iframe border="3"></iframe>

Sets the width of the border around the frame

frameboder


Copy code
The code is as follows:

<iframe frameboder="0"></iframe>

Sets whether the border is 3-dimensional (0=no, 1=yes)

height,width


Copy code
The code is as follows:

<iframe height="31" width="88"></iframe>

Set the width and height of the border

scrolling


Copy code
The code is as follows:

<iframe scrolling="no"></iframe>

Is there a scroll bar (yes, no, auto)

src


Copy code
The code is as follows:

<iframe src="girl.gif"></iframe>

Specify the file or image called by the iframe (html,htm,gif,jpeg,jpg,png,txt,*.*)

Summary <br />The above is the entire content of this article. I hope it will be of some help to your study or work. If you have any questions, you can leave a message to communicate.

<<:  Element Timeline implementation

>>:  Some problems that may be caused by inconsistent MySQL encoding

Recommend

Mysql backup multiple database code examples

This article mainly introduces the Mysql backup m...

The main differences between MySQL 4.1/5.0/5.1/5.5/5.6

Some command differences between versions: show i...

Install two MySQL5.6.35 databases under win10

Record the installation of two MySQL5.6.35 databa...

Use personalized search engines to find the personalized information you need

Many people now live on the Internet, and searchin...

Quick solution for forgetting MySQL8 password

Preface When we forget the MySQL database passwor...

How to build a DHCP server in Linux

Table of contents 1. Basic knowledge: 2. DHCP ser...

How to change the domestic image source for Docker

Configure the accelerator for the Docker daemon S...

Detailed explanation of the use of grid properties in CSS

Grid layout Attributes added to the parent elemen...

Five ways to traverse JavaScript arrays

Table of contents 1. for loop: basic and simple 2...

Use Javascript to develop sliding-nav navigation plug-in with sliding bar effect

Table of contents 1. Introduction 2. Usage 3. Dev...

js to implement collision detection

This article example shares the specific code of ...