为什么我在最后两个聊天气泡中缺少箭头?

时间:2019-04-07 05:35:52

标签: html5 css3 chat

我正在从psd文件构建聊天记录。到目前为止,除了我的最后两个聊天气泡缺少箭头外,其他所有内容都很明确。请参阅下面的图片和代码。

enter image description here

您会看到前两个箭头指向用户,而后两个箭头缺失。我正在寻找任何人都可以向我指出如何获取最后两个聊天气泡箭头的正确方向。

* {
  margin: auto;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
}

body {
  background-color: #eeeeee;
  font-family: Roboto;
}

section {
  width: 850px;
  height: 100%;
  box-shadow: 0 15px 50px 0 rgba(0, 0, 0, 0.13);
  background-color: #ffffff;
  margin-top: 5%;
  // margin-bottom: 15.7%;
}

.header li {
  margin-top: 10%;
}

.header .header-title {
  width: 220px;
  height: 14px;
  font-size: 18px;
  font-weight: normal;
  font-style: normal;
  font-stretch: condensed;
  line-height: normal;
  letter-spacing: 3.9px;
  color: #000000;
  text-transform: uppercase;
  position: relative;
  left: -6%;
}

.header .header-date {
  width: 240px;
  height: 18px;
  font-family: Roboto;
  font-size: 18px;
  font-weight: normal;
  font-style: normal;
  font-stretch: normal;
  line-height: normal;
  letter-spacing: normal;
  text-align: right;
  color: #9a9a9a;
  position: relative;
  right: -5%;
}

.line {
  width: 750px;
  height: 5px;
  background-color: #eeeeee;
  margin-top: 5%;
  margin-bottom: 5%;
}

.chat-log {
  margin-bottom: 5%
}

#user1 {
  width: 100%;
}

#user1 ul li.avatar img {
  width: 50px;
  height: 50px;
  background-color: rgba(0, 0, 0, 0);
  position: relative;
  top: -35px;
  border-radius: 50%;
}

.message-box {
  height: 100%;
}

#user1 ul li.message .message-box {
  width: 610px;
  background-color: #f3f3f3;
  border-radius: 5px;
}

#user1 ul li.message .message-box:after {
  content: '';
  height: 0;
  position: absolute;
  width: 0;
  border: 10px solid transparent;
  border-right-color: #f3f3f3;
  right: 66.1%;
  top: 37%;
}

#user2 {
  width: 100%;
}

#user2 ul {
  flex-direction: row-reverse;
}

#user2 ul li.avatar img {
  width: 50px;
  height: 50px;
  background-color: rgba(0, 0, 0, 0);
  position: relative;
  top: -35px;
  border-radius: 50%;
}

#user2 ul li.message .message-box {
  width: 610px;
  // height: 100%;
  box-shadow: 0 15px 50px 0 rgba(0, 0, 0, 0.13);
  background-color: #ffffff;
  border-radius: 5px;
}

#user2 ul li.message .message-box:after {
  content: '';
  height: 0;
  position: absolute;
  width: 0;
  border: 10px solid transparent;
  border-left-color: #fff;
  left: 66.1%;
  top: 61%;
}

#user2 .message-box .text-bottom .user-name {
  color: #5da2ff;
}

#user2_end {
  background-color: #f3f3f3 !important;
  box-shadow: none !important;
}

.text {
  width: 557px;
  height: 65px;
  font-size: 16px;
  font-weight: normal;
  font-style: normal;
  font-stretch: normal;
  line-height: 1.5;
  letter-spacing: normal;
  color: #333333;
  position: relative;
  top: 20px;
  margin-bottom: 10%;
}

.text-bottom {
  position: relative;
  left: -11%;
  top: -10px;
}

.text-bottom .user-name {
  width: 166px;
  height: 18px;
  font-family: Roboto;
  font-size: 18px;
  font-weight: bold;
  font-style: normal;
  font-stretch: normal;
  line-height: 1;
  letter-spacing: normal;
  color: #ff5d5d;
}

.text-bottom .time {
  width: 75px;
  height: 9px;
  font-family: Roboto;
  font-size: 12px;
  font-weight: bold;
  font-style: normal;
  font-stretch: normal;
  line-height: 0;
  letter-spacing: normal;
  color: #333333;
}

.timestamp {
  position: relative;
  left: -30%;
}
<!---------------First Message------------------------>

<div class="chat-log user1" id="user1">
  <ul>
    <li class="avatar"><img src="https://via.placeholder.com/150/0000FF" alt="Mygel van Trable"></li>
    <li class="message">
      <div class="message-box">
        <p class="text">Hi Charlie! It was good meeting you for coffee the other day. I would love to talk more about your autonomous car start up! Here’s my email: webtrabel@email.com</p>
        <ul class='text-bottom'>
          <li class="user-name">Mygel van Trable</li>
          <li class="timestamp">
            <ul>
              <li class="clock-icon">
              </li>
              <li class="time">
                <p>1:41PM</p>
              </li>
            </ul>
          </li>
        </ul>
      </div>
    </li>
  </ul>
</div>

<!--------------------- Next Message ------------------->

<div class="chat-log" id='user2'>
  <ul>
    <li class="avatar"><img src="https://via.placeholder.com/150/FF0000" alt="Charlie Hemn"></li>
    <li class="message">
      <div class="message-box">
        <p class="text">Thanks, Mygel! It was a pleasure chatting with you as well. You may also be interested in learning more about my new cryptocurrency start up, Goldhill LLC!</p>
        <ul class='text-bottom'>
          <li class="timestamp">
            <ul>
              <li class="clock-icon">
              </li>
              <li class="time">
                <p>1:46PM</p>
              </li>
            </ul>
          </li>
          <li class="user-name">Charlie Hemn</li>
        </ul>
      </div>
    </li>
  </ul>
</div>

<!----------------- Next Message ------------------>
<div class="chat-log" id="user1">
  <ul>
    <li class="avatar"><img src="https://via.placeholder.com/150/0000FF" alt="Mygel van Trable"></li>
    <li class="message">
      <div class="message-box">
        <p class="text">I recently started a cryptocurrency start up as well! I’ll definitely read through the whitepaper posted on the Goldhill website and get back to you!</p>
        <ul class='text-bottom'>
          <li class="user-name">Mygel van Trable</li>
          <li class="timestamp">
            <ul>
              <li class="clock-icon">
              </li>
              <li class="time">
                <p>1:50PM</p>
              </li>
            </ul>
          </li>
        </ul>
      </div>
    </li>
  </ul>
</div>

<!----------------- Next Message ------------------->

<div class="chat-log" id='user2'>
  <ul>
    <li class="avatar"><img src="https://via.placeholder.com/150/FF0000" alt="Charlie Hemn"></li>
    <li class="message">
      <div class="message-box" id="user2_end">
        <p class="text">Sounds good to me! Looking forward to hearing from you - Charlie.</p>
        <ul class='text-bottom'>

          <li class="timestamp">
            <ul>
              <li class="clock-icon">
              </li>
              <li class="time">
                <p>2:03PM</p>
              </li>
            </ul>
          </li>
          <li class="user-name">Charlie Hemn</li>
        </ul>
      </div>
    </li>
  </ul>
</div>

0 个答案:

没有答案