早上好, 我使用MathJax来显示数学问题。我想在一行中显示两个问题,并使用 span 进行修剪。
p.problems span.third {
width: 33%;
float: left
}

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-MML-AM_CHTML" async></script>
<br><br>Required solution with span on one line<br><br>
<p class="problems"><span class="third">a) \(ax^2 + bx + c = 0\)</span> <span>b) \( x = {-b \pm \sqrt{b^2-4ac} \over 2a} \)</span></p>
<br><br>it should be on one line<br><br>
<p class="problems">a) \(ax^2 + bx + c = 0\) b) \( x = {-b \pm \sqrt{b^2-4ac} \over 2a} \)</p>
&#13;
感谢您的帮助。
答案 0 :(得分:0)
您可以使用display:flex
和align-items: center;
p.problems span.third {
width: 33%;
float: left
}
p.problems {
display: flex;
align-items: center;
}
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-MML-AM_CHTML" async></script>
<br><br>Required solution with span on one line<br><br>
<p class="problems"><span class="third">a) \(ax^2 + bx + c = 0\)</span> <span>b) \( x = {-b \pm \sqrt{b^2-4ac} \over 2a} \)</span></p>