CSS.LGS
CSS.txt
CASCADING STYLE SHEETS:
---------------------------------------------
A stylesheet is a separate component that is merged with HTML pages.
It is used for giving a special appearance to an HTML page.
Syntax:
selector {
key:value;
}
It is a key/value pair where value can be predefined/user-defined.
more than one key/value pair can be joined by a semicolon.
stylesheet syntaxes are highly case-sensitive and all keys are generally in small cases.
-----------------------------------------------------------------------------------------------------------------------------------------------
There are three types of stylesheets:
1. External Stylesheet:
A seperate file is created with extension as .css. This css file is then linked into the HTML page as:
ex-
<link href="yourcssfile.css" rel="stylesheet" />
Link tag must be written inside <head> tag.
2. Internal Stylesheet:
It is specific to one particular page.
syntax:
<head>
<style>
selector {
property: value;
}
</style>
</head>
3. Inline Stylesheet:
It is specific to one particular HTML element/tag. All HTML elements have \"style\" attribute.
This attribute is used to specify stylesheet key/value pairs.
More than one key/value pairs are joined by a semicolon.
ex-
<table style="background-color: red; color: blue; font-weight: bold;">
...
</table>
------------------------------------------------------------------------------------------------------------------------------------------------------
Stylesheet can be written in 3 ways:
1. stylesheet for an element/tag-
for <body>:
syntax:
body {
background-color: blue;
}
for <p>:
syntax:
p {
background-color: cyan;
color: blue;
font-weight: bold;
}
2. stylesheet class- A class is used to group certain HTML elements together.
A class is created using a . (dot)
ex:
.myclass1 {
background-color: blue;
color: white;
font-weight: bold;
}
3. stylesheet id- It is a unique identifier for an HTML element.
An id is used using a # symbol
ex:
#myid
{
background-color: blue;
color: cyan;
font-weight: bold;
}
-------------------------------------------------------------------------------------------------------------------------------
Comment:
css comment:
/*
single/multine comment....
*/style.css
h1 { text-align: center; text-decoration: underline; text-decoration-color: black; text-decoration-style: wavy; border-style: dotted; border-color: rgb(216, 91, 91); font-family:'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif; } p{ font-family: cursive; } a{ text-decoration: none; color:black }
Comments
Post a Comment