skip to Main Content

I am trying to make a message with bootstrap to I would like something like it

Image example:

enter image description here

Here is what I tried so far

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
 
<div class="container">
  <img src="http://www.limestone.edu/sites/default/files/user.png" width="40px;" height="40px;"  class="img-responsive img-circle" />
  <div class="panel panel-default">

    <div class="panel-heading">message here</div>
    
  </div>
</div>

</body>
</html>

The question is how to get a bootstrap panel style like the image example and also align the user picture to the panel ?

2

Answers


  1. Try this?

    Edited to show user image closer

    #curvedarrow {
        position: relative;
        width: 0;
        height: 0;
        -webkit-transform: rotate(25deg);
      -moz-transform: rotate(25deg);
      -ms-transform: rotate(25deg);
      -o-transform: rotate(25deg);
    }
    #curvedarrow:after {
        content: "";
        position: absolute;
        border: 0 solid transparent;
        border-right: 7px solid #ddd;
        border-radius: 1px 3px 17px 0px;
        top: 12px;
        left: -5px;
        width: 12px;
        height: 12px;
        -webkit-transform: rotate(60deg);
      -moz-transform: rotate(60deg);
      -ms-transform: rotate(60deg);
      -o-transform: rotate(60deg);
    }
    #img-block{
        padding-right: 5px;
        padding-left: 5px;
        width: 60px;
        display: inline-block;
    }
    #message-block{
        padding-left: 0;
        display: inline-block;
        width: calc(100% - 65px);
        float: right;
    }
    <!DOCTYPE html>
    <html lang="en">
    <head>
      <title>Bootstrap Example</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    </head>
    <body>
     
    <div class="container">
    <div class="row">
    <div id="img-block">
      <img src="http://www.limestone.edu/sites/default/files/user.png" width="40px;" height="40px;"  class="img-responsive img-circle" />
      </div>
      <div class="col-xs-12" id="message-block">
      
      <div class="panel panel-default">
    <div id="curvedarrow"></div>
        <div class="panel-heading">message here</div>
        
      </div>
      </div>
      </div>
    </div>
    
    </body>
    </html>
    Login or Signup to reply.
  2. Here’s my basic attempt. I simply used the idea from here: CSS3 moon shape

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <title>Bootstrap Example</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    </head>
    <body>
     
    <div class="container">
      <img src="http://www.limestone.edu/sites/default/files/user.png" width="40px;" height="40px;"  class="img-responsive img-circle" />          
        <div class="something">
        </div>
      <div class="panel panel-default">
    
        <div class="panel-heading">message here</div>
        
      </div>
    </div>
    <style>
    .something {
        box-shadow: inset 0px 15px #ddd, inset 0px 15px 1px 1px #ddd;
        height: 30px;
        width: 30px;
        border-radius: 50%;
        position: relative;
        top: 10px;
        left: -2px;
        z-index: -1;
        transform: rotate(-250deg);
    }
    
    .panel {
        position: relative;
        top: 5px;
        left: -25px;
        background: #00728D;
        }
    .container * {
      display: inline-block;
    }
    </body>
    </html>
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search