隐藏布局但在页面中保留文字?

时间:2013-04-26 03:34:11

标签: javascript html css

假设我有像这样的HTML

<span class='hide'>
   nothing to comment please be good to each other
</span>

.hide{
   /*visibility:hidden;*/
   display:none;
   width:100px;
   height:auto;
}

如果我使用display:none or visibility:hidden这样的css,它隐藏所有(布局和文本)我想保留文本并仅隐藏布局。有没有办法存档这个案子?真诚地感谢您的亲切帮助......

1 个答案:

答案 0 :(得分:-2)

只需使用toggleClass并创建一个裸露的类,以及一个具有所需布局的类

<span class='hide' id='comment'>
   nothing to comment please be good to each other
</span>


$("#comment").toggleClass("oldClass newClass");

.oldClass {
  <!--bare formatting-->
}

.newClass{
  <!--fancy formatting-->
}
相关问题