![]() | |
|
The basics
|
Text FormattingSome basic margin settings are controlled for you by the templates. For example, paragraphs, list items, tables, and headings in the main body of the page have a left margin of 20 pixels. This is to stop these elements from hitting up against the side menu. Headings also have a top margin to 10 pixels and a bottom margin of 0 pixels. This helps visually separate the content on a page, making it easier to tell what content relates to what heading. MarginsMargins add space to the outside of the element in question. You can add top, bottom, left, and right margins. Values can be in pixels, em units, or as a percentage of the width of the nearest parent element.
h3 {margin-top: 20px;}
#newsbrief p {margin-left: 10em;}
ul {margin-bottom: 2%;}
PaddingPadding adds space to the element itself. The difference between Paddings and margins can be a bit quirky, so try a bit of trial and error and make sure to test your pages in multiple browsers.
h2 {padding-top: 0px;}
p {padding-bottom: 5%;}
.smalllist ol {padding-left: 20em;}
Text indentUsing style sheets, you can add an indent to the first line of an element. This is most often used to create a "tab" effect at the start of a paragraph. Negative values are permitted, which result in hanging indents.
p {text-indent: 5px;}
h3 {text-indent: -25em;}
Text alignAnother element of text formatting available to you is
p {text-align: center;}
h3 {text-align: right;
font-style: italic;}
|
![]() |
|