html - DIV position and alignment issue -


i trying create chat window per attachment below:

chat window

this have created in jsfiddle:

i trying make blue div payment information in center , top div in left, able make first div in left easily, cant bring payment div in center, not sure missing

here code well

     <style>  .chat_widget_body{float:left; width:100%; min-height:550px; padding:25px; box-sizing:border-box;}  .chat_widget_bubble_green{background:#c5d6b6; float:left; display:inline-block; padding:15px; border-radius:6px; position:relative;font-family: "montserrat-regular"; font-size:15px; font-weight:400; color:#404040;}  .chat_widget_bubble_green:after {right: 100%; top: 70%; border: solid transparent; content: " "; height: 0; width: 0; position: absolute; pointer-events: none; border-color: rgba(197, 214, 183, 0); border-right-color: #c5d6b7; border-width: 12px; margin-top: -12px;}  .chat_widget_bubble_green > .msg_time{font-size:11px; float:left; width:100%; text-align:right; padding:10px 10px 0 10px; box-sizing:border-box; color:#6f6f6f;}  .chat_widget_notification{display:inline-block; margin:0 auto; padding:10px; border-radius:6px; font-family: "montserrat-regular"; font-size:15px; background:#d9efff; border:1px solid #b7ccdb; color:#404040; clear:both;}  .chat_widget_footer{float:left; width:100%;}  </style>
<div class="chat_widget_body">    <div class="chat_widget_bubble_green"> headache since last night. please guide me      <div class="msg_time">today | 11:00 <i class="fa fa-check" aria-hidden="true"></i></div>    </div>    <div class="chat_widget_notification">payment of rs. 330.00 received</div>  </div>  <div class="chat_widget_footer"></div>

you need set float: right in .chat_widget_notification, along few tweaks

edit op comment:

can make blue box centered?

set display:block instead of inline-block , give width in .chat_widget_notification

.chat_widget_body {    float: left;    width: 100%;    min-height: 550px;    padding: 25px;    box-sizing: border-box;    border: dashed black 1px  }  .chat_widget_bubble_green {    background: #c5d6b6;    float: left;    display: inline-block;    padding: 15px;    border-radius: 6px;    position: relative;    font-family: "montserrat-regular";    font-size: 15px;    font-weight: 400;    color: #404040;    width: 70%;    margin: 10px 0  }  .chat_widget_bubble_green:after {    right: 100%;    top: 70%;    border: solid transparent;    content: " ";    height: 0;    width: 0;    position: absolute;    pointer-events: none;    border-color: rgba(197, 214, 183, 0);    border-right-color: #c5d6b7;    border-width: 12px;    margin-top: -12px;  }  .chat_widget_bubble_green > .msg_time {    font-size: 11px;    float: left;    width: 100%;    text-align: right;    padding: 10px 10px 0 10px;    box-sizing: border-box;    color: #6f6f6f;  }  .chat_widget_notification {    display: block;    width: 40%;    margin: 0 auto;    padding: 10px;    border-radius: 6px;    font-family: "montserrat-regular";    font-size: 15px;    background: #d9efff;    border: 1px solid #b7ccdb;    color: #404040;    clear: both;  }  .chat_widget_footer {    float: left;    width: 100%;  }  </style>
<div class="chat_widget_body">    <div class="chat_widget_bubble_green">too headache since last night. please guide me      <div class="msg_time">today | 11:00 <i class="fa fa-check" aria-hidden="true"></i>      </div>    </div>    <div class="chat_widget_notification">payment of rs. 330.00 received</div>    <div class="chat_widget_bubble_green">too headache since last night. please guide me      <div class="msg_time">today | 11:00 <i class="fa fa-check" aria-hidden="true"></i>      </div>    </div>    <div class="chat_widget_notification">payment of rs. 330.00 received</div>  </div>  <div class="chat_widget_footer"></div>


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -