本文介绍了为什么text-decoration:none不能在p中工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下的HTML和CSS片段,我想要!不要强调,但它是。我做错了什么?



p {color:red;文字修饰:下划线; font-size:1.2em;} span.none {text-decoration:none;}
 < p class =p>按一下< span class =none>!< / span>< / p>             to  span.none class  



  p {color:red;文字修饰:下划线; font-size:1.2em;} span.none {text-decoration:none; display:inline-block;}  
< p class = p>按一下< span class =none>!< / span>< / p>


I have the following HTML and CSS snippet and I want the "!" not to be underlined, but it is. What am I doing wrong?

p {
  color:red;
  text-decoration:
    underline;
  font-size: 1.2em;
}

span.none {
  text-decoration: none;
}
<p class="p">Click the thumb<span class="none">!</span></p>

解决方案

add display:inline-block; to span.none class

p {
  color:red;
  text-decoration:
    underline;
  font-size: 1.2em;
}

span.none {
  text-decoration: none;
  display:inline-block;
}
<p class="p">Click the thumb<span class="none">!</span></p>

这篇关于为什么text-decoration:none不能在p中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 06:27