我们如何将1px边框应用于这些气泡?

similar SO post在这里不起作用,因为我们使用了另一种方法来生成气泡



.chat-messages {
  width: calc(100%);
  padding-bottom: 5px;
  background-color: #f3f3f4;
}
.sb-time {
  font-size: 10pt;
  font-weight: 400;
  margin: 7px -5px 0px 10px;
  float: right;
}
.sb {
  font-size: 13pt;
  font-weight: 500;
  border-radius: 6px;
  display: block;
  padding: 10px 15px 5px 15px;
  position: relative;
  vertical-align: top;
  clear: both;
}
.sb::before {
  content: "\00a0";
  display: block;
  height: 15px;
  position: absolute;
  top: 10px;
  -moz-transform: rotate(30deg) skew(-35deg);
  -ms-transform: rotate(30deg) skew(-35deg);
  -o-transform: rotate(30deg) skew(-35deg);
  -webkit-transform: rotate(30deg) skew(-35deg);
  transform: rotate(30deg) skew(-35deg);
  width: 15px;
}
.sb-0 {
  background-color: #ffffff;
  float: left;
  margin: 5px 17% 5px 20px;
}
.sb-0::before {
  background-color: #ffffff;
  left: -8px;
}
.sb-1 {
background-color: #EEFFDD;
float: right;
margin: 5px 20px 5px 17%;
}

.sb-1::before {
    background-color: #EEFFDD;
    right: -8px;
}

<div class="chat-messages" style="max-height: 472px; overflow: hidden; width: auto; height: 472px;">
  <div class="sb sb-text sb-0">Hi
    <div class="sb-time">09:16</div>
  </div>
  <div class="sb sb-text sb-0">Fine. Thnks
    <div class="sb-time">09:19</div>
  </div>
  <div class="sb sb-text sb-1">What subject u are talking about ?
    <div class="sb-time">09:19</div>
  </div>
</div>

最佳答案

看看这个Jsfiddle

这些是我所做的更改:

.sb {
  border: 1px solid #000;
}

.sb::before {
  height: 12px;
  top: 12px;
  border-left: 1px solid #000;
  border-bottom: 1px solid #000;
}

.sb-0 {
  background-color: #ffffff;
  float: left;
  margin: 5px 17% 5px 20px;
}

.sb-0::before {
  left: -9px;
}


编辑

更新了Jsfiddle以在右侧也包含气泡。

关于css - 将1px边框应用于CSS气泡?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38168205/

10-13 04:17