Skip to content Skip to sidebar Skip to footer

Div Tag Creating New Line In Php

I am trying to style results from database but when I echo
it is creating new line after each result. How can I force the div not to create a new line? .message { b

Solution 1:

You create new DIVs every time. Every div by default starts with a new line.

Solution 2:

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.

Solution 3:

.message{
        border:2px solid;
        background-color:white;
        float:left;
        }

try with above css will display in one line

Solution 4:

Use css property display:inline-block e.g.

.message{
  border:2px solid;
  background-color:white;
  display:inline-block;
 }

It will arrange your messages linearly.

Solution 5:

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;
}

Post a Comment for "Div Tag Creating New Line In Php"