1 / 33

Text Properties

Text Properties. CSS The Definitive Guide Chapter 6. The Difference between text and font~. Text is the content, and fonts are used to display that content. By using text properties you can affect the position of text in relation to the rest of the line, superscript it, underline

shilah
Download Presentation

Text Properties

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Text Properties CSS The Definitive Guide Chapter 6

  2. The Difference between text and font~ • Textis the content, and fonts are used to display that content. By using text properties you can affect the position of text in relation to the rest of the line, superscript it, underline it and change the capitalization!

  3. Fonts • Fonts are the different kinds of typefaces. Each font is a set of letters, numbers, and symbols with a unique visual appearance. All fonts belong to large collections, which describe their general look, such as serif, sans-serif, or monospace. Font collections are made up of families, such as Times and Helvetica. A font family in turn can be broken down into font faces, which are variations on the basic family, such as Times Roman, Times Bold, Helvetica Condensed, Bodoni Italic, and so on.

  4. Text • Text simply describes a block of type, like this sentence or the heading of a chapter, regardless of the font in which it is set.

  5. Indenting Text Indenting the first line of a paragraph on a web page is one of the most sought-after text formatting effects. P {text-indent: 3em;}

  6. Negative indents The opposite effect. The first line hangs out from the paragraph. Depends on the negative value as to how much. Indents apply only to the first line of an element.

  7. Horizontal Alignment Text-align Effects how the lines of text in an element are Aligned with respect to one another. Values = left, center, right, justify, inherit

  8. Vertical Alignment Line-height A way to increase (or decrease) the vertical space between lines of text. Line-height controls the leading, which is the extra space between lines of text above and beyond the font’s size.

  9. Constructing a line Every element in a line of text generates a content area, which is determined by the size of the font.

  10. Vertically aligning text Vertical-align Applies only to inline elements and replaced elements such as images and form inputs. Not an inherited property Values: baseline, sub, super, top, text-top, middle, bottom, text-bottom, <percentage>, <length>

  11. Word-spacing property • Accepts a positive or negative length • Used to modify inter-word spacing • The default value of normal is the same as setting a value to zero (0) This length is added to the standard space between words.

  12. Letter-spacing • Modifies the space between characters or letters. • Default value is 0 • Any length value you enter will increase or decrease the space between letters by that amount.

  13. Letter-spacing • Can increase the emphasis and effect of text you want to emphasize.

  14. Spacing and alignment • The value of word-spacing may be influenced by the value of the property text-align.

  15. Text Transformation • uppercase |lowercase ~ just as their name in implies and to all characters. • capitalization ~ Capitalizes on the first letter to each word. • none ~ default and leaves text alone • Different user agents have different ways of deciding where words begin and which letters are capitalized.

  16. Text Decoration • None | underline | overline | line-through | blink | inherit • The value of none turns off any decoration • You can combine decorations in a single rule

  17. Weird Decorations • Text-decoration is not inherited • There is no way to turn off no way to turn off underlining, overlining or line-through generated by a parent element.

  18. Text Shadows • At this time not all web browsers support text-shadows. • Obvious default is not to have a drop shadow for the text. • First two lengths determine offset distance of the shadow from the text and the third length defines the “blur radius”

  19. http://www.w3.org/Style/Examples/007/text-shadow Let’s look at some examples.

  20. Handling Whitespace Do you remember that XHTML ignored whitespace between words and lines of text when writing code? It collapses any white space down to a single line. • Affects the user agent’s handling of space, newline, and tab characters within the document source. • Using this property you can affect how a browser treats the whitespace between words and lines of text.

  21. Whitespaces… • By being explicit you can set the default behavior with the following declaration: P {white-space: normal;}

  22. Setting white-space to pre • Setting the white-space to pre ~ whitespace is not ignored. p {white-space: pre;} The browser will pay attention to extra spaces and even carriage returns.

  23. White-spaces ~ nowrap • Nowrap is the opposite value of the pre value • Prevents text from wrapping within an element except wherever you use a br element. <p style=“white-space: nowrap;”>

  24. White-space nowrap + tables • You can use the whitespace to replace nowrap attribute on tables cells. td {white-space: nowrap;} <table><tr> <td>The contents of this cell are not wrapped. </td> <td>neither are the contents for this cell. < </td> </tr></table>

  25. pre-wrap and pre-line • The effect of these values is to allow authors to better control whitespace handling. • Pre-wrap and pre-line are opposites • Pre-wrap has whites spaces preserved where as pre-line whites spaces collapse and honors new lines.

  26. Text direction • English reads from left to right, many languages read from right to left. • Values: ltr | rtl | inherit • The direction property affects the writing directions of text in block level elements.

  27. Tonight’s Lab • Create a Resource Page • A resource page should have links with definitions of resources you have used thus far on your individual web sites. • Please use text properties that were discussed in tonight.

More Related