FAQ Question #72
» How do I alter the appearance of my text? How do I make text bold, italic or centered?
HTML, or HyperText Markup Language, is a standardized language for presenting information in a browser. A web server sends text to your browser in response to a request (clicking on a link or entering an address in your browser), and your browser then interprets the HTML markup in that document, presenting it in a human-readable form with links, images, and text embellishments.
A basic HTML tag will look something like the following:
The angle brackets (< and >) tell your browser that the thing between them is HTML; the tag name, inside the angle brackets, tells your browser what the tag is supposed to do. In many cases, it is necessary to also have a closing tag:
This tells your browser to stop doing the effect that the opening tag instructed it to do. A large number of HTML tags instruct your browser to apply a certain effect -- such as bold, italics, underlining, color, or font size -- to the text between the opening tag and the closing tag.
There are a small number of tags that do not need a closing tag; one example of this is the <img> tag, which inserts an image into the document. These tags generally insert an object, rather than applying to the following text. Tags which do not need a closing tag can be indicated by inserting a slash before the last angle bracket:
More complex HTML tags include pairs of attributes and values, which define various aspects of the tag. (For example, the different attributes of a <font> tag can specify size, color, font face, and so on.) These pairs will always be of the form attribute="value", there are spaces between the tag name and the attribute="value" pairs, and between different pairs:
<tag attribute1="value1" attribute2="value2">
When you have a tag with attribute="value" pairs, the closing tag will still only contain the tag name; it will not contain any of the attributes:
<tag attribute1="value1">text being affected</tag>
HTML ON LIVEJOURNAL
You can use any of the following HTML tags, and some others that are not included here, within a LiveJournal entry:
<a> <b> <big> <blockquote> <br> <center> <cite> <code> <dd> <div> <dl> <dt> <em> <font> <form> <h1> <h2> <h3> <hr> <i> <img> <input> <li> <marquee> <nobr> <ol> <option> <p> <pre> <s> <select> <small> <span> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul> <xmp>
Comments allow all of the tags shown above except form tags such as <form> and <input>. The subjects of journal entries, as well as the current mood/music fields, allow only the tags <a> <b> <i> <u> <em> <strong> <cite>.
Neither entries nor comments allow scripts, applets, or objects.
There are many useful tags there that can bring your text to life, but we're only going to cover a few of the basics here. If you want to learn more about these tags, you can search for a HTML tutorial using your favorite search engine.
There are also a small number of LiveJournal-specific tags, which are not standard HTML. These tags will only work on LiveJournal; however, they follow the same format as standard HTML (consisting of either <tag> or <tag attribute="value">.)
LiveJournal uses an HTML cleaner on all entries, comments, and journal styles, which looks for invalid or harmful HTML. If there is a problem with your HTML (for example, if you type <tag="value"> instead of <tag attribute="value">), you will receive an error, and will need to find and fix the problem in your HTML code.
COMMON TEXT EFFECTS
There are many useful tags there that can bring your text to life, but we're only going to cover a few of the basics here. If you want to learn more about these tags, or other HTML tags not covered here, you can search for a HTML tutorial using your favorite search engine.
* Bold: To make text bold, surround it with <b> and </b> tags. You can place as much text between the beginning <b> and ending </b> tags as you want, and all of it will be bold, even if there are spaces and punctuation included.
* Italics: To italicize text, surround it with <i> and </i> tags. As with the bold tag, you can place as much text between the <i> and </i> tags as you want.
* Underline: To underline text, surround it with <u> and </u> tags. Again, you can place as much text between these tags as you want, and it will all appear with an underline.
* Center: To center a line of text, use <center> and </center>. These tags work very much like the tags described above, but you must start the text you would like to center on a separate line.
* Marquee: To have a segment of text appear to scroll across the screen, use <marquee> and </marquee>. This tag will only work correctly on Internet Explorer; it can even break some browsers, so you should use the LiveJournal-specific <lj-cut> tag to hide text that you are applying the marquee tag to.
* Pre-formatted text: HTML treats multiple spaces as a single space, to allow formatting in the source code that doesn't need to apply to the page you see in the browser. Because of this, if you type multiple spaces into one part of an entry, it will appear as though you had only typed one. Enclosing text in <pre> and </pre> tags will tell the browser to display it as it was entered, including multiple spaces
It is possible to apply multiple HTML tags to the same text: <b><i><u>This text</u></i></b> will appear simultaneously bold, italic, and underlined. When you do this, the closing tags should be in reverse order to the opening tags, so that the first closing tag applies to the last opening tag, and so on.
There is a Preview button available for both entries and comments, so if you choose to use HTML, you can use this to preview your work as it would appear when someone views it.
Once you preview your entry or comment, you can either submit it as-is, or you can edit it in the box provided.
RICH TEXT EDITOR
LiveJournal provides a Rich Text editor, which allows you to use many of the features of HTML, without entering the code manually. If you enter HTML code in the Rich Text Editor, it will appear as the code itself; <b> will appear in your entry as <b>, and will not make the following text bold. The Rich Text editor is only available when composing a new entry; it is not available for editing existing entries or for writing comments.
USING A DOWNLOADABLE CLIENT
Most clients available for download include the ability to add markup to your text, and some allow you to preview that markup before you post it. Some clients also have WYSIWYG editors, similar to LiveJournal's Rich Text interface, which can allow you to format your entry without entering the code manually. For more information on your preferred client, consult its documentation or its menu options.
Change the Size, Color, and Font of Certain Words (Using Font and Span)
How do I update my journal using the Rich Text editor?
How do I add a link to another journal or another web site in my entry?
How do I add images to my journal entries or user bio?
What is a downloadable client? Where can I get one?
How do I use an lj-cut? What are the other LiveJournal-specific tags?
Why am I getting an "irreparable invalid markup in entry" error?
Why does my journal or Friends page suddenly display incorrectly or require me to scroll?