---
id: 587d78a5367417b2b2512ada
title: Use the CSS Transform scale Property to Scale an Element on Hover
challengeType: 0
videoUrl: ''
localeTitle: 使用CSS Transform scale属性在悬停上缩放元素
---
## Description
transform
属性具有多种功能,可让您缩放,移动,旋转,倾斜等元素。当与伪类(例如:hover
,指定元素的某个状态, transform
属性可以轻松地为元素添加交互性。这是一个示例,当用户将鼠标悬停在原始大小上时,将段落元素缩放到原始大小的2.1倍: p:悬停{
变换:规模(2.1);
}
## Instructions
为div
的hover
状态添加CSS规则,并使用transform
属性将div
元素缩放到其原始大小的1.1倍,当用户将鼠标悬停在其上时。
## Tests
```yml
tests:
- text: 当用户将鼠标悬停在其上时, div
元素的大小应缩放1.1倍。
testString: 'assert(code.match(/div:hover\s*?{\s*?transform:\s*?scale\(1\.1\);/gi), "The size of the div
element should scale 1.1 times when the user hovers over it.");'
```
## Challenge Seed
## Solution
```js
// solution required
```