Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Floats for layout?

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #238100
    arnsa
    Participant

    Hello,

    so I’ve read a lot of articles on the internet that we shouldn’t use floats for layout purposes if it’s possible, because floats weren’t created with an intention to create website layouts. I don’t want to use flexbox either, because it isn’t widely supported yet.

    So, there are a lot more options, like display: inline-block, display: table, using position (and I’m sure there are a few more). But then I came up to a guy on the IRC in CSS channel and he told me that there’s nothing wrong with using floats at all. Basically, if you can accomplish something you want with floats, this is the correct way most of the time. He mentioned, that using display: table will require to write a lot more code and display: inline-block will cause a lot more problems than using floats. So what’s the situation here, really? Is he correct or wrong? Is using floats for layout purposes fine? Thanks.

    #238103
    Paulie_D
    Member

    The fact is that the only method actually designed for layout IS flexbox.

    All the other options weren’t designed for layout but that’s how they are used.

    Basically, you can safely use any method that suits your fancy as and when the design requires it. You can mix and match as long as you are aware of the drawbacks of each option.

    Maybe that will be CSS Tables, inline-block, floats or even actual tables…whatever is right at the time.

    Me…I default to flexbox as I don’t have to support IE9 and below.

    Not widely supported.

    Well I disagree with that but you would know your audience…or at least your analytics can tell you.

    #238104
    arnsa
    Participant

    Great point you have there. But I have a few more questions to you.

    First of all, how do I know when I should use display inline-block, tables, floats or whatever else. How do I know which one is the correct for the current situation?

    The second question is… how do you determine whether you have to support IE9 and below or not? Case scenario one: I create your own project, so how do I know if I should support IE9 and below or not?

    Case scenario two: I work at a company or as a freelancer. In that case I suppose my client will tell me if I should support it or not?

    #238120
    Paulie_D
    Member

    First of all, how do I know when I should use display inline-block, tables, floats or whatever else. How do I know which one is the correct for the current situation?

    Unfortunately, the answer is experience.

    The second question is… how do you determine whether you have to support IE9 and below or not?

    If I’m creating my own project for my own use then I’ll decide what browsers I want to support based on the audience I’m trying to reach.

    For my company, they’ll check their analytics to see what browsers are being used to visit their site(s) first…then decide, again, on who they are trying to reach.

    I’ll still probably build with fallbacks for, perhaps, one older version than my target minimum but with the knowledge that those users won’t get the full experience.

    It’s a balancing act…

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.