2018-09-30 22:01:58 +00:00
|
|
|
---
|
|
|
|
id: 587d78a6367417b2b2512adb
|
|
|
|
title: Use the CSS Transform Property skewX to Skew an Element Along the X-Axis
|
|
|
|
challengeType: 0
|
|
|
|
videoUrl: 'https://scrimba.com/c/cyLP8Sr'
|
2019-08-05 16:17:33 +00:00
|
|
|
forumTopicId: 301074
|
2021-01-13 02:31:00 +00:00
|
|
|
dashedName: use-the-css-transform-property-skewx-to-skew-an-element-along-the-x-axis
|
2018-09-30 22:01:58 +00:00
|
|
|
---
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --description--
|
|
|
|
|
|
|
|
The next function of the `transform` property is `skewX()`, which skews the selected element along its X (horizontal) axis by a given degree.
|
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
The following code skews the paragraph element by -32 degrees along the X-axis.
|
2019-05-14 08:11:58 +00:00
|
|
|
|
|
|
|
```css
|
|
|
|
p {
|
|
|
|
transform: skewX(-32deg);
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --instructions--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
Skew the element with the id of `bottom` by 24 degrees along the X-axis by using the `transform` property.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --hints--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
The element with id `bottom` should be skewed by 24 degrees along its X-axis.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
```js
|
|
|
|
assert(code.match(/#bottom\s*?{\s*?.*?\s*?transform:\s*?skewX\(24deg\);/g));
|
2018-09-30 22:01:58 +00:00
|
|
|
```
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --seed--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
## --seed-contents--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
```html
|
|
|
|
<style>
|
2018-10-08 00:01:53 +00:00
|
|
|
div {
|
2018-09-30 22:01:58 +00:00
|
|
|
width: 70%;
|
|
|
|
height: 100px;
|
|
|
|
margin: 50px auto;
|
|
|
|
}
|
|
|
|
#top {
|
|
|
|
background-color: red;
|
|
|
|
}
|
|
|
|
#bottom {
|
|
|
|
background-color: blue;
|
2018-10-08 00:01:53 +00:00
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<div id="top"></div>
|
|
|
|
<div id="bottom"></div>
|
|
|
|
```
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --solutions--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2019-04-28 18:13:38 +00:00
|
|
|
```html
|
|
|
|
<style>
|
|
|
|
div {
|
|
|
|
width: 70%;
|
|
|
|
height: 100px;
|
|
|
|
margin: 50px auto;
|
|
|
|
}
|
|
|
|
#top {
|
|
|
|
background-color: red;
|
|
|
|
}
|
|
|
|
#bottom {
|
|
|
|
background-color: blue;
|
|
|
|
transform: skewX(24deg);
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<div id="top"></div>
|
|
|
|
<div id="bottom"></div>
|
2018-09-30 22:01:58 +00:00
|
|
|
```
|