How can I left align and right align my chat bubbles?












0















I have created two chat bubbles which one of them I need to be left aligned and other one I need to be right aligned .As of now my css grow both till the end like below image .



enter image description here



As of now I do not want to hardcode the width and want the bubble to grow with chat text and both one should be left aligned and other one should be right aligned like below:



enter image description here



CSS:



.speech-wrapper{
padding: 5px 6px;

}
.chatbox {
padding: 5px;
margin-left: 5px;
margin-right: 5px;
margin-top:0px;
background: #075698;
color: #FFF;
position: relative;
border-radius: 10px;
overflow-wrap: break-word;
word-wrap: break-word;
hyphens: auto;
box-shadow: 0 8px 6px -6px black;




}
.chatbox_other{
height:auto;
padding: 5px;
margin-left: 5px;
margin-right: 5px;
margin-top:0px;
background: #DCDCDC;
color: #000;
position: relative;
border-radius: 10px;
overflow-wrap: break-word;
word-wrap: break-word;
hyphens: auto;
box-shadow: 0 8px 6px -6px black;


}

.name_other{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #1970b0;
}
.name_other1{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #ba006e;
}
.name_other2{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #007670;
}
.name_other3{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #3b0256;
}
.name_other4{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #00512b;
}
.name_other5{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #a91024;
}
.name_other6{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #b8471b;
}
.name_other7{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #7f1c7d;
}

.timestamp_other{
font-size: 11px;
position: absolute;
bottom: 0px;
right: 10px;
text-transform: uppercase; color: #999
}
.timestamp{
font-size: 11px;
position: absolute;
bottom: 0px;
right: 10px;
text-transform: uppercase; color: #fff
}
/* speech bubble 13 */
.name{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #ffffff;
}


.triangle.left-top:after {
content: ' ';
position: absolute;
width: 0;
height: 0;
left: -10px;
right: auto;
top: 0px;
bottom: auto;
border: 22px solid;
border-color: #DCDCDC transparent transparent transparent;
z-index: -1;
}

.triangle.right-top:before {
content: ' ';
position: absolute;
width: 0;
height: 0;
left: auto;
right: -10px;
top: 0;
bottom: auto;
border: 32px solid;
border-color: #075698 transparent transparent
transparent;
z-index: -1;
}
.alt{
margin: 0 0 0 60px;
}


HTML:



<div class="speech-wrapper">
<div class="chatbox triangle right-top alt">
<div class="txt">
<p class="name">Apple TestUser1</p>Hi<span class="timestamp">10:20 pm</span></div>
</div>

<div class="speech-wrapper">
<div class="chatbox_other triangle left-top">
<div class="txt">
<p class="name">Apple TestUser1</p>Hi<span class="timestamp">10:20 pm</span>
</div>
</div>
</div>
</div>


I have tried uisng float left but while reducing the windows size the chat started overlapping on eachother



For testing out try below link
https://codepen.io/rajesh-kumar-dash/pen/KbvqQX










share|improve this question

























  • I do not get what is the issue??

    – Ingus
    Jan 2 at 15:01











  • @ingus The issue is with the layout.Both the bubble as of now grow till the end as both width and height are auto .I want them to take space as much as text.And One should be right aligned and other should be left aligned

    – Rajesh
    Jan 2 at 15:03











  • It will be hard to get to the desired effect with the current code, as the "bubbles" take by default the maximum size less the margins. They cannot at the same time adapt to their content. What is your other version using float? It looks more promising, shouldn't be that hard to fix the overlapping.

    – Kaddath
    Jan 2 at 15:12
















0















I have created two chat bubbles which one of them I need to be left aligned and other one I need to be right aligned .As of now my css grow both till the end like below image .



enter image description here



As of now I do not want to hardcode the width and want the bubble to grow with chat text and both one should be left aligned and other one should be right aligned like below:



enter image description here



CSS:



.speech-wrapper{
padding: 5px 6px;

}
.chatbox {
padding: 5px;
margin-left: 5px;
margin-right: 5px;
margin-top:0px;
background: #075698;
color: #FFF;
position: relative;
border-radius: 10px;
overflow-wrap: break-word;
word-wrap: break-word;
hyphens: auto;
box-shadow: 0 8px 6px -6px black;




}
.chatbox_other{
height:auto;
padding: 5px;
margin-left: 5px;
margin-right: 5px;
margin-top:0px;
background: #DCDCDC;
color: #000;
position: relative;
border-radius: 10px;
overflow-wrap: break-word;
word-wrap: break-word;
hyphens: auto;
box-shadow: 0 8px 6px -6px black;


}

.name_other{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #1970b0;
}
.name_other1{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #ba006e;
}
.name_other2{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #007670;
}
.name_other3{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #3b0256;
}
.name_other4{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #00512b;
}
.name_other5{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #a91024;
}
.name_other6{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #b8471b;
}
.name_other7{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #7f1c7d;
}

.timestamp_other{
font-size: 11px;
position: absolute;
bottom: 0px;
right: 10px;
text-transform: uppercase; color: #999
}
.timestamp{
font-size: 11px;
position: absolute;
bottom: 0px;
right: 10px;
text-transform: uppercase; color: #fff
}
/* speech bubble 13 */
.name{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #ffffff;
}


.triangle.left-top:after {
content: ' ';
position: absolute;
width: 0;
height: 0;
left: -10px;
right: auto;
top: 0px;
bottom: auto;
border: 22px solid;
border-color: #DCDCDC transparent transparent transparent;
z-index: -1;
}

.triangle.right-top:before {
content: ' ';
position: absolute;
width: 0;
height: 0;
left: auto;
right: -10px;
top: 0;
bottom: auto;
border: 32px solid;
border-color: #075698 transparent transparent
transparent;
z-index: -1;
}
.alt{
margin: 0 0 0 60px;
}


HTML:



<div class="speech-wrapper">
<div class="chatbox triangle right-top alt">
<div class="txt">
<p class="name">Apple TestUser1</p>Hi<span class="timestamp">10:20 pm</span></div>
</div>

<div class="speech-wrapper">
<div class="chatbox_other triangle left-top">
<div class="txt">
<p class="name">Apple TestUser1</p>Hi<span class="timestamp">10:20 pm</span>
</div>
</div>
</div>
</div>


I have tried uisng float left but while reducing the windows size the chat started overlapping on eachother



For testing out try below link
https://codepen.io/rajesh-kumar-dash/pen/KbvqQX










share|improve this question

























  • I do not get what is the issue??

    – Ingus
    Jan 2 at 15:01











  • @ingus The issue is with the layout.Both the bubble as of now grow till the end as both width and height are auto .I want them to take space as much as text.And One should be right aligned and other should be left aligned

    – Rajesh
    Jan 2 at 15:03











  • It will be hard to get to the desired effect with the current code, as the "bubbles" take by default the maximum size less the margins. They cannot at the same time adapt to their content. What is your other version using float? It looks more promising, shouldn't be that hard to fix the overlapping.

    – Kaddath
    Jan 2 at 15:12














0












0








0








I have created two chat bubbles which one of them I need to be left aligned and other one I need to be right aligned .As of now my css grow both till the end like below image .



enter image description here



As of now I do not want to hardcode the width and want the bubble to grow with chat text and both one should be left aligned and other one should be right aligned like below:



enter image description here



CSS:



.speech-wrapper{
padding: 5px 6px;

}
.chatbox {
padding: 5px;
margin-left: 5px;
margin-right: 5px;
margin-top:0px;
background: #075698;
color: #FFF;
position: relative;
border-radius: 10px;
overflow-wrap: break-word;
word-wrap: break-word;
hyphens: auto;
box-shadow: 0 8px 6px -6px black;




}
.chatbox_other{
height:auto;
padding: 5px;
margin-left: 5px;
margin-right: 5px;
margin-top:0px;
background: #DCDCDC;
color: #000;
position: relative;
border-radius: 10px;
overflow-wrap: break-word;
word-wrap: break-word;
hyphens: auto;
box-shadow: 0 8px 6px -6px black;


}

.name_other{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #1970b0;
}
.name_other1{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #ba006e;
}
.name_other2{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #007670;
}
.name_other3{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #3b0256;
}
.name_other4{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #00512b;
}
.name_other5{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #a91024;
}
.name_other6{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #b8471b;
}
.name_other7{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #7f1c7d;
}

.timestamp_other{
font-size: 11px;
position: absolute;
bottom: 0px;
right: 10px;
text-transform: uppercase; color: #999
}
.timestamp{
font-size: 11px;
position: absolute;
bottom: 0px;
right: 10px;
text-transform: uppercase; color: #fff
}
/* speech bubble 13 */
.name{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #ffffff;
}


.triangle.left-top:after {
content: ' ';
position: absolute;
width: 0;
height: 0;
left: -10px;
right: auto;
top: 0px;
bottom: auto;
border: 22px solid;
border-color: #DCDCDC transparent transparent transparent;
z-index: -1;
}

.triangle.right-top:before {
content: ' ';
position: absolute;
width: 0;
height: 0;
left: auto;
right: -10px;
top: 0;
bottom: auto;
border: 32px solid;
border-color: #075698 transparent transparent
transparent;
z-index: -1;
}
.alt{
margin: 0 0 0 60px;
}


HTML:



<div class="speech-wrapper">
<div class="chatbox triangle right-top alt">
<div class="txt">
<p class="name">Apple TestUser1</p>Hi<span class="timestamp">10:20 pm</span></div>
</div>

<div class="speech-wrapper">
<div class="chatbox_other triangle left-top">
<div class="txt">
<p class="name">Apple TestUser1</p>Hi<span class="timestamp">10:20 pm</span>
</div>
</div>
</div>
</div>


I have tried uisng float left but while reducing the windows size the chat started overlapping on eachother



For testing out try below link
https://codepen.io/rajesh-kumar-dash/pen/KbvqQX










share|improve this question
















I have created two chat bubbles which one of them I need to be left aligned and other one I need to be right aligned .As of now my css grow both till the end like below image .



enter image description here



As of now I do not want to hardcode the width and want the bubble to grow with chat text and both one should be left aligned and other one should be right aligned like below:



enter image description here



CSS:



.speech-wrapper{
padding: 5px 6px;

}
.chatbox {
padding: 5px;
margin-left: 5px;
margin-right: 5px;
margin-top:0px;
background: #075698;
color: #FFF;
position: relative;
border-radius: 10px;
overflow-wrap: break-word;
word-wrap: break-word;
hyphens: auto;
box-shadow: 0 8px 6px -6px black;




}
.chatbox_other{
height:auto;
padding: 5px;
margin-left: 5px;
margin-right: 5px;
margin-top:0px;
background: #DCDCDC;
color: #000;
position: relative;
border-radius: 10px;
overflow-wrap: break-word;
word-wrap: break-word;
hyphens: auto;
box-shadow: 0 8px 6px -6px black;


}

.name_other{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #1970b0;
}
.name_other1{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #ba006e;
}
.name_other2{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #007670;
}
.name_other3{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #3b0256;
}
.name_other4{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #00512b;
}
.name_other5{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #a91024;
}
.name_other6{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #b8471b;
}
.name_other7{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #7f1c7d;
}

.timestamp_other{
font-size: 11px;
position: absolute;
bottom: 0px;
right: 10px;
text-transform: uppercase; color: #999
}
.timestamp{
font-size: 11px;
position: absolute;
bottom: 0px;
right: 10px;
text-transform: uppercase; color: #fff
}
/* speech bubble 13 */
.name{
font-weight: 600;
font-size: 12px;
margin: 0px 0px 9px;
color: #ffffff;
}


.triangle.left-top:after {
content: ' ';
position: absolute;
width: 0;
height: 0;
left: -10px;
right: auto;
top: 0px;
bottom: auto;
border: 22px solid;
border-color: #DCDCDC transparent transparent transparent;
z-index: -1;
}

.triangle.right-top:before {
content: ' ';
position: absolute;
width: 0;
height: 0;
left: auto;
right: -10px;
top: 0;
bottom: auto;
border: 32px solid;
border-color: #075698 transparent transparent
transparent;
z-index: -1;
}
.alt{
margin: 0 0 0 60px;
}


HTML:



<div class="speech-wrapper">
<div class="chatbox triangle right-top alt">
<div class="txt">
<p class="name">Apple TestUser1</p>Hi<span class="timestamp">10:20 pm</span></div>
</div>

<div class="speech-wrapper">
<div class="chatbox_other triangle left-top">
<div class="txt">
<p class="name">Apple TestUser1</p>Hi<span class="timestamp">10:20 pm</span>
</div>
</div>
</div>
</div>


I have tried uisng float left but while reducing the windows size the chat started overlapping on eachother



For testing out try below link
https://codepen.io/rajesh-kumar-dash/pen/KbvqQX







html css






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 2 at 15:21









isherwood

37.5k1082112




37.5k1082112










asked Jan 2 at 14:57









RajeshRajesh

89041638




89041638













  • I do not get what is the issue??

    – Ingus
    Jan 2 at 15:01











  • @ingus The issue is with the layout.Both the bubble as of now grow till the end as both width and height are auto .I want them to take space as much as text.And One should be right aligned and other should be left aligned

    – Rajesh
    Jan 2 at 15:03











  • It will be hard to get to the desired effect with the current code, as the "bubbles" take by default the maximum size less the margins. They cannot at the same time adapt to their content. What is your other version using float? It looks more promising, shouldn't be that hard to fix the overlapping.

    – Kaddath
    Jan 2 at 15:12



















  • I do not get what is the issue??

    – Ingus
    Jan 2 at 15:01











  • @ingus The issue is with the layout.Both the bubble as of now grow till the end as both width and height are auto .I want them to take space as much as text.And One should be right aligned and other should be left aligned

    – Rajesh
    Jan 2 at 15:03











  • It will be hard to get to the desired effect with the current code, as the "bubbles" take by default the maximum size less the margins. They cannot at the same time adapt to their content. What is your other version using float? It looks more promising, shouldn't be that hard to fix the overlapping.

    – Kaddath
    Jan 2 at 15:12

















I do not get what is the issue??

– Ingus
Jan 2 at 15:01





I do not get what is the issue??

– Ingus
Jan 2 at 15:01













@ingus The issue is with the layout.Both the bubble as of now grow till the end as both width and height are auto .I want them to take space as much as text.And One should be right aligned and other should be left aligned

– Rajesh
Jan 2 at 15:03





@ingus The issue is with the layout.Both the bubble as of now grow till the end as both width and height are auto .I want them to take space as much as text.And One should be right aligned and other should be left aligned

– Rajesh
Jan 2 at 15:03













It will be hard to get to the desired effect with the current code, as the "bubbles" take by default the maximum size less the margins. They cannot at the same time adapt to their content. What is your other version using float? It looks more promising, shouldn't be that hard to fix the overlapping.

– Kaddath
Jan 2 at 15:12





It will be hard to get to the desired effect with the current code, as the "bubbles" take by default the maximum size less the margins. They cannot at the same time adapt to their content. What is your other version using float? It looks more promising, shouldn't be that hard to fix the overlapping.

– Kaddath
Jan 2 at 15:12












2 Answers
2






active

oldest

votes


















0














The "dirty" way to do it is by adding a after the divs just to clear the float:



<div class="speech-wrapper"><div class="chatbox triangle right-top alt"><div class="txt"><p class="name">Apple TestUser1</p>Hi<span class="timestamp">10:20 pm</span></div></div>
<div style="clear:both"></div>
<div class="speech-wrapper"><div class="chatbox_other triangle left-top"><div class="txt"><p class="name">Apple TestUser1</p>Hi<span class="timestamp">10:20 pm</span></div></div>
<div style="clear:both"></div>


The cleaner way to do it is called "Clearfix". I suggest you take a look on these two links to understand it and use on your code:



https://www.w3schools.com/css/css_float.asp



https://css-tricks.com/snippets/css/clear-fix/






share|improve this answer































    0














    I think using float: right; for the right bubble and for the left bubble: float: left; with width: auto; should work






    share|improve this answer
























    • You could also add max-width so the bubble won't grow out of the chat

      – Arno van Liere
      Jan 2 at 15:22











    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54008506%2fhow-can-i-left-align-and-right-align-my-chat-bubbles%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    The "dirty" way to do it is by adding a after the divs just to clear the float:



    <div class="speech-wrapper"><div class="chatbox triangle right-top alt"><div class="txt"><p class="name">Apple TestUser1</p>Hi<span class="timestamp">10:20 pm</span></div></div>
    <div style="clear:both"></div>
    <div class="speech-wrapper"><div class="chatbox_other triangle left-top"><div class="txt"><p class="name">Apple TestUser1</p>Hi<span class="timestamp">10:20 pm</span></div></div>
    <div style="clear:both"></div>


    The cleaner way to do it is called "Clearfix". I suggest you take a look on these two links to understand it and use on your code:



    https://www.w3schools.com/css/css_float.asp



    https://css-tricks.com/snippets/css/clear-fix/






    share|improve this answer




























      0














      The "dirty" way to do it is by adding a after the divs just to clear the float:



      <div class="speech-wrapper"><div class="chatbox triangle right-top alt"><div class="txt"><p class="name">Apple TestUser1</p>Hi<span class="timestamp">10:20 pm</span></div></div>
      <div style="clear:both"></div>
      <div class="speech-wrapper"><div class="chatbox_other triangle left-top"><div class="txt"><p class="name">Apple TestUser1</p>Hi<span class="timestamp">10:20 pm</span></div></div>
      <div style="clear:both"></div>


      The cleaner way to do it is called "Clearfix". I suggest you take a look on these two links to understand it and use on your code:



      https://www.w3schools.com/css/css_float.asp



      https://css-tricks.com/snippets/css/clear-fix/






      share|improve this answer


























        0












        0








        0







        The "dirty" way to do it is by adding a after the divs just to clear the float:



        <div class="speech-wrapper"><div class="chatbox triangle right-top alt"><div class="txt"><p class="name">Apple TestUser1</p>Hi<span class="timestamp">10:20 pm</span></div></div>
        <div style="clear:both"></div>
        <div class="speech-wrapper"><div class="chatbox_other triangle left-top"><div class="txt"><p class="name">Apple TestUser1</p>Hi<span class="timestamp">10:20 pm</span></div></div>
        <div style="clear:both"></div>


        The cleaner way to do it is called "Clearfix". I suggest you take a look on these two links to understand it and use on your code:



        https://www.w3schools.com/css/css_float.asp



        https://css-tricks.com/snippets/css/clear-fix/






        share|improve this answer













        The "dirty" way to do it is by adding a after the divs just to clear the float:



        <div class="speech-wrapper"><div class="chatbox triangle right-top alt"><div class="txt"><p class="name">Apple TestUser1</p>Hi<span class="timestamp">10:20 pm</span></div></div>
        <div style="clear:both"></div>
        <div class="speech-wrapper"><div class="chatbox_other triangle left-top"><div class="txt"><p class="name">Apple TestUser1</p>Hi<span class="timestamp">10:20 pm</span></div></div>
        <div style="clear:both"></div>


        The cleaner way to do it is called "Clearfix". I suggest you take a look on these two links to understand it and use on your code:



        https://www.w3schools.com/css/css_float.asp



        https://css-tricks.com/snippets/css/clear-fix/







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 2 at 15:19









        vinyluisvinyluis

        63




        63

























            0














            I think using float: right; for the right bubble and for the left bubble: float: left; with width: auto; should work






            share|improve this answer
























            • You could also add max-width so the bubble won't grow out of the chat

              – Arno van Liere
              Jan 2 at 15:22
















            0














            I think using float: right; for the right bubble and for the left bubble: float: left; with width: auto; should work






            share|improve this answer
























            • You could also add max-width so the bubble won't grow out of the chat

              – Arno van Liere
              Jan 2 at 15:22














            0












            0








            0







            I think using float: right; for the right bubble and for the left bubble: float: left; with width: auto; should work






            share|improve this answer













            I think using float: right; for the right bubble and for the left bubble: float: left; with width: auto; should work







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 2 at 15:20









            Arno van LiereArno van Liere

            35




            35













            • You could also add max-width so the bubble won't grow out of the chat

              – Arno van Liere
              Jan 2 at 15:22



















            • You could also add max-width so the bubble won't grow out of the chat

              – Arno van Liere
              Jan 2 at 15:22

















            You could also add max-width so the bubble won't grow out of the chat

            – Arno van Liere
            Jan 2 at 15:22





            You could also add max-width so the bubble won't grow out of the chat

            – Arno van Liere
            Jan 2 at 15:22


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54008506%2fhow-can-i-left-align-and-right-align-my-chat-bubbles%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            How to fix TextFormField cause rebuild widget in Flutter

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith