2. INTRODUCTION
CSS Stands for Cascading Style Sheets
It is used for Designing Stylized Websites
All the css files are saved with the file
extension .css
CSS was introduced together with HTML 4,
to provide a better way to style HTML
elements.
3.
4. Three Types of CSS:
1. Inline CSS - using the style attribute in
HTML elements.
2. Internal CSS - using the <style></style>
tag in the <head> section.
3. External CSS - using an external CSS file.
7. EXTERNAL CSS
In external CSS, we write CSS codes in a separate
file and include that CSS file with the HTML file.
We include CSS file in the HTML file by writing the
following line in the head section of html:
<link type=“text/css” rel=“stylesheet”
href=“style.css” >
8. INLINE CSS
Example:
<p style=“ color:red; ”>Welcome !</p>
<h2 style=“ color:blue; font-size:50px;
”>The is a Heading !</h2>
9. Text Color : body {color:blue;}
Text Alignment : h1 {text-align:center;}
Text Decoration:
h1 {text-decoration:overline;}
h2 {text-decoration:line-through;}
h3 {text-decoration:underline;}
Font Family : p{font-family:"Times New Roman”;}
Font Size : h1 {font-size:40px;}
Background Color : body {background-color:green;}
12. The id Selector
The id selector is used to specify a style for
a single, unique element.
The id selector uses the id attribute of the
HTML element, and is defined with a "#".
13. The class Selector
The class selector is used to specify a style for a
group of elements. Unlike the id selector, the
class selector is most often used on several
elements.
This allows you to set a particular style for many
HTML elements with the same class.
The class selector uses the HTML class attribute,
and is defined with a "."
In the example below, all HTML elements with
class="center" will be center-aligned:
.center {text-align:center;}