代码: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>
在第一个示例中,我看到$$
文本漂浮在第二段旁边。但是,我希望它浮动在第一段旁边。如何才能做到这一点?