Cascading Style Sheets Made Easy Washington DC

This tutorial serves as a starting point for those interested in learning about the basics of CSS and how it can benefit your Web site.

Local Companies

AT&T Inc.
(202) 638-7876
785 7th St., NW
Washington, DC
Comcast
(202) 832-2001
900 Michigan Ave., NE
Washington, DC
ACT 1
703-418-0011
200 12th St S
Arlington, VA
Esp Group LLC
703-418-6311
1225 Jefferson Davis Hwy
Arlington, VA
American Broadband Productions
(202) 331-5556
1667 K St Nw Ste 400
Washington, DC
Verizon Washington, DC
(202) 392-3700
2055 L St., NW
Washington, DC
Cyveillance Inc
703-351-9766
1555 Wilson Blvd
Arlington, VA
Localnet Corp
703-528-1824
1700 N Moore St
Arlington, VA
Hard Corps Inc
703-521-5000
2120 Washington Blvd
Arlington, VA
Washington Area Network Services
(202) 291-7010
1142 Buchanan St NW
Washington, DC

provided by: 
Originally published at Internet.com


As the major browsers (Internet Explorer and Netscape) continued to add support for more and more tags, though, it became very difficult to create Web sites where the content was separated from the presentation layout.

In other words, the design and content became intertwined, making it difficult to make changes. The W3 (World Wide Web Consortium) created styles in response. Most modern browsers now support Cascading Style Sheets (CSS), which can save you a lot of work when designing a Web site. And instead of having the same styles in the tags of each page on the site, you can have an external style sheet to control the layout and styles of the entire site. This means that you can now change many elements of an entire Web site simply by changing one file!

Using CSS: Where?

There are two ways to define styles using CSS. The best way is generally to use an external CSS file so that you can control many different elements throughout the entire site instead of defining the same elements over and over in all of the HTML files.

To make use of CSS, simply insert the following code between the opening tag and the closing tag.

Simply insert that between the tags in a HTML document.

NOTE: For “path/to/stylesheet” insert the path from the HTML file you are editing to the CSS page.

The second way is to insert tags in the head tags. This is a good way to define specific styles you only use on one page; otherwise you will want to use an external file sheet for two big reasons: visitors only have to load the sheet once, and you can control the styles for the entire site by editing one page.

Formatting Text

Using CSS for formatting text is much easier than using tags everywhere! Let’s start formatting some text.

Open Notepad or favorite HTML editor, where you can copy and paste the following code: "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">




CSS: Cascading Style Sheets


I love CSS, its so easy to use and it makes changes much easier! I can do things in CSS that HTML can’t!



Personally, I use XHTML for every type of Web site now because it’s cleaner and more precise than HTML 4.01. After you’ve inserted the above code, save the file as index.html

Defining Styles

OK, now that we've covered how to reference a style, let's look at defining styles. Open a new notepad document and write the following.

Figure 1-1

If you want to insert a comment: /* Any text placed here will be ignored
You
Can
Have
Spaces
Too*/

When you’re done, save the file as style.css and open the index.html file again.

Refer to Figure 1-1 above for an explanation of each line (as shown below):

Line 1: h1 states you wish to define the style for the HTML tag h1; you can apply formatting just like this for other elements, for instance.

Line 2: Defines the color of the h1 tag

Line 3: Defines the font size of the h1 tag

Line 4: Indicates an end to the style for h1

Line 5: .content defines content as a class available for use in HTML. You can name it whatever you wish, but be sure to include the period. To use the style in html for a paragraph, use the following:

OR

Line 6: Defines the color of the style

Line 7: Defines the size of the style

Line 8: Defines the font to use. Using font-family you can specify which font to use if someone does not have the font you’re trying to use. For example, someone on a Mac may not have the same fonts as a PC user. By defining a few different fonts you can be sure your website will have a similar look and feel.

Here’s an application of inserting CSS information in an HTML file (index.html). Note the changes in bold text. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">





CSS: Cascading Style Sheets


I love CSS, it’s so easy to use and it makes changes much easier! I can do things in CSS not possible with HTML!



Figure 1-2

That’s it; now you can preview the index file in your browser. It’s that simple to format your text with CSS! Of course, there’s much more to CSS than this relatively simple example. This article serves as a starting point for those who have wanted to know about the basics of CSS and how it can benefit your Web site(s).

About the Author

Taylor Anderson is the owner of a successful web site development company in Memphis, TN. He enjoys sharing what he has learned with others in the hope that one day more Web masters will clean up their code! To learn more about what he offers, visit his website: Memphis Web Design.
Tutorial adapted from WebReference

Author: Taylor Anderson

Read article at Internet.com site

Featured Local Company

AT&T Inc.

2026387876
785 7th St., NW
Washington, DC

Related Local Events
ESRI International User Conference
Dates: 7/13/2009 - 7/17/2009
Location: Washington Convention Center
Washington, DC
View Details

Annual Technology for Government Reception
Dates: 6/10/2009 - 6/10/2009
Location: Renaissance Mayflower Hotel
Washington, DC
View Details

Real Secrets to Drive Website Traffic With SEO and Online News Releases
Dates: 6/3/2009 - 6/3/2009
Location: Mandarin Oriental, Washington, D.C
Washington, DC
View Details