Jump to content

trying to understand more about float: left and display: inline block


piano0011

Recommended Posts

Hey guys!

I have been trying to learn about CSS and drop down menu from this channel and at 11:01, he uses a float: left in the nav ul li {} element to display them in a straight line instead of display: inline block? I guess there is more than one way of doing things but which way is better? I read from google or stackflow that the latter is the preferred choice?

 

 

Link to comment
Share on other sites

yay, no more ridiculously large videos!

float was available earlier, but since CSS 2.1 inline-block is indeed superior for this. Google can offer more on the subject; basically, float has a much more significant impact on elements' positioning, so if all you want to do is "collapse" elements to display side by side then inline-block will have the desired effect without other side effects.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.