Introduction to CSS

Introduction to CSS thumbnail
Cascading Style Sheets (CSS) define the styles on your web pages.

Cascading Style Sheets (CSS) were created by the World Wide Web Consortium, known as W3C. The W3C have set the international standards for the web since its inception in 1994. As web sites grew more complex, a standardized format for controlling the growing number of colors and fonts became necessary. Using CSS meant that the formatting information could be stored in a separate file from the HTML data, and would also allow format changes to be applied universally to all web pages---saving a lot of work for web programmers and designers.

  1. Style Sheets

    • Style sheets are generally thought of as document "rules." These rules dictate the properties, or parameters for HTML tags, and define how a document will appear. Web pages load much more quickly and consistently with style sheets. And if the browser is unable to display the web page as intended, style sheets can ensure a backup or default style will still happen.

    CSS Properties

    • There are six main categories of CSS properties: color, fonts, text, boxes, positioning, and classification. Color properties refers to both text and background colors. Font properties include the sizes of all fonts used in the style sheets. Text properties involve all word and letter spacing, and any specialized text, such as underlining. Box properties define margins and borders, while positioning properties manage the layout of web pages. Classification properties handle an element's display, white space and list elements.

    CSS Rules

    • CSS style rules assign a specified style to an HTML tag. For example, if we wanted all second-level headers on a website to be blue, we would place the information in brackets using either the color name, or hexadecimal color code, which would display as: h2 {color: blue;} or h2 { color: # 003F87; }.

      Additional rules assigned to the same tag would be designated by semicolons. As a result, you could set the header's color, font, and other specifics on the same line of text within the same brackets: h2 {color: blue; background-color: white; font-family: Helvetica, sans-serif;}.

    Adding Style Sheets

    • You will need to link the style sheets to your document, which can be done in a few different ways. The first way is to use a link tag, such as: <link rel="stylesheet" href="styles.css" type="content/css" />.

      Another way is to define the style rules in the HTML document header, by using the style tag: <style type="text/css">.

      The other way to link your style sheets to the document is by using a style attribute with an HTML markup tag.

    Browser Compatibility

    • When using CSS, browser compatibility can sometimes be a challenge. Different browsers may display CSS in various ways, so researching how your web page will show up in each of the most commonly used browsers is a good idea. It is also smart to check your HTML and CSS for mistakes, since even the smallest error can affect the way your content displays. Also, take advantage of the W3C's free online validator (validator.w3.org/) to be certain your style sheets meet current web standards.

Related Searches:

References

Resources

  • Photo Credit website layout image by 6922Designer from Fotolia.com

Comments

You May Also Like

  • How to Remove Indents on Bullets in CSS

    In Web design, you use the unordered list -- "<ul>" -- tag to create bullet lists. By default, browsers indent lists by...

  • How to Use CSS Display Properties for Grid Layouts

    The CSS display property allows you to set up rules for display that make your content display as a grid or as...

  • About ICD-9 Codes

    Everyone has generally heard of the International Classification of Diseases (ICD) Version 9, but beyond the term, most do not realize the...

  • How to Protect Web Page Images in CSS

    You cannot prevent Internet users from copying your HTML and Web images. Internet surfers can simply click "View Source" and see your...

  • Meaning of Brackets in CSS

    CSS stands for "cascading style sheets." CSS gives a greater degree of artistic and design control to Web developers and designers by...

  • How to Prevent Hyperlinks From Changing Color

    A hyperlink, or link, is Web page content that is typically colored and underlined so that your visitor knows to click it...

  • What Are CSS Templates?

    To understand what Cascading Style Sheets templates are, first you need to understand what CSS is and what its advantages are. With...

  • Wisconsin Land Use Classification

    Wisconsin Land Use Classification. Wisconsin has a diverse environmental layout with cities, forests and lakes. The United States Geographic Survey provides land...

  • Web Design Script for Text Color

    Setting text color in web design involves knowing HTML code for the hexadecimal colors. Code text color on an HTML website with...

Related Ads

Featured