【发布时间】:2016-01-25 00:54:18
【问题描述】:
我尝试制作一个无论在用户设备上都能响应的气泡,并且它在左侧站点上有一个三角形。
我尝试了什么:
HTML:
.responsive-bubble {
position: relative;
display: inline-block;
max-width: 80%;
min-width: 80%;
min-height: 1.5em;
padding: 20px;
background: #ebebeb;
border: #ebebeb solid 4px;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 0px;
border-style: solid;
float: right;
}
.responsive-bubble:before {
content: "";
position: absolute;
bottom: calc(89% - 3px);
left: calc(-4% - 3px);
border-style: solid;
border-width: 18px 18px 0;
border-color: #7F7F7F transparent;
display: block;
width: 0;
z-index: 0;
}
<div class="responsive-bubble">“And here comes some really long text which doesnt mean anything however it have to be long to provide a lot of characters and see how this buble works when long text is here and even when nearly no text is here and so on. I hope you know what I mean
So i am adding few additional words! So i am adding few additional words! So i am adding few additional words!”</div>
<div class="responsive-bubble">“Some shorter text come here to see how it looks when it's not so many text HERE! Some shorter text come here to see how it looks when it's not so many text HERE!”</div>
<div class="responsive-bubble">“Some shorter text come here to see how it looks when it's not so many text HERE!”</div>
什么不起作用:
看起来它自己的气泡响应正确,但是我在左侧站点的三角形有问题,它不是在正确的位置取决于气泡。
演示:
对于演示,我更改了边框等只是为了提供更多详细信息:
https://jsfiddle.net/jkdurdjr/2/
这里有谁能告诉我我做错了什么吗?
【问题讨论】:
-
你可能想看看这个 - stackoverflow.com/questions/30011363/…
-
我一头雾水,就这样 -> jsfiddle.net/jkdurdjr/8
标签: javascript html css css-shapes