What can I do with CSS?
You
can change almost any aspect of your blog's appearance just by changing
the style sheet in your template. Some of the most common things to do
are listed here. For more in-depth tutorials and examples, please see W3 Schools CSS Examples and The W3C Introduction to CSS.
Our default templates have all the CSS information towards the top, between
The highlighted line shows the style that is applied to every
Notes:
You can also use inline styles, if you want to do one-time formatting for a specific piece of text in a post. Here is the format to use:
Our default templates have all the CSS information towards the top, between
<style></style>
tags. You'll see a bunch of lines there that look like this:The highlighted line shows the style that is applied to every
<h3>
tag in your blog. What we're going to describe here are some options
for how to style it. Any of the pieces of code below can be inserted
between the { curly brackets } in the style sheet.
Code Examples
Colors | ||
color:blue; |
This text is blue. | |
background:yellow; |
This has a yellow background. | |
You can insert the names of many common colors here (e.g. red, green, yellow) or you can use hexadecimal codes for a greater range of colors (e.g. #0033AA). For more information on color, please see the Web Color Reference. | ||
colspan="2">Borders | ||
border:solid 1px red; |
This has a red border.
|
|
A border can be solid, dotted or dashed. The width here is specified in pixels (px). Colors can be names or hexadecimal codes. To only do a border on one side, use border-top, border-bottom, border-right, or border-left. | ||
Fonts | ||
font-family:"Times New Roman",Serif; |
This is in a serif font. | |
font-family:Verdana,Sans-Serif; |
This is in a sans-serif font. | |
You can specify a list of font choices. If the first one isn't available on your reader's computer, the next will be used, and so on. Indicating "Serif" will use any available serif font. | ||
font-size:24px; |
This text is 24 pixels high. | |
The units of size can be pixels (px), points (pt), inches (in) or percent of the default size (%). | ||
font-weight:bold; |
This text is bold. | |
Choices are bold and normal. | ||
text-decoration:underline; |
This text is underlined. | |
The text decoration can be set to none, underline, overline, or line-through. This is most commonly used to remove the underlining on links. | ||
text-align:right; |
This text is right aligned.
|
|
The alignment can be set to left, right, or justify. | ||
Margins and Padding | ||
margin:15px; |
This has a 15px margin all around.
|
|
padding:15px; |
This has 15px of padding all around.
|
|
Margin and padding both specify the amount of space around
something. The difference is that a margin is outside the border and
padding is inside. (The border here is just for illustration.) As with the border, you can specify one side at time with margin-left, padding-top, etc. You can also set all at once with margin:1px 2px 3px 4px; where the order is top, right, bottom, left. |
Notes:
You can also use inline styles, if you want to do one-time formatting for a specific piece of text in a post. Here is the format to use:
<span style="color:red;">
This text will be red.</span>