CSS Notes
CSS Notes
1. Color Name: It will target the text color by directly specifying the
name of the color like blue, green, yellow, white, black, etc.
Syntax:
color: name-of-the-color;
Syntax:
Syntax:
font-variant: normal/small-caps;
Syntax:
body {
background-color:color-name;
}
6 ways to add color by using:- 1. Color-name
2. By Hexadecimal(#)
3. RGB(0-255,0-255,0-255)
4. HSL(0-360,0-100%,0-100%)
5. RGBA(0-255,0-255,0-255,0-
1)
6. HSLA(0-360,0-100%,0-100%,0-
1)
Directions:-
i. to bottom v. to top left
ii. to top vi. to top right
iii. to right vii. to bottom left
iv. to left viii. To bottom right
Directions:-
i. Circle at bottom v. Circle at top left
ii. Circle at top vi. Circle at top right
iii. Circle at right vii. Circle at bottom left
iv. Circle at left viii. Circle at bottom right
Image
Bottom center
Bottom-left Corner
Bottom-left Corner
Values :-
i. Top center v. top left ix) center center
ii. Bottom center vi. top right x) 20px 40px
iii. Right center vii. bottom left xi) top 50% left 50%
iv. Left center viii. bottom right
6. Background-attachment Property : The property
background-attachment property in CSS is used to specify
the kind of attachment of the background image with respect to
its container. It can be set to scroll or remain fixed.
Values:-
scroll: It sets the background image to get fixed at its
position with respect to the containing element and scroll
with the page. It is the default value.
fixed: This property is used to set the background image to
fixed at its position with respect to the viewport.
local: This property is used to set the background image to
scroll along with the content of its container element instead
of the page.
Syntax:
background-attachment: scroll| fixed| local;
Syntax :-
background-clip: border-box |padding-box |content-box |
text
Firefox -moz-
Ms Edge -ms-
Opera -o-
Syntax :-
-webkit-background-clip: text;
Syntax:
h2 {
text-transform: values;
[values:-
Uppercase,lowercase,capitalize,none]
}
Syntax:
h2 {
text-decoration: values;
[values:- Underline, overline, line-
through,none]
}
}
Word-spacing: It is used to control the space between words.
Syntax:
h2 {
}
Offset-x: This property is required & used to specify the position
of horizontal shadow. It accepts the negative values.
Offset-y: This property is required & used to specify the position
of vertical shadow. It also accepts the negative values.
blur-radius: It is used to set the blur radius. Its default value is 0
& is optional.
color: It is used to set the color of the shadow. It is optional.
h2 {
top = 40px
right = 100px
bottom = 120px
left = 80px
div {
margin: 40px 100px 120px;
top = 40px
right and left= 100px
bottom = 120px
div {
margin: 40px;
}
top, right, bottom and left = 40px
}
Top and bottom = 150px
Right and left = auto
Padding Property :- CSS paddings are used to create space
around the element, inside any defined border.
padding-top: It is used to set the width of the padding area on
the top of an element.
padding-right: It is used to set the width of the padding area on
the right of an element.
padding-bottom: It is used to set the height of the padding area
on the bottom of an element.
padding-left: It is used to set the width of the padding area on
the left of an element.
top = 40px
right and left = 100px
bottom = 120px
Shorthand :- If the padding property has 2 values
Div{
padding: 100px 150px;
}
Border :- CSS border properties allow us to set the style, color, and
width of the border.
Values :- Hidden,visible,scroll
Values:-
i. static (default)
ii. relative
iii. absolute
iv. fixed
v. sticky
1. Static:-
It is the default position value for the element. Under
static position, elements are positioned according to
the normal flow of the page.
Note: left, right, top, and bottom properties will not
affect if the position is static.
2. Relative:-
Position element w.r.t its original position.
Elemnet will remain in browser, empty space is not occupied.
Left,Right,Top,Bottom is used to shift the position of an element.
3. Absolute :-
Position Element w.r.t its nearest parent.
Element will come out of the browser flow, empty space will be
occupied by succeeding element.
Left,Right,Top,Bottom is used to shift the position of an element.
4. Fixed :-
Fixed element does not follow normal document flow and
positions themselves relative to <HTML> tag. This
element always stick to the screen.
Positioned element w.r.t Viewport (Ex:- Chat with us).
5. Sticky :-
Position an element according to user scroll
Example:- Navigation/Header in websites.
Z-index :-
The z-index property is used to displace elements on the z-axis i.e in or
out of the screen. It is used to define the order of elements if they
overlap on each other.
This Property is used to position element on z-axis.
Example :- z-index: number(1,2,3,4…);
Transition-duration : This property allows you to determine how long it will take to
complete the transition from one CSS property to the other.
Or
OR
Shorthand Property :
transition: (property name) | (duration) | (timing function) |
(delay);
Animation Name :
To animate an element we have to provide animation to the element.
Example: Animation-name : Box1 ;
By this name {Box1} @keyframe will target the element for animation.
@keyframes identifier {
From{
}
}
2. Percentage :-
@keyframes identifier { We can use percentage. By using
0%{ percentage (%) we can target any
moment in the animation
background-color : red;
}
50% {
background-color : green;
}
100%{
background-color : red;
}
}
Value :-
1. normal Forward
2. Reverse
Reverse
3. Alternate
Forward
Reverse
4. alternate-reverse
Reverse
Forward