html - 确定元素之间的边距
问题描述
可以说我有 3 个元素。
<h2>test<h2>
<h2 style="visibility: visible" >test1<h2>
<h2>test2<h2>
现在通过java脚本我有时想隐藏test1,没问题。但是当发生这种情况时,我希望 test2 在测试下方。在 test1 隐藏的那一刻, test 和 test2 之间有一个空白空间。当 test1 隐藏时,我尝试通过更改 test2 的 margin-top 来做到这一点,但没有任何反应。
if (condition is true, change the margin-top of test2)
解决方案
推荐阅读
- javascript - 解构大(嵌套)对象的最佳方法是什么?
- regex - Is there a way to find all occurrences of using var with a require, and replacing just those results with const?
- jupyter-notebook - 如何在 Jupyter Notebook 中创建虚拟环境?
- python - 如何将具有每个级别的变量字符串的嵌套字典转换为熊猫数据框?
- java - 加入时为 Discord 服务器中的用户分配角色
- javascript - XMLHttpRequest 回调中的“this”关键字引用 React 组件
- python - 区块链试图将键/值添加到事务字典以创建区块链
- jmeter - 针对 microsoft edge 运行 blazemeter 脚本
- c++ - C++ mysqlConnector 未定义引用检查
- javascript - Naked.toolshed 未发送所有参数信息