1.6 KiB
1.6 KiB
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
587d78a5367417b2b2512ad9 | Use the CSS Transform scale Property to Change the Size of an Element | 0 | 使用CSS Transform scale属性更改元素的大小 |
Description
transform
属性及其scale()
函数。以下代码示例将页面上所有段落元素的大小加倍: p {
变换:比例(2);
}
Instructions
ball2
的id将元素的大小ball2
原始大小的1.5倍。 Tests
tests:
- text: '设置<code>#ball2</code>的<code>transform</code>属性,将其缩放为其大小的1.5倍。'
testString: 'assert(code.match(/#ball2\s*?{\s*?left:\s*?65%;\s*?transform:\s*?scale\(1\.5\);\s*?}|#ball2\s*?{\s*?transform:\s*?scale\(1\.5\);\s*?left:\s*?65%;\s*?}/gi), "Set the <code>transform</code> property for <code>#ball2</code> to scale it 1.5 times its size.");'
Challenge Seed
<style>
.ball {
width: 40px;
height: 40px;
margin: 50 auto;
position: fixed;
background: linear-gradient(
35deg,
#ccffff,
#ffcccc
);
border-radius: 50%;
}
#ball1 {
left: 20%;
}
#ball2 {
left: 65%;
}
</style>
<div class="ball" id= "ball1"></div>
<div class="ball" id= "ball2"></div>
Solution
// solution required