HTML Underlined Text Generator
WM-66Wrap words in __double underscores__ and get HTML that underlines them, with the u element or a span carrying text-decoration.
Runs in your browser. Nothing is uploaded.
Text; wrap underlined parts in __double underscores__. Optional lines: class:, id:, title:
HTML
How to use it
- Type your text and put __ on both sides of each part to underline.
- Choose the u element or a span with an inline text-decoration style.
- Optionally add class:, id: or title: lines.
- Copy the HTML into your page.
What the u element means now
In current HTML, u represents text that carries a non-textual annotation, such as marking a misspelled word or a proper name in Chinese text. It is no longer simply the underline tag. Readers also expect underlined text to be a link, so underlining ordinary words can confuse them. If you only want the look, CSS text-decoration: underline on a span does that without adding meaning, and the tool offers that choice. For emphasis use em or strong, and for edits use ins and del.
How the markers work
Put __ before and after the words to underline. If the text has no markers, each line is wrapped whole. The marker is two underscores, so identifiers such as __init__ are read as a marker and lose the underscores; use the whole-text mode or add the tag by hand for those. Markers stay on one line and do not nest. The other text is escaped, so angle brackets and ampersands show as typed.
Classes and style choices
A class line is added to every generated element, and you can restyle the underline with CSS properties such as text-decoration-style, text-decoration-color and text-underline-offset. The span choice writes an inline style attribute, which you may prefer to move to a stylesheet. Blocks separated by a blank line become p elements. The tool writes only the markup and does not check your spelling or choose what to underline.
Questions people ask
How do I underline text in HTML?
Use CSS: <span style="text-decoration: underline">text</span>, or the u element when the text carries an annotation such as a misspelling. This tool writes either. Prefer the CSS form for plain styling. The u element suits a misspelling mark, so that text carries a clear meaning.
Is the u tag deprecated?
No. It was redefined to mean text with a non-textual annotation, such as a misspelled word. It is still valid, but it is not meant for general styling.
Why should I avoid underlining normal text?
Readers assume underlined text is a link. Underlining other words can mislead them. Use bold, italic or a highlight for emphasis. Links are the one thing most people expect to see underlined, so reserve the underline for links on the page wherever you can.
How do I change the underline colour or style?
Use CSS text-decoration-color and text-decoration-style, plus text-underline-offset to move the line. Add a class line to hook your rule. Those properties apply to any element with an underline, whether it comes from the u element or from a span with text-decoration.
Can I underline just one word in a sentence?
Yes. Put __ on both sides of that word and the rest of the sentence stays plain. Several words on one line each get their own element, and a line with no markers is underlined whole.
About this tool
Wrapping part of a line in __double underscores__ gives a u element, or a span with an inline text-decoration: underline style if you pick that. A line such as __init__ is read as a marker, so use the whole-text mode or other text for literal underscores. With no markers, every line is wrapped. The u element is for text with a non-textual annotation, such as a misspelling mark; it is not for emphasis, and since links are underlined too, readers can mistake it for a link. Use strong, em or mark for meaning. Other text is escaped.