0

How can I format a typical Input with type="button" to display content text having a subscript format?

Example: O2

Hitesh Sahu
  • 41,955
  • 17
  • 205
  • 154
Alan Hord
  • 71
  • 1
  • 4

2 Answers2

1

See this fiddle

You can use HTML <sub> to insert subscript. See the below given HTML

HTML

<button type="button">
  O<sub>2</sub>
</button>

Read more about <sub> in the docs

Lal
  • 14,726
  • 4
  • 45
  • 70
1

For that particular example you could just use Unicode code point U+2082:

    <input type="button" value="O₂">

… but in the general case the solution is stop using an input. HTML 4 introduced the <button> element to replace the submit, button and reset types.

<button> has two main advantages:

  • The value and display content can be different
  • The display content can include markup

<button type="button"> O<sub>2</sub> </button>
Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • Thank you @Lal & Quentin. I spent the afternoon exploring all sorts of options and did indeed move to using – Alan Hord Jul 09 '16 at 02:15