PHP前端开发

bootstrap 怎么隐藏元素

百变鹏仔 1个月前 (11-14) #bootstrap
文章标签 元素
bootstrap隐藏元素的方法:1、打开相应的代码文件;2、在bootstrap中通过给元素添加“display:none;”或“visibility:hidden;”样式来隐藏元素即可。

本教程操作环境:windows7系统,bootstrap3版本,Dell G3电脑。

显示和隐藏DIV的技巧

使用bootstrap的12分栅来演示

隐藏后释放占用的页面空间

document.getElementById("typediv1").style.display="none";//隐藏document.getElementById("typediv1").style.display="";//显示

方法:

<div>              <div>                  <label>{{taskId}}</label>                  <div>                      <input>                  </div>              </div>              <div>                  <label>{{msgId}} </label>                  <div>                      <input>                  </div>              </div>              <div>                  <label>{{createTime}}</label>                  <div>                      <input>                      <span>                          <i></i>                      </span>                  </div>          </div>          <div>              <label>{{to}}</label>              <div>                  <input>                  <span> <i></i>                  </span>              </div>          </div>     </div>
style="visibility:hidden;" 隐藏后不释放空间document.getElementById("typediv1").style.visibility="hidden";//隐藏document.getElementById("typediv1").style.visibility="visible";//显示

代码:

<div>                                <div>                                    <label>{{taskId}}</label>                                    <div>                                        <input>                                    </div>                                </div>                                <div>                                    <label>{{msgId}} </label>                                    <div>                                        <input>                                    </div>                                </div>                                <div>                                    <label>{{createTime}}</label>                                    <div>                                        <input>                                        <span>                                            <i></i>                                        </span>                                    </div>                            </div>                            <div>                                <label>{{to}}</label>                                <div>                                    <input>                                    <span> <i></i>                                    </span>                                </div>                            </div>                       </div>

相关教程推荐:《bootstrap教程》