Centering an equation in a paragraph

Abstract

Dr. John Stockton wanted to write paragraphs in HTML that contained one or more centred equations. It had to be acceptable to validators and testers, and work in IE4.

Example

This is a paragraph of waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle here comes an equation: A = B + C and the waffles continues waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle waffle until the end.

Code

(X)HTML

<p>…<span class="equation">A = B + C</span>…</p>

CSS

span.equation {
display: block;
text-align: center;
}

Conclusion

Well it validates; as for working in IE4, then it should, as both display and text-align are both supported. However, practically it apparently doesn’t. More investigation needed.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Twitter Users!
Sign in with your Twitter account by clicking the button below.