rotate border css code example
Example 1: rotate element css
div {
width: 80px;
height: 80px;
background-color: skyblue;
}
.rotated {
transform: rotate(45deg);
background-color: pink;
}
Example 2: transform rotate css
<!DOCTYPE html>
<html>
<head>
<style>
div.a {
width: 150px;
height: 80px;
background-color: yellow;
-ms-transform: rotate(20deg);
transform: rotate(20deg);
}
div.b {
width: 150px;
height: 80px;
background-color: yellow;
-ms-transform: skewY(20deg);
transform: skewY(20deg);
}
div.c {
width: 150px;
height: 80px;
background-color: yellow;
-ms-transform: scaleY(1.5);
transform: scaleY(1.5);
}
</style>
</head>
<body>
<h1>The transform Property</h1>
<h2>transform: rotate(20deg):</h2>
<div class="a">Hello World!</div>
<br>
<h2>transform: skewY(20deg):</h2>
<div class="b">Hello World!</div>
<br>
<h2>transform: scaleY(1.5):</h2>
<div class="c">Hello World!</div>
</body>
</html>
Example 3: css transform property
Read this comprehensive article about CSS animation transform property.
It also has many useful examples that help you in best way.
https://medium.com/swlh/learn-css-transform-animation-zero-to-hero-6a2a643bd56b
Example 4: css make border rotate around element
.b-border{
display: inline-block;
position: relative;
border: solid #333;
border-width: 1px 1px 0px 1px;
padding: 20px;
margin-bottom: 100px;
}
.b-border.border-right{
border-width: 1px 0 1px 1px;
}
.b-border.border-right:after{
content: "";
position: absolute;
right: -30px;
border-top: 1px solid #333;
border-left: none medium;
top: -1px;
left: auto;
width: 30px;
height: 100%;
background: linear-gradient(to top left, white calc(50% - 1px), #000 1px, white 50%);
}
.b-border:after{
content: "";
position: absolute;
left: -1px;
bottom: -15%;
border-left: 1px solid #333;
height: 15%;
width: calc(100% + 1px);
background: linear-gradient(to right bottom, white calc(50% - 1px), #000 1px, white 50%);
}
Example 5: css make border rotate around element
<div class="b-border border-right">
Hello :)
</div>
<p></p>
<div class="b-border" style="width: 300px;">
Lorem ipsum dolor sit amet, consectetur
Lorem ipsum dolor sit amet, consectetur
Lorem ipsum dolor sit amet, consectetur
Lorem ipsum dolor sit amet, consectetur
Lorem ipsum dolor sit amet, consectetur
</div>