红色instagram通知泡影 - css

时间:2018-05-20 01:46:13

标签: css css3

我真的想在css 中使用创建红色instagram气泡,如下图所示:

enter image description here

除了圆形笔尖外,我几乎都有,但我不确定应该怎样做才能做到最好......

这是我到目前为止所做的:

.notif {
  display: block;
  height: 35px;
  background: #E95950;
  color: #fff;
  -webkit-filter: drop-shadow(0px 0px 5px rgba(233, 89, 80, 0.6));
  filter: drop-shadow(0px 0px 5px rgba(233, 89, 80, 0.6));
  position: absolute;
  top: 30px;
  left: 30px;
  border-radius: 7px;
}

.notif:after {
    content: '';
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #E95950;
    position: absolute;
    left: 25%;
    top: -7px;
    -webkit-transform: translateX(-65%);
    transform: translateX(-65%);
}

.notifItem {
  display:inline-block;
  color: #fff;
  font-family: sans-serif;
  font-weight: 600;
  padding: 8px 5px;
  margin-right: 0px;
}


.notifItem:first-child {
  margin-left: 8px;
}

.notifItem:last-child {
  margin-right: 8px;
}
<div class="notif">
    <div class="notifItem">33</div>
    <div class="notifItem">2</div>
    <div class="notifItem">5</div>
  </div>

所以这看起来很好,我有一个我个人想要的小费,我只是不确定我怎么能模仿这个圆形的小费......

有什么想法吗?谢谢!

1 个答案:

答案 0 :(得分:1)

它可以是一个简单的矩形框,带有圆角和skewrotated

此元素可用作伪元素,并放在您已经完成的框后面。

https://codepen.io/AugustinF/pen/odmvLV

.notif {
  display: block;
  height: 35px;
  background: #E95950;
  color: #fff;
  -webkit-filter: drop-shadow(0px 0px 5px rgba(233, 89, 80, 0.6));
  filter: drop-shadow(0px 0px 5px rgba(233, 89, 80, 0.6));
  position: absolute;
  top: 30px;
  left: 30px;
  border-radius: 7px;
}

.notif:after {
  content: '';
  width: 20px;
  height: 20px;
  background-color: #E95950;
  position: absolute;
  top: -7px;
  left: 25px;
  border-radius: 3px;
  transform: skew(-30deg, 45deg);
  z-index: -1;
}

.notifItem {
  display:inline-block;
  color: #fff;
  font-family: sans-serif;
  font-weight: 600;
  padding: 8px 5px;
  margin-right: 0px;
}


.notifItem:first-child {
  margin-left: 8px;
}

.notifItem:last-child {
  margin-right: 8px;
}
<div class="notif">
    <div class="notifItem">33</div>
    <div class="notifItem">2</div>
    <div class="notifItem">5</div>
  </div>