如何在HTML中编写求和表达式?

Gri*_*han 12 html html5 web

How to write equivalent HTML expression for following Latex:

$$\sum_{k=1}^Nk(N-k+1)  
Run Code Online (Sandbox Code Playgroud)

The image is:

在此输入图像描述

I did like this:

? <sub>k=1</sub> <sup>N</sup>  
Run Code Online (Sandbox Code Playgroud)

but output is like this

k=1 N

I am not good at HTML and I searched on web but couldn't find answer. Please help on this..Thanks!

Zol*_*oth 15

如果您需要在项目中使用很多东西,那么您可能会发现MathJax非常有用.否则,如果您只需要这个公式,那么试试这个 - DEMO

<p>
    <span>&Sigma;</span>
    k ( N - k + 1 )
</p>?
Run Code Online (Sandbox Code Playgroud)

CSS

p {
    height: 50px;
    line-height: 50px;
}

span {
    position: relative;
    font-size: 2.5em;
    display: inline-block;
    line-height: .7em;
    vertical-align: middle;
}

span:before {
    font-size: 12px;
    display: block;
    position absolute;
    left: 0;
    top: 0;
    content: "N";
    width: 22px;
    text-align: center;
}

span:after {
    font-size: 12px;
    display: block;
    position absolute;
    left: 0;
    bottom: 0;
    content: "k = 1";
    width: 27px;
    text-align: center;
}
?
Run Code Online (Sandbox Code Playgroud)