javascript - 如何打开 div 并使消息可读?

标签 javascript html css reactjs

我用 reactjs 创建了一个可折叠的 div,这使得我的内容不可读。这是组件的一部分:

<div>
       {/*start collapse*/}
            <div className={"collapse" + (this.state.open ? ' in' : '')}>
            <div className="col-md-12 message"> Hello I am open nice to read this properly !!!<hr/> </div>
            </div
       {/*end collapse*/}
</div>
<div className="col-md-12 more">This should be in same position and not pushed downwards but not visible/ blurred when I click on open</div>
</div>

CSS 看起来像这样:

.message {
      position: relative;
}

div.more {
      position: absolute;
      top: 40px;
      z-index: -1;
}

div.hier {
      position: absolute;
      top: 60px;
      z-index: -1;
}

在 index.html 中我有同样的问题:

<div id="app"></div>
  <div>
    <div class="col-md-12 hier">This should be in same position and not pushed downwards but not visible/ blurred when I click on open</div>
  </div>

我使用哪个 CSS 来使 div 不可见/模糊并且在我点击打开时不被压下?

代码笔 here

最佳答案

您需要有一个属性 visibility 设置为 hidden 的类。

将此应用于 HTML 元素将使标记不可见,但会保持它在页面上的分配空间不变。

关于javascript - 如何打开 div 并使消息可读?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41205031/

相关文章:

javascript - Angular 2 : How to apply a callback when I leave a route

javascript - Chrome 应用程序中的无限文件存储

javascript - 使用 mouseover() 时如何只允许出现一条消息

html - 网站上的 L 形文本框

javascript - 修复 http get 请求 angularJS 时的竞争条件

javascript - 如何在环回中多次切换模型的数据源? AttachTo 不起作用

html - CSS 如何在动画期间关闭滚动?

javascript - 自动复制表中的最后一行

javascript - 更改 parsley-errors-list 在 parsleyjs 中的位置

html - 居中表格和边距不起作用?