html中使用mathjax数学公式
测试用例:
test.html:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="./test.css" />
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});
</script>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
</head>
<body>
<div id="header"><h1>备战NOIP普及组专用网站</h1></div>
<div id="nav">
<a href="/chusai">初赛知识</a><br>
<a href="/fusai">复赛知识</a><br>
<br>
</div>
<div id="section">
<h1>公告</h1><br/>
<p>这个网站对持续更新到今年11月份。</p>
<p>希望能帮助大家在今年NOIP普及组取得好的成绩。</p>
<p>When $a \ne 0$, there are two solutions to \(ax^2 + bx + c = 0\) and they are
$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$</p>
</div>
<div id="footer">copyright zifeiy</div>
</body>
</html>
测试css文件:test.css:
<style>
#header {
background-color:black;
color:white;
text-align:center;
padding:5px;
}
#nav {
line-height:30px;
background-color:#eeeeee;
height:300px;
width:80px;
float:left;
padding:5px;
}
#section {
width:80%;
float:left;
padding:10px;
line-height: 5px;
}
#footer {
background-color:black;
color:white;
clear:both;
text-align:center;
padding:5px;
}
</style>