text formatting and font control. boldface, italics, and special formatting way back in the age of...

17
Text Formatting and Font Control

Upload: amberlynn-reynolds

Post on 20-Jan-2016

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Text Formatting and Font Control. Boldface, Italics, and Special Formatting Way back in the age of the typewriter, we were content with plain text and

Text Formatting and Font Control

Page 2: Text Formatting and Font Control. Boldface, Italics, and Special Formatting Way back in the age of the typewriter, we were content with plain text and

Boldface, Italics, and Special FormattingWay back in the age of the

typewriter, we were content with plain text and an occasional underline for emphasis. Today, boldface and italicized text have become necessary in all paper communication. Naturally, you can add bold and italic text to your Web pages too.

Page 3: Text Formatting and Font Control. Boldface, Italics, and Special Formatting Way back in the age of the typewriter, we were content with plain text and

Boldface, Italics, and Special FormattingFor boldface text, put the <b> tag

at the beginning of the text and </b> at the end. Similarly, you can make any text italic by enclosing it between <i> and </i>.

You can nest one type of formatting inside another. For instance, if you want some text to be both bold and italic, put <b><i> in front of it and </i></b> after it.

Page 4: Text Formatting and Font Control. Boldface, Italics, and Special Formatting Way back in the age of the typewriter, we were content with plain text and

Boldface, Italics, and Special FormattingTo avoid confusing some Web

browsers, be careful to close tags in the opposite order you opened them in. For example, don’t do this:◦<b>Bold, <i>bold and elegant,

</b> or just plain elegant.</i>Instead, do it this way:

◦<b>Bold, <i>bold and elegant, </i> </b>or just plain elegant. </i>

Page 5: Text Formatting and Font Control. Boldface, Italics, and Special Formatting Way back in the age of the typewriter, we were content with plain text and

Boldface, Italics, and Special FormattingYou can also use italics within

headings, but boldface usually won’t show in headings because they are already bold.

There are actually two ways to make text display as boldface; the <b> tag and the <strong> tag do the same thing in most Web browsers. Likewise, all popular browsers today interpret both<i> and <em> as italics.

Page 6: Text Formatting and Font Control. Boldface, Italics, and Special Formatting Way back in the age of the typewriter, we were content with plain text and

HTML Tags That Add Special Formatting to text

Tag Function

<small> Small text

<big> Big Small text

<sup> Superscript

<sub> Subscript Small

<strike> Strikethrough Small (draws a line through text)

<u> Underline Small

<em> or <i> Emphasized (italic) text

<strong> or <b>

Strong (boldface) text

<tt> Monospaced Small typewriter font

<pre> Monospaced Smallfont, preserving spaces and line breaks

Page 7: Text Formatting and Font Control. Boldface, Italics, and Special Formatting Way back in the age of the typewriter, we were content with plain text and

Font Size and Color There may be times when you’d

just like a bit more control over the size and appearance of your text while maintaining as much compatibility with older Web browsers as possible. For those times, you can use the officially discouraged but widely used <font> tag.

Page 8: Text Formatting and Font Control. Boldface, Italics, and Special Formatting Way back in the age of the typewriter, we were content with plain text and

Font Size and Color For example, the following HTML

will change the size and color of some text on a page:◦<font size=5 color=“purple”> this

text will be big and purple. </font>The size attribute can take any

value from 1(tiny) to 7 (fairly big), with 3 being the default size.

Page 9: Text Formatting and Font Control. Boldface, Italics, and Special Formatting Way back in the age of the typewriter, we were content with plain text and

Font Size and Color The color attribute can take any

of the following standard color names:◦Black, White, Red, Green, Blue,

Yellow, Aqua, Fuchsia, Gray, Lime, Maroon, Purple, Navy, Olive, Silver, or Teal

Page 10: Text Formatting and Font Control. Boldface, Italics, and Special Formatting Way back in the age of the typewriter, we were content with plain text and

Choosing a TypefaceThe <font face> attribute allows

you to specify the actual typeface that should be used to display text.

Times New Roman is the default typeface.

Page 11: Text Formatting and Font Control. Boldface, Italics, and Special Formatting Way back in the age of the typewriter, we were content with plain text and

Special CharactersMost fonts now include special

characters for European languages, such as the accented é in Café. There are also few mathematical symbols and special punctuation marks such as the circular • bullet.

For example, the word Café would look like this:◦Caf&#233;

Page 12: Text Formatting and Font Control. Boldface, Italics, and Special Formatting Way back in the age of the typewriter, we were content with plain text and

Important English-Language Special Characters

Character

Numeric Code

Code Name

Description

“ &#34; &quot; Quotation mark

& &#38; &amp; Ampersand

< &#60; &lt; Less than

> &#62; &gt; Greater than

¢ &#162; &cent; Cent sign

£ &#163; &pound; Pound sterling

¦ &#168; &brvbar; or brkbar;

Broken vertical bar

§ &#167; &sect; Section sign

© &#169; &copy; Copyright

Page 13: Text Formatting and Font Control. Boldface, Italics, and Special Formatting Way back in the age of the typewriter, we were content with plain text and

Important English-Language Special Characters

Character

Numeric Code

Code Name

Description

® &#174; &reg; Registered mark

° &#176; &deg; Degree sign

± &#177; &plusmn; Plus or minus

² &#178; &sup2; Superscript two

³ &#179; &sup3; Superscript three

· &#183; &middot; Middle dot

¹ &#185; &sup1; Superscript one

¼ &#188; &frac14; Fraction one-fourth

½ &#189; &frac12; Fraction one-half

¾ &#190 &frac34; Fraction three-fourths

Page 14: Text Formatting and Font Control. Boldface, Italics, and Special Formatting Way back in the age of the typewriter, we were content with plain text and

Important English-Language Special Characters

Character

Numeric Code

Code Name

Description

Æ &#198; &AElig; Capital AE ligature

æ &#230; &aelig; Small ae ligature

É &#201; &Eacute; Accented capital E

é &#233; &eacute; Accented small e

× &#215; Multiplication sign

÷ &#247; Division sign

Page 15: Text Formatting and Font Control. Boldface, Italics, and Special Formatting Way back in the age of the typewriter, we were content with plain text and

HTML Tags and Attributes CoveredTag Attribute Function

<em>…</em> Emphasis (usually italic)

<strong>…</strong>

Stronger emphasis (usually bold)

<b>…</b> Boldface text

<i>…</i> Italic text

<tt>…</tt> Typewriter (monospaced) font

<pre>…</pre> Preformatted text (exact line endings and spacing will be preserved – usually rendered in a monospaced font)

<big>…</big> Text is slightly larger than normal

<small>…</small> Text is slightly smaller than normal

<sub>…</sub> Subscript

Page 16: Text Formatting and Font Control. Boldface, Italics, and Special Formatting Way back in the age of the typewriter, we were content with plain text and

HTML Tags and Attributes CoveredTag Attribute Function

<sup>…</sup> Superscript

<strike>…</strike>

Puts a strikethrough intext

<font>…</font> Controls the appearance of the enclosed text

size=“…” The size of the font, from 1 to 7. Default is 3. Can also be specified as a value relative to the current size; for example, +2 or -1

color=“…” Changes the color of the text

face=“…” Name of font use if it can be found on the user’s system. Commas can separate multiple four names, and the first font on the list that can be found will be used.

Page 17: Text Formatting and Font Control. Boldface, Italics, and Special Formatting Way back in the age of the typewriter, we were content with plain text and

WorkshopWrite the HTML to produce the

following:◦Come for cheap H2O on May 7th at

9:00PM

How would you say, “We’re having our annual Impeachment Day SALE today,” in normal-sized blue text, but with the word “SALE” in the largest possible size in bright red?

How do you say “© 1996, Webwonks Inc.” on a Web page?