Dino Geek, try to help you

How to use transition effect in CSS?


To use transition effect in CSS, you have to specify two things:

1. The CSS property you want to add an effect to
2. The duration of the effect

Here is the basic syntax of transition property in CSS:

`transition: property duration;`

- `property` is the CSS property to which you want to add the transition effect. For example: width, height, opacity, etc.
- `duration` is the length of the transition effect in seconds or milliseconds. For example: 2s (2 seconds), 500ms (500 milliseconds).

If you want to add a transition effect to the `width` property and want the duration of the transition to be 2 seconds, you can use the following code:

```
div { transition: width 2s;
}
```

Examples on applying transition to hover effect in CSS:

```
div { width: 100px; height: 100px; background: red; transition: width 2s;
}

div:hover { width: 200px;
}
```
In the above code, when you hover over the `div`, its width will gradually change to 200px from 100px over a period of 2 seconds.

Additionally, you can add a delay, timing function and also can use shorthand transition which includes all in one.

```
div { /* property name | duration | timing function | delay */ transition: width 2s linear 1s;
}

div:hover { width: 200px;
}
```


Simply generate articles to optimize your SEO
Simply generate articles to optimize your SEO





DinoGeek offers simple articles on complex technologies

Would you like to be quoted in this article? It's very simple, contact us at dino@eiki.fr

CSS | NodeJS | DNS | DMARC | MAPI | NNTP | htaccess | PHP | HTTPS | Drupal | WEB3 | LLM | Wordpress | TLD | Domain name | IMAP | TCP | NFT | MariaDB | FTP | Zigbee | NMAP | SNMP | SEO | E-Mail | LXC | HTTP | MangoDB | SFTP | RAG | SSH | HTML | ChatGPT API | OSPF | JavaScript | Docker | OpenVZ | ChatGPT | VPS | ZIMBRA | SPF | UDP | Joomla | IPV6 | BGP | Django | Reactjs | DKIM | VMWare | RSYNC | Python | TFTP | Webdav | FAAS | Apache | IPV4 | LDAP | POP3 | SMTP

| Whispers of love (API) | Déclaration d'Amour |






Legal Notice / General Conditions of Use