INTRODUCTION OF CSS
CSS was first developed
in 1997, as a way for Web developers to define the look and feel of their Web
pages. It was intended to allow developers to separate content from design so
that HTML could perform more of the function that it was originally based on -
the markup of content, without worry about the design and layout.
WHERE CSS USED?
CSS is used to style
Web pages. But there is more to it than that. CSS is used to style XHTML and
XML markup. This means that anywhere you have XML markup (including XHTML) you
can use CSS to define how it will look.
CSS is also used to
define how Web pages should look when viewed in other media than a Web browser.
For example, you can create a print style sheet that
will define how the Web page should print out and another style sheet to
display the Web page on a projector for a slide show.
It may be three types:
- Internal CSS
- External CSS
- Inline CSS
- In-line
- In-line
styles are plonked straight into the HTML tags using the style attribute.
- They look something like this:
7.
8. <p style="color: red">text</p>
- Internal
- Embedded,
or internal, styles are used for the whole page. Inside the head element, the style tags surround all of the styles
for the page.
<!DOCTYPE
html>
<html>
<head>
<title>CSS
Example</title>
<style>
p {
color: red;
}
a {
color: blue;
}
</style>
External
External styles are used for the whole,
multiple-page website. There is a separate CSS file, which will simply look something
like:
p {
color: red;
}
a {
color: blue;
}
If this file is saved as “style.css” in the same directory
as your HTML page then it can be linked to in the HTML like this:
<!DOCTYPE
html>
<html>
<head>
<title>CSS
Example</title>
<link rel="stylesheet" href="style.css">
Apply!
<!DOCTYPE html>
<html>
<head>
<title>My first web page
</title>
<link rel=
"stylesheet"
href=
"style.css">
</head>
<title>My first web page
</title>
<link rel=
"stylesheet"
href=
"style.css">
No comments:
Post a Comment