Jump to content

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

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.