html - 使用 MathJax\[\] 数学, float 元素随下一段而不是当前段落一起 float

标签 html css css-float mathjax

代码:http://jsfiddle.net/tRRtY/

<!DOCTYPE HTML>
<html>
<head>
<title>$$ float</title>
<script
type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default">
</script>
<style type="text/css">
p {
    background: lightblue;
}

span.dollar {
    float: right;
    background: maroon;
    color: white;
}
</style>
</head>
<body>

<h1>Example 1</h1>
<p class="math">
\[
(a + b)^2 = a^2 + 2ab + b^2
\]
<span class="dollar">$$</span>
</p>
<p>Foo</p>

<h1>Example 2</h1>
<p class="math">
\(
(a + b)^2 = a^2 + 2ab + b^2
\)
<span class="dollar">$$</span>
<p>Foo</p>

</body>
</html>

在第一个示例中,我看到 $$ 文本 float 在第二段旁边。但是,我希望它 float 在第一段旁边。如何做到这一点?

最佳答案

另一种解决方案是使用内联 MathJax 命令。

例子:

有了方括号,方程式将出现在一个新行中:

\\[ frac{1}{2} \\]

但是如果你使用括号那么你的等式将在同一行:

\\( frac{3}{4} \\)

关于html - 使用 MathJax\[\] 数学, float 元素随下一段而不是当前段落一起 float ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9320311/

相关文章:

html - 在图像顶部显示溢出的 div

html - CSS 位置 :relative div problem

css - firefox 和 opera 是否通过 javascript 支持 zIndex 样式属性

HTML CSS 悬停问题

css - 定位div[CSS/HTML]

PHP PDO 从数据库中选择并显示在特定的 div 中

javascript - ESC 键关闭弹出窗体

html - 如何使文本在较小的 div 下方开始?

javascript - HTML5 : how to load an image onClick in a specific place

jquery - 无法覆盖外部文件的溢出 CSS 属性