响应式CSS语音泡沫

时间:2015-11-10 20:02:37

标签: html css responsive-design infobubble

我创建了以下语音气泡,以便为网站上的人们提供有用的提示。它有效,但没有响应,更长的评论会在某些移动设备的屏幕右侧流失。

如何使其响应?

目前看起来像:
my speech bubble

.bubble .bubble-avatar {
  float: left;
  margin-left: -125px;
  margin-top: -15px;
  font-size: 75px;
}
.bubble {
  position: relative;
  width: 250px;
  height: auto;
  min-height: 50px;
  padding: 1.5em;
  background: #FFFFFF;
  -webkit-border-radius: 10px;
  -moz-border-radius: 10px;
  border-radius: 10px;
  border: #000000 solid 3px;
  margin-left: 80px;
}
.bubble:after {
  content: '';
  position: absolute;
  border-style: solid;
  border-width: 15px 15px 15px 0;
  border-color: transparent #FFFFFF;
  display: block;
  width: 0;
  z-index: 1;
  left: -15px;
  top: 33px;
}
.bubble:before {
  font-size: 10em;
  content: '';
  position: absolute;
  border-style: solid;
  border-width: 17px 17px 17px 0;
  border-color: transparent #000000;
  display: block;
  width: 0;
  z-index: 0;
  left: -20px;
  top: 31px;
}
<div class="bubble"><i class="pw-icon-user-outline bubble-avatar"></i>
  Sorry, I feel you should stop what you are doing and have some nachos! Go on...
</div>

1 个答案:

答案 0 :(得分:0)

您可以使用overflow-wrap: break-word;

CSS中的overflow-wrap属性允许您指定浏览器可以将目标元素内的一行文本拆分成多行,而这些地方在其他地方坚不可摧。这有助于避免由于溢出而导致文本字符串过长而导致布局问题。