CSS3 倒圆角
有没有办法在 CSS3 中做一个倒圆角,类似于下面(粗略)图中的左下角?
/-------\
| |
| |
| |
| ______/
|/ <---The left side is flush (straight), the slant should be rounded
也许 border-radius 可以与这种技术结合使用?
编辑:我不是在寻找语音气泡,而是在寻找一种使左下角点的右侧弯曲的方法。
Is there a way to do an inverted rounded corner in CSS3, something approximately like the bottom left corner in the (crude) drawing below?
/-------\
| |
| |
| |
| ______/
|/ <---The left side is flush (straight), the slant should be rounded
Perhaps border-radius could be combined with this technique?
Edit: I'm not looking for a speech bubble, but rather just a way to curve the right side of the point on the bottom left.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
好吧,这纯粹是疯狂,但肯定有办法实现这一点:-) 不是跨浏览器,但让我们看看:
我们的标记:
我们的 CSS:
结果:
http://jsfiddle.net/MrLWY/
我只在 Firefox 3.6.3 中测试过这个,但是这个想法很清楚:-)
这里有两个:
结果: http://jsfiddle.net/ajeN7/
也许这可以通过多种方式增强:
Well, this is pure madness, but certainly there are ways to achieve this :-) not cross-browserly, but let's see:
Our mark-up:
Our CSS:
The result:
http://jsfiddle.net/MrLWY/
I have only tested this in Firefox 3.6.3, but the idea is clear :-)
Here is take two:
And the result: http://jsfiddle.net/ajeN7/
Perhaps this can be enhanced in many ways:
我还不能发表评论,但是这里有一个新的答案(关于 Gryzzlys 的答案):
Gryzzlys 的第一个示例没有处理不同的背景颜色(对于背景和气泡)。
但第二个却是这样。这是应用背景颜色的示例:
http://jsfiddle.net/tGnfb/
(我还添加了边框 - radius 属性,以便为 Firefox 以外的其他浏览器渲染边框)。
I cant comment yet, but so here's a new answer (in regard to Gryzzlys answer):
Gryzzlys first example didn't handle different background colors (for the background and bubble).
But the second one does. Here's an example with background colors applied:
http://jsfiddle.net/tGnfb/
(I also added border-radius properties so that it will render borders for other browsers than Firefox).
这样就达到了FF中的效果。对其他浏览器使用适当的
border-radius
变体。本质上,您使用 3
div
系统,其中一个系统的背景颜色相同。仅适用于单色背景。
还有CSS:
This achieves the effect in FF. Use the appropriate
border-radius
variants for the other browsers.Essentially you use a 3
div
system, one with the same color of the background.Does only work for background with a flat color.
And the CSS:
如果您想实现那种外观(语音气球),最好只使用图像:)
if you're trying to achieve that kind of look(a speech balloon) it's best to just use an image for that :)
有多种方法可以仅使用 CSS 来解决此问题。我决定使用一种用于选项卡的技术 - 但可以很容易地适应语音气泡。
我在这里介绍了如何在 CSS 中制作 Inverse Border Radius 的基本示例(此处)。这使用了边框大小的技巧来使用内部,您可能需要进行一些定位才能使其正常工作,但是正如您所看到的,这是可能的。
There are ways you could solve this issue by using just CSS. I have decided to use a technique for tabs - but could be easily adapted for speech bubbles.
I cover a basic example here of how to make an Inverse Border Radius in CSS (here). This uses a trick with the size of Border to use the inside, you might have to do some positioning to get it to work properly however as you can see its possible.