是否可以在iframe前面放置东西? [英] Is it possible to place something in front of iframe?

查看:131
本文介绍了是否可以在iframe前面放置东西?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网页上嵌入了YouTube视频,它们显示在下拉菜单,灯箱等上。我宁愿不使用旧的YouTube嵌入代码,但是愚蠢的iframe令人讨厌地把自己放在页面上的其他元素上。是否可以让它学习它的地方?

解决方案

你可以浮动iframe和任何你想要的顶部



然后,在顶部的项目上,只要设置一个负顶部边距。



这是一个jsfiddle 来显示我的意思。





更新


您也可以对自己想要的项目使用绝对定位,但通常会导致网站的其他问题。

您似乎试图违反常规HTML流程。在HTML中首先出现的一般是下或之前的事情。



但是,您可以从HTML呈现的常规流中取出一个元素,



更新了jsfiddle 来显示这是如何完成的。请注意,绝对位置可能会给您的网站设计带来其他问题。


I'm embedding YouTube videos on the page and they appear over drop down menus, over lightbox, etc. I'd rather not use the old YouTube embed code but stupid iframe is obnoxiously putting itself over every other element on the page. Is it possible to make it learn its place?

解决方案

You can float both the iframe and whatever you want on top of it inside of a container.

Then, on the items you want on top, just set a negative top margin.

Here's a jsfiddle to show what I mean.

You can also use absolute positioning on the items you want in front, but that typically results in other issues with the site.

update

It appears you are trying to go against regular HTML flow. Things that come first in the HTML are generally "under" or before things that come after.

However, you can take an element out of the regular flow of HTML rendering and position it absolutely.

I've updated the jsfiddle to show how this is done. Be warned, absolute position could bring other issues into your site design.

这篇关于是否可以在iframe前面放置东西?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆