Jump to content
piano0011

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

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?

 

 

Edited by piano0011

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

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.