CSS Styling: How do I get one div next to another?

How do I place multiple divs next to eachother? I tried using float left and float right but it isn’t working.

1 Like

I wonder how other folks solve this.
I know about bootstrap grid system and… maybe flexbox?
but I usually change the div to a span tag/element instead ( not sure if it’s a good solution or not ).
So yeah I also wonder about the best way to solve this.

There are various ways to have your divs next to each other, like @psyperl said. Aside from using a framework (Bootstrap uses flexbox), you can use floats, flexbox or inline-block depending on your needs.

The difference with flexbox is that you apply the style only to the parent container (at least for basic styling). And, when using floats, you’ll need to have a clear div to stop the floating.

Here is an example with these three methods.

More about flexbox, display and float.

1 Like

Thanks for the help. I’ll research these techniques.