html - Right position of DIVs in a pure CSS text chat simulation -



html - Right position of DIVs in a pure CSS text chat simulation -

i trying create appearance of text chat using pure css. kind of text chat 1 person's texts represented speech bubbles on left of screen, , other persons speech bubbles on right side of screen.

i'm there, , i've created jsfiddle example. there 2 problems.

the big problem bubbles pointer on right side, representing person on right, needs aligned on right side. can't find way them align without floating them, , if float them, overlap other bubbles , create mess.

how class bubble-right stick right side?

the sec issue i'm using display: inline-block; makes bubbles wide text. had set white-space: pre-line; in containing div in order bubbles stack properly. unfortunately, creating space. tried putting in line-height declarations prevent this, doesn't seem have helped.

how bubbles stack , alternate vertically without making whitespace don't need?

here css:

.bubble-dialog { white-space: pre-line; line-height:0; } .bubble-left, .bubble-right { line-height: 100%; display: inline-block; position: relative; padding: .25em .5em; background: pink; border: reddish solid 3px; -webkit-border-radius: 11px; -moz-border-radius: 11px; border-radius: 11px; margin-bottom: 2em; } .bubble-left { margin-right:10%; } .bubble-right { margin-left:10% } .bubble-left:after, .bubble-left:before, .bubble-right:after, .bubble-right:before { content: ""; position: absolute; top: 21px; border-style: solid; border-width: 13px 17px 13px 0; border-color: transparent pink; display: block; width: 0; } .bubble-left:after, .bubble-left:before { border-width: 13px 17px 13px 0; border-color: transparent pink; } .bubble-right:after, .bubble-right:before { border-width: 13px 0 13px 17px; border-color: transparent pink; } .bubble-left:after { left: -16px; border-color: transparent pink; z-index: 1; } .bubble-left:before { left: -19px; border-color: transparent red; z-index: 0; } .bubble-right:after { right:-16px; border-color: transparent pink; z-index: 1; } .bubble-right:before { right:-19px; border-color: transparent red; z-index: 0; }

i don't understand sec problem well, first problem can add together css left , right classes:

i add together clear:both , display:block , add together float said, , right bubbles stick @ right side; here fiddle:

.bubble-left, .bubble-right { line-height: 100%; display: block; position: relative; padding: .25em .5em; background: pink; border: reddish solid 3px; -webkit-border-radius: 11px; -moz-border-radius: 11px; border-radius: 11px; margin-bottom: 2em; clear: both; max-width:50%; } .bubble-left { float: left margin-right:10%; } .bubble-right { float:right; margin-left:10% }

and sec problem, don't know why spaces there, removing buttom margin of <p> tag gets ok add together margin-bottom:0 <p> tag;

html css css3

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -