I am trying to style results from database but when I echo
you can either display the div as inline-block
or set float: [left|right]
Using inline style
style="display: inline-block;"
style="float: left;"
using css
.message {
display: inline-block;
}
.message {
float: left;
}
Consider using <span>
instead of <div>
<span>
are already inline tags where <div>
are blocks by default, which create a new line for the content in it.
You create new DIVs every time. Every div by default starts with a new line.
Use css property display:inline-block e.g.
.message{
border:2px solid;
background-color:white;
display:inline-block;
}
It will arrange your messages linearly.
.message{
border:2px solid;
background-color:white;
float:left;
}
try with above css will display in one line