The following table lists all the supported rich text tags:
Tag | Description | Example |
---|---|---|
<a> |
Define a hyperlink. Use the href attribute to define the hyperlink URL. |
<a href="https://www.unity.com">Visit Unity!</a> |
<align> |
Change the text’s horizontal alignment. The supported values are:
If you put multiple alignment tags on the same line, the last one overrides the others. |
<align="left">Left-aligned</align> |
<allcaps> |
Convert text to uppercase. | <allcaps>Alice and Bob watched TV.</allcaps> |
<alpha> |
Change text opacity. It works with hexadecimal values. | <alpha=#FF>FF <alpha=#CC>CC <alpha=#AA>AA <alpha=#88>88 <alpha=#66>66 <alpha=#44>44 <alpha=#22>22 <alpha=#00>00 |
<b> |
Render text in boldface. | The fox jumps over the <b>lazy dog</b> |
<br> |
Forces a line break in text. | Break the line here <br> New line starts |
<color> |
Change text color or color and opacity. It supports color names and hexadecimal values. If you apply successive tags in the same text, the last one takes precedence over the others until you either add another tag or use a closing tag to end the current color’s scope. | <color="red">Red <color=#005500>Dark Green <#0000FF>Blue <color=#FF000088>Semitransparent Red |
<cspace> |
Change spacing between characters, either absolute or relative to the original font Asset. Use pixels or font units. Positive adjustments push the characters apart, negative adjustments pull them together. | <cspace=1em>Spacing</cspace> is just as important as <cspace=-0.5em>timing. |
<font> |
Change text font. | Would you like <font="Impact SDF">a different font?</font> |
<font-weight> |
Change the text’s font weight to any of the weights defined in the font Asset. If you haven’t defined any font weights, you can still use 400 for normal, 700 for bold. |
<font-weight="100">Thin</font-weight> |
<gradient>
|
Apply a color gradient to text. | <gradient="Light to Dark Green - Vertical">gradient |
<i> |
Render text in italics. | The <i>quick brown fox</i> |
<indent> |
Indent all text between the tag and the next hard line break. Use this tag to create text patterns, such as bullet points, that work with word-wrapping. Specify indentation in pixels, font units, or percentages. | <indent=15%>It is useful for things like bullet points.</indent> |
<line-height> |
Modify the line height relative to the default line height specified in the font Asset. Specify the line height in pixels, font units, or percentages. | <line-height=50%>Line height at 50% |
<line-indent> |
Indent the first line after every hard line break. New lines created by word-wrapping are not indented. | <line-indent=15%>This line is indented. <br>This line is also indented. |
<lowercase> |
Convert text to lowercase. | <lowercase>Alice and Bob watched TV.</lowercase> |
<margin> |
Set the text horizontal margins. If you only want to adjust the left or right margin, you can use the <margin-left> or <margin-right> tag. Specify the margins in pixels, font units, and percentages. Negative values have no effect. |
<margin=5em> |
<mark> |
Highlight the text with a colored overlay. The overlay must be translucent (alpha less than 1) for the text to show through. | Text <mark=#ffff00aa>can be marked with</mark> an overlay. |
<mspace> |
Override a font’s character spacing and turn it into a monospace font. | Any font can become <mspace=2.75em>monospace, if you really want it. |
<nobr> |
Keep a segment of text together. | You don't want <nobr>I M P O R T A N T</nobr> things to be broken up. |
<noparse> |
Prevent parsing of rich text tags. | Use <noparse><b></noparse> for <b>bold</b> text. |
<pos> |
Set the horizontal caret position on the current line. Specify the horizontal position in pixels, font units, or percentages. | at <pos=75%>75% |
<rotate> |
Rotates each character about its center. Specify the amount of rotation in degrees. Positive values rotate characters counter-clockwise. Negative values rotate them clockwise. Rotation affects the spacing between characters, and might cause characters to overlap in some cases. Use the <cspace> tag to correct character spacing as needed. |
Rotate text <rotate="45">counter-clockwise</rotate> |
<s> |
Render a line across the text. | The <s>quick brown</s> fox |
<size> |
Adjusts the font size. Specify the new size in pixels, font units, or percentage. Pixel adjustments can be absolute (such as 5px ) or relative (such as +1 or -1 ). Relative sizes are based on the original font size, so they’re not cumulative. |
<size=100%>Echo <size=80%>Echo <size=60%>Echo <size=40%>Echo <size=20%>Echo |
<smallcaps> |
Convert text to lowercase. | <smallcaps>Alice and Bob watched TV. |
<space> |
Add a horizontal offset between itself and the rest of the text. Specify the offset in pixels or font units. | Give me some <space=5em> space |
<sprite>
|
Add a spriteA 2D graphic objects. If you are used to working in 3D, Sprites are essentially just standard textures but there are special techniques for combining and managing sprite textures for efficiency and convenience during development. More info See in Glossary from a sprite asset into your text. |
<sprite name="spriteName"> |
<style>
|
Apply a custom style to the text. | <style="H1">Styles</style> |
<sub> |
Convert the text to subscript. | We have 1m<sup>3</sup> of H<sub>2</sub>O. |
<sup> |
Convert the text to superscript. | We have 1m<sup>3</sup> of H<sub>2</sub>O. |
<u> |
Underline the text. | <u>The lazy dog</u> |
<uppercase> |
Convert text to uppercase. | <uppercase>Alice and Bob watched TV.</uppercase> |
<voffset> |
Give the baseline a vertical offset. Specify the offset in pixels or font units. The offset is always relative to the original baseline. | Up <voffset=1em>up <voffset=2em>UP</voffset> and <voffset=-0.5em>down</voffset> we go again. |
<width> |
Change the horizontal size of text area. | <width=60%>Those days are long gone</width> |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.
When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change our default settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.
More information
These cookies enable the website to provide enhanced functionality and personalisation. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.
These cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising. Some 3rd party video providers do not allow video views without targeting cookies. If you are experiencing difficulty viewing a video, you will need to set your cookie preferences for targeting to yes if you wish to view videos from these providers. Unity does not control this.
These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.