Implement 2D transformation on Web page.
Code
<!DOCTYPE html>
<html lang="en"><head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Implement 2D transformation on web page.</title>
<style>
div{
width: 200px;
height: 200px;
border-radius: 10px;
text-align: center;
font-size: 30px;
font-weight: bold;
margin-left: 200px;
/* background-color: lightgreen; */
border: 2px solid red;
/* border-style: dotted; */
}
.a{
background-color: lightblue;
/* position: relative;
top: 50px;
left: 50px; */
transform: translate(50px,50px);
/* transform: translateX(50px); */
/* transform: translateY(50px); */
}
.b{
background-color: antiquewhite;
/* transform: scale(0.8); */
transform: scaleX(0.4);
/* transform: scaleY(0.4); */
}
.c{
background-color: aquamarine;
/* transform: rotateX(60deg); */
/* transform: rotateY(60deg); */
/* transform: rotate(45deg); */
/* negative deg is rotate anti clock wise */
transform: rotate(-45deg);
}
.d{
background-color: aliceblue;
transform: skew(20deg,20deg);
/* transform: skewX(20deg); */
/* transform: skewY(30deg); */
}
.e{
background-color: tomato;
transform: matrix(1,-0.8,0.5,1,50,50);
}
.f{
width: 300px;
height: 100px;
margin-top: 200px;
background-color: blueviolet;
border: 2px solid black;
}
div#mydiv{
transform: translate(50px,100px);
}
</style>
</head>
<body>
<h1>Transform Property</h1>
<h2>Transform: rotate</h2>
<div class="a">Hello World</div>
<h2>Transform: </h2>
<div class="b">Hello World</div>
<h2>Transform: </h2>
<div class="c">Hello World</div>
<h2>Transform: </h2>
<div class="d">Hello World</div>
<h2>Transform: </h2>
<div class="e">Hello World</div>
<div class="f">The original div tag</div>
<div id="mydiv">
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Temporibus, saepe.
</div>
</body>
</html>
Comments
Post a Comment