×

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 Align

CSS Center Align Elements CSS center align is used to create align by using block element. You should specify margin: auto;properties. The element will take up the specified width and the remaining space....

2 minutes read.

CSS Flex-Box

Introduction The flex-box property of CSS stands for Flexible Box Layout Module. It is specifically used to design a flexible responsive layout. Flex-box is a one dimensional layout model, i.e. it works...

6 minutes read.

CSS Hover

CSS Hover: CSS :hover is used to select the various elements whenever we point the mouse on these elements. We can also use this selector on all the HTML elements,...

3 minutes read.

How to change font size in CSS

How to change font size in CSS? Font Size: - Users may attract attention to content on a website page in various ways. One element in a sentence can be highlighted. You...

5 minutes read.

CSS Text-Overflow

Introduction: The text-overflow property of CSS is used to format the text which is overflowing the boundaries of the container. This property helps user to clip the text, to display the...

5 minutes read.

Css Box Model

Introduction The Box Model property of CSS is used for design and layout of an html page. In CSS, all the elements has a rectangular box around it, you have to...

5 minutes read.

CSS Background-blend-mode

Background-blend-mode The background-blend-mode property sets a blend mode of the component’s every background layer (color/image). It illustrates how the element background image blends well with the element background color. We can...

9 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.

Hover condition for a:before and a:after in CSS

In CSS, :after and :before are used to add content after and before the element. The CSS pseudo-class is used to add some styling effect to the webpage. We can change...

4 minutes read.

What is CSS

CSS stands for Cascading Style Sheet. It gives an additional style to the HTML document. A cascading style sheet is a language that is designed to define the document formatting...

3 minutes read.

CSS Lists

CSS Lists: Several properties are available in CSS that are used to manage the lists. Lists are distributed as ordered and unordered kind of lists. The ordered lists provide the...

7 minutes read.

CSS Text-align

Text-align The text-align property of CSS sets the table-cell box’s horizontal alignment or any block element. The text-align property is the same as the CSS property vertical-align but towards any horizontal...

1 minute 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 Line Height

CSS Line Height: This property in CSS can be used to describe the line box’s minimal height inside the element. It sets-up the distinction among two lines in our content. It...

3 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 White Space Property

White Space in CSS The white-space CSS property describes how to show the content inside an element. This property is applied to manage a white space within an element. Values of White-space...

2 minutes read.

CSS Background

CSS Background The properties of CSS background are applied to describe the effects of background on the element. Here are five properties of background that affects various elements of HTML: Background-colorBackground-imageBackground-repeatBackground-attachment Background-position Background-color The color of the background...

7 minutes read.

CSS Font-Size

A Cascading Style Sheet (CSS) is a simple design scripting language intended to simplify the process of making web pages more visually appealing with the kind of high-level formatting. Cascading...

3 minutes read.

How to resize an image in CSS

How to resize an image in CSS? The resize image attribute is used in responsive web design to resize images to fit within the div container automatically. The resize image attribute...

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.