CSS语音泡沫箭头不响应

时间:2017-09-02 17:05:02

标签: html css

我尝试使用 Viewport大小的排版创建如下的语音气泡 enter image description here

一切正常。它不理想,但有效...唯一的问题是"箭头"在调整窗口大小时,它不会停留在它的位置,它会在调整大小后在气泡内部或外部移动

到目前为止,这是我的代码:



.speechBubble {
  position: relative;
  display: inline-block;
  text-align: center;
  color: #FFFFFF;
  text-shadow: 0 0 3vw yellow;
  background-color: #000000;
  border: 3px solid #FFF;
  -webkit-border-radius: 58px;
  -moz-border-radius: 58px;
  border-radius: 50%;
  padding: 0px 100px 0px 100px;
  -webkit-box-shadow: 2px 2px 4px #888;
  -moz-box-shadow: 2px 2px 4px #888;
  box-shadow: 2px 2px 4px #888;
  max-width: 30vw;
}

.speechBubble:before {
  content: '';
  position: absolute;
  border-style: solid;
  border-width: 3vw 11.3vw 2vw 0;
  border-color: transparent #FFFFFF;
  display: block;
  width: 0;
  z-index: 0;
  left: 4.5vw;
  top: -30px;
  display: block;
  transform: rotate(53deg);
}

.speechBubble:after {
  content: '';
  position: absolute;
  border-style: solid;
  border-width: 3vw 11.3vw 2vw 0;
  border-color: transparent #000000;
  display: block;
  width: 0;
  z-index: 1;
  left: 5vw;
  top: -25px;
  transform: rotate(53deg);
  display: block;
}

.speechBubbleContent {
  position: relative;
  width: 80%;
  margin: 0 auto;
  text-transform: uppercase;
  padding: 30px;
  line-height: 3.7vw;
  font-size: 3.7vw;
  max-width: 40vw;
}

<div class="speechBubble">
  <div class="speechBubbleContent">Some realy really really long text</div>
</div>
&#13;
&#13;
&#13;

0 个答案:

没有答案