[英]Hide a large element without using display:none or visibility:hidden
Is it possible to hide an element without using display:none, visibility:hidden or opactiy:0 CSS rules? 是否可以在不使用display:none,visible:hidden或opactiy:0 CSS规则的情况下隐藏元素?
At the moment anything I try, the content of the still remains relatively the same (Note: I am using Bootstrap 3) 目前,我尝试执行任何操作时,内容仍然保持相对不变(注意:我使用的是Bootstrap 3)
I mostly need to only use elements that are normally used for styling, rather than hiding/showing the content directly, so things like Opacity, display:none and visibility:hidden wouldn't work. 我通常只需要使用通常用于样式设置的元素,而不是直接隐藏/显示内容,因此诸如不透明度,显示:无和可见性:隐藏之类的东西将不起作用。 (It's to show some bad behaviour I found in a particular version of a browser, wanted to confirm it on other browsers with a controlled set)
(这是为了显示我在特定版本的浏览器中发现的一些不良行为,希望在具有受控集的其他浏览器上进行确认)
Sorry guys, I managed to figure it out immediately after posting, what I used: 抱歉,我在发布后立即设法弄清楚了我的用法:
position:fixed !important;
height:1px !important;
width:1px !important;
bottom:0 !important;
left:0 !important;
z-index:-999 !important;
display:inline !important;
Just to give some more context into the CSS rules given above. 只是为了在上面给出的CSS规则中提供更多背景信息。 Height and width as 1px for the obvious reasons of making it as small as possible.
明显的原因是将高度和宽度设置为1px尽可能小。 The position being fixed but placing it constantly outside of the browsers visibility by place it at the 0th pixel from the bottom and the 0th pixel from the left.
该位置是固定的,但始终放置在浏览器可见性之外,方法是将其放在底部的第0个像素处,并将其放在左侧的第0个像素处。 I made everything !important so it over rides anything that might be cascaded.
我所做的一切都非常重要!因此,它超越了所有可能层叠的东西。
Try opacity:0;
尝试
opacity:0;
. 。 This will make that element transparent.
这将使该元素透明。
.classname{
position:absolute;
left:-2000px;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.