CSS (Cascading Style Sheets) is a markup language used to style and lay out web documents. There are three types of CSS: external style sheets, internal style sheets, and inline styles. External style sheets are ideal for applying styles to many pages, internal style sheets are used for styling a single document with unique styles, and inline styles are applied directly to HTML elements but lose advantages of style sheets.
Report
Share
Report
Share
1 of 15
More Related Content
Cascading Style Sheet (CSS)
2. OUTLINES
• What is CSS?
• Syntax
• Comments
• Example
• Types of CSS
• External style sheet
• Internal style sheet
• Inline style sheet
3. WHAT IS CSS?
• CSS stands for Cascading Style Sheets
• Markup language used in the web document for
presentation purpose.
• Various elements like text, font and color are used in
CSS for presentation.
• Can be used to bring styles in the web documents.
• By combining with HTML document, flexibility of
content is achieved.
4. SYNTAX
• A CSS rule has two main parts: a Selector and one or
more Declarations:
• The selector is the HTML element you want to style.
• Each declaration consists of a property and a value.
• The property is the style for the attribute you want to
change.
• Each property has a value.
5. COMMENTS
• A CSS comment begins with "/*", and ends with
"*/", like this:
• /*This is a comment*/
• Eg: p
{
text-align: center;
/*This text is center align*/
color: black;
font-family: arial;
}
6. EXAMPLE
• CSS declarations always end with a semicolon, and
declaration groups are surrounded by curly brackets:
p {color: red; text-align: center;}
• To make the CSS more readable, you can put one
declaration on each line, like this:
p
{
color: red;
text-align: center;
}
8. TYPES OF CSS
• There are 3 types of cascading style sheet:
1) External style sheet.
2) Internal style sheet.
3) Inline style.
9. EXTERNAL STYLE SHEET
• Ideal when applied to Many Pages.
<head>
<link rel=“stylesheet” type=“text/css” href="mystyle.css"/>
</head>
• An external style sheet can be written in any text editor.
• Your style sheet should be saved with a .css extension.
• Eg:
hr {color: sienna;}
p {margin-left:20px;}
body {background-image: url("images/back40.gif");}
11. INTERNAL STYLE SHEET
• It should be used when a Single Document has a unique
style.
• You can define internal styles in the head section of an
HTML page, by using the <style> tag, like this:
• Eg:
<head>
<style type="text/css">
hr {color: sienna;}
p {margin-left:20px;}
body {background-image: url("images/back40.gif");}
</style>
</head>
13. INLINE STYLE SHEET
• An inline style loses many of the advantages of a
style sheet.
• To use inline styles, add the style attribute to the
relevant tag.
• The style attribute can contain any CSS property.
• E.g.
<h1 style="color:blue;margin-left:30px;">This is a
heading.</h1>