c-- styles for logos and headline links do not modify internet, red, or black styles -->

Intranet Journal   Earthweb  
Events Jobs Premium Services Media Kit Network Map E-mail Offers Vendor Solutions Webcasts

   Intranet Journal Subjects
Search Earthweb

Privacy Policy



internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

internet commerce
Be a Commerce Partner
















 

[ Home | Discussion Forum | How Do I... | Lotus Notes Intranets | Microsoft SharePoint | Products | Shopping  ]

free news!

CSS Tutorial Part II

CSS Pseudo Classes and Elements


Nana Gilbert-Baffoe

Printer Friendly Version

CSS pseudo classes and elements are used to work with certain aspects of a pages formatting that can't be accessed using plain old HTML tags. For example, there isn't a tag to indicate a page has been visited, and there are no tags to indicated the first letter or first like of a block of text'this is where the CSS pseudo class and elements come in handy. Let's take a quick review of a few of them.

 

:active, :hover, :link and :visited

These four pseudo classes should be familiar to you, possibly with the exception of the: hover class'the: active class sets styles for active links, :hover sets styles for when the mouse hovers over a link, :link sets style properties for links and :visited is used for visited links.

 

Try It Out - The :hover property

<html>

<head>

<title>The :hover property</title>

<style type="text/css">

<!--

A:hover {color:#00ccff}

-->

</style>

</head>

<body>

<a target=blank href="http://www.s2snetwork.com">

Visit the S2SNetwork

</a>

</body>

</html>

 

How it Works

 

:first-letter and :first-line

The :first-letter element can be used to set style for the first letter of text contained in an element such as a DIV and the :first-line element does the same thing for the first line of an element'this code snippet shows how these work

<html>

<head>

<title>The first-line and first-letter properties</title>

<style type="text/css">

<!--

DIV:first-letter {font-size:large}

P:first-line {color:blue}

-->

</style>

</head>

<body>

<div>

content

... </div>

<P>Testing the first-line element<br>

This is the second line

</p>

</body>

</html>

Summary

I hope that by now you are starting to understand and appreciate the power of CSS. If you. ve read both the first and second parts of this series, you should be well on your way to your next great project; converting your old pages to take advantage of what CSS has to offer'this should be a great way to solidify what we. ve covered up to this point. We. re now almost through with the series and have just a little bit more to cover'the next installment will include the following topics:

  • CSS Positioning
  • CSS Display Properties
  • CSS Cursor Property
  • What's next?

Back Page IV
Back Page I
Back Page II
Back Page III

About the Author

Nana Gilbert-Baffoe is founder of the S2SNetwork'the Student-to-Student Trading Network

Printer Friendly Version



CSS Tutorial Part II
-Introduction
-CSS Background properties
-CSS Classification properties
-CSS and Printing
-CSS Pseudo Classes and Elements

CSS Tutorial Part I

Of Interest
· Intranet eXchange Discussion Board

· Advice and Opinions