How would you write out a logarithm base 2 in HTML? In other words, what tags would you use for the formatting?
HTML actually provides a tag – called the subscript tag to make the base 2 formatting of a logarithm easy to display (or any other formatting requiring a subscript). Below we show what the HTML would look like if we wanted to write out log base 2 of 1000.
Using the subscript tag for logarithms in HTML
This is how you would write out the log base 2 of 1000 in HTML:
The result of using the <sub> tag:
Success! Pretty easy – although if asked this question in an interview, it’s something you would either know or not know.