CSS (Cascading Style Sheets) have been around for a while now,
and act as a complement to plain old HTML files. Style sheets
allow a developer to separate HTML code from formatting rules
and styles. It seems like many HTML beginners’ under-estimate
the power and flexibility of the style sheet. In this article,
I’m going to describe what cascading style sheets are, their
benefits, and two ways to implement them.
Cascading Style Sheets…that’s what! They’re what paint is to
canvas, what topping is to ice cream… they complement HTML and
allow us to define the style (look and feel) for our entire site
in just one file!
Cascading style sheets were introduced to the web development
world way back in 1996. They get their name from the fact that
each different style declaration can be “cascaded” under the one
above it, forming a parent-child relationship between the
styles.
They were quickly standardized, and both Internet Explorer and
Netscape built their latest browser releases to match the CSS
standard (or, to match it as closely as they could).
So, you’re still asking what a style sheet exactly is? A style
sheet is a free-flowing document that can either be referenced
by, or included into a HTML document. Style sheets use blocks of
formatted code to define styles for existing HTML elements, or
new styles, called classes.
Style sheets can be used to change the height of some text, to
change the background color of a page, to set the default border
color of a table…the list goes on and on. Put simply though,
style sheets are used to set the formatting, color scheme and
style of an HTML page.
Style sheets should be used instead of the standard , , and tags because:
- One style sheet can be referenced from many pages, meaning
that each file is kept to a minimum size and only requires only
extra line to load the external style sheet file
- If you ever need to change any part of your sites look/feel,
it can be done quickly and only needs to be done in one place:
the style sheet.
- With cascading style sheets, there are many, many page
attributes that simply cannot be set without them: individual
tags can have different background colors, borders, indents,
shadows, etc.
Style sheets can either be inline (included as part of a HTML
document), or, referenced externally (Contained in a separate
file and referenced from the HTML document). Inline style sheets
are contained wholly within a HTML document and will only change
the look and layout of that HTML file.
Open your favorite text editor and enter the following code.
Save the file as stylesheet.html and open it in your browser:
Cascading Style Sheet Example < itle>
This is one big H1 tag!
When you fire up your browser, you should see the text "This is
one big H1 tag!" in a large, blue Verdana font face.
Let’s step through the style code step by step. Firstly, we have
a pretty standard HTML header. The page starts with the
tag followed by the tag. Next, we use a standard
tag to set the title of the page we are working with.
Notice, though, that before the tag is closed, we have
our tag.
When you add the style sheet code inline (as part of the HTML
document), it must be bound by tags
respectively. Our example is working with the
tag. We are
changing three attributes of the
’s style: the text color
(color), the font that any
tags on the page will be
displayed in (font-family), and lastly, the size of the font
(size).
The code between the { and } are known as the attributes. Our
sample code has three. Try changing the hexadecimal value of the
color attribute to #A00808 and then save and refresh the page.
You should see the same text, just coloured red instead of blue.
--------------------------------------- An example of an
external style sheet ---------------------------------------
External style sheets are similar to internal style sheets,
however, they are stripped of the tags, and
need to be referenced from another HTML file to be used.
Create a new file called “mystyle.css” and enter the following
code into it:
Next, create a HTML file and name it external.html. Enter the
following code into external.html:
External Style Sheet Reference Example <
itle>
This is one big H1 tag!
As mentioned above, you can see that the actual code in
mystyle.css is exactly the same as it was in the inline example.
In our HTML file, we simply place a tag in the
section of our page. The rel=”stylesheet” attribute tells the
browser that the link to the external file is a style sheet. The
type=”text/css” attribute tells the browser that mystyle.css is
a text file containing css (cascading style sheet) declarations.
Lastly, the href=”mystyle.css” attribute tells the browser that
the actual file we want to load is mystyle.css.
Well, there you have it, a quick look at style sheets and how to
implement both an inline and external version. Checkout the
links below if you’ve never worked with cascading style sheets
before. You will be surprised at some of the things you can do
with them!
My little confession.. I have a friend George is his name..and he over the years has been teaching me some html coding..well I decided to tackle html and css (css ..cascading style sheet) on a full time basis..more like doing one or two things learning each ...
Reference:Getting Out Of Google Purgatory -- The Supplemental Index Use Cascading Style Sheets instead of tables to lay out your pages. Check all your pages with the W3C validator ( http://validator.w3.org/ ) or similar tool and correct all errors. 3. Eliminate duplicate and scraped content. ...
cascadenik: cascading sheets of style for mapnik (Hakon Wium Lie, Cascading Style Sheets). Mapnik, the open source map rendering library I've written about recently, uses an XML language similar in spirit to SLD for applying visual style to map vector data. ...
IE8: Internet Explorer Filters and Transitions You can implement these effects in Web pages using Cascading Style Sheets (CSS) properties. By combining filters and transitions with basic scripting, you have a powerful tool for creating visually engaging and interactive documents. ...
Professional CSS: Cascading Style Sheets for Web Design 2nd Edition Professional CSS: Cascading Style Sheets for Web Design, 2nd Edition 2008 PDF | 323 Pages | English | May 2008 | 14 MB Download Link : http://rapidshare.com/files/141274886/Professional_CSS_Cascading_Style_Sheets_for_Web_Design_2008.rar ...
New Style Dialog Box New Style Dialog Box The New Style dialog box provides options that let you define cascading style sheet (CSS) style attributes. A CSS style combines individual formatting and positioning attributes into an attribute set that you can ...
Font, Style Builder Dialog Box Font, Style Builder Dialog Box The Font page of the Style Builder dialog box makes it possible for you to define cascading style sheet (CSS) font attributes. You can apply these attributes directly to HTML elements, or you can add them ...
Web site Acronyms and Definitions ... xhtml: - Extensible Hypertext Markup Language; https: - Hypertext Transfer Protocol over Secure Socket Layer; sql: - Structured Query Language; XML: - Extensible Markup Language; CSS: - Cascading Style Sheet; DOM: - Document Object ...
cascadenik: cascading sheets of style for mapnik cascadenik: cascading sheets of style for mapnik. Great idea. Mapnik (the open source tile rendering system used by OpenStreetMap and others) has a complex style configuration based on XML. Michal Migurski has build a CSS-style ...
Offline Explorer Enterprise 5.1.2820 SR1 Support of industry-standard technologies such as FTP, different proxy servers, Java and VB scripts, Java classes, Cascading Style Sheets (CSS,) Macromedia Flash, XML/XSL/DTD, Table Of Contents (TOC,) Acrobat (PDF,) M3U, AAM files, ...