Advanced Tutorial on Adding CSS to Messages
Other tutorials on enhancing messages:
Images |
HTML (advanced)
In addition to the allowed
HTML tags that we allow at CaneTalk, which we discuss
here, we also allow customization through inline CSS. (Cascading Style Sheets) Inline CSS can be added using the
style attribute on HTML tags. If you are familiar with CSS, you know that CSS styling can also be used from an external file and also includes CSS selectors to select various elements. To control the kind of CSS we allow, we don't allow that kind of CSS usage, only inline CSS. Only styling in the exact format that we allow can be used. You can test styling when you preview your message to see if you can use the styling you want to use. If you have a specific styling you would like to use that isn't allowed, please
contact the webmaster to see if it can be added.
We have listed the various CSS properties that we allow below. For a complete listing of CSS properties, including ones we don't allow, visit:
W3Schools |
MozillaSome formatting is specific to certain HTML tags. Additionally, the values we allow for certain properties are specific to our forum. Because our site is designed to be mobile friendly, certain values are not allowed. Other values might disrupt the layout of the message page.
In dark mode for our forum, various CSS properties will be overridden to help ensure content is legible. This will include resetting the font color to a grayish color and removing background color from elements. You cannot control these changes.
While not noted, any property in which you can use the unit "em", you can also use the unit "rem".
Table of Contents:
Colors
You can choose the color of text, backgrounds and borders.
The easiest way to select a color is to use the name of the color. There are 140 color names that can be used. You can find a list of them
here. We also support the value "transparent" to be used in most places you can use colors, other than for text color ("color") and "text-shadow".
The second easiest way to choose a color is to get its hex (hexadecimal) code. This is usually a 6 character code. For some codes, they can be shortened to 3 characters. We also support 8 character codes, which include an alpha channel for opacity, though it is easier to use RGBA and HSLA, mentioned in the next paragraphs, if using that. We support all three types. To choose a color you want, you can use a color picker such as the one
here at Google to find the color's hex code.
In addition to supporting color names and hex codes, we also support the
RGB,
RGBA,
HSL and
HSLA formats when using commas to separate values. You can find additional color pickers for
HEX codes, the
RGB format and the
HSL format by clicking each of those links. For the RGB and RGBA formats, we allow either integers or a percent.
The benefit of using RGBA or HSLA is that you can easily set an alpha value that lets you control the opacity. This is a value from 0 to 1 where 0 is invisible and 1 is fully visible. A value of 0.5 would be half transparent. We allow you to choose an alpha value to two decimal places. Using these for opacity is easier than using a hex code with an alpha channel. These are from 0 to 1, the other kind is from "00" to "ff".
All of the following are allowed values for the color green:
- green
- #008000
- #008000ff
- rgb(0, 128, 0)
- rgb(0%, 50%, 0%)
- rgba(0, 128, 0, 1)
- rgba(0%, 50%, 0%, 1)
- hsl(120, 100%, 25%)
- hsla(120, 100%, 25%, 1)
The previous list had all the exact same color of green. The following is a slightly different color of green, but is also allowed:
Example 1:
Code:
<span style="color: green;">Text</span>
Result:
Text
Example 2, with an alpha value of "0.5":
Code:
<span style="color: rgba(0, 128, 0, 0.5);">Text</span>
Result:
Text
Example 3, using different colors for text, background and border:
Code:
<div style="color: blue; background-color: rgba(0, 128, 0, 0.2); border: 1px solid #000; padding: 10px;">
The quick brown fox jumps over the lazy dog.
</div>
Result:
The quick brown fox jumps over the lazy dog.
Basic Text Formatting
color
More Info:
W3Schools |
MozillaThis allows you to set the color of text.
Please see the
color section for examples.
font
More Info:
W3Schools |
MozillaThis is a shorthand property that allows you to set various font properties at once. When setting this shorthand property, "font-size" and "font-family" are required. The font properties must be in order if setting them in this shorthand property.
The order is:
You can learn more about these in the sections that follow.
Example 1:
Code:
<span style="font: 18px 'Times New Roman', serif;">The quick brown fox jumps over the lazy dog.</span>
Result:
The quick brown fox jumps over the lazy dog.
Example 2:
Code:
<span style="font: italic small-caps bold 16px/20px Verdana, serif;">The quick brown fox jumps over the lazy dog.</span>
Result:
The quick brown fox jumps over the lazy dog.
font-style
More Info:
W3Schools |
MozillaThis font property allows you to slant text slightly to the right.
Allowed values:
Example:
Code:
<span style="font-style: italic;">Text</span>
Result:
Text
font-variant
More Info:
W3Schools |
MozillaThis font property allows you to slant text slightly to the right.
Allowed values:
- normal (default)
- small-caps
Example:
Code:
<span style="font-variant: small-caps;">Text</span>
Result:
Text
font-weight
More Info:
W3Schools |
MozillaThis font property allows you to make text thicker. Because some fonts don't do as well displaying text that doesn't have either a value of "normal" or "bold", we do not allow a numerical value other than what equates to either of those.
Allowed values:
- normal (default)
- bold
- 400 (equivalent to "normal")
- 700 (equivalent to "bold")
Example 1:
Code:
<span style="font-weight: bold;">Text</span>
Result:
Text
Example 2:
Code:
<div style="font-family: 'Segoe UI', sans-serif;">
<span style="font-weight: normal;">Text. (normal)</span>
<span style="font-weight: 400;">Text. (400)</span>
<span style="font-weight: bold;">Text. (bold)</span>
<span style="font-weight: 700;">Text. (700)</span>
</div>
Result:
Text. (normal)
Text. (400)
Text. (bold)
Text. (700)
font-size
More Info:
W3Schools |
MozillaThis font property allows you to set the size of text.
You can set a fixed unit, like pixels (px), or a relative one, like em. Learn more about units (we only support some):
W3Schools |
MozillaAllowed values:
- 8px to 60px
- 6pt to 50pt
- 0.5em to 5em (including to two decimal places)
- xx-small
- x-small
- small
- medium (default)
- large
- x-large
- xx-large
- smaller
- larger
Example 1:
Code:
<span style="font-size: 30px;">Text</span>
Result:
Text
Example 2:
Code:
<span style="font-size: 1.25em;">Text</span>
Result:
Text
line-height
More Info:
W3Schools |
MozillaThis font property allows you to set the line height of text.
Unitless values are allowed. If you want to use a relative unit, like "em", you may instead want to choose a unitless value to get a
more predictable result.
Allowed values:
- normal (default)
- 8px to 70px
- 6pt to 60pt
- 0.5em to 5em (including to two decimal places)
- 0.5 to 5 (including to two decimal places)
Example 1:
Code:
<span style="line-height: 50px;">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</span>
Result:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Example 2:
Code:
<span style="font-size: 1.25em; line-height: 2;">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</span>
Result:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
font-family
More Info:
W3Schools |
MozillaThis font property allows you to set the font of the text.
You can add up to four font names that are separated by commas. The purposes of adding multiple fonts is so that if the first font listed isn't installed on the user's system, the next font will be used if it is installed. You should end with a generic family, such as "serif", "sans-serif", "cursive" or "monospace" so that the browser can pick a font in that family if none of the ones you selected prior to that were available.
If the font you are using has spaces in it, you will need to use single quotes (') around that particular font name.
You can view a list of web safe fonts
here. If you use an obscure font, one that users are unlikely to have, make sure to end in a generic family font.
Example 1:
Code:
<span style="font-family: Verdana;">The quick brown fox jumps over the lazy dog.</span>
Result:
The quick brown fox jumps over the lazy dog.
Example 2:
Code:
<span style="font-family: 'Times New Roman', serif; font-size: 18px;">The quick brown fox jumps over the lazy dog.</span>
Result:
The quick brown fox jumps over the lazy dog.
Example 3:
Code:
<span style="font-family: 'Brush Script MT', cursive; font-size: 25px;">The quick brown fox jumps over the lazy dog.</span>
Result:
The quick brown fox jumps over the lazy dog.
text-align
More Info:
W3Schools |
MozillaThis property allows you to align the text horizontally.
This needs to be used on a block element, like "div", in order to work. "Span" is a inline element and will not allow it to work.
Allowed values:
- left (default if text direction is left to right)
- center
- right
- justify
Example 1:
Code:
<div style="text-align: center;">
Centered text.
</div>
Result:
Example 2:
Code:
<div style="text-align: justify;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
Result:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
text-decoration
More Info:
W3Schools |
MozillaThis property allows you to create a line above, through or below (an underline, like a link) the text.
This is a shorthand property that allows you to set various text-decoration properties at once. When setting this shorthand property, "text-decoration-line" is required. The text-decoration properties must be in order if setting them in this shorthand property.
The order is:
You can learn more about these in the sections that follow.
Example 1:
Code:
<span style="text-decoration: underline black solid 1px;">The quick brown fox jumps over the lazy dog.</span>
Result:
The quick brown fox jumps over the lazy dog.
Example 2:
Code:
<span style="text-decoration: underline overline line-through red dotted 2px;">The quick brown fox jumps over the lazy dog.</span>
Result:
The quick brown fox jumps over the lazy dog.
text-decoration-line
More Info:
W3Schools |
MozillaThis text-decoration property allows you to choose the type of line, or lines, displayed.
Allowed values:
- none (default)
- underline
- overline
- line-through
You can set 1 to 3 values when not using the value "none".
Example 1:
Code:
<span style="text-decoration-line: overline;">Overline</span>
<span style="text-decoration-line: line-through;">Line-through</span>
<span style="text-decoration-line: underline;">Underline</span>
Result:
Overline
Line-through
Underline
Example 2:
Code:
<span style="text-decoration-line: underline overline line-through;">The quick brown fox jumps over the lazy dog.</span>
Result:
The quick brown fox jumps over the lazy dog.
text-decoration-color
More Info:
W3Schools |
MozillaThis text-decoration property allows you to choose the color of the line, or lines, displayed.
Please see the
color section for information about allowed color values.
Example:
Code:
<span style="text-decoration-color: red; text-decoration-line: underline;">Underline</span>
Result:
Underline
text-decoration-style
More Info:
W3Schools |
MozillaThis text-decoration property allows you to choose the style of the line, or lines, displayed.
Allowed values:
- solid (default)
- double
- dotted
- dashed
- wavy
Example:
Code:
<span style="text-decoration-style: wavy; text-decoration-line: underline;">Underline</span>
Result:
Underline
text-decoration-thickness
More Info:
W3Schools |
MozillaThis text-decoration property allows you to choose the thickness of the line, or lines, displayed.
Allowed values:
- auto (default)
- 0px to 4px
- 0em to 0.25em (including to two decimal places)
Example:
Code:
<span style="text-decoration-thickness: 3px; text-decoration-line: underline;">Underline</span>
Result:
Underline
text-underline-offset
More Info:
MozillaThis property allows you to choose the spacing between text and its underline. This only works with "
text-decoration-line" set to "underline", not when that property is set to "overline" or "line-through".
Allowed values:
- auto (default)
- 0px to 5px
- 0em to 0.40em (including to two decimal places)
Example:
Code:
<span style="text-underline-offset: 3px; text-decoration-line: underline;">Underlined text with offset</span>
<span style="text-decoration-line: underline;">Underlined text without offset</span>
Result:
Underlined text with offset
Underlined text without offset
text-underline-position
More Info:
MozillaThis property can allow you to choose if the underline under text appears below it normally or if it appears below any characters that might otherwise cross the underline, such as "g", "j", "p", "q" and "y". This works when "
text-decoration-line" is set to "underline" so that you have an underline.
Allowed values:
Example:
Code:
<span style="text-underline-position: under; text-decoration-line: underline;">Under: The quick brown fox jumps over the lazy dog.</span>
<span style="text-decoration-line: underline;">Normal (auto): The quick brown fox jumps over the lazy dog.</span>
Result:
Under: The quick brown fox jumps over the lazy dog.
Normal (auto): The quick brown fox jumps over the lazy dog.
Advanced Text Formatting
text-indent
More Info:
W3Schools |
MozillaThis allows you to indent the first line of text.
Allowed values:
- 0 (default)
- 0px to 300px
- 0em to 20em (including to one decimal place)
- 0% to 90%
Example:
Code:
<div style="text-indent: 50px;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</div>
Result:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
letter-spacing
More Info:
W3Schools |
MozillaThis allows you to set the spacing between individual characters of text.
You can choose a value to one decimal place.
Allowed values:
- normal (default)
- -2px to 40px
- -2pt to 35pt
- -0.1em to 2.5em
Example:
Code:
<span style="letter-spacing: -0.5px;">The quick brown fox jumps over the lazy dog.</span>
<span style="letter-spacing: normal;">The quick brown fox jumps over the lazy dog.</span>
<span style="letter-spacing: 5px;">The quick brown fox jumps over the lazy dog.</span>
Result:
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
word-spacing
More Info:
W3Schools |
MozillaThis allows you to set the spacing between words.
Allowed values:
- normal (default)
- -3px to 100px
- -3pt to 75pt
- -0.2em to 6em
Example:
Code:
<span style="word-spacing: -0.5px;">The quick brown fox jumps over the lazy dog.</span>
<span style="word-spacing: normal;">The quick brown fox jumps over the lazy dog.</span>
<span style="word-spacing: 20px;">The quick brown fox jumps over the lazy dog.</span>
Result:
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
white-space
More Info:
W3Schools |
Mozilla"pre-wrap" can allow you to preserve spaces in text.
Because it could potentially interfere with the layout of the message page, we don't allow the values "nowrap" and "pre" to be used.
Allowed values:
- normal (default)
- pre-wrap
- pre-line
Example:
Code:
<div style="white-space: pre-wrap;">A B C
A B C</div>
Result:
text-transform
More Info:
W3Schools |
MozillaThis can allow you to make text uppercase or lowercase.
Allowed values:
- none (default)
- capitalize
- uppercase
- lowercase
Example:
Code:
<span style="text-transform: capitalize;">The quick brown fox jumps over the lazy dog.</span>
<span style="text-transform: uppercase;">The quick brown fox jumps over the lazy dog.</span>
<span style="text-transform: lowercase;">The quick brown fox jumps over the lazy dog.</span>
Result:
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
text-shadow
More Info:
W3Schools |
MozillaThis allows you to add a shadow to text.
Unless set to the default value of "none", this property has 2 to 4 values, separated by spaces. The first two are required, the horizontal position (-60px to 60px) and vertical position (-60px to 60px). The third value, the blur radius (0px to 30px), is optional. The fourth value, the text color of the shadow, is optional.
We allow you to set up to 3 text shadows, separated by commas.
Example:
Code:
<div style="text-shadow: 5px 5px; padding: 5px;">
The quick brown fox jumps over the lazy dog.
</div>
<div style="text-shadow: 5px 5px blue; padding: 5px;">
The quick brown fox jumps over the lazy dog.
</div>
<div style="text-shadow: 5px 5px 1px blue; padding: 5px;">
The quick brown fox jumps over the lazy dog.
</div>
<div style="text-shadow: 5px 5px 2px blue; padding: 5px;">
The quick brown fox jumps over the lazy dog.
</div>
<div style="text-shadow: 5px 5px 5px blue; padding: 5px;">
The quick brown fox jumps over the lazy dog.
</div>
<div style="text-shadow: -5px -5px 2px blue; padding: 5px;">
The quick brown fox jumps over the lazy dog.
</div>
<div style="text-shadow: 5px 5px 1px blue, 15px 15px 2px blue, 25px 25px 3px blue; padding: 5px 5px 30px 5px;">
The quick brown fox jumps over the lazy dog.
</div>
Result:
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
writing-mode
More Info:
W3Schools |
MozillaThis allows you to write text vertically. "horizontal-tb" is the default behavior, writing text normally.
If you use this property, use it sparingly and for an appropriate purpose.
Allowed values:
- horizontal-tb (default)
- vertical-rl
- vertical-lr
Example 1:
Code:
<div style="writing-mode: vertical-rl; width: 100%; height: 50px; background-color: lightyellow;">
The quick brown fox jumps over the lazy dog.
</div>
<div style="writing-mode: vertical-lr; width: 100%; height: 50px; background-color: lightblue;">
The quick brown fox jumps over the lazy dog.
</div>
Result:
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Example 2:
Code:
<div style="width: 100%; background-color: lightyellow;">
CaneTalk <span style="writing-mode: vertical-rl;">CaneTalk</span> CaneTalk
</div>
Result:
CaneTalk CaneTalk CaneTalk
transform: rotate()
More Info:
W3Schools |
MozillaThis allows you to rotate an element.
This needs to be used on a block element, like "div", in order to work. "Span" is a inline element and will not allow it to work.
We restrict the usage of this property to a rotation of only 10 degrees. Only administrators can choose a larger rotation.
If you use this property, use it sparingly. If used improperly, we may remove it from the forum.
We don't support other properties for "transform" other than "rotate()".
Allowed values:
- none (default for "transform")
- rotate(-10deg) to rotate(10deg)
Example:
Code:
<div style="transform: rotate(10deg); max-width: 100px; height: 50px; margin: 25px 0px; background-color: lightyellow;">
CaneTalk
</div>
Result:
direction
More Info:
W3Schools |
MozillaThis allows you to change the direction of text.
To change the direction of each character, use the value "rtl" of this property and combine it with "
unicode-bidi".
Allowed values:
Example:
Code:
<div style="direction: ltr; width: 100%; background-color: lightyellow;">
The quick brown fox jumps over the lazy dog.
</div>
<div style="direction: rtl; width: 100%; background-color: lightblue;">
The quick brown fox jumps over the lazy dog.
</div>
Result:
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
unicode-bidi
More Info:
W3Schools |
Mozilla"bidi-override" allows you to change the direction of each character if used in combination with "
direction", whose value should be set as "rtl".
Allowed values:
- normal (default)
- bidi-override
Example:
Code:
<div style="direction: rtl; unicode-bidi: bidi-override; width: 100%; background-color: lightblue;">
The quick brown fox jumps over the lazy dog.
</div>
Result:
The quick brown fox jumps over the lazy dog.
Margin
margin
More Info:
W3Schools |
MozillaThis is a shorthand property that allows you to set the margin of an element at once. The margin is the space around the element.
This allows you to set a margin between elements, like between "div" tags for example. It should generally be used on block elements and not an inline element, like "span". For block elements, the margin can be set on all four sides. For an inline element, it will only apply horizontally. (left and right)
This property has 1 to 4 values, separated by spaces.
If the margin property has four values, the values in order are: top, right, bottom, left
If the margin property has three values, the values in order are: top, right/left, bottom (where the second value applies to both right and left)
If the margin property has two values, the values in order are: top/bottom, right/left (where the first value applies to both top and bottom; where the second value applies to both right and left)
If the margin property has one value, all sides will use that value.
When using "auto" as a value for both right and left, you can center a block element horizontally. If you are centering a "div" in another "div", you will need to set a "
max-width" of the "div" you want centered. If you do not, the inside "div" will simply extend all the way across the parent "div".
To make things easier for most people in the forum, line breaks (
<br/>) are automatically inserted into a message. If you hit "enter" on the keyboard in the message box, a line break will usually be created for you. To not have line breaks created, you have to squish the code you are writing to reduce line breaks. This might mean that top and bottom margins don't work as well, as in addition to the margins you set, line breaks might be added above and/or below elements.
Allowed values for each side:
- 0 (default)
- 0% to 100%
- 0px to 100px
- 0em to 5em
- auto
Example 1:
Code:
<div style="width: 100%; background-color: #ddd;">
<div style="background-color: lightblue;">
Box 1
</div>
<div style="margin: 10px 20px 30px 40px; background-color: lightgreen;">
Box 2
</div>
<div style="background-color: lightyellow;">
Box 3
</div>
</div>
Result:
Example 2:
Code:
<div style="width: 100%; background-color: #ddd;">
<div style="background-color: lightblue;">
Box 1
</div>
<div style="margin: 20px auto; max-width: 100px; background-color: lightgreen;">
Box 2
</div>
<div style="background-color: lightyellow;">
Box 3
</div>
</div>
Result:
margin-top
More Info:
W3Schools |
MozillaFor information on margins, see "
margin".
This property takes a single value and you can see the allowed values in the margin section.
Example:
Code:
<div style="width: 100%; background-color: #ddd;">
<div style="background-color: lightblue;">
Box 1
</div>
<div style="margin-top: 20px; background-color: lightgreen;">
Box 2
</div>
</div>
Result:
margin-right
More Info:
W3Schools |
MozillaFor information on margins, see "
margin".
This property takes a single value and you can see the allowed values in the margin section.
Example:
Code:
<div style="width: 100%; background-color: #ddd;">
<div style="margin-right: 50px; background-color: lightgreen;">
Box
</div>
</div>
Result:
margin-bottom
More Info:
W3Schools |
MozillaFor information on margins, see "
margin".
This property takes a single value and you can see the allowed values in the margin section.
Example:
Code:
<div style="width: 100%; background-color: #ddd;">
<div style="margin-bottom: 20px; background-color: lightblue;">
Box 1
</div>
<div style="background-color: lightgreen;">
Box 2
</div>
</div>
Result:
margin-left
More Info:
W3Schools |
MozillaFor information on margins, see "
margin".
This property takes a single value and you can see the allowed values in the margin section.
Example:
Code:
<div style="width: 100%; background-color: #ddd;">
<div style="margin-left: 50px; background-color: lightgreen;">
Box
</div>
</div>
Result:
Padding
padding
More Info:
W3Schools |
MozillaThis is a shorthand property that allows you to set the padding of an element at once. The padding is the space inside the element between any border that might be set and the inside content.
This property has 1 to 4 values, separated by spaces.
If the padding property has four values, the values in order are: top, right, bottom, left
If the padding property has three values, the values in order are: top, right/left, bottom (where the second value applies to both right and left)
If the padding property has two values, the values in order are: top/bottom, right/left (where the first value applies to both top and bottom; where the second value applies to both right and left)
If the padding property has one value, all of the interior sides will use that value.
Allowed values for each side:
- 0 (default)
- 0% to 100%
- 0px to 100px
- 0em to 5em
Example 1:
Code:
<div style="padding: 20px 5px; background-color: lightblue;">
Box
</div>
Result:
Example 2:
Code:
<div style="padding: 10px 20px 30px 40px; background-color: #ddd;">
<div style="padding: 20px 5px; background-color: lightblue;">
Box
</div>
</div>
Result:
padding-top
More Info:
W3Schools |
MozillaFor information on paddings, see "
padding".
This property takes a single value and you can see the allowed values in the padding section.
Example:
Code:
<div style="padding-top: 20px; background-color: lightblue;">
Box
</div>
Result:
padding-right
More Info:
W3Schools |
MozillaFor information on paddings, see "
padding".
This property takes a single value and you can see the allowed values in the padding section.
Example:
Code:
<div style="padding-right: 20px; background-color: #ddd;">
<div style="background-color: lightblue;">
Box
</div>
</div>
Result:
padding-bottom
More Info:
W3Schools |
MozillaFor information on paddings, see "
padding".
This property takes a single value and you can see the allowed values in the padding section.
Example:
Code:
<div style="padding-bottom: 20px; background-color: lightblue;">
Box
</div>
Result:
padding-left
More Info:
W3Schools |
MozillaFor information on paddings, see "
padding".
This property takes a single value and you can see the allowed values in the padding section.
Example:
Code:
<div style="padding-left: 20px; background-color: lightblue;">
Box
</div>
Result:
Border
border
More Info:
W3Schools |
MozillaThis is a shorthand property that allows you to set the border of an element at once. When setting this shorthand property, we require "border-style" to be defined even if you also specifically define "border-style" before or after this shorthand property. You can set one, two or three of the values below, in any order.
Example 1:
Code:
<div style="border: 1px solid orange; padding: 10px;">
Box
</div>
Result:
Example 2:
Code:
<div style="border: 5px dotted green; padding: 10px;">
Box
</div>
Result:
border-width
More Info:
W3Schools |
MozillaThis property allows you to set the width of a border.
This property has 1 to 4 values, separated by spaces.
If the "border-width" property has four values, the values in order are: top, right, bottom, left
If the "border-width" property has three values, the values in order are: top, right/left, bottom (where the second value applies to both right and left)
If the "border-width" property has two values, the values in order are: top/bottom, right/left (where the first value applies to both top and bottom; where the second value applies to both right and left)
If the "border-width" property has one value, all of the borders will use that value.
Allowed values for each border:
- medium (default)
- thin
- thick
- 0px to 40px
- 0em to 2em
- 0
Example 1:
Code:
<div style="border-width: 5px; border-style: solid; border-color: orange; padding: 10px;">
Box
</div>
Result:
Example 2:
Code:
<div style="border: solid green; border-width: 5px 10px 15px 20px; padding: 10px;">
Box
</div>
Result:
border-style
More Info:
W3Schools |
MozillaThis property allows you to set the style of a border.
This property has 1 to 4 values, separated by spaces.
If the "border-style" property has four values, the values in order are: top, right, bottom, left
If the "border-style" property has three values, the values in order are: top, right/left, bottom (where the second value applies to both right and left)
If the "border-style" property has two values, the values in order are: top/bottom, right/left (where the first value applies to both top and bottom; where the second value applies to both right and left)
If the "border-style" property has one value, all of the borders will use that value.
Allowed values for each border:
- none (default)
- hidden
- dotted
- dashed
- solid
- double
- groove
- ridge
- inset
- outset
Example 1:
Code:
<div style="border-style: solid; border-width: 5px; border-color: orange; padding: 10px;">
Box
</div>
Result:
Example 2:
Code:
<div style="border: 10px solid green; border-style: solid dotted dashed double; padding: 10px;">
Box
</div>
Result:
border-color
More Info:
W3Schools |
MozillaThis property allows you to set the color of a border.
This property has 1 to 4 values, separated by spaces.
If the "border-color" property has four values, the values in order are: top, right, bottom, left
If the "border-color" property has three values, the values in order are: top, right/left, bottom (where the second value applies to both right and left)
If the "border-color" property has two values, the values in order are: top/bottom, right/left (where the first value applies to both top and bottom; where the second value applies to both right and left)
If the "border-color" property has one value, all of the borders will use that value.
Please see the
color section for information about allowed color values.
Example 1:
Code:
<div style="border-color: orange; border-style: solid; border-width: 5px; padding: 10px;">
Box
</div>
Result:
Example 2:
Code:
<div style="border: 10px solid; border-color: #000 red transparent orange; padding: 10px;">
Box
</div>
Result:
border-radius
More Info:
W3Schools |
MozillaThis property allows you to set rounded corners for an element.
You can also set this for an element that does not have a border.
Allowed values:
- 0 (default)
- 0% to 100%
- 0px to 60px
Note: For an "hr" tag, we don't allow a percent.
You can also set individual radius' by using "border-bottom-left-radius", "border-bottom-right-radius", "border-top-left-radius" and "border-top-right-radius".
Example 1:
Code:
<div style="border-radius: 15px; border: 1px solid black; padding: 10px;">
Box
</div>
Result:
Example 2:
Code:
<div style="border-radius: 15px; background: lightgreen; padding: 10px;">
Box
</div>
Result:
Example 3:
Code:
<div style="border-top-left-radius: 15px; border-top-right-radius: 15px; border-bottom-left-radius: 15px; border-bottom-right-radius: 15px; background: lightgreen; padding: 10px;">
Box
</div>
Result:
Example 4:
Code:
<img src="https://canetalk.com/images/lightning.jpg" style="border-radius: 50%;"/>
Result:
Other Border Properties
Complete CSS Reference:
W3Schools |
MozillaWhile we don't cover each in-depth, because they are similiar to the other border properties described, we also allow the following properties:
- border-top
- border-top-width
- border-top-style
- border-top-color
- border-right
- border-right-width
- border-right-style
- border-right-color
- border-bottom
- border-bottom-width
- border-bottom-style
- border-bottom-color
- border-left
- border-left-width
- border-left-style
- border-left-color
"border-top" is just like the shorthand property "
border", only it applies to the top border.
"border-top-width" is like "
border-width", "border-top-style" is like "
border-style" and "border-top-color" is like "
border-color", but again only applies to the top border. The same applies to the other borders.
Example 1:
Code:
<div style="border: 5px solid orange; border-top: 20px dotted red; padding: 10px;">
Box
</div>
Result:
Example 2:
Code:
<div style="border: 5px solid orange; border-bottom-width: 20px; padding: 10px;">
Box
</div>
Result:
Tables
border-spacing
More Info:
W3Schools |
MozillaThis property allows you to set the spacing between borders of adjacent cells in a table.
This property has 1 to 2 values, separated by a space.
If the "border-spacing" property has two values, the values in order are: horizontal spacing, vertical spacing (where the first value applies to spacing on the left and right sides of a cell; where the second value applies to spacing on the top and bottom sides of a cell)
If the "border-spacing" property has one value, all of the interior sides will use that value.
Our site has a default format for tables. When you add CSS, you are modifying the default we have chosen. For our default, we include borders between individual cells by default. That makes using this property easier when it comes to borders between cells. (it would otherwise require more CSS) This is used with "
border-collapse" set to "separate".
Allowed values:
Example:
Code:
<table style="border: 1px solid black; border-spacing: 5px; border-collapse: separate;">
<tr>
<td>Cell</td>
<td>Cell</td>
</tr>
<tr>
<td>Cell</td>
<td>Cell</td>
</tr>
</table>
Result:
border-collapse
More Info:
W3Schools |
MozillaThis property allows you to set "whether cells inside a <table> have shared or separate borders".
Allowed values:
- separate (default)
- collapse
Example 1:
Code:
<table style="border-collapse: separate; border: 1px solid black; border-spacing: 5px;">
<tr>
<td>Cell</td>
<td>Cell</td>
</tr>
<tr>
<td>Cell</td>
<td>Cell</td>
</tr>
</table>
Result:
Example 2:
Code:
<table style="border-collapse: collapse; border: 1px solid black; border-spacing: 5px;">
<tr>
<td>Cell</td>
<td>Cell</td>
</tr>
<tr>
<td>Cell</td>
<td>Cell</td>
</tr>
</table>
Result:
vertical-align (in tables)
More Info:
W3Schools (
in tables) |
MozillaThis property, when used in a table, allows you to set the vertical alignment of content within a table cell. You can use this in the "table", "thead", "tbody", "tfoot", "tr", "td" and/or "th" HTML tags.
We also allow the "
vertical-align" property for certain other HTML tags, though the values we allow in those differ from the ones we allow in tables. It is also used, and behaves, somewhat differently in those instances than in a table.
Allowed values in tables:
- baseline (default)
- top
- middle
- bottom
Example 1:
Code:
<table style="border: 1px solid black;">
<tr>
<td style="vertical-align: baseline;">
Baseline
</td>
<td style="vertical-align: top;">
Top
</td>
<td style="vertical-align: middle;">
Middle
</td>
<td style="vertical-align: bottom;">
Bottom
</td>
<td style="width: 50%;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</td>
</tr>
</table>
Result:
Baseline | Top | Middle | Bottom | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. |
Example 2:
Code:
<table style="border: 1px solid black;">
<tr style="vertical-align: bottom;">
<td>Cell</td>
<td>Cell</td>
<td style="width: 50%;">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</td>
</tr>
</table>
Result:
Cell | Cell | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. |
Example 3:
Code:
<table style="border: 1px solid black; vertical-align: bottom;">
<tr>
<td>Cell</td>
<td>Cell</td>
<td style="width: 50%;">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</td>
</tr>
</table>
Result:
Cell | Cell | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. |
empty-cells
More Info:
W3Schools |
MozillaThis property allows you to set whether borders are visible for empty cells in a table.
Allowed values:
Example 1:
Code:
<table style="empty-cells: show; border-collapse: separate; border: 1px solid black; border-spacing: 5px;">
<tr>
<td>Cell</td>
<td></td>
</tr>
<tr>
<td></td>
<td>Cell</td>
</tr>
</table>
Result:
Example 2:
Code:
<table style="empty-cells: hide; border-collapse: separate; border: 1px solid black; border-spacing: 5px;">
<tr>
<td>Cell</td>
<td></td>
</tr>
<tr>
<td></td>
<td>Cell</td>
</tr>
</table>
Result:
Lists
list-style-type
More Info:
W3Schools |
MozillaThis allows you to set the marker type used in a list.
Allowed values for "list-style-type" in "ul" tag:
- disc (default)
- circle
- square
- none
Allowed values for "list-style-type" in "ol" tag:
- decimal (default)
- disc
- circle
- square
- none
- lower-alpha
- lower-greek
- lower-latin
- lower-roman
- upper-alpha
- upper-greek
- upper-latin
- upper-roman
Example 1:
Code:
<ul style="list-style-type: circle;">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
Result:
Example 2:
Code:
<ol style="list-style-type: lower-alpha;">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ol>
Result:
Example 3:
Code:
<ol style="list-style-type: lower-roman;">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ol>
Result:
Example 4:
Code:
<ol start="4" style="list-style-type: lower-roman;">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ol>
Result:
list-style-position
More Info:
W3Schools |
MozillaThis allows you to set the marker type used in a list.
Allowed values:
Example 1:
Code:
<ul style="list-style-position: outside;">
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</li>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</li>
</ul>
Result:
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Example 2:
Code:
<ul style="list-style-position: inside;">
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</li>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</li>
</ul>
Result:
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Background
background-color
More Info:
W3Schools |
MozillaThis allows you to set the background color of an element.
Please see the
color section for information about allowed color values.
We also allow using just "background" rather than "background-color" to set the color. We don't allow the inclusion of images in a background, only changing the background color or adding a gradient.
Example 1:
Code:
<div style="background-color: lightblue; padding: 10px;">
Box
</div>
Result:
Example 2:
Code:
<div style="background-color: rgba(0, 128, 0, 0.1); padding: 10px; border-radius: 15px;">
Box
</div>
Result:
Background Gradients
More Info:
W3Schools |
MozillaDue to the complexity of gradients, we don't go into any detail in the sections about each gradient. While we support some of the CSS that is used for gradients, we don't fully support some aspects of gradients. You can try to see if what you want to use works.
Since the gradients appear in the background, you can have text and other content in the foreground over the gradient.
In dark mode, background gradients are preserved. This is not the case for normal background colors which are instead removed in dark mode.
The allowed CSS gradients:
Some of the examples in each section come directly from W3Schools or Mozilla.
We also allow using just "background" rather than "background-image" to set a gradient. We don't allow the inclusion of images in a background, only changing the background color or adding a gradient.
background-image: linear-gradient()
More Info:
W3Schools |
MozillaExample 1:
Code:
<div style="max-width: 100px; height: 100px; background-image: linear-gradient(to right, red 20%, orange 20% 40%, yellow 40% 60%, green 60% 80%, blue 80%);"></div>
Result:
Example 2:
Code:
<div style="max-width: 100px; height: 100px; background-image: linear-gradient(135deg, orange 60%, cyan);">
Text
</div>
Result:
background-image: repeating-linear-gradient()
More Info:
W3Schools |
MozillaExample 1:
Code:
<div style="max-width: 100px; height: 100px; background-image: repeating-linear-gradient(45deg, #3f87a6, #ebf8e1 15%, #f69d3c 20%);"></div>
Result:
Example 2:
Code:
<div style="max-width: 100px; height: 100px; background-image: repeating-linear-gradient(190deg,red,blue 7%,green 10%);"></div>
Result:
background-image: radial-gradient()
More Info:
W3Schools |
MozillaExample 1:
Code:
<div style="max-width: 100px; height: 100px; background-image: radial-gradient(closest-side, #3f87a6, #ebf8e1, #f69d3c);"></div>
Result:
Example 2:
Code:
<div style="max-width: 100px; height: 100px; background-image: radial-gradient(circle at 100%, #333, #333 50%, #eee 75%, #333 75%);"></div>
Result:
background-image: repeating-radial-gradient()
More Info:
W3Schools |
MozillaExample 1:
Code:
<div style="max-width: 100px; height: 100px; background-image: repeating-radial-gradient(#e66465, #9198e5 20%);"></div>
Result:
Example 2:
Code:
<div style="max-width: 100px; height: 100px; background-image: repeating-radial-gradient(closest-side, #3f87a6, #ebf8e1, #f69d3c);"></div>
Result:
background-image: conic-gradient()
More Info:
W3Schools |
MozillaExample 1:
Code:
<div style="max-width: 100px; height: 100px; background-image: conic-gradient(red, orange, yellow, green, blue);"></div>
Result:
Example 2:
Code:
<div style="max-width: 100px; height: 100px; background-image: conic-gradient(at 60% 45%, red, yellow, green);"></div>
Result:
Example 3:
Code:
<div style="max-width: 100px; height: 100px; background-image: conic-gradient(orange 0turn, orange 0.4turn, lightgray 0.4turn); border-radius: 50%;"></div>
Result:
Example 4:
Code:
<div style="max-width: 100px; height: 100px; background-image: conic-gradient(red 6deg, orange 6deg 18deg, yellow 18deg 45deg, green 45deg 110deg, blue 110deg 200deg, purple 200deg);"></div>
Result:
background-image: repeating-conic-gradient()
More Info:
W3Schools |
MozillaExample 1:
Code:
<div style="max-width: 100px; height: 100px; background-image: repeating-conic-gradient(from 45deg at 10% 50%, brown 0deg 10deg, darkgoldenrod 10deg 20deg, chocolate 20deg 30deg);"></div>
Result:
Example 2:
Code:
<div style="max-width: 100px; height: 100px; background-image: repeating-conic-gradient(red 0deg 30deg, yellow 30deg 60deg, blue 60deg 90deg); border-radius: 50%;"></div>
Result:
Example 3:
Code:
<div style="max-width: 100px; height: 100px; background-image: repeating-conic-gradient(red 0%, yellow 15%, red 33%);"></div>
Result:
Columns
columns
More Info:
W3Schools |
MozillaThis is a shorthand property that allows you to set the column count and column width at once. The order does not matter.
Example:
Code:
<div style="columns: 200px 2;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
Result:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
column-count
More Info:
W3Schools |
MozillaThis sets the number of columns. When used, we also require you to set a "
column-width".
Example:
Code:
<div style="column-count: 2; column-width: 200px;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
Result:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
column-width
More Info:
W3Schools |
MozillaThis sets the column width.
- auto (default)
- 200px to 1000px
- 13em to 65em
Example:
Code:
<div style="column-width: 15em;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
Result:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
column-gap
More Info:
W3Schools |
MozillaThis sets the width of the gap between columns.
- normal (default)
- 10px to 100px
- 1em to 7em
Example:
Code:
<div style="column-gap: 50px; column-width: 200px;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
Result:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
column-rule
More Info:
W3Schools |
MozillaThis is a shorthand property that allows you to set properties of a line that can be drawn between columns. "column-rule-style" is required. The others are optional. On our site, the order defined below is required.
The order is:
Example:
Code:
<div style="column-rule: 1px solid black; column-width: 200px; column-gap: 20px;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
Result:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
column-rule-width
More Info:
W3Schools |
MozillaThis sets the width of the line between columns.
We also require you to set "
column-gap" when using "column-rule-width". The gap must also be at least equal to or larger than the "column-rule-width".
- medium (default)
- thin
- thick
- 0px to 20px
- 0em to 1em (including to two decimal places)
Example:
Code:
<div style="column-rule-width: 5px; column-rule-style: dashed; column-rule-color: red; column-width: 200px; column-gap: 25px;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
Result:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
column-rule-style
More Info:
W3Schools |
MozillaThis sets the style of the line between columns.
- none (default)
- hidden
- dotted
- dashed
- solid
- double
- groove
- ridge
- inset
- outset
Example:
Code:
<div style="column-rule-style: dotted; column-rule-width: 5px; column-rule-color: red; column-width: 200px; column-gap: 20px;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
Result:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
column-rule-color
More Info:
W3Schools |
MozillaThis sets the color of the line between columns.
Please see the
color section for examples.
Example:
Code:
<div style="column-rule-color: rgba(0, 128, 0, 0.1); column-rule-width: 5px; column-rule-style: double; column-width: 200px; column-gap: 20px;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
Result:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Other
width
More Info:
W3Schools |
MozillaThis allows you to set the width of an element, like "div" for example.
Allowed values:
For "tbody", "tr" and "td" tags:
- 10px to 4000px
- 1em to 250em (including to two decimal places)
In order for a responsive layout to work, which allows the content of a page to shrink in size on mobile devices, fixed widths in pixels are generally not allowed. They are only allowed on certain "table" tags. In places where a fixed width (in pixels) is not allowed, the forum will automatically convert the property from "width" to "
max-width".
Example:
Code:
<div style="width: 50%; background-color: #ddd;">
Text
</div>
Result:
max-width
More Info:
W3Schools |
MozillaThis allows you to set the maximum width of an element, like "div" for example.
This value overrides any "
width" you set.
We do not allow "min-width".
Allowed values:
- none (default)
- 5% to 100%
- 10px to 4000px
- 1em to 250em (including to two decimal places)
Compare the example in the "
width" section to this one. In both examples the width is 50%, but because the maximum width set is "100px" below, the width will not exceed that.
Example:
Code:
<div style="width: 50%; max-width: 100px; background-color: #ddd;">
Text
</div>
Result:
height
More Info:
W3Schools |
MozillaThis allows you to set the height of an element, like "div" for example.
We do not currently allow "min-height" or "max-height".
Allowed values:
- auto (default)
- 5% to 100%
- 10px to 1000px
Example:
Code:
<div style="width: 100%; height: 50px; background-color: #ddd;">
Text
</div>
Result:
vertical-align (not in a table)
More Info:
W3Schools |
MozillaThis property allows you to set the vertical alignment of content in an inline or inline-block element. You can use this in "span" or "img" tags on our site. This can't be used to vertically align a block-level element in this context.
We also allow the "
vertical-align" property in tables. Click that link to see how this property works differently in tables.
Allowed values when not used in a table:
- baseline (default)
- sub
- super
- top
- text-top
- middle
- bottom
- text-bottom
Example 1:
Code:
The quick brown fox <span style="vertical-align: super;">jumps</span> over the lazy dog.
Result:
The quick brown fox jumps over the lazy dog.
Example 2:
Code:
Left <img src="https://canetalk.com/images/lightning.jpg" style="vertical-align: middle;"/> Right
Result:
Left
Right
display
More Info:
W3Schools |
MozillaThis allows you to set how an element is treated. You can make a normally inline element, like <span>, behave like a block-level element. You can make a normally block-level element, like <div>, behave like an inline element.
Our forum automatically adds line breaks (
<br/>) for you. When it comes to line breaks around elements that are by default block-level elements, our forum attempts to not add line breaks where you do not expect them. (so that extra line breaks are not created) We do not use special code in that particular section of code to determine how you are using a particular element. If you use a block-level element as an inline element, or use an inline element as a block-level element, by using the "display" property, line breaks may not be handled well. They might be added, or missing, around that particular element.
Allowed values:
We do not allow other "display" values, such as "none".
Example 1:
Code:
<span style="display: block; background: lightgreen;">Box 1</span><span style="display: block; background: lightblue;">Box 2</span>
Result:
Box 1Box 2
Example 2:
Code:
<div style="display: inline; background: lightgreen;">Box 1</div><div style="display: inline; background: lightblue;">Box 2</div>
Result: