我正在创建一个在小三角形中具有背景的语音泡泡,但唯一的问题是它还需要圆角 . 我不完全确定如何做到这一点,但任何黑客或任何事情都会受到赞赏 .
这就是我所拥有的
HTML
<div class="image">
<img class="test" src="http://fc00.deviantart.net/fs71/f/2011/322/e/2/e292b11555866aec8666ded2e63ee541-d4gl4vg.png" alt="leopard" />
</div>
CSS
.image {
position:relative;
width:340px;
background:orange;
}
.image:before, .image:after {
border-left: 20px solid white;
content: "";
left: 0;
position: absolute;
width: 0;
}
.image:before {
border-bottom: 5px solid transparent;
height: 34px;
top: 0;
}
.image:after {
top: 39px;
bottom:0;
border-top: 5px solid transparent;
}
.test {
display:block;
width:100%;
}
这是一个小提琴 . http://jsfiddle.net/yL7Hg/
编辑:如果它有帮助我只需要左上角的半径,因为我的设计工作方式 . 我可以在.image上使用border-radius来获得右上角 .
3 回答
这里是:
http://jsfiddle.net/HYgbu/
我知道它不是一个完美的解决方案,但它仍然是我的第一个想法 .
试试这个:http://www.html5rocks.com/en/tutorials/masking/adobe/
使用HTML5剪切和屏蔽 .
它使用HTML5时具有浏览器限制 . 但是所有最近的浏览器都支持它 .
使用标准CSS可以更轻松地实现这一点 . 只需设置2个DIV,一个用于箭头,另一个用图像作为背景(而不是IMG标记):
和2个相应的类:
就是这样:http://jsfiddle.net/yL7Hg/5/