Inline Styles

Vine

This lesson: Overview | SyntaxExample | Exercise   
Other lessons:  Style Syntax | Order of Precedence | Style Properties | Other Style Information
Intro. to Styles | Inline Styles | Embedded Style Sheets |
Linked Style Sheets

Overview

Syntax

<TAG STYLE="property: value; property: value"></TAG>

<P STYLE="font-size: 10pt; color: green">Example of an Inline Style</P>

Example

<body style="font-family: JunkFont1, Arial, sans-serif">

<h1 style="font-size: 20pt; font-weight: bold; color: #FF0000; text-align: center">This web page uses inline styles.</h1>

<h2 style="background-color: #CCCCFF; text-align: center">Generic Font Families</h2>

<blockquote style="color: green">Serif...Fixedsys</blockquote>

<address style="font-size: 10pt; text-align: center">This page...2002</address>

 

Exercise: Create Inline Styles

Method 1 - Using a Text Editor

  1. Type the code below.  

<html>
<head>
<title>Exercise: Using Inline Styles</title>
</head>
<body style="font-size: 18pt">
<h1 style="font-family: Impact, Cooper Black, sans-serif; text-align: center; background-color: yellow">Exercise: Using Inline Styles</h1>
<p>The inline style formats the body text as 18 points.  It also formats a heading 1 paragraph so that it uses the Impact or Cooper Black Font.  If those fonts are not available, then a sans-serif font is used.  Heading 1 is also formatted with a center text alignment and a yellow background.</p>

</body>
</html>

  1. Save the file with the name of:  exercise-inline.htm .
  2. View the web page in a browser.

Method 2 - Using FrontPage

  1. Open a blank page in FrontPage.
  2. Change the title that appears in the browser's title bar to:  Exercise: Using Inline Styles.
  3. Type the text below.
         OR
    Open the file, exercise-inline-text-2.txt.  Copy the text and paste it as a Normal paragraph into the blank page (in Normal view).  To paste as Normal, select Edit/Paste Special from the menu.  At the Convert Text dialog window, click on the option for Normal Paragraphs.

Exercise: Using Inline Styles

An inline style centers the first paragraph.  Another inline style creates a first line indent for the second paragraph as well as double-spacing the paragraph.

Center Paragraph

  1. Right-click in the first paragraph.  From the pop-up menu, click on Paragraph.
  2. At the Paragraph dialog window, click the drop-down arrow next to Alignment.  Click on Center.
  3. Click OK.

Indent First Line and Double-space Paragraph

  1. Right-click in the second paragraph.  From the pop-up menu, click on Paragraph.
  2. At the Paragraph dialog window, type the number 20 in the Indent First Line box.
  3. Click the drop-down arrow next to Line Spacing and click on Double.
  4. Click OK.
  5. Save the file with the name of:  exercise-inline-fp.htm .
  6. View the HTML tags by clicking on the HTML tab.

Penn State Behrend Home | Computer Center Home

This page is maintained by Carolyn Dudas
Updated May 21, 2002