代码之家  ›  专栏  ›  技术社区  ›  nam

带有html背景和字体颜色问题的MathJax

  •  0
  • nam  · 技术社区  · 7 年前

    LaTex

    <html>
    <head>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_HTMLorMML">
    </script>
    </head>
    <body>
    A \(\frac{a}{b}\) fraction in inline mode
    <br/>
    A\[\frac{a}{b}\] fraction in display mode
    <br/>
    A <span style='color:white;background:black'>\(\frac{a}{b}\)</span> fraction in inline mode with black background and white font
    <br/>
    A <span style='color:white;background:black'>\[\frac{a}{b}\]</span> fraction in display mode with black background and white font. This one is not displaying fraction.
    
    </body>
    </html>
    

    :

    enter image description here

    1 回复  |  直到 7 年前
        1
  •  0
  •   alex    7 年前

    <span style='color:white;background:black'> <span class='inverted'>

    .inverted .math {
        color: white;
        background-color: black;
    }
    

    你可能还会发现 CSS Style Objects

    编辑:

    <head> 标记如下:

    <head>
      <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_HTMLorMML"></script>
      <style type="text/css">
        .inverted .math {
          color: white;
          background-color: black;
        }
      </style> 
    </head>
    

    我还强烈建议你学习CSS的基础知识(至少), w3schools tutorials 可能真的很有帮助。