Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inline pre formatting?

Tags:

html

wordpress

This should be easy points as I forgot how and can't find it on Google.

How do I accomplish something like this:

Blah Blah Blah some code Blah Blah

in wordpress? pre doesn't work as it will give a line break.

like image 608
Pwnna Avatar asked May 09 '11 23:05

Pwnna


People also ask

What is pre formatting in HTML?

<pre>: The Preformatted Text element. The <pre> HTML element represents preformatted text which is to be presented exactly as written in the HTML file. The text is typically rendered using a non-proportional, or monospaced, font. Whitespace inside this element is displayed as written.

Is pre inline tag?

HTML pre element is an inline element.

What does inline mean in design?

Inline links are a design pattern that uses hyperlinked words—conventionally blue, underlined words—to guide users to another page containing related information. Designers employ inline links so that the information linked from the highlighted words does not clutter the user's current webpage.

What does pre formatting a text do?

The <pre> tag defines preformatted text. Text in a <pre> element is displayed in a fixed-width font, and the text preserves both spaces and line breaks. The text will be displayed exactly as written in the HTML source code.


2 Answers

It may be better to use <code> than <pre> to display inline code, for two reasons:

  • it's treated as inline
  • the semantics of <code> are a much better match than <pre>

But definitely use CSS classes (as @Blender points out).

There's a caveat: <code> doesn't escape <> brackets, so if you want to display HTML then you have to manually escape brackets as &lt; and &gt;. (which you should really do anyway; tags in HTML really should be clearly distinguished from data)

like image 163
Jason S Avatar answered Oct 04 '22 12:10

Jason S


<tt>text</tt> gives text

Wait... Wordpress? What HTML tags does it support?

like image 37
jwodder Avatar answered Oct 04 '22 13:10

jwodder