首页 > 解决方案 > 为什么按钮不显示回来?

问题描述

我有一个模态按钮,我隐藏它然后我想显示它。按钮不出现。怎么表现?

button {
  display: none;
}

@media screen and (max-width: 599px) {
  display: block;
}
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenter"> Modal
</button>

标签: htmlcss

解决方案


检查您的媒体查询代码 注意:-您的按钮将根据您的代码显示在视口 559px

button{display:none;}
@media screen and (max-width:599px){
button{display:block;} /*issue exits here*/
}
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenter">
  Modal
</button>


推荐阅读