CSS Cascading Style Sheet: Introduction To CSS
CSS stands for Cascading Style Sheets. Styles
define how HTML elements are displayed, just like the font tag and the color
attribute in HTML. Styles are normally saved in files external to your HTML
documents. External style sheets enable you to change the appearance and layout
of all the pages in your Web, just by editing a single CSS document. If you have
ever tried to change the font or color of all the headings in all your Web
pages, you will understand how CSS can save you a lot of work. CSS is a
breakthrough in Web design because it allows developers to control the style and
layout of multiple Web pages all at once. We can define a style for each HTML
element and apply it to as many Web pages as we want. To make a global change,
simply change the style, and all elements in the Web are updated automatically.
Style Sheets allow style information to be specified in many ways. Styles can be
specified inside a single HTML element, inside the <head> element of an HTML
page, or in an external CSS file. Even multiple external Style Sheets can be
referenced inside a single HTML document. An external style sheet is
ideal when the style is applied to many pages. With an external style sheet, you
can change the look of an entire Web site by changing one file. Each page must
link to the style sheet using the
tag. The
tag goes inside the head section:
The browser will read the style
definitions from the file mystyle.css, and format the document according to it.
Internal Style Sheet An internal style sheet should be used when a single document has a unique
style. You define internal styles in the head section by using the <style> tag,
like this:
Inline Styles An inline style loses many of
the advantages of style sheets by mixing content with presentation. Use this
method sparingly, such as when a style is to be applied to a single occurrence
of an element.
Multiple Style Sheets
<link rel="stylesheet" type="text/css" href="styles/docs.css"> For example, the code above illustrates two linked style sheets that manage one web page. This code manages the default style of all your web pages and in addition it manages a support documentation directory with the docs.css file. Both stylesheets are located within a "styles" directory. This helps keep your default external style sheet from getting too lengthy. It is also quite easy to determine |