Style Syntax

Vine

Overview

Styles have their own unique syntax.  Embedded (internal) style sheets and linked (external) style sheets follow the same syntax.  A different syntax is used for inline styles.

Syntax for Inline Styles

The syntax for inline styles is slightly different than those of the other style types.  Inline styles:

This is the syntax for inline styles:

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

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

Syntax for Embedded and Linked Style Sheets

The syntax for embedded and linked style sheets are the same.  These two style types:

This is the syntax for embedded and linked style sheets:

Tag { property: value; property: value }

Here are a few variations of the above syntax:

Tag, Tag, Tag { property: value; property: value }

Tag.class { property: value; property: value }

H1, H2, H3 { font-size: 20pt; color: red }

H4  { font-size: 16pt; color: navy }

H5.Indent { font-size: 12pt; margin-left: 50pt }

However, embedded and linked style sheets differ in several ways:

Location of Style Information for Embedded Style Sheets

The style information for an embedded style sheet is located within the web page.  Further, 

<HEAD>
<STYLE>
<!--
H4 { font-size: 16pt; color: navy }
-->
</STYLE>
</HEAD>

Location of Style Information for Linked Style Sheets

The style information for a linked style sheet is placed in a separate file.  Further, 

H1, H2, H3 { font-size: 20pt; color: red }
H4 { font-size: 16pt; color: navy }
H5.Indent { font-size: 12pt; margin-left: 50pt }

<LINK rel="stylesheet" type="text/css" href="filename.css">

<HEAD>
<LINK rel="stylesheet" type="text/css" href="mystyles.css">
</HEAD>

OR

<HEAD>
<LINK rel="stylesheet" type="text/css" href="http://www.mysite.edu/styles/mystyles.css">
</HEAD>

Additional Syntax Notes

Anatomy of a Style

Penn State Behrend Home | Computer Center Home

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