spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / authoring / style / sheets / headlines current pageTo page 2To page 3To page 4To page 5To page 6To page 7
[next]

Making Headlines With Cascading Style Sheets

Developer News
Sir Tim Talks Up Linked Open Data Movement
From L.A. to Vegas With 100GbE
Salesforce Rolls Out Big Summer '08 Update

By Christopher Schmitt (schmitt@cssbook.com)

[Editor's note: all linked examples in this tutorial will open in a new window.]

If you're Shakespeare, James Joyce, Anais Nin, or Ernest Hemingway, you don't really need to worry about how you present your text on your Web site. Your writing is enough to pull a reader in and make them read more. However if you aren't one of these famous writers, then your writing probably isn't on par. But, don't feel bad--I don't. I'm sure we know more HTML and CSS than they ever will and we can use these technologies to help attract our reader's attention.

Headers in Web pages--marked up with h1, h2, h3, h4, h5, or h6 elements--help the reader determine the purpose of sections in content. It also does one other thing: it helps the reader judge if the material is something they want to read. And if your header is visually stimulating, the odds are better that the section will capture your reader's eye. So, with a dash of design, we can utilize CSS to stylize those Web page headers to catch the reader's eye and encourage them to read on.

Designing with CSS

Graphic headers aren't a new idea to spice up a page layout. It's just that now Web builders have browsers that implement CSS specifications to such a degree that we can actually use CSS for what it was meant to: presentation. We can now stylize our headers and content without Web production hacks like font tags, single-pixel GIFs or spacer tags to mix content and presentation. So, if you properly mark up your content with HTML and style it with CSS, the content can remain untouched while you revise and refine the layout to your heart's content simply by editing the rules in the style sheet.

Apart from the ease of designing with CSS, we can now move away from the generic styles that browsers apply to headlines. Text wrapped solely in header elements--the h1, h2, h3, etc.--will be rendered in bold, flushed left and, depending on which element and browser, larger than the default text size. On its own, that effect on headers has an almost lifeless appearance. Now with CSS, we can add more visual flair to the page.

In the following examples, we will look at ways that CSS can help create more compelling headlines visually. First, we will start with a simple example, a "control," and then look at some of the possible ways to enhance it via CSS.

Before we begin, there's one note you should consider: These examples aren't geared for Netscape 4.x. In my opinion, it's time for us to move away from that browser and focus on the browsers that implement CSS better. With that noted, let's continue...

The Control Page

To start off creating headlines, let's look at an example of a generic headline and some text wrapped in a couple of HTML elements.

<h2><a name="results">Dewey defeats Truman</a></h2>

<p>Lorem ipsum dolor sit amet, consetetur 
 sadipscing elitr, sed diam nonumy eirmod tempor 
 invidunt ut labore et dolore magna aliquyam erat, 
 sed diam voluptua. At vero eos et accusam et justo 
 duo dolores et ea rebum. Stet clita kasd gubergren, 
 no sea takimata sanctus est Lorem ipsum dolor sit 
 amet. Lorem ipsum dolor sit amet, consetetur 
 sadipscing elitr, sed diam nonumy eirmod tempor 
 invidunt ut labore et dolore magna aliquyam erat, 
 sed diam voluptua. At vero eos et accusam et justo 
 duo dolores et ea rebum. Stet clita kasd gubergren, 
 no sea takimata sanctus est Lorem ipsum dolor sit 
 amet. Lorem ipsum dolor sit amet, consetetur 
 sadipscing elitr, sed diam nonumy eirmod tempor 
 invidunt ut labore et dolore magna aliquyam erat, 
 sed diam voluptua. At vero eos et accusam et 
 justo duo dolores et ea rebum. Stet clita kasd 
 gubergren, no sea takimata sanctus est Lorem 
 ipsum dolor sit amet.</p>

Now we will add some CSS declarations for the purpose of choosing some fonts, specifying some margins, and ensuring that text is black with a white background.

body
{
	color: #000;
	background-color: #fff;
	margin: 5em 5em 0 5em;
	font-family: 'Lucida Grande', Verdana, 
                     Geneva, Lucida, Arial, 
                     Helvetica, sans-serif;
}

As you can see, there is nothing fancy in this example. Just straightforward HTML and CSS. If you want to see how the control appears in your browser check here.


home / authoring / style / sheets / headlines current pageTo page 2To page 3To page 4To page 5To page 6To page 7
[next]



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
IBM eBook: Planning a Service Oriented Architecture
IBM eBook: Choosing the Right Architecture--What It Means for You and Your Business
Microsoft Article: Will Hyper-V Make VMware This Decade's Netscape?
Avaya Article: Using Intelligent Presence to Create Smarter Business Applications
Intel Go Parallel Article: Getting Started with TBB on Windows
Microsoft Article: 7.0, Microsoft's Lucky Version?
Avaya Article: How to Feed Data into the Avaya Event Processor
IBM Article: Developing a Software Policy for Your Organization
Microsoft Article: Managing Virtual Machines with Microsoft System Center
Intel Go Parallel Article: Intel Threading Tools and OpenMP
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
HP Video: StorageWorks EVA4400 and Oracle
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Red Gate Download: SQL Toolbelt and free High-Performance SQL Code eBook
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
Silverlight 2 App and Walkthrough: Leverage Silverlight 2 with SQL Server and XML
IBM Article: Enterprise Search--Do You Know What's Out There?
HP Demo: StorageWorks EVA4400
Microsoft Article: The Progress and Promise of Deep Zoom
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES
webref The latest from WebReference.com Browse >
Book Review: Head First JavaScript · Web Hosting Control Panels · Use Your Blog for Fast Search Engine Rankings
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
NetApp's Virtual Storage Strategy Crystallizes · F/MC Watch: A Cisco-Centric Approach · Olympic Time Trials Use Wi-Fi Mesh

Created: December 11, 2002
Revised: December 11, 2002

URL: http://webreference.com/authoring/style/sheets/headlines/