Collected by Elizabeth Janson Home Page |
|
The properties, or attributes, of text may be organised using 'margin', 'text-align', 'text-indent', 'text-decoration' 'text-transform' and 'vertical-align'. Not all Browsers recognise 'white-space', 'word-spacing' and 'letter-spacing' marginStyle sheets let us set a margin on any element. This margin is the space between the element, and the edge of the element which adjoins it. For headings and paragraphs, and other so called "block elements" this will usually be the body, but that isn't necessarily the case. Margins can be applied to each edge individually, or to every edge at once. You can specify the margin (which can be either positive or negative) in a number of units, or a percentage.BODY {margin: 10%} text-alignThe text-align property is intended for use with block-level HTML elements: the document body, divisions, headings, paragraphs, etc. You cannot use it with textual level elements, like font styles, or non-text elements, like an image or a form element. <P style="text-align: right"> This is some text</p>
Vertical-alignThe vertical-align property applies only to inline and table-cell elements, to change the vertical position of the element's text within the element itself. You can use one of the keywords described in this Table.
text-indentYou may want the indent to scale with the font used in the paragraph, and all is not lost in this case. For scalable indents, specify the amount of the indent in ems. An em is an amount of space equal to the height of the current font. If you want an indent equal to three times the font height, you could say.three { text-indent : 3em }As the font grows and shrinks, so will the indent. Exploiting margins
Conventional indented paragraphs, like this one, indent the first line to
the right while keeping the other lines flush to the left margin. The
opposite effect, wherein the first line shifts to the left, is known as a
"hanging indent" and can also be accomplished with the
To shift the first line to the left, use a negative indent amount. The browser will dutifully move the first line. It will not, however, shift the entire paragraph to the right to make room for that shifted first line. Instead, it will just render that first line over whatever happened to be to the left of the paragraph, which is probably not what you wanted.
To fix this, you must use the .indent1 { text-indent : -3em; margin-left : 3em } .indent2 { text-indent : -3em; margin-left : 6em } The first hanging indent keeps the first line flush with the existing left margin by setting the indent and margin amounts to the same value. The text shifts right just enough to allow the first line to shift left. The second hanging indent uses a margin larger than the indent amount, so that the first line does not come all the way back to the left margin. This creates an indented paragraph with a hanging indent, which is handy for lists and other organized layouts in your documents.
Regardless of the kind of indent you choose to use, you'll find that
consistent use of the text-decorationThe text-decoration values you can assign to it are: normal, underline, overline, line-through, and blink. Here is the popular definition that rids all links of the underline beneath them: A {text-decoration:none} text-decoration: underline, text-decoration: overline are only useful on <A>. Do not use on other elements (otherwise your site will look shoddy and unprofessional as a result of people clicking on the underlined text under the impression that it was a link). text-decoration: line-through to emphasize price cuts or similar. This effect is also used by DEL - see the page on HTML tags. text-transformThis property can transform text. The valid values are: none, capitalize, uppercase, lowercase.
<P><SPAN STYLE="text-transform: uppercase">The uppercase words,</SPAN> <SPAN STYLE="text-transform: capitalize">and the capitalised ones</SPAN>. The uppercase words, and the capitalized ones (note the 'z'). Not fully supportedwhite-spaceWhite space is used to define how a block of text will be controlled within an element. White space refers to the spaces between the words.This Text Formatting feature does not work in IE4 and has only partial support in NS4. Values include: normal, pre, nowrap <H4 style="white-space: pre">This is some text </H4> This is some textword-spacingWord Spacing allows you to define the amount of space between words.Note: This Text Formatting feature does not work in IE4 or NS4. Values include: normal, length, auto <P STYLE="word-spacing: 1cm">This is some text</P> This is some text letter-spacingLetter Spacing allows you to define the amount of space between letters in each word.Note: This Text Formatting feature does not work in NS4. Values include: normal, length, auto <P STYLE="letter-spacing: 0.1cm">This is some text</P> This is some text
|
CSS begins here |
|
This page is part of Elizabeth Janson's web site
http://www.geocities.com/elizatk/index.html
Tetbury residents in the Eighteenth Century my Australian Family History and Barrie, our Family Poet. |