CSS Properties: How to set a rotated element's base placement
Solution:
HTML Code :
<!DOCTYPE html>
<html>
<head>
<title>How to set a rotated element's base placement</title>
<style type="text/css">
#div1 {
position: relative;
height: 100px;
width: 100px;
margin: 50px;
padding: 10px;
border: 2px solid #CC0099;
}
#div2 {
padding: 18px;
position: absolute;
border: 1px solid #990000;
background-color: #0000CC;
-ms-transform: rotate(30deg);
-ms-transform-origin: 20% 30%;
-webkit-transform: rotate(30deg);
-webkit-transform-origin: 20% 30%;
transform: rotate(30deg);
transform-origin: 20% 15%;
}
</style>
</head>
<body>
<h1><strong>w3resource Tutorial</strong></h1>
<div id="div1">
<div id="div2">Web Development Tutorial</div>
</div>
</body>
</html>
Live Demo:
See the Pen transform-origin-answer by w3resource (@w3resource) on CodePen.
See the solution in the browser
Supported browser
![]() |
![]() |
![]() |
![]() |
![]() |
Yes | Yes | Yes | Yes | Yes |
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join