您最好的选择或方法是什么,以创建如附件链接中所示的形状,完全使用CSS,这是否可能?
我已经尝试了使用CSS平行四边形等进行研究和测试,但还没有取得任何好的成功。
在此处查看形状 -->> http://tinypic.com/r/352ge3b/6
您最好的选择或方法是什么,以创建如附件链接中所示的形状,完全使用CSS,这是否可能?
我已经尝试了使用CSS平行四边形等进行研究和测试,但还没有取得任何好的成功。
在此处查看形状 -->> http://tinypic.com/r/352ge3b/6
我本来认为这个事情只需要使用一个元素就能完成——它确实可以完成,但我并不认为这是最好的解决方案。
HTML代码:
<div class='speech-bubble'>Hello!</div>
CSS:
.speech-bubble {
position: relative;
margin: .5em auto;
padding: 1em;
width: 10em; height: 4em;
border-radius: .25em;
transform: rotate(-4deg) rotateY(15deg);
background: #629bdd;
font: 2em/4 Century Gothic, Verdana, sans-serif;
text-align: center;
}
.speech-bubble:before, .speech-bubble:after {
position: absolute;
z-index: -1;
content: '';
}
.speech-bubble:after {
top: 0; right: 0; bottom: 0; left: 0;
border-radius: inherit;
transform: rotate(2deg) translate(.35em, -.15em) scale(1.02);
background: #f4fbfe;
}
.speech-bubble:before {
border: solid 0 transparent;
border-right: solid 3.5em #f4fbfe;
border-bottom: solid .25em #629bdd;
bottom: .25em; left: 1.25em;
width: 0; height: 1em;
transform: rotate(45deg) skewX(75deg);
}
这不完全是你要找的,但我在尝试使用CSS3的透视和旋转时做出了这个:
body {
color: #FFF;
font-family: sans-serif;
}
.outer {
position: relative;
height: 120px;
width: 120px;
margin: 50px;
padding:10px;
perspective:150;
-webkit-perspective:150;
}
.inner {
border-radius: 15px;
padding:50px;
position: absolute;
background-color: #80BFFF;
transform: rotateY(10deg);
-webkit-transform: rotateY(10deg);
box-shadow: -4px -4px 0px #3399FF;
}
.inner:after {
content: ' ';
position: absolute;
width: 0;
height: 0;
left: 20px;
top: 115px;
border: 15px solid;
border-color: #80BFFF transparent transparent #80BFFF;
}
这是我的HTML代码
<div class="outer">
<div class="inner">Yay!</div>
</div>