使用CSS删除空格 [英] Remove white space using CSS
问题描述
问题和答案周围有自定义的div包装器.结束div在下一行产生空白行.我要删除该行.发表链接 http://fgstudy.com/uncategorized/a/
The question and answers have custom defined div wrappers around them. The closing div is on next line producing a blank line. I want to remove that line. Post Link http://fgstudy.com/uncategorized/a/
我已经尝试了空白CSS代码CSS代码:
I already tried the white-space CSS code CSS Code:
div#q1, div#a1, div#a2 { white-space: normal; }
P { white-space: normal;}
HTML代码:
<hr><div id="q1"><p>Which of the following the highest hydration energy</p>
</div><div id="a1"><p>Mg<sup>++</sup></p>
</div><div id="a2"><p>Li<sup>+</sup></p>
</div><div id="a2"><p>Na<sup>+</sup></p>
</div><div id="a2"><p>K<sup>+</sup></p>
</div>
<hr><div id="q1"><p>Which the correct statement</p>
</div><div id="a1"><p>Na<sup>+</sup>is smaller than Na atom</p>
</div><div id="a2"><p>Cl<sup>-</sup>is smaller than Cl atom</p>
</div><div id="a2"><p>Cl<sup>-</sup>(Ion) and Cl (atom) are equal in size</p>
</div><div id="a2"><p>Na<sup>+</sup>is larger than Na atom</p>
</div>
CSS代码:
body {margin: 2% 2%; }
#q1 {margin: 10px 10px; border: 1px; box-shadow: 0px 2px 2px 2px #DCDCDC; text-align: left; padding: 5px 20px; font-size: 18px; color: #ffffff; background-color: #317eac;}
#a1 {margin: 10px 10px; border: 1px; padding: 10px; box-shadow: 0px 2px 2px 2px #DCDCDC; text-align: left;font-size: 16px; padding: 8px 18px;}
#a2 {margin: 10px 10px; border: 1px; box-shadow: 0px 2px 2px 2px #DCDCDC; text-align: left; padding: 5px 18px; font-size: 16px;}
#a1:hover{color: #ffffff; background-color: #73AD21;}
#a2:hover{color: #ffffff; background-color: #C71C22;}
我想要文本消失后的空白.谁能帮我吗?
I want the white space after text disappears. Can anyone helps me?
推荐答案
每个 div
内的段落似乎都设置了 margin-bottom
属性.
It looks like the paragraph inside each div
has a margin-bottom
property set.
类似 .entry-content p {margin-bottom:0;}
摆脱它,或更具体地说: .entry-content>div p {margin-bottom:0;}
Something like .entry-content p { margin-bottom: 0; }
will get rid of it, or to be more specific: .entry-content > div p { margin-bottom: 0; }
这篇关于使用CSS删除空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!