Go Back   SitePoint Forums > Forum Index > FAQ
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

BB Code
BB code is a set of tags based on the HTML language that you may already be familiar with. They allow you to add formatting to your messages in the same way as HTML does, but have a simpler syntax and will never break the layout of the pages you are viewing. The ability to use BB code is set on a forum-by-forum basis by the administrator, so you should check the forum rules when you post a new message.

Below is a list of the BB code tags you can use to format your messages.
BB Code List
[b], [i], [u] Bold / Italic / Underline
[color] Color
[size] Size
[font] Font
[highlight] Highlight
[left], [right], [center] Left / Right / Center
[indent] Indent
[email] Email Linking
[url] URL Hyperlinking
[thread] Thread Linking
[post] Post Linking
[list] Bulleted Lists / Advanced Lists
[img] Images
[code] Code
[php] PHP Code
[html] HTML Code
[quote] Quote
[noparse] Stop BB Code Parsing
[attach] Attachment
[aname] Named anchor link
[article] Article
[center] Center
[edit] Edit
[fphp] PHP Function
[fphp] PHP Function with option
[google] Google Search
[jumpto] Anchor Link
[left] Left
[ot] Off Topic
[right] Right
[rule] Rule
[s] Strikethrough
[samp] Sample Code
[small] Small
[spoiler] Spoiler
Incorrect BB Code Usage:
  • [url] www.example.com [/url] - don't put spaces between the bracketed code and the text you are applying the code to.
  • [email]myname@domain.com[email] - the end brackets must include a forward slash ([/email])

Bold / Italic / Underline
The [b], [i] and [u] tags allow you to create text that is bold, italic and underlined.
Usage [b]value[/b]
[i]value[/i]
[u]value[/u]
Example Usage [b]this text is bold[/b]
[i]this text is italic[/i]
[u]this text is underlined[/u]
Example Output this text is bold
this text is italic
this text is underlined

Color
The [color] tag allows you to change the color of your text.
Usage [color=Option]value[/color]
Example Usage [color=blue]this text is blue[/color]
Example Output this text is blue

Size
The [size] tag allows you to change the size of your text.
Usage [size=Option]value[/size]
Example Usage [size=+2]this text is two sizes larger than normal[/size]
Example Output this text is two sizes larger than normal

Font
The [font] tag allows you to change the font of your text.
Usage [font=Option]value[/font]
Example Usage [font=courier]this text is in the courier font[/font]
Example Output this text is in the courier font

Highlight
The [highlight] tag allows you to emphasize your text.
Usage [highlight]value[/highlight]
Example Usage [highlight]this text is highlighted[/highlight]
Example Output this text is highlighted

Left / Right / Center
The [left], [right] and [center] tags allow you to change the alignment of your text.
Usage [left]value[/left]
[center]value[/center]
[right]value[/right]
Example Usage [left]this text is left-aligned[/left]
[center]this text is center-aligned[/center]
[right]this text is right-aligned[/right]
Example Output
this text is left-aligned
this text is center-aligned
this text is right-aligned

Indent
The [indent] tag allows you to indent your text.
Usage [indent]value[/indent]
Example Usage [indent]this text is indented[/indent]
Example Output
this text is indented

Email Linking
The [email] tag allows you to link to an email address. You can include an optional parameter to 'name' your link.
Usage [email]value[/email]
[email=Option]value[/email]
Example Usage [email]j.doe@example.com[/email]
[email=j.doe@example.com]Click Here to Email Me[/email]
Example Output j.doe@example.com
Click Here to Email Me

URL Hyperlinking
The [url] tag allows you to link to other websites and files. You can include an optional parameter to 'name' your link.
Usage [url]value[/url]
[url=Option]value[/url]
Example Usage [url]http://www.sitepoint.com/forums[/url]
[url=http://www.sitepoint.com/forums]SitePoint Forums[/url]
Example Output http://www.sitepoint.com/forums
SitePoint Forums

Thread Linking
The [thread] tag allows you to link to threads by specifying the thread id. You can include an optional parameter to 'name' your link.
Usage [thread]threadid[/thread]
[thread=threadid]value[/thread]
Example Usage [thread]42918[/thread]
[thread=42918]Click Me![/thread]
(Note: The threadid/postid is just an example and may not link to a valid thread/post.)
Example Output http://www.sitepoint.com/forums/showthread.php?t=42918
Click Me!

Post Linking
The [post] tag allows you to link to posts by specifying the post id. You can include an optional parameter to 'name' your link.
Usage [post]postid[/post]
[post=postid]value[/post]
Example Usage [post]269302[/post]
[post=269302]Click Me![/post]
(Note: The threadid/postid is just an example and may not link to a valid thread/post.)
Example Output http://www.sitepoint.com/forums/showthread.php?p=269302#post269302
Click Me!

Bulleted Lists
The [list] tag allows you to create simple, bulleted lists without specifying an option. Within the value portion, each bullet is denoted by the [*] tag.
Usage [list]value[/list]
Example Usage [list]
[*]list item 1
[*]list item 2
[/list]
Example Output
  • list item 1
  • list item 2

Advanced Lists
The [list] tag allows you to create advanced lists by specifying an option. The option should have a value of 1 (for a numbered list) or A (for an alphabetic with capital letters list) or a (for an alphabetic with lowercase letters list) or I (for a numbered with capital Roman numeral list) or i (for a numbered with small Roman numeral list).
Usage [list=Option]value[/list]
Example Usage [list=1]
[*]list item 1
[*]list item 2
[/list]

[list=a]
[*]list item 1
[*]list item 2
[/list]
Example Output
  1. list item 1
  2. list item 2
  1. list item 1
  2. list item 2

Images
The [img] tag allows you to embed images within your posts. You can also combine this tag with the [url] tag to make images become links.
Usage [img]value[/img]
Example Usage [img]http://sitepointstatic.com/forums/images/statusicon/forum_new.gif[/img] (Not linked)

[url=http://www.example.com] [img]http://sitepointstatic.com/forums/images/statusicon/forum_new.gif[/img] [/url] (Linked)
Example Output (Not linked)

(Linked)

Code
The [code] tag switches to a fixed-width (monospace) font and preserves all spacing.
Usage [code]value[/code]
Example Usage [code]
<script type="text/javascript">
<!--
    alert("Hello world!");
//-->
</script>
[/code]
Example Output
Code:
<script type="text/javascript">
<!--
	alert("Hello world!");
//-->
</script>

PHP Code
The [php] tag performs the same function as the [code] tag, but also adds syntax highlighting for PHP code. Although it is designed for PHP, it may correctly highlight some other C-like languages.
Usage [php]value[/php]
Example Usage [php]
$myvar = 'Hello World!';
for ($i = 0; $i < 10; $i++)
{
    echo $myvar . "\n";
}
[/php]
Example Output
PHP Code:

$myvar = 'Hello World!';
for (
$i = 0; $i < 10; $i++)
{
    echo
$myvar . "\n";
}

HTML Code
The [html] tag allows you to perform syntax highlighting for HTML code.
Usage [html]value[/html]
Example Usage [html]
<img src="image.gif" alt="image" />
<a href="testing.html" target="_blank">Testing</a>
[/html]
Example Output
HTML Code:
<img src="image.gif" alt="image" />
<a href="testing.html" target="_blank">Testing</a>

Quote
The [quote] tag allows you to attribute text to someone else.
Usage [quote]Quote[/quote]
[quote=User Name]value[/quote]
Example Usage [quote]Lorem ipsum dolor sit amet[/quote]
[quote=John Doe]Lorem ipsum dolor sit amet[/quote]
[quote=John Doe;4439826]Lorem ipsum dolor sit amet[/quote]
Example Output
Quote:
Lorem ipsum dolor sit amet
Quote:
Originally Posted by John Doe
Lorem ipsum dolor sit amet
Quote:
Originally Posted by John Doe View Post
Lorem ipsum dolor sit amet

Stop BB Code Parsing
The [noparse] tag allows you to stop the parsing of BB code.
Usage [noparse][b]value[/b][/noparse]
Example Usage [noparse][b]Lorem ipsum dolor sit amet[/b][/noparse]
Example Output [b]Lorem ipsum dolor sit amet[/b]

Attachment
The [attach] tag allows you to display an attachment in your post rather than at the bottom. It will only display attachments that belong to the post in which it is utilized.
Usage [attach]attachmentid[/attach]
Example Usage [attach]12345[/attach]
Example Output

Named anchor link
The [aname] tag is used in conjunction with the [jumpto] tag. One is not functional without the other.
Usage [aname=Option]value[/aname]
Example Usage [aname=aname]This is where you jump to[/aname]
Example Output This is where you jump to

Article
Create a quick link to an article in the SitePoint library.
Usage [article=Option]value[/article]
Example Usage [article=228]Kevin's PHP Tutorial[/article]
Example Output Kevin's PHP Tutorial

Center
Use this to center your text.
Usage [center]value[/center]
Example Usage [center]Centered Text[/center]
Example Output
Centered Text

Edit
If you have edited your post and you want to show what has been edited, use [edit] and [/edit]. Use of this is voluntary - it can be used in any way desired.
Usage [edit]value[/edit]
Example Usage [edit]This is edited text[/edit]
Example Output
Edit:

This is edited text

PHP Function
Shows the corresponding page for the PHP function in the online PHP manual.
Usage [fphp]value[/fphp]
Example Usage [fphp]date[/fphp]
Example Output date

PHP Function with option
PHP Function with the optional option.
Usage [fphp=Option]value[/fphp]
Example Usage [fphp=date]this is the date() function[/fphp]
Example Output this is the date() function

Google Search
Easily link to a Google search term. This is equivalent to: SitePoint
Usage [google]value[/google]
Example Usage [google]sitepoint[/google]
Example Output sitepoint

Anchor Link
The [jumpto] tag allows you to jump to another location within a post, usually used for long posts with headings and/or sections of interest. This tag must be used in conjunction with the [aname] tag. One is not functional without the other.
Usage [jumpto=Option]value[/jumpto]
Example Usage [jumpto=aname]This takes you to a new location within a post[/jumpto]
Example Output This takes you to a new location within a post

Left
Use this code to align your paragraphs to the left.
Usage [left]value[/left]
Example Usage [left]Left Aligned Text[/left]
Example Output
Left Aligned Text

Off Topic
You can use the [ot] and [/ot] tags when discussing something off-topic. Off-topic banter in a thread should be avoided, and a new thread should be created as soon as possible. If you want to briefly mention something which is off-topic, this can be used.
Usage [ot]value[/ot]
Example Usage [ot]I am discussing something off-topic[/ot]
Example Output
Off Topic:

I am discussing something off-topic

Right
Use this to align your text to the right.
Usage [right]value[/right]
Example Usage [right]Right Aligned Text[/right]
Example Output
Right Aligned Text

Rule
Places a Horizontal Rule in your message. You can specify color and width. [rule=width]color[/rule]
Usage [rule=Option]value[/rule]
Example Usage [rule=60%]Navy[/rule]
Example Output

Strikethrough
Allows you to strike through text in a post so you can emphasis its deletions without removing it from the message entirely.
Usage [s]value[/s]
Example Usage [s]Strikethrough[/s]
Example Output Strikethrough

Sample Code
The [samp] tag is an inline tag for denoting sample code.
Usage [samp]value[/samp]
Example Usage [samp]arr = new array([3,6,8]);[/samp]
Example Output arr = new array([3,6,8]);

Small
You can make small text by using this tag.
Usage [small]value[/small]
Example Usage [small]This is small text[/small]
Example Output This is small text

Spoiler
Use the [spoiler] code to create hidden text. When viewed in the forums, the text will be invisible until it is highlighted with the mouse. Useful for spoilers in movies.
Usage [spoiler]value[/spoiler]
Example Usage [spoiler]This text will be hidden[/spoiler]
Example Output This text will be hidden


All times are GMT -7. The time now is 10:40.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved