Css Properties
Css Properties
HEX value - like "#ff0000" The background- body {
Background color property is used background-
an RGB value - like
Color to set the background color: #f0e68c;
"rgb(255,0,0)"
color of an element. }
a color name - like "red"
;
By default body {
background-image: the background- background-
Background -
url("abc/leaf.jpg"); image property image:
Image
repeats an image both url("leaf.jpg");
horizontally and }
vertically.
repeat-x; You can set a body {
background image background-
repeat-y; repeat vertically (y- image:
no-repeat; axis), horizontally (x- url("gradient.png");
axis), in both background-
directions, or in repeat: repeat-x;
background- neither direction. }
repeat:
background- : fixed; The background- body {
attachment attachment property
determines whether
the background image
is fixed with regard to background-
the viewport or scrolls image:
along with the url("recycle.jpg");
containing block. background-
attachment: fixed;
}
line-height:
Note: The order of a:link { /*
Styling Links (a) a:link : the pseudo classes unvisited link */
should be the color: #FF0000;
Set styles for a unvisited following: :link, :visit text-decoration:
a:link ; links that has no mouse ed, :hover, :active, :fo none;
pointer over it. cus in order for these }
a:visited to work properly. a:visited { /*
a:visited :Set styles for a visited link */
a:hover link the user has visited but color: #00FF00;
has no mouse pointer on it }
a:active a:hover { /*
a:hover: mouse over link */
color: #FF00FF;
Set styles for a link when text-decoration:
the user place the mouse underline;
pointer over it. }
a:active: a:active { /*
Set styles for a link that is active link */
in the process of being color: #0000FF;
clicked }
Position:absolute=>
An absolutely positioned
element is positioned
relative to the first parent
element
Position:fixed
Floating Float:left/right/none
Elements Note: This property can
clear an element only
Float: from floated boxes within
the same block. It doesn't
clear: left; clear the element from
floated child boxes within
the element itself.
CSS position in
conjunction with
the left, right, top and bot
tom property
Using anchor pseudo- a:link {
Pseudo-class classes links can be color: blue;
displayed in different ways }
a:visited {
text-decoration:
none;
}
CSS3 introduced a new p::first-line { Note: The CSS
Pseudo-elements double-colon (::) syntax for color: #ff0000; properties that can
pseudo-elements font-variant: be applied to
small-caps; the ::first-
} line pseudo-
element are: font
properties, backgro
und
properties, color, w
ord-spacing, letter-
spacing, text-
decoration, vertical
-align, text-
transform, line-
height.
The ::before and ::after pse @media screen{ h1::before {
::before and udo-elements can be used body { content:
::after Pseudo- to insert generated content color: #32cd32; url("images/marker
either before or after an font-family: -left.gif");
element element's content. Arial, sans-serif; }
Pseudo-elements font-size: 14px; h1::after {
p.article::first-letter {
and CSS Classes } content:
color: #00ff00;
font-size: xx-large; } url("images/marker
} @media print { -right.gif");
Media type
<style> body { }
@import color: #ff6347;
url("css/screen.css") screen; font-family:
@import Times, serif;
url("css/print.css") print; font-size: 12pt;
body { }
background: #f5f5f5; }
line-height: 1.2;
@media screen, print
}
</style> {
body {
line-height: 1.2;
}
}
p{
opacity opacity: 0.7;
}
[title] {
[attribute] color: blue;
Selector }
a[target="_blank "] {
border: 1px solid green;
}
Colors
rgba colors Red,green,blue,alpha #p1 {background
-
color: rgba(255
, 0, 0,
0.3);} /* red
with opacity */
RGB
HEXA