How do I keep html elements on the same line

1

Well, theoretically my question is the following, I created two divs in html, however when doing the second one, the second div does not stay on the same "line" as the other one, but it stays below. I would like to know if there is any tag in html that keeps the elements all on the same line, without need there is css margin-top.

Thank you.

    
asked by anonymous 03.05.2016 / 03:57

2 answers

2

The question is not very specific. So it is not possible to give a concrete answer, but I will try to respond generalized. Home The div tag when created by default has the attribute in css "display: block".
If put in css .:

div{
   display:inline;
}

All div tags will have this feature, so they stayed on the same line. You can also "configure".:

div{
   float:left;
}

So, as long as the divs are on the same line they are followed, if there is no space go to the line below.

Depending on the purpose, you can also use a table.

    
03.05.2016 / 13:04
1

There is display property of elements, and some tags already have a default value for this property. The simplest case is that <div> has display:block and <span> has display:inline .

I do not recommend to change this property if we already have tags with different names to identify the function of each one.

For a better reference, please read link

    
03.05.2016 / 13:13