当前位置:网站首页>display,visibility,opacity
display,visibility,opacity
2022-08-02 03:22:00 【suzhiwei_boke】
display、visibility和opacity的区别
共同点:都可以隐藏元素,让元素不可见
区别:
display: none
(1)DOM 结构:浏览器不会渲染 display 属性为 none 的元素,不占据空间;
(2)事件监听:无法进行 DOM 事件监听;
(3)性能:动态改变此属性时会引起重排,性能较差;
(4)继承:不会被子元素继承,毕竟子类也不会被渲染;
(5)transition:transition 不支持 display。
visibility: hidden
(1)DOM 结构:元素被隐藏,但是会被渲染不会消失,占据空间;
(2)事件监听:无法进行 DOM 事件监听;
(3)性 能:动态改变此属性时会引起重绘,性能较高;
(4)继 承:会被子元素继承,子元素可以通过设置 visibility: visible; 来取消隐藏;
(5)transition:transition 支持 visibility。
opacity: 0
(1)DOM 结构:透明度为 100%,元素隐藏,占据空间;
(2)事件监听:可以进行 DOM 事件监听;
(3)性 能:提升为合成层,不会触发重绘,性能较高;
(4)继 承:会被子元素继承,且,子元素并不能通过 opacity: 1 来取消隐藏;
(5)transition:transition 支持 opacity。
v-show底层是操作元素的display属性
v-if底层是操控元素的创建/销毁(创建删除dom)
边栏推荐
- ImportError: libGL.so.1: cannot open shared object file: No such file or directory
- parser = argparse.ArgumentParser()解析
- np.unique() function
- mysql中json类型字段用法
- Deveco studio 鸿蒙app访问网络详细过程(js)
- 磷脂-聚乙二醇-酰肼,DSPE-PEG-Hydrazide,DSPE-PEG-HZ,MW:5000
- __dirname
- 磷脂-聚乙二醇-靶向新生血管靶向肽APRPG,DSPE-PEG-APRPG
- MySQL中字符串比较大小(日期字符串比较问题)
- 小程序组件总结
猜你喜欢

Scientific research reagent DMPE-PEG-Mal dimyristoylphosphatidylethanolamine-polyethylene glycol-maleimide

Redis笔记进阶篇:万字长文-整理Redis,各种知识点,建议收藏

知识工程作业2:知识工程相关领域介绍

The @autowired distinguished from @ the Resource

ModuleNotFoundError No module named 'xxx' possible solutions

parser = argparse.ArgumentParser()解析

【 application 】 life many years of operations, what turned scored 12 k + annual bonus salary?

PowerManagerService灭屏超时流程

ThunderBirde无法登录问题、pycharm调试一直收集数据、RuntimeError: CUDA error: device-side assert triggered等疑难杂症解决

MySQL中JOIN的用法
随机推荐
The @autowired distinguished from @ the Resource
SSM integration
@Accessors 注解详解
Phospholipid-polyethylene glycol-targeted neovascularization targeting peptide APRPG, DSPE-PEG-APRPG
Redis笔记基础篇:6分钟看完Redis的八种数据类型
@Autowired注解的使用
mysql卸载详细教程
parser = argparse.ArgumentParser()解析
[Basic Tutorial of Remote Control Development 1] Crazy Shell Open Source Formation Drone-GPIO (Remote Control Indicator Light Control)
DSPE-PEG-PDP,DSPE-PEG-OPSS,磷脂-聚乙二醇-巯基吡啶供应,MW:5000
Cloud server installation and deployment of Nacos 2.0.4 version
广州华为面试总结
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
Scientific research reagent DMPE-PEG-Mal dimyristoylphosphatidylethanolamine-polyethylene glycol-maleimide
@DateTimeFormat注解
Deveco studio Hongmeng app access network detailed process (js)
AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘
Amazon sellers how to improve the conversion
SOCKS5
【装机】老毛桃的安装及使用