如何用 html+css 实现平行四边形,以及气泡

html-css018

如何用 html+css 实现平行四边形,以及气泡,第1张

transform:skewX(30deg)

扭曲skew()函数能够让元素倾斜显示。它可以将一个对象以其中心位置围绕着X轴和Y轴按照一定的角度倾斜。这与rotate()函数的旋转不同,rotate()函数只是旋转,而不会改变

元素的形状。skew()函数不会旋转,而只会改变元素的形状。

一个参数:表示水平方向的倾斜角度;

两个参数:第一个参数表示水平方向的倾斜角度,第二个参数表示垂直方向的倾斜角度

气泡需要两个组合

.arrow_box {

position: relative

background: #88b7d5

border: 4px solid #c2e1f5

}

.arrow_box:after, .arrow_box:before {

left: 100%

top: 50%

border: solid transparent

content: " "

height: 0

width: 0

position: absolute

pointer-events: none

}

.arrow_box:after {

border-color: rgba(136, 183, 213, 0)

border-left-color: #88b7d5

border-width: 10px

margin-top: -10px

}

.arrow_box:before {

border-color: rgba(194, 225, 245, 0)

border-left-color: #c2e1f5

border-width: 16px

margin-top: -16px

}

<!DOCTYPE html>

<html>

<head> 

<meta charset="utf-8"> 

<title></title> 

<style>

*{ padding:0margin:0font-size:14px }

body{

background: grey

}

.d{

position:fixedmargin:autoleft:0right:0bottom:24pxwidth: 160pxheight:120px

animation: d1 3s linear animation-fill-mode: both

}

@keyframes d1{

from{

bottom: 24px

}

to{

bottom: 360px

}

}

.d img{

height:120pxposition: absolutemargin:autoleft:0top:0animation: d2 2s 3s linear infinite animation-fill-mode: both

}

@keyframes d2{

0%,100%{

transform:rotate(0deg)

}

50%{  

left: 40px

transform:rotate(90deg)

}

}

</style>

</head>

<body>

<div class="d">

<img src="http://aimusic.image.alimmdn.com/Image/6d235b11f15838d6711ec6b0ca5e1a32.png"/>

</div>

</body>

</html>