我的HTML代码是:
<p> Marium, Sameen and Mubashir are not working. ok </p> <p> THIS IS NEW LINE </p> This is result 2 <p> Marium, Sameen and Mubashir are not working. <span class=ins>ok </p> <p> THIS IS NEW LINE</span> </p>
我的CSS是:
span.ins { color: green; display:inline;}
span.del { color:red; text-decoration:line-through; display:inline;}
它为下一个<p>
标记之前的部分着色。那没问题”。但它没有上色“这是新线”。
它有什么解决方案?我不能使用div,因为它改变了行本身。我不想改变这条线。
答案 0 :(得分:2)
您的html无效使用HTML snippet
的HTML结构后,您的css将起作用:
span.ins { color: green; display:inline;}
span.del { color:red; text-decoration:line-through; display:inline;}
&#13;
<p> Marium, Sameen and Mubashir are not working. ok </p>
<p> THIS IS NEW LINE </p> This is result 2
<p> Marium, Sameen and Mubashir are not working.</p>
<p><span class=ins>ok THIS IS NEW LINE</span></p>
&#13;
答案 1 :(得分:1)
正确的HTML是:
span.ins {
color: green;
display: inline;
}
span.del {
color: red;
text-decoration: line-through;
display: inline;
}
<p>Marium, Sameen and Mubashir are not working. ok</p>
<p>THIS IS NEW LINE</p>
This is result 2
<p>Marium, Sameen and Mubashir are not working. <span class="ins">ok </span>
</p>
<p><span class="ins">THIS IS NEW LINE</span>
</p>
答案 2 :(得分:0)
你的CSS没有任何错误,但HTML有轻微变化。
而不是
<span class=ins>ok </p> <p> THIS IS NEW LINE</span></p>
待办事项
</p><span class=ins>ok <p> THIS IS NEW LINE </p></span>
有完整的代码
<p> Marium, Sameen and Mubashir are not working. ok </p>
<p> THIS IS NEW LINE </p> This is result 2
<p> Marium, Sameen and Mubashir are not working.</p>
<span class=ins>ok
<p> THIS IS NEW LINE </p></span>