freeCodeCamp/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-css-transform-scale...

66 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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