Computer Networking concepts

Thursday, 27 March 2014

CSS INTRODUCTION

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:
  1. Internal CSS
  2. External CSS
  3. Inline CSS
  4. In-line
  5. In-line styles are plonked straight into the HTML tags using the  style attribute.
  6. They look something like this:
7.   
8.   <p style="color: red">text</p>
  1. Internal
  2. 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>

No comments:

Post a Comment