CSS隐藏HTML元素,保持它的和高度? [英] CSS for hiding a HTML element, keeping its with and height?

查看:621
本文介绍了CSS隐藏HTML元素,保持它的和高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个CSS片段来隐藏HTML < div class =my> (有很多内容,包括文本和其他div)但仍然为它保留空间。是否有更好或更快的 div.my {opacity:0;}

I need a CSS snippet for hiding a HTML <div class="my"> (with quite a lot of contents, including text and other divs), but still reserving space for it. Is there something better or faster than div.my{opacity:0;}?

推荐答案

visibility:hidden;

这将从页面中隐藏元素,但保留它在布局中的位置。

This will hide the element from the page but retain it's place in the layout.

这篇关于CSS隐藏HTML元素,保持它的和高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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