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>
posted @   zifeiy  阅读(2749)  评论(1编辑  收藏  举报
编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
历史上的今天:
2018-07-20 Java连接阿里云HBase示例
2018-07-20 Maven项目添加阿里云HBase依赖之后第一行才出现红叉报错“Missing artifact jdk.tools:jdk.tools:jar:1.6”的解决办法
点击右上角即可分享
微信分享提示