Css Notes Parul
Css Notes Parul
It is use for change/control the color of the text, the style of fonts, the spacing between paragraphs,
how columns are sized , what background images are used or what background colors are used, layout
design, variations in display screen sizes as well as a variety of other effects.
What is requirement of CSS
• CSS Saves time and Work
• Easy maintenance
• Page Loading faster
• Superior styles to HTML
• Multiple device compatibility
• Offline browsing
• Platform independence
• It Solved a many Problems
Basic syntax and structure
A CSS document containing a selector and a declaration block.
The selector points to the HTML tag you want to style.
The declaration block contains number of declarations separated by semicolons.
Each and every declaration includes a property name and a value, separated by a colon.
1) Inline style
External style should not contain any html tags. HTML page must include a link to the style
sheet with the <link> tag.
[4]
CSS Box Model (Contd..)
Content - The content of the box, where text and images appear
Padding - Clears an area around the content. The padding is transparent
Border - A border that goes around the padding and content
Margin - Clears an area outside the border. The margin is transparent
p{
background-color: lightgrey;
width: 300px;
padding: 25px;
border: 25px solid red;
margin: 25px;
}
Figure 2.6: Boxes and Borders Program Output
CSS Selectors
CSS Selectors:
It is allow you to find and manipulate HTML elements.
CSS selectors are used to "select” HTML elements based on their id, class, attribute, type and
more.
You can select all <h1> elements on a page. (all <h1> elements will be center-aligned, with a
green text color and 15px font size)
h1
{
color: green;
font-size: 15px;
text-align: center;
}
CSS Selectors (Contd..)
2. id selector
It will apply a specific style to an identified element.
It is unique within a page, so the id selector is used if you want to select a single, unique
element.
Write a hash character(#), followed by the id of the element to select an element with a
specific id,
ID name cannot start with a number.
Ex. #parul {
color: green;
font-size: 15px;
text-align: center;
}
CSS Selectors (Contd..)
Example:
<html><head><title>ID Selector</title>
<style>
#parul {
font-size:15px;
text-align:center;
color: blue;
}
</style></head>
<body>
<p id="parul">PARUL UNIVERSITY</p>
<p>ID Selector Example</p>
</body></html>
CSS Selectors (Contd..)
3. Class selector
It is use to selects elements with a specific class attribute.
Write a period character(.), followed by the name of the class to select elements with a
specific class,
class name cannot start with a number.
Ex. .parul
{
color: green;
font-size: 15px;
text-align: center;
}
CSS Selectors (Contd..)
Example:
<html><head><title>Class Selector</title>
<style>
.parul {
font-size:15px;
text-align:center;
color: blue;
}
</style></head><body>
<p class="parul">PARUL UNIVERSITY</p>
<h5 class="parul">Class Selector Example</p>
</body></html>
CSS Selectors (Contd..)
We can also specify that only specific HTML tag should be affected by a class.
<html><head><title>Class Selector</title>
<style>
h5.parul {
font-size:15px;
text-align:center;
color: blue;
}
</style></head><body>
<p class="parul">PARUL UNIVERSITY</p>
<h5 class="parul">Class Selector Example</p>
</body></html>
CSS Selectors (Contd..)
4. group selector
If we have elements with the same style definitions, like :
h2 {
font-size:15px;
color: blue;
}
p{
font-size:15px;
color: blue;
}
h3 {
font-size:15px;
color: blue; }
CSS Selectors (Contd..)
To minimize the code, We can group the selectors.
Properties Description
background Sets all the background properties at one times(or in one declaration)
background-attachment Sets whether a background image is fixed or scrolls with the rest of the page
CSS background (Contd..)
background-image:
The background-image property is use to set the background image of an element.
By default, the image property is repeated as image both horizontally and vertically. so it
covers the entire element.
Property Description
Property Description
h1 {
color: #0000ff;
}
h2 {
color: rgb(0,255,0);
}
Manipulating Texts(Contd..)
2) Text Alignment: The text-align property is used to set the horizontal alignment of a text. Text can
be justified , or aligned to the left or right, or centered.
p{
text-align: right ;
}
h1{
text-align: justify;
}
h2 {
text-align: left;
}
Manipulating Texts(Contd..)
3)Text Decoration: It is used to set or remove decorations from text also remove underlines from
links for design purposes:
p{
text-decoration: line-through;
}
a{
text-decoration: none;
}
h1{
text-decoration: overline;
}
h2{
text-decoration: underline; }
Manipulating Texts(Contd..)
4) Text Transformation: It is used to specify uppercase and lowercase letters in a text or
capitalize the first letter of each word.
h1.uppercase {
text-transform: uppercase;
}
h2.lowercase {
text-transform: lowercase;
}
h3.capitalize {
text-transform: capitalize;
}
Manipulating Texts(Contd..)
5) Text Indentation:
The text-indent property is used to specify the indentation of the first line of a text.
p{
text-indent: 70px;
}
Using Fonts
Below table describe the font Properties:
Table 2.3: Font Property[5]
Property Description
h1.normal {
font-style: normal; }
h2.italic {
font-style: italic; }
h3.oblique {
font-style: oblique; }
Using Fonts (Contd..)
3) Font Size:
It is set the size of the text.
The font-size value can be an absolute, or relative size.
Absolute size:
1. Sets the text to a specified size
2.When the physical size of the output is known then we can use absolute size.
3.Does not allow a user to change the text size in all browsers.
Relative size:
1.Sets the size relative to surrounding elements.
2.Allows a user to change the text size in browsers.
3.The default size for normal text, like paragraphs, is 16px (16px=1em).
Using Fonts (Contd..)
Set Font Size With Pixels: Text size with pixels gives you full control over the text size:
p{
font-size: 15px;
}
h1 {
font-size: 20px;
}
h2 {
font-size: 25px;
}
Using Fonts (Contd..)
Set Font Size With em:
To allow users to resize the text (in the browser menu), many users use em instead of pixels.
The default text size in browsers is 16px. So, the default size of 1em is 16px.
The formula for converting pixel into em is: pixels/16=em.
p{
font-size: 3.75em; /* 60px/16= 3.75 em /*
}
h1 {
font-size: 2.5em;
}
h2 {
font-size: 1.25m;
}
Using Fonts (Contd..)
Combination of Percent and Em: The solution that works in all browsers, is to set a default
font-size in percent for the <body> element:
body
{
font-size: 100%;
}
p{
font-size: 3.75em; }
h1 {
font-size: 2.5em;
}
Borders and Boxes
The border properties allow you to specify the color, size and style of an element's border. Below table describe
the borders Properties: [5]
Table 2.4: Border and Boxes
border Sets all the border properties in one border-width, border-style, border-
declaration color
border-bottom-width Sets the width of the bottom border thin, medium, thick, length
border-left Sets all the left border properties in one Border-left-width, border-style
declaration
border-color
border-left-width Sets the width of the left border thin, medium, thick ,length
border-right Sets all the right border properties in one border-right-width ,border-style
declaration
border-color
border-right-width Sets the width of the right border thin, medium, thick
length
border-style Sets the style of the four borders none, hidden ,dotted, dashes, solid
,double
groove
ridge
inset
Outset
Borders and Boxes (Contd..)
Property Description Value
border-color
border-top-width Sets the width of the top border thin, medium, thick
length
border-width Sets the width of the four borders thin, medium, thick ,length
Borders and Boxes (Contd..)
The border properties allow you to specify the color, size and style of an element's border.
1)Border Style:
The border-style values are:
none: Defines no border
dotted: Defines a dotted border
dashed: Defines a dashed border
solid: Defines a solid border
double: Defines two borders
groove: Defines a 3D grooved border.
ridge: Defines a 3D ridged border.
inset: Defines a 3D inset border.
outset: Defines a 3D outset border.
Borders and Boxes (Contd..)
2) Border Width: It is used to set the width of the border.
We can set width in pixels, or by using this three pre-defined values: thin, medium, or thick.
If it is used alone then it does not work. Use the "border-style" property to set the borders width.
h1
{
border-style: dotted
border-width: 7px;
}
p
{
border-style: solid;
border-width: thin;
}
Borders and Boxes (Contd..)
3) Border Color: It is used to set the color of the border.
if it is used alone, then it does not work . Use the "border-style" property to set the borders
first
h1
{
border-style: dashed;
border-color: green;
}
p{
border-style: solid;
border-color: #95be25;
}
Borders and Boxes (Contd..)
4) Border - Individual sides:
It is possible to specify different borders for different sides:
p{
border-top-style: solid;
border-right-style: dashed
border-bottom-style: solid;
border-left-style: dashed;
}
We can also write the above example with a single property:
p{
border-style: solid dashed;
}
Borders and Boxes (Contd..)
4) Border - Individual sides:
border-style: dashed dotted solid double
top border is dashed
right border is dotted
bottom border is solid
left border is double
border-style: dotted double solid;
top border is dotted
right and left borders are double
bottom border is solid
border-style: solid dashed;
top and bottom borders are solid
right and left borders are dashed
border-style: solid;
all four borders are solid
Borders and Boxes (Contd..)
5) Border - Shorthand property:
We can use all the individual border properties in one property. It is called a shorthand
property.
border-width
border-style (required)
border-color
p
{
border: 13px dotted green;
}
Borders and Boxes (Contd..)
Box Model:
When we talking about design and layout then box model is used.
It is a box that wraps around HTML elements, and it consists of: margins, borders, padding,
and the actual content.
The box model allows us to add a border around elements, and to define space between
elements.
[4]
Borders and Boxes (Contd..)
Content - The content of the box, where text and images appear
Padding - Clears an area around the content. The padding is transparent
Border - A border that goes around the padding and content
Margin - Clears an area outside the border. The margin is transparent
p{
background-color: lightgrey;
width: 300px;
padding: 25px;
border: 25px solid red;
margin: 25px;
}
Figure 2.16: Boxes and Borders Program Output
Borders and Boxes (Contd..)
1) box-sizing Property: It is used to tell the browser what the sizing properties (width and
height) should include.
Table 2.5: Box-sizing Property[5]
Value Description
content-box Default. The width and height properties (and min/max properties) includes only the
content. Border, padding, or margin are not included
border-box The width and height properties (and min/max properties) includes content, padding
and border, but not the margin
I will display ┐
I will display ┌
Borders and Boxes (Contd..)
Table 2.6: Box Drawing Property[5]
2) Box Drawings:
Char Dec Hex Name
2) Box Drawings:
Char Dec Hex Name
Syntax:
p{
box-shadow: 15px 15px 5px #6688FF;
}
Borders and Boxes (Contd..)
box-shadow Property values are: Table 2.7: Box-shadow Property[5]
Value Description
h-shadow The position of the horizontal shadow. Negative values are allowed. Required.
v-shadow The position of the vertical shadow. Negative values are allowed. Required.
color The color of the shadow. The default value is black. Optional.
inset Optional. Changes the shadow from an outer shadow (outset) to an inner shadow
Value Description
length Specifies a margin in px, pt, cm, etc. Default value is 0px
inherit Specifies that the margin should be inherited from the parent element
Margins (Contd..)
1) Margin - Individual sides:
We can set different margins for different sides of an element:
p{
margin-top: 150px;
margin-bottom: 150px;
margin-right: 200px;
margin-left: 70px;
}
2) Margin - Shorthand property:
We can set all the margin properties in one property.
The shorthand property of all margin is "margin":
p{
margin: 120px 70px; }
Margins (Contd..)
The margin property can have from one to four values.
margin: 100px 50px 65px 80px;
top margin is 100px
right margin is 50px
bottom margin is 65px
left margin is 80px
margin: 10px 25px 50px;
top margin is 10px
right and left margins are 25px
bottom margin is 50px
margin: 100px 200px;
top and bottom margins are 100px
right and left margins are 200px
margin: 70px;
all four margins are 70px
Padding
It is define the space between the element border and the element content.
The padding is affected by the background color of the element.
The top, right, bottom, and left padding can be changed independently using separate
properties.
Possible Values are: [5]
Table 2.9: Padding Property
Value Description
ul {
list-style-image: url(‘pulogo.jpg’);
}
The above example does not display equally in all browsers. IE and Opera will display the
image-marker a little bit higher than Firefox, Chrome, and Safari.
If you want the image-marker to be placed equally in all browsers, a crossbrowser solution
is explained below.
Lists (Contd..)
3 ) Crossbrowser Solution: The following example displays the image-marker equally in all browsers:
ul { ul li {
list-style-type: none; background-image: url(sqpurple.gif);
padding: 0px; background-repeat: no-repeat;
margin: 0px; background-position: 0px center;
} padding-left: 15px;
}
For <ul>:
Set the list-style-type to none to remove the list item marker
Set both padding and margin to 0px (for cross-browser compatibility)
For all <li> in <ul>:
Set the URL of the image, and show it only once (no-repeat)
Position the image where you want it (left 0px and vertical value: center)
Position the text in the list with padding-left
Lists (Contd..)
4) List - Shorthand property:
It is used to set all the list properties in one declaration:
ul {
list-style: square inside url(“pulogo.jpg");
}
We have to follow below order for shorthand property:
list-style-type (if a list-style-image is specified, the value of this property will be displayed if
the image for some reason cannot be displayed)
list-style-position (specifies whether the list-item markers should appear inside or outside
the content flow)
list-style-image (specifies an image as the list item marker)
If one of the property values above are missing, the default value for the missing property
will be inserted, if any.
Positioning
The positioning properties allow you to position an element.
Elements can be positioned using the top, bottom, left, and right properties.
However, these properties will not work unless the position property is set first.
A static positioned element is always positioned according to the normal flow of the page.
Static positioned elements are not affected by the top, bottom, left, and right properties.
Positioning(Contd..)
2) Fixed Positioning:
An element with a fixed position is positioned relative to the browser window, and will not
move even if the window is scrolled:
p.pos {
position: fixed;
top: 40px;
right: 7px;
color: blue
}
Fixed positioned elements are removed from the normal flow. The document and other
elements behave like the fixed positioned element does not exist.
Fixed positioned elements can overlap other elements.
Positioning(Contd..)
3) Relative Positioning:
A relative positioned element is positioned relative to its normal position:
h1_pos_left {
position: relative;
left: -50px;
}
h1.pos_right {
position: relative;
left: 30px; }
The content of relatively positioned elements can be moved and overlap other elements, but the reserved
space for the element is still preserved in the normal flow.
h1pos_top {
position: relative;
top: -40px; }
Relatively positioned elements are often used as container blocks for absolutely positioned elements.
Positioning(Contd..)
4) Absolute Positioning:
An absolute position element is positioned relative to the first parent element that has a
position other than static. If no such element is found, the containing block is <html>:
h2 {
position: absolute;
left: 200px;
top: 170px;
}
Absolutely positioned elements are removed from the normal flow. The document and
other elements behave like the absolutely positioned element does not exist.
Absolutely positioned elements can overlap other elements.
CSS2
• Cascading Style Sheet level 2 generally called as CSS2 was developed by the WWW
Consortium and published in May 1998.
• CSS 2 has added new features like:
1. Absolute, relative, and fixed positioning of elements and z-index.
2. The media types supports for aural style sheets
3. New font properties like shadows
4. Errors in CSS2 are fixed in CSS 2.1. As well as it removes partially or fully unsupported
interoperable features of CSS 2.1.
Advanced Selectors
Selectors are used for selecting the HTML elements in the attributes.
Syntax:
Syntax:
input[type="checkbox"]
{
background: orange;
}
Advanced Selectors (Contd..)
Example:
<html><head> <title>Advanced Selectors Example</title>
<style>
a[href="http://www.gmail.com"]{
background: gray;
}
</style>
</head>
<body>
Figure 2.18: Advance Selector Program Output
<a href="http://www.google.com">google.com</a><br>
<a href="http://www.gmail.com" target="_blank">gmail.com</a>
<br>
<a href="http://www.yahoo.com">yahoo.com</a>
</body> </html>
Advanced Selectors (Contd..)
3. nth-of-type Selector
It selects an element from its position and types.
Syntax: Select a particular number tag to make changes.
div:nth-of-type(3)
{
background:yellow;
}
If we want to make changes in all even li.
li:nth-of-type(even)
{
background: yellow;
}
Advanced Selectors (Contd..)
Example:<html><head> <title>Advanced Selectors Example</title><style>
ul:nth-of-type(3){
background:purple;
}
</style></head><body>
<ul>
<li>java</li>
<li>C++</li>
</ul>
<ul>
<li>HTML</li>
<li>CSS</li>
</ul>
<ul>
<li>C#</li>
<li>OS</li>
</ul> </body></html>
Figure 2.19: Advance Selector Program Output
Advanced Selectors (Contd..)
4. Direct Child Selector
It selects any element matching the second element that is a direct child of an element
matching the first element. The element matched by the second selector must be the
immediate children of the elements matched by the first selector.
Syntax:
p > div
{
background-color: DodgerBlue;
}
Advanced Selectors (Contd..)
Example:<html><head> <title>Advanced Selectors Example</title>
<style>
div > span {
background-color: yellow;
}
</style>
</head>
<body>
<div>
<span>Parul university is inside div and span</span>
<p>Parul university inside div but not inside span
<span>Parul university inside div p</span>
</p>
</div>
<span>Parul university is not inside div</span>
</body>
</html>
Figure 2.20: Advance Selector Program Output
Advanced Selectors (Contd..)
5. General Sibling Selector
It selects only the first element if it follows the first element and both children are of the the
same parent element. It is not necessary that the second element immediately follows first
element.
Syntax: Changes to the span element content which follows paragraph tag and both have
same parent tag.
p ~ span
{
color: red;
}
Advanced Selectors (Contd..)
Example:
<html> <head> <title>Advanced Selectors Example</title>
<style >
p ~ span
{
color: red;
}
</style>
</head>
<body>
<p>Welcome to
<span>Parul University</span>
</p>
<h1>Let's learn about</h1>
<p>Advanced </p>
<span>Selectors</span>
</body> </html>
Figure 2.21: Advance Selector Program Output
Advanced Selectors (Contd..)
6. Star Selector: The changes made will be made to whole page.
Syntax:
*{
}
Advanced Selectors (Contd..)
Example: <html> <head> <title>Advanced Selectors Example</title>
<style>
*{
border:3px dotted green;
}
</style>
</head>
<body>
<p>PARUL UNIVERSITY</p>
<p>Advanced Selectors Example</p>
</body>
</html>
Figure 2.22: Advance Selector Program Output
Advanced Selectors (Contd..)
7. Decendant Selector: It makes changes only to those elements which are inside the other
element.
Syntax: Select all the anchor tags which are inside ‘li’ element which are inside ‘ul’ element.
ul li a
{
color: red;
}
Advanced Selectors (Contd..)
Example: <html><head><title>Advanced Selectors Example</title>
<style>
ul li a
{
color:blue;
}
</style>
</head>
<body>
<ul>
<li> <a href="www.paruluniversity.ac.in">PARUL UNIVERSITY.</a></li> Figure 2.23: Advance Selector Program Output
<li>WEB PROGRAMMING Subject</li>
<li>Unit-2 Style sheets</li>
<li>Advanced Selectors Example</li>
</body> </html>
CSS3
• As we know in CSS2, different features are defined by a large single specification, but on
the other hand the CSS3 is divided into number of individual documents called as
“modules”.
• New features are added into every document module and CSS2 features are extended in
order to preserve the backward compatibility.
Transparency
Gradients
Backgrounds
Round Borders
Typography
Shadows
Transformations
Transitions
Transparency / Opacity
It is display smooth transitions between two or many specified colors.
Transparent Image
You must define at least two color stops for linear gradient
Color stops are the colors you want to render smooth transitions among.
We can set a starting point and a direction (or an angle) along with the gradient effect.
Syntax
background: linear-gradient(direction, color-stop1, color-stop2, ...);
Gradients (Contd..)
1.Linear Gradients-Example
<html><head><style>
#g{
height: 100px;
background: linear-gradient(blue, green);
}
</style> </head><body>
<h1>It is display from Top to Bottom</h1>
<p>PARUL UNIVERSITY</p>
<div id="g"></div>
</body></html>
Gradients (Contd..)
1.Linear Gradients
Use below syntax for left to write:
background: linear-gradient(to right, blue , green);
Use below syntax for diagonal:
background: linear-gradient(to bottom right, blue , green);
We can define an angle, instead of the directions: (to bottom, top, right, left, to bottom right etc.)
background: linear-gradient(90deg,red, yellow);
Use below syntax for Multiple color Stops:
background: linear-gradient(blue, red, green, yellow);
background: linear-gradient(blue 20%, green 80%, red 50%);
Use below syntax for Repeating a linear-gradient:
background: repeating-linear-gradient(blue, yellow 15%, red 23%);
background: repeating-linear-gradient(45deg,red, blue 9%,green 13%);
Gradients (Contd..)
1.Linear Gradients- using Transparency
To add transparency, we use the rgba() function to define the color stops.
The last parameter in the rgba() function can be a value from 0 to 1, 0 indicates full
transparency, 1 indicates full color (no transparency).
Gradients (Contd..)
1.Linear Gradients- using Transparency-Example
<html><head><style>
#g {
height: 100px;
background: linear-gradient(to right, rgba(0,0,255,0), rgba(0,0,255,1));
} </style></head><body>
<h3>This is example of Linear Gradient -Transparency</h3>
<h2>PARUL UNIVERSITY</h2>
<div id="g"></div>
</body>
</html>
Gradients (Contd..)
2.Radial Gradients (defined by their center)
You must define at least two color stops for radial gradient.
Syntax:
Property Description
background This is shorthand property for setting all the background properties in one declaration.
Property Description
border-radius A shorthand property for setting all the border (four)
Property Description
Value Description
h-shadow The position of the horizontal shadow. negative values are allowed. It’s required.
v-shadow The position of the vertical shadow. negative values are allowed. It’s required.
Value Description
h-offset The horizontal offset of the shadow. A + value puts the shadow on the right side of the box
, a – values puts the shadow on the left side of the box. It’s required.
v-offset The vertical offset of the shadow. A + value puts the shadow below the box , a – values
puts the shadow above the box. It’s required.
blur The blur radius. Default value is 0.It’s Optional
color The color of the shadow. It’s Optional.
none No shadow is displayed. Default Value.
inset Changes the shadow from an outer shadow to an inner shadow. It’s Optional.
Shadows (Contd..)
Box-Shadow Example:
<html><head><style>
p{
width: 300px;
height: 100px;
padding: 15px;
background-color: yellow;
box-shadow: 10px 10px red; }
</style></head><body>
<p>Parul University is a private Institution established in 2015. The university offers UG, PG
and doctoral programs. The campus of the institution is spread across an area of 150
acres.</p>
</body></html>
Transformation
A transformation is an effect that lets an element change shape, size and position.
CSS3 transforms allow you to translate, rotate, scale, and skew elements.
CSS supports 2D and 3D transformations.
Transformation properties are:
Table 2.15: Transformation Property[5]
Property Description
Method Description
translate(x,y) Defines a 2D translation, moving the element along the X and Y- axis
translateX(n) Defines a 2D translation, moving the element along the X -axis
translateY(n) Defines a 2D translation, moving the element along Y- axis
scale(x,y) Defines a 2D scale transformation, changing the elements width and height.
scaleX(n) Defines a 2D scale transformation, changing the element’s width
scaleY(n) Defines a 2D scale transformation, changing the element’s height.
rotate(angle) Defines a 2D rotation, the angle is specified in the parameter.
skew(x-angle,y-angle) Defines a 2D skew transformation along the x- and y-axis.
skewX(angle) Defines a 2D skew transformation along the x-axis.
skewY(angle) Defines a 2D skew transformation along the y-axis.
matrix(n,n,n,n,n,n) Defines a 2D transformation, using a matrix of six value.
Transformation (Contd..)
1) translate():
The translate() method moves an element from its current position (according to the
parameters given for the X-axis and the Y-axis).
The following example moves the <div> element 50 pixels to the right, and 100 pixels down
from its current position.
[5]
Transformation (Contd..)
2) rotate():
The rotate() method rotates an element clockwise or counter-clockwise according to a
given degree.
The following example rotates the <div> element clockwise with 30 degrees:
Transformation (Contd..)
3) scale():
The scale() method increases or decreases the size of an element (according to the
parameters given for the width and height).
The following example increases the <div> element to be two times of its original width,
and three times of its original height:
Transformation (Contd..)
4) skewX():
The skewX() method skews an element along the X-axis by the given angle.
The following example skews the <div> element 15 degrees along the X-axis:
Transformation (Contd..)
5) skewY():
The skewY() method skews an element along the Y-axis by the given angle.
The following example skews the <div> element 15 degrees along the Y-axis.
Transformation (Contd..)
6) matrix() :
The matrix() method combines all the 2D transform methods into one.
The matrix() method take six parameters, containing mathematic functions, which allows
you to rotate, scale, move (translate), and skew elements.
The parameters are as follow:
matrix(scaleX(),skewY(),skewX(),scaleY(),translateX(),translateY())
[5]
Transitions
It allows you to change property values smoothly, over a given duration.
If the duration part is not specified, the transition will have no effect, because the default
value is 0.
Property Description
transition A shorthand property for setting the four transition properties into a single
property
transition-property Specifies the name of the CSS property the transition effect is for