What is display: flow-root and when to use it

Поділитися
Вставка
  • Опубліковано 29 січ 2025

КОМЕНТАРІ • 109

  • @erichobbs4042
    @erichobbs4042 4 роки тому +44

    It's content like this which is the reason I am subscribed. Fantastic and informative. For whatever reason, when I try and read about CSS on a blog, none of it makes sense. But when Kevin explains it, everything just clicks.

    • @KevinPowell
      @KevinPowell  4 роки тому +10

      Glad I can help out a little 😊

    • @clevermissfox
      @clevermissfox Рік тому +1

      Same here, even other creator videos don’t help as much as KPs teaching style. I want him to cover everything I have questions about and gosh he’s at least halfway there. So many concepts , tips, tricks, and explanations.

  • @wherethereswilltheresaway3297
    @wherethereswilltheresaway3297 Рік тому +1

    I gotta say, your UA-cam quiz setup is awesome. I like that when the wrong answer is chosen, it gives a detailed reasoning and includes the link to your video explaining it. That's how I ended up on this particular video. I've been following you for a while now and there's still so much of your content that I haven't gotten to, or that I come back to multiple times. You do such a great job at clearing things up for those of us who are still learning. Thank you!

  • @scaletownmodels
    @scaletownmodels 4 роки тому +5

    I've been a full stack programmer for over 20 years now, but I'm mainly backend. So I'm still always happy to pick up new front-end tips and tricks. I'm so busy all the time that it's hard to keep up with developements.

  • @boradmay
    @boradmay 4 роки тому +50

    Should have watched this six years ago

    • @nathanwebster2383
      @nathanwebster2383 4 роки тому +4

      Yep, that's when we really needed it

    • @PetervandenHeuvel81
      @PetervandenHeuvel81 4 роки тому +2

      and clearfix is what I first learned.

    • @gabydewilde
      @gabydewilde 4 роки тому +2

      @Capsaicin they are block elements, they block you, its wqhat they are for

  • @joeldcanfield_spinhead
    @joeldcanfield_spinhead 4 роки тому +26

    I find myself avoiding floats the way some folks avoid tables, even when they're appropriate. Good reminder along with the cool value.

    • @erichobbs4042
      @erichobbs4042 4 роки тому +11

      I'm working on a site at the moment, and I need to display some data in a table. I thought about the problem for a while went down a display grid rabbit hole, and then came to the conclusion that,... Hey, I can use a table to display tabular data! My first website back in 97 was layed out with tables (and Frames!), So I have also avoided them ever since better ways became available. But everything has a use case.

  • @adee-xt7vh
    @adee-xt7vh 4 роки тому

    That's why this profession is beautiful. Never-ever ending learning... People (like me) started web development, learned floats and ways of clearfixing it, and turns out we have just one simple line of code for it. Development is getting better and better day by day. Thank you Kevin, please keep doin' these videos, we learn a lot of tricks that makes development fun and easier!

  • @ankursoni4978
    @ankursoni4978 4 роки тому

    This is the best channel i have ever came across for learning front-end development

  • @adnan19672000
    @adnan19672000 Рік тому +1

    Great video that clarified flow-root nicely.
    I hope you make a video for "run-in" display attribute...

  • @TheHermitHacker
    @TheHermitHacker 4 роки тому +6

    Man I needed to know this 25 years ago.

  • @MacSvensson
    @MacSvensson 4 роки тому

    Watched this vid just to learn about something I didn't know about. Turns out this will fix an issue I've had on my to-do since months! On top of that, the explanation is world class! Thanks!

  • @Morrile1
    @Morrile1 4 роки тому

    In typical Kevin Powell style, a small change makes a huge difference, love it!

  • @djordjek3916
    @djordjek3916 3 роки тому

    I always hated floats then doing clear fix as a must every time which takes multiple lines of code. Float-root is a live saver, one line of code instead multiple. Thank you very much Kevin!

  • @Ivsti831
    @Ivsti831 Місяць тому

    look at that beautiful card man!

  • @mtolin82
    @mtolin82 4 роки тому

    Wowww... outstanding!!! no more "clear:both" around!!! Thank you so much!

  • @michaelharings9913
    @michaelharings9913 4 роки тому

    !Amazing. I thought this is obscure and I will forget it, but 1 day after watching I was able to implement it on a webpage. Thanks Kevin!

  • @SuperDHARU
    @SuperDHARU 4 роки тому

    Woww.... Flow-root is like a magical touch for all those floats issues. 🤯🤩
    And I'm very happy to see that you got a YT button for all your efforts. You really explains everything so nicely. I hope you got 1M subscribers soon. 🌟🤘🙂

  • @luiscuenta6789
    @luiscuenta6789 4 роки тому

    You are a pro, awesome video Kevin.

  • @tipsharp6494
    @tipsharp6494 4 роки тому

    Nice new backgroud!!!!

  • @techwake360
    @techwake360 4 роки тому

    Thanks for coming with new thing flow-root . nice

  • @guillermoandradaFSD
    @guillermoandradaFSD 3 роки тому

    You cracked the whole! Thank you for that vid

  • @bw-dude
    @bw-dude 4 роки тому +54

    Once again, the world would be a better place without Internet Explorer ..

    • @nathanwebster2383
      @nathanwebster2383 4 роки тому +18

      Internet Explorer isn't the problem anymore. Now it's Safari. Especially on mobile devices.

    • @ed1nh0
      @ed1nh0 4 роки тому +2

      @@nathanwebster2383 yeah indeed.

    • @akakka2442
      @akakka2442 4 роки тому +3

      Microsoft saw your comment

    • @AndreasDelleske
      @AndreasDelleske 4 роки тому

      @@akakka2442 We are watching you, Microsoft :)

  • @marksolon1874
    @marksolon1874 4 роки тому

    You're the best teacher out there!

  • @castlemoyle
    @castlemoyle 4 роки тому

    This is GREAT! One of the things I do is maintain an obituary page on a local site. It's all Name/Dates as the headline, a picture, and a short biography. I've floated the picture to right or left as you work down the page. Worked great until I get to people with only 2 or 3 lines. Then it broke. Haha. Not any more. Thanks Kevin!

  • @pendaco
    @pendaco 4 роки тому +3

    Wouldn't overflow: auto on the .card do the same?

  • @hezekiahvaldez2943
    @hezekiahvaldez2943 4 роки тому

    cool! thanks a lot sir @kevin powell

  • @gideonokokoro5024
    @gideonokokoro5024 4 роки тому

    Nice one, nice float trick

  • @HeyNoah
    @HeyNoah 3 роки тому

    That's really neat!

  • @kristianulvund4274
    @kristianulvund4274 4 роки тому

    Thanks Kevin🤩

  • @eddier.6749
    @eddier.6749 4 роки тому

    Great video and great info as always, thank you.

  • @boneykingofsomewhere
    @boneykingofsomewhere 4 роки тому

    0 dislikes! wow doesn't deserve any dislikes but that's rare to see on any video, GG Kevin.

  • @clevermissfox
    @clevermissfox 6 місяців тому +1

    Is the Flow-root behaviour similar to “contain”? Since it’s a self-contained element once declared ?

  • @travezripley
    @travezripley 4 роки тому

    Thanks Kev!

  • @SpencerTaylorOnline
    @SpencerTaylorOnline 4 роки тому

    Awesome, this is truly helpful!

  • @arijitroy5425
    @arijitroy5425 Рік тому

    Wanted to understand how flow-root works with overflow clip. I have going nuts to make position: sticky work in a horizontally overflowing container(which also needs to be programmatically scrollable). Any pointer guys ?

  • @citizen0003
    @citizen0003 4 роки тому

    Very interesting... I think this can be a very useful tool at times... I've never seen this before.

  • @wolfenrico
    @wolfenrico 4 роки тому

    Great! Thanks!

  •  4 роки тому

    Wow. Would this help making component containers (docks, panels) work with any content? Primarily asking for forms like web applications.

  • @digitalinvestors9ja390
    @digitalinvestors9ja390 2 роки тому

    Sir which book do you prescribe for learners in css

  • @WahTzH3k
    @WahTzH3k 4 роки тому

    Life Changing

  • @MohammadAbdulHyeShaon
    @MohammadAbdulHyeShaon 4 роки тому

    Great...... Awesome..... Go Ahead

  • @yinonelbaz5309
    @yinonelbaz5309 3 роки тому

    you are the best!

  • @jobiryusupov8188
    @jobiryusupov8188 2 роки тому

    We can write overflow: auto instead of display:flow-root. what is diffirence?

  • @kuthathwe
    @kuthathwe Рік тому

    great video

  • @iamstickfigure
    @iamstickfigure 4 роки тому

    Another thing that seems to behave similarly to floats is "position: absolute". I say it behaves similarly because of the same effect of a child div suddenly not affecting the size of the parent div.
    My question was, would "display: flow-root" also solve the issue with "position: absolute" causing the parent div to ignore the existence of the child element?
    I answered this question myself by trying it out in codepen. No, it does not have the same effect on "position: absolute"
    Any idea why that is?

    stuff

    // flow-root does not solve the issue (div.a does not grow to fit div.b)
    .a {
    padding: 50px;
    background: red;
    display: flow-root;
    }
    .b {
    background: yellow;
    position: absolute;

    width: 50px;
    height: 50px;
    }
    // flow-root solves the issue as shown in the video (div.a grows to fit div.b)
    .a {
    padding: 50px;
    background: red;
    display: flow-root;
    }
    .b {
    background: yellow;
    position: absolute;

    width: 50px;
    height: 50px;
    }

  • @flyinghead1147
    @flyinghead1147 3 роки тому

    Hello. I don't understand something. Is clearfix only for floats. I never use floats and I never got this problem. So it's a float problem?

    • @KevinPowell
      @KevinPowell  3 роки тому +1

      Yup, clearfix is only for floats :)

  • @Hotatoes
    @Hotatoes 4 роки тому

    wow that's fix alot of stuff to me :D lol thanks so much kiven :D all the love from egypt :D

  • @nima_arf
    @nima_arf 4 роки тому

    🔥 short videos, valuable info 🔥
    thanks

  • @christianachleitner9439
    @christianachleitner9439 4 роки тому

    awsome dude :)

  • @sreesai1692
    @sreesai1692 4 роки тому

    What I understand is that instead of using clearfix this can help us right?

  • @CharlesSmall
    @CharlesSmall 4 роки тому

    I like this video, but can you help me. How do i start a new project. Every time when i start new the previous html /css folder popup. Maybe is missed it in anther tutorial. I am in my learner shoes .

  • @mattwood8659
    @mattwood8659 4 роки тому

    I remember watching this video when you first posted it. And I remembered to use it on a project I'm currently working on. Until... I don't remember if yiu mention it in the video... But when it came to testing it doesn't work in edge. So I had to still use clear anyway which makes the flow root redundant to use anyway

    • @KevinPowell
      @KevinPowell  4 роки тому

      It should work in Edge, which is up to version 83, it's been supported since 79. IE is the issue, if you're supporting it.

  • @mahmoudal7allaj130
    @mahmoudal7allaj130 4 роки тому

    thank you.

  • @nathancornwell1455
    @nathancornwell1455 4 роки тому +1

    I share your content literally everywhere i can. I know you have reservations about doing a JS course but have you ever considered a collaboration on like maybe a projects type of course where you focus on the CSS and another developer could maybe focus on the js? I have your scrimba course and im currently studying JS and i find myself referencing back to the scrimba course when i try to add extra functionality and style the extra content in case I'm stuck , so it would be awesome to do both at the same time. Anywho , thanks for sharing all your knowledge, its invaluable!

  • @vanyastaleva415
    @vanyastaleva415 4 роки тому

    What editor are you using?

  • @ShukurAlRawi
    @ShukurAlRawi 4 роки тому

    Thanks

  • @SurenEnfiajyan
    @SurenEnfiajyan 3 роки тому

    For container I used display: inline-block; width: 100%; this will also fix + compatible with IE

  • @michalnowak2181
    @michalnowak2181 2 роки тому

    thx

  • @amitsinha5621
    @amitsinha5621 4 роки тому

    whats for clear fix ? am I confused ;-(

  • @dgknca
    @dgknca 4 роки тому

    what is your camera brand model?

  • @JayJames
    @JayJames 4 роки тому

    Great video! IE11 doesn't seem to support anything 😅

  • @bobbynicholson5329
    @bobbynicholson5329 4 роки тому

    Can you do a comprehensive video on shape-around with text and images? Greatly appreciate it!

  • @yacine-55-q5TVu
    @yacine-55-q5TVu 4 роки тому

    interesting property . what about that conquering responsive layouts :D i missed it the first time and still waiting for it :D ?

    • @KevinPowell
      @KevinPowell  4 роки тому +1

      Another month, maybe longer. Got some things to fix up 👍

  • @RimantasBelovas
    @RimantasBelovas 4 роки тому

    And yet the best way to fix float issues is actually using a display: inline-block on parent element.

  • @dortaltal3184
    @dortaltal3184 2 роки тому

    nice ;)

  • @techtipsuk
    @techtipsuk 4 роки тому

    Overflow would also do that

    • @KevinPowell
      @KevinPowell  4 роки тому

      Yup, but it can have unintended consequences as it does other stuff, whereas this only does that one thing

  • @siddharthasharma9731
    @siddharthasharma9731 4 роки тому

    Please do compare with clearfix.

    • @KevinPowell
      @KevinPowell  4 роки тому

      Not much to compare, is there? They'll both get you exactly the same result. only advantage with clearfix is support in IE

    • @siddharthasharma9731
      @siddharthasharma9731 4 роки тому

      @@KevinPowell yes you are right, result are same but I think that clearfix is like a HACK unlike flow-root...... I hope you get my point
      Thanks Kevin for such Informative videos.
      I was not aware with flow-root property before viewed your video so I just want to know that clearfix done same to us then what will be further benefit of flow-root over the clearfix?

  • @nathanwebster2383
    @nathanwebster2383 4 роки тому

    You talk about the clear-fix, but no mention of overflow: hidden which is how I usually address this.

    • @pulok9909
      @pulok9909 4 роки тому +2

      there is some problem with overflow: hidden rather you should use clear-fix. it is good practice. now you learn about display: flow-root. you can use it too. thank you.

    • @KevinPowell
      @KevinPowell  4 роки тому

      The reason that worked is the same as flow-root, it creates a new formatting context, but it can have unintended consequences, which is why this is better suited 😊

    • @nathanwebster2383
      @nathanwebster2383 4 роки тому

      @@KevinPowell You both indicate it creates problems, but in 25 years of web development I have yet to see whatever those problems might be. Clear-fix requires another element be added and that's each time you use it..

    • @edwardgray6167
      @edwardgray6167 4 роки тому

      @@nathanwebster2383 you can apply clear fix via an ::after pseudo element on the container. Assuming you have no other use for it. 😁

  • @soniablanche5672
    @soniablanche5672 4 роки тому

    So what you're saying is... it's a clear fix?

  • @KelseyThornton
    @KelseyThornton 2 роки тому

    Wonders... Is this now superseded by "isolate"?

  • @andrewt248
    @andrewt248 4 роки тому

    If you're using a clearFix mixin in SASS, you can switch it to this, but also keep the old clearFix hack in there and wrap it in an IE conditional media query. www.mediacurrent.com/blog/pro-tip-how-write-conditional-css-ie10-and-11/

  • @ed1nh0
    @ed1nh0 4 роки тому +1

    "No support for IE"... We'll listen this statement and see that red flag on caniuse.com until the next meteor touch the Earth.

  • @mymusic7262
    @mymusic7262 3 роки тому

    New website? Why wouldnt you float images on a new website? Text flowing around an image is a standard pattern which I use every day.

    • @KevinPowell
      @KevinPowell  3 роки тому

      Oh for sure, I even out a video out today looking at using shape-outside with floats. It's just much less common, and not for making layouts 😊

  • @gabydewilde
    @gabydewilde 4 роки тому

    next episode x-path

  • @nigelpallatt
    @nigelpallatt 4 роки тому

    flow-root did nothing 4 me!? WHAT????

  • @joserabn7156
    @joserabn7156 4 роки тому

    RIP clearfix

  • @vuufke4327
    @vuufke4327 2 роки тому

    if you have to use floats you can't use flow root

  • @animation8.0
    @animation8.0 3 роки тому

    well, out topic! you look a lot like Mark Zuckerberg, especially when you talk!

  • @cheezy69
    @cheezy69 4 роки тому

    Hey I just wanted to ask what font family you use in your website because I like that font and I wanna use it

    • @KevinPowell
      @KevinPowell  4 роки тому

      It's called Basic Sans. It's not a free font though, I'm using Adobe Fonts

    • @cheezy69
      @cheezy69 4 роки тому

      @@KevinPowell oh thx