×

CSS Transition

CSS Transition

The transitions in CSS are influenced, included to modify the component from one design to another, without the use of the JavaScript or Flash.

We should describe two of the essential things to make the CSS transition.

  • The property of CSS, on which we wish to include an effect.
  • The duration of time of an effect.

Consider the below example:

Example:

<!DOCTYPE html> 
<html> 
<head> 
<style>  
div
{ 
width: 100px; 
height: 100px; 
background: lime; 
-webkit-transition: width 1s; /* For Safari 3.1 to 6.0 */ 
transition: width 1s; 
} 
div:hover
{ 
width: 300px; 
} 
</style> 
</head> 
<body> 
<div></div> 
<p> Point your cursor on the div item above, to examine the effect of transition.</p> 
</body> 
</html> 

Output:

CSS Transition

CSS Transition Effect: Multiple

It can be applied to include the transition effect on one or more properties of CSS. When we wish to include the impact of transition over one or more properties of CSS, isolate those properties along with the comma.

Following is an illustration where we will specify the effects of transition on transformation, height, and width.

Consider the below example:

Example:

<!DOCTYPE html> 
<html> 
<head> 
<style>  
div
{ 
padding:15px; 
width: 150px; 
height: 100px; 
background: lightblue; 
-webkit-transition: width 2s, height 2s, -webkit-transform 2s; /* For Browser Safari 3.1 to 6.0 */ 
transition: width 2s, height 2s, transform 2s; 
} 
div:hover
{ 
width: 300px; 
height: 200px; 
-webkit-transform: rotate(360deg); /* Opera, Safari, Chrome */ 
transform: rotate(360deg); 
} 
</style> 
</head> 
<body> 
<div><b>Tutorial and Example</b><p> (Point your cursor on me to examine the effect)</p></div> 
</body> 
</html> 

Output:

CSS Transition

Related Topics

CSS 3D Transform

Introduction To understand 3D transformation property of transform you need to first understand the difference between 2D and 3D transform. 2D transform is a CSS effect which transforms the elements according to...

6 minutes read.

CSS Font

CSS Font: CSS has font property, which makes the text more attractive. We can alter the entire look by changing font color, font size, font style, and much more. In...

5 minutes read.

CSS Page-break-after Attribute

Page-break-after Attribute As its name implies, the page-break-before property is applied to include page break after any element, at the time of printing a document. It adds the page break after...

5 minutes read.

CSS Text-stroke

Text-stroke Text-stroke CSS property inserts the stroke to any text and gives a decoration option to them also. It describes the stroke’s width and color for various text characters. It is...

2 minutes read.

CSS Display

CSS Display: The CSS Display property is one of an essential property among all other properties of CSS. The display property specifies how the HTML elements should be displayed on...

4 minutes read.

CSS Form

You can create attractive HTML form by using CSS. Style input Fields The Input Field width properties are used to determine the width of the input field. Let us see an example of CSS style...

2 minutes read.

CSS Overflow

CSS Overflow: The Overflow property in CSS is used to manage the content if it overflows from its container of the block level. We have seen that all the elements...

3 minutes read.

CSS Justify Content

Justify Content: These properties are applied for the alignment of items of a flexible box container if any item does not cover every available space over the main-axis, i.e., horizontally....

4 minutes read.

CSS Animation

CSS Animation: The animation property of CSS is applied to make animation over any webpage. It is used as the animation replacement made by JavaScript and Flash. Rules of CSS3 @keyframes The...

3 minutes read.

CSS Padding

CSS Padding: The padding property in CSS is addressed to describe the space among the element border and the element content.This property is quite different from the margin property of...

2 minutes read.

CSS Ellipsis

The CSS ellipsis kind of is the value that mostly is used by the property: text-overflow. Here, we will discuss the following: What is CSS Ellipsis? Syntax for CSS ellipsis How to...

3 minutes read.

CSS Text-Transform Property

Text-Transform in CSS The text-transform property permits us to alter the text case. It controls the capitalization of the text. This property is employed to design the text appearance in every...

3 minutes read.

How to Set Space between the Flexbox

For managing layout on the Web, CSS Flexbox and CSS Grid are two excellent tools. Flexbox handles one-dimensional layouts quite well, whereas CSS Grid manages two-dimensional layouts with columns and...

4 minutes read.

CSS Checkbox style

CSS Checkbox style: It is an element of HTML, which is used to get input from various users. It is difficult to style any checkbox. However, some elements make it...

6 minutes read.

What is Bootstrap CSS?

Bootstrap: - Bootstrap is a CSS framework that is free to use and is used for the front-end development of the website in a faster and easier way. Bootstrap was released as...

3 minutes read.

Is CSS a programming language?

 A programming language is a set of grammatical rules and a vocabulary for commanding a machine to accomplish specified tasks. High-level languages like BASIC, C, C++, COBOL, Java, FORTRAN, Ada...

4 minutes read.

CSS Loader

CSS Loader The loader is the animation that can alert a visitor regarding the loading of the page. We need to wait for some time. It will be helpful if any...

4 minutes read.

CSS Reference

The CSS Reference lists all of the basic standard CSS properties, pseudo-classes, pseudo-elements, and data types, for all intents and purposes functional notations, and at-rules alphabetically.  The site also includes...

5 minutes read.

Radial-gradient() CSS function

Radial-gradient() CSS function It defines a CSS in-built function, which produces a smooth transition among multiple colors. It is used to set any radial-gradient that is same as a background-image. This...

4 minutes read.

CSS Superscript and Subscript

Superscript and Subscript To specify the superscript and the subscript text, HTML provides us two tags that are <sup> and <sub>. The superscript content looks in the shorter font and half...

2 minutes read.